kanzi::MaterialRenderer Class Reference

Material renderer. More...

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

Public Member Functions

void attach (MaterialSharedPtr material, Node3D &node, Mesh *mesh)
 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, KzcDynamicArray *transformedObjects) const
 Draw the given morph using attached material. More...
 
void setAllPropertiesDirty ()
 Mark all property notification handlers dirty. More...
 
GlRenderStategetRenderState ()
 Access render state. More...
 
MaterialSharedPtr getMaterial () const
 Access brush. More...
 
MeshgetMesh () const
 Access mesh. 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...
 

Static Public Member Functions

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

Protected Member Functions

 MaterialRenderer ()
 Constructor. 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,
Mesh mesh 
)

Reattaches material renderer to a model and a mesh.

Called by Node3D when material or mesh is updated.

Parameters
materialMaterial to use.
meshMesh 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,
KzcDynamicArray transformedObjects 
) const

Draw the given morph using attached material.

Parameters
rendererRenderer to use.
transformedObjectsList of transformed objects.
clusterCluster of the mesh to draw.
void kanzi::MaterialRenderer::setAllPropertiesDirty ( )

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.
Mesh* kanzi::MaterialRenderer::getMesh ( ) const
inline

Access mesh.

Returns
Mesh 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.

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