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 "NvBlastExtPxCollisionBuilder.h"
00037 #include <nvparameterized\NvSerializer.h>
00038 #include <NvBlastExtExporter.h>
00039
00040 namespace physx
00041 {
00042 class PxFoundation;
00043 class PxPhysics;
00044 class PxCooking;
00045
00046 namespace general_PxIOStream2
00047 {
00048 class PxFileBuf;
00049 }
00050 }
00051
00052 namespace NvParameterized
00053 {
00054 class Interface;
00055 }
00056
00057 namespace nvidia
00058 {
00059 namespace apex
00060 {
00061 class ApexSDK;
00062 class ModuleDestructible;
00063 class DestructibleAsset;
00064 }
00065 using namespace physx::general_PxIOStream2;
00066 }
00067
00068
00069 namespace Nv
00070 {
00071 namespace Blast
00072 {
00073
00074 struct CollisionHull;
00075 class TkFramework;
00076
00077 namespace ApexImporter
00078 {
00079
00080 struct ApexImporterConfig
00081 {
00091 enum InterfaceSearchMode { EXACT, FORCED, MODE_COUNT };
00092
00093 ApexImporterConfig()
00094 {
00095 setDefaults();
00096 }
00097
00098 void setDefaults()
00099 {
00100 infSearchMode = EXACT;
00101 }
00102 InterfaceSearchMode infSearchMode;
00103 };
00104
00105
00106 class ApexDestruction;
00107
00108
00112 class ApexImportTool
00113 {
00114 public:
00115 ApexImportTool();
00116 ~ApexImportTool();
00117
00123 bool loadAssetFromFile(nvidia::PxFileBuf* stream, NvParameterized::Serializer::DeserializedData& data);
00124
00125
00136 bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00137 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags);
00138
00150 bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00151 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags,
00152 const ApexImporterConfig& config);
00153
00157 bool importRendermesh(const std::vector<uint32_t>& chunkReorderInvMap, const NvParameterized::Interface* assetNvIfc, Nv::Blast::ExporterMeshData* outputData, const char* materialsDir);
00158
00159
00166 bool saveAsset(const NvBlastAsset* asset, nvidia::PxFileBuf* stream);
00167
00179 bool getCollisionGeometry(const NvParameterized::Interface* assetPrm, uint32_t chunkCount, std::vector<uint32_t>& chunkReorderInvMap,
00180 const std::vector<uint32_t>& apexChunkFlags, std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks,
00181 std::vector<ExtPxAssetDesc::SubchunkDesc>& physicsSubchunks, std::vector<std::vector<CollisionHull*> >& hullsDesc);
00182
00183 const ExtPxCollisionBuilder* getCollisionBuilder() const
00184 {
00185 return m_collisionBuilder;
00186 }
00187
00189
00190 bool isValid();
00191
00192 physx::PxPhysics* getPxSdk() { return m_PhysxSDK; }
00193 physx::PxCooking* getCooking() { return m_Cooking; };
00194
00195 private:
00196 bool importApexAssetInternal(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
00197 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDesc, std::vector<uint32_t>& flags,
00198 const ApexImporterConfig& configDesc);
00199
00200 protected:
00201 ApexImportTool(const ApexImportTool&);
00202 ApexImportTool& operator=(const ApexImportTool&);
00203
00204 physx::PxFoundation* m_Foundation;
00205 physx::PxPhysics* m_PhysxSDK;
00206 physx::PxCooking* m_Cooking;
00207
00208 ExtPxCollisionBuilder* m_collisionBuilder;
00209 };
00210
00211 }
00212
00213 }
00214 }
00215
00216 #endif // NVBLASTEXTAPEXIMPORTTOOL_H