#include <OgreSkeleton.h>
Inheritance diagram for Ogre::Skeleton:
Public Methods | |
Skeleton (String name) | |
Constructor, don't call directly, use SkeletonManager. More... | |
~Skeleton () | |
virtual void | load (void) |
Generic load - called by SkeletonManager. More... | |
virtual void | unload (void) |
Generic unload - called by SkeletonManager. More... | |
Bone * | createBone (void) |
Creates a brand new Bone owned by this Skeleton. More... | |
Bone * | createBone (unsigned short handle) |
Creates a brand new Bone owned by this Skeleton. More... | |
Bone * | createBone (const String &name) |
Creates a brand new Bone owned by this Skeleton. More... | |
Bone * | createBone (const String &name, unsigned short handle) |
Creates a brand new Bone owned by this Skeleton. More... | |
unsigned short | getNumBones (void) const |
Returns the number of bones in this skeleton. More... | |
Bone * | getRootBone (void) const |
Gets the root bone of the skeleton. More... | |
Bone * | getBone (unsigned short handle) const |
Gets a bone by it's handle. More... | |
Bone * | getBone (const String &name) const |
Gets a bone by it's name. More... | |
void | setBindingPose (void) |
Sets the current position / orientation to be the 'binding pose' ie the layout in which bones were originally bound to a mesh. More... | |
void | reset (void) |
Resets the position and orientation of all bones in this skeleton to their original binding position. More... | |
Animation * | createAnimation (const String &name, Real length) |
Creates a new Animation object for animating this skeleton. More... | |
Animation * | getAnimation (const String &name) const |
Returns the named Animation object. More... | |
void | removeAnimation (const String &name) |
Removes an Animation from this skeleton. More... | |
void | setAnimationState (const AnimationStateSet &animSet) |
Changes the state of the skeleton to reflect the application of the passed in collection of animations. More... | |
const AnimationStateSet & | getAnimationState (void) const |
Gets the last animation state of this skeleton. More... | |
void | _initAnimationState (AnimationStateSet *animSet) |
Initialise an animation set suitable for use with this mesh. More... | |
void | _getBoneMatrices (Matrix4 *pMatrices) |
Populates the passed in array with the bone matrices based on the current position. More... | |
unsigned short | getNumAnimations (void) const |
Gets the number of animations on this skeleton. More... | |
Animation * | getAnimation (unsigned short index) const |
Gets a single animation by index. More... | |
SkeletonAnimationBlendMode | getBlendMode () |
Gets the animation blending mode which this skeleton will use. More... | |
void | setBlendMode (SkeletonAnimationBlendMode state) |
Sets the animation blending mode this skeleton will use. More... | |
virtual size_t | getSize (void) |
Retrieves info about the size of the resource. More... | |
void | touch (void) |
'Touches' the resource to indicate it has been used. More... | |
time_t | getLastAccess (void) const |
Gets the last time the resource was 'touched'. More... | |
const String & | getName (void) const |
Gets resource name. More... | |
bool | isLoaded (void) const |
Returns true if the Resource has been loaded, false otherwise. More... | |
virtual void | destroy () |
A method to make the resource delete itself. More... | |
Protected Types | |
typedef std::map< unsigned short, Bone * > | BoneList |
Storage of bones, lookup by bone handle. More... | |
typedef std::map< String, Bone * > | BoneListByName |
Lookup by bone name. More... | |
typedef std::map< String, Animation * > | AnimationList |
Storage of animations, lookup by name. More... | |
Protected Methods | |
void | deriveRootBone (void) const |
Internal method which parses the bones to derive the root bone. More... | |
void | _dumpContents (const String &filename) |
Debugging method. More... | |
Protected Attributes | |
SkeletonAnimationBlendMode | mBlendState |
BoneList | mBoneList |
BoneListByName | mBoneListByName |
Bone * | mRootBone |
Pointer to root bone (all others follow). More... | |
unsigned short | mNextAutoHandle |
Automatic handles. More... | |
AnimationList | mAnimationsList |
AnimationStateSet | mLastAnimationState |
Saved version of last animation. More... | |
String | mName |
bool | mIsLoaded |
time_t | mLastAccess |
size_t | mSize |
So how does this animate a mesh? Well every vertex in a mesh is assigned to one or more bones which affects it's position when the bone is moved. If a vertex is assigned to more than one bone, then weights must be assigned to determine how much each bone affects the vertex (actually a weight of 1.0 is used for single bone assignments). Weighted vertex assignments are especially useful around the joints themselves to avoid 'pinching' of the mesh in this region.
Therefore by moving the skeleton using preset animations, we can animate the mesh. The advantage of using skeletal animation is that you store less animation data, especially as vertex counts increase. In addition, you are able to blend multiple animations together (e.g. walking and looking around, running and shooting) and provide smooth transitions between animations without incurring as much of an overhead as would be involved if you did this on the core vertex data.
Skeleton definitions are loaded from datafiles, namely the .skeleton file format. They are loaded on demand, especially when referenced by a Mesh.
|
Storage of animations, lookup by name.
|
|
Storage of bones, lookup by bone handle.
|
|
Lookup by bone name.
|
|
Constructor, don't call directly, use SkeletonManager.
|
|
|
|
Debugging method.
|
|
Populates the passed in array with the bone matrices based on the current position.
|
|
Initialise an animation set suitable for use with this mesh.
|
|
Creates a new Animation object for animating this skeleton.
|
|
Creates a brand new Bone owned by this Skeleton.
|
|
Creates a brand new Bone owned by this Skeleton.
|
|
Creates a brand new Bone owned by this Skeleton.
|
|
Creates a brand new Bone owned by this Skeleton.
|
|
Internal method which parses the bones to derive the root bone.
|
|
A method to make the resource delete itself.
|
|
Gets a single animation by index.
|
|
Returns the named Animation object.
|
|
Gets the last animation state of this skeleton.
|
|
Gets the animation blending mode which this skeleton will use.
|
|
Gets a bone by it's name.
|
|
Gets a bone by it's handle.
|
|
Gets the last time the resource was 'touched'.
|
|
Gets resource name.
Reimplemented in Ogre::Material. |
|
Gets the number of animations on this skeleton.
|
|
Returns the number of bones in this skeleton.
|
|
Gets the root bone of the skeleton.
|
|
Retrieves info about the size of the resource.
|
|
Returns true if the Resource has been loaded, false otherwise.
|
|
Generic load - called by SkeletonManager.
Implements Ogre::Resource. |
|
Removes an Animation from this skeleton.
|
|
Resets the position and orientation of all bones in this skeleton to their original binding position.
|
|
Changes the state of the skeleton to reflect the application of the passed in collection of animations.
|
|
Sets the current position / orientation to be the 'binding pose' ie the layout in which bones were originally bound to a mesh.
|
|
Sets the animation blending mode this skeleton will use.
|
|
'Touches' the resource to indicate it has been used.
|
|
Generic unload - called by SkeletonManager.
Reimplemented from Ogre::Resource. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Saved version of last animation.
|
|
|
|
Automatic handles.
|
|
Pointer to root bone (all others follow).
|
|
|
Copyright © 2002 by The OGRE Team