Composition stack for managing current render context. More...
#include <kanzi/core.ui/graphics/composition_stack.hpp>
Classes | |
| struct | ColorBlendState |
| Blend state. More... | |
| struct | CompositionState |
| Composition target state. More... | |
| struct | DepthStencilState |
| Depth/Stencil state. More... | |
| struct | RasterizationState |
| Rasterization state. More... | |
| class | StateStack |
| Template class for handling state arrays. More... | |
Public Member Functions | |
| void | apply () |
| Applies the topmost render settings. | |
| void | apply2D () |
| Applies the topmost render settings for 2D rendering. | |
| void | applyColorBlend () |
| Applies the topmost color/blend stack state. | |
| void | applyComposition () |
| Applies the topmost composition stack state. | |
| void | applyDepthStencil () |
| Applies the topmost depth/stencil stack state. | |
| void | applyPerspective2D (const Matrix4x4 &cameraMatrix, const Matrix4x4 &projectionMatrix) |
| Applies the topmost render settings for 2D perspective rendering. | |
| void | applyRasterization () |
| Applies the topmost rasterization stack state. | |
| CompositionStack (const CompositionStack &)=delete | |
| CompositionStack (Renderer *renderer) | |
| Constructor. | |
| const ColorBlendState * | getAppliedColorBlend () const |
| Gets the applied color blend state. | |
| const DepthStencilState * | getAppliedDepthStencil () const |
| Gets the applied depth stencil state. | |
| const RasterizationState * | getAppliedRasterization () const |
| Gets the applied rasterization state. | |
| 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. | |
| CompositionStack & | operator= (const CompositionStack &)=delete |
| const Framebuffer * | peekCompositionTargetFramebuffer () const |
| Kanzi uses this function internally to get the framebuffer 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 | popSettings () |
| Pops the topmost state from each composition stack. | |
| void | pushColorBlend (optional< int > blendMode, optional< GraphicsColorWriteMode > colorWriteMode) |
| Pushes blend state into the blend stack. | |
| void | pushComposition (const Framebuffer &framebuffer, Vector2 size) |
| Pushes a composition target into the composition stack. | |
| void | pushComposition (const Framebuffer &framebuffer, 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 or scissor into the 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 | pushComposition (Vector4 viewport) |
| Pushes a viewport into the composition stack. | |
| void | pushCompositionActiveGraphicsOutput () |
| Pushes the active graphics output framebuffer into the composition stack. | |
| void | pushCompositionActiveGraphicsOutput (Vector2 size) |
| Pushes the active graphics output framebuffer into the composition stack. | |
| void | pushCompositionActiveGraphicsOutput (Vector4 viewport) |
| Pushes the active graphics output framebuffer into the composition stack. | |
| void | pushDefaultSettings2D () |
| Pushes a default 2D state into each settings stack. | |
| void | pushDefaultSettings3D () |
| Pushes a default 3D state into each settings 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< GraphicsFillMode > fillMode, optional< Vector2 > polygonOffset, optional< float > lineWidth) |
| Pushes rasterization state. | |
| void | setDebugComposer (RenderPassSharedPtr debugComposer) |
| Set the debug composer to be used by this render context stack. | |
| void | setRasterizationFillModeOverride (optional< GraphicsFillMode > fillMode) |
| Sets a manual override of the Rasterization FillMode. | |
| void | setStencilOverride (optional< GraphicsCompareFunction > stencilFunc, optional< unsigned int > referenceValue, optional< unsigned int > maskValue, optional< GraphicsStencilOperation > stencilFail, optional< GraphicsStencilOperation > stencilPassDepthFail, optional< GraphicsStencilOperation > stencilPassDepthPass, optional< bool > stencilWrite) |
| Sets a manual override of the Stencil State. | |
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.
| renderer | The core renderer. |
|
delete |
|
delete |
|
inline |
Tells if composition stack is empty.
Empty composition stack has no states of any kind.
| 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::pushCompositionActiveGraphicsOutput | ( | ) |
Pushes the active graphics output framebuffer into the composition stack.
Pushes the active graphics output framebuffer into the composition stack.
| size | Composition target size. |
Pushes the active graphics output framebuffer into the composition stack.
| viewport | Viewport area. |
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 | ( | 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 | ( | const Framebuffer & | framebuffer, |
| Vector2 | size ) |
Pushes a composition target into the composition stack.
| framebuffer | Composition target framebuffer. |
| size | Composition target size. |
| void kanzi::CompositionStack::pushComposition | ( | const Framebuffer & | framebuffer, |
| Vector2 | size, | ||
| Vector4 | viewport, | ||
| optional< Vector4 > | scissor ) |
Pushes a composition target and a viewport into the composition stack.
| framebuffer | Composition target framebuffer. |
| size | Composition target size. |
| viewport | Viewport area. |
| scissor | Scissor area. |
| void kanzi::CompositionStack::pushComposition | ( | optional< Vector4 > | viewport, |
| optional< Vector4 > | scissor ) |
Pushes a viewport or scissor into the composition stack.
| viewport | Optional viewport area. |
| scissor | Optional scissor area. |
Pushes a viewport into the composition stack.
| viewport | Viewport area. |
| void kanzi::CompositionStack::popComposition | ( | ) |
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< GraphicsFillMode > | fillMode, | ||
| optional< Vector2 > | polygonOffset, | ||
| optional< float > | lineWidth ) |
Pushes rasterization state.
Using nullopt with any parameter will take the default value or the last value pushed.
| cullMode | Culling mode. |
| fillMode | Filling mode. |
| polygonOffset | Polygon offset. |
| lineWidth | Line width. |
|
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::apply | ( | ) |
Applies the topmost render settings.
| void kanzi::CompositionStack::apply2D | ( | ) |
Applies the topmost render settings for 2D rendering.
renderer parameter. | void kanzi::CompositionStack::applyPerspective2D | ( | const Matrix4x4 & | cameraMatrix, |
| const Matrix4x4 & | projectionMatrix ) |
Applies the topmost render settings for 2D perspective rendering.
| cameraMatrix | Precalculated cameraMatrix. |
| projectionMatrix | Precalculated projectionMatrix. |
renderer parameter.
|
inline |
Kanzi uses this function internally to get the framebuffer 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 parameter.
|
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.
renderer parameter.
|
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 parameter.
|
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 parameter.
|
inline |
Invalidates rasterization stack state.
Should only be called when manually modifying rasterization state so that applying again will not assume no changes.
|
inline |
Gets the applied color blend state.
|
inline |
Gets the applied depth stencil state.
|
inline |
Gets the applied rasterization state.
|
inline |
Invalidates all distinct stacks.
Removes all states from each stack. User should not need to call this function. Intended to be called along Renderer::reset() to signify context change.
| void kanzi::CompositionStack::pushDefaultSettings2D | ( | ) |
Pushes a default 2D state into each settings stack.
This does not push the composition stack.
| void kanzi::CompositionStack::pushDefaultSettings3D | ( | ) |
Pushes a default 3D state into each settings stack.
This does not push the composition stack.
| void kanzi::CompositionStack::popSettings | ( | ) |
Pops the topmost state from each composition stack.
This does not pop the composition stack.
| void kanzi::CompositionStack::setRasterizationFillModeOverride | ( | optional< GraphicsFillMode > | fillMode | ) |
Sets a manual override of the Rasterization FillMode.
The override takes effect when a pushRasterization, pushDefaultSettings2D, or pushDefaultSettings3D operation occurs.
| fillMode | The fill mode, or nullopt to disable the override. |
| void kanzi::CompositionStack::setStencilOverride | ( | optional< GraphicsCompareFunction > | stencilFunc, |
| optional< unsigned int > | referenceValue, | ||
| optional< unsigned int > | maskValue, | ||
| optional< GraphicsStencilOperation > | stencilFail, | ||
| optional< GraphicsStencilOperation > | stencilPassDepthFail, | ||
| optional< GraphicsStencilOperation > | stencilPassDepthPass, | ||
| optional< bool > | stencilWrite ) |
Sets a manual override of the Stencil State.
The override takes effect when a pushDepthStencil, pushDefaultSettings2D, or pushDefaultSettings3D operation occurs.
| stencilFunc | The stencil function, or nullopt to disable the override. |
| referenceValue | The reference value, or nullopt to disable the override. |
| maskValue | The mask value, or nullopt to disable the override. |
| stencilFail | The stencil fail operation, or nullopt to disable the override. |
| stencilPassDepthFail | The stencil pass, but depth fail operation, or nullopt to disable the override. |
| stencilPassDepthPass | The depth and stencil pass operation, or nullopt to disable the override. |
| stencilWrite | Is stencil write enabled, or nullopt to disable the override. |