Changeset 3744 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 7, 2005, 3:07:20 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/simple_animation.cc
r3743 r3744 240 240 } 241 241 242 this->localTime = 0; 242 if( this->workingAnimator == NULL) 243 { 244 PRINTF(1)("You have no target selected to start: either do this with start(target) or by prev selecting it\n"); 245 return; 246 } 247 this->workingAnimator->localTime = 0.0; 248 this->workingAnimator->bRunning = true; 249 this->workingAnimator->currentFrame = this->workingAnimator->frames->firstElement(); 250 this->workingAnimator->lastFrame = this->workingAnimator->frames->nextElement(this->workingAnimator->currentFrame); 243 251 244 252 /* … … 253 261 } 254 262 */ 255 256 this->bRunning = true;257 263 } 258 264 … … 299 305 void SimpleAnimation::tick(float time) 300 306 { 301 this->localTime += time;302 307 tIterator<Animation>* iterator = this->animators->getIterator(); 303 308 Animation* anim = iterator->nextElement(); … … 306 311 if( anim->bRunning) 307 312 { 308 313 anim->localTime += time; 309 314 /* first get the current frame via time-stamps */ 310 while( this->localTime > anim->currentFrame->time)315 while( anim->localTime > anim->currentFrame->time) 311 316 { 312 317 printf("SimpleAnimation::tick(...) - changing Frame\n"); 313 318 319 anim->localTime -= anim->currentFrame->time; 314 320 //this->currentFrame->object->setRelCoor(*this->currentFrame->position); 315 321 *anim->lastPosition = *anim->currentFrame->position; … … 331 337 332 338 *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position; 333 *anim->tmpVect = *anim->tmpVect * this->localTime / anim->currentFrame->time;339 *anim->tmpVect = *anim->tmpVect * anim->localTime / anim->currentFrame->time; 334 340 anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect); 335 341 *anim->lastPosition = *anim->tmpVect; … … 340 346 case NEG_EXP: 341 347 *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position; 342 *anim->tmpVect = *anim->tmpVect * (1 - exp(- this->localTime * anim->deltaT));348 *anim->tmpVect = *anim->tmpVect * (1 - exp(- anim->localTime * anim->deltaT)); 343 349 anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect); 344 350 *anim->lastPosition = *anim->tmpVect; … … 346 352 case SIN: 347 353 *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position; 348 *anim->tmpVect = *anim->tmpVect * 0.5*(1 - cos(M_PI * this->localTime / anim->currentFrame->time));354 *anim->tmpVect = *anim->tmpVect * 0.5*(1 - cos(M_PI * anim->localTime / anim->currentFrame->time)); 349 355 anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect); 350 356 *anim->lastPosition = *anim->tmpVect; … … 355 361 case QUADRATIC: 356 362 *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position; 357 *anim->tmpVect = *anim->tmpVect * 1/3 * ldexpf( this->localTime, 3);363 *anim->tmpVect = *anim->tmpVect * 1/3 * ldexpf(anim->localTime, 3); 358 364 break; 359 365 default: -
orxonox/trunk/src/simple_animation.h
r3739 r3744 52 52 bool bRunning; 53 53 float deltaT; 54 float localTime; 54 55 }; 55 56 -
orxonox/trunk/src/story_entities/world.cc
r3739 r3744 495 495 this->simpleAnimation->addKeyFrame(f1); 496 496 this->simpleAnimation->addKeyFrame(f2); 497 this->simpleAnimation->start(); 497 498 //this->simpleAnimation->addKeyFrame(f3); 498 499 //this->simpleAnimation->addKeyFrame(f2); 499 500 this->simpleAnimation->animatorEnd(); 500 501 501 this->simpleAnimation->start();502 502 503 503 /*
Note: See TracChangeset
for help on using the changeset viewer.