Radium Engine  1.5.20
Loading...
Searching...
No Matches
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.
 
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::stringgetMeshName () const
 Returns the name of the skinned mesh.
 
void setMeshName (const std::string &name)
 
const std::stringgetSkeletonName () 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.
 
virtual EntitygetEntity () const
 Return the entity the component belongs to.
 
virtual const std::stringgetName () 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.

Constructor & Destructor Documentation

◆ SkinningComponent()

Ra::Engine::Scene::SkinningComponent::SkinningComponent ( const std::string & name,
SkinningType type,
Entity * entity )
inline

Definition at line 55 of file SkinningComponent.hpp.

◆ ~SkinningComponent()

Ra::Engine::Scene::SkinningComponent::~SkinningComponent ( )
inlineoverride

Definition at line 65 of file SkinningComponent.hpp.

Member Function Documentation

◆ endSkinning()

void Ra::Engine::Scene::SkinningComponent::endSkinning ( )

Update internal data and update the skinned mesh.

Definition at line 258 of file SkinningComponent.cpp.

+ Here is the call graph for this function:

◆ getMeshName()

const std::string & Ra::Engine::Scene::SkinningComponent::getMeshName ( ) const

Returns the name of the skinned mesh.

Definition at line 359 of file SkinningComponent.cpp.

◆ getNormalSkinning()

NormalSkinning Ra::Engine::Scene::SkinningComponent::getNormalSkinning ( ) const
inline

Returns the current method used to skin the normal, tangent and binormal vectors.

Definition at line 100 of file SkinningComponent.hpp.

◆ getSkeletonName()

const std::string & Ra::Engine::Scene::SkinningComponent::getSkeletonName ( ) const

Returns the name of the skeleton skinning the mesh.

Definition at line 363 of file SkinningComponent.cpp.

◆ getSkinningFrameData()

const Core::Animation::SkinningFrameData * Ra::Engine::Scene::SkinningComponent::getSkinningFrameData ( ) const
inline

Returns the current Pose data.

Definition at line 120 of file SkinningComponent.hpp.

◆ getSkinningRefData()

const Core::Animation::SkinningRefData * Ra::Engine::Scene::SkinningComponent::getSkinningRefData ( ) const
inline

Returns the reference skinning data.

Definition at line 117 of file SkinningComponent.hpp.

◆ getSkinningType()

SkinningType Ra::Engine::Scene::SkinningComponent::getSkinningType ( ) const
inline

Returns the current skinning method.

Definition at line 94 of file SkinningComponent.hpp.

◆ getWeightsType()

SkinningComponent::WeightType Ra::Engine::Scene::SkinningComponent::getWeightsType ( )

Returns the type of skinning weights displayed.

Definition at line 422 of file SkinningComponent.cpp.

◆ 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:

◆ isShowingWeights()

bool Ra::Engine::Scene::SkinningComponent::isShowingWeights ( )

Returns whether the skinning weights are displayed or not.

Definition at line 413 of file SkinningComponent.cpp.

◆ 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.

◆ setNormalSkinning()

void Ra::Engine::Scene::SkinningComponent::setNormalSkinning ( NormalSkinning normalSkinning)

Sets the method to use to skin the normal, tangent and binormal vectors.

Definition at line 354 of file SkinningComponent.cpp.

◆ 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.

◆ setSkinningType()

void Ra::Engine::Scene::SkinningComponent::setSkinningType ( SkinningType type)

Sets the Skinning method to use.

Definition at line 344 of file SkinningComponent.cpp.

◆ setWeightBone()

void Ra::Engine::Scene::SkinningComponent::setWeightBone ( uint bone)

Set the bone to show the weights of.

Definition at line 426 of file SkinningComponent.cpp.

+ Here is the call graph for this function:

◆ showWeights()

void Ra::Engine::Scene::SkinningComponent::showWeights ( bool on)

Toggles display of skinning weights.

Definition at line 367 of file SkinningComponent.cpp.

+ Here is the call graph for this function:

◆ showWeightsType()

void Ra::Engine::Scene::SkinningComponent::showWeightsType ( WeightType type)

Set the type of skinning weight to display.

Definition at line 417 of file SkinningComponent.cpp.

+ Here is the call graph for this function:

◆ skin()

void Ra::Engine::Scene::SkinningComponent::skin ( )

Apply the Skinning Method and update the SkinningFrameData.

Definition at line 202 of file SkinningComponent.cpp.

+ Here is the call graph for this function:

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