OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
An animation sequence. More...
#include <OgreAnimation.h>
Public Types | |
enum | InterpolationMode : uint8 { IM_LINEAR , IM_SPLINE } |
The types of animation interpolation available. More... | |
typedef ConstMapIterator< NodeTrackList > | NodeTrackIterator |
typedef std::map< unsigned short, NodeAnimationTrack * > | NodeTrackList |
typedef ConstMapIterator< NumericTrackList > | NumericTrackIterator |
typedef std::map< unsigned short, NumericAnimationTrack * > | NumericTrackList |
enum | RotationInterpolationMode : uint8 { RIM_LINEAR , RIM_SPHERICAL } |
The types of rotational interpolation available. More... | |
typedef std::set< ushort > | TrackHandleList |
A list of track handles. | |
typedef ConstMapIterator< VertexTrackList > | VertexTrackIterator |
typedef std::map< unsigned short, VertexAnimationTrack * > | VertexTrackList |
Public Member Functions | |
Animation (const String &name, Real length) | |
You should not use this constructor directly, use the parent object such as Skeleton instead. | |
virtual | ~Animation () |
void | _applyBaseKeyFrame () |
Internal method to adjust keyframes relative to a base keyframe (see setUseBaseKeyFrame) | |
void | _collectIdentityNodeTracks (TrackHandleList &tracks) const |
Internal method for collecting identity node tracks. | |
void | _destroyNodeTracks (const TrackHandleList &tracks) |
Internal method for destroy given node tracks. | |
const NodeTrackList & | _getNodeTrackList (void) const |
Fast access to NON-UPDATEABLE node track list. | |
const NumericTrackList & | _getNumericTrackList (void) const |
Fast access to NON-UPDATEABLE numeric track list. | |
TimeIndex | _getTimeIndex (Real timePos) const |
Internal method used to convert time position to time index object. | |
const VertexTrackList & | _getVertexTrackList (void) const |
Fast access to NON-UPDATEABLE Vertex track list. | |
void | _keyFrameListChanged (void) |
Internal method used to tell the animation that keyframe list has been changed, which may cause it to rebuild some internal data. | |
void | _notifyContainer (AnimationContainer *c) |
void | apply (Entity *entity, Real timePos, Real weight, bool software, bool hardware) |
Applies all vertex tracks given a specific time point and weight to a given entity. | |
void | apply (Real timePos, Real weight=1.0, Real scale=1.0f) |
Applies an animation given a specific time point and weight. | |
void | apply (Skeleton *skeleton, Real timePos, float weight, const AnimationState::BoneBlendMask *blendMask, Real scale) |
Applies all node tracks given a specific time point and weight to a given skeleton. | |
void | apply (Skeleton *skeleton, Real timePos, Real weight=1.0, Real scale=1.0f) |
Applies all node tracks given a specific time point and weight to a given skeleton. | |
void | applyToAnimable (const AnimableValuePtr &anim, Real timePos, Real weight=1.0, Real scale=1.0f) |
Applies all numeric tracks given a specific time point and weight to the specified animable value. | |
void | applyToNode (Node *node, Real timePos, Real weight=1.0, Real scale=1.0f) |
Applies all node tracks given a specific time point and weight to the specified node. | |
void | applyToVertexData (VertexData *data, Real timePos, float weight=1.0) |
Applies all vertex tracks given a specific time point and weight to the specified vertex data. | |
Animation * | clone (const String &newName) const |
Clone this animation. | |
NodeAnimationTrack * | createNodeTrack (unsigned short handle) |
Creates a NodeAnimationTrack for animating a Node. | |
NodeAnimationTrack * | createNodeTrack (unsigned short handle, Node *node) |
Creates a new AnimationTrack automatically associated with a Node. | |
NumericAnimationTrack * | createNumericTrack (unsigned short handle, const AnimableValuePtr &anim) |
Creates a NumericAnimationTrack and associates it with an animable. | |
VertexAnimationTrack * | createVertexTrack (unsigned short handle, VertexAnimationType animType) |
Creates a VertexAnimationTrack for animating vertex position data. | |
VertexAnimationTrack * | createVertexTrack (unsigned short handle, VertexData *data, VertexAnimationType animType) |
Creates a VertexAnimationTrack and associates it with VertexData. | |
void | destroyAllNodeTracks (void) |
Removes and destroys all tracks making up this animation. | |
void | destroyAllNumericTracks (void) |
Removes and destroys all tracks making up this animation. | |
void | destroyAllTracks (void) |
Removes and destroys all tracks making up this animation. | |
void | destroyAllVertexTracks (void) |
Removes and destroys all tracks making up this animation. | |
void | destroyNodeTrack (unsigned short handle) |
Destroys the node track with the given handle. | |
void | destroyNumericTrack (unsigned short handle) |
Destroys the numeric track with the given handle. | |
void | destroyVertexTrack (unsigned short handle) |
Destroys the Vertex track with the given handle. | |
const String & | getBaseKeyFrameAnimationName () const |
If a base keyframe is being used, the Animation that provides that keyframe. | |
Real | getBaseKeyFrameTime () const |
If a base keyframe is being used, the time of that keyframe. | |
AnimationContainer * | getContainer () |
Retrieve the container of this animation. | |
InterpolationMode | getInterpolationMode (void) const |
Gets the current interpolation mode of this animation. | |
Real | getLength (void) const |
Gets the total length of the animation. | |
const String & | getName (void) const |
Gets the name of this animation. | |
NodeAnimationTrack * | getNodeTrack (unsigned short handle) const |
Gets a node track by it's handle. | |
NodeTrackIterator | getNodeTrackIterator (void) const |
NumericAnimationTrack * | getNumericTrack (unsigned short handle) const |
Gets a numeric track by it's handle. | |
NumericTrackIterator | getNumericTrackIterator (void) const |
unsigned short | getNumNodeTracks (void) const |
Gets the number of NodeAnimationTrack objects contained in this animation. | |
unsigned short | getNumNumericTracks (void) const |
Gets the number of NumericAnimationTrack objects contained in this animation. | |
unsigned short | getNumVertexTracks (void) const |
Gets the number of VertexAnimationTrack objects contained in this animation. | |
RotationInterpolationMode | getRotationInterpolationMode (void) const |
Gets the current rotation interpolation mode of this animation. | |
bool | getUseBaseKeyFrame () const |
Whether a base keyframe is being used for this Animation. | |
VertexAnimationTrack * | getVertexTrack (unsigned short handle) const |
Gets a Vertex track by it's handle. | |
VertexTrackIterator | getVertexTrackIterator (void) const |
bool | hasNodeTrack (unsigned short handle) const |
Does a track exist with the given handle? | |
bool | hasNumericTrack (unsigned short handle) const |
Does a track exist with the given handle? | |
bool | hasVertexTrack (unsigned short handle) const |
Does a track exist with the given handle? | |
void | optimise (bool discardIdentityNodeTracks=true) |
Optimise an animation by removing unnecessary tracks and keyframes. | |
void | setInterpolationMode (InterpolationMode im) |
Tells the animation how to interpolate between keyframes. | |
void | setLength (Real len) |
Sets the length of the animation. | |
void | setRotationInterpolationMode (RotationInterpolationMode im) |
Tells the animation how to interpolate rotations. | |
void | setUseBaseKeyFrame (bool useBaseKeyFrame, Real keyframeTime=0.0f, const String &baseAnimName=BLANKSTRING) |
Sets a base keyframe which for the skeletal / pose keyframes in this animation. | |
Static Public Member Functions | |
static InterpolationMode | getDefaultInterpolationMode (void) |
Gets the default interpolation mode for all animations. | |
static RotationInterpolationMode | getDefaultRotationInterpolationMode (void) |
Gets the default rotation interpolation mode for all animations. | |
static void | setDefaultInterpolationMode (InterpolationMode im) |
Sets the default animation interpolation mode. | |
static void | setDefaultRotationInterpolationMode (RotationInterpolationMode im) |
Sets the default rotation interpolation mode. | |
An animation sequence.
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.
typedef std::set<ushort> Ogre::Animation::TrackHandleList |
A list of track handles.
|
virtual |
Sets the length of the animation.
NodeAnimationTrack * Ogre::Animation::createNodeTrack | ( | unsigned short | handle | ) |
Creates a NodeAnimationTrack for animating a Node.
handle | Handle to give the track, used for accessing the track later. Must be unique within this Animation. |
VertexAnimationTrack * Ogre::Animation::createVertexTrack | ( | unsigned short | handle, |
VertexAnimationType | animType | ||
) |
Creates a VertexAnimationTrack for animating vertex position data.
handle | Handle to give the track, used for accessing the track later. Must be unique within this Animation, and is used to identify the target. For example when applied to a Mesh, the handle must reference the index of the geometry being modified; 0 for the shared geometry, and 1+ for SubMesh geometry with the same index-1. |
animType | Either morph or pose animation, |
NodeAnimationTrack * Ogre::Animation::createNodeTrack | ( | unsigned short | handle, |
Node * | node | ||
) |
Creates a new AnimationTrack automatically associated with a Node.
This method creates a standard AnimationTrack, but also associates it with a target Node which will receive all keyframe effects.
NumericAnimationTrack * Ogre::Animation::createNumericTrack | ( | unsigned short | handle, |
const AnimableValuePtr & | anim | ||
) |
Creates a NumericAnimationTrack and associates it with an animable.
handle | Handle to give the track, used for accessing the track later. |
anim | Animable object link Must be unique within this Animation. |
VertexAnimationTrack * Ogre::Animation::createVertexTrack | ( | unsigned short | handle, |
VertexData * | data, | ||
VertexAnimationType | animType | ||
) |
Creates a VertexAnimationTrack and associates it with VertexData.
handle | Handle to give the track, used for accessing the track later. |
data | VertexData object link |
animType | The animation type Must be unique within this Animation. |
Gets the number of NodeAnimationTrack objects contained in this animation.
NodeAnimationTrack * Ogre::Animation::getNodeTrack | ( | unsigned short | handle | ) | const |
Gets a node track by it's handle.
Does a track exist with the given handle?
Gets the number of NumericAnimationTrack objects contained in this animation.
NumericAnimationTrack * Ogre::Animation::getNumericTrack | ( | unsigned short | handle | ) | const |
Gets a numeric track by it's handle.
Does a track exist with the given handle?
Gets the number of VertexAnimationTrack objects contained in this animation.
VertexAnimationTrack * Ogre::Animation::getVertexTrack | ( | unsigned short | handle | ) | const |
Gets a Vertex track by it's handle.
Does a track exist with the given handle?
Destroys the node track with the given handle.
Destroys the numeric track with the given handle.
Destroys the Vertex track with the given handle.
Removes and destroys all tracks making up this animation.
Removes and destroys all tracks making up this animation.
Removes and destroys all tracks making up this animation.
Removes and destroys all tracks making up this animation.
Applies an animation given a specific time point and weight.
Where you have associated animation tracks with objects, you can easily apply an animation to those objects by calling this method.
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. |
scale | The scale to apply to translations and scalings, useful for adapting an animation to a different size target. |
void Ogre::Animation::applyToNode | ( | Node * | node, |
Real | timePos, | ||
Real | weight = 1.0 , |
||
Real | scale = 1.0f |
||
) |
Applies all node tracks given a specific time point and weight to the specified node.
It does not consider the actual node tracks are attached to. As such, it resembles the apply method for a given skeleton (see below).
node | |
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. |
scale | The scale to apply to translations and scalings, useful for adapting an animation to a different size target. |
void Ogre::Animation::apply | ( | Skeleton * | skeleton, |
Real | timePos, | ||
Real | weight = 1.0 , |
||
Real | scale = 1.0f |
||
) |
Applies all node tracks given a specific time point and weight to a given skeleton.
Where you have associated animation tracks with Node objects, you can easily apply an animation to those nodes by calling this method.
skeleton | |
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. |
scale | The scale to apply to translations and scalings, useful for adapting an animation to a different size target. |
void Ogre::Animation::apply | ( | Skeleton * | skeleton, |
Real | timePos, | ||
float | weight, | ||
const AnimationState::BoneBlendMask * | blendMask, | ||
Real | scale | ||
) |
Applies all node tracks given a specific time point and weight to a given skeleton.
Where you have associated animation tracks with Node objects, you can easily apply an animation to those nodes by calling this method.
skeleton | |
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. |
blendMask | The influence array defining additional per bone weights. These will be modulated with the weight factor. |
scale | The scale to apply to translations and scalings, useful for adapting an animation to a different size target. |
void Ogre::Animation::apply | ( | Entity * | entity, |
Real | timePos, | ||
Real | weight, | ||
bool | software, | ||
bool | hardware | ||
) |
Applies all vertex tracks given a specific time point and weight to a given entity.
entity | The Entity to which this animation should be applied |
timePos | The time position in the animation to apply. |
weight | The weight at which the animation should be applied (only affects pose animation) |
software | Whether to populate the software morph vertex data |
hardware | Whether to populate the hardware morph vertex data |
void Ogre::Animation::applyToAnimable | ( | const AnimableValuePtr & | anim, |
Real | timePos, | ||
Real | weight = 1.0 , |
||
Real | scale = 1.0f |
||
) |
Applies all numeric tracks given a specific time point and weight to the specified animable value.
It does not applies to actual attached animable values but rather uses all tracks for a single animable value.
anim | |
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. |
scale | The scale to apply to translations and scalings, useful for adapting an animation to a different size target. |
void Ogre::Animation::applyToVertexData | ( | VertexData * | data, |
Real | timePos, | ||
float | weight = 1.0 |
||
) |
Applies all vertex tracks given a specific time point and weight to the specified vertex data.
It does not apply to the actual attached vertex data but rather uses all tracks for a given vertex data.
data | |
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. |
void Ogre::Animation::setInterpolationMode | ( | InterpolationMode | im | ) |
Tells the animation how to interpolate between keyframes.
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.
InterpolationMode Ogre::Animation::getInterpolationMode | ( | void | ) | const |
Gets the current interpolation mode of this animation.
See setInterpolationMode for more info.
void Ogre::Animation::setRotationInterpolationMode | ( | RotationInterpolationMode | im | ) |
Tells the animation how to interpolate rotations.
By default, animations interpolate linearly 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.
RotationInterpolationMode Ogre::Animation::getRotationInterpolationMode | ( | void | ) | const |
Gets the current rotation interpolation mode of this animation.
See setRotationInterpolationMode for more info.
|
static |
Sets the default animation interpolation mode.
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.
|
static |
Gets the default interpolation mode for all animations.
|
static |
Sets the default rotation interpolation mode.
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.
|
static |
Gets the default rotation interpolation mode for all animations.
const NodeTrackList & Ogre::Animation::_getNodeTrackList | ( | void | ) | const |
Fast access to NON-UPDATEABLE node track list.
|
inline |
const NumericTrackList & Ogre::Animation::_getNumericTrackList | ( | void | ) | const |
Fast access to NON-UPDATEABLE numeric track list.
|
inline |
const VertexTrackList & Ogre::Animation::_getVertexTrackList | ( | void | ) | const |
Fast access to NON-UPDATEABLE Vertex track list.
|
inline |
Optimise an animation by removing unnecessary tracks and keyframes.
When you export an animation, it is possible that certain tracks have been keyframed but actually don't include anything useful - the keyframes include no transformation. These tracks can be completely eliminated from the animation and thus speed up the animation. In addition, if several keyframes in a row have the same value, then they are just adding overhead and can be removed.
discardIdentityNodeTracks | If true, discard identity node tracks. |
void Ogre::Animation::_collectIdentityNodeTracks | ( | TrackHandleList & | tracks | ) | const |
Internal method for collecting identity node tracks.
This method remove non-identity node tracks form the track handle list.
tracks | A list of track handle of non-identity node tracks, where this method will remove non-identity node track handles. |
void Ogre::Animation::_destroyNodeTracks | ( | const TrackHandleList & | tracks | ) |
Internal method for destroy given node tracks.
Clone this animation.
Internal method used to tell the animation that keyframe list has been changed, which may cause it to rebuild some internal data.
Internal method used to convert time position to time index object.
timePos | The time position. |
void Ogre::Animation::setUseBaseKeyFrame | ( | bool | useBaseKeyFrame, |
Real | keyframeTime = 0.0f , |
||
const String & | baseAnimName = BLANKSTRING |
||
) |
Sets a base keyframe which for the skeletal / pose keyframes in this animation.
Skeletal and pose animation keyframes are expressed as deltas from a given base state. By default, that is the binding setup of the skeleton, or the object space mesh positions for pose animation. However, sometimes it is useful for animators to create animations with a different starting pose, because that's more convenient, and the animation is designed to simply be added to the existing animation state and not globally averaged with other animations (this is always the case with pose animations, but is activated for skeletal animations via ANIMBLEND_CUMULATIVE).
useBaseKeyFrame | Whether a base keyframe should be used |
keyframeTime | The time corresponding to the base keyframe, if any |
baseAnimName | Optionally a different base animation (must contain the same tracks) |
bool Ogre::Animation::getUseBaseKeyFrame | ( | ) | const |
Whether a base keyframe is being used for this Animation.
Real Ogre::Animation::getBaseKeyFrameTime | ( | ) | const |
If a base keyframe is being used, the time of that keyframe.
If a base keyframe is being used, the Animation that provides that keyframe.
void Ogre::Animation::_applyBaseKeyFrame | ( | ) |
Internal method to adjust keyframes relative to a base keyframe (see setUseBaseKeyFrame)
void Ogre::Animation::_notifyContainer | ( | AnimationContainer * | c | ) |
AnimationContainer * Ogre::Animation::getContainer | ( | ) |
Retrieve the container of this animation.