00001
00002
00003
00004 #ifndef _VUVOLUMEREGULARUNIMODAL3D1B1VALRAYCAST_H_
00005 #define _VUVOLUMEREGULARUNIMODAL3D1B1VALRAYCAST_H_
00006
00007 #include "../intensity.h"
00008 #include "vuTFunc/vuTFPreintegrated.h"
00009
00010 #include "vuSimpleTypes.h"
00011 #include "vuVector.h"
00012 #include "vuThread.h"
00013
00014 #include "vuSampleRay.h"
00015 #include "vuImage.h"
00016
00017 enum {
00018 TFUNC_SMP = 0,
00019 TFUNC_PI,
00020 TFUNC_PIAW,
00021 };
00022
00023 using namespace ns_vu1112113;
00024
00025 class vu1112113;
00026 typedef vu1112113 vuVolumeRegularUnimodal3d1B1ValRaycast;
00033 class vu1112113 : public vu111211, public vuThread
00034 {
00035 friend class DatGrid;
00036 friend class DatPnt;
00037 public:
00038
00040 vu1112113();
00042 vu1112113(const vu1112113& inst);
00044 virtual ~vu1112113();
00045
00047 vu1112113& operator=(const vu1112113& rhs);
00048
00050 void setViewVectors(const vuVector& pos,const vuVector& vrp,const vuVector& up);
00051
00053 void initOpenGL(void);
00055 void render();
00056
00058 virtual bool read();
00059
00061 virtual bool readRaw(void);
00062
00064 void setImageSize(dword sx, dword sy);
00066 void getImageSize(dword &sx, dword &sy);
00068
00069 void doRefresh();
00071 vuVector getCenter() const;
00072
00074 void doPreviewDraw(bool predraw = true) { m_PreDraw = predraw; };
00076 void setSamplingDistance(float smpdist) {m_SamplingDistance = smpdist; };
00078 void doSpecular(bool dospec) {m_DoSpecular = dospec; };
00083 void setTFuncMethod(int which) {
00084 m_TFuncMethod = which;
00085 m_TFuncPI.useAlphaWeighting(which == TFUNC_PIAW);
00086 m_TFuncPI.preintegrate();
00087 };
00088
00089 vuImage* getImage ();
00090
00091 void displayFromImage ();
00092
00093 private:
00096 void run(int whatsup, void* data);
00105 void shootRays(int xofs=0, int xinc=1, int yofs=0, int yinc=1);
00106
00108 void preprocess(void);
00110 vuColourRGBa Cast(vuSampleRay& Vray);
00111
00112 private:
00113 vuTFPreintegrated m_TFuncPI;
00114 vuVector center;
00115 DatGrid m_Grid;
00116
00117 vuImage m_Image;
00118 vuVector lightdir;
00119 float brightness;
00120 float diffuse;
00121 vuColourRGBa m_Specular;
00122 vuColourRGBa m_Background;
00123 bool pp_gradients;
00124 bool m_PreDraw;
00125 float m_SamplingDistance;
00126 vuMutex m_Mutex[2];
00127 bool m_DoSpecular;
00128 int m_TFuncMethod;
00129 };
00130
00131 #endif