Main Page   Class Hierarchy   Compound List   File List   Compound Members  

AnimationSet Class Reference

The AnimationSet contains a set of SkeletalAnimation objects. More...

#include <AnimationSet.h>

List of all members.

Public Methods

 AnimationSet (const std::string &setName)
 Creates an initially empty AnimationSet, with no active animation.

 ~AnimationSet ()
 Destructor.

void addAnimation (const AKeysList &keys, const BoneNameSet &boneSet, Bone &rootBone, float startTime, float endTime, const std::string &animName)
 Adds an animation to this set.

void setLooping (bool looping)
 Sets the looping status of this animation.

bool isLooping () const
 Returns true if the animation is set for looping.

const std::string & getName () const
 Returns the name for this AnimationSet.

int getNumAnims () const
 Returns the number of animations in this set.

int findAnim (const std::string &animName) const
 Searches through all of the animations in this set looking for the animation with the given name.

const std::string & getAnimName (int anim) const
 Returns the name for the animation specified by the index.

int getActiveAnim () const
 Returns the index of the currently running animation, or -1 if there is no animation running.

void setActiveAnim (int anim)
 Changes the currently running animation to the given animation.

void update (float dt)
 Updates the animation by the given number of seconds.


Detailed Description

The AnimationSet contains a set of SkeletalAnimation objects.

It also contains a looping flag (set if the animation is to loop), the current time offset into the animation, and the currently active animation. It also takes update events and passes them to the active animation, which will modify the matrices of the bones to which it is attached. An exmaple of an AnimationSet would be a set of atomic animations for legs, walking, running, and standing.


Constructor & Destructor Documentation

AnimationSet::AnimationSet const std::string &    setName
 

Creates an initially empty AnimationSet, with no active animation.

Parameters:
setName  the name for this set of animations


Member Function Documentation

void AnimationSet::addAnimation const AKeysList &    keys,
const BoneNameSet &    boneSet,
Bone   rootBone,
float    startTime,
float    endTime,
const std::string &    animName
 

Adds an animation to this set.

It is intended that an AnimationSet is over the same bones, keys, and skeleton, so the keys, boneSet, and skel parameters should be the same for all added animations, but there is no technical requirement that that must be so.

The indicies of the animations are in the order as added, so the first added animation will be animation 0, the second will be animation 1, and so on.

If an animation by the name animName already exists in this AnimationSet, then a GameException is thrown. A GameException is also thrown if an error occurs while constructing the SkeletalAnimation object.

See also:
SkeletalAnimation::SkeletalAnimation

int AnimationSet::findAnim const std::string &    animName const
 

Searches through all of the animations in this set looking for the animation with the given name.

Returns -1 if the animation was not found, else returns a number x such that 0 <= x < getNumAnims(), that is the index for that animation.

const std::string & AnimationSet::getAnimName int    anim const
 

Returns the name for the animation specified by the index.

As a special case, the animIdx -1 will return the string "none", so that it is easy to use this method with getActiveAnim.

Precondition:
anim is a number -1 <= anim < getNumAnims().

void AnimationSet::setActiveAnim int    anim
 

Changes the currently running animation to the given animation.

If the given index is out of range ( <0 or >= getNumAnims ), then the active animation is unset, and no animation is active. When the animation is changed, it starts playing from the start of the animation. If you set the animation to the currently running animation, this will have the same effect as restarting the animation.

The state of the looping flag is not changed when changing animations.

void AnimationSet::setLooping bool    looping
 

Sets the looping status of this animation.

If an animation is not looping, it will play once and then stop motionless in its final configuration.

The looping flag state stays between animation changes.

void AnimationSet::update float    dt
 

Updates the animation by the given number of seconds.

This will modify the Skeleton that the animations are bound to. If there is no active animation, then calling this method has no visible effect. The value dt must be greater than or equal to 0 for proper updating.


The documentation for this class was generated from the following files:
Generated on Wed May 14 01:38:07 2003 for CG Skeletal Animation Project by doxygen1.2.18