Radium Engine  1.5.20
Loading...
Searching...
No Matches
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 PosegetPose (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< Labelm_label
 

Friends

std::ostreamoperator<< (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 editing 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

Editing scheme for the manipulation of the skeleton.

Todo
also implement Inverse Kynematics.
Enumerator
FORWARD 

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

PSEUDO_IK 

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

Definition at line 29 of file Skeleton.hpp.

Constructor & Destructor Documentation

◆ Skeleton() [1/2]

Ra::Core::Animation::Skeleton::Skeleton ( )

CONSTRUCTOR.

Definition at line 12 of file Skeleton.cpp.

◆ Skeleton() [2/2]

Ra::Core::Animation::Skeleton::Skeleton ( const uint n)
explicit

Definition at line 14 of file Skeleton.cpp.

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 149 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 142 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 167 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:

◆ projectOnBone()

Vector3 Ra::Core::Animation::Skeleton::projectOnBone ( uint boneIdx,
const Vector3 & pos ) const

Projects point pos, given in Model Space, onto the bone with index boneIdx.

Definition at line 186 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 104 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 123 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.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Skeleton & skeleton )
friend

Stream insertion operator.

Definition at line 201 of file Skeleton.cpp.

Member Data Documentation

◆ m_graph

AdjacencyList Ra::Core::Animation::Skeleton::m_graph

The Joint hierarchy.

Definition at line 106 of file Skeleton.hpp.

◆ m_manipulation

Manipulation Ra::Core::Animation::Skeleton::m_manipulation { FORWARD }

The manipulation scheme.

Definition at line 109 of file Skeleton.hpp.

◆ m_modelSpace

ModelPose Ra::Core::Animation::Skeleton::m_modelSpace
protected

Skeleton pose in MODEL space.

Definition at line 113 of file Skeleton.hpp.


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