Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/util/animation/animation3d.h @ 4703

Last change on this file since 4703 was 4597, checked in by bensch, 19 years ago

orxonox/trunk: setClassID implemented in all files

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