1 | /*! |
---|
2 | \file animation3d.h |
---|
3 | */ |
---|
4 | |
---|
5 | |
---|
6 | #include "animation.h" |
---|
7 | |
---|
8 | #include "vector.h" |
---|
9 | class PNode; |
---|
10 | |
---|
11 | #define DELTA_X_3D 0.05 //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta |
---|
12 | |
---|
13 | //! KeyFrame3D Struct |
---|
14 | /** |
---|
15 | This represents one point with direction of the animation |
---|
16 | */ |
---|
17 | typedef struct KeyFrame3D { |
---|
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 |
---|
22 | }; |
---|
23 | |
---|
24 | //! Animation Struct |
---|
25 | /** |
---|
26 | This represents an animation for a object |
---|
27 | */ |
---|
28 | class Animation3D : public Animation |
---|
29 | { |
---|
30 | public: |
---|
31 | Animation3D(PNode* object); |
---|
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); |
---|
37 | // void addKeyFrame(KeyFrame3D* frame); |
---|
38 | |
---|
39 | virtual void tick(float dt); |
---|
40 | |
---|
41 | private: |
---|
42 | // animation functions |
---|
43 | void setAnimFunc(ANIM_FUNCTION animFunc); |
---|
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; |
---|
52 | // ANIM_FUNCTION animFunc; |
---|
53 | void (Animation3D::*animFunc)(float) const; //!< A Function for the AnimationType |
---|
54 | |
---|
55 | KeyFrame3D* currentKeyFrame; //!< The current KeyFrame |
---|
56 | KeyFrame3D* nextKeyFrame; //!< The KeyFrame we iterate to |
---|
57 | tList<KeyFrame3D>* keyFrameList; //!< The KeyFrameList |
---|
58 | |
---|
59 | // more class-local description |
---|
60 | PNode* object; //!< The Object from which to Animate something |
---|
61 | Vector lastPosition; //!< ?? |
---|
62 | Vector tmpVect; //!< what for?? |
---|
63 | float deltaT; //!< ?? |
---|
64 | float expFactor; |
---|
65 | }; |
---|