Kanzi  3.9.6
Kanzi Engine API
kanzi::MorphRuntime Class Reference

Contains morph weights for a morph. More...

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

Public Member Functions

unsigned int getChannelCount () const
 Gets the size of the morph runtime. More...
 
unsigned int getSelectedMorph (unsigned int selectedMorphIndex) const
 Gets the selected morph at a given index. More...
 
float getSelectedWeight (unsigned int selectedMorphIndex) const
 Gets the selected morph weight at a given index. More...
 
const float * getSelectedWeightData () const
 Gets a float data array of morph weights. More...
 
float getWeight (unsigned int index) const
 Gets morph weight at given index. More...
 
void initialize (const Morph &morph)
 Initializes the morph runtime from a morph. More...
 
bool isDirty () const
 Indicates whether the morph weight selection is dirty. More...
 
void resize (size_t channelCount)
 Resizes the data array for morph weights. More...
 
void setWeight (unsigned int index, float weight)
 Sets morph weight at given index. More...
 
unsigned int updateSelectedMorphs (unsigned int maxMorphFromShader)
 Updates the selected weights with the most weighted morph targets. More...
 

Static Public Member Functions

static MorphRuntimePtr create ()
 Creates a morph runtime. More...
 
static MorphRuntimePtr create (const Morph &morph)
 Creates a morph runtime. More...
 
static unsigned int getMaxSimultaneousMorphs ()
 Gets the maximum number of simultaneous morphs. More...
 

Protected Member Functions

bool insertSelectedWeight (unsigned int index, unsigned int numMorphs, unsigned int maxMorphs, float currentWeight, unsigned int currentMorph)
 Insert a weight coupled with morph index into a correct location in selected weights and morphs arrays. More...
 
 MorphRuntime ()=default
 Constructor. More...
 
 MorphRuntime (const Morph &morph)
 Constructor. More...
 
bool tryInsertSelectedWeight (unsigned int numMorphs, unsigned int maxMorphs, float currentWeight, unsigned int currentMorph)
 Tries to insert a weight coupled with morph index into the selected arrays of weights and morphs. More...
 

Protected Attributes

bool m_dirty
 Dirty flag for selected weights arrays. More...
 
array< unsigned int, MaxSimultaneousMorphsm_selectedMorphs
 Selected indices for morph weights. More...
 
array< float, MaxSimultaneousMorphsm_selectedWeights
 Selected largest morph weights. More...
 
vector< float > m_weights
 All morph weights. More...
 

Static Protected Attributes

static const unsigned int MaxSimultaneousMorphs
 Maximum number of simultaneous morphs. More...
 

Detailed Description

Contains morph weights for a morph.

Constructor & Destructor Documentation

◆ MorphRuntime() [1/2]

kanzi::MorphRuntime::MorphRuntime ( )
explicitprotecteddefault

Constructor.

◆ MorphRuntime() [2/2]

kanzi::MorphRuntime::MorphRuntime ( const Morph morph)
explicitprotected

Constructor.

Parameters
morphSource morph to copy.

Member Function Documentation

◆ getMaxSimultaneousMorphs()

static unsigned int kanzi::MorphRuntime::getMaxSimultaneousMorphs ( )
inlinestatic

Gets the maximum number of simultaneous morphs.

Returns
Maximum number of simultaneous morphs.
Since
Kanzi 3.9.6

◆ create() [1/2]

static MorphRuntimePtr kanzi::MorphRuntime::create ( )
static

Creates a morph runtime.

Returns
Uninitialized morph runtime.
Since
Kanzi 3.9.6 return type changed to MorphRuntimePtr.

◆ create() [2/2]

static MorphRuntimePtr kanzi::MorphRuntime::create ( const Morph morph)
static

Creates a morph runtime.

Parameters
morphThe morph from which to acquire information when preparing the morph runtime.
Returns
Initialized morph runtime.
Since
Kanzi 3.9.6 return type changed to MorphRuntimePtr.

◆ initialize()

void kanzi::MorphRuntime::initialize ( const Morph morph)

Initializes the morph runtime from a morph.

Parameters
morphThe morph from which to acquire information when preparing the morph runtime.

◆ updateSelectedMorphs()

unsigned int kanzi::MorphRuntime::updateSelectedMorphs ( unsigned int  maxMorphFromShader)

Updates the selected weights with the most weighted morph targets.

This reorders the selected morph array based on the heaviest morph weights. If the weights have not been modified, this function is NOP.

Parameters
maxMorphFromShaderMaximum number of morphs the shader can use.
Returns
Number of selected morphs.
Since
Kanzi 3.9.6

◆ getChannelCount()

unsigned int kanzi::MorphRuntime::getChannelCount ( ) const
inline

Gets the size of the morph runtime.

Returns
Number of possible morph channels.
Since
Kanzi 3.9.6

◆ getSelectedWeightData()

const float* kanzi::MorphRuntime::getSelectedWeightData ( ) const
inline

Gets a float data array of morph weights.

Call updateSelected() before you access the weight data.

Returns
Floating-point array of morph weights.
Since
Kanzi 3.9.6

◆ isDirty()

bool kanzi::MorphRuntime::isDirty ( ) const
inline

Indicates whether the morph weight selection is dirty.

Returns
If the morph weights are dirty, true, otherwise false.
Since
Kanzi 3.9.6

◆ getSelectedWeight()

float kanzi::MorphRuntime::getSelectedWeight ( unsigned int  selectedMorphIndex) const
inline

Gets the selected morph weight at a given index.

Call updateSelected() before you access the selected morphs.

Parameters
selectedMorphIndexIndex to fetch.
Returns
Weight at given selection index.
Since
Kanzi 3.9.6

◆ getSelectedMorph()

unsigned int kanzi::MorphRuntime::getSelectedMorph ( unsigned int  selectedMorphIndex) const
inline

Gets the selected morph at a given index.

Call updateSelected() before you access the selected morphs.

Parameters
selectedMorphIndexThe index of the morph that you want get.
Returns
Index to the morph referred to at a given selection index.
Since
Kanzi 3.9.6

◆ getWeight()

float kanzi::MorphRuntime::getWeight ( unsigned int  index) const
inline

Gets morph weight at given index.

Parameters
indexIndex of the weight.
Returns
Weight at index.
Since
Kanzi 3.9.6

◆ setWeight()

void kanzi::MorphRuntime::setWeight ( unsigned int  index,
float  weight 
)
inline

Sets morph weight at given index.

Parameters
indexIndex to set.
weightWeight to set.
Since
Kanzi 3.9.6

◆ resize()

void kanzi::MorphRuntime::resize ( size_t  channelCount)
inline

Resizes the data array for morph weights.

Parameters
channelCountThe new number of weights.

◆ tryInsertSelectedWeight()

bool kanzi::MorphRuntime::tryInsertSelectedWeight ( unsigned int  numMorphs,
unsigned int  maxMorphs,
float  currentWeight,
unsigned int  currentMorph 
)
protected

Tries to insert a weight coupled with morph index into the selected arrays of weights and morphs.

Parameters
numMorphsCurrent number of morphs.
maxMorphsMaximum number of morphs.
currentWeightWeight to check.
currentMorphMorph index associated with the weight.
Returns
If inserting the weight succeeds and the number of weights increases, true, otherwise false.
Since
Kanzi 3.9.6

◆ insertSelectedWeight()

bool kanzi::MorphRuntime::insertSelectedWeight ( unsigned int  index,
unsigned int  numMorphs,
unsigned int  maxMorphs,
float  currentWeight,
unsigned int  currentMorph 
)
protected

Insert a weight coupled with morph index into a correct location in selected weights and morphs arrays.

Called by tryInsertSelectedWeight() for an insertion location.

Parameters
indexIndex at which to insert the weight.
numMorphsCurrent number of morphs.
maxMorphsMaximum number of morphs.
currentWeightWeight to insert.
currentMorphMorph index associated with the weight.
Returns
If the number of weights increases, true, otherwise false.
Since
Kanzi 3.9.6

Member Data Documentation

◆ MaxSimultaneousMorphs

const unsigned int kanzi::MorphRuntime::MaxSimultaneousMorphs
staticprotected

Maximum number of simultaneous morphs.

◆ m_weights

vector<float> kanzi::MorphRuntime::m_weights
protected

All morph weights.

◆ m_selectedWeights

array<float, MaxSimultaneousMorphs> kanzi::MorphRuntime::m_selectedWeights
protected

Selected largest morph weights.

◆ m_selectedMorphs

array<unsigned int, MaxSimultaneousMorphs> kanzi::MorphRuntime::m_selectedMorphs
protected

Selected indices for morph weights.

◆ m_dirty

bool kanzi::MorphRuntime::m_dirty
protected

Dirty flag for selected weights arrays.


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