Changeset 3832 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Apr 14, 2005, 1:16:31 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/animation.h
r3831 r3832 29 29 #include "list.h" 30 30 // FORWARD DEFINITION 31 32 #define DELTA_X 0.05 //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta 31 33 32 34 typedef enum ANIM_FUNCTION {ANIM_CONSTANT, … … 146 148 147 149 private: 150 float expFactor; 148 151 T* object; 149 152 void (T::*funcToAnim)(float); … … 258 261 break; 259 262 } 260 this->currentKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 263 //this->currentKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 264 this->currentKeyFrame = this->nextKeyFrame; 261 265 this->nextKeyFrame = this->keyFrameList->nextElement(this->nextKeyFrame); 262 266 printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value); … … 291 295 break; 292 296 case ANIM_NEG_EXP: 293 this->animFunc = &tAnim<T>::negExp; 294 break; 297 { 298 this->animFunc = &tAnim<T>::negExp; 299 float d = fabs(this->currentKeyFrame->value - this->nextKeyFrame->value); 300 expFactor = - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X); 301 break; 302 } 295 303 case ANIM_QUADRATIC: 296 304 this->animFunc = &tAnim<T>::quadratic; … … 319 327 float tAnim<T>::linear(float timePassed) const 320 328 { 321 return this-> nextKeyFrame->value -(this->nextKeyFrame->value - this->currentKeyFrame->value)329 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 322 330 * (timePassed / this->currentKeyFrame->duration); 323 331 // PRINTF(0)("value is %f, %p %p\n", val, this->currentKeyFrame, this->nextKeyFrame); … … 330 338 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; 331 339 float e = 0.5 * d * (1 - cos(M_PI * timePassed / this->currentKeyFrame->duration)); 332 //printf("d=%f, t=%f, T=%f\n", d, timePassed, this->currentKeyFrame->duration); 340 return this->currentKeyFrame->value - e; 341 /* 342 return his->currentKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 343 * sin(timePassed / this->currentKeyFrame->duration * M_PI); 344 */ 345 } 346 347 template<class T> 348 float tAnim<T>::cosine(float timePassed) const 349 { 350 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; 351 float e = 0.5 * d * (sin(M_PI * timePassed / this->currentKeyFrame->duration)); 352 if( timePassed > 0.5*this->currentKeyFrame->duration) e = (d - e); 333 353 return this->currentKeyFrame->value - e; 334 354 /* 335 355 return this->currentKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 336 * sin(timePassed / this->currentKeyFrame->duration * M_PI);356 * cos(timePassed / this->currentKeyFrame->duration * M_PI); 337 357 */ 338 358 } 339 359 340 360 template<class T> 341 float tAnim<T>::cosine(float timePassed) const342 {343 return this->currentKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value)344 * cos(timePassed / this->currentKeyFrame->duration * M_PI);345 }346 347 template<class T>348 361 float tAnim<T>::exp(float timePassed) const 349 362 { 350 351 363 } 352 364 … … 354 366 float tAnim<T>::negExp(float timePassed) const 355 367 { 356 368 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; 369 float e = d * (1.0 - expf(- timePassed * expFactor)); 370 return this->currentKeyFrame->value - e; 357 371 } 358 372 -
orxonox/trunk/src/lib/coord/p_node.cc
r3813 r3832 522 522 { 523 523 //this->tick (dt); 524 /* 524 525 PNode* pn = this->children->enumerate(); 525 526 while( pn != NULL) … … 528 529 pn = this->children->nextElement(); 529 530 } 531 */ 530 532 } 531 533 -
orxonox/trunk/src/lib/util/list.h
r3831 r3832 110 110 bool isEmpty(); 111 111 int getSize(); 112 T* enumerate();112 //T* enumerate(); 113 113 tIterator<T>* getIterator(); 114 114 T* nextElement(); … … 170 170 inline void tList<T>::remove(T* entity) 171 171 { 172 //__UNLIKELY( entity == NULL) return;173 172 this->currentEl = this->first; 174 173 listElement<T>* te; 175 174 while( this->currentEl != NULL) 176 175 { 177 if( this->currentEl->curr == entity)176 __UNLIKELY_IF( this->currentEl->curr == entity) 178 177 { 179 if( this->currentEl->prev == NULL ) this->first = this->currentEl->next;178 __UNLIKELY_IF( this->currentEl->prev == NULL ) this->first = this->currentEl->next; 180 179 else this->currentEl->prev->next = this->currentEl->next; 181 180 182 if( this->currentEl->next == NULL) this->last = this->currentEl->prev;181 __UNLIKELY_IF( this->currentEl->next == NULL) this->last = this->currentEl->prev; 183 182 else this->currentEl->next->prev = this->currentEl->prev; 184 183 185 //te = this->currentEl->next; // for what am i doing this?186 184 delete this->currentEl; 187 //this->currentEl = te;188 this->currentEl = NULL;189 185 this->size--; 190 186 return; … … 218 214 } 219 215 216 220 217 template<class T> 221 218 inline T* tList<T>::lastElement() … … 240 237 241 238 /* deprecated */ 239 /* 242 240 template<class T> 243 241 T* tList<T>::enumerate() … … 248 246 return this->currentEl->curr; 249 247 } 250 248 */ 251 249 252 250 template<class T> -
orxonox/trunk/src/simple_animation.cc
r3755 r3832 355 355 case NEG_EXP: 356 356 *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position; 357 *anim->tmpVect = *anim->tmpVect * (1 - exp (- anim->localTime * anim->deltaT));357 *anim->tmpVect = *anim->tmpVect * (1 - expf(- anim->localTime * anim->deltaT)); 358 358 anim->currentFrame->object->setRelCoor(*anim->lastFrame->position + *anim->tmpVect); 359 359 *anim->lastPosition = *anim->tmpVect; -
orxonox/trunk/src/story_entities/campaign.cc
r3629 r3832 212 212 213 213 214 215 StoryEntity* entity = this->entities->enumerate();214 tIterator<StoryEntity>* iterator = this->entities->getIterator(); 215 StoryEntity* entity = iterator->nextElement(); 216 216 while( entity != NULL) 217 217 { … … 223 223 return entity; 224 224 } 225 entity = this->entities->nextElement();226 } 227 225 entity = iterator->nextElement(); 226 } 227 delete iterator; 228 228 229 229 -
orxonox/trunk/src/story_entities/world.cc
r3831 r3832 374 374 375 375 this->testText = TextEngine::getInstance()->createText("fonts/earth.ttf", 30, TEXT_DYNAMIC, 0, 255, 0); 376 testText->setText(" TEXT rocks");376 testText->setText("We've got Hostiles!"); 377 377 testText->setBlending(1.0); 378 378 testText->setBindNode(tn); 379 379 380 aTest* test = new aTest(); 381 tAnim<aTest>* testAnim = new tAnim<aTest>(test, &aTest::littleDebug); 380 //aTest* test = new aTest(); 381 //tAnim<aTest>* testAnim = new tAnim<aTest>(test, &aTest::littleDebug); 382 tAnim<Text>* testAnim = new tAnim<Text>(testText, &Text::setBlending); 383 384 testAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR); 385 testAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR); 386 testAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR); 387 388 testAnim->addKeyFrame(0.0, 1.0, ANIM_COSINE); 389 testAnim->addKeyFrame(1.0, 1.0, ANIM_COSINE); 390 382 391 testAnim->addKeyFrame(0.0, 1.0, ANIM_SINE); 383 testAnim->addKeyFrame(3.5, 1.0, ANIM_SINE); 384 //testAnim->addKeyFrame(0.0, 1.0, ANIM_LINEAR); 385 //testAnim->addKeyFrame(1.0, 1.0, ANIM_LINEAR); 392 testAnim->addKeyFrame(1.0, 1.0, ANIM_SINE); 393 testAnim->addKeyFrame(0.0, 1.0, ANIM_NEG_EXP); 394 testAnim->addKeyFrame(1.0, 1.0, ANIM_NEG_EXP); 395 386 396 testAnim->setInfinity(ANIM_INF_REWIND); 387 397 break; -
orxonox/trunk/src/track_manager.cc
r3809 r3832 149 149 childCount = this->childCount; 150 150 151 TrackElement* enumElem = this->children->enumerate(); 151 // TrackElement* enumElem = this->children->enumerate(); 152 tIterator<TrackElement>* iterator = this->children->getIterator(); 153 TrackElement* enumElem = iterator->nextElement(); 152 154 for (int i = 0; i < childCount; i++) 153 enumElem = this->children->nextElement(); 155 enumElem = iterator->nextElement(); 156 delete iterator; 154 157 return enumElem; 155 158 } … … 200 203 { 201 204 PRINT(0)(" has %d children: ", this->childCount); 202 TrackElement* enumElem = this->children->enumerate(); 205 //TrackElement* enumElem = this->children->enumerate(); 206 tIterator<TrackElement>* iterator = this->children->getIterator(); 207 TrackElement* enumElem = iterator->nextElement(); 203 208 while (enumElem) 204 209 { 205 210 PRINT(0)("=%d= ", enumElem->ID); 206 enumElem = this->children->nextElement();211 enumElem = iterator->nextElement(); 207 212 } 213 delete iterator; 208 214 PRINT(0)("\n"); 209 215 } … … 294 300 int i = 0; 295 301 296 TrackElement* enumElem = this->children->enumerate(); 302 //TrackElement* enumElem = this->children->enumerate(); 303 tIterator<TrackElement>* iterator = this->children->getIterator(); 304 TrackElement* enumElem = iterator->nextElement(); 297 305 while (enumElem) 298 306 { … … 304 312 } 305 313 i++; 306 enumElem = this->children->nextElement(); 307 } 314 enumElem = iterator->nextElement(); 315 } 316 delete iterator; 308 317 309 318 PRINTF(4)("PathDecision with nearest algorithm: %d\n", childNumber); … … 692 701 if(firstJoint->childCount > 0) 693 702 { 694 TrackElement* enumElem = firstJoint->children->enumerate(); 703 //TrackElement* enumElem = firstJoint->children->enumerate(); 704 tIterator<TrackElement>* iterator = firstJoint->children->getIterator(); 705 TrackElement* enumElem = iterator->nextElement(); 695 706 while (enumElem) 696 707 { … … 699 710 enumElem->endTime = tmpLatestTime + enumElem->duration; 700 711 701 enumElem = firstJoint->children->nextElement();712 enumElem = iterator->nextElement(); 702 713 } 714 delete iterator; 703 715 } 704 716 // returning to the TrackElement we were working on. … … 716 728 { 717 729 TrackElement* tmpElem = findTrackElementByID(i); 718 if (tmpElem->childCount > 0 && tmpElem->mainJoin)730 if( tmpElem->childCount > 0 && tmpElem->mainJoin) 719 731 { 720 721 TrackElement* enumElem = tmpElem->children->enumerate(); 732 tIterator<TrackElement>* iterator = tmpElem->children->getIterator(); 733 TrackElement* enumElem = iterator->nextElement(); 734 //TrackElement* enumElem = tmpElem->children->enumerate(); 722 735 while (enumElem) 723 736 { … … 740 753 enumElem->curve->calcAcc(0).x, enumElem->curve->calcAcc(0).y, enumElem->curve->calcAcc(0).z); 741 754 742 enumElem = tmpElem->children->nextElement();755 enumElem = iterator->nextElement(); 743 756 } 757 delete iterator; 744 758 } 745 759 } -
orxonox/trunk/src/world_entities/world_entity.cc
r3803 r3832 104 104 void WorldEntity::processDraw () 105 105 { 106 this->draw (); 107 PNode* pn = this->children->enumerate (); 108 while( pn != NULL) 109 { 110 ((WorldEntity*)pn)->processDraw (); 111 pn = this->children->nextElement(); 112 } 106 113 107 } 114 108
Note: See TracChangeset
for help on using the changeset viewer.