Radium Engine  1.5.0
Ra::Engine::Scene::SkinningComponent Class Reference

The SkinningComponent class is responsible for applying Geometric Skinning Methods on an animated object's mesh. More...

#include <Engine/Scene/SkinningComponent.hpp>

+ Inheritance diagram for Ra::Engine::Scene::SkinningComponent:
+ Collaboration diagram for Ra::Engine::Scene::SkinningComponent:

Public Types

enum  SkinningType { LBS = 0 , DQS , COR }
 The Geometric Skinning Method. More...
 
enum  NormalSkinning { APPROX = 0 , GEOMETRIC }
 How to skin the normal, tangent and binormal vectors. More...
 
enum  WeightType { STANDARD = 0 }
 The skinning weight type. More...
 

Public Member Functions

 SkinningComponent (const std::string &name, SkinningType type, Entity *entity)
 
void setPerBoneWeight (std::map< std::string, std::vector< std::pair< uint, Scalar >>> &&w)
 
void setPerBoneMatrix (std::map< std::string, Core::Transform > &&m)
 
Component Communication (CC)
virtual void initialize () override
 Pure virtual method to be overridden by any component. When this method is called you are guaranteed that all other startup systems have been loaded. More...
 
Build from fileData
void handleSkinDataLoading (const Core::Asset::HandleData *data, const std::string &meshName)
 
Skinning Process
void skin ()
 Apply the Skinning Method and update the SkinningFrameData.
 
void endSkinning ()
 Update internal data and update the skinned mesh.
 
void setSkinningType (SkinningType type)
 Sets the Skinning method to use.
 
SkinningType getSkinningType () const
 Returns the current skinning method.
 
void setNormalSkinning (NormalSkinning normalSkinning)
 Sets the method to use to skin the normal, tangent and binormal vectors.
 
NormalSkinning getNormalSkinning () const
 Returns the current method used to skin the normal, tangent and binormal vectors.
 
Skinning Data
const std::string & getMeshName () const
 Returns the name of the skinned mesh.
 
void setMeshName (const std::string &name)
 
const std::string & getSkeletonName () const
 Returns the name of the skeleton skinning the mesh.
 
const Core::Animation::SkinningRefDatagetSkinningRefData () const
 Returns the reference skinning data.
 
const Core::Animation::SkinningFrameDatagetSkinningFrameData () const
 Returns the current Pose data.
 
Skinning Weights Display
void showWeights (bool on)
 Toggles display of skinning weights.
 
bool isShowingWeights ()
 Returns whether the skinning weights are displayed or not.
 
void showWeightsType (WeightType type)
 Set the type of skinning weight to display.
 
WeightType getWeightsType ()
 Returns the type of skinning weights displayed.
 
void setWeightBone (uint bone)
 Set the bone to show the weights of.
 
- Public Member Functions inherited from Ra::Engine::Scene::Component
 Component (const std::string &name, Entity *entity)
 CONSTRUCTOR.
 
virtual ~Component ()
 DESTRUCTOR.
 
virtual void setEntity (Entity *entity)
 Set entity the component is part of. This method is called by the entity. More...
 
virtual EntitygetEntity () const
 Return the entity the component belongs to.
 
virtual const std::string & getName () const
 Return the component's name.
 
virtual void setSystem (System *system)
 Set the system to which the component belongs.
 
virtual SystemgetSystem () const
 Returns the system to which the component belongs.
 
Core::Utils::Index addRenderObject (Rendering::RenderObject *renderObject)
 Add a new render object to the component. This adds the RO to the manager for drawing.
 
void removeRenderObject (const Core::Utils::Index &roIdx)
 Remove the render object from the component.
 
virtual bool canEdit (const Core::Utils::Index &) const
 Returns true if a transform can be edited with the render object index given as a key.
 
virtual Core::Transform getTransform (const Core::Utils::Index &) const
 Get the transform associated with the given RO index key.
 
virtual void setTransform (const Core::Utils::Index &, const Core::Transform &)
 Set the new transform associated with the RO index key.
 
void notifyRenderObjectExpired (const Core::Utils::Index &idx)
 
virtual Core::Aabb computeAabb ()
 
void invalidateAabb ()
 
const std::vector< Core::Utils::Index > & getRenderObjects ()
 

Additional Inherited Members

- Public Attributes inherited from Ra::Engine::Scene::Component
std::vector< Core::Utils::Index > m_renderObjects
 
- Static Protected Member Functions inherited from Ra::Engine::Scene::Component
static Rendering::RenderObjectManager * getRoMgr ()
 Shortcut to access the render object manager.
 
- Protected Attributes inherited from Ra::Engine::Scene::Component
std::string m_name {}
 
Entitym_entity { nullptr }
 
Systemm_system { nullptr }
 

Detailed Description

The SkinningComponent class is responsible for applying Geometric Skinning Methods on an animated object's mesh.

Regarding Component Communication, a SkinningComponent gives access to the following data from the skinned mesh's name:

Warning
The Ra::Core::Animation::SkinningFrameData better be accessed after the skinning task.

Definition at line 34 of file SkinningComponent.hpp.

Member Enumeration Documentation

◆ NormalSkinning

How to skin the normal, tangent and binormal vectors.

Enumerator
APPROX 

Use the standard approximation method.

GEOMETRIC 

Recompute from scratch from the skinned positions.

Definition at line 45 of file SkinningComponent.hpp.

◆ SkinningType

The Geometric Skinning Method.

Enumerator
LBS 

Linear Blend Skinning.

DQS 

Dual Quaternion Skinning.

COR 

Center of Rotation skinning.

Definition at line 38 of file SkinningComponent.hpp.

◆ WeightType

The skinning weight type.

Enumerator
STANDARD 

Standard geometric skinning weights.

Definition at line 51 of file SkinningComponent.hpp.

Member Function Documentation

◆ handleSkinDataLoading()

void Ra::Engine::Scene::SkinningComponent::handleSkinDataLoading ( const Core::Asset::HandleData data,
const std::string &  meshName 
)

Loads the skinning data from the given Handledata.

Note
Call initialize() afterwards to finalize data registration.

Definition at line 283 of file SkinningComponent.cpp.

+ Here is the call graph for this function:

◆ initialize()

void Ra::Engine::Scene::SkinningComponent::initialize ( )
overridevirtual

Pure virtual method to be overridden by any component. When this method is called you are guaranteed that all other startup systems have been loaded.

TODO : use the tangent computation algorithms from Core as soon as it is available.

Implements Ra::Engine::Scene::Component.

Definition at line 86 of file SkinningComponent.cpp.

+ Here is the call graph for this function:

◆ setMeshName()

void Ra::Engine::Scene::SkinningComponent::setMeshName ( const std::string &  name)
inline

Set the associated mesh name, usefull if component setup is not done using handleSkinDataLoading

Definition at line 111 of file SkinningComponent.hpp.

◆ setPerBoneMatrix()

void Ra::Engine::Scene::SkinningComponent::setPerBoneMatrix ( std::map< std::string, Core::Transform > &&  m)
inline

Set the associated bind matrix of named bones. A bind matrix is used to transform a vertex from object space to rest pose bone space. Typical value is obtained from skeleton getTransform( boneId, Skeleton::SpaceType::MODEL ).inverse();

Definition at line 152 of file SkinningComponent.hpp.

◆ setPerBoneWeight()

void Ra::Engine::Scene::SkinningComponent::setPerBoneWeight ( std::map< std::string, std::vector< std::pair< uint, Scalar >>> &&  w)
inline

Set the associated weight for named bones. Each pair is a vertex index from the skinned mesh (uint) and a weight (Scalar).

Definition at line 144 of file SkinningComponent.hpp.


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