Changeset 3982 in orxonox.OLD for orxonox/trunk/src/util/animation
- Timestamp:
- Apr 26, 2005, 3:17:43 AM (20 years ago)
- Location:
- orxonox/trunk/src/util/animation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/animation/animation.cc
r3876 r3982 34 34 35 35 // setting default values 36 this->keyFramesToPlay = -1; 36 37 this->localTime = 0.0; 37 38 this->bRunning = true; … … 83 84 break; 84 85 case ANIM_INF_REPLAY: 85 this->replay(); 86 this->rewind(); 87 this->bRunning = true; 86 88 break; 87 89 case ANIM_INF_REWIND: … … 99 101 void Animation::play() 100 102 { 103 this->keyFramesToPlay = -1; 104 this->bRunning = true; 105 } 106 107 /** 108 \brief plays the Next n keyframes 109 \param n the Count of keyFrames to play. 110 */ 111 void Animation::playNextKeyframes(int n) 112 { 113 this->keyFramesToPlay = n-1; 101 114 this->bRunning = true; 102 115 } … … 107 120 void Animation::stop() 108 121 { 122 this->keyFramesToPlay = -1; 109 123 this->rewind(); 110 124 this->bRunning = true; … … 127 141 { 128 142 this->rewind(); 129 this-> bRunning = true;143 this->play(); 130 144 } -
orxonox/trunk/src/util/animation/animation.h
r3979 r3982 73 73 74 74 void play(); // equals resume(); 75 void playNextKeyframes(int n = 1); 75 76 void stop(); 76 77 void pause(); … … 99 100 BaseObject* baseObject; //!< The same as object in the derived classes, but with reference to BaseObject 100 101 unsigned int keyFrameCount; //!< The Count of KeyFrames. 102 int keyFramesToPlay; //!< How many more Keyframes to play. if negative it will be ignored if 0 stop. 101 103 bool bHandled; //!< If this Animation is handled by the AnimationPlayer. 102 104 bool bRunning; //!< If the animation is running -
orxonox/trunk/src/util/animation/animation3d.cc
r3981 r3982 138 138 if (localTime >= this->currentKeyFrame->duration) 139 139 { 140 // switching to the next Key-Frame 141 this->localTime -= this->currentKeyFrame->duration; 142 this->currentKeyFrame = this->nextKeyFrame; 143 // checking, if we should still Play the animation 144 if (this->currentKeyFrame == this->keyFrameList->lastElement()) 145 this->handleInfinity(); 146 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 147 this->setAnimFuncMov(this->currentKeyFrame->animFuncMov); 148 this->setAnimFuncRot(this->currentKeyFrame->animFuncRot); 149 } 140 if (likely(this->keyFramesToPlay != 0)) 141 { 142 if (unlikely(this->keyFramesToPlay > 0)) 143 --this->keyFramesToPlay; 144 // switching to the next Key-Frame 145 this->localTime -= this->currentKeyFrame->duration; 146 this->currentKeyFrame = this->nextKeyFrame; 147 // checking, if we should still Play the animation 148 if (this->currentKeyFrame == this->keyFrameList->lastElement()) 149 this->handleInfinity(); 150 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 151 this->setAnimFuncMov(this->currentKeyFrame->animFuncMov); 152 this->setAnimFuncRot(this->currentKeyFrame->animFuncRot); 153 } 154 else 155 this->pause(); 156 } 150 157 /* now animate it */ 151 158 (this->*animFuncMov)(this->localTime); -
orxonox/trunk/src/util/animation/t_animation.h
r3979 r3982 192 192 if (localTime >= this->currentKeyFrame->duration) 193 193 { 194 // switching to the next Key-Frame 195 this->localTime -= this->currentKeyFrame->duration; 196 197 this->currentKeyFrame = this->nextKeyFrame; 198 // checking, if we should still Play the animation 199 if (this->currentKeyFrame == this->keyFrameList->lastElement()) 200 this->handleInfinity(); 201 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 202 203 printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value); 204 this->setAnimFunc(this->currentKeyFrame->animFunc); 194 if (likely(this->keyFramesToPlay != 0)) 195 { 196 if (unlikely(this->keyFramesToPlay > 0)) 197 --this->keyFramesToPlay; 198 // switching to the next Key-Frame 199 this->localTime -= this->currentKeyFrame->duration; 200 201 this->currentKeyFrame = this->nextKeyFrame; 202 // checking, if we should still Play the animation 203 if (this->currentKeyFrame == this->keyFrameList->lastElement()) 204 this->handleInfinity(); 205 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 206 207 printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value); 208 this->setAnimFunc(this->currentKeyFrame->animFunc); 209 } 210 else 211 this->pause(); 205 212 } 206 213
Note: See TracChangeset
for help on using the changeset viewer.