Kanzi Framework  3.9.0
Kanzi Engine API
kanzi::BrushRenderer Class Referenceabstract

Brush renderer class. More...

#include <kanzi/core.ui/graphics2d/brush_renderer.hpp>

Inheritance diagram for kanzi::BrushRenderer:
[legend]

Public Types

enum  RenderMode {
  RenderModeNone, RenderModeInvalid, RenderModeOpaqueNoContent, RenderModeTranslucentNoContent,
  RenderModeOpaque, RenderModeTranslucent
}
 Enum signifying currently selected render mode. More...
 

Public Member Functions

void bind (Renderer3D &renderer)
 Bind brush renderer for rendering. More...
 
void draw (Renderer3D &renderer, const Geometry &quad, const Matrix4x4 &transform)
 Draw a brush using given quad. More...
 
void draw (Renderer3D &renderer, const Geometry &quad, const Matrix3x3 &transform)
 Overload for draw a brush using given quad. More...
 
BrushgetBrush () const
 Access brush. More...
 
TextureSharedPtr getContentTexture () const
 Access content texture. More...
 
virtual MaterialSharedPtr getMaterial ()
 Get currently set material for the renderer. More...
 
NodegetNode () const
 Access 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 hasOpaqueRenderMode () const
 Tell if selected render mode is opaque. More...
 
bool hasRenderMode () const
 Tell if any (valid) render mode selection has been made. 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 (bool forceOpaque, bool translucencyHint)
 Called from Node2D::updateRender(), prepare brush for rendering. More...
 
void updateRender (bool forceOpaque)
 Default parameter override for updateRender(). More...
 
void updateRender ()
 Default parameter override for updateRender(). More...
 
virtual ~BrushRenderer ()
 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 (Renderer3D &renderer, const Geometry &geometry, const Matrix4x4 &transform)=0
 Draw a clip quad. More...
 
bool isChangeCounterSame () const
 Check if property change counter matches that of the brush. More...
 
virtual void restoreResourcesOverride ()=0
 BrushRenderer-specific restore resources implementation. More...
 
void setRenderMode (RenderMode selection)
 Set render mode. More...
 
void updateChangeCounter ()
 Update property change counter to match brush. More...
 
virtual void updateRenderOverride (bool forceOpaque, bool translucencyHint)=0
 BrushRenderer-specific opacity override implementation. More...
 

Detailed Description

Brush renderer class.

Just an interface, actual rendering will be implemented by specialized brush renderers.

Member Enumeration Documentation

◆ RenderMode

Enum signifying currently selected render mode.

Enumerator
RenderModeNone 

No selection.

RenderModeInvalid 

Invalid render mode - selection has been done but suitable render mode could not be selected.

RenderModeOpaqueNoContent 

Opaque without content.

RenderModeTranslucentNoContent 

Translucent without content.

RenderModeOpaque 

Opaque with content.

RenderModeTranslucent 

Translucent with content.

Constructor & Destructor Documentation

◆ ~BrushRenderer()

virtual kanzi::BrushRenderer::~BrushRenderer ( )
inlinevirtual

Destructor.

◆ BrushRenderer()

kanzi::BrushRenderer::BrushRenderer ( Brush brush,
Node node 
)
inlineexplicitprotected

Constructor.

Parameters
nodeNode to attach to.
brushBrush to attach to.

Member Function Documentation

◆ updateRender() [1/3]

void kanzi::BrushRenderer::updateRender ( bool  forceOpaque,
bool  translucencyHint 
)

Called from Node2D::updateRender(), prepare brush for rendering.

updateRender() should be called when brush material or attached nodes have been changed. Unlike bind(), updateRender() does not need to be called every frame before draw().

Parameters
forceOpaqueShould opaque render mode be selected no matter what?
translucencyHintAdditional hint to use translucent rendering.

◆ updateRender() [2/3]

void kanzi::BrushRenderer::updateRender ( bool  forceOpaque)
inline

Default parameter override for updateRender().

Allows forcing opacity, in this situation translucency hint does not matter.

Parameters
forceOpaqueShould opaque render mode be selected no matter what?

◆ updateRender() [3/3]

void kanzi::BrushRenderer::updateRender ( )
inline

Default parameter override for updateRender().

Opaqueness force and translucency hint are off.

◆ bind()

void kanzi::BrushRenderer::bind ( Renderer3D renderer)

Bind brush renderer for rendering.

Must be called before calling draw().

Parameters
rendererRenderer to use.

◆ draw() [1/2]

void kanzi::BrushRenderer::draw ( Renderer3D renderer,
const Geometry quad,
const Matrix4x4 transform 
)

Draw a brush using given quad.

Parameters
rendererRenderer to use.
quadQuad to draw.
transformTransform (4X4) to use.

◆ draw() [2/2]

void kanzi::BrushRenderer::draw ( Renderer3D renderer,
const Geometry quad,
const Matrix3x3 transform 
)
inline

Overload for draw a brush using given quad.

Parameters
rendererRenderer to use.
quadQuad to draw.
transformTransform (3X3) to use.

◆ restoreResources()

void kanzi::BrushRenderer::restoreResources ( )

Restore resources after sleep.

◆ getBrush()

Brush* kanzi::BrushRenderer::getBrush ( ) const
inline

Access brush.

Returns
Brush pointer.

◆ getPropertyChangeCounter()

unsigned int kanzi::BrushRenderer::getPropertyChangeCounter ( ) const
inline

Access property change counter.

◆ getRenderOpacity()

float kanzi::BrushRenderer::getRenderOpacity ( ) const
inline

Access opacity.

Returns
Current render opacity.

◆ setRenderOpacity()

void kanzi::BrushRenderer::setRenderOpacity ( float  opacity)
inline

Set opacity to use for next attach.

Parameters
opacityNew render opacity.

◆ getContentTexture()

TextureSharedPtr kanzi::BrushRenderer::getContentTexture ( ) const
inline

Access content texture.

Returns
Current content texture.

◆ setContentTexture()

void kanzi::BrushRenderer::setContentTexture ( TextureSharedPtr  texture)
inline

Set a content texture.

Parameters
textureNew render texture.

◆ getNode()

Node* kanzi::BrushRenderer::getNode ( ) const
inline

Access node.

Returns
Node pointer.

◆ getRenderMode()

RenderMode kanzi::BrushRenderer::getRenderMode ( ) const
inline

Get currently selected render mode.

Returns
Current render mode.

◆ hasRenderMode()

bool kanzi::BrushRenderer::hasRenderMode ( ) const
inline

Tell if any (valid) render mode selection has been made.

◆ hasOpaqueRenderMode()

bool kanzi::BrushRenderer::hasOpaqueRenderMode ( ) const
inline

Tell if selected render mode is opaque.

◆ getMaterial()

virtual MaterialSharedPtr kanzi::BrushRenderer::getMaterial ( )
inlinevirtual

Get currently set material for the renderer.

Returns
Shared pointer to the material that is currently set for the brush renderer. If not set, returns nullptr.

Reimplemented in kanzi::MaterialBrushRenderer, kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, and kanzi::ContentBrushRenderer.

◆ drawOverride()

virtual void kanzi::BrushRenderer::drawOverride ( Renderer3D renderer,
const Geometry geometry,
const Matrix4x4 transform 
)
protectedpure virtual

Draw a clip quad.

To be implemented by specific brush implementations.

Parameters
rendererRenderer to use.
geometryQuad to draw.
transformTransform to use.

Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::MaterialBrushRenderer.

◆ bindOverride()

virtual void kanzi::BrushRenderer::bindOverride ( Renderer3D renderer)
protectedpure virtual

BrushRenderer-specific bind implementation.

Parameters
rendererRenderer to use.

Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::MaterialBrushRenderer.

◆ updateRenderOverride()

virtual void kanzi::BrushRenderer::updateRenderOverride ( bool  forceOpaque,
bool  translucencyHint 
)
protectedpure virtual

BrushRenderer-specific opacity override implementation.

Parameters
forceOpaqueShould opaque render mode be selected no matter what?
translucencyHintAdditional hint to use translucent rendering.

Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::MaterialBrushRenderer.

◆ restoreResourcesOverride()

virtual void kanzi::BrushRenderer::restoreResourcesOverride ( )
protectedpure virtual

BrushRenderer-specific restore resources implementation.

Implemented in kanzi::TextureBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::MaterialBrushRenderer.

◆ setRenderMode()

void kanzi::BrushRenderer::setRenderMode ( RenderMode  selection)
inlineprotected

Set render mode.

Parameters
selectionNew render mode selection.

◆ isChangeCounterSame()

bool kanzi::BrushRenderer::isChangeCounterSame ( ) const
inlineprotected

Check if property change counter matches that of the brush.

Returns
True if matches and no update is necessary, false otherwise.

◆ updateChangeCounter()

void kanzi::BrushRenderer::updateChangeCounter ( )
inlineprotected

Update property change counter to match brush.


The documentation for this class was generated from the following file: