Changeset 4636 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection
- Timestamp:
- Jun 15, 2005, 10:38:15 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc
r4635 r4636 475 475 if( drawMode & DRAW_BV_AXIS || drawMode & DRAW_ALL) 476 476 { 477 if( drawMode & DRAW_SINGLE && depth == 0)477 if( !(drawMode & DRAW_SINGLE && depth != 0)) 478 478 { 479 479 /* draw the obb axes */ … … 501 501 if( drawMode & DRAW_BV_POLYGON || drawMode & DRAW_ALL) 502 502 { 503 if( drawMode & DRAW_SINGLE && depth == 0)503 if( !(drawMode & DRAW_SINGLE && depth != 0)) 504 504 { 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 505 Vector cen = *this->bvElement->center; 506 Vector** axis = this->bvElement->axis; 507 float* len = this->bvElement->halfLength; 508 509 /* draw bounding box */ 510 glBegin(GL_LINE_LOOP); 511 glColor3f(0.3, 0.4, 0.7); 512 glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2], 513 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2], 514 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]); 515 glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2], 516 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2], 517 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]); 518 glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2], 519 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2], 520 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]); 521 glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2], 522 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2], 523 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]); 524 glEnd(); 525 526 glBegin(GL_LINE_LOOP); 527 glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2], 528 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2], 529 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]); 530 glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2], 531 cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2], 532 cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]); 533 glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2], 534 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2], 535 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]); 536 glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2], 537 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2], 538 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]); 539 glEnd(); 540 541 glBegin(GL_LINE_LOOP); 542 glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2], 543 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2], 544 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]); 545 glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2], 546 cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2], 547 cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]); 548 glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2], 549 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2], 550 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]); 551 glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2], 552 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2], 553 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]); 554 glEnd(); 555 556 glBegin(GL_LINE_LOOP); 557 glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2], 558 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2], 559 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]); 560 glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2], 561 cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2], 562 cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]); 563 glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2], 564 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2], 565 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]); 566 glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2], 567 cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2], 568 cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]); 569 glEnd(); 570 570 } 571 571 572 } 572 573 573 574 if( drawMode & DRAW_SEPARATING_PLANE || drawMode & DRAW_ALL) 574 575 { 575 if( drawMode & DRAW_SINGLE && depth == 0)576 if( !(drawMode & DRAW_SINGLE && depth != 0)) 576 577 { 577 578 579 580 581 582 583 584 585 586 587 588 578 /* now draw the separation plane */ 579 Vector a1 = *this->bvElement->axis[(this->longestAxisIndex + 1)%3]; 580 Vector a2 = *this->bvElement->axis[(this->longestAxisIndex + 2)%3]; 581 Vector c = *this->bvElement->center; 582 float l1 = this->bvElement->halfLength[(this->longestAxisIndex + 1)%3]; 583 float l2 = this->bvElement->halfLength[(this->longestAxisIndex + 2)%3]; 584 glBegin(GL_QUADS); 585 glVertex3f(c.x + a1.x * l1 + a2.x * l2, c.y + a1.y * l1+ a2.y * l2, c.z + a1.z * l1 + a2.z * l2); 586 glVertex3f(c.x - a1.x * l1 + a2.x * l2, c.y - a1.y * l1+ a2.y * l2, c.z - a1.z * l1 + a2.z * l2); 587 glVertex3f(c.x - a1.x * l1 - a2.x * l2, c.y - a1.y * l1- a2.y * l2, c.z - a1.z * l1 - a2.z * l2); 588 glVertex3f(c.x + a1.x * l1 - a2.x * l2, c.y + a1.y * l1- a2.y * l2, c.z + a1.z * l1 - a2.z * l2); 589 glEnd(); 589 590 } 590 591 }
Note: See TracChangeset
for help on using the changeset viewer.