mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-21 15:43:45 +00:00
Expanded mesh baking functionality, now supporting baking of LODs and Collision meshes
This commit is contained in:
parent
e079536122
commit
f309b736ca
7 changed files with 1578 additions and 8 deletions
|
|
@ -3927,15 +3927,38 @@ void WorldEditor::makeSelectionAMesh(const char *filename)
|
|||
OptimizedPolyList polyList;
|
||||
polyList.setBaseTransform(orientation);
|
||||
|
||||
ColladaUtils::ExportData exportData;
|
||||
|
||||
for (S32 i = 0; i < objectList.size(); i++)
|
||||
{
|
||||
SceneObject *pObj = objectList[i];
|
||||
if (!pObj->buildPolyList(PLC_Export, &polyList, pObj->getWorldBox(), pObj->getWorldSphere()))
|
||||
if (!pObj->buildExportPolyList(PLC_Export, &exportData, pObj->getWorldBox(), pObj->getWorldSphere()))
|
||||
Con::warnf("colladaExportObjectList() - object %i returned no geometry.", pObj->getId());
|
||||
}
|
||||
|
||||
//Now that we have all of our mesh data, process it so we can correctly collapse everything.
|
||||
exportData.processData();
|
||||
|
||||
//recenter generated visual mesh results
|
||||
for (U32 dl = 0; dl < exportData.colMeshes.size(); dl++)
|
||||
{
|
||||
for (U32 pnt = 0; pnt < exportData.colMeshes[dl].mesh.mPoints.size(); pnt++)
|
||||
{
|
||||
exportData.colMeshes[dl].mesh.mPoints[pnt] -= centroid;
|
||||
}
|
||||
}
|
||||
|
||||
//recenter generated collision mesh results
|
||||
for (U32 dl = 0; dl < exportData.detailLevels.size(); dl++)
|
||||
{
|
||||
for (U32 pnt = 0; pnt < exportData.detailLevels[dl].mesh.mPoints.size(); pnt++)
|
||||
{
|
||||
exportData.detailLevels[dl].mesh.mPoints[pnt] -= centroid;
|
||||
}
|
||||
}
|
||||
|
||||
// Use a ColladaUtils function to do the actual export to a Collada file
|
||||
ColladaUtils::exportToCollada(filename, polyList);
|
||||
ColladaUtils::exportToCollada(filename, exportData);
|
||||
//
|
||||
|
||||
// Allocate TSStatic object and add to level.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue