| 6072 | |
| 6073 | |
| 6074 | void Player::buildConvex(const Box3F& box, Convex* convex) |
| 6075 | { |
| 6076 | if (mShapeInstance == NULL) |
| 6077 | return; |
| 6078 | |
| 6079 | // These should really come out of a pool |
| 6080 | mConvexList->collectGarbage(); |
| 6081 | |
| 6082 | Box3F realBox = box; |
| 6083 | mWorldToObj.mul(realBox); |
| 6084 | realBox.minExtents.convolveInverse(mObjScale); |
| 6085 | realBox.maxExtents.convolveInverse(mObjScale); |
| 6086 | |
| 6087 | if (realBox.isOverlapped(getObjBox()) == false) |
| 6088 | return; |
| 6089 | |
| 6090 | Convex* cc = 0; |
| 6091 | CollisionWorkingList& wl = convex->getWorkingList(); |
| 6092 | for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) { |
| 6093 | if (itr->mConvex->getType() == BoxConvexType && |
| 6094 | itr->mConvex->getObject() == this) { |
| 6095 | cc = itr->mConvex; |
| 6096 | break; |
| 6097 | } |
| 6098 | } |
| 6099 | if (cc) |
| 6100 | return; |
| 6101 | |
| 6102 | // Create a new convex. |
| 6103 | BoxConvex* cp = new OrthoBoxConvex; |
| 6104 | mConvexList->registerObject(cp); |
| 6105 | convex->addToWorkingList(cp); |
| 6106 | cp->init(this); |
| 6107 | |
| 6108 | mObjBox.getCenter(&cp->mCenter); |
| 6109 | cp->mSize.x = mObjBox.len_x() / 2.0f; |
| 6110 | cp->mSize.y = mObjBox.len_y() / 2.0f; |
| 6111 | cp->mSize.z = mObjBox.len_z() / 2.0f; |
| 6112 | } |
| 6113 | |
| 6114 | |
| 6115 | //---------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected