Wasabi
|
#include <WAnimation.hpp>
Public Member Functions | |
virtual std::string | GetTypeName () const override |
virtual void | SetID (uint32_t newID) override |
virtual void | SetName (std::string newName) override |
WAnimation (class Wasabi *const app, uint32_t ID=0) | |
virtual void | Update (float fDeltaTime) |
virtual class WImage * | GetTexture () const =0 |
virtual void | AddSubAnimation () |
virtual void | RemoveSubAnimation (uint32_t index) |
WError | SetKeyFrameTime (uint32_t frame, float fTime) |
void | SetPlaySpeed (float fSpeedMultiplier, uint32_t subAnimation=-1) |
void | SetCurrentFrame (uint32_t frame, uint32_t subAnimation=0) |
void | SetCurrentTime (float fTime, uint32_t subAnimation=0) |
void | SetPlayingBounds (uint32_t startFrame, uint32_t endFrame, uint32_t subAnimation=0) |
void | SetPlayingBounds_Time (float fStartTime, float fEndTime, uint32_t subAnimation=0) |
void | Play (uint32_t subAnimation=-1) |
void | Loop (uint32_t subAnimation=-1) |
void | Stop (uint32_t subAnimation=-1) |
void | Reset (uint32_t subAnimation=-1) |
bool | Playing (uint32_t subAnimation=0) const |
bool | Looping (uint32_t subAnimation=0) const |
float | GetTime (uint32_t subAnimation=0) const |
virtual WError | CopyFrom (const WAnimation *const from)=0 |
virtual WError | UseAnimationFrames (const WAnimation *const anim)=0 |
![]() | |
WFileAsset (class Wasabi *const app, uint32_t ID=0) | |
virtual WError | SaveToStream (class WFile *file, std::ostream &outputStream)=0 |
virtual WError | LoadFromStream (class WFile *file, std::istream &inputStream, vector< void * > &args, std::string nameSuffix)=0 |
![]() | |
WBase (class Wasabi *const app, uint32_t ID=0) | |
uint32_t | GetID () const |
std::string | GetName () const |
class Wasabi * | GetAppPtr () const |
void | AddReference () |
void | RemoveReference () |
virtual bool | Valid () const =0 |
Static Public Member Functions | |
static std::string | _GetTypeName () |
Protected Member Functions | |
void | m_UpdateFirstFrame (uint32_t subAnimation=-1) |
Protected Attributes | |
bool | m_bFramesOwner |
float | m_totalTime |
vector< W_FRAME * > | m_frames |
vector< W_SUB_ANIMATION * > | m_subAnimations |
![]() | |
class Wasabi * | m_app |
uint32_t | m_ID |
std::string | m_name |
This is an abstract base class that represents an animation which could be attached to an object. This base class is responsible for maintaining subanimations and managing their playing and looping.
|
static |
Returns "Animation" string.
|
virtual |
Appends a subanimation to this animation.
Reimplemented in WSkeleton.
|
pure virtual |
Copies another WAnimation. This function is specific to the implementation.
from | Animation to copy from |
Implemented in WSkeleton.
|
pure virtual |
Retrieves the texture that corresponds to the animation. This depends on the implementation. For example, a skeletal animation implementation may return a texture that contains bone matrices encoded in its pixels.
Implemented in WSkeleton.
float WAnimation::GetTime | ( | uint32_t | subAnimation = 0 | ) | const |
Retrieves the current time in the subanimation.
subAnimation | subanimation to check |
|
overridevirtual |
This function must be implemented by a child class. This is used for debugging, in which a class should return its name.
Implements WBase.
void WAnimation::Loop | ( | uint32_t | subAnimation = -1 | ) |
Starts looping the subanimation.
subAnimation | subanimation to loop, -1 for all subanimations |
bool WAnimation::Looping | ( | uint32_t | subAnimation = 0 | ) | const |
Whether or not the subanimation is looping.
subAnimation | subanimation to check |
|
protected |
Updates W_SUB_ANIMATION::firstFrame for the given subanimation to match its' W_SUB_ANIMATION::fPlayStartTime.
subAnimation | subanimation to update, -1 to update all subanimations |
void WAnimation::Play | ( | uint32_t | subAnimation = -1 | ) |
Starts playing the subanimation.
subAnimation | subanimation to play, -1 for all subanimations |
bool WAnimation::Playing | ( | uint32_t | subAnimation = 0 | ) | const |
Whether or not the subanimation is playing (or looping).
subAnimation | subanimation to check |
|
virtual |
Removes a subanimation from this animation. Subanimation at index 0 cannot be removed.
index | The index of the subanimation to remove |
void WAnimation::Reset | ( | uint32_t | subAnimation = -1 | ) |
Resets the subanimation by setting its current time and frame to the beginning of the boundaries set for it (Set boundaries using SetPlayingBounds and SetPlayingBounds_Time).
subAnimation | subanimation to reset, -1 for all subanimations |
void WAnimation::SetCurrentFrame | ( | uint32_t | frame, |
uint32_t | subAnimation = 0 |
||
) |
Immediately sets the current frame in the subanimation.
frame | The frame index to go to |
subAnimation | The subanimation to set its frame, -1 for all subanimations |
void WAnimation::SetCurrentTime | ( | float | fTime, |
uint32_t | subAnimation = 0 |
||
) |
Immediately sets the current time in the subanimation.
fTime | The time to set the subanimation to |
subAnimation | The subanimation to set its time, -1 for all subanimations |
|
overridevirtual |
WError WAnimation::SetKeyFrameTime | ( | uint32_t | frame, |
float | fTime | ||
) |
Sets the time interval for a keyframe in the animation frames.
frame | Frame index |
fTime | Time to set for the frame |
|
overridevirtual |
void WAnimation::SetPlayingBounds | ( | uint32_t | startFrame, |
uint32_t | endFrame, | ||
uint32_t | subAnimation = 0 |
||
) |
Sets the range in which the subanimation can loop.
startFrame | The first frame to start looping |
endFrame | The last frame for the loop |
subAnimation | The subanimation to set its boundaries, -1 for all subanimations |
void WAnimation::SetPlayingBounds_Time | ( | float | fStartTime, |
float | fEndTime, | ||
uint32_t | subAnimation = 0 |
||
) |
Sets the range in which the subanimation can loop.
fStartTime | The time at which looping begins |
fEndTime | The time at which the loop restarts |
subAnimation | The subanimation to set its boundaries, -1 for all subanimations |
void WAnimation::SetPlaySpeed | ( | float | fSpeedMultiplier, |
uint32_t | subAnimation = -1 |
||
) |
Sets the play speed multiplier for the selected subanimation.
fSpeedMultiplier | Speed multiplier |
subAnimation | subanimation index, -1 will set the speed for all subanimations |
void WAnimation::Stop | ( | uint32_t | subAnimation = -1 | ) |
Stops playing (and looping) the subanimation.
subAnimation | subanimation to stop, -1 for all subanimations |
|
virtual |
Steps the state of the playing (or looping) subanimations forward. This is usually called by the engine during normal execution each frame.
fDeltaTime | step time in seconds |
Reimplemented in WSkeleton.
|
pure virtual |
Use the animation frames of another animation object. This should be more efficient than copying in time and memory usage. This function depends on the implementation.
anim | Animation to use its frames |
Implemented in WSkeleton.
|
protected |
true if this object owns the frames in m_frames, and can thus free them. The owner of the frames is the one who allocated them.
|
protected |
The frames of this animation
|
protected |
The subanimations of this animation
|
protected |
Total time of all the frames