Carna Version 3.3.3
Loading...
Searching...
No Matches
MaskRenderingStage.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Leonid Kostrykin
3 *
4 */
5
6#ifndef MASKRENDERINGSTAGE_H_6014714286
7#define MASKRENDERINGSTAGE_H_6014714286
8
10#include <Carna/Carna.h>
11#include <memory>
12
17namespace Carna
18{
19
20namespace presets
21{
22
23
24
25// ----------------------------------------------------------------------------------
26// MaskRenderingStage
27// ----------------------------------------------------------------------------------
28
60{
61
62 struct Details;
63 const std::unique_ptr< Details > pimpl;
64
65public:
66
68 const static unsigned int DEFAULT_ROLE_MASK;
69
74 const unsigned int maskRole;
75
83 explicit MaskRenderingStage( unsigned int geometryType, unsigned int maskRole = DEFAULT_ROLE_MASK );
84
89
90 MaskRenderingStage* clone() const override;
91
92 virtual void reshape( base::FrameRenderer& fr, unsigned int width, unsigned int height ) override;
93
97 virtual void renderPass
98 ( const base::math::Matrix4f& viewTransform
100 , const base::Viewport& vp ) override;
101
105 const base::Color& color() const;
106
110 void setColor( const base::Color& color );
111
115 bool renderBorders() const;
116
120 void setRenderBorders( bool borders );
121
122protected:
123
124 virtual unsigned int loadVideoResources() override;
125
126 virtual void createVolumeSamplers( const std::function< void( unsigned int, base::Sampler* ) >& registerSampler ) override;
127
131 virtual const base::ShaderProgram& acquireShader() override;
132
136 virtual const std::string& uniformName( unsigned int role ) const override;
137
141 virtual void configureShader() override;
142
146 virtual void configureShader( const base::Renderable& ) override;
147
148}; // DRRStage
149
150
151
152} // namespace Carna :: presets
153
154} // namespace Carna
155
156#endif // MASKRENDERINGSTAGE_H_6014714286
Defines Carna::presets::VolumeRenderingStage.
Represents a color. Objects from this class are copyable and assignable.
Definition Color.h:42
Defines logic for rendering frames from given scenes.
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
virtual void configureShader() override
Sets the border rendering mode and the rendering color.
static const base::Color DEFAULT_COLOR
Holds the default rendering color.
void setRenderBorders(bool borders)
Sets whether to render borders instead of regions.
virtual void configureShader(const base::Renderable &) override
Does nothing.
virtual void renderPass(const base::math::Matrix4f &viewTransform, base::RenderTask &rt, const base::Viewport &vp) override
Performs the mask rendering.
MaskRenderingStage * clone() const override
Returns same RenderStage implementation with same configuration.
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...
bool renderBorders() const
Tells whether borders are rendered instead of regions.
void setColor(const base::Color &color)
Sets the rendering color.
MaskRenderingStage(unsigned int geometryType, unsigned int maskRole=DEFAULT_ROLE_MASK)
Instantiates.
const base::Color & color() const
Tells the rendering color.
virtual unsigned int loadVideoResources() override
Loads video resources when rendering is triggered for the first time. Override this method if you nee...
virtual void reshape(base::FrameRenderer &fr, unsigned int width, unsigned int height) override
Orders this stage to reshape its buffers according to the specified dimensions.
static const unsigned int DEFAULT_ROLE_MASK
Holds the default value of maskRole.
virtual const std::string & uniformName(unsigned int role) const override
Maps maskRole to mask.
const unsigned int maskRole
Holds the role that mask volume data is expected to take when attached to base::Geometry nodes.
virtual ~MaskRenderingStage()
Deletes.
virtual const base::ShaderProgram & acquireShader() override
Acquires the mask_rendering shader from the base::ShaderManager.
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.h:193