rawVolModel.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef EVOLVE_RAW_VOL_MODEL_H
00018 #define EVOLVE_RAW_VOL_MODEL_H
00019
00020 #include <eq/eq.h>
00021
00022 namespace eVolve
00023 {
00024
00040 struct DataInTextureDimensions
00041 {
00042 float W;
00043 float H;
00044 float D;
00045 float Do;
00046 float Db;
00047 };
00048
00051 struct VolumeScaling
00052 {
00053 float W;
00054 float H;
00055 float D;
00056 };
00057
00058 struct VolumeInfo
00059 {
00060 GLuint volume;
00061 GLuint preint;
00062 VolumeScaling volScaling;
00063 DataInTextureDimensions TD;
00064 };
00065
00067 class RawVolumeModel
00068 {
00069 public:
00070 RawVolumeModel( const std::string& filename );
00071
00072 bool loadHeader( const float brightness, const float alpha );
00073
00074 bool getVolumeInfo( VolumeInfo& info, const eq::Range& range );
00075
00076 void releaseVolumeInfo( const eq::Range& range );
00077
00078 const std::string& getFileName() const { return _filename; };
00079 uint32_t getResolution() const { return _resolution; };
00080 const VolumeScaling& getVolumeScaling() const { return _volScaling; };
00081
00082 void glewSetContext( GLEWContext* context ) { _glewContext = context; }
00083
00084 GLEWContext* glewGetContext() { return _glewContext; }
00085
00086 protected:
00087
00088 bool _createVolumeTexture(
00089 GLuint& volume,
00090 DataInTextureDimensions& TD,
00091 const eq::Range& range );
00092
00093 private:
00094 bool _lFailed( char* msg )
00095 { EQERROR << msg << std::endl; return false; }
00096
00097 struct VolumePart
00098 {
00099 GLuint volume;
00100 DataInTextureDimensions TD;
00101 };
00102
00103 stde::hash_map< int32_t, VolumePart > _volumeHash;
00104
00105 bool _headerLoaded;
00106 std::string _filename;
00107
00108 GLuint _preintName;
00109
00110 uint32_t _w;
00111 uint32_t _h;
00112 uint32_t _d;
00113 uint32_t _resolution;
00114
00115 VolumeScaling _volScaling;
00116
00117 std::vector< uint8_t > _TF;
00118
00119 GLEWContext* _glewContext;
00120 };
00121
00122 }
00123
00124 #endif // EVOLVE_RAW_VOL_MODEL_H