[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 |
---|
[3973] | 21 | ANIM_FUNCTION animFuncMov; //!< with whitch function to iterate movement to the next KeyFrame3D |
---|
| 22 | ANIM_FUNCTION animFuncRot; //!< with whitch function to iterate rotation to the next KeyFrame3D |
---|
[3851] | 23 | }; |
---|
| 24 | |
---|
| 25 | //! Animation Struct |
---|
| 26 | /** |
---|
| 27 | This represents an animation for a object |
---|
| 28 | */ |
---|
| 29 | class Animation3D : public Animation |
---|
| 30 | { |
---|
| 31 | public: |
---|
[3852] | 32 | Animation3D(PNode* object); |
---|
[3851] | 33 | virtual ~Animation3D(void); |
---|
| 34 | |
---|
| 35 | virtual void rewind(void); |
---|
| 36 | |
---|
[3973] | 37 | void addKeyFrame(Vector position, Quaternion direction, float time, ANIM_FUNCTION animFuncMov = ANIM_LINEAR, ANIM_FUNCTION animFuncRot = ANIM_LINEAR); |
---|
[3855] | 38 | // void addKeyFrame(KeyFrame3D* frame); |
---|
[3851] | 39 | |
---|
[3852] | 40 | virtual void tick(float dt); |
---|
[3973] | 41 | |
---|
[3859] | 42 | private: |
---|
[3851] | 43 | // animation functions |
---|
[3973] | 44 | void setAnimFuncMov(ANIM_FUNCTION animFunc); |
---|
| 45 | void setAnimFuncRot(ANIM_FUNCTION animFunc); |
---|
| 46 | void mConstant(float timePassed) const; |
---|
| 47 | void mLinear(float timePassed) const; |
---|
| 48 | void mSine(float timePassed) const; |
---|
| 49 | void mCosine(float timePassed) const; |
---|
| 50 | void mExp(float timePassed) const; |
---|
| 51 | void mNegExp(float timePassed) const; |
---|
| 52 | void mQuadratic(float timePassed) const; |
---|
| 53 | void mRandom(float timePassed) const; |
---|
| 54 | void rConstant(float timePassed) const; |
---|
| 55 | void rLinear(float timePassed) const; |
---|
| 56 | void rSine(float timePassed) const; |
---|
| 57 | void rCosine(float timePassed) const; |
---|
| 58 | void rExp(float timePassed) const; |
---|
| 59 | void rNegExp(float timePassed) const; |
---|
| 60 | void rQuadratic(float timePassed) const; |
---|
| 61 | void rRandom(float timePassed) const; |
---|
[3851] | 62 | // ANIM_FUNCTION animFunc; |
---|
[3973] | 63 | void (Animation3D::*animFuncMov)(float) const; //!< A Function for the AnimationType |
---|
| 64 | void (Animation3D::*animFuncRot)(float) const; //!< A Function for the AnimationType |
---|
[3851] | 65 | |
---|
[3855] | 66 | KeyFrame3D* currentKeyFrame; //!< The current KeyFrame |
---|
| 67 | KeyFrame3D* nextKeyFrame; //!< The KeyFrame we iterate to |
---|
| 68 | tList<KeyFrame3D>* keyFrameList; //!< The KeyFrameList |
---|
| 69 | |
---|
[3851] | 70 | // more class-local description |
---|
[3855] | 71 | PNode* object; //!< The Object from which to Animate something |
---|
| 72 | Vector lastPosition; //!< ?? |
---|
| 73 | Vector tmpVect; //!< what for?? |
---|
| 74 | float deltaT; //!< ?? |
---|
[3964] | 75 | float expFactor; |
---|
[3851] | 76 | }; |
---|