Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Skeleton Class Reference

A Skeleton is a collection on Bone objects. More...

#include <Skeleton.h>

List of all members.

Public Methods

 Skeleton (Bone *root)
 Constructs a Skeleton with one Bone (the root).

 ~Skeleton ()
 Destructor destroys the Skeleton and deallocates all memory for the Bone objects that it holds.

BonegetRoot ()
 Returns the root Bone of the Skeleton.

BonefindBone (const std::string &boneName)
 Searches the entire Bone hierarchy for the Bone with the specified name.

void addBone (Bone *parent, Bone *newBone)
 Adds a Bone to be the child of the given parent.

void debugRender (StaticModel &m)
 Provides a debug rendering by rendering the given model using each Bone's matrix.

void updateHierarchy (const Matrix &worldMat)
 Updates all Bones in this skeleton, using the passed world matrix as the starting transformation.

BonePtrListIter beginBones ()
 Returns an iterator to the start of a linear collection of all Bone objects in this Skeleton.

BonePtrListIter endBones ()
 Returns an iterator to one past the last Bone in the collection of bones, exactly as the end method for an STL container.


Detailed Description

A Skeleton is a collection on Bone objects.

Bones can be addressed by name, or by an index (as in an array). Other than acting as a linear container for bones, the Skeleton has no functionality. The Skeleon class is responsible for the memory of the bones. The usefulness of the Skeleton comes from the fact that you can get a sequential list of bones, or get the "root" bone and traverse the tree. When rendering the mesh or generating a list of bones, the linear access is well-suited, when applying/calculating transforms, tree traversal is well-suited.


Constructor & Destructor Documentation

Skeleton::Skeleton Bone   root [explicit]
 

Constructs a Skeleton with one Bone (the root).

The memory for this root Bone becomes the responsiblity of this Skeleton. The passed pointer must not be NULL.

Skeleton::~Skeleton  
 

Destructor destroys the Skeleton and deallocates all memory for the Bone objects that it holds.

Any Bone objects that are part of this Skeleton are destroyed as a result.


Member Function Documentation

void Skeleton::addBone Bone   parent,
Bone   newBone
 

Adds a Bone to be the child of the given parent.

The parent must be a Bone from this Skeleton. The Bone newBone is added to the end of the list of Bones, so the linear list of bones is ordered by addition. Adding bones in this way allows one to create any Bone hierarchy but with an additional arbitrary traversal ordering.

The memory for newBone becomes the responsibility of Skeleton.

Adding bones invalidates any iterators from beginBones or endBones.

BonePtrListIter Skeleton::beginBones  
 

Returns an iterator to the start of a linear collection of all Bone objects in this Skeleton.

This iterator is an STL-compliant iterator of Bone*. The order of the bones is the order is the order they were inserted into the Skeleton.

Adding bones invalidates any iterators from beginBones or endBones.

void Skeleton::debugRender StaticModel   m
 

Provides a debug rendering by rendering the given model using each Bone's matrix.

It is suggested that the model is oriented around the origin so that the model is drawn about the transformed origin of all the Bones.

BonePtrListIter Skeleton::endBones  
 

Returns an iterator to one past the last Bone in the collection of bones, exactly as the end method for an STL container.

Adding bones invalidates any iterators from beginBones or endBones.

Bone * Skeleton::findBone const std::string &    boneName
 

Searches the entire Bone hierarchy for the Bone with the specified name.

Returns NULL if the Bone is not found, or a pointer to the located Bone.

If more than one Bone of the same name exists in the hierarchy, then one of them will be returned.

Bone * Skeleton::getRoot  
 

Returns the root Bone of the Skeleton.

If the Skeleton has no bones, then NULL is returned.


The documentation for this class was generated from the following files:
Generated on Mon May 5 21:47:03 2003 for CG Skeletal Animation Project by doxygen1.2.18