Carna  Version 3.3.2
Public Member Functions | Static Public Attributes | List of all members
Carna::presets::OccludedRenderingStage Class Reference

Renders geometry that is actually depth-occluded. The occluded geometry is rendered with reduced opacity on-top of the geometry that it is occluded by. More...

#include <OccludedRenderingStage.h>

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

Public Member Functions

 OccludedRenderingStage ()
 Sets translucency of occluding geometry to DEFAULT_OCCLUSION_TRANSLUCENCY.
 
OccludedRenderingStageclone () const override
 Returns same RenderStage implementation with same configuration. More...
 
virtual ~OccludedRenderingStage ()
 Deletes.
 
void disableAllStages ()
 Disables all stages.
 
void enableStage (const base::RenderStage &rs)
 Enables rs in \(\mathcal O\left(\log n\right)\).
 
void disableStage (const base::RenderStage &rs)
 Disables rs in \(\mathcal O\left(\log n\right)\).
 
bool isStageEnabled (const base::RenderStage &rs) const
 Tells whether rs is enabled in \(\mathcal O\left(\log n\right)\).
 
void setOcclusionTranslucency (float translucency)
 Sets the translucency of the occluding geometry. More...
 
float occlusionTranslucency () const
 Tells the translucency of the occluding geometry. More...
 
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. More...
 
virtual void prepareFrame (base::Node &root) override
 Called once before each frame.
 
virtual void renderPass (const base::math::Matrix4f &viewTransform, base::RenderTask &rt, const base::Viewport &vp) override
 Called once per pass. More...
 
- 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.
 
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)\).
 

Static Public Attributes

static const float DEFAULT_OCCLUSION_TRANSLUCENCY
 Holds the default translucency of the occluding geometry.
 

Detailed Description

Renders geometry that is actually depth-occluded. The occluded geometry is rendered with reduced opacity on-top of the geometry that it is occluded by.

Note
In the rendering process this stage should be inserted before the geometry that is to be rendered with reduced opacity when occluded and after the geometry that the occluded geometry should be rendered on-top of.

Note that every geometry type that is to be rendered like described above when occluded must be enabled explicitly.

The following exemplary setup of the rendering process draws opaque meshes, that are occluded by cutting planes, on-top of them with reduced opacity:

  1. CuttingPlanesStage
  2. OccludedRenderingStage with stage 3 enabled
  3. OpaqueRenderingStage
Author
Leonid Kostrykin
Date
21.2.15 - 6.3.15

Definition at line 56 of file OccludedRenderingStage.h.

Member Function Documentation

◆ clone()

OccludedRenderingStage* Carna::presets::OccludedRenderingStage::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.

◆ occlusionTranslucency()

float Carna::presets::OccludedRenderingStage::occlusionTranslucency ( ) const

Tells the translucency of the occluding geometry.

For translucency == 1 it looks as if the occluding geometry was completely translucent.

◆ renderPass()

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

Called once per pass.

If this rendering stage maintains one or more Carna::base::RenderQueue objects, than this is the right place to build them. Note that the queues need to be rebuilt only once per frame and not per pass, unless isViewTransformFixed is false. If it is true and this is not the first invocation of this method since the last time prepareFrame was called, rewinding the queue will be sufficient.

Implements Carna::base::RenderStage.

◆ reshape()

virtual void Carna::presets::OccludedRenderingStage::reshape ( base::FrameRenderer fr,
unsigned int  width,
unsigned int  height 
)
overridevirtual

Orders this stage to reshape its buffers according to the specified dimensions.

Attention
Always call the base implementaion!
Parameters
frreferences the frame renderer this stage belongs to.
widthis the root viewport width.
heightis the root viewport height.

Reimplemented from Carna::base::RenderStage.

◆ setOcclusionTranslucency()

void Carna::presets::OccludedRenderingStage::setOcclusionTranslucency ( float  translucency)

Sets the translucency of the occluding geometry.

For translucency == 1 it looks as if the occluding geometry was completely translucent.


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