Equalizer  1.6.1
rawVolModel.h
1 
2 /* Copyright (c) 2007 Maxim Makhinya
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * - Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  * - Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * - Neither the name of Eyescale Software GmbH nor the names of its
13  * contributors may be used to endorse or promote products derived from this
14  * software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef EVOLVE_RAW_VOL_MODEL_H
30 #define EVOLVE_RAW_VOL_MODEL_H
31 
32 #include <eq/eq.h>
33 
34 namespace eVolve
35 {
36 
53  {
54  float W;
55  float H;
56  float D;
57  float Do;
58  float Db;
59  };
60 
64  {
65  float W;
66  float H;
67  float D;
68  };
69 
70  struct VolumeInfo
71  {
72  GLuint volume;
73  GLuint preint;
78  };
79 
82  {
83  public:
84  RawVolumeModel( const std::string& filename );
85 
86  bool loadHeader( const float brightness, const float alpha );
87 
88  bool getVolumeInfo( VolumeInfo& info, const eq::Range& range );
89 
90  void releaseVolumeInfo( const eq::Range& range );
91 
92  const std::string& getFileName() const { return _filename; };
93  uint32_t getResolution() const { return _resolution; };
94  const VolumeScaling& getVolumeScaling() const { return _volScaling; };
95 
96  void glewSetContext( const GLEWContext* context )
97  { _glewContext = context; }
98 
99  const GLEWContext* glewGetContext() const { return _glewContext; }
100 
101  protected:
102 
103  bool _createVolumeTexture( GLuint& volume,
105  const eq::Range& range );
106 
107  private:
108  bool _lFailed( char* msg )
109  { LBERROR << msg << std::endl; return false; }
110 
111  struct VolumePart
112  {
113  GLuint volume;
115  };
116 
117  stde::hash_map< int32_t, VolumePart > _volumeHash;
118 
119  bool _headerLoaded;
120  std::string _filename;
121 
122  GLuint _preintName;
123 
124  uint32_t _w;
125  uint32_t _h;
126  uint32_t _d;
127  uint32_t _tW;
128  uint32_t _tH;
129  uint32_t _tD;
130  uint32_t _resolution;
131 
132  VolumeScaling _volScaling;
133 
134  std::vector< uint8_t > _TF;
135 
136  bool _hasDerivatives;
137 
138  const GLEWContext* _glewContext;
139  };
140 
141 }
142 
143 #endif // EVOLVE_RAW_VOL_MODEL_H
Load model to texture.
Definition: rawVolModel.h:81
VolumeScaling volScaling
Proportions of volume.
Definition: rawVolModel.h:74
GLuint volume
3D texture ID
Definition: rawVolModel.h:72
float H
height scale
Definition: rawVolModel.h:66
float Db
Depth border (necessary for preintegration)
Definition: rawVolModel.h:58
float D
Depth of data in texture (0..1].
Definition: rawVolModel.h:56
DataInTextureDimensions TD
Data dimensions within volume texture.
Definition: rawVolModel.h:76
float W
Width of data in texture (0..1].
Definition: rawVolModel.h:54
Structure that contain actual dimensions of data that is stored in volume texture.
Definition: rawVolModel.h:52
Contain overal volume proportions relatively [-1,-1,-1]..[1,1,1] cube.
Definition: rawVolModel.h:63
float D
depth scale
Definition: rawVolModel.h:67
float W
width scale
Definition: rawVolModel.h:65
VolumeScaling voxelSize
Relative volume size (0..1].
Definition: rawVolModel.h:75
GLuint preint
preintegration table texture
Definition: rawVolModel.h:73
bool hasDerivatives
true if raw+der used
Definition: rawVolModel.h:77
bool _createVolumeTexture(GLuint &volume, DataInTextureDimensions &TD, const eq::Range &range)
Reading requested part of volume and derivatives from data file.
float H
Height of data in texture (0..1].
Definition: rawVolModel.h:55
float Do
Depth offset (start of range)
Definition: rawVolModel.h:57