Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::BlendShapeBase Struct Reference

Skinning class that manages blend shape vectors/offsets. More...

#include <blend_shape_base.h>

Inheritance diagram for momentum::BlendShapeBase:

Public Member Functions

 BlendShapeBase ()=default
 BlendShapeBase (const BlendShapeBase &)=default
BlendShapeBase & operator= (const BlendShapeBase &)=default
 BlendShapeBase (BlendShapeBase &&)=default
BlendShapeBase & operator= (BlendShapeBase &&)=default
 BlendShapeBase (size_t modelSize, size_t numShapes, momentum::span< const std::string > shapeNames={})
virtual ~BlendShapeBase ()=default
void setShapeVectors (const MatrixXf &shapeVectors, momentum::span< const std::string > shapeNames={})
const MatrixXf & getShapeVectors () const
template<typename T>
VectorX< T > computeDeltas (const BlendWeightsT< T > &blendWeights) const
 Calculates weighted combination of shape vectors.
template<typename T>
void applyDeltas (const BlendWeightsT< T > &blendWeights, std::vector< Eigen::Vector3< T > > &result) const
 Adds weighted shape vectors to existing vertices.
void setShapeVector (size_t index, momentum::span< const Vector3f > shapeVector, std::string_view name="")
Eigen::Index shapeSize () const
size_t modelSize () const
const std::vector< std::string > & getShapeNames () const
std::string_view getShapeName (size_t index) const
void setShapeName (size_t index, std::string_view name)

Protected Attributes

MatrixXf shapeVectors_
std::vector< std::string > shapeNames_

Detailed Description

Skinning class that manages blend shape vectors/offsets.

Used to model facial expressions and potentially other deformations such as pose-dependent shape changes

Definition at line 19 of file blend_shape_base.h.

Constructor & Destructor Documentation

◆ BlendShapeBase() [1/4]

momentum::BlendShapeBase::BlendShapeBase ( )
default

◆ BlendShapeBase() [2/4]

momentum::BlendShapeBase::BlendShapeBase ( const BlendShapeBase & )
default

References BlendShapeBase().

◆ BlendShapeBase() [3/4]

momentum::BlendShapeBase::BlendShapeBase ( BlendShapeBase && )
default

References BlendShapeBase().

◆ BlendShapeBase() [4/4]

momentum::BlendShapeBase::BlendShapeBase ( size_t modelSize,
size_t numShapes,
momentum::span< const std::string > shapeNames = {} )
Parameters
modelSizeNumber of vertices in the model
numShapesNumber of blend shapes
shapeNamesNames of the blend shapes (will be automatically generated if empty or not the right size)

Definition at line 36 of file blend_shape_base.cpp.

References modelSize(), shapeNames_, and shapeVectors_.

◆ ~BlendShapeBase()

virtual momentum::BlendShapeBase::~BlendShapeBase ( )
virtualdefault

Member Function Documentation

◆ applyDeltas()

template<typename T>
template void momentum::BlendShapeBase::applyDeltas ( const BlendWeightsT< T > & blendWeights,
std::vector< Eigen::Vector3< T > > & result ) const

Adds weighted shape vectors to existing vertices.

Template Parameters
TScalar type (float or double)
Parameters
blendWeightsWeights for each shape vector
result[in,out] Vertices to modify

Definition at line 28 of file blend_shape_base.cpp.

References computeDeltas().

◆ computeDeltas()

template<typename T>
template VectorX< double > momentum::BlendShapeBase::computeDeltas< double > ( const BlendWeightsT< T > & blendWeights) const
nodiscard

Calculates weighted combination of shape vectors.

Template Parameters
TScalar type (float or double)
Parameters
blendWeightsWeights for each shape vector
Returns
Combined vertex offsets

Definition at line 18 of file blend_shape_base.cpp.

References momentum::cast(), MT_CHECK, shapeVectors_, momentum::EigenStrongType< Derived, EigenType >::size(), and momentum::EigenStrongType< Derived, EigenType >::v.

Referenced by applyDeltas(), and momentum::BlendShape::computeShape().

◆ getShapeName()

std::string_view momentum::BlendShapeBase::getShapeName ( size_t index) const
inlinenodiscard

Definition at line 83 of file blend_shape_base.h.

References shapeNames_.

◆ getShapeNames()

const std::vector< std::string > & momentum::BlendShapeBase::getShapeNames ( ) const
inlinenodiscard

◆ getShapeVectors()

const MatrixXf & momentum::BlendShapeBase::getShapeVectors ( ) const
inlinenodiscard

◆ modelSize()

size_t momentum::BlendShapeBase::modelSize ( ) const
inlinenodiscard

◆ operator=() [1/2]

BlendShapeBase & momentum::BlendShapeBase::operator= ( BlendShapeBase && )
default

References BlendShapeBase(), and modelSize().

◆ operator=() [2/2]

BlendShapeBase & momentum::BlendShapeBase::operator= ( const BlendShapeBase & )
default

References BlendShapeBase().

◆ setShapeName()

void momentum::BlendShapeBase::setShapeName ( size_t index,
std::string_view name )
inline

Definition at line 87 of file blend_shape_base.h.

References shapeNames_.

◆ setShapeVector()

void momentum::BlendShapeBase::setShapeVector ( size_t index,
momentum::span< const Vector3f > shapeVector,
std::string_view name = "" )
Parameters
indexIndex of the shape vector to set
shapeVectorVector of vertex offsets

Definition at line 71 of file blend_shape_base.cpp.

References modelSize(), MT_CHECK, setShapeVector(), shapeNames_, and shapeVectors_.

Referenced by momentum::BlendShape::setShapeVector(), and setShapeVector().

◆ setShapeVectors()

void momentum::BlendShapeBase::setShapeVectors ( const MatrixXf & shapeVectors,
momentum::span< const std::string > shapeNames = {} )
Parameters
shapeVectorsMatrix where each column is a shape vector

Definition at line 53 of file blend_shape_base.cpp.

References MT_LOGW_IF, setShapeVectors(), shapeNames_, and shapeVectors_.

Referenced by momentum::loadBlendShape(), momentum::loadBlendShapeBase(), and setShapeVectors().

◆ shapeSize()

Eigen::Index momentum::BlendShapeBase::shapeSize ( ) const
inlinenodiscard

Member Data Documentation

◆ shapeNames_

std::vector<std::string> momentum::BlendShapeBase::shapeNames_
protected

◆ shapeVectors_


The documentation for this struct was generated from the following files: