LibCarna Version 3.4.0
Loading...
Searching...
No Matches
VolumeRenderingStage.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 VOLUMERENDERINGSTAGE_H_6014714286
16#define VOLUMERENDERINGSTAGE_H_6014714286
17
20#include <LibCarna/LibCarna.hpp>
21#include <map>
22
28namespace LibCarna
29{
30
31namespace presets
32{
33
34
35
36// ----------------------------------------------------------------------------------
37// VolumeRenderingStage
38// ----------------------------------------------------------------------------------
39
320class LIBCARNA VolumeRenderingStage : public base::GeometryStage< base::Renderable::BackToFront >
321{
322
323 struct Details;
324 const std::unique_ptr< Details > pimpl;
325
326 struct VideoResources;
327 std::unique_ptr< VideoResources > vr;
328
329public:
330
334 const static unsigned int DEFAULT_SAMPLE_RATE = 200;
335
340 explicit VolumeRenderingStage( unsigned int geometryType );
341
346
351 void setSampleRate( unsigned int sampleRate );
352
357 unsigned int sampleRate() const;
358
362 virtual void renderPass
363 ( const base::math::Matrix4f& viewTransform
364 , base::RenderTask& rt
365 , const base::Viewport& vp ) override;
366
367protected:
368
377 virtual unsigned int loadVideoResources();
378
379 virtual void render( const base::Renderable& ) override;
380
385 virtual void createVolumeSamplers( const std::function< void( unsigned int, base::Sampler* ) >& registerSampler ) = 0;
386
391 virtual const base::ShaderProgram& acquireShader() = 0;
392
397 virtual const std::string& uniformName( unsigned int role ) const = 0;
398
402 virtual void configureShader() = 0;
403
407 virtual void configureShader( const base::Renderable& ) = 0;
408
409}; // VolumeRenderingStage
410
411
412
413} // namespace LibCarna :: presets
414
415} // namespace LibCarna
416
417#endif // VOLUMERENDERINGSTAGE_H_6014714286
Defines LibCarna::base::GeometryStage.
Contains forward-declarations.
Defines LibCarna::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.
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
Defines abstract base class for rendering stages that render volume geometries in the scene.
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.
unsigned int sampleRate() const
Tells number of slices to be rendered per segment.
void setSampleRate(unsigned int sampleRate)
Sets number of slices to be rendered per segment.
VolumeRenderingStage(unsigned int geometryType)
Instantiates. The created stage will render such base::Geometry scene graph nodes,...
virtual void configureShader(const base::Renderable &)=0
Performs custom shader configuration on a per-volume level.
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.
virtual void render(const base::Renderable &) override
Renders the renderable.
virtual unsigned int loadVideoResources()
Loads video resources when rendering is triggered for the first time. Override this method if you nee...
virtual const base::ShaderProgram & acquireShader()=0
Acquires the shader from the base::ShaderManager, that is to be used for rendering the slices.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
Definition math.hpp:197