Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4485 in orxonox.OLD for orxonox/trunk/src/util/animation


Ignore:
Timestamp:
Jun 3, 2005, 12:19:43 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more documentation in util

Location:
orxonox/trunk/src/util/animation
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/animation/animation.h

    r4381 r4485  
    8080  //! A virtual function that should change to the first keyframe.
    8181  virtual void rewind() = 0;
     82
    8283  /** \brief A virtual function that ticks the animation \param dt the time passed */
    8384  virtual void tick(float dt) = 0;
    8485
    85   /**
    86      \returns the BaseObject, this animation operates on
    87   */
    88   BaseObject* getBaseObject(void) const {return baseObject;}
     86  /** \returns the BaseObject, this animation operates on */
     87  BaseObject* getBaseObject(void) const { return this->baseObject; };
    8988
    9089  /** \returns if the Animation should be deleted */
    91   inline bool ifDelete(void) {return bDelete;}
     90  inline bool ifDelete(void) { return bDelete; };
    9291
    9392 protected:
     
    9594
    9695  void handleInfinity(void);
     96
     97 protected:
    9798  // variables
    98   float localTime;                //!< The Time passed since the beginning of the currentKeyFrame.
    99   ANIM_INFINITY postInfinity;     //!< describing what the animation should do after the last keyframe.
     99  float                 localTime;              //!< The Time passed since the beginning of the currentKeyFrame.
     100  ANIM_INFINITY         postInfinity;           //!< describing what the animation should do after the last keyframe.
    100101
    101   BaseObject* baseObject;         //!< The same as object in the derived classes, but with reference to BaseObject
    102   unsigned int keyFrameCount;     //!< The Count of KeyFrames.
    103   int keyFramesToPlay;            //!< How many more Keyframes to play. if negative it will be ignored if 0 stop.
    104   bool bHandled;                  //!< If this Animation is handled by the AnimationPlayer.
    105   bool bRunning;                  //!< If the animation is running
    106   bool bDelete;                   //!< If true, the animation will be deleted through the AnimationPlayer.
     102  BaseObject*           baseObject;             //!< The same as object in the derived classes, but with reference to BaseObject
     103  unsigned int          keyFrameCount;          //!< The Count of KeyFrames.
     104  int                   keyFramesToPlay;        //!< How many more Keyframes to play. if negative it will be ignored if 0 stop.
     105  bool                  bHandled;               //!< If this Animation is handled by the AnimationPlayer.
     106  bool                  bRunning;               //!< If the animation is running
     107  bool                  bDelete;                //!< If true, the animation will be deleted through the AnimationPlayer.
    107108};
    108109
    109110
     111
     112
    110113/**********************TEST*******************************/
     114//! a simple testClass for the animation
    111115class aTest
    112116{
    113117 public:
    114   aTest() { last = 0.0;}
    115   ~aTest() {}
    116   void littleDebug(float f) {  diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;}
     118  inline aTest() { last = 0.0;}
     119  /** \brief a little debug information to show the results of this class \param f new value */
     120  inline void littleDebug(float f) {  diff = f - last; printf("f=%f, diff=%f\n", f,diff); last = f;}
    117121 private:
    118   float diff;
    119   float last;
     122  float     diff;           //!< difference from the last value
     123  float     last;           //!< the last calculated value
    120124};
    121125
  • orxonox/trunk/src/util/animation/animation3d.cc

    r4000 r4485  
    8686   \param duration The duration from the new KeyFrame to the next one
    8787   \param animFuncMov The function to animate position between this keyFrame and the next one
    88    \param animFuncMov The function to animate rotation between this keyFrame and the next one
    89 */
    90 void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration, ANIM_FUNCTION animFuncMov, ANIM_FUNCTION animFuncRot)
     88   \param animFuncRot The function to animate rotation between this keyFrame and the next one
     89*/
     90void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration,
     91                              ANIM_FUNCTION animFuncMov, ANIM_FUNCTION animFuncRot)
    9192{
    9293  // some small check
     
    167168/**
    168169   \brief Sets The kind of movment Animation between this keyframe and the next one
    169    \param animFunc The Type of Animation to set
     170   \param animFuncMov: The Type of Animation to set
    170171*/
    171172void Animation3D::setAnimFuncMov(ANIM_FUNCTION animFuncMov)
     
    213214    }
    214215}
    215 
    216 
    217216
    218217/**
     
    348347/**
    349348   \brief Sets The kind of rotation Animation between this keyframe and the next one
    350    \param animFunc The Type of Animation to set
     349   \param animFuncRot: The Type of Animation to set
    351350*/
    352351void Animation3D::setAnimFuncRot(ANIM_FUNCTION animFuncRot)
  • orxonox/trunk/src/util/animation/animation3d.h

    r3981 r4485  
    1616*/
    1717typedef struct KeyFrame3D {
    18   float duration;                   //!< The duration of this KeyFrame
    19   Vector position;                  //!< The position of this KeyFrame
    20   Vector lastPosition;
    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
     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
    2424};
    2525
    26 //! Animation Struct
     26//! Animation Class for 3D-transformations (movement and rotation)
    2727/**
    2828   This represents an animation for a object
     
    6565  void (Animation3D::*animFuncRot)(float) const;      //!< A Function for the AnimationType
    6666
    67   KeyFrame3D* currentKeyFrame;                     //!< The current KeyFrame
    68   KeyFrame3D* nextKeyFrame;                        //!< The KeyFrame we iterate to
    69   tList<KeyFrame3D>* keyFrameList;                 //!< The KeyFrameList
     67
     68 private:
     69  KeyFrame3D*          currentKeyFrame;               //!< The current KeyFrame
     70  KeyFrame3D*          nextKeyFrame;                  //!< The KeyFrame we iterate to
     71  tList<KeyFrame3D>*   keyFrameList;                  //!< The KeyFrameList
     72
    7073
    7174  // more class-local description
    72   PNode* object;                                   //!< The Object from which to Animate something
    73   Vector lastPosition;   //!< ??
    74   Vector tmpVect;        //!< what for??
    75   float deltaT;          //!< ??
    76   float expFactorMov;
    77   float expFactorRot;
     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
    7881};
  • orxonox/trunk/src/util/animation/animation_player.cc

    r4320 r4485  
    3838*/
    3939AnimationPlayer* AnimationPlayer::singletonRef = NULL;
    40 
    41 /**
    42    \returns a Pointer to this Class
    43 */
    44 AnimationPlayer* AnimationPlayer::getInstance(void)
    45 {
    46   if (!AnimationPlayer::singletonRef)
    47     AnimationPlayer::singletonRef = new AnimationPlayer();
    48   return AnimationPlayer::singletonRef;
    49 }
    5040
    5141/**
     
    148138}
    149139
    150 
    151 Animation* AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const
     140/**
     141   \returns the animation from a certain baseobject
     142   if multiple are found, it just retruns the first one
     143   if none is found it returns NULL
     144*/
     145Animation* AnimationPlayer::getAnimationFromBaseObject(const BaseObject* baseObject) const
    152146{
    153147  tIterator<Animation>* animIt = this->animationList->getIterator();
     
    163157    }
    164158  delete animIt;
    165 
     159  return NULL;
    166160}
    167161
  • orxonox/trunk/src/util/animation/animation_player.h

    r3868 r4485  
    2929
    3030 public:
    31   static AnimationPlayer* getInstance(void);
     31  /** \returns a Pointer to the only object of this Class */
     32  inline static AnimationPlayer* getInstance(void) { if (!singletonRef) singletonRef = new AnimationPlayer();  return singletonRef; };
     33
    3234  virtual ~AnimationPlayer(void);
    3335
     
    4244  void pause(void);
    4345
    44   Animation* getObjectFromBaseObject(const BaseObject* baseObject) const;
     46  Animation* getAnimationFromBaseObject(const BaseObject* baseObject) const;
    4547
    4648  void debug(void);
     
    4951  /* singleton */
    5052  AnimationPlayer(void);
    51   static AnimationPlayer* singletonRef;
     53  static AnimationPlayer*      singletonRef;          //!< SingletonReference to this class.
    5254
    5355  /* class specific */
    54   tList<Animation>* animationList;         //!< A List of Animations to be handled.
    55   bool bRunning;                           //!< If the AnimationPlayer is running.
     56  tList<Animation>*            animationList;         //!< A List of Animations to be handled.
     57  bool                         bRunning;              //!< If the AnimationPlayer is running.
    5658};
    5759
Note: See TracChangeset for help on using the changeset viewer.