Changeset 3800 in orxonox.OLD for orxonox/trunk/src/lib/coord
- Timestamp:
- Apr 13, 2005, 6:23:17 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r3799 r3800 29 29 #include "null_parent.h" 30 30 31 #ifdef __unix__32 #include <glib-2.0/glib/gmacros.h>33 #endif34 35 31 //#include "vector.h" 36 32 //#include "quaternion.h" … … 64 60 65 61 *this->absCoordinate = *absCoordinate; 66 #ifdef __unix__ 67 if ( G_UNLIKELY(parent != NULL)) 68 #else 69 if ( parent != NULL) 70 #endif 71 { 72 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 73 parent->addChild (this); 74 } 62 63 __LIKELY_IF(parent != NULL) 64 { 65 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 66 parent->addChild (this); 67 } 75 68 else 76 69 this->relCoordinate = new Vector(0,0,0); … … 252 245 void PNode::shiftCoor (Vector* shift) 253 246 { 254 #ifdef __unix__ 255 if( G_UNLIKELY(this->bAbsCoorChanged)) 256 #else 257 if( this->bAbsCoorChanged) 258 #endif 247 248 __UNLIKELY_IF( this->bAbsCoorChanged) 259 249 { 260 250 *this->absCoordinate = *this->absCoordinate + *shift; … … 291 281 void PNode::shiftCoor (Vector shift) 292 282 { 293 #ifdef __unix__ 294 if( G_UNLIKELY(this->bAbsCoorChanged)) 295 #else 296 if( this->bAbsCoorChanged) 297 #endif 283 284 __UNLIKELY_IF( this->bAbsCoorChanged) 298 285 { 299 286 *this->absCoordinate = *this->absCoordinate + shift; … … 437 424 float PNode::getSpeed() 438 425 { 439 #ifdef __unix__ 440 if( G_UNLIKELY(this->time == 0)) 441 #else 442 if(this->time == 0) 443 #endif 426 __UNLIKELY_IF( this->time == 0) 444 427 return 1000; 445 428 Vector diff; … … 471 454 void PNode::addChild (PNode* pNode, int parentingMode) 472 455 { 473 if( pNode->parent != NULL ) 456 457 __UNLIKELY_IF( pNode->parent != NULL) 474 458 { 475 459 PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n"); … … 585 569 this->time = dt; 586 570 PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z); 587 if(this->mode & PNODE_MOVEMENT ) 588 { 589 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 571 572 573 __LIKELY_IF( this->mode & PNODE_MOVEMENT) 574 { 575 __UNLIKELY_IF(this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 590 576 { 591 577 /* if you have set the absolute coordinates this overrides all other changes */ 592 578 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 593 579 } 594 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 580 __LIKELY_IF(this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 581 595 582 { 596 583 /*this is bad style... must be deleted later - just for testing*/ 597 if( this->parent == NULL) 584 585 /* 586 __UNLIKELY_IF( this->parent == NULL) 598 587 { 599 588 *this->absCoordinate = *this->relCoordinate; 600 589 } 601 else602 590 else */ 591 *this->absCoordinate = parent->getAbsCoor() + *this->relCoordinate; /* update the current absCoordinate */ 603 592 } 604 593 } … … 606 595 if( this->mode & PNODE_LOCAL_ROTATE) 607 596 { 608 if( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)597 __UNLIKELY_IF( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 609 598 { 610 599 /* if you have set the absolute coordinates this overrides all other changes */ 611 600 *this->relDirection = *this->absDirection - parent->getAbsDir(); 612 601 } 613 else if( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)602 else __LIKELY_IF( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/) 614 603 { 615 604 /* update the current absDirection - remember * means rotation around sth.*/ … … 620 609 if( this->mode & PNODE_ROTATE_MOVEMENT) 621 610 { 622 if( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)611 __UNLIKELY_IF( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 623 612 { 624 613 /* if you have set the absolute coordinates this overrides all other changes */ 625 614 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 626 615 } 627 else if( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)616 else __LIKELY_IF( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/) 628 617 { 629 618 /*this is bad style... must be deleted later - just for testing*/ 630 if( this->parent == NULL)619 /*if( this->parent == NULL) 631 620 *this->absCoordinate = *this->relCoordinate; 632 else633 621 else*/ 622 *this->absCoordinate = parent->getAbsCoor() + parent->getAbsDir().apply(*this->relCoordinate); /* update the current absCoordinate */ 634 623 } 635 624 } … … 642 631 { 643 632 /* if this node has changed, make sure, that all children are updated also */ 644 if( this->bRelCoorChanged || this->bAbsCoorChanged)633 __LIKELY_IF( this->bRelCoorChanged || this->bAbsCoorChanged) 645 634 pn->parentCoorChanged (); 646 if( this->bRelDirChanged || this->bAbsDirChanged)635 __LIKELY_IF( this->bRelDirChanged || this->bAbsDirChanged) 647 636 pn->parentDirChanged (); 648 637
Note: See TracChangeset
for help on using the changeset viewer.