Equalizer  1.6.1
rawVolModelRenderer.h
1 
2 /* Copyright (c) 2007-2011, Maxim Makhinya <maxmah@gmail.com>
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_RENDERER_H
30 #define EVOLVE_RAW_VOL_MODEL_RENDERER_H
31 
32 #include "rawVolModel.h"
33 #include "sliceClipping.h"
34 #include "glslShaders.h"
35 
36 
37 namespace eVolve
38 {
39 
41  {
42  public:
43  RawVolumeModelRenderer( const std::string& filename,
44  const uint32_t precision = 1 );
45 
46  bool loadHeader( const float brightness, const float alpha )
47  {
48  return _rawModel.loadHeader( brightness, alpha );
49  }
50 
51  const VolumeScaling& getVolumeScaling() const
52  {
53  return _rawModel.getVolumeScaling();
54  }
55 
56  void glewSetContext( const GLEWContext* context )
57  {
58  _glewContext = context;
59  _rawModel.glewSetContext( context );
60  }
61 
62 
63  bool render( const eq::Range& range,
64  const eq::Matrix4d& modelviewM,
65  const eq::Matrix3d& modelviewITM,
66  const eq::Matrix4f& invRotationM,
67  const eq::Vector4f& taintColor,
68  const int normalsQuality );
69 
70  void setPrecision( const uint32_t precision ){ _precision = precision; }
71  void setOrtho( const uint32_t ortho ) { _ortho = ortho; }
72 
73  const GLEWContext* glewGetContext() { return _glewContext; }
74  bool loadShaders();
75 
76  private:
77  void _putVolumeDataToShader( const VolumeInfo& volumeInfo,
78  const float sliceDistance,
79  const eq::Matrix4f& invRotationM,
80  const eq::Vector4f& taintColor,
81  const int normalsQuality );
82 
83  RawVolumeModel _rawModel;
84  SliceClipper _sliceClipper;
85  uint32_t _precision;
86  GLSLShaders _shaders;
87 
88  const GLEWContext* _glewContext;
89 
90  bool _ortho;
91 
92  };
93 
94 }
95 #endif // EVOLVE_RAW_VOL_MODEL_RENDERER_H
96 
Load model to texture.
Definition: rawVolModel.h:81
Contain overal volume proportions relatively [-1,-1,-1]..[1,1,1] cube.
Definition: rawVolModel.h:63