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