Radium Engine  1.5.0
Ra::Core::Animation::Skeleton Class Reference

#include <Core/Animation/Skeleton.hpp>

+ Inheritance diagram for Ra::Core::Animation::Skeleton:
+ Collaboration diagram for Ra::Core::Animation::Skeleton:

Public Types

enum  Manipulation { FORWARD = 0 , PSEUDO_IK }
 
- Public Types inherited from Ra::Core::Animation::HandleArray
enum class  SpaceType : bool { LOCAL , MODEL }
 

Public Member Functions

 Skeleton ()
 CONSTRUCTOR.
 
 Skeleton (const uint n)
 
 Skeleton (const Skeleton &skeleton)=default
 
uint size () const override
 
void clear () override
 
const Pose & getPose (const SpaceType MODE) const override
 
void setPose (const Pose &pose, const SpaceType MODE) override
 
const Transform & getTransform (const uint i, const SpaceType MODE) const override
 
void setTransform (const uint i, const Transform &T, const SpaceType MODE) override
 
uint addRoot (const Transform &T=Transform::Identity(), const Label label="")
 
uint addBone (const uint parent, const Transform &T=Transform::Identity(), const SpaceType MODE=SpaceType::LOCAL, const Label label="")
 
void getBonePoints (uint i, Vector3 &startOut, Vector3 &endOut) const
 
Vector3 projectOnBone (uint boneIdx, const Vector3 &pos) const
 Projects point pos, given in Model Space, onto the bone with index boneIdx.
 
- Public Member Functions inherited from Ra::Core::Animation::HandleArray
 HandleArray (const uint n)
 
 HandleArray (const HandleArray &handle)=default
 
HandleArrayoperator= (const HandleArray &handle)=default
 
Label getName () const
 
void setName (const Label &name)
 
Label getLabel (const uint i) const
 
void setLabel (const uint i, const Label &text)
 

Public Attributes

AdjacencyList m_graph
 The Joint hierarchy.
 
Manipulation m_manipulation { FORWARD }
 The manipulation scheme.
 
- Public Attributes inherited from Ra::Core::Animation::HandleArray
LocalPose m_pose
 

Protected Member Functions

void setLocalTransform (uint i, const Transform &T)
 
void setModelTransform (uint i, const Transform &T)
 

Protected Attributes

ModelPose m_modelSpace
 Skeleton pose in MODEL space.
 
- Protected Attributes inherited from Ra::Core::Animation::HandleArray
Label m_name
 
std::vector< Label > m_label
 

Friends

std::ostream & operator<< (std::ostream &os, const Skeleton &skeleton)
 Stream insertion operator.
 

Detailed Description

The Skeleton class.

A skeleton is a set of joint transforms with an associated joint hierarchy, represented by a graph ( adjacency list ).

Skeleton bones represent a couple of joints: the proximal joint and the distal joint, the former being the parent of the latter in the hierarchy. For animation purposes, a bone transform refers to the proximal joint's tranform.

During the edition of the transformation of a skeleton bone, the transformations of all the bones are updated accroding to the Manipulation scheme (cf Ra::Core:Animation::Skeleton::Manipulation).

Definition at line 24 of file Skeleton.hpp.

Member Enumeration Documentation

◆ Manipulation

Edition scheme for the manipulation of the skeleton.

Todo:
also implement Inverse Kynematics.
Enumerator
FORWARD 

Standard edition scheme: rotation and / or translation of one bone.

PSEUDO_IK 

Advanced edition scheme: translation of a bone means parent's rotation.

Definition at line 29 of file Skeleton.hpp.

Member Function Documentation

◆ addBone()

uint Ra::Core::Animation::Skeleton::addBone ( const uint  parent,
const Transform &  T = Transform::Identity(),
const SpaceType  MODE = SpaceType::LOCAL,
const Label  label = "" 
)

Add a new joint transform to the skeleton.

Parameters
parentthe index of the joint's parent in the hierarchy
Tthe joint transform associated to the new bone
MODESpaceType of T (either SpaceType::LOCAL or SpaceType::MODEL)
labelthe name for the new joint
Returns
the index of the new joint

Definition at line 146 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ addRoot()

uint Ra::Core::Animation::Skeleton::addRoot ( const Transform &  T = Transform::Identity(),
const Label  label = "" 
)

Add a new root transform to the skeleton.

Parameters
Tthe joint transform associated to the new bone
labelthe name for the new joint
Returns
the index of the new joint

Definition at line 139 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ clear()

void Ra::Core::Animation::Skeleton::clear ( )
overridevirtual

Clear the transformations data

Reimplemented from Ra::Core::Animation::HandleArray.

Definition at line 16 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ getBonePoints()

void Ra::Core::Animation::Skeleton::getBonePoints ( uint  i,
Vector3 &  startOut,
Vector3 &  endOut 
) const

Get the i-th bone endpoints in Model space.

Parameters
ithe bone index
[out]startOutthe bone's start point
[out]endOutthe bone's end point
Note
If the i-th bone is a leaf, then startOut == endOut.

Definition at line 164 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ getPose()

const Pose & Ra::Core::Animation::Skeleton::getPose ( const SpaceType  MODE) const
overridevirtual
Returns
the current pose in the MODE space.

Reimplemented from Ra::Core::Animation::HandleArray.

Definition at line 22 of file Skeleton.cpp.

◆ getTransform()

const Transform & Ra::Core::Animation::Skeleton::getTransform ( const uint  i,
const SpaceType  MODE 
) const
overridevirtual
Returns
the i-th transformation in MODE space.

Reimplemented from Ra::Core::Animation::HandleArray.

Definition at line 55 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ setLocalTransform()

void Ra::Core::Animation::Skeleton::setLocalTransform ( uint  i,
const Transform &  T 
)
protected

Sets the i-th transform to T, given in Local space.

Note
Updates the Model-space transform of the descendants.
This method keeps the Local-space transforms of the descendants untouched.

Definition at line 101 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ setModelTransform()

void Ra::Core::Animation::Skeleton::setModelTransform ( uint  i,
const Transform &  T 
)
protected

Sets the i-th transform to T, given in Model space.

Note
Updates the Local-space transform of the descendants.
This method keeps the Model-space transforms of the descendants untouched.

Definition at line 120 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ setPose()

void Ra::Core::Animation::Skeleton::setPose ( const Pose &  pose,
const SpaceType  MODE 
)
overridevirtual

Set the current pose.

Parameters
posethe new pose
MODEthe space the psoe lives in

Reimplemented from Ra::Core::Animation::HandleArray.

Definition at line 29 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ setTransform()

void Ra::Core::Animation::Skeleton::setTransform ( const uint  i,
const Transform &  T,
const SpaceType  MODE 
)
overridevirtual

Set the i-th transform to T, which is given in the MODE space, w.r.t. the current manipulation scheme and updates the whole Skeleton Pose.

Reimplemented from Ra::Core::Animation::HandleArray.

Definition at line 63 of file Skeleton.cpp.

+ Here is the call graph for this function:

◆ size()

uint Ra::Core::Animation::Skeleton::size ( ) const
inlineoverridevirtual
Returns
the number of transformations

Reimplemented from Ra::Core::Animation::HandleArray.

Definition at line 40 of file Skeleton.hpp.


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