Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 7, 2005, 3:54:49 PM (19 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: Merged trunk into branch… still not working though…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/simple_animation.h

    r3605 r3746  
    1212
    1313#include "base_object.h"
    14 #include "p_node.h"
    1514#include "list.h"
    1615
    1716
    18 typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS};
     17class Vector;
     18class Quaternion;
     19class WorldEntity;
     20class PNode;
     21
     22typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
     23typedef enum animationMode{SINGLE=0, LOOP};
     24#define DEFAULT_ANIMATION_MODE LINEAR
    1925
    2026
    21 //! KeyFrame Class
     27//! KeyFrame Struct
    2228/**
    23    This represents one point with orientation of the animation
     29   This represents one point with direction of the animation
    2430*/
    25 class 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:
     31typedef struct KeyFrame {
     32  Vector* position;
     33  Quaternion* direction;
     34  WorldEntity* object;
    3535  float time;
    3636  movementMode mode;
    3737};
    3838
     39//! Animation Struct
     40/**
     41   This represents an animation for a object
     42*/
     43typedef struct Animation {
     44  WorldEntity* object;
     45  KeyFrame* currentFrame;
     46  KeyFrame* lastFrame;
     47  Vector* lastPosition;
     48  Vector* tmpVect;
     49  tList<KeyFrame>* frames;
     50  animationMode animMode;
     51  movementMode movMode;
     52  bool bRunning;
     53  float deltaT;
     54};
    3955
    4056//! Animation Class
     
    4561 
    4662 public:
    47   SimpleAnimation(PNode* parent);
    48   virtual ~SimpleAnimation();
     63  static SimpleAnimation* getInstance();
    4964
    50   void addKeyFrame(Vector* point, Quaternion* orientation, float time);
    51   void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
     65  void animatorBegin();
     66  void animatorEnd();
     67  void selectObject(WorldEntity* entity);
     68  void addKeyFrame(Vector* point, Quaternion* direction, float time);
     69  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
    5270  void addKeyFrame(KeyFrame* frame);
    5371  void reset();
     72
    5473
    5574  void start();
     
    6281
    6382 private:
    64   bool bPause;                     //<! is set, when there is a pause
    65   tList<KeyFrame>* frames;        //<! where keyframes are stored in
     83  SimpleAnimation();
     84  virtual ~SimpleAnimation();
     85
     86  static SimpleAnimation* singletonRef;
     87  bool bDescriptive;               //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands
     88  bool bRunning;                   //<! is set, when the animation is running
     89  tList<KeyFrame>* frames;         //<! where keyframes are stored in
     90  tList<Animation>* animators;      //<! a list of animation's
     91  KeyFrame* currentFrame;          //<! the frame that is been played now
     92  KeyFrame* lastFrame;
     93  Vector* lastPosition;
     94  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
    6695  float localTime;
    6796  PNode* parent;
    6897 
     98  Vector* tmpVect;                 //<! this is the temporary vector save place -
     99  WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
     100  Animation* workingAnimator;       //<! the animator with which you are currently working
     101  float deltaT;                    //<! this is a time constant for the movement
     102
     103  Animation* getAnimationFromWorldEntity(WorldEntity* entity);
    69104
    70105};
Note: See TracChangeset for help on using the changeset viewer.