Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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  // cppcheck-suppress unusedStructMember
66  float W;
67  // cppcheck-suppress unusedStructMember
68  float H;
69  // cppcheck-suppress unusedStructMember
70  float D;
71  };
72 
73  struct VolumeInfo
74  {
75  GLuint volume;
76  GLuint preint;
80  };
81 
84  {
85  public:
86  RawVolumeModel( const std::string& filename );
87 
88  bool loadHeader( const float brightness, const float alpha );
89 
90  bool getVolumeInfo( VolumeInfo& info, const eq::Range& range );
91 
92  void releaseVolumeInfo( const eq::Range& range );
93 
94  const std::string& getFileName() const { return _filename; }
95  uint32_t getResolution() const { return _resolution; }
96  const VolumeScaling& getVolumeScaling() const { return _volScaling; }
97 
98  void glewSetContext( const GLEWContext* context )
99  { _glewContext = context; }
100 
101  const GLEWContext* glewGetContext() const { return _glewContext; }
102 
103  protected:
104 
105  bool _createVolumeTexture( GLuint& volume,
107  const eq::Range& range );
108 
109  private:
110  bool _lFailed( char* msg )
111  { LBERROR << msg << std::endl; return false; }
112 
113  struct VolumePart
114  {
115  GLuint volume;
117  };
118 
119  stde::hash_map< int32_t, VolumePart > _volumeHash;
120 
121  bool _headerLoaded;
122  std::string _filename;
123 
124  GLuint _preintName;
125 
126  uint32_t _w;
127  uint32_t _h;
128  uint32_t _d;
129  uint32_t _tW;
130  uint32_t _tH;
131  uint32_t _tD;
132  uint32_t _resolution;
133 
134  VolumeScaling _volScaling;
135 
136  std::vector< uint8_t > _TF;
137 
138  bool _hasDerivatives;
139 
140  const GLEWContext* _glewContext;
141  };
142 
143 }
144 
145 #endif // EVOLVE_RAW_VOL_MODEL_H
VolumeScaling voxelSize
Relative volume size (0..1].
Definition: rawVolModel.h:78
Load model to texture.
Definition: rawVolModel.h:83
GLuint volume
3D texture ID
Definition: rawVolModel.h:75
bool _createVolumeTexture(GLuint &volume, DataInTextureDimensions &TD, const eq::Range &range)
Reading requested part of volume and derivatives from data file.
GLuint preint
preintegration table texture
Definition: rawVolModel.h:76
float D
Depth of data in texture (0..1].
Definition: rawVolModel.h:56
float Do
Depth offset (start of range)
Definition: rawVolModel.h:57
DataInTextureDimensions TD
Data dimensions within volume texture.
Definition: rawVolModel.h:79
float D
depth scale
Definition: rawVolModel.h:70
float W
width scale
Definition: rawVolModel.h:66
Contain overall volume proportions relatively [-1,-1,-1]..[1,1,1] cube.
Definition: rawVolModel.h:63
float Db
Depth border (necessary for preintegration)
Definition: rawVolModel.h:58
float W
Width of data in texture (0..1].
Definition: rawVolModel.h:54
float H
height scale
Definition: rawVolModel.h:68
VolumeScaling volScaling
Proportions of volume.
Definition: rawVolModel.h:77
float H
Height of data in texture (0..1].
Definition: rawVolModel.h:55
Structure that contain actual dimensions of data that is stored in volume texture.
Definition: rawVolModel.h:52