Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Static Public Attributes | List of all members
om::graphics::shapes::Skeleton Class Reference

A class that describes a hierarchy of bones with corresponding transformations. More...

#include <omGraphicsSkeleton.h>

Classes

class  Bone
 A class that stores information about a bone that makes up a skeleton. More...
 

Public Member Functions

 Skeleton ()
 Create an empty skeleton with no bones. More...
 
Size getBoneCount () const
 Return the number of bones there are in this skeleton. More...
 
const BonegetBone (Index boneIndex) const
 Return a reference to the bone in this skeleton at the specified index. More...
 
Bool getBoneIndex (const UTF8String &boneName, Index &boneIndex) const
 Determine the index of the first bone in this skeleton with the specified name. More...
 
Index addBone (const Bone &newBone)
 Add a new bone to this skeleton. More...
 
Bool removeBone (Index boneIndex)
 Remove the bone at the specified index from this skeleton. More...
 
Bool removeBoneUpdateParents (Index boneIndex)
 Remove the bone at the specified index from this skeleton. More...
 
void clearBones ()
 Remove all bones from this skeleton. More...
 
const Transform3getBoneTransform (Index boneIndex) const
 Return a reference to the parent-relative transformation of the bone at the specified index. More...
 
Bool setBoneTransform (Index boneIndex, const Transform3 &newTransform)
 Set the parent-relative transformation of the bone at the specified index in this skeleton. More...
 
const Transform3getBoneBindTransform (Index boneIndex) const
 Return a reference to the parent-relative bind transformation of the bone at the specified index. More...
 
Bool setBoneBindTransform (Index boneIndex, const Transform3 &newTransform)
 Set the parent-relative bind transformation of the bone at the specified index in this skeleton. More...
 
const UTF8String & getBoneName (Index boneIndex) const
 Return a reference to the name of the bone at the specified index. More...
 
Bool setBoneName (Index boneIndex, const UTF8String &newName)
 Set the name of the bone at the specified index in this skeleton. More...
 
Index getBoneParent (Index boneIndex) const
 Return the index of the parent of the bone at the specified index. More...
 
Bool setBoneParent (Index boneIndex, Index newParentIndex)
 Set the index of the parent of the bone at the specified index in this skeleton. More...
 
const Matrix4getBoneMatrix (Index boneIndex) const
 Return a reference to the bone-to-world transformation matrix of the bone at the specified index. More...
 
const Matrix4getBoneMatrices () const
 Return a pointer to an array of bone-to-world transformation matrices for this skeleton's bones. More...
 
void updateBoneMatrices (const Matrix4 &worldTransform)
 Update the bone matrices for this skeleton for the specified skeleton-to-world transformation. More...
 

Static Public Attributes

static const ResourceType RESOURCE_TYPE
 The resource type for a graphics skeleton. More...
 
static const Index INVALID_BONE = Index(-1)
 The index used to indicate an invalid bone index. More...
 

Detailed Description

A class that describes a hierarchy of bones with corresponding transformations.

Constructor & Destructor Documentation

om::graphics::shapes::Skeleton::Skeleton ( )

Create an empty skeleton with no bones.

Member Function Documentation

Size om::graphics::shapes::Skeleton::getBoneCount ( ) const
inline

Return the number of bones there are in this skeleton.

const Bone& om::graphics::shapes::Skeleton::getBone ( Index  boneIndex) const
inline

Return a reference to the bone in this skeleton at the specified index.

Bool om::graphics::shapes::Skeleton::getBoneIndex ( const UTF8String &  boneName,
Index boneIndex 
) const

Determine the index of the first bone in this skeleton with the specified name.

The method places the bone index in the output parameter and returns TRUE if there is a bone with that name in the skeleton. If not, FALSE is returned indicating there was no bone with that name.

Index om::graphics::shapes::Skeleton::addBone ( const Bone newBone)

Add a new bone to this skeleton.

The method returns the index of the new bone in this skeleton. There are no restrictions on the parent index range, since the parent index may reference bones that are not added to the skeleton yet. During skeleton updating, an out-of-range parent index is interpreted as INVALID_BONE.

Bool om::graphics::shapes::Skeleton::removeBone ( Index  boneIndex)

Remove the bone at the specified index from this skeleton.

The method returns whether or not the bone was successfully removed. The parent indices of the bones are not affected.

Bool om::graphics::shapes::Skeleton::removeBoneUpdateParents ( Index  boneIndex)

Remove the bone at the specified index from this skeleton.

The method returns whether or not the bone was successfully removed. This method automatically adjusts all bone parent indices that are greater than the removed bone index so that the reflect the new bone indices.

void om::graphics::shapes::Skeleton::clearBones ( )

Remove all bones from this skeleton.

const Transform3& om::graphics::shapes::Skeleton::getBoneTransform ( Index  boneIndex) const
inline

Return a reference to the parent-relative transformation of the bone at the specified index.

Bool om::graphics::shapes::Skeleton::setBoneTransform ( Index  boneIndex,
const Transform3 newTransform 
)
inline

Set the parent-relative transformation of the bone at the specified index in this skeleton.

The method returns whether or not the operation was successful.

const Transform3& om::graphics::shapes::Skeleton::getBoneBindTransform ( Index  boneIndex) const
inline

Return a reference to the parent-relative bind transformation of the bone at the specified index.

Bool om::graphics::shapes::Skeleton::setBoneBindTransform ( Index  boneIndex,
const Transform3 newTransform 
)
inline

Set the parent-relative bind transformation of the bone at the specified index in this skeleton.

The method returns whether or not the operation was successful.

const UTF8String& om::graphics::shapes::Skeleton::getBoneName ( Index  boneIndex) const
inline

Return a reference to the name of the bone at the specified index.

Bool om::graphics::shapes::Skeleton::setBoneName ( Index  boneIndex,
const UTF8String &  newName 
)
inline

Set the name of the bone at the specified index in this skeleton.

The method returns whether or not the operation was successful.

Index om::graphics::shapes::Skeleton::getBoneParent ( Index  boneIndex) const
inline

Return the index of the parent of the bone at the specified index.

The method returns INVALID_BONE_INDEX if there is no parent for that bone.

Bool om::graphics::shapes::Skeleton::setBoneParent ( Index  boneIndex,
Index  newParentIndex 
)
inline

Set the index of the parent of the bone at the specified index in this skeleton.

The method returns whether or not the operation was successful.

const Matrix4& om::graphics::shapes::Skeleton::getBoneMatrix ( Index  boneIndex) const
inline

Return a reference to the bone-to-world transformation matrix of the bone at the specified index.

const Matrix4* om::graphics::shapes::Skeleton::getBoneMatrices ( ) const
inline

Return a pointer to an array of bone-to-world transformation matrices for this skeleton's bones.

void om::graphics::shapes::Skeleton::updateBoneMatrices ( const Matrix4 worldTransform)

Update the bone matrices for this skeleton for the specified skeleton-to-world transformation.

This method should be called once per frame before drawing any meshes that use this skeleton.

Member Data Documentation

const ResourceType om::graphics::shapes::Skeleton::RESOURCE_TYPE
static

The resource type for a graphics skeleton.

const Index om::graphics::shapes::Skeleton::INVALID_BONE = Index(-1)
static

The index used to indicate an invalid bone index.


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