Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/ai/src/util/animation/animation3d.h @ 10167

Last change on this file since 10167 was 6616, checked in by bensch, 19 years ago

orxonox/trunk: taken the quaternion outside of Vector.cc to quaternion.cc/h

File size: 3.1 KB
Line 
1/*!
2 * @file animation3d.h
3*/
4
5
6#include "animation.h"
7
8#include "vector.h"
9#include "quaternion.h"
10class PNode;
11
12#define DELTA_X_3D 0.05  //!< the percentag of the distance that doesn't have to be done by neg_exp (asymptotical) ~ maschinendelta
13
14//! KeyFrame3D Struct
15/**
16   This represents one point with direction of the animation
17*/
18typedef struct KeyFrame3D {
19  float             duration;              //!< The duration of this KeyFrame
20  Vector            position;              //!< The position of this KeyFrame
21  Vector            lastPosition;          //!< The last known position
22  Quaternion        direction;             //!< The direction of this KeyFrame
23  ANIM_FUNCTION     animFuncMov;           //!< with whitch function to iterate movement to the next KeyFrame3D
24  ANIM_FUNCTION     animFuncRot;           //!< with whitch function to iterate rotation to the next KeyFrame3D
25};
26
27//! Animation Class for 3D-transformations (movement and rotation)
28/**
29   This represents an animation for a object
30*/
31class Animation3D : public Animation
32{
33 public:
34  Animation3D(PNode* object);
35  virtual ~Animation3D();
36
37  virtual void rewind();
38
39  void addKeyFrame(Vector position, Quaternion direction,
40                   float time, ANIM_FUNCTION animFuncMov = ANIM_DEFAULT_FUNCTION,
41                   ANIM_FUNCTION animFuncRot = ANIM_NULL);
42  //  void addKeyFrame(KeyFrame3D* frame);
43
44  virtual void tick(float dt);
45
46 private:
47  // animation functions
48  void setAnimFuncMov(ANIM_FUNCTION animFunc);
49  void setAnimFuncRot(ANIM_FUNCTION animFunc);
50  void mConstant(float timePassed) const;
51  void mLinear(float timePassed) const;
52  void mSine(float timePassed) const;
53  void mCosine(float timePassed) const;
54  void mExp(float timePassed) const;
55  void mNegExp(float timePassed) const;
56  void mQuadratic(float timePassed) const;
57  void mRandom(float timePassed) const;
58  void rConstant(float timePassed) const;
59  void rLinear(float timePassed) const;
60  void rSine(float timePassed) const;
61  void rCosine(float timePassed) const;
62  void rExp(float timePassed) const;
63  void rNegExp(float timePassed) const;
64  void rQuadratic(float timePassed) const;
65  void rRandom(float timePassed) const;
66  //  ANIM_FUNCTION animFunc;
67  void (Animation3D::*animFuncMov)(float) const;      //!< A Function for the AnimationType
68  void (Animation3D::*animFuncRot)(float) const;      //!< A Function for the AnimationType
69
70
71 private:
72  KeyFrame3D*          currentKeyFrame;               //!< The current KeyFrame
73  KeyFrame3D*          nextKeyFrame;                  //!< The KeyFrame we iterate to
74  tList<KeyFrame3D>*   keyFrameList;                  //!< The KeyFrameList
75
76
77  // more class-local description
78  PNode*               object;                        //!< The Object from which to Animate something
79  Vector               lastPosition;                  //!< last Object
80  Vector               tmpVect;                       //!< temporary vector
81  float                deltaT;                        //!< time passed since last
82  float                expFactorMov;                  //!< exponential Factor for movement
83  float                expFactorRot;                  //!< exponential Factor for rotation
84};
Note: See TracBrowser for help on using the repository browser.