Main Page Class List Class Members

NvBlastExtPxAssetImpl.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 NVBLASTEXTPXASSETIMPL_H
30 #define NVBLASTEXTPXASSETIMPL_H
31
32 #include "NvBlastExtPxAsset.h"
33 #include "NvBlastArray.h"
34
35
36 namespace Nv
37 {
38 namespace Blast
39 {
40
41
42 using namespace physx;
43 using namespace general_PxIOStream2;
44
45
46 // 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)
47 #define NVBLASTEXT_FOURCC(_a, _b, _c, _d) ( (uint32_t)(_a) | (uint32_t)(_b)<<8 | (uint32_t)(_c)<<16 | (uint32_t)(_d)<<24 )
48
49
50 class ExtPxAssetImpl final : public ExtPxAsset
51 {
52 NV_NOCOPY(ExtPxAssetImpl)
53
54 public:
55 friend class ExtPxAsset;
56
58
59 ExtPxAssetImpl(const ExtPxAssetDesc& desc, TkFramework& framework);
60 ExtPxAssetImpl(const TkAssetDesc& desc, ExtPxChunk* pxChunks, ExtPxSubchunk* pxSubchunks, TkFramework& framework);
61 ExtPxAssetImpl(TkAsset* asset, ExtPxAssetDesc::ChunkDesc* chunks, uint32_t chunkCount);
62 ExtPxAssetImpl(TkAsset* asset);
63
64 ~ExtPxAssetImpl();
65
66
68
69 virtual void release() override;
70
71 virtual const TkAsset& getTkAsset() const override
72 {
73 return *m_tkAsset;
74 }
75
76 virtual uint32_t getChunkCount() const override
77 {
78 return m_chunks.size();
79 }
80
81 virtual const ExtPxChunk* getChunks() const override
82 {
83 return m_chunks.begin();
84 }
85
86 virtual uint32_t getSubchunkCount() const override
87 {
88 return m_subchunks.size();
89 }
90
91 virtual const ExtPxSubchunk* getSubchunks() const override
92 {
93 return m_subchunks.begin();
94 }
95
96 virtual NvBlastActorDesc& getDefaultActorDesc() override
97 {
98 return m_defaultActorDesc;
99 }
100
101 virtual const NvBlastActorDesc& getDefaultActorDesc() const override
102 {
103 return m_defaultActorDesc;
104 }
105
106 virtual void setUniformHealth(bool enabled) override;
107
108 virtual void setAccelerator(NvBlastExtDamageAccelerator* accelerator) override
109 {
110 m_accelerator = accelerator;
111 }
112
113 virtual NvBlastExtDamageAccelerator* getAccelerator() const override
114 {
115 return m_accelerator;
116 }
117
118
120
121 /*
122 Get the underlying array for the chunks. Used for serialization.
123 */
124 Array<ExtPxChunk>::type& getChunksArray() { return m_chunks; }
125
126 /*
127 Get the underlying array for the subchunks. Used for serialization.
128 */
129 Array<ExtPxSubchunk>::type& getSubchunksArray() { return m_subchunks; }
130
131 /*
132 Get the underlying array for the bond healths. Used for serialization.
133 */
134 Array<float>::type& getBondHealthsArray() { return m_bondHealths; }
135
136 /*
137 Get the underlying array for the support chunk healths. Used for serialization.
138 */
139 Array<float>::type& getSupportChunkHealthsArray() { return m_supportChunkHealths; }
140
141 private:
142
144 void fillPhysicsChunks(ExtPxChunk* pxChunks, ExtPxSubchunk* pxSuchunk, uint32_t chunkCount);
145 void fillPhysicsChunks(ExtPxAssetDesc::ChunkDesc* desc, uint32_t count);
146
147
149
150 TkAsset* m_tkAsset;
151 Array<ExtPxChunk>::type m_chunks;
152 Array<ExtPxSubchunk>::type m_subchunks;
153 Array<float>::type m_bondHealths;
154 Array<float>::type m_supportChunkHealths;
155 NvBlastExtDamageAccelerator* m_accelerator;
156 NvBlastActorDesc m_defaultActorDesc;
157 };
158
159 } // namespace Blast
160 } // namespace Nv
161
162
163 #endif // ifndef NVBLASTEXTPXASSETIMPL_H
physx
Definition: NvBlastExtApexSharedParts.h:34
NvBlastActorDesc
Definition: NvBlastTypes.h:395
NvBlastArray.h
Nv::Blast::Array
Definition: NvBlastArray.h:46
Nv::Blast::ExtPxChunk
Definition: NvBlastExtPxAsset.h:110
Nv::Blast::ExtPxAssetImpl::getSupportChunkHealthsArray
Array< float >::type & getSupportChunkHealthsArray()
Definition: NvBlastExtPxAssetImpl.h:139
Nv::Blast::ExtPxAssetImpl::getBondHealthsArray
Array< float >::type & getBondHealthsArray()
Definition: NvBlastExtPxAssetImpl.h:134
Nv::Blast::ExtPxAssetImpl::getSubchunks
virtual const ExtPxSubchunk * getSubchunks() const override
Definition: NvBlastExtPxAssetImpl.h:91
Nv::Blast::Array::type
physx::shdfnd::Array< T, Allocator > type
Definition: NvBlastArray.h:48
Nv::Blast::ExtPxAssetImpl::getChunkCount
virtual uint32_t getChunkCount() const override
Definition: NvBlastExtPxAssetImpl.h:76
Nv::Blast::ExtPxAssetImpl::setAccelerator
virtual void setAccelerator(NvBlastExtDamageAccelerator *accelerator) override
Definition: NvBlastExtPxAssetImpl.h:108
Nv::Blast::ExtPxAssetImpl::getAccelerator
virtual NvBlastExtDamageAccelerator * getAccelerator() const override
Definition: NvBlastExtPxAssetImpl.h:113
Nv::Blast::ExtPxAssetImpl::getChunks
virtual const ExtPxChunk * getChunks() const override
Definition: NvBlastExtPxAssetImpl.h:81
Nv::Blast::ExtPxAssetImpl::getChunksArray
Array< ExtPxChunk >::type & getChunksArray()
Definition: NvBlastExtPxAssetImpl.h:124
Nv::Blast::TkAsset
Definition: NvBlastTkAsset.h:59
Nv::Blast::ExtPxSubchunk
Definition: NvBlastExtPxAsset.h:98
Nv::Blast::ExtPxAssetImpl::getTkAsset
virtual const TkAsset & getTkAsset() const override
Definition: NvBlastExtPxAssetImpl.h:71
Nv::Blast::TkAssetDesc
Definition: NvBlastTkFramework.h:74
NvBlastExtPxAsset.h
Nv::Blast::ExtPxAsset
Definition: NvBlastExtPxAsset.h:123
NvBlastExtDamageAccelerator
Definition: NvBlastExtDamageShaders.h:45
Nv::Blast::ExtPxAssetDesc
Definition: NvBlastExtPxAsset.h:64
Nv::Blast::ExtPxAssetDesc::ChunkDesc
Definition: NvBlastExtPxAsset.h:82
Nv::Blast::ExtPxAssetImpl
Definition: NvBlastExtPxAssetImpl.h:50
Nv::Blast::ExtPxAssetImpl::getDefaultActorDesc
virtual NvBlastActorDesc & getDefaultActorDesc() override
Definition: NvBlastExtPxAssetImpl.h:96
Nv::Blast::ExtPxAssetImpl::getSubchunkCount
virtual uint32_t getSubchunkCount() const override
Definition: NvBlastExtPxAssetImpl.h:86
Nv::Blast::TkFramework
Definition: NvBlastTkFramework.h:160
Nv::Blast::ExtPxAssetImpl::getSubchunksArray
Array< ExtPxSubchunk >::type & getSubchunksArray()
Definition: NvBlastExtPxAssetImpl.h:129
Nv::Blast::ExtPxAssetImpl::getDefaultActorDesc
virtual const NvBlastActorDesc & getDefaultActorDesc() const override
Definition: NvBlastExtPxAssetImpl.h:101
NV_NOCOPY
#define NV_NOCOPY(Class)
Definition: NvPreprocessor.h:527
Nv
Definition: NvBlastArray.h:37