#include <kanzi/core.ui/platform/graphics_backend/gl/brush_renderer.hpp>
Public Types | |
enum | RenderMode { RenderModeNone, RenderModeInvalid, RenderModeOpaqueNoContent, RenderModeTranslucentNoContent, RenderModeOpaque, RenderModeTranslucent } |
Enum signifying currently selected render mode. More... | |
Public Member Functions | |
virtual | ~BrushRenderer () |
Destructor. 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... | |
void | bind (Renderer3D &renderer) |
Bind brush renderer for rendering. More... | |
void | draw (Renderer3D &renderer, const Geometry &quad, const Matrix4x4 &transform) const |
Draw a brush using given quad. More... | |
void | draw (Renderer3D &renderer, const Geometry &quad, const Matrix3x3 &transform) const |
Overload for draw a brush using given quad. More... | |
void | restoreResources () |
Restore resources after sleep. More... | |
Brush * | getBrush () const |
Access brush. More... | |
unsigned int | getPropertyChangeCounter () const |
Access property change counter. More... | |
float | getRenderOpacity () const |
Access opacity. More... | |
void | setRenderOpacity (float opacity) |
Set opacity to use for next attach. More... | |
TextureSharedPtr | getContentTexture () const |
Access content texture. More... | |
void | setContentTexture (TextureSharedPtr texture) |
Set a content texture. More... | |
Node * | getNode () const |
Access node. More... | |
RenderMode | getRenderMode () const |
Get currently selected render mode. More... | |
bool | hasRenderMode () const |
Tell if any (valid) render mode selection has been made. More... | |
bool | hasOpaqueRenderMode () const |
Tell if selected render mode is opaque. More... | |
Protected Member Functions | |
BrushRenderer (Brush *brush, Node *node) | |
Constructor. More... | |
virtual void | drawOverride (Renderer3D &renderer, const Geometry &geometry, const Matrix4x4 &transform) const =0 |
Draw a clip quad. More... | |
virtual void | bindOverride (Renderer3D &renderer)=0 |
BrushRenderer-specific bind implementation. More... | |
virtual void | updateRenderOverride (bool forceOpaque, bool translucencyHint)=0 |
BrushRenderer-specific opacity override implementation. More... | |
virtual void | restoreResourcesOverride ()=0 |
BrushRenderer-specific restore resources implementation. More... | |
void | setRenderMode (RenderMode selection) |
Set render mode. More... | |
bool | isChangeCounterSame () const |
Check if property change counter matches that of the brush. More... | |
void | updateChangeCounter () |
Update property change counter to match brush. More... | |
Brush renderer class.
Just an interface, actual rendering will be implemented by specialized brush renderers.
Enum signifying currently selected render mode.
|
inlinevirtual |
Destructor.
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().
forceOpaque | Should opaque render mode be selected no matter what? |
translucencyHint | Additional hint to use translucent rendering. |
|
inline |
Default parameter override for updateRender().
Allows forcing opacity, in this situation translucency hint does not matter.
forceOpaque | Should opaque render mode be selected no matter what? |
|
inline |
Default parameter override for updateRender().
Opaqueness force and translucency hint are off.
void kanzi::BrushRenderer::bind | ( | Renderer3D & | renderer | ) |
void kanzi::BrushRenderer::draw | ( | Renderer3D & | renderer, |
const Geometry & | quad, | ||
const Matrix4x4 & | transform | ||
) | const |
Draw a brush using given quad.
renderer | Renderer to use. |
quad | Quad to draw. |
transform | Transform (4X4) to use. |
|
inline |
Overload for draw a brush using given quad.
renderer | Renderer to use. |
quad | Quad to draw. |
transform | Transform (3X3) to use. |
void kanzi::BrushRenderer::restoreResources | ( | ) |
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 |
Tell if any (valid) render mode selection has been made.
|
inline |
Tell if selected render mode is opaque.
|
protectedpure virtual |
Draw a clip quad.
To be implemented by specific brush implementations.
renderer | Renderer to use. |
geometry | Quad to draw. |
transform | Transform to use. |
Implemented in kanzi::MaterialBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::TextureBrushRenderer.
|
protectedpure virtual |
BrushRenderer-specific bind implementation.
Implemented in kanzi::MaterialBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::TextureBrushRenderer.
|
protectedpure virtual |
BrushRenderer-specific opacity override implementation.
forceOpaque | Should opaque render mode be selected no matter what? |
translucencyHint | Additional hint to use translucent rendering. |
Implemented in kanzi::MaterialBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::TextureBrushRenderer.
|
protectedpure virtual |
BrushRenderer-specific restore resources implementation.
Implemented in kanzi::MaterialBrushRenderer, kanzi::ColorBrushRenderer, kanzi::ContentBrushRenderer, and kanzi::TextureBrushRenderer.
|
inlineprotected |
Set render mode.
selection | New render mode selection. |
|
inlineprotected |
Check if property change counter matches that of the brush.
|
inlineprotected |
Update property change counter to match brush.