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. | |
void | apply3D (Renderer3D &renderer) |
Applies the topmost render settings for 3D rendering. | |
void | applyColorBlend2D (Renderer &renderer) |
Applies the topmost color/blend stack state. | |
void | applyColorBlend3D (Renderer &renderer) |
Applies the topmost color/blend stack state. | |
void | applyComposition2D (Renderer &renderer) |
Applies the topmost composition stack state for 2D rendering. | |
void | applyComposition3D (Renderer &renderer) |
Applies the topmost composition stack state for 3D rendering. | |
void | applyDepthStencil2D (Renderer &renderer) |
Applies the topmost depth/stencil stack state. | |
void | applyDepthStencil3D (Renderer &renderer) |
Applies the topmost depth/stencil stack state. | |
void | applyPerspective2D (Renderer3D &renderer, const Matrix4x4 &cameraMatrix, const Matrix4x4 &projectionMatrix) |
Applies the topmost render settings for 2D perspective rendering. | |
void | applyRasterization2D (Renderer &renderer) |
Applies the topmost rasterization stack state. | |
void | applyRasterization3D (Renderer &renderer) |
Applies the topmost rasterization stack state. | |
CompositionStack () | |
Constructor. | |
CompositionStack (NativeFramebufferHandle handle, Vector2 size) | |
Constructor. | |
CompositionStack (NativeFramebufferHandle handle, Vector2 size, Vector4 viewport, optional< Vector4 > scissor) | |
Constructor. | |
RenderPassSharedPtr | getDebugComposer () const |
Get the debug composer used by this render context stack. | |
void | invalidateAllState () |
Invalidates all distinct stacks. | |
void | invalidateColorBlend () |
Invalidates color/blend stack state. | |
void | invalidateComposition () |
Invalidates composition stack state. | |
void | invalidateDepthStencil () |
Invalidates depth/stencil stack state. | |
void | invalidateRasterization () |
Invalidates rasterization stack state. | |
bool | isCompositionStackEmpty () const |
Tells if composition stack is empty. | |
optional< NativeFramebufferHandle > | peekCompositionTargetHandle () const |
Kanzi uses this function internally to get the handle of the current composition target. | |
optional< Vector2 > | peekPolygonOffset () |
Kanzi uses this function internally to get the current polygon offset. | |
optional< Vector2 > | peekRenderContextSize () const |
Kanzi uses this function internally to get the size of the current composition target. | |
optional< Vector4 > | peekScissor () const |
Gets current scissor. | |
optional< ViewportRectangle > | peekScissorDeviceCoordinates () |
Kanzi uses this function internally to get the current scissor area in device coordinates. | |
optional< Texture * > | peekTexture () const |
Gets the current composition target texture. | |
optional< Vector4 > | peekViewport () const |
Gets current viewport. | |
optional< ViewportRectangle > | peekViewportDeviceCoordinates () |
Kanzi uses this function internally to get the current viewport in device coordinates. | |
optional< Vector2 > | peekViewportOffset () const |
Gets current viewport offset. | |
optional< Vector2 > | peekViewportSize () const |
Gets current viewport size. | |
void | popColorBlend () |
Pop blend state from blend stack. | |
void | popComposition () |
Pop a composition target state from the stack. | |
void | popDepthStencil () |
Pop a depth stencil state from the stack. | |
void | popRasterization () |
Pop a rasterization state from the stack. | |
void | pushColorBlend (optional< int > blendMode, optional< GraphicsColorWriteMode > colorWriteMode) |
Pushes blend state into the blend stack. | |
void | pushComposition (NativeFramebufferHandle handle, unsigned int bufferCount, Vector2 size) |
Pushes a composition target into the composition stack. | |
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. | |
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. | |
void | pushComposition (NativeFramebufferHandle handle, Vector2 size) |
Pushes a composition target into the composition stack. | |
void | pushComposition (NativeFramebufferHandle handle, Vector2 size, Vector4 viewport, optional< Vector4 > scissor) |
Pushes a composition target and a viewport into the composition stack. | |
void | pushComposition (optional< Vector4 > viewport, optional< Vector4 > scissor) |
Pushes a viewport and/or scissor onto composition stack. | |
void | pushComposition (Texture &texture) |
Pushes a composition target into the composition stack. | |
void | pushComposition (Texture &texture, Vector2 size) |
Pushes a composition target into the composition stack. | |
void | pushComposition (Texture &texture, Vector4 viewport, optional< Vector4 > scissor) |
Pushes a composition target and a viewport into the composition stack. | |
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. | |
void | pushRasterization (optional< GraphicsCullMode > cullMode, optional< Vector2 > polygonOffset) |
Pushes rasterization state. | |
void | setDebugComposer (RenderPassSharedPtr debugComposer) |
Set the debug composer to be used by this render context stack. | |
Composition stack for managing current render context.
The stack has no ownership over the stored render targets - they will not be reserved or deleted.
|
inlineexplicit |
Constructor.
|
inlineexplicit |
Constructor.
handle | Composition target handle. |
size | Composition target size. |
|
inlineexplicit |
Constructor.
handle | Composition target handle. |
size | Composition target size. |
viewport | Viewport area. |
scissor | Scissor area. |
|
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.
blendMode | Blend mode. |
colorWriteMode | Color write mode. |
blendMode
parameter changed from GraphicsBlendMode to int.
|
inline |
Pop blend state from blend stack.
void kanzi::CompositionStack::pushComposition | ( | NativeFramebufferHandle | handle, |
Vector2 | size ) |
Pushes a composition target into the composition stack.
handle | Composition target handle. |
size | Composition target size. |
void kanzi::CompositionStack::pushComposition | ( | NativeFramebufferHandle | handle, |
unsigned int | bufferCount, | ||
Vector2 | size ) |
Pushes a composition target into the composition stack.
handle | Composition target handle. |
bufferCount | Composition target handle. |
size | Composition target size. |
Pushes a composition target into the composition stack.
texture | Composition target. |
Pushes a composition target into the composition stack.
texture | Composition target. |
size | Composition target size. |
void kanzi::CompositionStack::pushComposition | ( | optional< Vector4 > | viewport, |
optional< Vector4 > | scissor ) |
Pushes a viewport and/or scissor onto composition stack.
viewport | optional viewport area. |
scissor | optional scissor area. |
void kanzi::CompositionStack::pushComposition | ( | Texture & | texture, |
Vector4 | viewport, | ||
optional< Vector4 > | scissor ) |
Pushes a composition target and a viewport into the composition stack.
texture | Composition target. |
viewport | Viewport area. |
scissor | Scissor 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.
handle | Composition target handle. |
size | Composition target size. |
viewport | Viewport area. |
scissor | Scissor area. |
|
inline |
Pushes a composition target and a viewport into the composition stack.
handle | Composition target handle. |
bufferCount | Number of draw buffers bound to the handle. |
size | Composition target size. |
viewport | Viewport area. |
scissor | Scissor area. |
|
inline |
Pushes a composition target and a viewport into the composition stack.
handle | Composition target handle. |
bufferCount | Number of draw buffers bound to the handle. |
size | Composition target size. |
viewport | Viewport area. |
scissor | Scissor area. |
texture | The texture to use as the composition target. |
|
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.
depthFunc | Depth testing function. |
depthWrite | Depth write enabled? |
stencilFunc | Stencil function. |
referenceValue | Stencil reference value. |
maskValue | Stencil mask value. |
stencilFail | Operation for stencil fail. |
stencilPassDepthFail | Operation for stencil pass but depth fail. |
stencilPassDepthPass | Operation for stencil and depth pass. |
stencilWrite | Stencil write enabled? |
|
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.
cullMode | Culling mode. |
polygonOffset | Polygon offset. |
|
inline |
Pop a rasterization state from the stack.
|
inline |
Get the debug composer used by this render context stack.
|
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.
renderer | Renderer 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.
renderer | Renderer to use. |
cameraMatrix | Precalculated cameraMatrix. |
projectionMatrix | Precalculated projectionMatrix. |
|
inline |
Kanzi uses this function internally to get the handle of the current composition target.
|
inline |
Kanzi uses this function internally to get the size of the current composition target.
|
inline |
Gets current scissor.
|
inline |
Gets current viewport.
|
inline |
Gets current viewport offset.
|
inline |
Gets current viewport size.
Disregards scissor.
|
inline |
Gets the current composition target texture.
|
inline |
Kanzi uses this function internally to get the current viewport in device coordinates.
|
inline |
Kanzi uses this function internally to get the current scissor area in device coordinates.
|
inline |
Kanzi uses this function internally to get the current polygon offset.
Applies the topmost color/blend stack state.
If stack is empty, default 2D blend settings are used.
renderer | Renderer to use. |
Applies the topmost color/blend stack state.
If stack is empty, default 3D blend settings are used.
renderer | Renderer to use. |
|
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.
Applies the topmost composition stack state for 2D rendering.
Default composition state for 2D is not defined.
renderer | Renderer to use. |
Applies the topmost composition stack state for 3D rendering.
Default composition state for 2D is not defined.
renderer | Renderer to use. |
|
inline |
Invalidates composition stack state.
Should only be called when manually modifying composition state so that applying again will not assume no changes.
Applies the topmost depth/stencil stack state.
If stack is empty, default depth/stencil settings are used.
renderer | Renderer to use. |
Applies the topmost depth/stencil stack state.
If stack is empty, default depth/stencil settings are used.
renderer | Renderer to use. |
|
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.
Applies the topmost rasterization stack state.
If stack is empty, default rasterization settings are used.
renderer | Renderer to use. |
Applies the topmost rasterization stack state.
If stack is empty, default rasterization settings are used.
renderer | Renderer to use. |
|
inline |
Invalidates rasterization stack state.
Should only be called when manually modifying rasterization state so that applying again will not assume no changes.
|
inline |
Invalidates all distinct stacks.
User should not need to call this function. Intended to be called along Renderer3D::reset() to signify context change.