LibCarna Version 3.4.0
Loading...
Searching...
No Matches
MaskRenderingStage.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 - 2025 Leonid Kostrykin
3 *
4 */
5
6#ifndef MASKRENDERINGSTAGE_H_6014714286
7#define MASKRENDERINGSTAGE_H_6014714286
8
10#include <LibCarna/LibCarna.hpp>
11#include <memory>
12
18namespace LibCarna
19{
20
21namespace presets
22{
23
24
25
26// ----------------------------------------------------------------------------------
27// MaskRenderingStage
28// ----------------------------------------------------------------------------------
29
59{
60
61 struct Details;
62 const std::unique_ptr< Details > pimpl;
63
64public:
65
67 const static unsigned int DEFAULT_ROLE_MASK;
68 const static bool DEFAULT_FILLING;
69
74 const unsigned int maskRole;
75
83 explicit MaskRenderingStage( unsigned int geometryType, unsigned int maskRole = DEFAULT_ROLE_MASK );
84
89
90 virtual void reshape( base::FrameRenderer& fr, unsigned int width, unsigned int height ) override;
91
95 virtual void renderPass
96 ( const base::math::Matrix4f& viewTransform
98 , const base::Viewport& vp ) override;
99
103 const base::Color& color() const;
104
108 void setColor( const base::Color& color );
109
113 bool isFilling() const;
114
118 void setFilling( bool filled );
119
120protected:
121
122 virtual unsigned int loadVideoResources() override;
123
124 virtual void createVolumeSamplers( const std::function< void( unsigned int, base::Sampler* ) >& registerSampler ) override;
125
129 virtual const base::ShaderProgram& acquireShader() override;
130
134 virtual const std::string& uniformName( unsigned int role ) const override;
135
139 virtual void configureShader() override;
140
144 virtual void configureShader( const base::Renderable& ) override;
145
146}; // DRRStage
147
148
149
150} // namespace LibCarna :: presets
151
152} // namespace LibCarna
153
154#endif // MASKRENDERINGSTAGE_H_6014714286
Contains forward-declarations.
Defines LibCarna::presets::VolumeRenderingStage.
Represents a color. Objects from this class are copyable and assignable.
Definition Color.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
static const unsigned int DEFAULT_ROLE_MASK
Holds the default value of maskRole.
void setFilling(bool filled)
Sets whether to render filled regions (instead of borders only).
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 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
Performs the mask rendering.
virtual const base::ShaderProgram & acquireShader() override
Acquires the mask_rendering shader from the base::ShaderManager.
MaskRenderingStage(unsigned int geometryType, unsigned int maskRole=DEFAULT_ROLE_MASK)
Instantiates.
virtual const std::string & uniformName(unsigned int role) const override
Maps maskRole to mask.
virtual unsigned int loadVideoResources() override
Loads video resources when rendering is triggered for the first time. Override this method if you nee...
static const bool DEFAULT_FILLING
Holds the default value of isFilling.
static const base::Color DEFAULT_COLOR
Holds the default rendering color.
const unsigned int maskRole
Holds the role that mask volume data is expected to take when attached to base::Geometry nodes.
virtual void configureShader(const base::Renderable &) override
Does nothing.
bool isFilling() const
Tells whether filled regions are rendered (instead of borders only).
virtual void configureShader() override
Sets the border rendering mode and the rendering color.
void setColor(const base::Color &color)
Sets the rendering color.
const base::Color & color() const
Tells the rendering color.
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