| 500 | //-------------------------------------------------------------------------- |
| 501 | |
| 502 | void Trigger::buildConvex(const Box3F& box, Convex* convex) |
| 503 | { |
| 504 | // These should really come out of a pool |
| 505 | mConvexList->collectGarbage(); |
| 506 | |
| 507 | Box3F realBox = box; |
| 508 | mWorldToObj.mul(realBox); |
| 509 | realBox.minExtents.convolveInverse(mObjScale); |
| 510 | realBox.maxExtents.convolveInverse(mObjScale); |
| 511 | |
| 512 | if (realBox.isOverlapped(getObjBox()) == false) |
| 513 | return; |
| 514 | |
| 515 | // Just return a box convex for the entire shape... |
| 516 | Convex* cc = 0; |
| 517 | CollisionWorkingList& wl = convex->getWorkingList(); |
| 518 | for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) { |
| 519 | if (itr->mConvex->getType() == BoxConvexType && |
| 520 | itr->mConvex->getObject() == this) { |
| 521 | cc = itr->mConvex; |
| 522 | break; |
| 523 | } |
| 524 | } |
| 525 | if (cc) |
| 526 | return; |
| 527 | |
| 528 | // Create a new convex. |
| 529 | BoxConvex* cp = new BoxConvex; |
| 530 | mConvexList->registerObject(cp); |
| 531 | convex->addToWorkingList(cp); |
| 532 | cp->init(this); |
| 533 | |
| 534 | mObjBox.getCenter(&cp->mCenter); |
| 535 | cp->mSize.x = mObjBox.len_x() / 2.0f; |
| 536 | cp->mSize.y = mObjBox.len_y() / 2.0f; |
| 537 | cp->mSize.z = mObjBox.len_z() / 2.0f; |
| 538 | } |
| 539 | |
| 540 | //------------------------------------------------------------------------------ |
| 541 |
nothing calls this directly
no test coverage detected