NvBlastExtPxAsset.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 NVBLASTEXTPXASSET_H
30 #define NVBLASTEXTPXASSET_H
31 
32 #include "NvBlastTkFramework.h"
33 #include "PxConvexMeshGeometry.h"
34 #include "PxTransform.h"
35 #include "NvBlastPreprocessor.h"
36 
37 
38 // Forward declarations
39 namespace physx
40 {
41 class PxCooking;
42 
43 namespace general_PxIOStream2
44 {
45 class PxFileBuf;
46 }
47 }
48 
50 
51 
52 namespace Nv
53 {
54 namespace Blast
55 {
56 
57 
64 struct ExtPxAssetDesc : public TkAssetDesc
65 {
71  struct SubchunkDesc
72  {
73  physx::PxTransform transform;
74  physx::PxConvexMeshGeometry geometry;
75  };
76 
82  struct ChunkDesc
83  {
85  uint32_t subchunkCount;
86  bool isStatic;
87  };
88 
90 };
91 
92 
99 {
100  physx::PxTransform transform;
101  physx::PxConvexMeshGeometry geometry;
102 };
103 
104 
111 {
113  uint32_t subchunkCount;
114  bool isStatic;
115 };
116 
117 
123 class NV_DLL_EXPORT ExtPxAsset
124 {
125 public:
126 
135  static ExtPxAsset* create(const ExtPxAssetDesc& desc, TkFramework& framework);
136 
145  static ExtPxAsset* create(const TkAssetDesc& desc, ExtPxChunk* pxChunks, ExtPxSubchunk* pxSubchunks, TkFramework& framework);
146 
147 
148  /*
149  Factory method for deserialization
150 
151  Doesn't specify chunks or subchunks as they'll be fed in during deserialization to avoid copying stuff around.
152 
153  */
154  static ExtPxAsset* create(TkAsset* asset);
155 
156  /*
157  Create a new ExtPxAsset.
158 
159  \param[in] asset TkAsset from which ExtPxAsset will be created
160  \param[in] chunks Array of physics chunks descriptors
161  \param[in] chunkCount Size of chunks descriptors array
162 
163 
164  \return the new ExtPxAsset if successful, NULL otherwise.
165 
166  */
167  static ExtPxAsset* create(TkAsset* asset, ExtPxAssetDesc::ChunkDesc* chunks, uint32_t chunkCount);
168 
172  virtual void release() = 0;
173 
179  virtual const TkAsset& getTkAsset() const = 0;
180 
186  virtual uint32_t getChunkCount() const = 0;
187 
193  virtual const ExtPxChunk* getChunks() const = 0;
194 
201  virtual uint32_t getSubchunkCount() const = 0;
202 
208  virtual const ExtPxSubchunk* getSubchunks() const = 0;
209 
223  virtual NvBlastActorDesc& getDefaultActorDesc() = 0;
224 
225  virtual const NvBlastActorDesc& getDefaultActorDesc() const = 0;
226 
230  virtual void setUniformHealth(bool enabled) = 0;
231 
235  virtual void setAccelerator(NvBlastExtDamageAccelerator* accelerator) = 0;
236 
240  virtual NvBlastExtDamageAccelerator* getAccelerator() const = 0;
241 
245  void* userData;
246 };
247 
248 
249 
250 } // namespace Blast
251 } // namespace Nv
252 
253 
254 #endif // ifndef NVBLASTEXTPXASSET_H
Definition: NvBlastExtApexImportTool.h:40
Definition: NvBlastTypes.h:395
Definition: NvBlastExtPxAsset.h:110
ChunkDesc * pxChunks
array of chunks in asset, should be of size chunkCount (
Definition: NvBlastExtPxAsset.h:89
Definition: NvBlastExtPxAsset.h:71
Definition: NvBlastTkAsset.h:59
Definition: NvBlastExtPxAsset.h:98
uint32_t subchunkCount
size array of subchunks for chunk, can be 0
Definition: NvBlastExtPxAsset.h:85
physx::PxTransform transform
convex local transform
Definition: NvBlastExtPxAsset.h:100
Definition: NvBlastTkFramework.h:74
physx::PxConvexMeshGeometry geometry
convex geometry
Definition: NvBlastExtPxAsset.h:74
Definition: NvBlastExtPxAsset.h:123
Definition: NvBlastExtDamageShaders.h:45
bool isStatic
is chunk static (kinematic)?.
Definition: NvBlastExtPxAsset.h:114
Definition: NvBlastExtPxAsset.h:64
uint32_t firstSubchunkIndex
first Subchunk index in Subchunk's array in ExtPhyicsAsset
Definition: NvBlastExtPxAsset.h:112
uint32_t subchunkCount
Subchunk count. Can be 0.
Definition: NvBlastExtPxAsset.h:113
Definition: NvBlastExtPxAsset.h:82
SubchunkDesc * subchunks
array of subchunks for chunk, can be empty
Definition: NvBlastExtPxAsset.h:84
bool isStatic
is chunk static. Static chunk makes PxActor Kinematic.
Definition: NvBlastExtPxAsset.h:86
physx::PxTransform transform
convex local transform
Definition: NvBlastExtPxAsset.h:73
Definition: NvBlastTkFramework.h:160
void * userData
Definition: NvBlastExtPxAsset.h:245
physx::PxConvexMeshGeometry geometry
convex geometry
Definition: NvBlastExtPxAsset.h:101
Definition: NvBlastExtAuthoring.h:34