Kanzi  3.9.7
Kanzi Engine API
kanzi::CompositionStack Class Reference

Composition stack for managing current render context. More...

#include <kanzi/core.ui/graphics2d/composition_stack.hpp>

Public Member Functions

void apply2D (Renderer3D &renderer)
 Applies the topmost render settings for 2D rendering. More...
 
void apply3D (Renderer3D &renderer)
 Applies the topmost render settings for 3D rendering. More...
 
void applyColorBlend2D (Renderer &renderer)
 Applies the topmost color/blend stack state. More...
 
void applyColorBlend3D (Renderer &renderer)
 Applies the topmost color/blend stack state. More...
 
void applyComposition2D (Renderer &renderer)
 Applies the topmost composition stack state for 2D rendering. More...
 
void applyComposition3D (Renderer &renderer)
 Applies the topmost composition stack state for 3D rendering. More...
 
void applyDepthStencil2D (Renderer &renderer)
 Applies the topmost depth/stencil stack state. More...
 
void applyDepthStencil3D (Renderer &renderer)
 Applies the topmost depth/stencil stack state. More...
 
void applyPerspective2D (Renderer3D &renderer, const Matrix4x4 &cameraMatrix, const Matrix4x4 &projectionMatrix)
 Applies the topmost render settings for 2D perspective rendering. More...
 
void applyRasterization2D (Renderer &renderer)
 Applies the topmost rasterization stack state. More...
 
void applyRasterization3D (Renderer &renderer)
 Applies the topmost rasterization stack state. More...
 
 CompositionStack ()
 Constructor. More...
 
 CompositionStack (NativeFramebufferHandle handle, Vector2 size)
 Constructor. More...
 
 CompositionStack (NativeFramebufferHandle handle, Vector2 size, Vector4 viewport, optional< Vector4 > scissor)
 Constructor. More...
 
RenderPassSharedPtr getDebugComposer () const
 Get the debug composer used by this render context stack. More...
 
void invalidateAllState ()
 Invalidates all distinct stacks. More...
 
void invalidateColorBlend ()
 Invalidates color/blend stack state. More...
 
void invalidateComposition ()
 Invalidates composition stack state. More...
 
void invalidateDepthStencil ()
 Invalidates depth/stencil stack state. More...
 
void invalidateRasterization ()
 Invalidates rasterization stack state. More...
 
bool isCompositionStackEmpty () const
 Tells if composition stack is empty. More...
 
optional< NativeFramebufferHandlepeekCompositionTargetHandle () const
 Kanzi uses this function internally to get the handle of the current composition target. More...
 
optional< Vector2peekPolygonOffset ()
 Kanzi uses this function internally to get the current polygon offset. More...
 
optional< Vector2peekRenderContextSize () const
 Kanzi uses this function internally to get the size of the current composition target. More...
 
optional< Vector4peekScissor () const
 Gets current scissor. More...
 
optional< ViewportRectanglepeekScissorDeviceCoordinates ()
 Kanzi uses this function internally to get the current scissor area in device coordinates. More...
 
optional< Texture * > peekTexture () const
 Gets the current composition target texture. More...
 
optional< Vector4peekViewport () const
 Gets current viewport. More...
 
optional< ViewportRectanglepeekViewportDeviceCoordinates ()
 Kanzi uses this function internally to get the current viewport in device coordinates. More...
 
optional< Vector2peekViewportOffset () const
 Gets current viewport offset. More...
 
optional< Vector2peekViewportSize () const
 Gets current viewport size. More...
 
void popColorBlend ()
 Pop blend state from blend stack. More...
 
void popComposition ()
 Pop a composition target state from the stack. More...
 
void popDepthStencil ()
 Pop a depth stencil state from the stack. More...
 
void popRasterization ()
 Pop a rasterization state from the stack. More...
 
void pushColorBlend (optional< int > blendMode, optional< GraphicsColorWriteMode > colorWriteMode)
 Pushes blend state into the blend stack. More...
 
void pushComposition (NativeFramebufferHandle handle, Vector2 size)
 Pushes a composition target into the composition stack. More...
 
void pushComposition (NativeFramebufferHandle handle, unsigned int bufferCount, Vector2 size)
 Pushes a composition target into the composition stack. More...
 
void pushComposition (Texture &texture)
 Pushes a composition target into the composition stack. More...
 
void pushComposition (Texture &texture, Vector2 size)
 Pushes a composition target into the composition stack. More...
 
void pushComposition (optional< Vector4 > viewport, optional< Vector4 > scissor)
 Pushes a viewport and/or scissor onto composition stack. More...
 
void pushComposition (Texture &texture, Vector4 viewport, optional< Vector4 > scissor)
 Pushes a composition target and a viewport into the composition stack. More...
 
void pushComposition (NativeFramebufferHandle handle, Vector2 size, Vector4 viewport, optional< Vector4 > scissor)
 Pushes a composition target and a viewport into the composition stack. More...
 
void pushComposition (NativeFramebufferHandle handle, unsigned int bufferCount, Vector2 size, Vector4 viewport, optional< Vector4 > scissor)
 Pushes a composition target and a viewport into the composition stack. More...
 
void pushComposition (NativeFramebufferHandle handle, unsigned int bufferCount, Vector2 size, Vector4 viewport, optional< Vector4 > scissor, optional< Texture * > texture)
 Pushes a composition target and a viewport into the composition stack. More...
 
void pushDepthStencil (optional< GraphicsCompareFunction > depthFunc, optional< bool > depthWrite, optional< GraphicsCompareFunction > stencilFunc, optional< unsigned int > referenceValue, optional< unsigned int > maskValue, optional< GraphicsStencilOperation > stencilFail, optional< GraphicsStencilOperation > stencilPassDepthFail, optional< GraphicsStencilOperation > stencilPassDepthPass, optional< bool > stencilWrite)
 Pushes depth stencil state. More...
 
void pushRasterization (optional< GraphicsCullMode > cullMode, optional< Vector2 > polygonOffset)
 Pushes rasterization state. More...
 
void setDebugComposer (RenderPassSharedPtr debugComposer)
 Set the debug composer to be used by this render context stack. More...
 

Detailed Description

Composition stack for managing current render context.

The stack has no ownership over the stored render targets - they will not be reserved or deleted.

Constructor & Destructor Documentation

kanzi::CompositionStack::CompositionStack ( )
inlineexplicit

Constructor.

kanzi::CompositionStack::CompositionStack ( NativeFramebufferHandle  handle,
Vector2  size 
)
inlineexplicit

Constructor.

Parameters
handleComposition target handle.
sizeComposition target size.
kanzi::CompositionStack::CompositionStack ( NativeFramebufferHandle  handle,
Vector2  size,
Vector4  viewport,
optional< Vector4 scissor 
)
inlineexplicit

Constructor.

Parameters
handleComposition target handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.

Member Function Documentation

bool kanzi::CompositionStack::isCompositionStackEmpty ( ) const
inline

Tells if composition stack is empty.

Empty composition stack has no states whatsoever.

void kanzi::CompositionStack::pushColorBlend ( optional< int >  blendMode,
optional< GraphicsColorWriteMode colorWriteMode 
)

Pushes blend state into the blend stack.

Using nullopt with any parameter will take the default value or the last value pushed.

Parameters
blendModeBlend mode.
colorWriteModeColor write mode.
Since
Kanzi 3.9.1 type of blendMode parameter changed from GraphicsBlendMode to int.
void kanzi::CompositionStack::popColorBlend ( )
inline

Pop blend state from blend stack.

void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle  handle,
Vector2  size 
)

Pushes a composition target into the composition stack.

Parameters
handleComposition target handle.
sizeComposition target size.
void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle  handle,
unsigned int  bufferCount,
Vector2  size 
)

Pushes a composition target into the composition stack.

Parameters
handleComposition target handle.
bufferCountComposition target handle.
sizeComposition target size.
void kanzi::CompositionStack::pushComposition ( Texture texture)

Pushes a composition target into the composition stack.

Parameters
textureComposition target.
void kanzi::CompositionStack::pushComposition ( Texture texture,
Vector2  size 
)

Pushes a composition target into the composition stack.

Parameters
textureComposition target.
sizeComposition target size.
void kanzi::CompositionStack::pushComposition ( optional< Vector4 viewport,
optional< Vector4 scissor 
)

Pushes a viewport and/or scissor onto composition stack.

Parameters
viewportoptional viewport area.
scissoroptional scissor area.
void kanzi::CompositionStack::pushComposition ( Texture texture,
Vector4  viewport,
optional< Vector4 scissor 
)

Pushes a composition target and a viewport into the composition stack.

Parameters
textureComposition target.
viewportViewport area.
scissorScissor area.
void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle  handle,
Vector2  size,
Vector4  viewport,
optional< Vector4 scissor 
)

Pushes a composition target and a viewport into the composition stack.

Parameters
handleComposition target handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.
void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle  handle,
unsigned int  bufferCount,
Vector2  size,
Vector4  viewport,
optional< Vector4 scissor 
)
inline

Pushes a composition target and a viewport into the composition stack.

Parameters
handleComposition target handle.
bufferCountNumber of draw buffers bound to the handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.
void kanzi::CompositionStack::pushComposition ( NativeFramebufferHandle  handle,
unsigned int  bufferCount,
Vector2  size,
Vector4  viewport,
optional< Vector4 scissor,
optional< Texture * >  texture 
)
inline

Pushes a composition target and a viewport into the composition stack.

Parameters
handleComposition target handle.
bufferCountNumber of draw buffers bound to the handle.
sizeComposition target size.
viewportViewport area.
scissorScissor area.
textureThe texture to use as the composition target.
Since
Kanzi 3.9.7
void kanzi::CompositionStack::popComposition ( )
inline

Pop a composition target state from the stack.

void kanzi::CompositionStack::pushDepthStencil ( optional< GraphicsCompareFunction depthFunc,
optional< bool >  depthWrite,
optional< GraphicsCompareFunction stencilFunc,
optional< unsigned int >  referenceValue,
optional< unsigned int >  maskValue,
optional< GraphicsStencilOperation stencilFail,
optional< GraphicsStencilOperation stencilPassDepthFail,
optional< GraphicsStencilOperation stencilPassDepthPass,
optional< bool >  stencilWrite 
)

Pushes depth stencil state.

Using nullopt with any parameter will take the default value or the last value pushed.

Parameters
depthFuncDepth testing function.
depthWriteDepth write enabled?
stencilFuncStencil function.
referenceValueStencil reference value.
maskValueStencil mask value.
stencilFailOperation for stencil fail.
stencilPassDepthFailOperation for stencil pass but depth fail.
stencilPassDepthPassOperation for stencil and depth pass.
stencilWriteStencil write enabled?
void kanzi::CompositionStack::popDepthStencil ( )
inline

Pop a depth stencil state from the stack.

void kanzi::CompositionStack::pushRasterization ( optional< GraphicsCullMode cullMode,
optional< Vector2 polygonOffset 
)

Pushes rasterization state.

Using nullopt with any parameter will take the default value or the last value pushed.

Parameters
cullModeCulling mode.
polygonOffsetPolygon offset.
Since
Kanzi 3.9.4 polygonOffset parameter
void kanzi::CompositionStack::popRasterization ( )
inline

Pop a rasterization state from the stack.

RenderPassSharedPtr kanzi::CompositionStack::getDebugComposer ( ) const
inline

Get the debug composer used by this render context stack.

void kanzi::CompositionStack::setDebugComposer ( RenderPassSharedPtr  debugComposer)
inline

Set the debug composer to be used by this render context stack.

void kanzi::CompositionStack::apply2D ( Renderer3D renderer)

Applies the topmost render settings for 2D rendering.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::apply3D ( Renderer3D renderer)

Applies the topmost render settings for 3D rendering.

Default values will be used for those states with empty stacks.

void kanzi::CompositionStack::applyPerspective2D ( Renderer3D renderer,
const Matrix4x4 cameraMatrix,
const Matrix4x4 projectionMatrix 
)

Applies the topmost render settings for 2D perspective rendering.

Parameters
rendererRenderer to use.
cameraMatrixPrecalculated cameraMatrix.
projectionMatrixPrecalculated projectionMatrix.
optional<NativeFramebufferHandle> kanzi::CompositionStack::peekCompositionTargetHandle ( ) const
inline

Kanzi uses this function internally to get the handle of the current composition target.

Returns
Framebuffer handle.
optional<Vector2> kanzi::CompositionStack::peekRenderContextSize ( ) const
inline

Kanzi uses this function internally to get the size of the current composition target.

Returns
Composition target size.
optional<Vector4> kanzi::CompositionStack::peekScissor ( ) const
inline

Gets current scissor.

Returns
Scissor in Node2D coordinates or an empty optional if no scissor is set.
optional<Vector4> kanzi::CompositionStack::peekViewport ( ) const
inline

Gets current viewport.

Returns
Viewport in Node2D coordinates or an empty optional if composition stack is empty.
optional<Vector2> kanzi::CompositionStack::peekViewportOffset ( ) const
inline

Gets current viewport offset.

Returns
Offset of topmost viewport or an empty optional if composition stack is empty.
optional<Vector2> kanzi::CompositionStack::peekViewportSize ( ) const
inline

Gets current viewport size.

Disregards scissor.

Returns
Size of topmost viewport or an empty optional if composition stack is empty.
optional<Texture*> kanzi::CompositionStack::peekTexture ( ) const
inline

Gets the current composition target texture.

Returns
The target texture. If the composition stack is empty, returns an empty optional.
Since
Kanzi 3.9.7
optional<ViewportRectangle> kanzi::CompositionStack::peekViewportDeviceCoordinates ( )
inline

Kanzi uses this function internally to get the current viewport in device coordinates.

Returns
Device coordinate viewport.
optional<ViewportRectangle> kanzi::CompositionStack::peekScissorDeviceCoordinates ( )
inline

Kanzi uses this function internally to get the current scissor area in device coordinates.

Returns
Device coordinate viewport.
optional<Vector2> kanzi::CompositionStack::peekPolygonOffset ( )
inline

Kanzi uses this function internally to get the current polygon offset.

Returns
Polygon offset.
void kanzi::CompositionStack::applyColorBlend2D ( Renderer renderer)
inline

Applies the topmost color/blend stack state.

If stack is empty, default 2D blend settings are used.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::applyColorBlend3D ( Renderer renderer)
inline

Applies the topmost color/blend stack state.

If stack is empty, default 3D blend settings are used.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::invalidateColorBlend ( )
inline

Invalidates color/blend stack state.

Should only be called when manually modifying color/blend state so that applying again will not assume no changes.

void kanzi::CompositionStack::applyComposition2D ( Renderer renderer)
inline

Applies the topmost composition stack state for 2D rendering.

Default composition state for 2D is not defined.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::applyComposition3D ( Renderer renderer)
inline

Applies the topmost composition stack state for 3D rendering.

Default composition state for 2D is not defined.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::invalidateComposition ( )
inline

Invalidates composition stack state.

Should only be called when manually modifying composition state so that applying again will not assume no changes.

void kanzi::CompositionStack::applyDepthStencil2D ( Renderer renderer)
inline

Applies the topmost depth/stencil stack state.

If stack is empty, default depth/stencil settings are used.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::applyDepthStencil3D ( Renderer renderer)
inline

Applies the topmost depth/stencil stack state.

If stack is empty, default depth/stencil settings are used.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::invalidateDepthStencil ( )
inline

Invalidates depth/stencil stack state.

Should only be called when manually modifying depth/stencil state so that applying again will not assume no changes.

void kanzi::CompositionStack::applyRasterization2D ( Renderer renderer)
inline

Applies the topmost rasterization stack state.

If stack is empty, default rasterization settings are used.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::applyRasterization3D ( Renderer renderer)
inline

Applies the topmost rasterization stack state.

If stack is empty, default rasterization settings are used.

Parameters
rendererRenderer to use.
void kanzi::CompositionStack::invalidateRasterization ( )
inline

Invalidates rasterization stack state.

Should only be called when manually modifying rasterization state so that applying again will not assume no changes.

void kanzi::CompositionStack::invalidateAllState ( )
inline

Invalidates all distinct stacks.

User should not need to call this function. Intended to be called along Renderer3D::reset() to signify context change.


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