Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3726 was 3726, checked in by patrick, 19 years ago

orxonox/trunk: reimplemented, rescaled KeyFrame.

File size: 1.7 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  SimpleAnimation(PNode* parent);
46  virtual ~SimpleAnimation();
47
48  void addKeyFrame(Vector* point, Quaternion* orientation, float time);
49  void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
50  void addKeyFrame(KeyFrame* frame);
51  void reset();
52
53  void start();
54  void stop();
55  void restart();
56  void pause();
57  void resume();
58
59  void tick(float time);
60
61 private:
62  bool bRunning;                   //<! is set, when the animation is running
63  tList<KeyFrame>* frames;         //<! where keyframes are stored in
64  KeyFrame* currentFrame;          //<! the frame that is been played now
65  KeyFrame* lastFrame;
66  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
67  float localTime;
68  PNode* parent;
69 
70  Vector* tmpVect;                 //<! this is the temporary vector save place -
71
72};
73
74#endif /* _SIMPLE_ANIMATION_H */
Note: See TracBrowser for help on using the repository browser.