V-ART
|
Animations. Transformations acting through time. Abstract class. More...
#include <baseaction.h>
Classes | |
class | Initializer |
Action Initializer. More... | |
Public Member Functions | |
BaseAction () | |
Creates an action with sane defaults. More... | |
virtual | ~BaseAction () |
void | SetSpeed (float newSpeed) |
void | SetDuration (float seconds) |
void | SetCyclic (bool value) |
bool | IsCyclic () |
bool | IsActive () const |
void | Deactivate (float seconds) |
Mark for auto deactivation in given time. More... | |
virtual void | Deactivate () |
Deactivate now. More... | |
virtual void | Activate () |
Activates the action. More... | |
Static Public Member Functions | |
static unsigned int | MoveAllActive () |
Moves all active actions. More... | |
Public Attributes | |
std::string | description |
CallBack * | callbackPtr |
Termination callback. More... | |
Protected Member Functions | |
virtual void | Move ()=0 |
Make the action update its targets. More... | |
virtual void | ComputePositionIndex (bool *cycled) |
Computes current position index. More... | |
Protected Attributes | |
bool | cyclic |
Whether the action restarts upon termination. More... | |
bool | active |
Whether the action is currently active (changing its target). More... | |
float | speedModifier |
Speed modifier. More... | |
float | duration |
Duration in seconds. More... | |
float | timeToLive |
Time (in seconds) to auto deactivate. More... | |
float | positionIndex |
Current position index. More... | |
float | lastPositionIndex |
Position index of last update. More... | |
Time | lastUpdateTime |
Time of last update. More... | |
Static Protected Attributes | |
static std::list< BaseAction * > | activeInstances |
List of active actions. More... | |
static std::list< Initializer * > | initializers |
List of action initializers. More... | |
Animations. Transformations acting through time. Abstract class.
Actions can be seen as animations. BaseAction is an abstract class providing the interface for all kinds of actions. In order to use actions, the programmer creates action objects from derived classes such as TranslationAction; activates them and finally calls BaseAction::MoveAllActive() before each rendering iteration.
Definition at line 21 of file baseaction.h.
VART::BaseAction::BaseAction | ( | ) |
Creates an action with sane defaults.
Speed is initialized to 1 (normal speed); action is not cyclic; time to live is huge.
Definition at line 17 of file baseaction.cpp.
|
inlinevirtual |
Definition at line 34 of file baseaction.h.
|
virtual |
Activates the action.
Once an action becomes active, calls to MoveAllActive() will make it update its target.
Reimplemented in VART::JointAction.
Definition at line 59 of file baseaction.cpp.
|
protectedvirtual |
Computes current position index.
cycled | [out] indicates whether index has started over |
Before updating its target at Move(), an action should compute its current positionIndex using this method. This method will deactivate the action if it is finished.
Definition at line 100 of file baseaction.cpp.
References VART::Time::NOW().
void VART::BaseAction::Deactivate | ( | float | seconds | ) |
Mark for auto deactivation in given time.
Definition at line 53 of file baseaction.cpp.
|
virtual |
Deactivate now.
Definition at line 23 of file baseaction.cpp.
|
inline |
Definition at line 40 of file baseaction.h.
References active.
|
inline |
Definition at line 39 of file baseaction.h.
References cyclic.
|
protectedpure virtual |
Make the action update its targets.
Move is to be called from MoveAllActive.
Implemented in VART::JointAction, VART::TranslationAction, VART::RotationAction, VART::ScaleAction, VART::ShearAction, and VART::TransformAction.
|
static |
Moves all active actions.
Definition at line 74 of file baseaction.cpp.
|
inline |
Definition at line 38 of file baseaction.h.
References cyclic.
|
inline |
Definition at line 37 of file baseaction.h.
References duration.
|
inline |
Definition at line 36 of file baseaction.h.
References speedModifier.
|
protected |
Whether the action is currently active (changing its target).
Definition at line 99 of file baseaction.h.
Referenced by IsActive().
|
staticprotected |
List of active actions.
Definition at line 90 of file baseaction.h.
CallBack* VART::BaseAction::callbackPtr |
Termination callback.
Definition at line 57 of file baseaction.h.
|
protected |
Whether the action restarts upon termination.
Definition at line 96 of file baseaction.h.
Referenced by IsCyclic(), and SetCyclic().
std::string VART::BaseAction::description |
Definition at line 54 of file baseaction.h.
|
protected |
Duration in seconds.
The duration is how much time (in seconds) the action takes from start to finish. Actual playback is modified the speed modifier.
Definition at line 112 of file baseaction.h.
Referenced by SetDuration().
|
staticprotected |
List of action initializers.
Definition at line 93 of file baseaction.h.
|
protected |
Position index of last update.
The position index is a number between 0 and 1 that reflects the current progress of the action.
Definition at line 127 of file baseaction.h.
|
protected |
Time of last update.
Definition at line 130 of file baseaction.h.
|
protected |
Current position index.
The position index is a number between 0 and 1 that reflects the current progress of the action.
Definition at line 121 of file baseaction.h.
|
protected |
Speed modifier.
The speed modifier is a speed multiplicator that changes how fast an action develops. Like a playback speed. A speed modifier of 2 indicates the action is twice as fast as originally created.
Definition at line 106 of file baseaction.h.
Referenced by SetSpeed().
|
protected |
Time (in seconds) to auto deactivate.
Definition at line 115 of file baseaction.h.