Carna  Version 3.3.2
DVRStage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 - 2015 Leonid Kostrykin
3  *
4  * Chair of Medical Engineering (mediTEC)
5  * RWTH Aachen University
6  * Pauwelsstr. 20
7  * 52074 Aachen
8  * Germany
9  *
10  */
11 
12 #ifndef DVRSTAGE_H_6014714286
13 #define DVRSTAGE_H_6014714286
14 
16 #include <Carna/Carna.h>
17 #include <memory>
18 
23 namespace Carna
24 {
25 
26 namespace presets
27 {
28 
29 
30 
31 // ----------------------------------------------------------------------------------
32 // DVRStage
33 // ----------------------------------------------------------------------------------
34 
101 class CARNA_LIB DVRStage : public VolumeRenderingStage
102 {
103 
104  struct Details;
105  const std::unique_ptr< Details > pimpl;
106 
107 public:
108 
113  const static unsigned int ROLE_INTENSITIES = 0;
114 
119  const static unsigned int ROLE_NORMALS = 1;
120 
124  const static float DEFAULT_TRANSLUCENCE;
125 
130  const static float DEFAULT_DIFFUSE_LIGHT;
131 
140  explicit DVRStage( unsigned int geometryType, unsigned int colorMapResolution = ( 1 << 12 ) );
141 
145  virtual ~DVRStage();
146 
147  DVRStage* clone() const override;
148 
149  virtual void reshape( base::FrameRenderer& fr, unsigned int width, unsigned int height ) override;
150 
151  virtual void renderPass
152  ( const base::math::Matrix4f& viewTransform
153  , base::RenderTask& rt
154  , const base::Viewport& vp ) override;
155 
160  void clearColorMap();
161 
174  void writeColorMap( const base::math::Span< float >& intensityRange, const base::math::Span< base::Color > colorRange );
175 
178  void writeColorMap( float intensityFirst, float intensityLast, const base::Color& colorFirst, const base::Color& colorLast );
179 
183  void setTranslucence( float translucence );
184 
188  float translucence() const;
189 
199  void setDiffuseLight( float diffuseLight );
200 
205  float diffuseLight() const;
206 
211  bool isLightingUsed() const;
212 
213 protected:
214 
215  virtual unsigned int loadVideoResources() override;
216 
217  virtual void createVolumeSamplers( const std::function< void( unsigned int, base::Sampler* ) >& registerSampler ) override;
218 
222  virtual const base::ShaderProgram& acquireShader() override;
223 
227  virtual const std::string& uniformName( unsigned int role ) const override;
228 
229  virtual void configureShader() override;
230 
234  virtual void configureShader( const base::Renderable& ) override;
235 
236 }; // DVRStage
237 
238 
239 
240 } // namespace Carna :: presets
241 
242 } // namespace Carna
243 
244 #endif // DVRSTAGE_H_6014714286
static const float DEFAULT_DIFFUSE_LIGHT
Holds the default diffuse light amount. The ambient light amount is always one minus the diffuse ligh...
Definition: DVRStage.h:130
static const float DEFAULT_TRANSLUCENCE
Holds the default translucence.
Definition: DVRStage.h:124
Defines logic for rendering frames from given scenes.
Definition: FrameRenderer.h:69
Maintains an OpenGL shader program. Realizes the RAII-idiom.
Definition: ShaderProgram.h:47
Invokes the rendering stages of the frame renderer successively.
Definition: RenderTask.h:40
Maintains an OpenGL texture sampler object. This class realizes the RAII-idiom.
Definition: Sampler.h:44
Defines abstract base class for rendering stages that render volume geometries in the scene...
Represents a color. Objects from this class are copyable and assignable.
Definition: Color.h:41
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
Definition: math.h:193
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Definition: Viewport.h:48
Represents a Geometry object that has been queued into a RenderQueue. The object&#39;s model-view transfo...
Definition: Renderable.h:45
Performs direct volume renderings of the volume geometries in the scene.
Definition: DVRStage.h:101
Defines Carna::presets::VolumeRenderingStage.