Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
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::Matrix4f& invRotationM,
66  const eq::Vector4f& taintColor,
67  const int normalsQuality );
68 
69  void setPrecision( const uint32_t precision ){ _precision = precision; }
70  void setOrtho( const uint32_t ortho ) { _ortho = ortho; }
71 
72  const GLEWContext* glewGetContext() { return _glewContext; }
73  bool loadShaders();
74 
75  private:
76  void _putVolumeDataToShader( const VolumeInfo& volumeInfo,
77  const float sliceDistance,
78  const eq::Matrix4f& invRotationM,
79  const eq::Vector4f& taintColor,
80  const int normalsQuality );
81 
82  RawVolumeModel _rawModel;
83  SliceClipper _sliceClipper;
84  uint32_t _precision;
85  GLSLShaders _shaders;
86 
87  const GLEWContext* _glewContext;
88 
89  bool _ortho;
90 
91  };
92 
93 }
94 #endif // EVOLVE_RAW_VOL_MODEL_RENDERER_H
95 
Load model to texture.
Definition: rawVolModel.h:83
Contain overall volume proportions relatively [-1,-1,-1]..[1,1,1] cube.
Definition: rawVolModel.h:63