Changeset 4485 in orxonox.OLD for orxonox/trunk/src/util/animation
- Timestamp:
- Jun 3, 2005, 12:19:43 AM (19 years ago)
- Location:
- orxonox/trunk/src/util/animation
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/animation/animation.h
r4381 r4485 80 80 //! A virtual function that should change to the first keyframe. 81 81 virtual void rewind() = 0; 82 82 83 /** \brief A virtual function that ticks the animation \param dt the time passed */ 83 84 virtual void tick(float dt) = 0; 84 85 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; }; 89 88 90 89 /** \returns if the Animation should be deleted */ 91 inline bool ifDelete(void) { return bDelete;}90 inline bool ifDelete(void) { return bDelete; }; 92 91 93 92 protected: … … 95 94 96 95 void handleInfinity(void); 96 97 protected: 97 98 // 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. 100 101 101 BaseObject* baseObject;//!< The same as object in the derived classes, but with reference to BaseObject102 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 running106 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. 107 108 }; 108 109 109 110 111 112 110 113 /**********************TEST*******************************/ 114 //! a simple testClass for the animation 111 115 class aTest 112 116 { 113 117 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;} 117 121 private: 118 float diff;119 float last;122 float diff; //!< difference from the last value 123 float last; //!< the last calculated value 120 124 }; 121 125 -
orxonox/trunk/src/util/animation/animation3d.cc
r4000 r4485 86 86 \param duration The duration from the new KeyFrame to the next one 87 87 \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 */ 90 void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration, 91 ANIM_FUNCTION animFuncMov, ANIM_FUNCTION animFuncRot) 91 92 { 92 93 // some small check … … 167 168 /** 168 169 \brief Sets The kind of movment Animation between this keyframe and the next one 169 \param animFunc The Type of Animation to set170 \param animFuncMov: The Type of Animation to set 170 171 */ 171 172 void Animation3D::setAnimFuncMov(ANIM_FUNCTION animFuncMov) … … 213 214 } 214 215 } 215 216 217 216 218 217 /** … … 348 347 /** 349 348 \brief Sets The kind of rotation Animation between this keyframe and the next one 350 \param animFunc The Type of Animation to set349 \param animFuncRot: The Type of Animation to set 351 350 */ 352 351 void Animation3D::setAnimFuncRot(ANIM_FUNCTION animFuncRot) -
orxonox/trunk/src/util/animation/animation3d.h
r3981 r4485 16 16 */ 17 17 typedef struct KeyFrame3D { 18 float duration;//!< The duration of this KeyFrame19 Vector position;//!< The position of this KeyFrame20 Vector lastPosition;21 Quaternion direction; //!< The direction of this KeyFrame22 ANIM_FUNCTION animFuncMov;//!< with whitch function to iterate movement to the next KeyFrame3D23 ANIM_FUNCTION animFuncRot;//!< with whitch function to iterate rotation to the next KeyFrame3D18 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 24 24 }; 25 25 26 //! Animation Struct26 //! Animation Class for 3D-transformations (movement and rotation) 27 27 /** 28 28 This represents an animation for a object … … 65 65 void (Animation3D::*animFuncRot)(float) const; //!< A Function for the AnimationType 66 66 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 70 73 71 74 // more class-local description 72 PNode* object;//!< The Object from which to Animate something73 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 78 81 }; -
orxonox/trunk/src/util/animation/animation_player.cc
r4320 r4485 38 38 */ 39 39 AnimationPlayer* AnimationPlayer::singletonRef = NULL; 40 41 /**42 \returns a Pointer to this Class43 */44 AnimationPlayer* AnimationPlayer::getInstance(void)45 {46 if (!AnimationPlayer::singletonRef)47 AnimationPlayer::singletonRef = new AnimationPlayer();48 return AnimationPlayer::singletonRef;49 }50 40 51 41 /** … … 148 138 } 149 139 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 */ 145 Animation* AnimationPlayer::getAnimationFromBaseObject(const BaseObject* baseObject) const 152 146 { 153 147 tIterator<Animation>* animIt = this->animationList->getIterator(); … … 163 157 } 164 158 delete animIt; 165 159 return NULL; 166 160 } 167 161 -
orxonox/trunk/src/util/animation/animation_player.h
r3868 r4485 29 29 30 30 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 32 34 virtual ~AnimationPlayer(void); 33 35 … … 42 44 void pause(void); 43 45 44 Animation* get ObjectFromBaseObject(const BaseObject* baseObject) const;46 Animation* getAnimationFromBaseObject(const BaseObject* baseObject) const; 45 47 46 48 void debug(void); … … 49 51 /* singleton */ 50 52 AnimationPlayer(void); 51 static AnimationPlayer* singletonRef;53 static AnimationPlayer* singletonRef; //!< SingletonReference to this class. 52 54 53 55 /* 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. 56 58 }; 57 59
Note: See TracChangeset
for help on using the changeset viewer.