| 400 | } |
| 401 | |
| 402 | void TSShapeLoader::generateObjects() |
| 403 | { |
| 404 | for (S32 iSub = 0; iSub < subshapes.size(); iSub++) |
| 405 | { |
| 406 | Subshape* subshape = subshapes[iSub]; |
| 407 | shape->subShapeFirstObject.push_back(shape->objects.size()); |
| 408 | |
| 409 | // Get the names and sizes of the meshes for this subshape |
| 410 | Vector<String> meshNames; |
| 411 | for (S32 iMesh = 0; iMesh < subshape->objMeshes.size(); iMesh++) |
| 412 | { |
| 413 | AppMesh* mesh = subshape->objMeshes[iMesh]; |
| 414 | mesh->detailSize = 2; |
| 415 | String name = String::GetTrailingNumber( mesh->getName(), mesh->detailSize ); |
| 416 | name = getUniqueName( name, cmpMeshNameAndSize, meshNames, &(subshape->objMeshes), (void*)(uintptr_t)mesh->detailSize ); |
| 417 | meshNames.push_back( name ); |
| 418 | |
| 419 | // Fix up any collision details that don't have a negative detail level. |
| 420 | if ( dStrStartsWith(meshNames[iMesh], "Collision") || |
| 421 | dStrStartsWith(meshNames[iMesh], "LOSCol") ) |
| 422 | { |
| 423 | if (mesh->detailSize > 0) |
| 424 | mesh->detailSize = -mesh->detailSize; |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | // An 'object' is a collection of meshes with the same base name and |
| 429 | // different detail sizes. The object is attached to the node of the |
| 430 | // highest detail mesh. |
| 431 | |
| 432 | // Sort the 3 arrays (objMeshes, objNodes, meshNames) by name and size |
| 433 | for (S32 i = 0; i < subshape->objMeshes.size()-1; i++) |
| 434 | { |
| 435 | for (S32 j = i+1; j < subshape->objMeshes.size(); j++) |
| 436 | { |
| 437 | if ((meshNames[i].compare(meshNames[j]) < 0) || |
| 438 | ((meshNames[i].compare(meshNames[j]) == 0) && |
| 439 | (subshape->objMeshes[i]->detailSize < subshape->objMeshes[j]->detailSize))) |
| 440 | { |
| 441 | { |
| 442 | AppMesh* tmp = subshape->objMeshes[i]; |
| 443 | subshape->objMeshes[i] = subshape->objMeshes[j]; |
| 444 | subshape->objMeshes[j] = tmp; |
| 445 | } |
| 446 | { |
| 447 | S32 tmp = subshape->objNodes[i]; |
| 448 | subshape->objNodes[i] = subshape->objNodes[j]; |
| 449 | subshape->objNodes[j] = tmp; |
| 450 | } |
| 451 | { |
| 452 | String tmp = meshNames[i]; |
| 453 | meshNames[i] = meshNames[j]; |
| 454 | meshNames[j] = tmp; |
| 455 | } |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 |
nothing calls this directly
no test coverage detected