xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Graphics::Aurora::AnimationChannel Class Reference

#include <animationchannel.h>

Collaboration diagram for Graphics::Aurora::AnimationChannel:
Collaboration graph
[legend]

Classes

struct  DefaultAnimation
 

Public Member Functions

 AnimationChannel (Model *model)
 
void playAnimation (const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
 Play a named animation. More...
 
void playAnimationCount (const Common::UString &anim, bool restart=true, int32 loopCount=0)
 Play a named animation a number of loop iterations. More...
 
void clearDefaultAnimations ()
 
void addDefaultAnimation (const Common::UString &name, uint8 probability)
 
void playDefaultAnimation ()
 
void manageAnimations (float dt)
 

Private Types

typedef std::list< DefaultAnimationDefaultAnimations
 

Private Member Functions

void playDefaultAnimationInternal ()
 
AnimationselectDefaultAnimation ()
 
void setCurrentAnimation (Animation *anim)
 
void makeModelNodeMap ()
 

Private Attributes

Model_model
 
Animation_currentAnimation
 The currently playing animation. More...
 
Animation_nextAnimation
 The animation that's scheduled next. More...
 
float _animationSpeed
 The speed the current animation should run at. More...
 
float _animationLength
 The time the current animation should run for. More...
 
float _animationTime
 The time the current animation has played. More...
 
float _animationLoopLength
 The length of one loop of the current animation. More...
 
float _animationLoopTime
 The time the current loop of the current animation has played. More...
 
DefaultAnimations _defaultAnimations
 
std::vector< ModelNode * > _modelNodeMap
 
Common::Semaphore _manageSem
 

Detailed Description

Definition at line 41 of file animationchannel.h.

Member Typedef Documentation

◆ DefaultAnimations

Definition at line 83 of file animationchannel.h.

Constructor & Destructor Documentation

◆ AnimationChannel()

Graphics::Aurora::AnimationChannel::AnimationChannel ( Model model)

Definition at line 36 of file animationchannel.cpp.

Member Function Documentation

◆ addDefaultAnimation()

void Graphics::Aurora::AnimationChannel::addDefaultAnimation ( const Common::UString name,
uint8  probability 
)

◆ clearDefaultAnimations()

void Graphics::Aurora::AnimationChannel::clearDefaultAnimations ( )

Definition at line 81 of file animationchannel.cpp.

References _defaultAnimations, _manageSem, Common::Semaphore::lock(), and Common::Semaphore::unlock().

Referenced by Graphics::Aurora::Model::clearDefaultAnimations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeModelNodeMap()

void Graphics::Aurora::AnimationChannel::makeModelNodeMap ( )
private

◆ manageAnimations()

void Graphics::Aurora::AnimationChannel::manageAnimations ( float  dt)

◆ playAnimation()

void Graphics::Aurora::AnimationChannel::playAnimation ( const Common::UString anim,
bool  restart = true,
float  length = 0.0f,
float  speed = 1.0f 
)

Play a named animation.

Parameters
animThe animation to play.
restartWhether to restart the animation if it's already playing.
lengthThe length in seconds the animation should play for. If 0.0f, play the animation for one full loop. If negative, loop indefinitely.
speedThe speed the animation should play at. 1.0f is normal speed.

Definition at line 48 of file animationchannel.cpp.

References _animationLength, _animationLoopLength, _animationSpeed, _animationTime, _currentAnimation, _manageSem, _model, _nextAnimation, Graphics::Aurora::Model::getAnimation(), Graphics::Aurora::Animation::getLength(), Common::Semaphore::lock(), and Common::Semaphore::unlock().

Referenced by Graphics::Aurora::Model::playAnimation(), playAnimationCount(), Engines::KotOR2::Creature::playHeadAnimation(), and Engines::KotOR::Creature::playHeadAnimation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ playAnimationCount()

void Graphics::Aurora::AnimationChannel::playAnimationCount ( const Common::UString anim,
bool  restart = true,
int32  loopCount = 0 
)

Play a named animation a number of loop iterations.

Parameters
animThe animation to play.
restartWhether to restart the animation if it's already playing.
loopCountNumber of times to loop the animation. Negative for loop indefinitely.

Definition at line 69 of file animationchannel.cpp.

References _model, Graphics::Aurora::Model::getAnimation(), Graphics::Aurora::Animation::getLength(), and playAnimation().

Here is the call graph for this function:

◆ playDefaultAnimation()

void Graphics::Aurora::AnimationChannel::playDefaultAnimation ( )

◆ playDefaultAnimationInternal()

void Graphics::Aurora::AnimationChannel::playDefaultAnimationInternal ( )
private

Definition at line 178 of file animationchannel.cpp.

References _animationLength, _animationLoopLength, _animationLoopTime, _animationSpeed, _animationTime, _currentAnimation, _nextAnimation, Graphics::Aurora::Animation::getLength(), and selectDefaultAnimation().

Referenced by manageAnimations(), and playDefaultAnimation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectDefaultAnimation()

Animation * Graphics::Aurora::AnimationChannel::selectDefaultAnimation ( )
private

Definition at line 196 of file animationchannel.cpp.

References _defaultAnimations.

Referenced by playDefaultAnimationInternal().

Here is the caller graph for this function:

◆ setCurrentAnimation()

void Graphics::Aurora::AnimationChannel::setCurrentAnimation ( Animation anim)
private

Definition at line 209 of file animationchannel.cpp.

References _animationLoopTime, _currentAnimation, Graphics::Aurora::Model::_currentState, _model, and makeModelNodeMap().

Referenced by manageAnimations().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _animationLength

float Graphics::Aurora::AnimationChannel::_animationLength
private

The time the current animation should run for.

Definition at line 89 of file animationchannel.h.

Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().

◆ _animationLoopLength

float Graphics::Aurora::AnimationChannel::_animationLoopLength
private

The length of one loop of the current animation.

Definition at line 91 of file animationchannel.h.

Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().

◆ _animationLoopTime

float Graphics::Aurora::AnimationChannel::_animationLoopTime
private

The time the current loop of the current animation has played.

Definition at line 92 of file animationchannel.h.

Referenced by manageAnimations(), playDefaultAnimationInternal(), and setCurrentAnimation().

◆ _animationSpeed

float Graphics::Aurora::AnimationChannel::_animationSpeed
private

The speed the current animation should run at.

Definition at line 88 of file animationchannel.h.

Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().

◆ _animationTime

float Graphics::Aurora::AnimationChannel::_animationTime
private

The time the current animation has played.

Definition at line 90 of file animationchannel.h.

Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().

◆ _currentAnimation

Animation* Graphics::Aurora::AnimationChannel::_currentAnimation
private

The currently playing animation.

Definition at line 86 of file animationchannel.h.

Referenced by makeModelNodeMap(), manageAnimations(), playAnimation(), playDefaultAnimationInternal(), and setCurrentAnimation().

◆ _defaultAnimations

DefaultAnimations Graphics::Aurora::AnimationChannel::_defaultAnimations
private

◆ _manageSem

Common::Semaphore Graphics::Aurora::AnimationChannel::_manageSem
private

◆ _model

Model* Graphics::Aurora::AnimationChannel::_model
private

◆ _modelNodeMap

std::vector<ModelNode *> Graphics::Aurora::AnimationChannel::_modelNodeMap
private

Definition at line 94 of file animationchannel.h.

Referenced by makeModelNodeMap(), and manageAnimations().

◆ _nextAnimation

Animation* Graphics::Aurora::AnimationChannel::_nextAnimation
private

The animation that's scheduled next.

Definition at line 87 of file animationchannel.h.

Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().


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