Changeset 8190 in orxonox.OLD for trunk/src/lib/collision_detection
- Timestamp:
- Jun 7, 2006, 3:00:01 PM (19 years ago)
- Location:
- trunk/src/lib/collision_detection
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/Makefile.am
r5750 r8190 5 5 6 6 libORXcd_a_SOURCES = cd_engine.cc \ 7 collision.cc \8 7 obb.cc \ 9 8 obb_tree.cc \ … … 17 16 noinst_HEADERS = cd_engine.h \ 18 17 collision_defs.h \ 19 collision.h \20 18 obb.h \ 21 19 obb_tree.h \ -
trunk/src/lib/collision_detection/obb_tree_node.cc
r7736 r8190 481 481 PRINTF(5)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassName(), nodeB->getClassName(), this->nodeLeft, this->nodeRight); 482 482 483 /* check if left node overlaps */ 483 484 // left node 484 485 if( this->nodeLeft != NULL ) 485 486 { 486 PRINTF(5)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());487 487 if( this->overlapTest(this->nodeLeft->bvElement, treeNode->bvElement, nodeA, nodeB)) 488 488 { 489 this->nodeLeft->collideWith(treeNode->nodeLeft, nodeA, nodeB); 490 this->nodeLeft->collideWith(treeNode->nodeRight, nodeA, nodeB); 489 if( treeNode->nodeLeft != NULL) 490 this->nodeLeft->collideWith(treeNode->nodeLeft, nodeA, nodeB); 491 if( treeNode->nodeRight != NULL) 492 this->nodeLeft->collideWith(treeNode->nodeRight, nodeA, nodeB); 491 493 } 492 494 } 493 /* check if right node overlaps */ 494 if( likely( this->nodeRight != NULL))495 {496 PRINTF(5)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());497 if( this->overlapTest(this->nodeRight->bvElement, treeNode->bvElement, nodeA, nodeB))495 496 // right node 497 if( this->nodeRight != NULL ) 498 { 499 if( this->overlapTest(this->nodeRight->bvElement, treeNode->bvElement, nodeA, nodeB)) 498 500 { 499 this->nodeRight->collideWith(treeNode->nodeLeft, nodeA, nodeB); 500 this->nodeRight->collideWith(treeNode->nodeRight, nodeA, nodeB); 501 if( treeNode->nodeLeft != NULL) 502 this->nodeRight->collideWith(treeNode->nodeLeft, nodeA, nodeB); 503 if( treeNode->nodeRight != NULL) 504 this->nodeRight->collideWith(treeNode->nodeRight, nodeA, nodeB); 501 505 } 502 506 } 503 507 504 /* so there is a collision and this is the last box in the tree (i.e. leaf) */ 505 if( unlikely((this->nodeRight == NULL || this->nodeLeft == NULL) || 506 (treeNode->nodeRight == NULL || treeNode->nodeLeft == NULL)) ) 507 { 508 nodeA->collidesWith(nodeB, treeNode->bvElement->center); 509 nodeB->collidesWith(nodeA, this->bvElement->center); 508 509 // hybrid mode: we reached the end of this obbtree, now reach the end of the other tree 510 if( this->nodeLeft == NULL && this->nodeRight == NULL) 511 { 512 if( treeNode->nodeLeft != NULL) 513 this->collideWith(treeNode->nodeLeft, nodeA, nodeB); 514 if( treeNode->nodeRight != NULL) 515 this->collideWith(treeNode->nodeRight, nodeA, nodeB); 516 } 517 518 519 // now check if we reached the end of both trees 520 if( unlikely((this->nodeRight == NULL && this->nodeLeft == NULL) && 521 (treeNode->nodeRight == NULL && treeNode->nodeLeft == NULL)) ) 522 { 523 nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement); 510 524 } 511 525
Note: See TracChangeset
for help on using the changeset viewer.