xoreos
0.0.5
|
#include <animationchannel.h>
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< DefaultAnimation > | DefaultAnimations |
Private Member Functions | |
void | playDefaultAnimationInternal () |
Animation * | selectDefaultAnimation () |
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 |
Definition at line 41 of file animationchannel.h.
|
private |
Definition at line 83 of file animationchannel.h.
Graphics::Aurora::AnimationChannel::AnimationChannel | ( | Model * | model | ) |
Definition at line 36 of file animationchannel.cpp.
void Graphics::Aurora::AnimationChannel::addDefaultAnimation | ( | const Common::UString & | name, |
uint8 | probability | ||
) |
Definition at line 87 of file animationchannel.cpp.
References _defaultAnimations, _manageSem, _model, Graphics::Aurora::AnimationChannel::DefaultAnimation::animation, Graphics::Aurora::Model::getAnimation(), Common::Semaphore::lock(), Graphics::Aurora::AnimationChannel::DefaultAnimation::probability, and Common::Semaphore::unlock().
Referenced by Graphics::Aurora::Model::addDefaultAnimation().
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().
|
private |
Definition at line 220 of file animationchannel.cpp.
References Graphics::Aurora::Model::_attachedModels, _currentAnimation, Graphics::Aurora::Model::_currentState, _model, _modelNodeMap, Graphics::Aurora::Model::_superModel, Graphics::Aurora::ModelNode::getName(), Graphics::Aurora::Model::getNode(), Graphics::Aurora::ModelNode::getNodeNumber(), Graphics::Aurora::Animation::getNodes(), and Graphics::Aurora::Model::State::nodeMap.
Referenced by setCurrentAnimation().
void Graphics::Aurora::AnimationChannel::manageAnimations | ( | float | dt | ) |
Definition at line 107 of file animationchannel.cpp.
References _animationLength, _animationLoopLength, _animationLoopTime, _animationSpeed, _animationTime, _currentAnimation, _manageSem, _model, _modelNodeMap, _nextAnimation, Graphics::Aurora::Model::createBound(), Common::Semaphore::lock(), playDefaultAnimationInternal(), setCurrentAnimation(), Common::Semaphore::unlock(), and Graphics::Aurora::Animation::update().
void Graphics::Aurora::AnimationChannel::playAnimation | ( | const Common::UString & | anim, |
bool | restart = true , |
||
float | length = 0.0f , |
||
float | speed = 1.0f |
||
) |
Play a named animation.
anim | The animation to play. |
restart | Whether to restart the animation if it's already playing. |
length | The length in seconds the animation should play for. If 0.0f, play the animation for one full loop. If negative, loop indefinitely. |
speed | The 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().
void Graphics::Aurora::AnimationChannel::playAnimationCount | ( | const Common::UString & | anim, |
bool | restart = true , |
||
int32 | loopCount = 0 |
||
) |
Play a named animation a number of loop iterations.
anim | The animation to play. |
restart | Whether to restart the animation if it's already playing. |
loopCount | Number 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().
void Graphics::Aurora::AnimationChannel::playDefaultAnimation | ( | ) |
Definition at line 101 of file animationchannel.cpp.
References _manageSem, Common::Semaphore::lock(), playDefaultAnimationInternal(), and Common::Semaphore::unlock().
Referenced by Graphics::Aurora::Model::playDefaultAnimation(), Engines::KotOR2::Creature::playDefaultHeadAnimation(), and Engines::KotOR::Creature::playDefaultHeadAnimation().
|
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().
|
private |
Definition at line 196 of file animationchannel.cpp.
References _defaultAnimations.
Referenced by playDefaultAnimationInternal().
|
private |
Definition at line 209 of file animationchannel.cpp.
References _animationLoopTime, _currentAnimation, Graphics::Aurora::Model::_currentState, _model, and makeModelNodeMap().
Referenced by manageAnimations().
|
private |
The time the current animation should run for.
Definition at line 89 of file animationchannel.h.
Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().
|
private |
The length of one loop of the current animation.
Definition at line 91 of file animationchannel.h.
Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().
|
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().
|
private |
The speed the current animation should run at.
Definition at line 88 of file animationchannel.h.
Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().
|
private |
The time the current animation has played.
Definition at line 90 of file animationchannel.h.
Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().
|
private |
The currently playing animation.
Definition at line 86 of file animationchannel.h.
Referenced by makeModelNodeMap(), manageAnimations(), playAnimation(), playDefaultAnimationInternal(), and setCurrentAnimation().
|
private |
Definition at line 93 of file animationchannel.h.
Referenced by addDefaultAnimation(), clearDefaultAnimations(), and selectDefaultAnimation().
|
private |
Definition at line 95 of file animationchannel.h.
Referenced by addDefaultAnimation(), clearDefaultAnimations(), manageAnimations(), playAnimation(), and playDefaultAnimation().
|
private |
Definition at line 85 of file animationchannel.h.
Referenced by addDefaultAnimation(), makeModelNodeMap(), manageAnimations(), playAnimation(), playAnimationCount(), and setCurrentAnimation().
|
private |
Definition at line 94 of file animationchannel.h.
Referenced by makeModelNodeMap(), and manageAnimations().
|
private |
The animation that's scheduled next.
Definition at line 87 of file animationchannel.h.
Referenced by manageAnimations(), playAnimation(), and playDefaultAnimationInternal().