Carna  Version 3.0.1
Public Types | Public Member Functions | Protected Member Functions | List of all members
Carna::presets::CompositionStage Class Referenceabstract

Defines rendering stage that combines two other renderings either by putting them next to each other or through row-wise interleaving. More...

#include <CompositionStage.h>

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

Public Types

enum  CompositionMode { interleave, aside }
 Defines how two renderings are to be combined. More...
 

Public Member Functions

 CompositionStage (CompositionMode compositionMode)
 Instantiates.
 
virtual ~CompositionStage ()
 Deletes.
 
void setCompositionMode (CompositionMode compositionMode)
 Sets how the two renderings obtained through renderPass(const base::math::Matrix4f&,base::RenderTask&,const base::Viewport&,bool,bool) shall be combined.
 
CompositionMode compositionMode () const
 Tells how the two renderings obtained through renderPass(const base::math::Matrix4f&,base::RenderTask&,const base::Viewport&,bool,bool) are combined.
 
void setCompositionSwap (bool)
 Swaps the two renderings obtained through renderPass(const base::math::Matrix4f&,base::RenderTask&,const base::Viewport&,bool,bool) when combining.
 
bool isCompositionSwapped () const
 Tells whether the two renderings obtained through renderPass(const base::math::Matrix4f&,base::RenderTask&,const base::Viewport&,bool,bool) are swapped when combined.
 
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
 Invokes renderPass(const base::math::Matrix4f&,base::RenderTask&,const base::Viewport&,bool,bool) twice and combines the results like specified.
 
- Public Member Functions inherited from Carna::base::RenderStage
 RenderStage ()
 Instantiates in enabled-state.
 
virtual ~RenderStage ()
 Deletes.
 
virtual RenderStageclone () const =0
 Returns same RenderStage implementation with same configuration. More...
 
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)\).
 

Protected Member Functions

virtual void renderPass (const base::math::Matrix4f &viewTransform, base::RenderTask &rt, const base::Viewport &vp, bool isFirstInvocation, bool isFirstSource)=0
 Renders one of the two renderings that are to be combined per invocation. More...
 

Detailed Description

Defines rendering stage that combines two other renderings either by putting them next to each other or through row-wise interleaving.

Author
Leonid Kostrykin
Date
22.2.15 - 31.3.15

Definition at line 41 of file CompositionStage.h.

Member Enumeration Documentation

Defines how two renderings are to be combined.

Enumerator
interleave 

Combines renderings through row-wise interleaving.

interleaved.png
aside 

Combines renderings by putting them next to each other.

aside.png

Definition at line 52 of file CompositionStage.h.

Member Function Documentation

virtual void Carna::presets::CompositionStage::renderPass ( const base::math::Matrix4f viewTransform,
base::RenderTask rt,
const base::Viewport vp,
bool  isFirstInvocation,
bool  isFirstSource 
)
protectedpure virtual

Renders one of the two renderings that are to be combined per invocation.

Parameters
viewTransformtransforms world space to view space.
rtreferences the rendering task.
vpreferences the viewport.
isFirstInvocationindicates whether this is the first rendering invocation of the current rendering pass.
isFirstSourceindicates whether this rendering should be done using the "first" method/source/algorithm.

Note that isFirstInvocation == isFirstSource is true when swapping was disabled and isFirstInvocation != isFirstSource is true if it was enabled.

Implemented in Carna::presets::ParallaxStage.

virtual void Carna::presets::CompositionStage::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.


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