fluidvis
Public Member Functions | List of all members
sx::Skeleton Class Reference

#include <SXCore.h>

Inheritance diagram for sx::Skeleton:
sx::SXResource sx::EffectObject

Public Member Functions

EX Skeleton (const string &id)
 
EX ~Skeleton ()
 
EX void addBones (const string &path)
 
EX void addBones (BufferedMesh &mesh)
 
EX void setSkeletonMatrix (const Matrix &transform)
 
EX const MatrixgetSkeletonMatrix () const
 
EX void addRootBone (Bone &bone)
 
EX const BonegetBone (const string &id) const
 
EX vector< const BonegetRootBones () const
 
EX void load ()
 
EX void unload ()
 
EX bool isLoaded () const
 
EX vector< string > getUnmatchedBones () const
 
EX void addBoneTransform (int setID, const BoneTransform &transform)
 
EX BoneTransformgetBoneTransform (int setID, const string &boneID)
 
EX void removeBoneTransform (int setID, const string &boneID)
 
EX void removeBoneTransforms (int setID)
 
EX void removeBoneTransforms ()
 
EX void updateBoneTransforms ()
 
EX void execute (vector< string > &input)
 
- Public Member Functions inherited from sx::SXResource
virtual EX ~SXResource ()
 
EX const string & getID () const
 

Additional Inherited Members

- Protected Attributes inherited from sx::SXResource
string id
 

Detailed Description

Collection of bone hierachies with sets of BoneTransforms attached to it. Each set of BoneTransforms has a unique id, and repesents an instance of the skeleton in movement. Method updateBoneTransforms uses the input matrices of the BoneTransforms to move the bones, and copies the matrix describing the movement of the vertices associated to the bone of a BoneTransform in model space coordinates into the output matrix of the BoneTransform.

Constructor & Destructor Documentation

EX sx::Skeleton::Skeleton ( const string &  id)

constructor

EX sx::Skeleton::~Skeleton ( )

destructor

Member Function Documentation

EX void sx::Skeleton::addBones ( const string &  path)

Adds the path of a file containing a skeleton, which will be loaded by method load. Skeletons in Collada format are supported currently.

EX void sx::Skeleton::addBones ( BufferedMesh mesh)

Adds a mesh, from which bones will be loaded by method load. The load operation of Skeleton calls the load operation of the mesh, if the mesh is not loaded yet.

EX void sx::Skeleton::addBoneTransform ( int  setID,
const BoneTransform transform 
)

Adds a bone transform to a set with identifier setID. The identifier of the transform is only required to be unique in the set of BoneTransforms with identifier setID. A set of BoneTransforms represents an instance of the skeleton. The BoneTransform itself represents movement of the skeleton. The input matrix of the BoneTransform describes the movement of the bone with the same identifier as the BoneTransform in joint space from the bind pose into the moved state. The updateBoneTransforms method takes all input matrices of a set into consideration, applies the movements specified by the input matrices, and calculates the output matrix of the BoneTransform, which transforms the vertices associated to the bone with the identifier of the BoneTransform from the bind pose into the moved pose in model space coordinates. If the BoneTransform has no bone associated with it, the updateBoneTransforms method simply ignores it.

EX void sx::Skeleton::addRootBone ( Bone bone)

Adds a root bone, which will be loaded by method load.

EX void sx::Skeleton::execute ( vector< string > &  input)
virtual

calls method updateBoneTransforms()

Implements sx::EffectObject.

EX const Bone& sx::Skeleton::getBone ( const string &  id) const

Returns a loaded bone with identifier id. If no such bone exists, an exception is thrown.

EX BoneTransform& sx::Skeleton::getBoneTransform ( int  setID,
const string &  boneID 
)

Returns the BoneTransform with identifier boneID in the set of BoneTransforms with identifier setID. If no such BoneTransform exists, an exception is thrown.

EX vector<const Bone> sx::Skeleton::getRootBones ( ) const

returns the loaded root bones

EX const Matrix& sx::Skeleton::getSkeletonMatrix ( ) const

getter

EX vector<string> sx::Skeleton::getUnmatchedBones ( ) const

The purpose of this method is to check for boneIDs of BoneTransforms, which don't match to any bones. If this is loaded, the method returns a list of all BoneTransforms' boneIDs, which aren't equal to any bone's ID. Otherwise, if this is not loaded, the returned vector is empty.

EX bool sx::Skeleton::isLoaded ( ) const
virtual

true iff the last invocation of load loaded all the bones

Implements sx::SXResource.

EX void sx::Skeleton::load ( )
virtual

Deletes the previously loaded bones, and loads bones added with the addBone and addRootBone methods. Each bone is required to have a unique identifier. If that uniquenes constraint does not hold, or the bones can't be loaded from the added media, the method deletes all bones, and leaves this in an uninitialized state.

Implements sx::SXResource.

EX void sx::Skeleton::removeBoneTransform ( int  setID,
const string &  boneID 
)

Removes the BoneTransform with identifier boneID in the set of BoneTransforms with identifier setID.

EX void sx::Skeleton::removeBoneTransforms ( int  setID)

removes the set of BoneTransforms with identifier setID

EX void sx::Skeleton::removeBoneTransforms ( )

removes all BoneTransforms

EX void sx::Skeleton::setSkeletonMatrix ( const Matrix transform)

setter

EX void sx::Skeleton::unload ( )

deletes all loaded bones, if something has been loaded, and leaves this unloaded

EX void sx::Skeleton::updateBoneTransforms ( )

Calculates the movement of the vertices from bind pose into the moved position in model space coordinates. The method calculates the state of the moved position by taking the input matrices of the BoneTransforms into consideration, and copies the transformations of the vertices into the moved position into the output matrices of the BoneTransforms. Each set of BoneTransforms is treated as an instance of the Skeleton. The input matrix of a certain BoneTransform is interpreted as the movement of the bone with the same identifier from the bind pose into the moved state in the space of the bone's joint. If the input matrix is NULL, it's assumed to be the identity matrix. The transformation from the bind pose into the moved state in model space coordinates is copied into the output matrix. If the BoneTransform's output matrix is NULL, the output matrix remains unchanged. BoneTransforms, which are not associated with any bone are ignored.


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