#include <spAnimationPlayback.hpp>
Public Member Functions | |
AnimationPlayback () | |
~AnimationPlayback () | |
bool | update (f32 Speed) |
bool | play (const EAnimPlaybackModes Mode, u32 FirstFrame, u32 LastFrame) |
bool | play (u32 SeqId) |
void | pause (bool IsPaused=true) |
Pauses or resumes the playback process. | |
void | stop (bool IsReset=false) |
void | setFrame (u32 Index) |
Sets the new frame index. If the new index is out of the playback range, the animation will stop. | |
void | setFirstFrame (u32 Index) |
Sets the new first frame index. If the current frame index is out of the playback range, the animation will stop. | |
void | setLastFrame (u32 Index) |
Sets the new last frame index. If the current frame index is out of the playback range, the animation will stop. | |
bool | addSequence (u32 SeqId, const EAnimPlaybackModes Mode, u32 FirstFrame, u32 LastFrame, f32 Speed=1.0f) |
bool | removeSequence (u32 SeqId) |
Removes the specified sequence. | |
void | clearSequences () |
Clears all sequences. | |
SAnimSequence | getSequence (u32 SeqId) const |
bool | playingSeq (u32 SeqId) const |
bool | playing () const |
Returns true if the animation is currently playing. | |
bool | playing (u32 MinFrame, u32 MaxFrame) const |
u32 | getFrame () const |
Returns the current frame index. | |
u32 | getNextFrame () const |
Returns the index for the next frame. | |
u32 | getFirstFrame () const |
Returns the first frame. This will be set when starting playback or with the "setFirstFrame" function. | |
u32 | getLastFrame () const |
Returns the last frame. This will be set when starting playback or with the "setLastFrame" function. | |
void | setInterpolation (f32 Interpolation) |
Sets the new frame interpolation. | |
f32 | getInterpolation () const |
Returns the current frame interpolation. | |
void | setMode (const EAnimPlaybackModes Mode) |
Sets the new playback mode. | |
EAnimPlaybackModes | getMode () const |
Returns the current playback mode. | |
void | setSpeed (f32 Speed) |
Sets the new playback speed (by default 1.0). | |
f32 | getSpeed () const |
void | setFrameCallback (const PlaybackFrameCallback &FrameCallback) |
PlaybackFrameCallback | getFrameCallback () const |
Returns the playback frame callback. By default null. | |
Static Public Member Functions | |
static bool | interpolateRange (u32 &FirstFrame, u32 &LastFrame, f32 &Interpolation) |
Animation playback class. This class only stores information about the playback, i.e. frame indices, playback- speed and mode etc. But no information about the underlying animated object.
sp::scene::AnimationPlayback::AnimationPlayback | ( | ) |
sp::scene::AnimationPlayback::~AnimationPlayback | ( | ) |
bool sp::scene::AnimationPlayback::addSequence | ( | u32 | SeqId, | |
const EAnimPlaybackModes | Mode, | |||
u32 | FirstFrame, | |||
u32 | LastFrame, | |||
f32 | Speed = 1.0f | |||
) |
Adds a new sequence. This just a memory for a limited animation sequence. Use this to store several sequences like "character moving", "weapon reloaded" etc.
void sp::scene::AnimationPlayback::clearSequences | ( | ) |
Clears all sequences.
u32 sp::scene::AnimationPlayback::getFirstFrame | ( | ) | const [inline] |
Returns the first frame. This will be set when starting playback or with the "setFirstFrame" function.
u32 sp::scene::AnimationPlayback::getFrame | ( | ) | const [inline] |
Returns the current frame index.
PlaybackFrameCallback sp::scene::AnimationPlayback::getFrameCallback | ( | ) | const [inline] |
Returns the playback frame callback. By default null.
f32 sp::scene::AnimationPlayback::getInterpolation | ( | ) | const [inline] |
Returns the current frame interpolation.
u32 sp::scene::AnimationPlayback::getLastFrame | ( | ) | const [inline] |
Returns the last frame. This will be set when starting playback or with the "setLastFrame" function.
EAnimPlaybackModes sp::scene::AnimationPlayback::getMode | ( | ) | const [inline] |
Returns the current playback mode.
u32 sp::scene::AnimationPlayback::getNextFrame | ( | ) | const [inline] |
Returns the index for the next frame.
SAnimSequence sp::scene::AnimationPlayback::getSequence | ( | u32 | SeqId | ) | const |
Returns the specified playback sequence. If the specified sequence could not be found, a default (and invalid) sequence will be returned. 'Invalid' means that the first- and last frame indices are 0.
f32 sp::scene::AnimationPlayback::getSpeed | ( | ) | const [inline] |
bool sp::scene::AnimationPlayback::interpolateRange | ( | u32 & | FirstFrame, | |
u32 & | LastFrame, | |||
f32 & | Interpolation | |||
) | [static] |
Makes an interpolation over the given range. In this case the first frame must be smaller then the last frame!
[in,out] | FirstFrame | Specifies the first frame in the range. |
[in,out] | LastFrame | Specifies the last frame in the range. |
[in,out] | Interpolation | Specifies the interpolation factor. Must be in the range [0.0 .. 1.0]. |
void sp::scene::AnimationPlayback::pause | ( | bool | IsPaused = true |
) |
Pauses or resumes the playback process.
bool sp::scene::AnimationPlayback::play | ( | const EAnimPlaybackModes | Mode, | |
u32 | FirstFrame, | |||
u32 | LastFrame | |||
) |
Plays the animation.
[in] | Mode | Specifies the animation mode. |
[in] | FirstFrame | Specifies the first animation frame. |
[in] | LastFrame | Specifies the last animation frame. |
bool sp::scene::AnimationPlayback::play | ( | u32 | SeqId | ) |
Plays the given animation sequence.
Returns true if the animation is currently playing and the current frame index is in the range [MinFrame, MaxFrame). This is equivalent to the following code:
return Playback.playing() && Playback.getFrame() >= MinFrame && Playback.getFrame() < MaxFrame;
bool sp::scene::AnimationPlayback::playing | ( | ) | const [inline] |
Returns true if the animation is currently playing.
bool sp::scene::AnimationPlayback::playingSeq | ( | u32 | SeqId | ) | const |
Returns true if the specified (and previously with the "addSequence" function added) palyback sequence is currently being played.
bool sp::scene::AnimationPlayback::removeSequence | ( | u32 | SeqId | ) |
Removes the specified sequence.
void sp::scene::AnimationPlayback::setFirstFrame | ( | u32 | Index | ) |
Sets the new first frame index. If the current frame index is out of the playback range, the animation will stop.
void sp::scene::AnimationPlayback::setFrame | ( | u32 | Index | ) |
Sets the new frame index. If the new index is out of the playback range, the animation will stop.
void sp::scene::AnimationPlayback::setFrameCallback | ( | const PlaybackFrameCallback & | FrameCallback | ) | [inline] |
Sets the playback frame callback.
void sp::scene::AnimationPlayback::setInterpolation | ( | f32 | Interpolation | ) | [inline] |
Sets the new frame interpolation.
void sp::scene::AnimationPlayback::setLastFrame | ( | u32 | Index | ) |
Sets the new last frame index. If the current frame index is out of the playback range, the animation will stop.
void sp::scene::AnimationPlayback::setMode | ( | const EAnimPlaybackModes | Mode | ) | [inline] |
Sets the new playback mode.
void sp::scene::AnimationPlayback::setSpeed | ( | f32 | Speed | ) | [inline] |
Sets the new playback speed (by default 1.0).
void sp::scene::AnimationPlayback::stop | ( | bool | IsReset = false |
) |
Stops the playback process.
[in] | IsReset | Specifies whether frame and interpolation are to be reseted. By default false. |
bool sp::scene::AnimationPlayback::update | ( | f32 | Speed | ) |
Updates the playback process with the specified interpolation speed.