00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef NVBLASTEXTAPEXIMPORTTOOL_H
00030 #define NVBLASTEXTAPEXIMPORTTOOL_H
00031
00032 #include "NvBlast.h"
00033 #include <vector>
00034 #include <string>
00035 #include "NvBlastExtPxAsset.h"
00036 #include <nvparameterized\NvSerializer.h>
00037 #include <NvBlastExtExporter.h>
00038
00039 namespace physx
00040 {
00041 class PxFoundation;
00042 class PxPhysics;
00043 class PxCooking;
00044
00045 namespace general_PxIOStream2
00046 {
00047 class PxFileBuf;
00048 }
00049 }
00050
00051 namespace NvParameterized
00052 {
00053 class Interface;
00054 }
00055
00056 namespace nvidia
00057 {
00058 namespace apex
00059 {
00060 class ApexSDK;
00061 class ModuleDestructible;
00062 class DestructibleAsset;
00063 }
00064 using namespace physx::general_PxIOStream2;
00065 }
00066
00067
00068 namespace Nv
00069 {
00070 namespace Blast
00071 {
00072
00073 struct CollisionHull;
00074 class TkFramework;
00075
00076 namespace ApexImporter
00077 {
00078
00079 struct ApexImporterConfig
00080 {
00090 enum InterfaceSearchMode { EXACT, FORCED, MODE_COUNT };
00091
00092 ApexImporterConfig()
00093 {
00094 setDefaults();
00095 }
00096
00097 void setDefaults()
00098 {
00099 infSearchMode = EXACT;
00100 }
00101 InterfaceSearchMode infSearchMode;
00102 };
00103
00104
00105 class ApexDestruction;
00106
00107
00111 class ApexImportTool
00112 {
00113 public:
00114 ApexImportTool();
00115 ~ApexImportTool();
00116
00122 bool loadAssetFromFile(nvidia::PxFileBuf* stream, NvParameterized::Serializer::DeserializedData& data);
00123
00124
00135 bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00136 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags);
00137
00149 bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00150 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags,
00151 const ApexImporterConfig& config);
00152
00156 bool importRendermesh(const std::vector<uint32_t>& chunkReorderInvMap, const NvParameterized::Interface* assetNvIfc, Nv::Blast::ExporterMeshData* outputData, const char* materialsDir);
00157
00158
00165 bool saveAsset(const NvBlastAsset* asset, nvidia::PxFileBuf* stream);
00166
00178 bool getCollisionGeometry(const NvParameterized::Interface* assetPrm, uint32_t chunkCount, std::vector<uint32_t>& chunkReorderInvMap,
00179 const std::vector<uint32_t>& apexChunkFlags, std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks,
00180 std::vector<ExtPxAssetDesc::SubchunkDesc>& physicsSubchunks, std::vector<std::vector<CollisionHull*> >& hullsDesc);
00181
00183
00184 bool isValid();
00185
00186 physx::PxPhysics* getPxSdk() { return m_PhysxSDK; }
00187 physx::PxCooking* getCooking() { return m_Cooking; };
00188
00189 private:
00190 bool importApexAssetInternal(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00191 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDesc, std::vector<uint32_t>& flags,
00192 const ApexImporterConfig& configDesc);
00193
00194 protected:
00195 ApexImportTool(const ApexImportTool&);
00196 ApexImportTool& operator=(const ApexImportTool&);
00197
00198 physx::PxFoundation* m_Foundation;
00199 physx::PxPhysics* m_PhysxSDK;
00200 physx::PxCooking* m_Cooking;
00201
00202 };
00203
00204 }
00205
00206 }
00207 }
00208
00209 #endif // NVBLASTEXTAPEXIMPORTTOOL_H