LibCarna Version 3.4.0
Loading...
Searching...
No Matches
DVRStage.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010 - 2016 Leonid Kostrykin
3 *
4 * Chair of Medical Engineering (mediTEC)
5 * RWTH Aachen University
6 * Pauwelsstr. 20
7 * 52074 Aachen
8 * Germany
9 *
10 *
11 * Copyright (C) 2021 - 2025 Leonid Kostrykin
12 *
13 */
14
15#ifndef DVRSTAGE_H_6014714286
16#define DVRSTAGE_H_6014714286
17
18#include <LibCarna/LibCarna.hpp>
21#include <memory>
22
28namespace LibCarna
29{
30
31namespace presets
32{
33
34
35
36// ----------------------------------------------------------------------------------
37// DVRStage
38// ----------------------------------------------------------------------------------
39
105class LIBCARNA DVRStage : public VolumeRenderingStage
106{
107
108 struct Details;
109 const std::unique_ptr< Details > pimpl;
110
111public:
112
117 const static unsigned int ROLE_INTENSITIES = 0;
118
123 const static unsigned int ROLE_NORMALS = 1;
124
128 const static float DEFAULT_TRANSLUCENCY;
129
134 const static float DEFAULT_DIFFUSE_LIGHT;
135
144 explicit DVRStage
145 ( unsigned int geometryType
146 , unsigned int colorMapResolution = base::ColorMap::DEFAULT_RESOLUTION );
147
151 virtual ~DVRStage();
152
153 virtual void reshape( base::FrameRenderer& fr, unsigned int width, unsigned int height ) override;
154
155 virtual void renderPass
156 ( const base::math::Matrix4f& viewTransform
157 , base::RenderTask& rt
158 , const base::Viewport& vp ) override;
159
164
168 void setTranslucency( float translucency );
169
173 float translucency() const;
174
184 void setDiffuseLight( float diffuseLight );
185
190 float diffuseLight() const;
191
196 bool isLightingUsed() const;
197
198protected:
199
200 virtual unsigned int loadVideoResources() override;
201
202 virtual void createVolumeSamplers( const std::function< void( unsigned int, base::Sampler* ) >& registerSampler ) override;
203
207 virtual const base::ShaderProgram& acquireShader() override;
208
212 virtual const std::string& uniformName( unsigned int role ) const override;
213
214 virtual void configureShader() override;
215
219 virtual void configureShader( const base::Renderable& ) override;
220
221}; // presets :: DVRStage
222
223
224
225} // namespace LibCarna :: presets
226
227} // namespace LibCarna
228
229#endif // DVRSTAGE_H_6014714286
Defines LibCarna::base::ColorMap.
Contains forward-declarations.
Defines LibCarna::presets::VolumeRenderingStage.
Represents a mapping of intensity values to RGBA colors, that can be queried in a shader.
Definition ColorMap.hpp:45
Defines logic for rendering frames from given scenes.
Invokes the rendering stages of the frame renderer successively.
Represents a Geometry object that has been queued into a RenderQueue. The object's model-view transfo...
Maintains an OpenGL texture sampler object. This class realizes the RAII-idiom.
Definition Sampler.hpp:48
Maintains an OpenGL shader program. Realizes the RAII-idiom.
Defines a rendering viewport. The viewport is a property of the current OpenGL context.
Definition Viewport.hpp:52
Performs direct volume renderings of the volume geometries in the scene.
Definition DVRStage.hpp:106
float translucency() const
Tells current translucency.
virtual const base::ShaderProgram & acquireShader() override
Acquires the dvr shader from the base::ShaderManager.
virtual void reshape(base::FrameRenderer &fr, unsigned int width, unsigned int height) override
Orders this stage to reshape its buffers according to the specified width and height.
virtual void renderPass(const base::math::Matrix4f &viewTransform, base::RenderTask &rt, const base::Viewport &vp) override
Triggers the volume rendering.
bool isLightingUsed() const
Tells whether lighting was used during the last rendering. The return value is undefined if nothing w...
void setDiffuseLight(float diffuseLight)
Sets the diffuse light amount to diffuseLight and the ambient light amount to one minus diffuseLight.
virtual const std::string & uniformName(unsigned int role) const override
Maps ROLE_INTENSITIES to intensities and ROLE_NORMALS to normalMap.
static const float DEFAULT_TRANSLUCENCY
Holds the default translucency.
Definition DVRStage.hpp:128
base::ColorMap colorMap
The color map used for the rendering.
Definition DVRStage.hpp:163
virtual void configureShader() override
Performs custom shader configuration on a per-pass level.
virtual ~DVRStage()
Deletes.
void setTranslucency(float translucency)
Sets the translucency property.
virtual unsigned int loadVideoResources() override
Loads video resources when rendering is triggered for the first time. Override this method if you nee...
virtual void createVolumeSamplers(const std::function< void(unsigned int, base::Sampler *) > &registerSampler) override
Creates texture samplers for volume textures and uses registerSampler to assign them to the roles tha...
virtual void configureShader(const base::Renderable &) override
Computes and uploads the normals transformation matrix.
DVRStage(unsigned int geometryType, unsigned int colorMapResolution=base::ColorMap::DEFAULT_RESOLUTION)
Instantiates. The created stage will render such base::Geometry scene graph nodes,...
float diffuseLight() const
Tells the diffuse light amount. The ambient light amount is one minus the diffuse light amount.
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.hpp:134
Defines abstract base class for rendering stages that render volume geometries in the scene.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
Definition math.hpp:197