Main Page   Class List   Class Members  

  • Main Page
  • User's Guide
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

sdk/extensions/physx/source/physics/NvBlastExtPxAssetImpl.h

Go to the documentation of this file.
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 NVBLASTEXTPXASSETIMPL_H
00030 #define NVBLASTEXTPXASSETIMPL_H
00031 
00032 #include "NvBlastExtPxAsset.h"
00033 #include "NvBlastArray.h"
00034 
00035 
00036 namespace Nv
00037 {
00038 namespace Blast
00039 {
00040 
00041 
00042 using namespace physx;
00043 using namespace general_PxIOStream2;
00044 
00045 
00046 // Macro to load a uint32_t (or larger) with four characters (move it in some shared header if it's used anywhere else in Ext)
00047 #define NVBLASTEXT_FOURCC(_a, _b, _c, _d)   ( (uint32_t)(_a) | (uint32_t)(_b)<<8 | (uint32_t)(_c)<<16 | (uint32_t)(_d)<<24 )
00048 
00049 
00050 class ExtPxAssetImpl final : public ExtPxAsset
00051 {
00052     NV_NOCOPY(ExtPxAssetImpl)
00053 
00054 public:
00055     friend class ExtPxAsset;
00056 
00058 
00059     ExtPxAssetImpl(const ExtPxAssetDesc& desc, TkFramework& framework);
00060     ExtPxAssetImpl(const TkAssetDesc& desc, ExtPxChunk* pxChunks, ExtPxSubchunk* pxSubchunks, TkFramework& framework);
00061     ExtPxAssetImpl(TkAsset* asset, ExtPxAssetDesc::ChunkDesc* chunks, uint32_t chunkCount);
00062     ExtPxAssetImpl(TkAsset* asset);
00063 
00064     ~ExtPxAssetImpl();
00065 
00066 
00068 
00069     virtual void                    release() override;
00070 
00071     virtual const TkAsset&          getTkAsset() const override
00072     {
00073         return *m_tkAsset;
00074     }
00075 
00076     virtual uint32_t                getChunkCount() const override
00077     {
00078         return m_chunks.size();
00079     }
00080 
00081     virtual const ExtPxChunk*       getChunks() const override
00082     {
00083         return m_chunks.begin();
00084     }
00085 
00086     virtual uint32_t                getSubchunkCount() const override
00087     {
00088         return m_subchunks.size();
00089     }
00090 
00091     virtual const ExtPxSubchunk*    getSubchunks() const override
00092     {
00093         return m_subchunks.begin();
00094     }
00095 
00096     virtual NvBlastActorDesc&       getDefaultActorDesc() override
00097     {
00098         return m_defaultActorDesc;
00099     }
00100 
00101     virtual const NvBlastActorDesc& getDefaultActorDesc() const override
00102     {
00103         return m_defaultActorDesc;
00104     }
00105 
00106     virtual void                    setUniformHealth(bool enabled) override;
00107 
00108     virtual void                    setAccelerator(NvBlastExtDamageAccelerator* accelerator) override
00109     {
00110         m_accelerator = accelerator;
00111     }
00112 
00113     virtual NvBlastExtDamageAccelerator* getAccelerator() const override
00114     {
00115         return m_accelerator;
00116     }
00117 
00118 
00120 
00121     /*
00122         Get the underlying array for the chunks. Used for serialization.
00123     */
00124     Array<ExtPxChunk>::type&        getChunksArray() { return m_chunks; }
00125 
00126     /*
00127     Get the underlying array for the subchunks. Used for serialization.
00128     */
00129     Array<ExtPxSubchunk>::type&     getSubchunksArray() { return m_subchunks; }
00130 
00131     /*
00132     Get the underlying array for the bond healths. Used for serialization.
00133     */
00134     Array<float>::type&             getBondHealthsArray() { return m_bondHealths; }
00135 
00136     /*
00137     Get the underlying array for the support chunk healths. Used for serialization.
00138     */
00139     Array<float>::type&             getSupportChunkHealthsArray() { return m_supportChunkHealths; }
00140 
00141 private:
00142 
00144     void fillPhysicsChunks(ExtPxChunk* pxChunks, ExtPxSubchunk* pxSuchunk, uint32_t chunkCount);
00145     void fillPhysicsChunks(ExtPxAssetDesc::ChunkDesc* desc, uint32_t count);
00146 
00147 
00149 
00150     TkAsset*                     m_tkAsset;
00151     Array<ExtPxChunk>::type      m_chunks;
00152     Array<ExtPxSubchunk>::type   m_subchunks;
00153     Array<float>::type           m_bondHealths;
00154     Array<float>::type           m_supportChunkHealths;
00155     NvBlastExtDamageAccelerator* m_accelerator;
00156     NvBlastActorDesc             m_defaultActorDesc;
00157 };
00158 
00159 } // namespace Blast
00160 } // namespace Nv
00161 
00162 
00163 #endif // ifndef NVBLASTEXTPXASSETIMPL_H
Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com