kanzi::MaterialRenderer Class Reference

Material renderer. More...

#include <kanzi/core.ui/graphics3d/material_renderer.hpp>

Public Member Functions

void attach (MaterialSharedPtr material, Node3D &node)
 Reattaches material renderer to a model and a mesh. More...
 
void bind (Renderer3D &renderer)
 Bind material renderer for rendering. More...
 
void draw (Renderer3D &renderer, Node3D &node, Mesh &mesh, KzcDynamicArray *transformedObjects) const
 Draw the given morph using attached material. More...
 
void invalidateRenderValues ()
 Mark all property notification handlers dirty. More...
 
GlRenderStategetRenderState ()
 Access render state. More...
 
MaterialSharedPtr getMaterial () const
 Access brush. More...
 
bool isRenderable () const
 Tells if this material renderer can be used for rendering. More...
 
GlRenderState::HandleType getTextureHandle (string_view name)
 Get texture handle for contained render state. More...
 
GlRenderState::HandleType getContentTextureHandle ()
 Get content texture handle for contained render state. More...
 
void setTextureValue (GlRenderState::HandleType handle, TextureSharedPtr value)
 Set texture value in contained render state. More...
 
void invalidateNotificationHandlers ()
 Marks the notification handlers as invalid. More...
 

Static Public Member Functions

static unique_ptr< MaterialRenderercreate ()
 Constructor. More...
 

Protected Member Functions

 MaterialRenderer ()
 Constructor. More...
 
bool isChangeCounterSame (Material &material) const
 Check if property change counter matches that of the brush. More...
 
void updateChangeCounter (Material &material)
 Update property change counter to match brush. More...
 

Detailed Description

Material renderer.

Connects material, mesh and 3D node like a brush renderer connects material, brush and 2D node.

Constructor & Destructor Documentation

kanzi::MaterialRenderer::MaterialRenderer ( )
inlineexplicitprotected

Constructor.

Parameters
materialMaterial to use.
meshMesh to use.
nodeNode to attach to.

Member Function Documentation

static unique_ptr<MaterialRenderer> kanzi::MaterialRenderer::create ( )
static

Constructor.

Parameters
nodeNode to attach to.
void kanzi::MaterialRenderer::attach ( MaterialSharedPtr  material,
Node3D node 
)

Reattaches material renderer to a model and a mesh.

Called by Node3D when material or mesh is updated.

Parameters
materialMaterial to use.
void kanzi::MaterialRenderer::bind ( Renderer3D renderer)

Bind material renderer for rendering.

Must be called before calling draw().

Parameters
rendererRenderer to use.
void kanzi::MaterialRenderer::draw ( Renderer3D renderer,
Node3D node,
Mesh mesh,
KzcDynamicArray transformedObjects 
) const

Draw the given morph using attached material.

Parameters
rendererRenderer to use.
nodeThe node being drawn.
meshThe mesh to draw.
transformedObjectsList of transformed objects.
void kanzi::MaterialRenderer::invalidateRenderValues ( )

Mark all property notification handlers dirty.

GlRenderState& kanzi::MaterialRenderer::getRenderState ( )
inline

Access render state.

Returns
Reference to the render state.
MaterialSharedPtr kanzi::MaterialRenderer::getMaterial ( ) const
inline

Access brush.

Returns
Material shared pointer.
bool kanzi::MaterialRenderer::isRenderable ( ) const
inline

Tells if this material renderer can be used for rendering.

Returns
True if yes, false if no.
GlRenderState::HandleType kanzi::MaterialRenderer::getTextureHandle ( string_view  name)
inline

Get texture handle for contained render state.

Parameters
nameTexture uniform name.
Returns
Handle to named texture in current attached material or -1.
GlRenderState::HandleType kanzi::MaterialRenderer::getContentTextureHandle ( )
inline

Get content texture handle for contained render state.

This function is provided as a shorthand because access to content texture is a common use case.

Returns
Handle to content texture in current attached material.
void kanzi::MaterialRenderer::setTextureValue ( GlRenderState::HandleType  handle,
TextureSharedPtr  value 
)
inline

Set texture value in contained render state.

A valid texture handle must have been acquired by getTextureHandle prior to calling this function.

Parameters
handleHandle to content texture.
valueTexture value.
void kanzi::MaterialRenderer::invalidateNotificationHandlers ( )
inline

Marks the notification handlers as invalid.

Use this function when you destroy a node before destroying the MaterialRenderer.

bool kanzi::MaterialRenderer::isChangeCounterSame ( Material material) const
inlineprotected

Check if property change counter matches that of the brush.

Parameters
materialMaterial currently used.
Returns
True if matches and no update is necessary, false otherwise.
void kanzi::MaterialRenderer::updateChangeCounter ( Material material)
inlineprotected

Update property change counter to match brush.

Parameters
materialMaterial currently used.

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