| [3851] | 1 | /*! |
|---|
| 2 | \file animation3d.h |
|---|
| 3 | */ |
|---|
| 4 | |
|---|
| [3863] | 5 | |
|---|
| [3851] | 6 | #include "animation.h" |
|---|
| 7 | |
|---|
| 8 | #include "vector.h" |
|---|
| 9 | class PNode; |
|---|
| 10 | |
|---|
| 11 | //! KeyFrame3D Struct |
|---|
| 12 | /** |
|---|
| 13 | This represents one point with direction of the animation |
|---|
| 14 | */ |
|---|
| 15 | typedef struct KeyFrame3D { |
|---|
| [3855] | 16 | float duration; //!< The duration of this KeyFrame |
|---|
| 17 | Vector position; //!< The position of this KeyFrame |
|---|
| 18 | Quaternion direction; //!< The direction of this KeyFrame |
|---|
| 19 | ANIM_FUNCTION animFunc; //!< with whitch function to iterate to the next KeyFrame3D |
|---|
| [3851] | 20 | }; |
|---|
| 21 | |
|---|
| 22 | //! Animation Struct |
|---|
| 23 | /** |
|---|
| 24 | This represents an animation for a object |
|---|
| 25 | */ |
|---|
| 26 | class Animation3D : public Animation |
|---|
| 27 | { |
|---|
| 28 | public: |
|---|
| [3852] | 29 | Animation3D(PNode* object); |
|---|
| [3851] | 30 | virtual ~Animation3D(void); |
|---|
| 31 | |
|---|
| 32 | virtual void rewind(void); |
|---|
| 33 | |
|---|
| 34 | void addKeyFrame(Vector position, Quaternion direction, float time, ANIM_FUNCTION animFunc = ANIM_LINEAR); |
|---|
| [3855] | 35 | // void addKeyFrame(KeyFrame3D* frame); |
|---|
| [3851] | 36 | |
|---|
| [3852] | 37 | virtual void tick(float dt); |
|---|
| [3851] | 38 | |
|---|
| [3859] | 39 | private: |
|---|
| [3851] | 40 | // animation functions |
|---|
| 41 | void setAnimFunc(ANIM_FUNCTION animFunc); |
|---|
| [3852] | 42 | void constant(float timePassed) const; |
|---|
| 43 | void linear(float timePassed) const; |
|---|
| 44 | void sine(float timePassed) const; |
|---|
| 45 | void cosine(float timePassed) const; |
|---|
| 46 | void exp(float timePassed) const; |
|---|
| 47 | void negExp(float timePassed) const; |
|---|
| 48 | void quadratic(float timePassed) const; |
|---|
| 49 | void random(float timePassed) const; |
|---|
| [3851] | 50 | // ANIM_FUNCTION animFunc; |
|---|
| [3855] | 51 | void (Animation3D::*animFunc)(float) const; //!< A Function for the AnimationType |
|---|
| [3851] | 52 | |
|---|
| [3855] | 53 | KeyFrame3D* currentKeyFrame; //!< The current KeyFrame |
|---|
| 54 | KeyFrame3D* nextKeyFrame; //!< The KeyFrame we iterate to |
|---|
| 55 | tList<KeyFrame3D>* keyFrameList; //!< The KeyFrameList |
|---|
| 56 | |
|---|
| [3851] | 57 | // more class-local description |
|---|
| [3855] | 58 | PNode* object; //!< The Object from which to Animate something |
|---|
| 59 | Vector lastPosition; //!< ?? |
|---|
| 60 | Vector tmpVect; //!< what for?? |
|---|
| 61 | float deltaT; //!< ?? |
|---|
| [3851] | 62 | }; |
|---|