Data and functionality required for rendering Node2D visuals. More...
#include <kanzi/core.ui/node/node_visual2d.hpp>
Classes | |
| struct | BrushState |
| State associated with brush rendering. More... | |
Public Member Functions | |
| tuple< QuadDescription, unsigned int > | calculateContentStretch (int contentStretch, Vector2 renderSize, Vector2 contentSize) |
| Calculates foreground content stretch. | |
| BrushRenderer * | getBackgroundBrushRenderer () const |
| Gets background brush renderer. | |
| const Geometry & | getBackgroundGeometry () const |
| Gets a pointer to the background geometry. | |
| Matrix3x3 | getBackgroundLocalTransformation () const |
| Gets transformation for transforming the background geometry vertex positions relative to the node top left corner. | |
| Vector2 | getBackgroundTiling () const |
| Gets background tiling from brush if present. | |
| BrushRenderer * | getForegroundBrushRenderer () const |
| Gets foreground brush renderer. | |
| const Geometry & | getForegroundGeometry () const |
| Gets a pointer to the foreground geometry. | |
| Matrix3x3 | getForegroundLocalTransformation () const |
| Gets transformation for transforming the foreground geometry vertex positions relative to the node top left corner. | |
| Vector2 | getForegroundTiling () const |
| Gets foreground tiling from brush if present. | |
| optional< float > | getHorizontalTilingOverride () const |
| Gets the horizontal tiling override. | |
| optional< float > | getVerticalTilingOverride () const |
| Gets the vertical tiling override. | |
| bool | isBackgoundBrushTilingDirty () const |
| Returns whether the tiling of the Background Brush has changed. | |
| bool | isBackgroundGeometryValid () const |
| Indicates whether background geometry is set and is valid. | |
| bool | isBackgroundOpaque () const |
| Indicates whether background brush is present and is opaque. | |
| bool | isForegoundBrushTilingDirty () const |
| Returns whether the tiling of the Foreground Brush has changed. | |
| bool | isForegroundGeometryValid () const |
| Indicates whether foreground geometry is set and is valid. | |
| bool | isForegroundOpaque () const |
| Indicates whether foreground brush is present and is opaque. | |
| void | onDetached () |
| Kanzi calls this function when the node that owns the visual becomes detached. | |
| void | renderBackground (Renderer3D &renderer, const Geometry &geometry, const Matrix3x3 &transform) |
| Render using background brush wrapper. | |
| void | renderBackground (Renderer3D &renderer, const Geometry &geometry, const Matrix4x4 &transform) |
| Renders using background brush. | |
| void | renderBackground (Renderer3D &renderer, const Matrix3x3 &transform) |
| Render using background brush wrapper. | |
| void | renderBackground (Renderer3D &renderer, const Matrix4x4 &transform) |
| Renders using background brush. | |
| void | renderBackground (Renderer3D &renderer, const Matrix4x4 &transform, BrushRenderer &brushRenderer) |
| Renders background using an override brush renderer. | |
| void | renderForeground (Renderer3D &renderer, const Matrix3x3 &transform) |
| Renders using foreground brush wrapper. | |
| void | renderForeground (Renderer3D &renderer, const Matrix4x4 &transform) |
| Renders using foreground brush. | |
| void | renderForeground (Renderer3D &renderer, const Matrix4x4 &transform, BrushRenderer &brushRenderer) |
| Renders foreground using an override brush renderer. | |
| void | resetBackgroundBrush () |
| Resets background brush renderer. | |
| void | resetBackgroundGeometry () |
| Resets outside area quad. | |
| void | resetForegroundBrush () |
| Resets foreground brush renderer. | |
| void | resetForegroundGeometry () |
| Resets foreground geometry. | |
| void | restoreResources () |
| Restores resources to GPU, if applicable. | |
| void | setBackgroundBrush (Brush *brush, Node &node) |
| Creates background brush renderer. | |
| void | setBackgroundGeometry (Domain *domain, const FrameDescription &frame) |
| Creates the outside area quad. | |
| void | setBackgroundGeometry (Domain *domain, const QuadDescription &bg, const QuadDescription &fg, unsigned int clippingResult) |
| Creates the outside area quad. | |
| void | setBackgroundGeometry (Domain *domain, const QuadDescription &quad) |
| Creates a background quad. | |
| void | setForegroundBrushRenderer (Brush *brush, Node &node) |
| Creates foreground brush renderer. | |
| void | setForegroundGeometry (Domain *domain, const QuadDescription &quad) |
| Sets foreground quad with full data. | |
| void | setHorizontalTilingOverride (optional< float > tiling) |
| Sets the horizontal tiling override. | |
| void | setVerticalTilingOverride (optional< float > tiling) |
| Sets the vertical tiling override. | |
| void | updateBlendSettings (bool selfInCompositionTarget) |
| Updates brush renderers for rendering. | |
| void | updateContentTexture (TextureSharedPtr texture) |
| Updates content texture in foreground brush renderer, if it exists. | |
| void | updateRender (optional< int > blendMode, float layoutOpacity) |
| Stores rendering parameters for the brushes and selects materials. | |
Static Public Member Functions | |
| static unique_ptr< NodeVisual2D > | create () |
| Creates a NodeVisual2D. | |
Protected Member Functions | |
| NodeVisual2D ()=default | |
| Default constructor. | |
Protected Attributes | |
| BrushState | m_backgroundBrushState |
| State associated with background brush rendering. | |
| optional< int > | m_blendMode |
| Saved blend mode parameter. | |
| bool | m_brushRenderersDirty |
| Brush renderer dirty flag. | |
| BrushState | m_foregroundBrushState |
| State associated with foreground brush rendering. | |
| optional< float > | m_horizontalTilingOverride |
| Optional horizontal tiling override. | |
| float | m_layoutOpacity |
| Saved opacity parameter. | |
| bool | m_selfInCompositionTarget |
| Flag that indicates whether the node is rendered to a composition target. | |
| optional< float > | m_verticalTilingOverride |
| Optional vertical tiling override. | |
Data and functionality required for rendering Node2D visuals.
|
explicitprotecteddefault |
Default constructor.
|
static |
Creates a NodeVisual2D.
| void kanzi::NodeVisual2D::onDetached | ( | ) |
Kanzi calls this function when the node that owns the visual becomes detached.
| tuple< QuadDescription, unsigned int > kanzi::NodeVisual2D::calculateContentStretch | ( | int | contentStretch, |
| Vector2 | renderSize, | ||
| Vector2 | contentSize ) |
Calculates foreground content stretch.
| contentStretch | Content stretch mode of type Node2D::ContentStretch. |
| renderSize | Render size. |
| contentSize | Content size. |
| void kanzi::NodeVisual2D::renderBackground | ( | Renderer3D & | renderer, |
| const Matrix4x4 & | transform, | ||
| BrushRenderer & | brushRenderer ) |
| void kanzi::NodeVisual2D::renderBackground | ( | Renderer3D & | renderer, |
| const Geometry & | geometry, | ||
| const Matrix4x4 & | transform ) |
Renders using background brush.
| renderer | Renderer to use. |
| geometry | Quad to render. |
| transform | Transform for the quad. |
|
inline |
Render using background brush wrapper.
| void kanzi::NodeVisual2D::renderBackground | ( | Renderer3D & | renderer, |
| const Matrix4x4 & | transform ) |
Renders using background brush.
Uses background quad from visual.
| renderer | Renderer to use. |
| transform | Transform for the quad. |
|
inline |
Render using background brush wrapper.
| void kanzi::NodeVisual2D::renderForeground | ( | Renderer3D & | renderer, |
| const Matrix4x4 & | transform, | ||
| BrushRenderer & | brushRenderer ) |
| void kanzi::NodeVisual2D::renderForeground | ( | Renderer3D & | renderer, |
| const Matrix4x4 & | transform ) |
Renders using foreground brush.
| renderer | Renderer to use. |
| transform | Transform for the quad. |
|
inline |
Renders using foreground brush wrapper.
| void kanzi::NodeVisual2D::restoreResources | ( | ) |
Restores resources to GPU, if applicable.
renderer parameter. Stores rendering parameters for the brushes and selects materials.
Kanzi calls this function during Node2D::updateRender(). To select the materials, this function calls BrushRenderer::updateRender() on the brush renderers. Kanzi calls updateBlendSettings() later during rendering, after determining whether to composit.
| blendMode | The blend mode of the node. If the node is composited, pass nullopt. |
| layoutOpacity | The layout opacity of the node. |
blendMode parameter. foregroundOpaquenessHint parameter. foregroundTranslucencyHint parameter. Updates brush renderers for rendering.
If no settings have changed, this call is a NOP.
| selfInCompositionTarget | Whether the node is rendered to a composition target. |
|
inline |
Gets background brush renderer.
Creates background brush renderer.
| node | The node to which to attach. |
| brush | The brush from which to create the renderer. |
brush parameter changed from BrushSharedPtr to Brush*.
|
inline |
Resets background brush renderer.
|
inline |
Gets foreground brush renderer.
Creates foreground brush renderer.
| node | The node to which to attach. |
| brush | The brush from which to create the renderer. |
brush parameter changed from BrushSharedPtr to Brush*.
|
inline |
Resets foreground brush renderer.
Gets a pointer to the foreground geometry.
Call this function only if you know that foreground geometry is valid.
| bool kanzi::NodeVisual2D::isForegroundGeometryValid | ( | ) | const |
Indicates whether foreground geometry is set and is valid.
| void kanzi::NodeVisual2D::setForegroundGeometry | ( | Domain * | domain, |
| const QuadDescription & | quad ) |
Sets foreground quad with full data.
| domain | Domain to use. |
| quad | The quad to set. |
| void kanzi::NodeVisual2D::resetForegroundGeometry | ( | ) |
Resets foreground geometry.
| Matrix3x3 kanzi::NodeVisual2D::getForegroundLocalTransformation | ( | ) | const |
Gets transformation for transforming the foreground geometry vertex positions relative to the node top left corner.
| Vector2 kanzi::NodeVisual2D::getBackgroundTiling | ( | ) | const |
Gets background tiling from brush if present.
| Vector2 kanzi::NodeVisual2D::getForegroundTiling | ( | ) | const |
Gets foreground tiling from brush if present.
|
inline |
Indicates whether background brush is present and is opaque.
|
inline |
Indicates whether foreground brush is present and is opaque.
Gets a pointer to the background geometry.
Call this function only if you know that background geometry is valid.
| bool kanzi::NodeVisual2D::isBackgroundGeometryValid | ( | ) | const |
Indicates whether background geometry is set and is valid.
| void kanzi::NodeVisual2D::setBackgroundGeometry | ( | Domain * | domain, |
| const QuadDescription & | quad ) |
Creates a background quad.
| domain | Domain to use. |
| quad | Quad description. |
| void kanzi::NodeVisual2D::setBackgroundGeometry | ( | Domain * | domain, |
| const FrameDescription & | frame ) |
Creates the outside area quad.
Creates a frame that does not include the foreground area.
| domain | Domain to use. |
| frame | The frame description to use. |
| void kanzi::NodeVisual2D::setBackgroundGeometry | ( | Domain * | domain, |
| const QuadDescription & | bg, | ||
| const QuadDescription & | fg, | ||
| unsigned int | clippingResult ) |
Creates the outside area quad.
Creates a frame that does not include the foreground area.
| domain | Domain to use. |
| bg | Whole background area quad. |
| fg | Whole foreground area quad. |
| clippingResult | Clipping result. |
| void kanzi::NodeVisual2D::resetBackgroundGeometry | ( | ) |
Resets outside area quad.
| Matrix3x3 kanzi::NodeVisual2D::getBackgroundLocalTransformation | ( | ) | const |
Gets transformation for transforming the background geometry vertex positions relative to the node top left corner.
|
inline |
Updates content texture in foreground brush renderer, if it exists.
Sets the horizontal tiling override.
This overrides the horizontal tiling set in a brush.
| tiling | Horizontal tiling override to use, or nullopt to disable the override. |
|
inline |
Gets the horizontal tiling override.
Sets the vertical tiling override.
This overrides the vertical tiling set in a brush.
| tiling | Vertical tiling override to use, or nullopt to disable the override. |
|
inline |
Gets the vertical tiling override.
|
inline |
|
inline |
|
protected |
State associated with background brush rendering.
|
protected |
State associated with foreground brush rendering.
|
protected |
Saved blend mode parameter.
Affects brush selection unless the node is composited.
|
protected |
Saved opacity parameter.
|
protected |
Flag that indicates whether the node is rendered to a composition target.
|
protected |
Optional horizontal tiling override.
|
protected |
Optional vertical tiling override.