Carna Version 3.3.3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Carna::presets::TransparentRenderingStage Class Reference

Implements rendering stage that renders transparent meshes. More...

#include <TransparentRenderingStage.h>

+ Inheritance diagram for Carna::presets::TransparentRenderingStage:
+ Collaboration diagram for Carna::presets::TransparentRenderingStage:

Public Member Functions

 TransparentRenderingStage (unsigned int geometryType)
 Instantiates.
 
TransparentRenderingStageclone () const override
 Returns same RenderStage implementation with same configuration.
 
virtual void renderPass (const base::math::Matrix4f &viewTransform, base::RenderTask &rt, const base::Viewport &vp) override
 Renders transparent geometries with enabled blending and disabled depth writing.
 
- Public Member Functions inherited from Carna::base::MeshRenderingStage< base::Renderable::BackToFront >
 MeshRenderingStage (unsigned int geometryType)
 Instantiates.
 
- Public Member Functions inherited from Carna::base::GeometryStage< RenderableCompare >
 GeometryStage (unsigned int geometryType, unsigned int geometryTypeMask=RenderQueue< RenderableCompare >::EXACT_MATCH_GEOMETRY_TYPE_MASK)
 Instantiates s.t. the predefined rendering queue enqueues such Carna::base::Geometry scene graph nodes, whose geometry type AND-linked with geometryTypeMask equals the geometryType specified here.
 
virtual ~GeometryStage ()
 Releases acquired video resources.
 
virtual void prepareFrame (Node &root) override
 Called once before each frame.
 
std::size_t renderedPassesCount () const
 Tells the number of passes rendered so far since the beginning of the current frame.
 
template<typename GeometryFeatureType >
GeometryFeatureType::ManagedInterface & videoResource (GeometryFeatureType &geometryFeature) const
 Interfaces the geometryFeature video resources that were acquired by this rendering stage.
 
template<typename GeometryFeatureType >
const GeometryFeatureType::ManagedInterface & videoResource (const GeometryFeatureType &geometryFeature) const
 
- Public Member Functions inherited from Carna::base::RenderStage
 RenderStage ()
 Instantiates in enabled-state.
 
virtual ~RenderStage ()
 Deletes.
 
void setViewTransformFixed (bool viewTransformFixed)
 Sets whether the view transform is pass-invariant for the duration of a single frame.
 
bool isViewTransformFixed () const
 Tells whether the view transform is pass-invariant for the duration of a single frame.
 
virtual void reshape (FrameRenderer &fr, unsigned int width, unsigned int height)
 Orders this stage to reshape its buffers according to the specified dimensions.
 
bool isInitialized () const
 Tells whether this stage is ready for rendering.
 
bool isEnabled () const
 Tells whether this stage is enabled. Disabled stages are not rendered by render tasks.
 
void setEnabled (bool)
 Sets whether this stage is enabled. Disabled stages are not rendered by render tasks.
 
base::FrameRendererrenderer ()
 References the renderer this stage belongs to.
 
const base::FrameRendererrenderer () const
 
void addRenderStageListener (RenderStageListener &listener)
 Adds listener to the set of listeners this instance notifies in \(\mathcal O\left(\log n\right)\).
 
void removeRenderStageListener (RenderStageListener &listener)
 Removes listener from the set of listeners this instance notifies in \(\mathcal O\left(\log n\right)\).
 
- Public Member Functions inherited from Carna::base::MeshRenderingStageBase
 MeshRenderingStageBase (unsigned int geometryType)
 Instantiates.
 
virtual ~MeshRenderingStageBase ()
 Does nothing.
 

Additional Inherited Members

- Public Attributes inherited from Carna::base::GeometryStage< RenderableCompare >
const unsigned int geometryType
 Renders such geometries whose type AND-linked with geometryTypeMask equals this.
 
const unsigned int geometryTypeMask
 Renders such geometries whose type AND-linked with this equals geometryType.
 
- Public Attributes inherited from Carna::base::MeshRenderingStageBase
const unsigned int geometryType
 Holds the geometry type rendered by this MeshRenderingStage.
 
- Static Public Attributes inherited from Carna::base::MeshRenderingStageBase
static const unsigned int ROLE_DEFAULT_MESH = 0
 Identifies the Mesh object that MeshRenderingStage uses for rendering.
 
static const unsigned int ROLE_DEFAULT_MATERIAL = 1
 Identifies the Material object that MeshRenderingStage uses for rendering.
 
- Protected Member Functions inherited from Carna::base::MeshRenderingStage< base::Renderable::BackToFront >
virtual void render (const Renderable &renderable) override
 Renders the renderable.
 
- Protected Member Functions inherited from Carna::base::GeometryStage< RenderableCompare >
void activateGLContext () const
 Ensures that the OpenGL context of the hosting Carna::base::FrameRenderer is the current one.
 
virtual void buildRenderQueues (Node &root, const math::Matrix4f &viewTransform)
 Builds the rendering queues of this stage.
 
virtual void rewindRenderQueues ()
 Rewinds the rendering queues of this stage.
 
virtual void updateRenderQueues (const math::Matrix4f &viewTransform)
 Recomputes the model-view transforms of the renderables enqueued by this stage.
 
- Protected Attributes inherited from Carna::base::GeometryStage< RenderableCompare >
RenderQueue< RenderableComparerq
 Holds the predefined rendering queue of this rendering stage.
 

Detailed Description

Implements rendering stage that renders transparent meshes.

The TransparentRenderingStage constructor takes a geometry type parameter:

transparent = new presets::TransparentRenderingStage( GEOMETRY_TYPE_TRANSPARENT );
renderer->appendStage( transparent );
void appendStage(RenderStage *stage)
Appends stage to the rendering stages sequence.
base::FrameRenderer & renderer()
References the renderer this stage belongs to.
Implements rendering stage that renders transparent meshes.

The concept of geometry types is explained here.

Note
In the rendering process this stage will usually be inserted after such stages that render opaque geometry, like CuttingPlanesStage and OpaqueRenderingStage.

The following example code configures the scene s.t. it produces the rendering presented further below:

base::Material& redMaterial = base::Material::create( "unshaded" );
base::Material& greenMaterial = base::Material::create( "unshaded" );
redMaterial .setParameter( "color", base::math::Vector4f( 1, 0, 0, 0.5f ) );
greenMaterial.setParameter( "color", base::math::Vector4f( 0, 1, 0, 0.5f ) );
base::Geometry* const box1 = new base::Geometry( GEOMETRY_TYPE_TRANSPARENT );
base::Geometry* const box2 = new base::Geometry( GEOMETRY_TYPE_TRANSPARENT );
boxMesh.release();
redMaterial.release();
greenMaterial.release();
scene->root->attachChild( box1 );
scene->root->attachChild( box2 );
box1->localTransform = base::math::translation4f( -10, -10, -40 );
box2->localTransform = base::math::translation4f( +10, +10, +40 );
void release()
Denotes that this object is no longer required and may be deleted as soon as it is valid to delete it...
Defines scene graph leafs. Instances of this class represent visible geometry that can be rendered....
Definition Geometry.h:60
void putFeature(unsigned int role, GeometryFeature &feature)
Adds the feature to this geometry node using role in . The concept of geometry features and roles is ...
Represents MeshBase object whose lifetime is managed by instances of this class. This is a format-ind...
Definition ManagedMesh.h:57
Specifies the shader and it's configuration that are to be used for rendering a Geometry node with a ...
Definition Material.h:175
void setParameter(const std::string &name, const ParameterType &value)
Definition Material.h:306
static Material & create(const std::string &shaderName)
Instantiates. Call release when you do not need the object any longer.
static ManagedMesh< VertexType, uint8_t > & createBox(float width, float height, float depth)
Creates box with width, height and depth. The box is centered in .
static const unsigned int ROLE_DEFAULT_MESH
Identifies the Mesh object that MeshRenderingStage uses for rendering.
static const unsigned int ROLE_DEFAULT_MATERIAL
Identifies the Material object that MeshRenderingStage uses for rendering.
math::Matrix4f localTransform
Defines the location, rotation and scale of this spatial in relation to it's parent....
Definition Spatial.h:132
Eigen::Matrix< float, 4, 1 > Vector4f
Defines vector.
Definition math.h:195
Matrix4f translation4f(float x, float y, float z)
Returns matrix that translates homogeneous coordinates.
Definition math.h:271

The concept of materials, meshes and other geometry feature is explained here.

exemplary rendering of two box meshes from code above
Author
Leonid Kostrykin
Date
21.2.15 - 6.3.15

Definition at line 60 of file TransparentRenderingStage.h.

Constructor & Destructor Documentation

◆ TransparentRenderingStage()

Carna::presets::TransparentRenderingStage::TransparentRenderingStage ( unsigned int  geometryType)
explicit

Instantiates.

Parameters
geometryTypeis the geometry type rendered by this stage.

Member Function Documentation

◆ clone()

TransparentRenderingStage * Carna::presets::TransparentRenderingStage::clone ( ) const
overridevirtual

Returns same RenderStage implementation with same configuration.

The listeners and the rendering state are not copied.

Deprecated:
Do not use this method. It will be removed shortly.

Reimplemented from Carna::base::MeshRenderingStage< base::Renderable::BackToFront >.

◆ renderPass()

virtual void Carna::presets::TransparentRenderingStage::renderPass ( const base::math::Matrix4f viewTransform,
base::RenderTask rt,
const base::Viewport vp 
)
overridevirtual

Renders transparent geometries with enabled blending and disabled depth writing.

Reimplemented from Carna::base::MeshRenderingStage< base::Renderable::BackToFront >.


The documentation for this class was generated from the following file: