Main Page   Class Hierarchy   Compound List   File List   Compound Members  

AnimatedModel Class Reference

The AnimatedModel class extends the functionality of the SkinnedModel class to include animations on the skeleton. More...

#include <AnimatedModel.h>

Inheritance diagram for AnimatedModel:

SkinnedModel List of all members.

Public Methods

 ~AnimatedModel ()
 Destructor.

int findSet (const std::string &setName) const
 Searches through all of the AnimationSet objects for this model looking for the set given by the specified name.

int getNumSets () const
 Returns the number of animation sets for this model.

const std::string & getSetName (int setIdx) const
 Returns the name for the animation set given by the index.

int findAnim (int setIdx, const std::string &animName) const
 Finds the animation by the name animName in the specified animation set.

int getNumAnims (int setIdx) const
 Returns the number of animations for the given set.

const std::string & getAnimName (int setIdx, int animIdx) const
 Returns the name of the specified animation in the specified set.

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

void setActiveAnim (int setIdx, int animIdx)
 Sets the currently active animation for this model.

void setLooping (int setIdx, bool looping)
 Sets the looping flag of the specified set.

bool isLooping (int setIdx) const
 Gets the looping flag of the specified set.

void update (float dt)
 Updates the animation for this model.


Detailed Description

The AnimatedModel class extends the functionality of the SkinnedModel class to include animations on the skeleton.

It is important to note that from the perspective of the program, it is the skeleton that is being animated, and not the skin or mesh. The SkinnedModel simple renders around the skeleton. Thus the AnimatedModel focuses on tying sets of animation to groups of joints in the Skeleton alone, and through the fact the skeleton is moving, the functionality in the SkinnedModel will not need to "know" about animation.

The animations for a model are split up into sets of animations. Each AnimationSet cooresponds to a logical section of the model. For example if a humanoid character was split at the waist, the two animation sets would be "torso animations" and "leg animations." There is no limit on the number of splits on a model (except that an animation set must contain at least one joint). The number of active animations in an AnimatedModel is at most equal to the number of sets it contains, since each AnimatedSet has a currently active animation. In the previous example, the humanoid character would have at most two active animations, one for the legs and one for the torso, that both operate independently.


Member Function Documentation

int AnimatedModel::findAnim int    setIdx,
const std::string &    animName
const
 

Finds the animation by the name animName in the specified animation set.

Returns an index to the animation, or -1 if no animation by that name is found.

Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()

int AnimatedModel::findSet const std::string &    setName const
 

Searches through all of the AnimationSet objects for this model looking for the set given by the specified name.

Returns an index to that set, or -1 if the set is not found.

int AnimatedModel::getActiveAnim int    setIdx const
 

Returns the index of the currently running animation for the given set, or -1 if no animation is running.

See also:
AnimationSet::getActiveAnim
Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()

const std::string & AnimatedModel::getAnimName int    setIdx,
int    animIdx
const
 

Returns the name of the specified animation in the specified set.

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

Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()
animIdx meets the requirements: -1 <= animIdx < getNumAnims(setIdx)

int AnimatedModel::getNumAnims int    setIdx const
 

Returns the number of animations for the given set.

Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()

const std::string & AnimatedModel::getSetName int    setIdx const
 

Returns the name for the animation set given by the index.

Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()

bool AnimatedModel::isLooping int    setIdx const
 

Gets the looping flag of the specified set.

Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()
See also:
AnimationSet::isLooping

void AnimatedModel::setActiveAnim int    setIdx,
int    animIdx
 

Sets the currently active animation for this model.

Each set has at most one active animation at a time. If the passed animIdx is out of range (negative numbers are always out of range), then that animation set is disabled.

Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()

void AnimatedModel::setLooping int    setIdx,
bool    looping
 

Sets the looping flag of the specified set.

Precondition:
setIdx meets the requirements: 0 <= setIdx < getNumSets()
See also:
AnimationSet::setLooping

void AnimatedModel::update float    dt
 

Updates the animation for this model.

Calling this method will result in modifying the current position of the model's skeleton based on the currently active animations.


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