Main Page Class List Class Members

NvBlastExtApexImportTool.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed to you
2 // under a form of NVIDIA software license agreement provided separately to you.
3 //
4 // Notice
5 // NVIDIA Corporation and its licensors retain all intellectual property and
6 // proprietary rights in and to this software and related documentation and
7 // any modifications thereto. Any use, reproduction, disclosure, or
8 // distribution of this software and related documentation without an express
9 // license agreement from NVIDIA Corporation is strictly prohibited.
10 //
11 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
12 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
13 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
14 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
15 //
16 // Information and code furnished is believed to be accurate and reliable.
17 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
18 // information or for any infringement of patents or other rights of third parties that may
19 // result from its use. No license is granted by implication or otherwise under any patent
20 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
21 // This code supersedes and replaces all information previously supplied.
22 // NVIDIA Corporation products are not authorized for use as critical
23 // components in life support devices or systems without express written approval of
24 // NVIDIA Corporation.
25 //
26 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
27
28
29 #ifndef NVBLASTEXTAPEXIMPORTTOOL_H
30 #define NVBLASTEXTAPEXIMPORTTOOL_H
31
32 #include "NvBlast.h"
33 #include <vector>
34 #include <string>
35 #include "NvBlastExtPxAsset.h"
36 #include "NvBlastExtPxCollisionBuilder.h"
37 #include <nvparameterized\NvSerializer.h>
38 #include <NvBlastExtExporter.h>
39
40 namespace physx
41 {
42 class PxFoundation;
43 class PxPhysics;
44 class PxCooking;
45
46 namespace general_PxIOStream2
47 {
48 class PxFileBuf;
49 }
50 }
51
52 namespace NvParameterized
53 {
54 class Interface;
55 }
56
57 namespace nvidia
58 {
59 namespace apex
60 {
61 class ApexSDK;
62 class ModuleDestructible;
63 class DestructibleAsset;
64 }
65 using namespace physx::general_PxIOStream2;
66 }
67
68
69 namespace Nv
70 {
71 namespace Blast
72 {
73
74 struct CollisionHull;
75 class TkFramework;
76
77 namespace ApexImporter
78 {
79
80 struct ApexImporterConfig
81 {
91 enum InterfaceSearchMode { EXACT, FORCED, MODE_COUNT };
92
93 ApexImporterConfig()
94 {
95 setDefaults();
96 }
97
98 void setDefaults()
99 {
100 infSearchMode = EXACT;
101 }
102 InterfaceSearchMode infSearchMode;
103 };
104
105
106 class ApexDestruction;
107
108
112 class ApexImportTool
113 {
114 public:
115 ApexImportTool();
116 ~ApexImportTool();
117
123 bool loadAssetFromFile(nvidia::PxFileBuf* stream, NvParameterized::Serializer::DeserializedData& data);
124
125
136 bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
137 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags);
138
150 bool importApexAsset(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
151 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDescriptors, std::vector<uint32_t>& flags,
152 const ApexImporterConfig& config);
153
157 bool importRendermesh(const std::vector<uint32_t>& chunkReorderInvMap, const NvParameterized::Interface* assetNvIfc, Nv::Blast::ExporterMeshData* outputData, const char* materialsDir);
158
159
166 bool saveAsset(const NvBlastAsset* asset, nvidia::PxFileBuf* stream);
167
179 bool getCollisionGeometry(const NvParameterized::Interface* assetPrm, uint32_t chunkCount, std::vector<uint32_t>& chunkReorderInvMap,
180 const std::vector<uint32_t>& apexChunkFlags, std::vector<ExtPxAssetDesc::ChunkDesc>& physicsChunks,
181 std::vector<ExtPxAssetDesc::SubchunkDesc>& physicsSubchunks, std::vector<std::vector<CollisionHull*> >& hullsDesc);
182
183 const ExtPxCollisionBuilder* getCollisionBuilder() const
184 {
185 return m_collisionBuilder;
186 }
187
189
190 bool isValid();
191
192 physx::PxPhysics* getPxSdk() { return m_PhysxSDK; }
193 physx::PxCooking* getCooking() { return m_Cooking; };
194
195 private:
196 bool importApexAssetInternal(std::vector<uint32_t>& chunkReorderInvMap, NvParameterized::Interface* assetNvIfc,
197 std::vector<NvBlastChunkDesc>& chunkDescriptors, std::vector<NvBlastBondDesc>& bondDesc, std::vector<uint32_t>& flags,
198 const ApexImporterConfig& configDesc);
199
200 protected:
201 ApexImportTool(const ApexImportTool&);
202 ApexImportTool& operator=(const ApexImportTool&);
203
204 physx::PxFoundation* m_Foundation;
205 physx::PxPhysics* m_PhysxSDK;
206 physx::PxCooking* m_Cooking;
207
208 ExtPxCollisionBuilder* m_collisionBuilder;
209 };
210
211 } // namespace ApexImporter
212
213 } // namespace Blast
214 } // namespace Nv
215
216 #endif // NVBLASTEXTAPEXIMPORTTOOL_H
physx
Definition: NvBlastExtApexImportTool.h:40
Nv::Blast::ApexImporter::ApexImporterConfig::ApexImporterConfig
ApexImporterConfig()
Definition: NvBlastExtApexImportTool.h:93
Nv::Blast::ApexImporter::ApexImporterConfig::infSearchMode
InterfaceSearchMode infSearchMode
Definition: NvBlastExtApexImportTool.h:102
NvBlast.h
Nv::Blast::ApexImporter::ApexImportTool
Definition: NvBlastExtApexImportTool.h:112
Nv::Blast::ApexImporter::ApexImportTool::getCooking
physx::PxCooking * getCooking()
Definition: NvBlastExtApexImportTool.h:193
NvBlastExtPxAsset.h
Nv::Blast::ApexImporter::ApexImportTool::m_collisionBuilder
ExtPxCollisionBuilder * m_collisionBuilder
Definition: NvBlastExtApexImportTool.h:208
Nv::Blast::ExtPxCollisionBuilder
Definition: NvBlastExtPxCollisionBuilder.h:52
NvBlastExtExporter.h
Nv::Blast::ApexImporter::ApexImporterConfig
Definition: NvBlastExtApexImportTool.h:80
Nv::Blast::ApexImporter::ApexImportTool::m_PhysxSDK
physx::PxPhysics * m_PhysxSDK
Definition: NvBlastExtApexImportTool.h:205
Nv::Blast::ApexImporter::ApexImporterConfig::setDefaults
void setDefaults()
Definition: NvBlastExtApexImportTool.h:98
Nv::Blast::ApexImporter::ApexImportTool::getCollisionBuilder
const ExtPxCollisionBuilder * getCollisionBuilder() const
Definition: NvBlastExtApexImportTool.h:183
nvidia
Definition: NvBlastExtApexImportTool.h:57
Nv::Blast::ExporterMeshData
Definition: NvBlastExtExporter.h:50
NvBlastAsset
Definition: NvBlastTypes.h:286
NvParameterized
Definition: NvBlastExtApexImportTool.h:52
Nv::Blast::ApexImporter::ApexImportTool::m_Foundation
physx::PxFoundation * m_Foundation
Definition: NvBlastExtApexImportTool.h:204
NvBlastExtPxCollisionBuilder.h
physx::general_PxIOStream2
Definition: NvBlastExtApexImportTool.h:46
Nv::Blast::ApexImporter::ApexImportTool::getPxSdk
physx::PxPhysics * getPxSdk()
Definition: NvBlastExtApexImportTool.h:192
Nv::Blast::ApexImporter::ApexImportTool::m_Cooking
physx::PxCooking * m_Cooking
Definition: NvBlastExtApexImportTool.h:206
Nv
Definition: NvBlastExtAuthoring.h:34
Nv::Blast::ApexImporter::ApexImporterConfig::InterfaceSearchMode
InterfaceSearchMode
Definition: NvBlastExtApexImportTool.h:91