00001 // Author: Steven Bergner 00002 // Created: Oct01 00003 00004 #ifndef _VUVOLUMEREGULARUNIMODAL3D1B1VALSPECTRAL_H_ 00005 #define _VUVOLUMEREGULARUNIMODAL3D1B1VALSPECTRAL_H_ 00006 00007 #include "../intensity.h" 00008 #include "vuSimpleTypes.h" 00009 #include "vuVector.h" 00010 #include "vuSampleRay.h" 00011 #include "vuThread.h" 00012 00013 #include "DatGrid.h" 00014 #include "vuSpectralImage.h" 00015 #include "vuImage.h" 00016 #include "Util.h" 00017 #include "Material.h" 00018 00019 #define NUM_LIGHTS 2 00020 00021 namespace ns_vu1112112 { 00022 using namespace ns_vu1112112; 00023 00030 class vu1112112; 00031 typedef vu1112112 vuVolumeRegularUnimodal3d1B1ValSpectral; 00038 class vu1112112 : public vu111211, public vuThread 00039 { 00040 friend class Parser; 00041 friend class DatGrid; 00042 friend class DatPnt; 00043 public: 00045 vu1112112(); 00047 vu1112112(const vu1112112& inst); 00049 virtual ~vu1112112(); 00050 00052 vu1112112& operator=(const vu1112112& rhs); 00053 00055 void setViewVectors(const vuVector& pos,const vuVector& vrp,const vuVector& up); 00056 00058 void initOpenGL(void); 00060 void render(); 00061 00063 virtual bool read(); 00064 00066 virtual bool readRaw(void); 00067 00069 bool add_material(Material &mat); 00071 bool add_light(ColourType &lc); 00073 00076 bool load_scene(const char *filename); 00078 00079 bool load_volume(char* name); 00081 void setLight(const vuColour31a &light); 00083 void setImageSize(dword sx, dword sy); 00085 00086 void doRefresh(); 00088 vuVector getCenter(); 00089 00090 vuImage* getImage (); 00091 00093 void setDoSpecular(bool doit = true) { m_DoSpecular = doit; } 00095 bool getDoSpecular() { return m_DoSpecular; } 00097 void setDrawPreview(bool doit = true) { m_DrawPreview = doit; } 00099 bool getDrawPreview() {return m_DrawPreview; } 00101 float& getShininess() {return m_Shininess; } 00103 float& getGloss() {return m_Gloss; } 00105 void setObserverLight(bool moveit=true) 00106 { m_ObserverLight = moveit; } 00108 void setLightDir(const vuVector& lightdir) { 00109 m_LightDir = lightdir; 00110 Grid.shade(*this); 00111 } 00113 const vuVector& getLightDir() const { return m_LightDir; } 00114 00115 private: 00118 void run(int whatsup, void* data); 00127 void shootRays(int xofs=0, int xinc=1, int yofs=0, int yinc=1); 00129 void preprocess(void); 00131 ColourType Cast(vuSampleRay& Vray); 00132 00133 private: 00134 vuVector center; 00135 00136 DatGrid Grid; 00137 ColourType Background; 00138 vuColour31a Ambient; 00139 ColourType m_Light[NUM_LIGHTS]; 00140 00143 ColourType TFLUT_scatt[255]; 00144 00147 ColourType TFLUT_absor[255]; 00148 00149 int numlights; 00150 Material mat[MAT_NUM_MATERIALS]; 00151 int nummat; 00152 vuSpectralImage spimg; 00153 vuImage rgbimg; 00154 vuVector m_LightDir; 00155 bool m_ObserverLight; 00156 float brightness; 00157 float diffuse; 00158 float light_scale; 00159 bool re_light, re_render; 00160 00162 byte *imgbuf; 00163 bool use_flat_absorption; 00164 bool pp_gradients; 00165 vuMutex m_Mutex[2]; 00166 00167 bool m_DoSpecular; 00168 bool m_DrawPreview; 00169 float m_Shininess; 00170 float m_Gloss; 00171 }; 00172 00173 } // end of namespace 00174 00175 #endif