Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
momentum::CharacterStateT< T > Struct Template Reference

Represents the complete state of a character at a specific point in time. More...

#include <character_state.h>

Public Member Functions

 CharacterStateT ()
 CharacterStateT (const CharacterStateT &other)
 Creates a deep copy of another character state, including owned meshState and collisionState.
 CharacterStateT (CharacterStateT &&c) noexcept
CharacterStateT & operator= (const CharacterStateT &rhs)=delete
 Copy assignment is deleted; use the explicit copy constructor instead.
CharacterStateT & operator= (CharacterStateT &&rhs) noexcept
 ~CharacterStateT ()
 CharacterStateT (const Character &referenceCharacter, bool updateMesh=true, bool updateCollision=true)
 Creates a character state in referenceCharacter's bind pose.
 CharacterStateT (const CharacterParameters &parameters, const Character &referenceCharacter, bool updateMesh=true, bool updateCollision=true, bool applyLimits=true)
 Creates a character state by applying parameters to referenceCharacter.
void set (const CharacterParameters &parameters, const Character &referenceCharacter, bool updateMesh=true, bool updateCollision=true, bool applyLimits=true)
 Updates the character state by applying parameters to referenceCharacter.
void setBindPose (const Character &referenceCharacter, bool updateMesh=true, bool updateCollision=true)
 Sets the character state to referenceCharacter's bind pose.

Public Attributes

CharacterParameters parameters
 Model parameters (pose) and joint parameter offsets driving this state.
SkeletonState skeletonState
LocatorState locatorState
Mesh_u meshState
 Skinned mesh; null when constructed/updated with updateMesh=false or when the reference character has no mesh or skin weights.
CollisionGeometryState_u collisionState
 Collision geometry state; null when constructed/updated with updateCollision=false or when the reference character has no collision geometry.

Detailed Description

template<typename T>
struct momentum::CharacterStateT< T >

Represents the complete state of a character at a specific point in time.

Stores the character's parameters, skeleton state, locator positions, skinned mesh, and collision geometry state. This class is used for character animation and rendering.

Definition at line 23 of file character_state.h.

Constructor & Destructor Documentation

◆ CharacterStateT() [1/5]

template<typename T>
momentum::CharacterStateT< T >::CharacterStateT ( )
default

Referenced by CharacterStateT().

◆ CharacterStateT() [2/5]

template<typename T>
momentum::CharacterStateT< T >::CharacterStateT ( const CharacterStateT< T > & other)
explicit

Creates a deep copy of another character state, including owned meshState and collisionState.

Definition at line 24 of file character_state.cpp.

References CharacterStateT(), collisionState, locatorState, meshState, parameters, and skeletonState.

◆ CharacterStateT() [3/5]

template<typename T>
momentum::CharacterStateT< T >::CharacterStateT ( CharacterStateT< T > && c)
defaultnoexcept

◆ ~CharacterStateT()

template<typename T>
momentum::CharacterStateT< T >::~CharacterStateT ( )
default

◆ CharacterStateT() [4/5]

template<typename T>
momentum::CharacterStateT< T >::CharacterStateT ( const Character & referenceCharacter,
bool updateMesh = true,
bool updateCollision = true )
explicit

Creates a character state in referenceCharacter's bind pose.

Parameters
updateMeshIf true, allocate and populate meshState by skinning referenceCharacter.mesh (requires non-null mesh and skin weights).
updateCollisionIf true, allocate and populate collisionState from referenceCharacter.collision (requires non-null collision).

Definition at line 43 of file character_state.cpp.

References setBindPose().

◆ CharacterStateT() [5/5]

template<typename T>
momentum::CharacterStateT< T >::CharacterStateT ( const CharacterParameters & parameters,
const Character & referenceCharacter,
bool updateMesh = true,
bool updateCollision = true,
bool applyLimits = true )

Creates a character state by applying parameters to referenceCharacter.

Parameters
applyLimitsIf true, clamp passive joint parameters to the character's parameterLimits after applying the parameter transform.
See also
set() for the meaning of updateMesh and updateCollision and for the requirements on parameters.pose and parameters.offsets.

Definition at line 51 of file character_state.cpp.

References parameters, and set().

Member Function Documentation

◆ operator=() [1/2]

template<typename T>
CharacterStateT< T > & momentum::CharacterStateT< T >::operator= ( CharacterStateT< T > && rhs)
defaultnoexcept

◆ operator=() [2/2]

template<typename T>
CharacterStateT & momentum::CharacterStateT< T >::operator= ( const CharacterStateT< T > & rhs)
delete

Copy assignment is deleted; use the explicit copy constructor instead.

◆ set()

template<typename T>
void momentum::CharacterStateT< T >::set ( const CharacterParameters & parameters,
const Character & referenceCharacter,
bool updateMesh = true,
bool updateCollision = true,
bool applyLimits = true )

Updates the character state by applying parameters to referenceCharacter.

Precondition
parameters.pose.size() == referenceCharacter.parameterTransform.numAllModelParameters()
parameters.offsets is either empty or has size referenceCharacter.parameterTransform.numJointParameters(). When empty, it is initialized to zeros.
Parameters
updateMeshIf true, allocate and populate meshState by skinning referenceCharacter.mesh (no-op if mesh or skin weights are null). When pose blend shapes or blend shapes are present on the character, they are applied before linear skinning.
updateCollisionIf true, allocate and populate collisionState from referenceCharacter.collision (no-op if collision is null).
applyLimitsIf true, clamp passive joint parameters to the character's parameterLimits after applying the parameter transform.

Definition at line 69 of file character_state.cpp.

References momentum::ParameterTransformT< T >::apply(), momentum::applyPassiveJointParameterLimits(), momentum::applySSD(), momentum::Character::blendShape, momentum::Character::collision, collisionState, momentum::Character::inverseBindPose, momentum::Character::locators, locatorState, momentum::Character::mesh, meshState, MT_CHECK, momentum::ParameterTransformT< T >::numAllModelParameters(), momentum::ParameterTransformT< T >::numJointParameters(), momentum::Character::parameterLimits, parameters, momentum::Character::parameterTransform, momentum::Character::poseShapes, momentum::Character::skeleton, skeletonState, momentum::Character::skinWeights, and momentum::skinWithBlendShapes().

Referenced by CharacterStateT(), and setBindPose().

◆ setBindPose()

template<typename T>
void momentum::CharacterStateT< T >::setBindPose ( const Character & referenceCharacter,
bool updateMesh = true,
bool updateCollision = true )

Sets the character state to referenceCharacter's bind pose.

See also
set() for the meaning of updateMesh and updateCollision.

Definition at line 61 of file character_state.cpp.

References momentum::Character::bindPose(), and set().

Referenced by CharacterStateT().

Member Data Documentation

◆ collisionState

template<typename T>
CollisionGeometryState_u momentum::CharacterStateT< T >::collisionState

Collision geometry state; null when constructed/updated with updateCollision=false or when the reference character has no collision geometry.

Definition at line 38 of file character_state.h.

Referenced by CharacterStateT(), and set().

◆ locatorState

template<typename T>
LocatorState momentum::CharacterStateT< T >::locatorState

Definition at line 29 of file character_state.h.

Referenced by CharacterStateT(), momentum::logCharacter(), and set().

◆ meshState

template<typename T>
Mesh_u momentum::CharacterStateT< T >::meshState

Skinned mesh; null when constructed/updated with updateMesh=false or when the reference character has no mesh or skin weights.

Definition at line 33 of file character_state.h.

Referenced by CharacterStateT(), momentum::logCharacter(), and set().

◆ parameters

template<typename T>
CharacterParameters momentum::CharacterStateT< T >::parameters

Model parameters (pose) and joint parameter offsets driving this state.

Definition at line 25 of file character_state.h.

Referenced by CharacterStateT(), CharacterStateT(), and set().

◆ skeletonState

template<typename T>
SkeletonState momentum::CharacterStateT< T >::skeletonState

Definition at line 27 of file character_state.h.

Referenced by CharacterStateT(), momentum::logCharacter(), and set().


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