Carna  Version 3.0.1
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_HU_VOLUME = 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 
136  DVRStage( unsigned int geometryType );
137 
141  virtual ~DVRStage();
142 
143  DVRStage* clone() const override;
144 
145  virtual void reshape( base::FrameRenderer& fr, unsigned int width, unsigned int height ) override;
146 
147  virtual void renderPass
148  ( const base::math::Matrix4f& viewTransform
149  , base::RenderTask& rt
150  , const base::Viewport& vp ) override;
151 
156  void clearColorMap();
157 
167  void writeColorMap( const base::math::Span< base::HUV >& huRange, const base::math::Span< base::Color > colorRange );
168 
171  void writeColorMap( base::HUV huFirst, base::HUV huLast, const base::Color& colorFirst, const base::Color& colorLast );
172 
176  void setTranslucence( float translucence );
177 
181  float translucence() const;
182 
192  void setDiffuseLight( float diffuseLight );
193 
198  float diffuseLight() const;
199 
204  bool isLightingUsed() const;
205 
206 protected:
207 
208  virtual unsigned int loadVideoResources() override;
209 
210  virtual void createVolumeSamplers( const std::function< void( unsigned int, base::Sampler* ) >& registerSampler ) override;
211 
215  virtual const base::ShaderProgram& acquireShader() override;
216 
220  virtual const std::string& uniformName( unsigned int role ) const override;
221 
222  virtual void configureShader() override;
223 
227  virtual void configureShader( const base::Renderable& ) override;
228 
229 }; // DVRStage
230 
231 
232 
233 } // namespace Carna :: presets
234 
235 } // namespace Carna
236 
237 #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's model-view transfo...
Definition: Renderable.h:45
signed short HUV
Represents values in .
Definition: Carna.h:56
Performs direct volume renderings of the volume geometries in the scene.
Definition: DVRStage.h:101
Defines Carna::presets::VolumeRenderingStage.