V-ART
action.h
Go to the documentation of this file.
1 
5 #ifndef VART_ACTION_H
6 #define VART_ACTION_H
7 
8 #include "vart/time.h"
9 #include "vart/scenenode.h"
10 #include <list>
11 #include <string>
12 
13 namespace VART {
14  class JointMover;
15  class Joint;
16  class Interpolator;
17  class CallBack;
18  class NoisyDofMover;
19  class DMModifier;
29  class Action {
30  friend std::ostream& operator<<(std::ostream& output, const Action& action);
31  public:
32  // PUBLIC METHODS
34  Action();
35 
36  ~Action();
37 
40  VART::Action& operator=(const VART::Action& action);
41 
54  JointMover* AddJointMover(Joint* jointPtr,
55  float newDuration, const Interpolator& interpolator);
56 
58  JointMover* AddJointMover(Joint* jointPtr, JointMover* jointMover);
59 
61  void SetPriority(unsigned int newPriority) { priority = newPriority; }
62 
64  void SetSpeed(float newSpeed) { speed = newSpeed; }
65 
67  void SetCyclic(bool value) { cycle = value; }
68 
70  bool IsCyclic() { return cycle; }
71 
73  void Set(float newSpeed, unsigned int newPriority, bool cyclic);
74 
76  void Activate();
77 
79  void Deactivate();
80 
82  void Deactivate(float seconds);
83 
85  bool IsActive() const { return active; }
86 
88  void GetFinalTimes(std::list<float>* resultPtr);
89 
94  VART::Action* Copy(VART::SceneNode& targetNode);
95 
97  void ModifyDofMovers(DMModifier& mod);
98  // STATIC PUBLIC METHODS
101  static unsigned int MoveAllActive();
102  // STATIC PUBLIC ATTRIBUTES
108  static float frameFrequency;
109  // PUBLIC ATTRIBUTES
111  std::string description;
114  protected:
115  // PROTECTED METHODS
117  void Move();
122  void DeactivateDofMovers();
123  // PROTECTED ATTRIBUTES
124  bool cycle;
125  bool active;
126  // FixMe: Speeds greater than 1 make a cyclic action stop between cycles!
127  // FixMe: Speeds less than 1 make a cyclic action jump between cycles!
128  float speed;
129  float duration;
130  float timeToLive;
131  unsigned int priority;
132  std::list<JointMover*> jointMoverList;
134  // STATIC PROTECTED ATTRIBUTES
135  static std::list<Action*> activeInstances;
136  private:
137  // keep programmers from creating copies of actions
138  Action(const Action& action) {}
139  float timeDiff; // how many seconds have passed since activation
140  }; // end class declaration
141 } // end namespace
142 
143 #endif
Time initialTime
Definition: action.h:133
VART::Action & operator=(const VART::Action &action)
Copy action data, except the active atribute (that remains unmodified). Used in Action::Copy() method...
Definition: action.cpp:24
Base class for objects that compose a scene graph.
Definition: scenenode.h:25
void ModifyDofMovers(DMModifier &mod)
Modifies dof movers.
Definition: action.cpp:246
Action()
Creates an unitialized action.
Definition: action.cpp:19
Representation of joints.
Definition: joint.h:34
void SetSpeed(float newSpeed)
Sets the speed of an action.
Definition: action.h:64
void Set(float newSpeed, unsigned int newPriority, bool cyclic)
Sets speed, priority and cycle attibutes.
Definition: action.cpp:45
Header file for V-ART class "Time".
A coordinated movement of joints in an articulated body.
Definition: action.h:29
static float frameFrequency
Fake animation time.
Definition: action.h:108
Header file for V-ART class "SceneNode".
bool IsActive() const
Returns true if the action is currently active.
Definition: action.h:85
void SetPriority(unsigned int newPriority)
Sets the priority of an action.
Definition: action.h:61
bool cycle
Definition: action.h:124
void GetFinalTimes(std::list< float > *resultPtr)
Returns a ordered list with all different final times for every dof mover.
Definition: action.cpp:215
std::string description
Textual description.
Definition: action.h:111
bool active
Definition: action.h:125
unsigned int priority
seconds to auto deactivation
Definition: action.h:131
float speed
Definition: action.h:128
void DeactivateDofMovers()
Deactivates DOF movers in every joint mover.
Definition: action.cpp:188
An object that modifies noisy dof movers.
Definition: dmmodifier.h:15
static std::list< Action * > activeInstances
Definition: action.h:135
Interpolator representation.
Definition: interpolator.h:17
Controllers for joint movement.
Definition: jointmover.h:22
void Move()
Animate joints.
Definition: action.cpp:70
static unsigned int MoveAllActive()
Moves all active actions.
Definition: action.cpp:195
CallBack * callbackPtr
A call-back to be activated once the action is finished/deactivated.
Definition: action.h:113
void Activate()
Activate action.
Definition: action.cpp:127
Noisy Controller for DOF movement.
Definition: noisydofmover.h:17
void Deactivate()
Deactivate action.
Definition: action.cpp:156
bool IsCyclic()
Checks whether the action is cyclic.
Definition: action.h:70
std::list< JointMover * > jointMoverList
Definition: action.h:132
VART::Action * Copy(VART::SceneNode &targetNode)
Returns a copy of an action, aplied to an targetNode sceneNode.
Definition: action.cpp:224
JointMover * AddJointMover(Joint *jointPtr, float newDuration, const Interpolator &interpolator)
Adds a joint mover to the action.
Definition: action.cpp:52
An object that is activated in a callback-like scheme.
Definition: callback.h:18
friend std::ostream & operator<<(std::ostream &output, const Action &action)
float duration
Definition: action.h:129
void SetCyclic(bool value)
Sets whether an action is cyclic.
Definition: action.h:67
float timeToLive
Definition: action.h:130
Elapsed time representation.
Definition: time.h:15