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< NativeFramebufferHandle > | peekCompositionTargetHandle () const |
Kanzi uses this function internally to get the handle of the current composition target. More... | |
optional< Vector2 > | peekPolygonOffset () |
Kanzi uses this function internally to get the current polygon offset. More... | |
optional< Vector2 > | peekRenderContextSize () const |
Kanzi uses this function internally to get the size of the current composition target. More... | |
optional< Vector4 > | peekScissor () const |
Gets current scissor. More... | |
optional< ViewportRectangle > | peekScissorDeviceCoordinates () |
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< Vector4 > | peekViewport () const |
Gets current viewport. More... | |
optional< ViewportRectangle > | peekViewportDeviceCoordinates () |
Kanzi uses this function internally to get the current viewport in device coordinates. More... | |
optional< Vector2 > | peekViewportOffset () const |
Gets current viewport offset. More... | |
optional< Vector2 > | peekViewportSize () 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... | |
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. |
void kanzi::CompositionStack::pushComposition | ( | Texture & | texture | ) |
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.
|
inline |
Applies the topmost color/blend stack state.
If stack is empty, default 2D blend settings are used.
renderer | Renderer to use. |
|
inline |
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.
|
inline |
Applies the topmost composition stack state for 2D rendering.
Default composition state for 2D is not defined.
renderer | Renderer to use. |
|
inline |
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.
|
inline |
Applies the topmost depth/stencil stack state.
If stack is empty, default depth/stencil settings are used.
renderer | Renderer to use. |
|
inline |
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.
|
inline |
Applies the topmost rasterization stack state.
If stack is empty, default rasterization settings are used.
renderer | Renderer to use. |
|
inline |
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.