Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3725 was 3720, checked in by patrick, 20 years ago

orxonox/trunk: now implemented the speed distribution algorithms

File size: 1.9 KB
RevLine 
[3573]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
[3717]18typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
[3573]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  float time;
35  movementMode mode;
36};
37
38
39//! Animation Class
40/**
41   Helps you making some small animation
42*/
43class SimpleAnimation : public BaseObject {
44 
45 public:
46  SimpleAnimation(PNode* parent);
47  virtual ~SimpleAnimation();
48
49  void addKeyFrame(Vector* point, Quaternion* orientation, float time);
50  void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
51  void addKeyFrame(KeyFrame* frame);
52  void reset();
53
54  void start();
55  void stop();
56  void restart();
57  void pause();
58  void resume();
59
60  void tick(float time);
61
62 private:
[3719]63  bool bRunning;                   //<! is set, when the animation is running
[3717]64  tList<KeyFrame>* frames;         //<! where keyframes are stored in
65  KeyFrame* currentFrame;          //<! the frame that is been played now
[3719]66  KeyFrame* lastFrame;
[3717]67  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
[3573]68  float localTime;
69  PNode* parent;
70 
[3720]71  Vector* tmpVect;                 //<! this is the temporary vector save place
[3573]72
73};
74
75#endif /* _SIMPLE_ANIMATION_H */
Note: See TracBrowser for help on using the repository browser.