Last change
on this file since 3852 was
3852,
checked in by bensch, 20 years ago
|
orxonox/trunk: new Animation3D is now ready for setting up of the Functions
|
File size:
1.3 KB
|
Rev | Line | |
---|
[3851] | 1 | /*! |
---|
| 2 | \file animation3d.h |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #include "animation.h" |
---|
| 6 | |
---|
| 7 | #include "vector.h" |
---|
| 8 | class PNode; |
---|
| 9 | |
---|
| 10 | //! KeyFrame3D Struct |
---|
| 11 | /** |
---|
| 12 | This represents one point with direction of the animation |
---|
| 13 | */ |
---|
| 14 | typedef struct KeyFrame3D { |
---|
| 15 | float duration; |
---|
| 16 | Vector position; |
---|
| 17 | Quaternion direction; |
---|
| 18 | ANIM_FUNCTION animFunc; |
---|
| 19 | }; |
---|
| 20 | |
---|
| 21 | //! Animation Struct |
---|
| 22 | /** |
---|
| 23 | This represents an animation for a object |
---|
| 24 | */ |
---|
| 25 | class Animation3D : public Animation |
---|
| 26 | { |
---|
| 27 | public: |
---|
[3852] | 28 | Animation3D(PNode* object); |
---|
[3851] | 29 | virtual ~Animation3D(void); |
---|
| 30 | |
---|
| 31 | virtual void rewind(void); |
---|
| 32 | |
---|
| 33 | void addKeyFrame(Vector position, Quaternion direction, float time, ANIM_FUNCTION animFunc = ANIM_LINEAR); |
---|
| 34 | void addKeyFrame(KeyFrame3D* frame); |
---|
| 35 | |
---|
[3852] | 36 | virtual void tick(float dt); |
---|
[3851] | 37 | |
---|
| 38 | // animation functions |
---|
| 39 | void setAnimFunc(ANIM_FUNCTION animFunc); |
---|
| 40 | |
---|
| 41 | private: |
---|
[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; |
---|
| 51 | KeyFrame3D* currentKeyFrame; |
---|
| 52 | KeyFrame3D* nextKeyFrame; |
---|
| 53 | tList<KeyFrame3D>* keyFrameList; |
---|
[3852] | 54 | void (Animation3D::*animFunc)(float) const; |
---|
[3851] | 55 | |
---|
| 56 | // more class-local description |
---|
| 57 | PNode* object; |
---|
| 58 | Vector lastPosition; |
---|
| 59 | Vector tmpVect; |
---|
| 60 | float deltaT; |
---|
| 61 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.