#include <kanzi/core.ui/graphics2d/brush_renderer.hpp>
Public Types | |
enum | RenderMode { RenderModeNone, RenderModeContent, RenderModeNoContent } |
Enum signifying currently selected render mode. More... | |
Public Member Functions | |
void | bind (Renderer3D &renderer) |
Bind brush renderer for rendering. More... | |
void | draw (Renderer &renderer, const Geometry &quad, const Matrix4x4 &transform) |
Draw a brush using given quad. More... | |
void | draw (Renderer &renderer, const Geometry &quad, const Matrix3x3 &transform) |
Overload for draw a brush using given quad. More... | |
int | getBlendModeValue () |
Gets the last used blend mode value. More... | |
Brush * | getBrush () const |
Access brush. More... | |
TextureSharedPtr | getContentTexture () const |
Access content texture. More... | |
virtual MaterialSharedPtr | getMaterial () |
Get currently set material for the renderer. More... | |
Node * | getNode () const |
Gets the attached node. More... | |
unsigned int | getPropertyChangeCounter () const |
Access property change counter. More... | |
RenderMode | getRenderMode () const |
Get currently selected render mode. More... | |
float | getRenderOpacity () const |
Access opacity. More... | |
bool | hasRenderMode () const |
Indicates whether a valid render mode is selected. More... | |
void | restoreResources () |
Restore resources after sleep. More... | |
void | setContentTexture (TextureSharedPtr texture) |
Set a content texture. More... | |
void | setRenderOpacity (float opacity) |
Set opacity to use for next attach. More... | |
void | updateRender (optional< int > blendMode, bool translucencyHint) |
Called from Node2D::updateRender(). More... | |
virtual | ~BrushRenderer ()=default |
Destructor. More... | |
Protected Member Functions | |
virtual void | bindOverride (Renderer3D &renderer)=0 |
BrushRenderer-specific bind implementation. More... | |
BrushRenderer (Brush *brush, Node *node) | |
Constructor. More... | |
virtual void | drawOverride (Renderer &renderer, const Geometry &geometry, const Matrix4x4 &transform)=0 |
Draw geometry using the brush. More... | |
virtual int | getBlendModeValueOverride ()=0 |
BrushRenderer-specific acquisition of last-used blend mode. More... | |
bool | isChangeCounterSame () const |
Checks whether the property change counter matches that of the brush. More... | |
virtual void | restoreResourcesOverride ()=0 |
BrushRenderer-specific restore resources implementation. More... | |
virtual void | setContentTextureOverride (TextureSharedPtr texture) |
BrushRenderer-specific update of the content texture. More... | |
void | setRenderMode (RenderMode selection) |
Set render mode. More... | |
void | updateChangeCounter () |
Updates property change counter to match the counter value from brush. More... | |
virtual void | updateRenderOverride (optional< int > blendMode, bool translucencyHint)=0 |
BrushRenderer-specific opacity override implementation. More... | |
Protected Attributes | |
Brush * | m_brush |
Brush attached to. More... | |
unsigned int | m_brushPropertyChangeCounter |
Property change counter to track brush. More... | |
TextureSharedPtr | m_contentTexture |
Content texture provided to the brush renderer from outside, e.g. from Node2D. More... | |
Node * | m_node |
Node attached to. More... | |
RenderMode | m_renderMode |
Currently used render mode (or none if not selected). More... | |
float | m_renderOpacity |
Opacity to issue on attach. More... | |
Brush renderer class.
Just an interface, actual rendering will be implemented by specialized brush renderers.
|
virtualdefault |
Destructor.
Constructor.
node | The node to which to attach. |
brush | The brush to which to attach. |
|
inline |
Called from Node2D::updateRender().
Prepares a brush for rendering. Call this function when the brush material or attached nodes have changed. Unlike bind(), updateRender() does not need to be called every frame before draw().
blendMode | Optional blend mode override. |
translucencyHint | Additional hint to use translucent rendering. |
blendMode
parameter. forceOpaque
parameter.
|
inline |
void kanzi::BrushRenderer::draw | ( | Renderer & | renderer, |
const Geometry & | quad, | ||
const Matrix4x4 & | transform | ||
) |
Draw a brush using given quad.
renderer | Renderer to use. |
quad | Quad to draw. |
transform | The transform as a 4x4 matrix to use. |
|
inline |
Overload for draw a brush using given quad.
renderer | Renderer to use. |
quad | Quad to draw. |
transform | The transform as a 3x3 matrix to use. |
|
inline |
Restore resources after sleep.
|
inline |
Access property change counter.
|
inline |
Access opacity.
|
inline |
Set opacity to use for next attach.
opacity | New render opacity. |
|
inline |
Access content texture.
|
inline |
Set a content texture.
texture | New render texture. |
|
inline |
Get currently selected render mode.
|
inline |
Indicates whether a valid render mode is selected.
|
inlinevirtual |
Get currently set material for the renderer.
Reimplemented in kanzi::MaterialBrushRenderer, and kanzi::ContentBrushRenderer.
|
inline |
Gets the last used blend mode value.
This function is intended for tests.
|
protectedpure virtual |
Draw geometry using the brush.
To be implemented by specific brush implementations.
renderer | Renderer to use. |
geometry | Quad to draw. |
transform | Transform to use. |
Implemented in kanzi::ContentBrushRenderer, kanzi::MaterialBrushRenderer, kanzi::TextureBrushRenderer, and kanzi::ColorBrushRenderer.
|
protectedpure virtual |
BrushRenderer-specific bind implementation.
renderer | Renderer to use. |
Implemented in kanzi::MaterialBrushRenderer, kanzi::ContentBrushRenderer, kanzi::TextureBrushRenderer, and kanzi::ColorBrushRenderer.
|
protectedpure virtual |
BrushRenderer-specific opacity override implementation.
blendMode | Optional blend mode override. |
translucencyHint | Additional hint to use translucent rendering. |
blendMode
parameter. forceOpaque
parameter. Implemented in kanzi::ContentBrushRenderer, kanzi::MaterialBrushRenderer, kanzi::TextureBrushRenderer, and kanzi::ColorBrushRenderer.
|
protectedpure virtual |
BrushRenderer-specific restore resources implementation.
Implemented in kanzi::ContentBrushRenderer, kanzi::MaterialBrushRenderer, kanzi::TextureBrushRenderer, and kanzi::ColorBrushRenderer.
|
protectedpure virtual |
BrushRenderer-specific acquisition of last-used blend mode.
Implemented in kanzi::ContentBrushRenderer, and kanzi::MaterialBrushRenderer.
|
inlineprotectedvirtual |
BrushRenderer-specific update of the content texture.
texture | New renderer texture. |
Reimplemented in kanzi::ColorBrushRenderer.
|
inlineprotected |
Set render mode.
selection | New render mode selection. |
|
protected |
Checks whether the property change counter matches that of the brush.
|
protected |
Updates property change counter to match the counter value from brush.
|
protected |
Brush attached to.
|
protected |
Content texture provided to the brush renderer from outside, e.g. from Node2D.
|
protected |
Currently used render mode (or none if not selected).
|
protected |
Opacity to issue on attach.
|
protected |
Property change counter to track brush.