All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gazebo::common::Skeleton Class Reference

A skeleton. More...

#include <common/common.hh>

Collaboration diagram for gazebo::common::Skeleton:
Collaboration graph
[legend]

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...
 
SkeletonAnimationGetAnimation (const unsigned int _i)
 Find animation. More...
 
math::Matrix4 GetBindShapeTransform ()
 Return bind pose skeletal transform. 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 (math::Matrix4 _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...
 
math::Matrix4 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

gazebo::common::Skeleton::Skeleton ( )

Constructor.

gazebo::common::Skeleton::Skeleton ( SkeletonNode _root)

Constructor.

Parameters
[in]_rootnode
virtual gazebo::common::Skeleton::~Skeleton ( )
virtual

Destructor.

Member Function Documentation

void gazebo::common::Skeleton::AddAnimation ( SkeletonAnimation _anim)

Add an animation.

The skeleton does not take ownership of the animation

Parameters
[in]_animthe animation to add
void gazebo::common::Skeleton::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)
void gazebo::common::Skeleton::BuildNodeMap ( )
protected

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

SkeletonAnimation* gazebo::common::Skeleton::GetAnimation ( const unsigned int  _i)

Find animation.

Parameters
[in]_ithe animation index
Returns
the animation, or NULL if _i is out of bounds
math::Matrix4 gazebo::common::Skeleton::GetBindShapeTransform ( )

Return bind pose skeletal transform.

Returns
a matrix
SkeletonNode* gazebo::common::Skeleton::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
SkeletonNode* gazebo::common::Skeleton::GetNodeById ( std::string  _id)

Find node by index.

Parameters
[in]_idthe index
Returns
the node, or NULL if not found
SkeletonNode* gazebo::common::Skeleton::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
NodeMap gazebo::common::Skeleton::GetNodes ( )

Get a copy or the node dictionary.

unsigned int gazebo::common::Skeleton::GetNumAnimations ( )

Returns the number of animations.

Returns
the count
unsigned int gazebo::common::Skeleton::GetNumJoints ( )

Returns the number of joints.

Returns
the count
unsigned int gazebo::common::Skeleton::GetNumNodes ( )

Returns the node count.

Returns
the count
unsigned int gazebo::common::Skeleton::GetNumVertNodeWeights ( unsigned int  _vertex)

Returns the number of bone weights for a vertex.

Parameters
[in]_vertexthe index of the vertex
Returns
the count
SkeletonNode* gazebo::common::Skeleton::GetRootNode ( )

Return the root.

Returns
the root
std::pair<std::string, double> gazebo::common::Skeleton::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
void gazebo::common::Skeleton::PrintTransforms ( )

Outputs the transforms to std::err stream.

void gazebo::common::Skeleton::Scale ( double  _scale)

Scale all nodes, transforms and animation data.

Parameters
[in]thescaling factor
void gazebo::common::Skeleton::SetBindShapeTransform ( math::Matrix4  _trans)

Set the bind pose skeletal transform.

Parameters
[in]_transthe transform
void gazebo::common::Skeleton::SetNumVertAttached ( unsigned int  _vertices)

Resizes the raw node weight array.

Parameters
[in]_verticesthe new size
void gazebo::common::Skeleton::SetRootNode ( SkeletonNode _node)

Change the root node.

Parameters
[in]_nodethe new node

Member Data Documentation

std::vector<SkeletonAnimation*> gazebo::common::Skeleton::anims
protected

the array of animations

math::Matrix4 gazebo::common::Skeleton::bindShapeTransform
protected

the bind pose skeletal transform

NodeMap gazebo::common::Skeleton::nodes
protected

The dictionary of nodes, indexed by name.

RawNodeWeights gazebo::common::Skeleton::rawNW
protected

the node weight table

SkeletonNode* gazebo::common::Skeleton::root
protected

the root node


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