- Timestamp:
- May 18, 2006, 8:46:40 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cd/src/lib/collision_detection/obb_tree_node.cc
r7707 r7708 334 334 maxLength[k] = p->distancePoint(tmpVec); 335 335 minLength[k] = p->distancePoint(tmpVec); 336 // PRINT(0)("axis[%i]: %f %f %f\n", k, box.axis[k].x, box.axis[k].y, box.axis[k].z);337 336 338 337 for( int j = 0; j < length; ++j) { … … 490 489 return; 491 490 492 PRINTF( 3)("collideWith\n");491 PRINTF(4)("collideWith\n"); 493 492 /* if the obb overlap, make subtests: check which node is realy overlaping */ 494 PRINTF( 3)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex());493 PRINTF(4)("Checking OBB %i vs %i: ", this->getIndex(), treeNode->getIndex()); 495 494 // if( unlikely(treeNode == NULL)) return; 496 495 … … 498 497 if( this->overlapTest(*this->bvElement, *(((const OBBTreeNode*)&treeNode)->bvElement), nodeA, nodeB)) 499 498 { 500 PRINTF( 3)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassName(), nodeB->getClassName(), this->nodeLeft, this->nodeRight);499 PRINTF(4)("collision @ lvl %i, object %s vs. %s, (%p, %p)\n", this->depth, nodeA->getClassName(), nodeB->getClassName(), this->nodeLeft, this->nodeRight); 501 500 502 501 /* check if left node overlaps */ 503 502 if( likely( this->nodeLeft != NULL)) 504 503 { 505 PRINTF( 3)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());504 PRINTF(4)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex()); 506 505 if( this->overlapTest(*this->nodeLeft->bvElement, *(((const OBBTreeNode*)&treeNode)->bvElement), nodeA, nodeB)) 507 506 { … … 513 512 if( likely( this->nodeRight != NULL)) 514 513 { 515 PRINTF( 3)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());514 PRINTF(4)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex()); 516 515 if(this->overlapTest(*this->nodeRight->bvElement, *(((const OBBTreeNode*)&treeNode)->bvElement), nodeA, nodeB)) 517 516 { … … 586 585 rB += fabs(boxB.halfLength[2] * rotAxisB[2].dot(l)); 587 586 588 PRINTF( 3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB);587 PRINTF(5)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 589 588 590 589 if( (rA + rB) < fabs(t.dot(l))) 591 590 { 592 PRINTF( 3)("no Collision\n");591 PRINTF(4)("no Collision\n"); 593 592 return false; 594 593 } … … 610 609 rB += fabs(boxB.halfLength[2] * rotAxisB[2].dot(l)); 611 610 612 PRINTF( 3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB);611 PRINTF(5)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 613 612 614 613 if( (rA + rB) < fabs(t.dot(l))) 615 614 { 616 PRINTF( 3)("no Collision\n");615 PRINTF(4)("no Collision\n"); 617 616 return false; 618 617 } … … 638 637 rB += fabs(boxB.halfLength[2] * rotAxisB[2].dot(l)); 639 638 640 PRINTF( 3)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB);639 PRINTF(5)("s = %f, rA+rB = %f\n", fabs(t.dot(l)), rA+rB); 641 640 642 641 if( (rA + rB) < fabs(t.dot(l))) 643 642 { 644 PRINTF( 3)("keine Kollision\n");643 PRINTF(4)("keine Kollision\n"); 645 644 return false; 646 645 } … … 653 652 654 653 655 PRINTF( 3)("Kollision!\n");654 PRINTF(4)("Kollision!\n"); 656 655 return true; 657 656 } … … 681 680 glBegin(GL_POINTS); 682 681 glColor3f(0.3, 0.8, 0.54); 683 for( int i = 0; i < this->bvElement->modelInf->numTriangles; ++i) 684 { 685 for(int j = 0; j < 3; ++j) 686 { 687 glVertex3f( 688 (&this->bvElement->modelInf->pVertices[this->bvElement->modelInf->pTriangles[i].indexToVertices[j]])[0], 689 (&this->bvElement->modelInf->pVertices[this->bvElement->modelInf->pTriangles[i].indexToVertices[j]])[1], 690 (&this->bvElement->modelInf->pVertices[this->bvElement->modelInf->pTriangles[i].indexToVertices[j]])[2]); 691 } 692 } 693 694 // for( int i = 0; i < this->bvElement->modelInf->numVertices*3; i+=3) 695 // glVertex3f(this->bvElement->modelInf->pVertices[i], 696 // this->bvElement->modelInf->pVertices[i+1], 697 // this->bvElement->modelInf->pVertices[i+2]); 682 for( int i = 0; i < this->bvElement->modelInf->numVertices*3; i+=3) 683 glVertex3f(this->bvElement->modelInf->pVertices[i], 684 this->bvElement->modelInf->pVertices[i+1], 685 this->bvElement->modelInf->pVertices[i+2]); 698 686 glEnd(); 699 687 }
Note: See TracChangeset
for help on using the changeset viewer.