Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::Animation Class Reference

An animation sequence. More...

#include <OgreAnimation.h>

List of all members.

Public Types

typedef std::map< unsigned
short, AnimationTrack * > 
TrackList
typedef ConstMapIterator<
TrackList
TrackIterator
enum  InterpolationMode { IM_LINEAR, IM_SPLINE }
 The types of animation interpolation available. More...

enum  RotationInterpolationMode { RIM_LINEAR, RIM_SPHERICAL }
 The types of rotational interpolation available. More...


Public Methods

 Animation (const String &name, Real length)
 You should not use this constructor directly, use the parent object such as Skeleton instead.

virtual ~Animation ()
const StringgetName (void) const
 Gets the name of this animation.

Real getLength (void) const
 Gets the total length of the animation.

AnimationTrackcreateTrack (unsigned short handle)
 Creates an AnimationTrack.

AnimationTrackcreateTrack (unsigned short handle, Node *node)
 Creates a new AnimationTrack automatically associated with a Node.

unsigned short getNumTracks (void) const
 Gets the number of AnimationTrack objects which make up this animation.

AnimationTrackgetTrack (unsigned short handle) const
 Gets a track by it's handle.

void destroyTrack (unsigned short handle)
 Destroys the track with the given handle.

void destroyAllTracks (void)
 Removes and destroys all tracks making up this animation.

void apply (Real timePos, Real weight=1.0, bool accumulate=false)
 Applies an animation given a specific time point and weight.

void apply (Skeleton *skeleton, Real timePos, Real weight=1.0, bool accumulate=false)
 Applies an animation given a specific time point and weight to a given skeleton.

void setInterpolationMode (InterpolationMode im)
 Tells the animation how to interpolate between keyframes.

InterpolationMode getInterpolationMode (void) const
 Gets the current interpolation mode of this animation.

void setRotationInterpolationMode (RotationInterpolationMode im)
 Tells the animation how to interpolate rotations.

RotationInterpolationMode getRotationInterpolationMode (void) const
 Gets the current rotation interpolation mode of this animation.

const TrackList_getTrackList (void) const
 Fast access to NON-UPDATEABLE track list.

TrackIterator getTrackIterator (void) const
 Get non-updateable iterator over tracks.


Static Public Methods

void setDefaultInterpolationMode (InterpolationMode im)
 Sets the default animation interpolation mode.

InterpolationMode getDefaultInterpolationMode (void)
 Gets the default interpolation mode for all animations.

void setDefaultRotationInterpolationMode (RotationInterpolationMode im)
 Sets the default rotation interpolation mode.

RotationInterpolationMode getDefaultRotationInterpolationMode (void)
 Gets the default rotation interpolation mode for all animations.


Protected Attributes

TrackList mTrackList
 Tracks, indexed by handle.

String mName
Real mLength
InterpolationMode mInterpolationMode
RotationInterpolationMode mRotationInterpolationMode

Static Protected Attributes

InterpolationMode msDefaultInterpolationMode = Animation::IM_LINEAR
RotationInterpolationMode msDefaultRotationInterpolationMode = Animation::RIM_LINEAR


Detailed Description

An animation sequence.

Remarks:
This class defines the interface for a sequence of animation, whether that be animation of a mesh, a path along a spline, or possibly more than one type of animation in one. An animation is made up of many 'tracks', which are the more specific types of animation.

You should not create these animations directly. They will be created via a parent object which owns the animation, e.g. Skeleton.

Definition at line 45 of file OgreAnimation.h.


Member Typedef Documentation

typedef ConstMapIterator<TrackList> Ogre::Animation::TrackIterator
 

Definition at line 193 of file OgreAnimation.h.

typedef std::map<unsigned short, AnimationTrack*> Ogre::Animation::TrackList
 

Definition at line 192 of file OgreAnimation.h.


Member Enumeration Documentation

enum Ogre::Animation::InterpolationMode
 

The types of animation interpolation available.

Enumeration values:
IM_LINEAR  Values are interpolated along straight lines.
IM_SPLINE  Values are interpolated along a spline, resulting in smoother changes in direction.

Definition at line 50 of file OgreAnimation.h.

enum Ogre::Animation::RotationInterpolationMode
 

The types of rotational interpolation available.

Enumeration values:
RIM_LINEAR  Values are interpolated linearly.

This is faster but does not necessarily give a completely accurate result.

RIM_SPHERICAL  Values are interpolated spherically.

This is more accurate but has a higher cost.

Definition at line 59 of file OgreAnimation.h.


Constructor & Destructor Documentation

Ogre::Animation::Animation const String   name,
Real    length
 

You should not use this constructor directly, use the parent object such as Skeleton instead.

Parameters:
name  The name of the animation, should be unique within it's parent (e.g. Skeleton)
length  The length of the animation in seconds.

Definition at line 39 of file OgreAnimation.cpp.

References mInterpolationMode, mRotationInterpolationMode, Ogre::Real, and Ogre::String.

Ogre::Animation::~Animation   [virtual]
 

Definition at line 45 of file OgreAnimation.cpp.

References destroyAllTracks().


Member Function Documentation

const Animation::TrackList & Ogre::Animation::_getTrackList void    const
 

Fast access to NON-UPDATEABLE track list.

Definition at line 162 of file OgreAnimation.cpp.

References mTrackList.

Referenced by Ogre::SceneManager::_applySceneAnimations().

void Ogre::Animation::apply Skeleton   skeleton,
Real    timePos,
Real    weight = 1.0,
bool    accumulate = false
 

Applies an animation given a specific time point and weight to a given skeleton.

Remarks:
Where you have associated animation tracks with Node objects, you can eaily apply an animation to those nodes by calling this method.
Parameters:
timePos  The time position in the animation to apply.
weight  The influence to give to this track, 1.0 for full influence, less to blend with other animations.

Definition at line 129 of file OgreAnimation.cpp.

References Ogre::Skeleton::getBone(), mTrackList, and Ogre::Real.

void Ogre::Animation::apply Real    timePos,
Real    weight = 1.0,
bool    accumulate = false
 

Applies an animation given a specific time point and weight.

Remarks:
Where you have associated animation tracks with Node objects, you can eaily apply an animation to those nodes by calling this method.
Parameters:
timePos  The time position in the animation to apply.
weight  The influence to give to this track, 1.0 for full influence, less to blend with other animations.

Definition at line 118 of file OgreAnimation.cpp.

References mTrackList, and Ogre::Real.

Referenced by Ogre::SceneManager::_applySceneAnimations(), and Ogre::Skeleton::setAnimationState().

AnimationTrack * Ogre::Animation::createTrack unsigned short    handle,
Node   node
 

Creates a new AnimationTrack automatically associated with a Node.

Remarks:
This method creates a standard AnimationTrack, but also associates it with a target Node which will receive all keyframe effects.
Parameters:
handle  Numeric handle to give the track, used for accessing the track later. Must be unique within this Animation.
node  A pointer to the Node object which will be affected by this track

Definition at line 65 of file OgreAnimation.cpp.

References createTrack(), and Ogre::AnimationTrack::setAssociatedNode().

AnimationTrack * Ogre::Animation::createTrack unsigned short    handle
 

Creates an AnimationTrack.

Parameters:
handle  Numeric handle to give the track, used for accessing the track later. Must be unique within this Animation.

Definition at line 55 of file OgreAnimation.cpp.

References mTrackList.

Referenced by createTrack(), and Ogre::SkeletonSerializer::readAnimationTrack().

void Ogre::Animation::destroyAllTracks void   
 

Removes and destroys all tracks making up this animation.

Definition at line 103 of file OgreAnimation.cpp.

References mTrackList.

Referenced by ~Animation().

void Ogre::Animation::destroyTrack unsigned short    handle
 

Destroys the track with the given handle.

Definition at line 94 of file OgreAnimation.cpp.

References mTrackList.

Animation::InterpolationMode Ogre::Animation::getDefaultInterpolationMode void    [static]
 

Gets the default interpolation mode for all animations.

Definition at line 157 of file OgreAnimation.cpp.

References msDefaultInterpolationMode.

Animation::RotationInterpolationMode Ogre::Animation::getDefaultRotationInterpolationMode void    [static]
 

Gets the default rotation interpolation mode for all animations.

Definition at line 183 of file OgreAnimation.cpp.

References msDefaultRotationInterpolationMode.

Animation::InterpolationMode Ogre::Animation::getInterpolationMode void    const
 

Gets the current interpolation mode of this animation.

Remarks:
See setInterpolationMode for more info.

Definition at line 147 of file OgreAnimation.cpp.

References mInterpolationMode.

Referenced by Ogre::AnimationTrack::getInterpolatedKeyFrame().

Real Ogre::Animation::getLength void    const
 

Gets the total length of the animation.

Definition at line 50 of file OgreAnimation.cpp.

References mLength, and Ogre::Real.

Referenced by Ogre::Skeleton::_dumpContents(), Ogre::Skeleton::_initAnimationState(), Ogre::SceneManager::createAnimationState(), Ogre::AnimationTrack::getKeyFramesAtTime(), and Ogre::SkeletonSerializer::writeAnimation().

const String & Ogre::Animation::getName void    const
 

Gets the name of this animation.

Definition at line 113 of file OgreAnimation.cpp.

References mName, and Ogre::String.

Referenced by Ogre::Skeleton::_dumpContents(), Ogre::Skeleton::_initAnimationState(), Ogre::SkeletonSerializer::calcAnimationSize(), Ogre::SkeletonSerializer::exportSkeleton(), and Ogre::SkeletonSerializer::writeAnimation().

unsigned short Ogre::Animation::getNumTracks void    const
 

Gets the number of AnimationTrack objects which make up this animation.

Definition at line 74 of file OgreAnimation.cpp.

References mTrackList.

Referenced by Ogre::Skeleton::_dumpContents(), and Ogre::SkeletonSerializer::calcAnimationSize().

Animation::RotationInterpolationMode Ogre::Animation::getRotationInterpolationMode void    const
 

Gets the current rotation interpolation mode of this animation.

Remarks:
See setRotationInterpolationMode for more info.

Definition at line 173 of file OgreAnimation.cpp.

References mRotationInterpolationMode.

Referenced by Ogre::AnimationTrack::applyToNode(), and Ogre::AnimationTrack::getInterpolatedKeyFrame().

AnimationTrack * Ogre::Animation::getTrack unsigned short    handle const
 

Gets a track by it's handle.

Definition at line 79 of file OgreAnimation.cpp.

References Except, and mTrackList.

Referenced by Ogre::Skeleton::_dumpContents(), and Ogre::SkeletonSerializer::calcAnimationSize().

TrackIterator Ogre::Animation::getTrackIterator void    const
 

Get non-updateable iterator over tracks.

Definition at line 199 of file OgreAnimation.h.

Referenced by Ogre::SkeletonSerializer::writeAnimation().

void Ogre::Animation::setDefaultInterpolationMode InterpolationMode    im [static]
 

Sets the default animation interpolation mode.

Remarks:
Every animation created after this option is set will have the new interpolation mode specified. You can also change the mode per animation by calling the setInterpolationMode method on the instance in question.

Definition at line 152 of file OgreAnimation.cpp.

References msDefaultInterpolationMode.

void Ogre::Animation::setDefaultRotationInterpolationMode RotationInterpolationMode    im [static]
 

Sets the default rotation interpolation mode.

Remarks:
Every animation created after this option is set will have the new interpolation mode specified. You can also change the mode per animation by calling the setInterpolationMode method on the instance in question.

Definition at line 178 of file OgreAnimation.cpp.

References msDefaultRotationInterpolationMode.

void Ogre::Animation::setInterpolationMode InterpolationMode    im
 

Tells the animation how to interpolate between keyframes.

Remarks:
By default, animations normally interpolate linearly between keyframes. This is fast, but when animations include quick changes in direction it can look a little unnatural because directions change instantly at keyframes. An alternative is to tell the animation to interpolate along a spline, which is more expensive in terms of calculation time, but looks smoother because major changes in direction are distributed around the keyframes rather than just at the keyframe.

You can also change the default animation behaviour by calling Animation::setDefaultInterpolationMode.

Definition at line 142 of file OgreAnimation.cpp.

References mInterpolationMode.

void Ogre::Animation::setRotationInterpolationMode RotationInterpolationMode    im
 

Tells the animation how to interpolate rotations.

Remarks:
By default, animations interpolate lieanrly between rotations. This is fast but not necessarily completely accurate. If you want more accurate interpolation, use spherical interpolation, but be aware that it will incur a higher cost.

You can also change the default rotation behaviour by calling Animation::setDefaultRotationInterpolationMode.

Definition at line 168 of file OgreAnimation.cpp.

References mRotationInterpolationMode.


Member Data Documentation

InterpolationMode Ogre::Animation::mInterpolationMode [protected]
 

Definition at line 212 of file OgreAnimation.h.

Referenced by Animation(), getInterpolationMode(), and setInterpolationMode().

Real Ogre::Animation::mLength [protected]
 

Definition at line 210 of file OgreAnimation.h.

Referenced by getLength().

String Ogre::Animation::mName [protected]
 

Definition at line 208 of file OgreAnimation.h.

Referenced by getName().

RotationInterpolationMode Ogre::Animation::mRotationInterpolationMode [protected]
 

Definition at line 213 of file OgreAnimation.h.

Referenced by Animation(), getRotationInterpolationMode(), and setRotationInterpolationMode().

Animation::InterpolationMode Ogre::Animation::msDefaultInterpolationMode = Animation::IM_LINEAR [static, protected]
 

Definition at line 35 of file OgreAnimation.cpp.

Referenced by getDefaultInterpolationMode(), and setDefaultInterpolationMode().

Animation::RotationInterpolationMode Ogre::Animation::msDefaultRotationInterpolationMode = Animation::RIM_LINEAR [static, protected]
 

Definition at line 37 of file OgreAnimation.cpp.

Referenced by getDefaultRotationInterpolationMode(), and setDefaultRotationInterpolationMode().

TrackList Ogre::Animation::mTrackList [protected]
 

Tracks, indexed by handle.

Definition at line 207 of file OgreAnimation.h.

Referenced by _getTrackList(), apply(), createTrack(), destroyAllTracks(), destroyTrack(), getNumTracks(), and getTrack().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:50:46 2004