Changeset 4704 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jun 26, 2005, 4:13:11 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/cd_engine.cc
r4695 r4704 66 66 WorldEntity* entity1 = iterator1->nextElement(); 67 67 WorldEntity* entity2 = iterator2->seekElement(entity1); 68 printf("checking for collisions\n");68 PRINTF(3)("checking for collisions\n"); 69 69 while( entity1 != NULL) 70 70 { 71 printf("entering l1\n");72 71 while( entity2 != NULL) 73 72 { 74 printf("entering l2 -checking object %s against %s\n", entity1->getName(), entity2->getName());73 PRINTF(3)("checking object %s against %s\n", entity1->getName(), entity2->getName()); 75 74 entity1->collideWith(entity2); 76 75 entity2 = iterator2->nextElement(); -
orxonox/trunk/src/lib/collision_detection/obb.cc
r4660 r4704 31 31 this->axis = new Vector[3]; 32 32 this->halfLength = new float[3]; 33 this->bCollided = false; 33 34 } 34 35 -
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4703 r4704 609 609 PRINTF(0)("collideWith\n"); 610 610 /* if the obb overlap, make subtests: check which node is realy overlaping */ 611 PRINT(0)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex()); 611 612 if( this->overlapTest(this->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB)) 612 613 { 613 614 /* check if left node overlaps */ 614 if( unlikely( this->nodeLeft != NULL)) 615 if( likely( this->nodeLeft != NULL)) 616 { 617 PRINT(0)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex()); 615 618 if( this->overlapTest(this->nodeLeft->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB)) 619 { 616 620 this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeLeft, nodeA, nodeB); 621 this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB); 622 } 623 } 617 624 /* check if right node overlaps */ 618 if( unlikely( this->nodeRight != NULL)) 625 if( likely( this->nodeRight != NULL)) 626 { 627 PRINT(0)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex()); 619 628 if(this->overlapTest(this->nodeRight->bvElement, ((OBBTreeNode*)treeNode)->bvElement, nodeA, nodeB)) 620 this->nodeLeft->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB); 629 { 630 this->nodeRight->collideWith(((OBBTreeNode*)treeNode)->nodeLeft, nodeA, nodeB); 631 this->nodeRight->collideWith(((OBBTreeNode*)treeNode)->nodeRight, nodeA, nodeB); 632 } 633 } 621 634 } 622 635 } … … 626 639 bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, PNode* nodeA, PNode* nodeB) 627 640 { 641 628 642 629 643 … … 641 655 l = boxA->axis[j]; 642 656 657 /* \todo unroll all loops */ 643 658 for(int i = 0; i < 3; ++i) 644 659 rA += fabs(boxA->halfLength[i] * boxA->axis[i].dot(l)); … … 651 666 if( (rA + rB) < fabs(t.dot(l))) 652 667 { 653 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 668 PRINT(0)("keine Kollision\n"); 669 PRINTF(3)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 654 670 return false; 655 671 } … … 673 689 if( (rA + rB) < fabs(t.dot(l))) 674 690 { 675 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 691 PRINT(0)("keine Kollision\n"); 692 PRINTF(3)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 676 693 return false; 677 694 } … … 699 716 if( (rA + rB) < fabs(t.dot(l))) 700 717 { 701 PRINTF(0)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 718 PRINT(0)("keine Kollision\n"); 719 PRINTF(3)(" - Keine Kollision in der Bahnfohstrasse! Passagiere der Linien 6, 14 sind gebeten zu fliegen!\n"); 702 720 return false; 703 721 } … … 710 728 boxA->bCollided = true; /* use this ONLY!!!! for drawing operations */ 711 729 boxB->bCollided = true; 730 PRINT(0)("Kollision!\n"); 712 731 return true; 713 732 } -
orxonox/trunk/src/subprojects/collision_detection/collision_detection.cc
r4701 r4704 38 38 int drawMode; 39 39 int depth; 40 float iterata; 40 41 tList<WorldEntity>* entityList; 41 42 … … 43 44 bool drawModel; 44 45 45 TestEntity* a;46 Environment* a; 46 47 Environment* b; 47 48 … … 68 69 entityList = new tList<WorldEntity>(); 69 70 70 a = new TestEntity(); a->setName("Clown1"); 71 //a = new TestEntity(); a->setName("Clown1"); 72 a = new Environment(); a->setName("Clown"); 71 73 b = new Environment(); b->setName("Jaeger"); 72 74 b->setRelCoor(0.0, 0.0, -10.0); … … 92 94 depth = 0; 93 95 dt = lastFrame = currentFrame = 0; 94 96 iterata = 0.05f; 95 97 96 98 moduleHelp(); … … 198 200 } 199 201 break; 202 case SDLK_o: 203 if(iterata == 0.0f) 204 { 205 iterata = 0.05f; 206 } 207 else 208 { 209 iterata = 0.0f; 210 } 211 break; 200 212 201 213 } … … 227 239 } 228 240 229 b->shiftCoor(Vector(0.0, 0.0, 0.1));241 b->shiftCoor(Vector(0.0, 0.0, iterata)); 230 242 231 243
Note: See TracChangeset
for help on using the changeset viewer.