00001 // This code contains NVIDIA Confidential Information and is disclosed to you 00002 // under a form of NVIDIA software license agreement provided separately to you. 00003 // 00004 // Notice 00005 // NVIDIA Corporation and its licensors retain all intellectual property and 00006 // proprietary rights in and to this software and related documentation and 00007 // any modifications thereto. Any use, reproduction, disclosure, or 00008 // distribution of this software and related documentation without an express 00009 // license agreement from NVIDIA Corporation is strictly prohibited. 00010 // 00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES 00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO 00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, 00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. 00015 // 00016 // Information and code furnished is believed to be accurate and reliable. 00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such 00018 // information or for any infringement of patents or other rights of third parties that may 00019 // result from its use. No license is granted by implication or otherwise under any patent 00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice. 00021 // This code supersedes and replaces all information previously supplied. 00022 // NVIDIA Corporation products are not authorized for use as critical 00023 // components in life support devices or systems without express written approval of 00024 // NVIDIA Corporation. 00025 // 00026 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved. 00027 00028 00029 #ifndef NVBLASTEXTPXASSET_H 00030 #define NVBLASTEXTPXASSET_H 00031 00032 #include "NvBlastTkFramework.h" 00033 #include "PxConvexMeshGeometry.h" 00034 #include "PxTransform.h" 00035 #include "NvBlastPreprocessor.h" 00036 00037 00038 // Forward declarations 00039 namespace physx 00040 { 00041 class PxCooking; 00042 00043 namespace general_PxIOStream2 00044 { 00045 class PxFileBuf; 00046 } 00047 } 00048 00049 class NvBlastExtDamageAccelerator; 00050 00051 00052 namespace Nv 00053 { 00054 namespace Blast 00055 { 00056 00057 00064 struct ExtPxAssetDesc : public TkAssetDesc 00065 { 00071 struct SubchunkDesc 00072 { 00073 physx::PxTransform transform; 00074 physx::PxConvexMeshGeometry geometry; 00075 }; 00076 00082 struct ChunkDesc 00083 { 00084 SubchunkDesc* subchunks; 00085 uint32_t subchunkCount; 00086 bool isStatic; 00087 }; 00088 00089 ChunkDesc* pxChunks; 00090 }; 00091 00092 00098 struct ExtPxSubchunk 00099 { 00100 physx::PxTransform transform; 00101 physx::PxConvexMeshGeometry geometry; 00102 }; 00103 00104 00110 struct ExtPxChunk 00111 { 00112 uint32_t firstSubchunkIndex; 00113 uint32_t subchunkCount; 00114 bool isStatic; 00115 }; 00116 00117 00123 class NV_DLL_EXPORT ExtPxAsset 00124 { 00125 public: 00126 00135 static ExtPxAsset* create(const ExtPxAssetDesc& desc, TkFramework& framework); 00136 00145 static ExtPxAsset* create(const TkAssetDesc& desc, ExtPxChunk* pxChunks, ExtPxSubchunk* pxSubchunks, TkFramework& framework); 00146 00147 00148 /* 00149 Factory method for deserialization 00150 00151 Doesn't specify chunks or subchunks as they'll be fed in during deserialization to avoid copying stuff around. 00152 00153 */ 00154 static ExtPxAsset* create(TkAsset* asset); 00155 00156 /* 00157 Create a new ExtPxAsset. 00158 00159 \param[in] asset TkAsset from which ExtPxAsset will be created 00160 \param[in] chunks Array of physics chunks descriptors 00161 \param[in] chunkCount Size of chunks descriptors array 00162 00163 00164 \return the new ExtPxAsset if successful, NULL otherwise. 00165 00166 */ 00167 static ExtPxAsset* create(TkAsset* asset, ExtPxAssetDesc::ChunkDesc* chunks, uint32_t chunkCount); 00168 00172 virtual void release() = 0; 00173 00179 virtual const TkAsset& getTkAsset() const = 0; 00180 00186 virtual uint32_t getChunkCount() const = 0; 00187 00193 virtual const ExtPxChunk* getChunks() const = 0; 00194 00201 virtual uint32_t getSubchunkCount() const = 0; 00202 00208 virtual const ExtPxSubchunk* getSubchunks() const = 0; 00209 00223 virtual NvBlastActorDesc& getDefaultActorDesc() = 0; 00224 00225 virtual const NvBlastActorDesc& getDefaultActorDesc() const = 0; 00226 00230 virtual void setUniformHealth(bool enabled) = 0; 00231 00235 virtual void setAccelerator(NvBlastExtDamageAccelerator* accelerator) = 0; 00236 00240 virtual NvBlastExtDamageAccelerator* getAccelerator() const = 0; 00241 00245 void* userData; 00246 }; 00247 00248 00249 00250 } // namespace Blast 00251 } // namespace Nv 00252 00253 00254 #endif // ifndef NVBLASTEXTPXASSET_H