Carna Version 3.3.3
Loading...
Searching...
No Matches
VolumeRenderingStage.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 VOLUMERENDERINGSTAGE_H_6014714286
13#define VOLUMERENDERINGSTAGE_H_6014714286
14
17#include <Carna/Carna.h>
18#include <map>
19
24namespace Carna
25{
26
27namespace presets
28{
29
30
31
32// ----------------------------------------------------------------------------------
33// VolumeRenderingStage
34// ----------------------------------------------------------------------------------
35
316class CARNA_LIB VolumeRenderingStage : public base::GeometryStage< base::Renderable::BackToFront >
317{
318
319 struct Details;
320 const std::unique_ptr< Details > pimpl;
321
322 struct VideoResources;
323 std::unique_ptr< VideoResources > vr;
324
325public:
326
330 const static unsigned int DEFAULT_SAMPLE_RATE = 200;
331
336 explicit VolumeRenderingStage( unsigned int geometryType );
337
342
347 void setSampleRate( unsigned int sampleRate );
348
353 unsigned int sampleRate() const;
354
358 virtual void renderPass
359 ( const base::math::Matrix4f& viewTransform
360 , base::RenderTask& rt
361 , const base::Viewport& vp ) override;
362
363protected:
364
373 virtual unsigned int loadVideoResources();
374
375 virtual void render( const base::Renderable& ) override;
376
381 virtual void createVolumeSamplers( const std::function< void( unsigned int, base::Sampler* ) >& registerSampler ) = 0;
382
387 virtual const base::ShaderProgram& acquireShader() = 0;
388
393 virtual const std::string& uniformName( unsigned int role ) const = 0;
394
398 virtual void configureShader() = 0;
399
403 virtual void configureShader( const base::Renderable& ) = 0;
404
405}; // VolumeRenderingStage
406
407
408
409} // namespace Carna :: presets
410
411} // namespace Carna
412
413#endif // VOLUMERENDERINGSTAGE_H_6014714286
Defines Carna::base::GeometryStage.
Defines Carna::base::Renderable.
Partially implements a rendering stage that uses at least one render queue for rendering geometry fro...
Invokes the rendering stages of the frame renderer successively.
Definition RenderTask.h:41
Represents a Geometry object that has been queued into a RenderQueue. The object's model-view transfo...
Definition Renderable.h:46
Maintains an OpenGL texture sampler object. This class realizes the RAII-idiom.
Definition Sampler.h:45
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.h:49
Defines abstract base class for rendering stages that render volume geometries in the scene.
virtual const base::ShaderProgram & acquireShader()=0
Acquires the shader from the base::ShaderManager, that is to be used for rendering the slices.
void setSampleRate(unsigned int sampleRate)
Sets number of slices to be rendered per segment.
unsigned int sampleRate() const
Tells number of slices to be rendered per segment.
virtual void createVolumeSamplers(const std::function< void(unsigned int, base::Sampler *) > &registerSampler)=0
Creates texture samplers for volume textures and uses registerSampler to assign them to the roles tha...
virtual void configureShader()=0
Performs custom shader configuration on a per-pass level.
virtual unsigned int loadVideoResources()
Loads video resources when rendering is triggered for the first time. Override this method if you nee...
virtual const std::string & uniformName(unsigned int role) const =0
Tells the name of the uniform variable, that the role texture is to be bound to. Use configureShader ...
virtual void renderPass(const base::math::Matrix4f &viewTransform, base::RenderTask &rt, const base::Viewport &vp) override
Triggers the volume rendering.
VolumeRenderingStage(unsigned int geometryType)
Instantiates. The created stage will render such base::Geometry scene graph nodes,...
virtual void render(const base::Renderable &) override
Renders the renderable.
virtual void configureShader(const base::Renderable &)=0
Performs custom shader configuration on a per-volume level.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
Definition math.h:193