#include <OgreSkeleton.h>
Inheritance diagram for Ogre::Skeleton:
Public Types | |
typedef std::vector< Bone * > | BoneList |
typedef VectorIterator< BoneList > | BoneIterator |
Public Methods | |
Skeleton (const String &name) | |
Constructor, don't call directly, use SkeletonManager. | |
virtual | ~Skeleton () |
virtual void | load (void) |
Generic load - called by SkeletonManager. | |
virtual void | unload (void) |
Generic unload - called by SkeletonManager. | |
virtual Bone * | createBone (void) |
Creates a brand new Bone owned by this Skeleton. | |
virtual Bone * | createBone (unsigned short handle) |
Creates a brand new Bone owned by this Skeleton. | |
virtual Bone * | createBone (const String &name) |
Creates a brand new Bone owned by this Skeleton. | |
virtual Bone * | createBone (const String &name, unsigned short handle) |
Creates a brand new Bone owned by this Skeleton. | |
virtual unsigned short | getNumBones (void) const |
Returns the number of bones in this skeleton. | |
virtual Bone * | getRootBone (void) const |
Gets the root bone of the skeleton: deprecated in favour of getRootBoneIterator. | |
virtual BoneIterator | getRootBoneIterator (void) |
Get an iterator over the root bones in the skeleton, ie those with no parents. | |
virtual BoneIterator | getBoneIterator (void) |
Get an iterator over all the bones in the skeleton. | |
virtual Bone * | getBone (unsigned short handle) const |
Gets a bone by it's handle. | |
virtual Bone * | getBone (const String &name) const |
Gets a bone by it's name. | |
virtual 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. | |
virtual void | reset (bool resetManualBones=false) |
Resets the position and orientation of all bones in this skeleton to their original binding position. | |
virtual Animation * | createAnimation (const String &name, Real length) |
Creates a new Animation object for animating this skeleton. | |
virtual Animation * | getAnimation (const String &name) const |
Returns the named Animation object. | |
virtual void | removeAnimation (const String &name) |
Removes an Animation from this skeleton. | |
virtual void | setAnimationState (const AnimationStateSet &animSet) |
Changes the state of the skeleton to reflect the application of the passed in collection of animations. | |
virtual const AnimationStateSet & | getAnimationState (void) const |
Gets the last animation state of this skeleton. | |
virtual void | _initAnimationState (AnimationStateSet *animSet) |
Initialise an animation set suitable for use with this mesh. | |
virtual void | _getBoneMatrices (Matrix4 *pMatrices) |
Populates the passed in array with the bone matrices based on the current position. | |
virtual unsigned short | getNumAnimations (void) const |
Gets the number of animations on this skeleton. | |
virtual Animation * | getAnimation (unsigned short index) const |
Gets a single animation by index. | |
virtual SkeletonAnimationBlendMode | getBlendMode () |
Gets the animation blending mode which this skeleton will use. | |
virtual void | setBlendMode (SkeletonAnimationBlendMode state) |
Sets the animation blending mode this skeleton will use. | |
virtual void | _updateTransforms (void) |
Updates all the derived transforms in the skeleton. | |
virtual size_t | getSize (void) const |
Retrieves info about the size of the resource. | |
virtual void | touch (void) |
'Touches' the resource to indicate it has been used. | |
time_t | getLastAccess (void) const |
Gets the last time the resource was 'touched'. | |
const String & | getName (void) const |
Gets resource name. | |
ResourceHandle | getHandle (void) const |
bool | isLoaded (void) const |
Returns true if the Resource has been loaded, false otherwise. | |
virtual void | destroy () |
A method to make the resource delete itself. | |
Protected Types | |
typedef std::map< String, Bone * > | BoneListByName |
Lookup by bone name. | |
typedef std::map< String, Animation * > | AnimationList |
Storage of animations, lookup by name. | |
Protected Methods | |
void | deriveRootBone (void) const |
Internal method which parses the bones to derive the root bone. | |
void | _dumpContents (const String &filename) |
Debugging method. | |
Protected Attributes | |
SkeletonAnimationBlendMode | mBlendState |
BoneList | mBoneList |
Storage of bones, indexed by bone handle. | |
BoneListByName | mBoneListByName |
BoneList | mRootBones |
Pointer to root bones (can now have multiple roots). | |
unsigned short | mNextAutoHandle |
Bone automatic handles. | |
AnimationList | mAnimationsList |
AnimationStateSet | mLastAnimationState |
Saved version of last animation. | |
String | mName |
ResourceHandle | mHandle |
bool | mIsLoaded |
time_t | mLastAccess |
size_t | mSize |
Friends | |
class | SkeletonInstance |
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.
Definition at line 72 of file OgreSkeleton.h.
|
Storage of animations, lookup by name.
Definition at line 273 of file OgreSkeleton.h. |
|
Definition at line 170 of file OgreSkeleton.h. Referenced by getBoneIterator(), getRootBoneIterator(), and Ogre::SkeletonInstance::load(). |
|
Definition at line 169 of file OgreSkeleton.h. |
|
Lookup by bone name.
Definition at line 262 of file OgreSkeleton.h. |
|
Constructor, don't call directly, use SkeletonManager.
Definition at line 42 of file OgreSkeleton.cpp. References Ogre::ANIMBLEND_AVERAGE, mBlendState, Ogre::Resource::mName, and mNextAutoHandle. |
|
Definition at line 54 of file OgreSkeleton.cpp. References unload(). |
|
Debugging method.
Definition at line 419 of file OgreSkeleton.cpp. References Ogre::AnimationTrack::getAssociatedNode(), Ogre::Bone::getHandle(), Ogre::AnimationTrack::getKeyFrame(), Ogre::Animation::getLength(), Ogre::Animation::getName(), Ogre::AnimationTrack::getNumKeyFrames(), Ogre::Animation::getNumTracks(), Ogre::Node::getOrientation(), Ogre::Node::getPosition(), Ogre::KeyFrame::getRotation(), Ogre::KeyFrame::getTime(), Ogre::Animation::getTrack(), Ogre::KeyFrame::getTranslate(), mAnimationsList, mBoneList, Ogre::Resource::mName, Ogre::of, Ogre::Real, and Ogre::Quaternion::ToAngleAxis(). |
|
Populates the passed in array with the bone matrices based on the current position.
Definition at line 328 of file OgreSkeleton.cpp. References Ogre::Bone::_getBindingPoseInverseTransform(), Ogre::Node::_getFullTransform(), _updateTransforms(), and mBoneList. Referenced by Ogre::Entity::cacheBoneMatrices(). |
|
Initialise an animation set suitable for use with this mesh.
Definition at line 309 of file OgreSkeleton.cpp. References Ogre::AnimationStateSet, Ogre::Animation::getLength(), Ogre::Animation::getName(), and mAnimationsList. Referenced by Ogre::Mesh::_initAnimationState(). |
|
Updates all the derived transforms in the skeleton.
Definition at line 510 of file OgreSkeleton.cpp. References mRootBones. Referenced by _getBoneMatrices(), and setBindingPose(). |
|
Creates a new Animation object for animating this skeleton.
Reimplemented in Ogre::SkeletonInstance. Definition at line 261 of file OgreSkeleton.cpp. References mAnimationsList, mLastAnimationState, and Ogre::Real. Referenced by Ogre::SkeletonInstance::createAnimation(), and Ogre::SkeletonSerializer::readAnimation(). |
|
Creates a brand new Bone owned by this Skeleton.
Definition at line 152 of file OgreSkeleton.cpp. References Except, mBoneList, mBoneListByName, and OGRE_MAX_NUM_BONES. |
|
Creates a brand new Bone owned by this Skeleton.
Definition at line 129 of file OgreSkeleton.cpp. References createBone(), and mNextAutoHandle. |
|
Creates a brand new Bone owned by this Skeleton.
Definition at line 134 of file OgreSkeleton.cpp. References Except, Ogre::Node::getName(), mBoneList, mBoneListByName, and OGRE_MAX_NUM_BONES. |
|
Creates a brand new Bone owned by this Skeleton.
Definition at line 123 of file OgreSkeleton.cpp. References mNextAutoHandle. Referenced by Ogre::SkeletonInstance::cloneBoneAndChildren(), createBone(), Ogre::Bone::createChild(), Ogre::Bone::createChildImpl(), and Ogre::SkeletonSerializer::readBone(). |
|
Internal method which parses the bones to derive the root bone.
Definition at line 394 of file OgreSkeleton.cpp. References Except, Ogre::Node::getParent(), mBoneList, and mRootBones. Referenced by getRootBone(), and getRootBoneIterator(). |
|
A method to make the resource delete itself.
Definition at line 137 of file OgreResource.h. |
|
Gets a single animation by index.
Reimplemented in Ogre::SkeletonInstance. Definition at line 361 of file OgreSkeleton.cpp. References mAnimationsList. |
|
Returns the named Animation object.
Reimplemented in Ogre::SkeletonInstance. Definition at line 275 of file OgreSkeleton.cpp. References Except, and mAnimationsList. Referenced by Ogre::SkeletonSerializer::exportSkeleton(), Ogre::SkeletonInstance::getAnimation(), and setAnimationState(). |
|
Gets the last animation state of this skeleton.
Definition at line 304 of file OgreSkeleton.cpp. References Ogre::AnimationStateSet, and mLastAnimationState. |
|
Gets the animation blending mode which this skeleton will use.
Definition at line 486 of file OgreSkeleton.cpp. References mBlendState, and Ogre::SkeletonAnimationBlendMode. |
|
Gets a bone by it's name.
Definition at line 380 of file OgreSkeleton.cpp. References Except, and mBoneListByName. |
|
Gets a bone by it's handle.
Definition at line 374 of file OgreSkeleton.cpp. References mBoneList. Referenced by Ogre::Entity::_updateRenderQueue(), Ogre::Animation::apply(), Ogre::Entity::attachObjectToBone(), Ogre::SkeletonSerializer::readAnimationTrack(), Ogre::SkeletonSerializer::readBoneParent(), and Ogre::SkeletonSerializer::writeSkeleton(). |
|
Get an iterator over all the bones in the skeleton.
Definition at line 505 of file OgreSkeleton.cpp. References BoneIterator, and mBoneList. |
|
Definition at line 120 of file OgreResource.h. References Ogre::ResourceHandle. Referenced by Ogre::Material::clone(), Ogre::BspLevel::loadQuake3Level(), and Ogre::ResourceManager::unload(). |
|
Gets the last time the resource was 'touched'.
Definition at line 108 of file OgreResource.h. |
|
|
Gets the number of animations on this skeleton.
Reimplemented in Ogre::SkeletonInstance. Definition at line 356 of file OgreSkeleton.cpp. References mAnimationsList. Referenced by Ogre::SkeletonSerializer::exportSkeleton(), and Ogre::SkeletonInstance::getNumAnimations(). |
|
Returns the number of bones in this skeleton.
Definition at line 323 of file OgreSkeleton.cpp. References mBoneList. Referenced by Ogre::Entity::_updateRenderQueue(), Ogre::Entity::cacheBoneMatrices(), Ogre::Entity::Entity(), and Ogre::SkeletonSerializer::writeSkeleton(). |
|
Gets the root bone of the skeleton: deprecated in favour of getRootBoneIterator.
Definition at line 172 of file OgreSkeleton.cpp. References deriveRootBone(), and mRootBones. |
|
Get an iterator over the root bones in the skeleton, ie those with no parents.
Definition at line 496 of file OgreSkeleton.cpp. References BoneIterator, deriveRootBone(), and mRootBones. Referenced by Ogre::SkeletonInstance::load(). |
|
Retrieves info about the size of the resource.
Definition at line 93 of file OgreResource.h. Referenced by Ogre::ResourceManager::unload(). |
|
Returns true if the Resource has been loaded, false otherwise.
Definition at line 127 of file OgreResource.h. Referenced by Ogre::GpuProgramUsage::_load(), Ogre::SceneManager::deriveShadowCasterPass(), Ogre::SceneManager::deriveShadowReceiverPass(), Ogre::Technique::isLoaded(), Ogre::D3D9Texture::load(), Ogre::D3D9Texture::unload(), and Ogre::D3D9Texture::~D3D9Texture(). |
|
Generic load - called by SkeletonManager.
Implements Ogre::Resource. Reimplemented in Ogre::SkeletonInstance. Definition at line 59 of file OgreSkeleton.cpp. References Ogre::DataChunk::clear(), Except, Ogre::SkeletonSerializer::importSkeleton(), Ogre::Resource::mIsLoaded, Ogre::Resource::mName, Ogre::String::split(), Ogre::String::toLowerCase(), and unload(). Referenced by Ogre::Mesh::setSkeletonName(). |
|
Removes an Animation from this skeleton.
Reimplemented in Ogre::SkeletonInstance. Definition at line 288 of file OgreSkeleton.cpp. References Except, and mAnimationsList. Referenced by Ogre::SkeletonInstance::removeAnimation(). |
|
Resets the position and orientation of all bones in this skeleton to their original binding position.
Definition at line 251 of file OgreSkeleton.cpp. References mBoneList. Referenced by setAnimationState(). |
|
Changes the state of the skeleton to reflect the application of the passed in collection of animations.
Definition at line 182 of file OgreSkeleton.cpp. References Ogre::AnimationStateSet, Ogre::ANIMBLEND_CUMULATIVE, Ogre::Animation::apply(), getAnimation(), Ogre::AnimationState::getAnimationName(), Ogre::AnimationState::getEnabled(), Ogre::AnimationState::getTimePosition(), Ogre::AnimationState::getWeight(), mBlendState, mLastAnimationState, and reset(). Referenced by Ogre::Entity::cacheBoneMatrices(). |
|
Sets the current position / orientation to be the 'binding pose' ie the layout in which bones were originally bound to a mesh.
Definition at line 238 of file OgreSkeleton.cpp. References _updateTransforms(), and mBoneList. Referenced by Ogre::SkeletonSerializer::importSkeleton(), and Ogre::SkeletonInstance::load(). |
|
Sets the animation blending mode this skeleton will use.
Definition at line 491 of file OgreSkeleton.cpp. References mBlendState, and Ogre::SkeletonAnimationBlendMode. |
|
'Touches' the resource to indicate it has been used.
Reimplemented in Ogre::Material. Definition at line 100 of file OgreResource.h. Referenced by Ogre::Mesh::clone(), Ogre::MeshManager::createCurvedIllusionPlane(), Ogre::MeshManager::createCurvedPlane(), Ogre::MeshManager::createPlane(), and Ogre::ResourceManager::load(). |
|
Generic unload - called by SkeletonManager.
Reimplemented from Ogre::Resource. Reimplemented in Ogre::SkeletonInstance. Definition at line 100 of file OgreSkeleton.cpp. References mAnimationsList, mBoneList, and Ogre::Resource::mIsLoaded. |
|
Definition at line 74 of file OgreSkeleton.h. |
|
Definition at line 274 of file OgreSkeleton.h. Referenced by _dumpContents(), _initAnimationState(), createAnimation(), getAnimation(), getNumAnimations(), removeAnimation(), and unload(). |
|
Definition at line 258 of file OgreSkeleton.h. Referenced by getBlendMode(), Ogre::SkeletonInstance::load(), setAnimationState(), setBlendMode(), and Skeleton(). |
|
Storage of bones, indexed by bone handle.
Definition at line 260 of file OgreSkeleton.h. Referenced by _dumpContents(), _getBoneMatrices(), createBone(), deriveRootBone(), getBone(), getBoneIterator(), getNumBones(), reset(), setBindingPose(), and unload(). |
|
Definition at line 263 of file OgreSkeleton.h. Referenced by createBone(), and getBone(). |
|
Definition at line 57 of file OgreResource.h. Referenced by Ogre::ResourceManager::add(), Ogre::Material::clone(), Ogre::Material::copyDetailsTo(), and Ogre::Material::operator=(). |
|
|
Definition at line 59 of file OgreResource.h. Referenced by Ogre::Material::operator=(). |
|
Saved version of last animation.
Definition at line 278 of file OgreSkeleton.h. Referenced by createAnimation(), getAnimationState(), and setAnimationState(). |
|
|
Bone automatic handles.
Definition at line 269 of file OgreSkeleton.h. Referenced by createBone(), Ogre::SkeletonInstance::load(), and Skeleton(). |
|
Pointer to root bones (can now have multiple roots).
Definition at line 267 of file OgreSkeleton.h. Referenced by _updateTransforms(), Ogre::SkeletonInstance::cloneBoneAndChildren(), deriveRootBone(), getRootBone(), and getRootBoneIterator(). |
|
Definition at line 60 of file OgreResource.h. Referenced by Ogre::D3D9Texture::_setFinalAttributes(), Ogre::D3DTexture::loadImage(), Ogre::D3DTexture::loadImage3D(), Ogre::GLTexture::loadImages(), and Ogre::Material::operator=(). |
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:27:16 2004