Carna  Version 3.3.2
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. More...
 
TransparentRenderingStageclone () const override
 Returns same RenderStage implementation with same configuration. More...
 
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. More...
 
MeshRenderingStageclone () const override
 Returns same RenderStage implementation with same configuration. More...
 
- Public Member Functions inherited from Carna::base::GeometryStage< base::Renderable::BackToFront >
 GeometryStage (unsigned int geometryType, unsigned int geometryTypeMask=RenderQueue< base::Renderable::BackToFront >::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. More...
 
std::size_t renderedPassesCount () const
 Tells the number of passes rendered so far since the beginning of the current frame.
 
GeometryFeatureType::ManagedInterface & videoResource (GeometryFeatureType &geometryFeature) const
 Interfaces the geometryFeature video resources that were acquired by this rendering stage.
 
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. More...
 
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. More...
 
bool isInitialized () const
 Tells whether this stage is ready for rendering. More...
 
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. More...
 
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. More...
 
virtual ~MeshRenderingStageBase ()
 Does nothing.
 

Additional Inherited Members

- Public Attributes inherited from Carna::base::GeometryStage< base::Renderable::BackToFront >
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. More...
 
- Protected Member Functions inherited from Carna::base::GeometryStage< base::Renderable::BackToFront >
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< base::Renderable::BackToFront >
RenderQueue< base::Renderable::BackToFrontrq
 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 );

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::ManagedMeshBase& boxMesh = base::MeshFactory< base::PVertex >::createBox( 40, 40, 40 );
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 );

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

transparentFromFront.png
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.

Implements Carna::base::RenderStage.


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