aboutsummaryrefslogtreecommitdiff
path: root/tools/ApexImporter/src
diff options
context:
space:
mode:
authorAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
committerAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
commit236f03c0b9a4982328ed1201978f7f69d192d9b2 (patch)
treee486f2fa39dba203563895541e92c60ed3e25759 /tools/ApexImporter/src
parentAdded screens to welcome page (diff)
downloadblast-236f03c0b9a4982328ed1201978f7f69d192d9b2.tar.xz
blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.zip
Blast 1.1 release (windows / linux)
see docs/release_notes.txt for details
Diffstat (limited to 'tools/ApexImporter/src')
-rw-r--r--tools/ApexImporter/src/ApexDestructibleObjExporter.cpp162
-rw-r--r--tools/ApexImporter/src/ApexDestructibleObjExporter.h34
-rw-r--r--tools/ApexImporter/src/Main.cpp93
3 files changed, 224 insertions, 65 deletions
diff --git a/tools/ApexImporter/src/ApexDestructibleObjExporter.cpp b/tools/ApexImporter/src/ApexDestructibleObjExporter.cpp
index 0c90ac1..2a2e21e 100644
--- a/tools/ApexImporter/src/ApexDestructibleObjExporter.cpp
+++ b/tools/ApexImporter/src/ApexDestructibleObjExporter.cpp
@@ -1,3 +1,31 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2017 NVIDIA Corporation. All rights reserved.
+
+
#include "ApexDestructibleObjExporter.h"
#include "Log.h"
@@ -8,8 +36,8 @@
#include <PxVec2.h>
#include <PxVec3.h>
#include <map>
-#include <FbxFileWriter.h>
-#include <ObjFileWriter.h>
+#include <NvBlastExtExporter.h>
+#include <NvBlastExtAuthoringTypes.h>
using namespace nvidia;
@@ -84,20 +112,27 @@ std::string getTextureFromMaterial(const char* materialPath)
}
-bool ApexDestructibleGeometryExporter::exportToFile(NvBlastAsset* asset, const DestructibleAsset& apexAsset, const std::string& name, const std::vector<uint32_t>& chunkReorderInvMap, bool toFbx, bool toObj, bool fbxascii, bool toUe4)
+bool ApexDestructibleGeometryExporter::exportToFile(NvBlastAsset* asset, const DestructibleAsset& apexAsset, const std::string& name,
+ const std::vector<uint32_t>& chunkReorderInvMap, bool toFbx, bool toObj, bool fbxascii, bool nonSkinned, const std::vector<std::vector<CollisionHull*> >& hulls)
{
const RenderMeshAsset* rAsset = apexAsset.getRenderMeshAsset();
- uint32_t submeshCount = rAsset->getSubmeshCount();
+
+ Nv::Blast::ExporterMeshData meshData;
+ meshData.asset = asset;
+ meshData.submeshCount = rAsset->getSubmeshCount();
+ meshData.submeshNames = new const char*[meshData.submeshCount];
std::vector<std::string> materialPathes;
+ materialPathes.reserve(meshData.submeshCount);
// gather materials
{
- for (uint32_t submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex)
+ for (uint32_t submeshIndex = 0; submeshIndex < meshData.submeshCount; ++submeshIndex)
{
const char* materialName = rAsset->getMaterialName(submeshIndex);
std::ostringstream materialPath;
materialPath << m_materialsDir << "\\" << materialName;
std::string texturePath = getTextureFromMaterial(materialPath.str().c_str());
materialPathes.push_back(texturePath);
+ meshData.submeshNames[submeshIndex] = materialPathes[submeshIndex].c_str();
}
}
struct vc3Comp
@@ -138,7 +173,7 @@ bool ApexDestructibleGeometryExporter::exportToFile(NvBlastAsset* asset, const D
// gather data for export
{
- for (uint32_t submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex)
+ for (uint32_t submeshIndex = 0; submeshIndex < meshData.submeshCount; ++submeshIndex)
{
const RenderSubmesh& currentSubmesh = rAsset->getSubmesh(submeshIndex);
uint32_t indexCount = currentSubmesh.getVertexBuffer().getVertexCount();
@@ -178,7 +213,7 @@ bool ApexDestructibleGeometryExporter::exportToFile(NvBlastAsset* asset, const D
}
}
- for (uint32_t submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex)
+ for (uint32_t submeshIndex = 0; submeshIndex < meshData.submeshCount; ++submeshIndex)
{
const RenderSubmesh& currentSubmesh = rAsset->getSubmesh(submeshIndex);
uint32_t indexCount = currentSubmesh.getVertexBuffer().getVertexCount();
@@ -218,7 +253,7 @@ bool ApexDestructibleGeometryExporter::exportToFile(NvBlastAsset* asset, const D
}
}
- for (uint32_t submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex)
+ for (uint32_t submeshIndex = 0; submeshIndex < meshData.submeshCount; ++submeshIndex)
{
const RenderSubmesh& currentSubmesh = rAsset->getSubmesh(submeshIndex);
uint32_t indexCount = currentSubmesh.getVertexBuffer().getVertexCount();
@@ -257,57 +292,126 @@ bool ApexDestructibleGeometryExporter::exportToFile(NvBlastAsset* asset, const D
texturesMapping[oldSize + i] = it->second;
}
}
-
+ }
+ for (uint32_t i = 0; i < compressedTextures.size(); ++i)
+ {
+ std::swap(compressedTextures[i].x, compressedTextures[i].y);
}
- uint32_t apexChunkCount = apexAsset.getChunkCount();
- uint32_t chunkCount = static_cast<uint32_t>(chunkReorderInvMap.size());
-
- std::vector<std::vector<std::vector<int32_t> > > pInd(chunkCount);
- std::vector<std::vector<std::vector<int32_t> > > tInd(chunkCount);
- std::vector<std::vector<std::vector<int32_t> > > nInd(chunkCount);
+ meshData.positionsCount = (uint32_t)compressedPositions.size();
+ //meshData.positions = compressedPositions.data();
+ meshData.positions = new PxVec3[meshData.positionsCount];
+ memcpy(meshData.positions, compressedPositions.data(), sizeof(PxVec3) * meshData.positionsCount);
+ meshData.normalsCount = (uint32_t)compressedNormals.size();
+ //meshData.normals = compressedNormals.data();
+ meshData.normals = new PxVec3[meshData.normalsCount];
+ memcpy(meshData.normals, compressedNormals.data(), sizeof(PxVec3) * meshData.normalsCount);
+ meshData.uvsCount = (uint32_t)compressedTextures.size();
+ //meshData.uvs = compressedTextures.data();
+ meshData.uvs = new PxVec2[meshData.uvsCount];
+ memcpy(meshData.uvs, compressedTextures.data(), sizeof(PxVec2) * meshData.uvsCount);
- for (uint32_t chunkIndex = 0; chunkIndex < chunkCount; ++chunkIndex)
+ uint32_t apexChunkCount = apexAsset.getChunkCount();
+ meshData.meshCount = (uint32_t)chunkReorderInvMap.size();
+ meshData.submeshOffsets = new uint32_t[meshData.meshCount * meshData.submeshCount + 1]{ 0 };
+
+ //count total number of indices
+ for (uint32_t chunkIndex = 0; chunkIndex < meshData.meshCount; ++chunkIndex)
+ {
+ uint32_t apexChunkIndex = chunkReorderInvMap[chunkIndex];
+ if (apexChunkIndex >= apexChunkCount)
+ {
+ PX_ALWAYS_ASSERT();
+ continue;
+ }
+ uint32_t part = apexAsset.getPartIndex(apexChunkIndex);
+ for (uint32_t submeshIndex = 0; submeshIndex < meshData.submeshCount; ++submeshIndex)
+ {
+ uint32_t indexCount = rAsset->getSubmesh(submeshIndex).getIndexCount(part);
+ uint32_t* firstIdx = meshData.submeshOffsets + chunkIndex * meshData.submeshCount + submeshIndex;
+ *(firstIdx + 1) = *firstIdx + indexCount;
+ }
+ }
+ meshData.posIndex = new uint32_t[meshData.submeshOffsets[meshData.meshCount * meshData.submeshCount]];
+ meshData.normIndex = new uint32_t[meshData.submeshOffsets[meshData.meshCount * meshData.submeshCount]];
+ meshData.texIndex = new uint32_t[meshData.submeshOffsets[meshData.meshCount * meshData.submeshCount]];
+ //copy indices
+ for (uint32_t chunkIndex = 0; chunkIndex < meshData.meshCount; ++chunkIndex)
{
uint32_t apexChunkIndex = chunkReorderInvMap[chunkIndex];
if (apexChunkIndex >= apexChunkCount)
{
+ PX_ALWAYS_ASSERT();
continue;
}
uint32_t part = apexAsset.getPartIndex(apexChunkIndex);
uint32_t offset = 0;
- for (uint32_t submeshIndex = 0; submeshIndex < submeshCount; ++submeshIndex)
+ for (uint32_t submeshIndex = 0; submeshIndex < meshData.submeshCount; ++submeshIndex)
{
const RenderSubmesh& currentSubmesh = rAsset->getSubmesh(submeshIndex);
const uint32_t* indexArray = currentSubmesh.getIndexBuffer(part);
uint32_t indexCount = currentSubmesh.getIndexCount(part);
- pInd[chunkIndex].push_back(std::vector<int32_t>());
- tInd[chunkIndex].push_back(std::vector<int32_t>());
- nInd[chunkIndex].push_back(std::vector<int32_t>());
+ uint32_t firstIdx = meshData.submeshOffsets[chunkIndex * meshData.submeshCount + submeshIndex];
for (uint32_t i = 0; i < indexCount;++i)
{
- pInd[chunkIndex].back().push_back(positionsMapping[indexArray[i] + offset]);
- tInd[chunkIndex].back().push_back(texturesMapping[indexArray[i] + offset]);
- nInd[chunkIndex].back().push_back(normalsMapping[indexArray[i] + offset]);
+ meshData.posIndex[firstIdx + i] = positionsMapping[indexArray[i] + offset];
+ meshData.normIndex[firstIdx + i] = normalsMapping[indexArray[i] + offset];
+ meshData.texIndex[firstIdx + i] = texturesMapping[indexArray[i] + offset];
}
offset += currentSubmesh.getVertexBuffer().getVertexCount();
}
}
+
+ if (!hulls.empty())
+ {
+ meshData.hullsOffsets = new uint32_t[hulls.size() + 1]{ 0 };
+ for (uint32_t i = 0; i < hulls.size(); i++)
+ {
+ meshData.hullsOffsets[i + 1] = meshData.hullsOffsets[i] + (uint32_t)hulls[i].size();
+ }
+ meshData.hulls = new CollisionHull*[meshData.hullsOffsets[hulls.size()]];
+ for (uint32_t i = 0; i < hulls.size(); i++)
+ {
+ for (uint32_t j = 0; j < hulls[i].size(); j++)
+ {
+ meshData.hulls[meshData.hullsOffsets[i] + j] = hulls[i][j];
+ }
+ }
+ }
+ else
+ {
+ meshData.hulls = nullptr;
+ meshData.hullsOffsets = nullptr;
+ }
if (toObj)
{
- ObjFileWriter writer;
- writer.saveToFile(asset, name, m_exportDir, compressedPositions, compressedNormals, compressedTextures, pInd, nInd, tInd, materialPathes, submeshCount);
+ IMeshFileWriter* fileWriter = NvBlastExtExporterCreateObjFileWriter();
+ fileWriter->appendMesh(meshData, name.c_str());
+ fileWriter->saveToFile(name.c_str(), m_exportDir.c_str());
+ fileWriter->release();
+ //writer.saveToFile(asset, name, m_exportDir, compressedPositions, compressedNormals, compressedTextures, pInd, nInd, tInd, materialPathes, submeshCount);
}
if (toFbx)
{
- FbxFileWriter writer;
- writer.bOutputFBXAscii = fbxascii;
- writer.setConvertToUE4(toUe4);
- writer.saveToFile(asset, name, m_exportDir, compressedPositions, compressedNormals, compressedTextures, pInd, nInd, tInd, materialPathes, submeshCount);
+ IMeshFileWriter* fileWriter = NvBlastExtExporterCreateFbxFileWriter(fbxascii);
+ fileWriter->appendMesh(meshData, name.c_str(), nonSkinned);
+ fileWriter->saveToFile(name.c_str(), m_exportDir.c_str());
+ fileWriter->release();
}
+
+ delete[] meshData.hulls;
+ delete[] meshData.hullsOffsets;
+ delete[] meshData.normals;
+ delete[] meshData.normIndex;
+ delete[] meshData.posIndex;
+ delete[] meshData.positions;
+ delete[] meshData.submeshOffsets;
+ delete[] meshData.texIndex;
+ delete[] meshData.submeshNames;
+ delete[] meshData.uvs;
}
return true;
diff --git a/tools/ApexImporter/src/ApexDestructibleObjExporter.h b/tools/ApexImporter/src/ApexDestructibleObjExporter.h
index cd6f238..f5ead5c 100644
--- a/tools/ApexImporter/src/ApexDestructibleObjExporter.h
+++ b/tools/ApexImporter/src/ApexDestructibleObjExporter.h
@@ -1,10 +1,38 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2017 NVIDIA Corporation. All rights reserved.
+
+
#ifndef OBJ_APEX_EXPORTER_H
#define OBJ_APEX_EXPORTER_H
#include <string>
#include <vector>
#include "DestructibleAsset.h"
-
+#include <NvBlastExtAuthoringCollisionBuilder.h>
@@ -27,7 +55,9 @@ public:
ApexDestructibleGeometryExporter(std::string materialsDir, std::string exportDir) : m_materialsDir(materialsDir), m_exportDir(exportDir)
{}
- bool exportToFile(NvBlastAsset* asset, const nvidia::apex::DestructibleAsset& apexAsset, const std::string& name, const std::vector<uint32_t>& chunkReorderInvMap, bool toFbx, bool toObj, bool fbxascii, bool toUe4);
+ bool exportToFile(NvBlastAsset* asset, const nvidia::apex::DestructibleAsset& apexAsset, const std::string& name,
+ const std::vector<uint32_t>& chunkReorderInvMap, bool toFbx, bool toObj, bool fbxascii, bool nonSkinned,
+ const std::vector<std::vector<CollisionHull*> >& hulls = std::vector<std::vector<CollisionHull*> >());
private:
ApexDestructibleGeometryExporter& operator=(const ApexDestructibleGeometryExporter&)
diff --git a/tools/ApexImporter/src/Main.cpp b/tools/ApexImporter/src/Main.cpp
index 157e923..6479d72 100644
--- a/tools/ApexImporter/src/Main.cpp
+++ b/tools/ApexImporter/src/Main.cpp
@@ -1,3 +1,30 @@
+// This code contains NVIDIA Confidential Information and is disclosed to you
+// under a form of NVIDIA software license agreement provided separately to you.
+//
+// Notice
+// NVIDIA Corporation and its licensors retain all intellectual property and
+// proprietary rights in and to this software and related documentation and
+// any modifications thereto. Any use, reproduction, disclosure, or
+// distribution of this software and related documentation without an express
+// license agreement from NVIDIA Corporation is strictly prohibited.
+//
+// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
+// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
+// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
+// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
+//
+// Information and code furnished is believed to be accurate and reliable.
+// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
+// information or for any infringement of patents or other rights of third parties that may
+// result from its use. No license is granted by implication or otherwise under any patent
+// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
+// This code supersedes and replaces all information previously supplied.
+// NVIDIA Corporation products are not authorized for use as critical
+// components in life support devices or systems without express written approval of
+// NVIDIA Corporation.
+//
+// Copyright (c) 2016-2017 NVIDIA Corporation. All rights reserved.
+
#if NV_VC
#pragma warning(push)
@@ -13,14 +40,19 @@
#include "Log.h"
#include <string>
#include <iostream>
+#include <fstream>
#include "tclap/CmdLine.h"
#include "ApexDestructibleObjExporter.h"
#include "NvBlastTkFramework.h"
+#include "NvBlastGlobals.h"
#include "NvBlastExtPxAsset.h"
#include "NvBlastExtPxManager.h"
-#include <BlastDataExporter.h>
+#include "BlastDataExporter.h"
#include "windows.h"
#include <NvBlastTkAsset.h>
+#include "NvBlastExtLlSerialization.h"
+#include "NvBlastExtTkSerialization.h"
+#include "NvBlastExtPxSerialization.h"
#define DEFAULT_INPUT_FILE "../../../tools/ApexImporter/resources/assets/table.apb"
#define DEFAULT_OUTPUT_DIR "C:/TestFracturer/"
#define DEFAULT_ASSET_NAME "table"
@@ -63,12 +95,12 @@ bool mkDirRecursively(std::string path)
}
// Create an Asset from the APEX destructible asset
-void run(const std::string& inFilepath, const std::string& outDir, const std::string& assetName, uint32_t mode, bool llFlag, bool tkFlag, bool extPxFlag, bool obj, bool fbx, bool fbxascii, bool ue4)
+void run(const std::string& inFilepath, const std::string& outDir, const std::string& assetName, uint32_t mode, bool llFlag, bool tkFlag, bool extPxFlag, bool obj, bool fbx, bool fbxascii, bool fbxCollision, bool nonSkinned)
{
std::string inputDir = inFilepath.substr(0, inFilepath.find_last_of("/\\"));
// load APEX
- ApexImportTool blast(loggingCallback);
+ ApexImportTool blast;
lout() << Log::TYPE_INFO << "ApexImportTool initialization" << std::endl;
blast.initialize();
@@ -92,12 +124,7 @@ void run(const std::string& inFilepath, const std::string& outDir, const std::st
config.infSearchMode = static_cast<ApexImporterConfig::InterfaceSearchMode>(mode);
std::vector<uint32_t> chunkReorderInvMap;
- TkFrameworkDesc frameworkDesc =
- {
- nvidia::apex::GetApexSDK()->getErrorCallback(),
- nvidia::apex::GetApexSDK()->getAllocator()
- };
- TkFramework* framework = NvBlastTkFrameworkCreate(frameworkDesc);
+ TkFramework* framework = NvBlastTkFrameworkCreate();
if (framework == nullptr)
{
lout() << Log::TYPE_ERROR << "Failed to create TkFramework" << std::endl;
@@ -117,8 +144,8 @@ void run(const std::string& inFilepath, const std::string& outDir, const std::st
lout() << Log::TYPE_ERROR << "Failed to build Blast asset data" << std::endl;
return;
};
-
- result = blast.getCollisionGeometry(apexAsset, static_cast<uint32_t>(chunkDesc.size()), chunkReorderInvMap, flags, physicsChunks, physicsSubchunks);
+ std::vector<std::vector<CollisionHull*>> hulls;
+ result = blast.getCollisionGeometry(apexAsset, static_cast<uint32_t>(chunkDesc.size()), chunkReorderInvMap, flags, physicsChunks, physicsSubchunks, hulls);
if (!result)
{
lout() << Log::TYPE_ERROR << "Failed to build physics data" << std::endl;
@@ -128,7 +155,7 @@ void run(const std::string& inFilepath, const std::string& outDir, const std::st
// save asset
lout() << Log::TYPE_INFO << "Saving blast asset: " << outDir << std::endl;
- BlastDataExporter blExpr(framework, nvidia::apex::GetApexSDK()->getCookingInterface(), loggingCallback);
+ BlastDataExporter blExpr(framework, nvidia::apex::GetApexSDK()->getPhysXSDK(), nvidia::apex::GetApexSDK()->getCookingInterface());
NvBlastAsset* llAsset = blExpr.createLlBlastAsset(bondDescs, chunkDesc);
std::cout <<"Chunk count: " << NvBlastAssetGetChunkCount(llAsset, NULL) << std::endl;
@@ -141,37 +168,32 @@ void run(const std::string& inFilepath, const std::string& outDir, const std::st
if (llFlag)
{
- std::ostringstream outBlastFilePathStream;
- outBlastFilePathStream << outDir << "/" << assetName << ".llasset";
- std::string outBlastFilePath = outBlastFilePathStream.str();
- blExpr.saveBlastLLAsset(outBlastFilePath, llAsset);
- std::cout << "Wrote NvBlastAsset to " << outBlastFilePath << std::endl;
+ blExpr.saveBlastObject(outDir, assetName, llAsset, LlObjectTypeID::Asset);
}
if (tkFlag)
{
TkAsset* tkAsset = blExpr.createTkBlastAsset(bondDescs, chunkDesc);
- std::ostringstream outBlastFilePathStream;
- outBlastFilePathStream << outDir << "/" << assetName << ".tkasset";
- std::string outBlastFilePath = outBlastFilePathStream.str();
- blExpr.saveBlastTkAsset(outBlastFilePath, tkAsset);
- std::cout << "Wrote TkAsset to " << outBlastFilePath << std::endl;
+ blExpr.saveBlastObject(outDir, assetName, tkAsset, TkObjectTypeID::Asset);
tkAsset->release();
}
if (extPxFlag)
{
ExtPxAsset* pxAsset = blExpr.createExtBlastAsset(bondDescs, chunkDesc, physicsChunks);
- std::ostringstream outBlastFilePathStream;
- outBlastFilePathStream << outDir << "/" << assetName << ".bpxa";
- std::string outBlastFilePath = outBlastFilePathStream.str();
- blExpr.saveBlastExtAsset(outBlastFilePath, pxAsset);
- std::cout << "Wrote ExtPxAsset to " << outBlastFilePath << std::endl;
+ blExpr.saveBlastObject(outDir, assetName, pxAsset, ExtPxObjectTypeID::Asset);
pxAsset->release();
}
lout() << Log::TYPE_INFO << "Saving model file: " << outDir << std::endl;
ApexDestructibleGeometryExporter objSaver(inputDir, outDir);
- objSaver.exportToFile(llAsset, *apexAsset, assetName, chunkReorderInvMap, fbx, obj, fbxascii, ue4);
- _aligned_free(llAsset);
+ if (fbxCollision)
+ {
+ objSaver.exportToFile(llAsset, *apexAsset, assetName, chunkReorderInvMap, fbx, obj, fbxascii, nonSkinned, hulls);
+ }
+ else
+ {
+ objSaver.exportToFile(llAsset, *apexAsset, assetName, chunkReorderInvMap, fbx, obj, fbxascii, nonSkinned);
+ }
+ NVBLAST_FREE(llAsset);
}
@@ -206,9 +228,6 @@ int main(int argc, const char* const* argv)
TCLAP::SwitchArg llOutputArg("", "ll", "Output LL Blast asset to the output directory (ext: llasset)", false);
cmd.add(llOutputArg);
- TCLAP::SwitchArg ue4OutputArg("", "ue4", "Output FBX with UE4 coordinate system", false);
- cmd.add(ue4OutputArg);
-
TCLAP::SwitchArg fbxAsciiArg("", "fbxascii", "Output FBX as an ascii file (defaults to binary output)", false);
cmd.add(fbxAsciiArg);
@@ -218,6 +237,11 @@ int main(int argc, const char* const* argv)
TCLAP::SwitchArg fbxOutputArg("", "fbx", "Output a FBX mesh to the output directory", false);
cmd.add(fbxOutputArg);
+ TCLAP::SwitchArg fbxcollision("", "fbxcollision", "Append collision geometry to FBX file", false);
+ cmd.add(fbxcollision);
+
+ TCLAP::SwitchArg nonSkinnedFBX("", "nonskinned", "Output a non-skinned FBX file", false);
+ cmd.add(nonSkinnedFBX);
// parse cmd input
cmd.parse(argc, argv);
@@ -226,12 +250,13 @@ int main(int argc, const char* const* argv)
bool bOutputTK = tkOutputArg.getValue();
bool bOutputLL = llOutputArg.getValue();
- bool bUE4CoordSystem = ue4OutputArg.isSet();
bool bOutputFBXAscii = fbxAsciiArg.isSet();
bool bOutputObjFile = objOutputArg.isSet();
bool bOutputFbxFile = fbxOutputArg.isSet();
+ bool bFbxCollision = fbxcollision.isSet();
+ bool bNonSkinned = nonSkinnedFBX.isSet();
// Did we specify no output formats?
if (!bpxaOutputArg.isSet() && !tkOutputArg.isSet() && !llOutputArg.isSet())
@@ -287,7 +312,7 @@ int main(int argc, const char* const* argv)
if (debug)
lout().setMinVerbosity(Log::MOST_VERBOSE);
- run(infile, outDir, assetName, mode, bOutputLL, bOutputTK, bOutputBPXA, bOutputObjFile, bOutputFbxFile, bOutputFBXAscii, bUE4CoordSystem);
+ run(infile, outDir, assetName, mode, bOutputLL, bOutputTK, bOutputBPXA, bOutputObjFile, bOutputFbxFile, bOutputFBXAscii, bFbxCollision, bNonSkinned);
}
catch (TCLAP::ArgException &e) // catch any exceptions
{