Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3732 was 3729, checked in by patrick, 21 years ago

orxonox/trunk: simple animation is moving, but not realy what it should

File size: 2.2 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 "list.h"
15
16
[3726]17class Vector;
18class Quaternion;
19class WorldEntity;
20class PNode;
21
[3717]22typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
[3726]23#define DEFAULT_ANIMATION_MODE LINEAR
[3573]24
[3726]25//! KeyFrame Struct
[3573]26/**
[3729]27   This represents one point with direction of the animation
[3573]28*/
[3726]29typedef struct KeyFrame {
30  Vector* position;
[3729]31  Quaternion* direction;
[3726]32  WorldEntity* object;
[3573]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:
[3727]45  static SimpleAnimation* getInstance();
[3573]46
[3729]47  void animatorBegin();
48  void animatorEnd();
[3727]49  void selectObject(WorldEntity* entity);
[3729]50  void addKeyFrame(Vector* point, Quaternion* direction, float time);
51  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
[3573]52  void addKeyFrame(KeyFrame* frame);
53  void reset();
54
[3727]55
[3573]56  void start();
57  void stop();
58  void restart();
59  void pause();
60  void resume();
61
62  void tick(float time);
63
64 private:
[3727]65  SimpleAnimation();
66  virtual ~SimpleAnimation();
67
68  static SimpleAnimation* singletonRef;
[3719]69  bool bRunning;                   //<! is set, when the animation is running
[3717]70  tList<KeyFrame>* frames;         //<! where keyframes are stored in
71  KeyFrame* currentFrame;          //<! the frame that is been played now
[3719]72  KeyFrame* lastFrame;
[3729]73  Vector* lastPosition;
[3717]74  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
[3573]75  float localTime;
76  PNode* parent;
77 
[3726]78  Vector* tmpVect;                 //<! this is the temporary vector save place -
[3727]79  WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
80  bool bDescriptive;               //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands
[3573]81};
82
83#endif /* _SIMPLE_ANIMATION_H */
Note: See TracBrowser for help on using the repository browser.