Skeleton Class Reference

A skeleton. More...

#include <common/common.hh>

Public Member Functions

 Skeleton ()
 Constructor. More...
 
 Skeleton (SkeletonNode *_root)
 Constructor. More...
 
virtual ~Skeleton ()
 Destructor. More...
 
void AddAnimation (SkeletonAnimation *_anim)
 Add an animation. More...
 
void AddVertNodeWeight (unsigned int _vertex, std::string _node, double _weight)
 Add a new weight to a node (bone) More...
 
ignition::math::Matrix4d BindShapeTransform ()
 Return bind pose skeletal transform. More...
 
SkeletonAnimationGetAnimation (const unsigned int _i)
 Find animation. More...
 
SkeletonNodeGetNodeByHandle (unsigned int _handle)
 Find or create node with handle. More...
 
SkeletonNodeGetNodeById (std::string _id)
 Find node by index. More...
 
SkeletonNodeGetNodeByName (std::string _name)
 Find a node. More...
 
NodeMap GetNodes ()
 Get a copy or the node dictionary. More...
 
unsigned int GetNumAnimations ()
 Returns the number of animations. More...
 
unsigned int GetNumJoints ()
 Returns the number of joints. More...
 
unsigned int GetNumNodes ()
 Returns the node count. More...
 
unsigned int GetNumVertNodeWeights (unsigned int _vertex)
 Returns the number of bone weights for a vertex. More...
 
SkeletonNodeGetRootNode ()
 Return the root. More...
 
std::pair< std::string, double > GetVertNodeWeight (unsigned int _v, unsigned int _i)
 Weight of a bone for a vertex. More...
 
void PrintTransforms ()
 Outputs the transforms to std::err stream. More...
 
void Scale (double _scale)
 Scale all nodes, transforms and animation data. More...
 
void SetBindShapeTransform (const ignition::math::Matrix4d &_trans)
 Set the bind pose skeletal transform. More...
 
void SetNumVertAttached (unsigned int _vertices)
 Resizes the raw node weight array. More...
 
void SetRootNode (SkeletonNode *_node)
 Change the root node. More...
 

Protected Member Functions

void BuildNodeMap ()
 Initializes the hande numbers for each node in the map using breadth first traversal. More...
 

Protected Attributes

std::vector< SkeletonAnimation * > anims
 the array of animations More...
 
ignition::math::Matrix4d bindShapeTransform
 the bind pose skeletal transform More...
 
NodeMap nodes
 The dictionary of nodes, indexed by name. More...
 
RawNodeWeights rawNW
 the node weight table More...
 
SkeletonNoderoot
 the root node More...
 

Detailed Description

A skeleton.

Constructor & Destructor Documentation

§ Skeleton() [1/2]

Skeleton ( )

Constructor.

§ Skeleton() [2/2]

Skeleton ( SkeletonNode _root)

Constructor.

Parameters
[in]_rootnode

§ ~Skeleton()

virtual ~Skeleton ( )
virtual

Destructor.

Member Function Documentation

§ AddAnimation()

void AddAnimation ( SkeletonAnimation _anim)

Add an animation.

The skeleton does not take ownership of the animation

Parameters
[in]_animthe animation to add

§ AddVertNodeWeight()

void AddVertNodeWeight ( unsigned int  _vertex,
std::string  _node,
double  _weight 
)

Add a new weight to a node (bone)

Parameters
[in]_vertexindex of the vertex
[in]_nodename of the bone
[in]_weightthe new weight (range 0 to 1)

§ BindShapeTransform()

ignition::math::Matrix4d BindShapeTransform ( )

Return bind pose skeletal transform.

Returns
a matrix

§ BuildNodeMap()

void BuildNodeMap ( )
protected

Initializes the hande numbers for each node in the map using breadth first traversal.

§ GetAnimation()

SkeletonAnimation* GetAnimation ( const unsigned int  _i)

Find animation.

Parameters
[in]_ithe animation index
Returns
the animation, or NULL if _i is out of bounds

§ GetNodeByHandle()

SkeletonNode* GetNodeByHandle ( unsigned int  _handle)

Find or create node with handle.

Parameters
[in]_handle
Returns
the node. A new node is created if it didn't exist

§ GetNodeById()

SkeletonNode* GetNodeById ( std::string  _id)

Find node by index.

Parameters
[in]_idthe index
Returns
the node, or NULL if not found

§ GetNodeByName()

SkeletonNode* GetNodeByName ( std::string  _name)

Find a node.

Parameters
[in]_namethe name of the node to look for
Returns
the node, or NULL if not found

§ GetNodes()

NodeMap GetNodes ( )

Get a copy or the node dictionary.

§ GetNumAnimations()

unsigned int GetNumAnimations ( )

Returns the number of animations.

Returns
the count

§ GetNumJoints()

unsigned int GetNumJoints ( )

Returns the number of joints.

Returns
the count

§ GetNumNodes()

unsigned int GetNumNodes ( )

Returns the node count.

Returns
the count

§ GetNumVertNodeWeights()

unsigned int GetNumVertNodeWeights ( unsigned int  _vertex)

Returns the number of bone weights for a vertex.

Parameters
[in]_vertexthe index of the vertex
Returns
the count

§ GetRootNode()

SkeletonNode* GetRootNode ( )

Return the root.

Returns
the root

§ GetVertNodeWeight()

std::pair<std::string, double> GetVertNodeWeight ( unsigned int  _v,
unsigned int  _i 
)

Weight of a bone for a vertex.

Parameters
[in]_vthe index of the vertex
[in]_ithe index of the weight for that vertex
Returns
a pair containing the name of the node and the weight

§ PrintTransforms()

void PrintTransforms ( )

Outputs the transforms to std::err stream.

§ Scale()

void Scale ( double  _scale)

Scale all nodes, transforms and animation data.

Parameters
[in]thescaling factor

§ SetBindShapeTransform()

void SetBindShapeTransform ( const ignition::math::Matrix4d &  _trans)

Set the bind pose skeletal transform.

Parameters
[in]_transthe transform

§ SetNumVertAttached()

void SetNumVertAttached ( unsigned int  _vertices)

Resizes the raw node weight array.

Parameters
[in]_verticesthe new size

§ SetRootNode()

void SetRootNode ( SkeletonNode _node)

Change the root node.

Parameters
[in]_nodethe new node

Member Data Documentation

§ anims

std::vector<SkeletonAnimation*> anims
protected

the array of animations

§ bindShapeTransform

ignition::math::Matrix4d bindShapeTransform
protected

the bind pose skeletal transform

§ nodes

NodeMap nodes
protected

The dictionary of nodes, indexed by name.

§ rawNW

RawNodeWeights rawNW
protected

the node weight table

§ root

SkeletonNode* root
protected

the root node


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