Changeset 3746 in orxonox.OLD for orxonox/branches/levelloader/src/simple_animation.h
- Timestamp:
- Apr 7, 2005, 3:54:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/levelloader/src/simple_animation.h
r3605 r3746 12 12 13 13 #include "base_object.h" 14 #include "p_node.h"15 14 #include "list.h" 16 15 17 16 18 typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS}; 17 class Vector; 18 class Quaternion; 19 class WorldEntity; 20 class PNode; 21 22 typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC}; 23 typedef enum animationMode{SINGLE=0, LOOP}; 24 #define DEFAULT_ANIMATION_MODE LINEAR 19 25 20 26 21 //! KeyFrame Class27 //! KeyFrame Struct 22 28 /** 23 This represents one point with orientation of the animation29 This represents one point with direction of the animation 24 30 */ 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: 31 typedef struct KeyFrame { 32 Vector* position; 33 Quaternion* direction; 34 WorldEntity* object; 35 35 float time; 36 36 movementMode mode; 37 37 }; 38 38 39 //! Animation Struct 40 /** 41 This represents an animation for a object 42 */ 43 typedef 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 }; 39 55 40 56 //! Animation Class … … 45 61 46 62 public: 47 SimpleAnimation(PNode* parent); 48 virtual ~SimpleAnimation(); 63 static SimpleAnimation* getInstance(); 49 64 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); 52 70 void addKeyFrame(KeyFrame* frame); 53 71 void reset(); 72 54 73 55 74 void start(); … … 62 81 63 82 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 66 95 float localTime; 67 96 PNode* parent; 68 97 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); 69 104 70 105 };
Note: See TracChangeset
for help on using the changeset viewer.