V-ART
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
VART::BaseAction Class Referenceabstract

Animations. Transformations acting through time. Abstract class. More...

#include <baseaction.h>

Inheritance diagram for VART::BaseAction:
VART::JointAction VART::TransformAction VART::XmlJointAction VART::RotationAction VART::ScaleAction VART::ShearAction VART::TranslationAction

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
 
CallBackcallbackPtr
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

virtual VART::BaseAction::~BaseAction ( )
inlinevirtual

Definition at line 34 of file baseaction.h.

Member Function Documentation

void VART::BaseAction::Activate ( )
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.

void VART::BaseAction::ComputePositionIndex ( bool *  cycled)
protectedvirtual

Computes current position index.

Parameters
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.

void VART::BaseAction::Deactivate ( )
virtual

Deactivate now.

Definition at line 23 of file baseaction.cpp.

bool VART::BaseAction::IsActive ( ) const
inline

Definition at line 40 of file baseaction.h.

References active.

bool VART::BaseAction::IsCyclic ( )
inline

Definition at line 39 of file baseaction.h.

References cyclic.

virtual void VART::BaseAction::Move ( )
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.

unsigned int VART::BaseAction::MoveAllActive ( )
static

Moves all active actions.

Returns
The number of active actions.

Definition at line 74 of file baseaction.cpp.

void VART::BaseAction::SetCyclic ( bool  value)
inline

Definition at line 38 of file baseaction.h.

References cyclic.

void VART::BaseAction::SetDuration ( float  seconds)
inline

Definition at line 37 of file baseaction.h.

References duration.

void VART::BaseAction::SetSpeed ( float  newSpeed)
inline

Definition at line 36 of file baseaction.h.

References speedModifier.

Member Data Documentation

bool VART::BaseAction::active
protected

Whether the action is currently active (changing its target).

Definition at line 99 of file baseaction.h.

Referenced by IsActive().

list< VART::BaseAction * > VART::BaseAction::activeInstances
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.

bool VART::BaseAction::cyclic
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.

float VART::BaseAction::duration
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().

list< VART::BaseAction::Initializer * > VART::BaseAction::initializers
staticprotected

List of action initializers.

Definition at line 93 of file baseaction.h.

float VART::BaseAction::lastPositionIndex
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.

Time VART::BaseAction::lastUpdateTime
protected

Time of last update.

Definition at line 130 of file baseaction.h.

float VART::BaseAction::positionIndex
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.

float VART::BaseAction::speedModifier
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().

float VART::BaseAction::timeToLive
protected

Time (in seconds) to auto deactivate.

Definition at line 115 of file baseaction.h.


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