| 1373 | } |
| 1374 | |
| 1375 | void TSStatic::buildConvex(const Box3F& box, Convex* convex) |
| 1376 | { |
| 1377 | if (mCollisionType == None) |
| 1378 | return; |
| 1379 | |
| 1380 | if (mShapeInstance == NULL) |
| 1381 | return; |
| 1382 | |
| 1383 | // These should really come out of a pool |
| 1384 | mConvexList->collectGarbage(); |
| 1385 | |
| 1386 | if (mCollisionType == Bounds) |
| 1387 | { |
| 1388 | // Just return a box convex for the entire shape... |
| 1389 | Convex* cc = 0; |
| 1390 | CollisionWorkingList& wl = convex->getWorkingList(); |
| 1391 | for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) |
| 1392 | { |
| 1393 | if (itr->mConvex->getType() == BoxConvexType && |
| 1394 | itr->mConvex->getObject() == this) |
| 1395 | { |
| 1396 | cc = itr->mConvex; |
| 1397 | break; |
| 1398 | } |
| 1399 | } |
| 1400 | if (cc) |
| 1401 | return; |
| 1402 | |
| 1403 | // Create a new convex. |
| 1404 | BoxConvex* cp = new BoxConvex; |
| 1405 | mConvexList->registerObject(cp); |
| 1406 | convex->addToWorkingList(cp); |
| 1407 | cp->init(this); |
| 1408 | |
| 1409 | mObjBox.getCenter(&cp->mCenter); |
| 1410 | cp->mSize.x = mObjBox.len_x() / 2.0f; |
| 1411 | cp->mSize.y = mObjBox.len_y() / 2.0f; |
| 1412 | cp->mSize.z = mObjBox.len_z() / 2.0f; |
| 1413 | } |
| 1414 | else // CollisionMesh || VisibleMesh |
| 1415 | { |
| 1416 | TSStaticPolysoupConvex::smCurObject = this; |
| 1417 | |
| 1418 | for (U32 i = 0; i < mCollisionDetails.size(); i++) |
| 1419 | mShapeInstance->buildConvexOpcode(mObjToWorld, mObjScale, mCollisionDetails[i], box, convex, mConvexList); |
| 1420 | |
| 1421 | TSStaticPolysoupConvex::smCurObject = NULL; |
| 1422 | } |
| 1423 | } |
| 1424 | |
| 1425 | SceneObject* TSStaticPolysoupConvex::smCurObject = NULL; |
| 1426 |
nothing calls this directly
no test coverage detected