Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/simple_animation.h @ 3728

Last change on this file since 3728 was 3727, checked in by patrick, 21 years ago

orxonox/trunk: added a third debug level, made SimpleAnimation singleton and restructured it to be more opengl command style

File size: 2.2 KB
Line 
1/*!
2    \file simple_animation.h
3    \brief A class to interpolate the movement of an object following descrete points in room and time
4    \todo implement it
5
6    This class has been done to animate some movement, works best for short
7    distances.
8*/
9
10#ifndef _SIMPLE_ANIMATION_H
11#define _SIMPLE_ANIMATION_H
12
13#include "base_object.h"
14#include "list.h"
15
16
17class Vector;
18class Quaternion;
19class WorldEntity;
20class PNode;
21
22typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
23#define DEFAULT_ANIMATION_MODE LINEAR
24
25//! KeyFrame Struct
26/**
27   This represents one point with orientation of the animation
28*/
29typedef struct KeyFrame {
30  Vector* position;
31  Quaternion* orientation;
32  WorldEntity* object;
33  float time;
34  movementMode mode;
35};
36
37
38//! Animation Class
39/**
40   Helps you making some small animation
41*/
42class SimpleAnimation : public BaseObject {
43 
44 public:
45  static SimpleAnimation* getInstance();
46
47  void AnimatorBegin();
48  void AnimatorEnd();
49  void selectObject(WorldEntity* entity);
50  void addKeyFrame(Vector* point, Quaternion* orientation, float time);
51  void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
52  void addKeyFrame(KeyFrame* frame);
53  void reset();
54
55
56  void start();
57  void stop();
58  void restart();
59  void pause();
60  void resume();
61
62  void tick(float time);
63
64 private:
65  SimpleAnimation();
66  virtual ~SimpleAnimation();
67
68  static SimpleAnimation* singletonRef;
69  bool bRunning;                   //<! is set, when the animation is running
70  tList<KeyFrame>* frames;         //<! where keyframes are stored in
71  KeyFrame* currentFrame;          //<! the frame that is been played now
72  KeyFrame* lastFrame;
73  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
74  float localTime;
75  PNode* parent;
76 
77  Vector* tmpVect;                 //<! this is the temporary vector save place -
78  WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
79  bool bDescriptive;               //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands
80};
81
82#endif /* _SIMPLE_ANIMATION_H */
Note: See TracBrowser for help on using the repository browser.