Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: simple change in animation player

File size: 1.8 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 "p_node.h"
15#include "list.h"
16
17
18typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
19
20
21//! KeyFrame Class
22/**
23   This represents one point with orientation of the animation
24*/
25class KeyFrame : public PNode {
26 public:
27  KeyFrame(Vector* point, Quaternion* orientation, float time);
28  KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode); 
29  virtual ~KeyFrame();
30
31  void set(Vector* point, Quaternion* orientation, float time);
32  void set(Vector* point, Quaternion* orientation, float time, movementMode mode);
33 
34 private:
35  float time;
36  movementMode mode;
37};
38
39
40//! Animation Class
41/**
42   Helps you making some small animation
43*/
44class SimpleAnimation : public BaseObject {
45 
46 public:
47  SimpleAnimation(PNode* parent);
48  virtual ~SimpleAnimation();
49
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  void start();
56  void stop();
57  void restart();
58  void pause();
59  void resume();
60
61  void tick(float time);
62
63 private:
64  bool bPause;                     //<! is set, when there is a pause
65  tList<KeyFrame>* frames;         //<! where keyframes are stored in
66  KeyFrame* currentFrame;          //<! the frame that is been played now
67  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
68  float localTime;
69  PNode* parent;
70 
71
72};
73
74#endif /* _SIMPLE_ANIMATION_H */
Note: See TracBrowser for help on using the repository browser.