Equalizer 1.0
|
00001 00002 /* Copyright (c) 2007 Maxim Makhinya 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are met: 00006 * 00007 * - Redistributions of source code must retain the above copyright notice, this 00008 * list of conditions and the following disclaimer. 00009 * - Redistributions in binary form must reproduce the above copyright notice, 00010 * this list of conditions and the following disclaimer in the documentation 00011 * and/or other materials provided with the distribution. 00012 * - Neither the name of Eyescale Software GmbH nor the names of its 00013 * contributors may be used to endorse or promote products derived from this 00014 * software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00017 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00018 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00019 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00020 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00021 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00022 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00023 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00024 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00025 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00026 * POSSIBILITY OF SUCH DAMAGE. 00027 */ 00028 00029 #ifndef EVOLVE_RAW_VOL_MODEL_H 00030 #define EVOLVE_RAW_VOL_MODEL_H 00031 00032 #include <eq/eq.h> 00033 00034 namespace eVolve 00035 { 00036 00052 struct DataInTextureDimensions 00053 { 00054 float W; 00055 float H; 00056 float D; 00057 float Do; 00058 float Db; 00059 }; 00060 00063 struct VolumeScaling 00064 { 00065 float W; 00066 float H; 00067 float D; 00068 }; 00069 00070 struct VolumeInfo 00071 { 00072 GLuint volume; 00073 GLuint preint; 00074 VolumeScaling volScaling; 00075 DataInTextureDimensions TD; 00076 }; 00077 00079 class RawVolumeModel 00080 { 00081 public: 00082 RawVolumeModel( const std::string& filename ); 00083 00084 bool loadHeader( const float brightness, const float alpha ); 00085 00086 bool getVolumeInfo( VolumeInfo& info, const eq::Range& range ); 00087 00088 void releaseVolumeInfo( const eq::Range& range ); 00089 00090 const std::string& getFileName() const { return _filename; }; 00091 uint32_t getResolution() const { return _resolution; }; 00092 const VolumeScaling& getVolumeScaling() const { return _volScaling; }; 00093 00094 void glewSetContext( const GLEWContext* context ) 00095 { _glewContext = context; } 00096 00097 const GLEWContext* glewGetContext() const { return _glewContext; } 00098 00099 protected: 00100 00101 bool _createVolumeTexture( GLuint& volume, 00102 DataInTextureDimensions& TD, 00103 const eq::Range& range ); 00104 00105 private: 00106 bool _lFailed( char* msg ) 00107 { EQERROR << msg << std::endl; return false; } 00108 00109 struct VolumePart 00110 { 00111 GLuint volume; 00112 DataInTextureDimensions TD; 00113 }; 00114 00115 stde::hash_map< int32_t, VolumePart > _volumeHash; 00116 00117 bool _headerLoaded; 00118 std::string _filename; 00119 00120 GLuint _preintName; 00121 00122 uint32_t _w; 00123 uint32_t _h; 00124 uint32_t _d; 00125 uint32_t _resolution; 00126 00127 VolumeScaling _volScaling; 00128 00129 std::vector< uint8_t > _TF; 00130 00131 const GLEWContext* _glewContext; 00132 }; 00133 00134 } 00135 00136 #endif // EVOLVE_RAW_VOL_MODEL_H