Main Page Class List Class Members

NvBlastTkFramework.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 NVBLASTTKFRAMEWORK_H
30 #define NVBLASTTKFRAMEWORK_H
31
32
33 #include "NvBlastTkType.h"
34 #include "NvBlastTkEvent.h"
35
36 #include "NvBlastPreprocessor.h"
37 #include "NvBlastTypes.h"
38
39 #include "PxVec3.h"
40
41
42 // Forward declarations
43 namespace physx
44 {
45 class PxTransform;
46 }
47
48
49 namespace Nv
50 {
51 namespace Blast
52 {
53
54 // Forward declarations
55 class TkObject;
56 class TkEventDispatcher;
57 class TkAsset;
58 struct TkGroupDesc;
59 class TkGroup;
60 class TkActor;
61 class TkJoint;
62 class TkIdentifiable;
63 struct TkAssetJointDesc;
64
65
66
74 struct TkAssetDesc : public NvBlastAssetDesc
75 {
79 enum BondFlags
80 {
81 NoFlags = 0,
82
90 BondJointed = (1 << 0)
91 };
92
97 const uint8_t* bondFlags;
98
100 TkAssetDesc() : bondFlags(nullptr)
101 {
102 chunkCount = bondCount = 0;
103 chunkDescs = nullptr;
104 bondDescs = nullptr;
105 }
106 };
107
108
114 struct TkActorDesc : public NvBlastActorDesc
115 {
116 const TkAsset* asset;
117
119 TkActorDesc(const TkAsset* inAsset = nullptr) : asset(inAsset)
120 {
121 uniformInitialBondHealth = uniformInitialLowerSupportChunkHealth = 1.0f;
122 initialBondHealths = initialSupportChunkHealths = nullptr;
123 }
124 };
125
126
130 struct TkJointDesc
131 {
132 TkFamily* families[2];
133 uint32_t chunkIndices[2];
134 physx::PxVec3 attachPositions[2];
135 };
136
137
141 struct TkTypeIndex
142 {
143 enum Enum
144 {
145 Asset = 0,
146 Family,
147 Group,
148
149 TypeCount
150 };
151 };
152
153
160 class TkFramework
161 {
162 public:
167 virtual void release() = 0;
168
177 virtual const TkType* getType(TkTypeIndex::Enum typeIndex) const = 0;
178
186 virtual TkIdentifiable* findObjectByID(const NvBlastID& id) const = 0;
187
195 virtual uint32_t getObjectCount(const TkType& type) const = 0;
196
207 virtual uint32_t getObjects(TkIdentifiable** buffer, uint32_t bufferSize, const TkType& type, uint32_t indexStart = 0) const = 0;
208
210
226 virtual bool reorderAssetDescChunks(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount, NvBlastBondDesc* bondDescs, uint32_t bondCount, uint32_t* chunkReorderMap = nullptr, bool keepBondNormalChunkOrder = false) const = 0;
227
240 virtual bool ensureAssetExactSupportCoverage(NvBlastChunkDesc* chunkDescs, uint32_t chunkCount) const = 0;
241
249 virtual TkAsset* createAsset(const TkAssetDesc& desc) = 0;
250
261 virtual TkAsset* createAsset(const NvBlastAsset* assetLL, Nv::Blast::TkAssetJointDesc* jointDescs = nullptr, uint32_t jointDescCount = 0, bool ownsAsset = false) = 0;
262
264
273 virtual TkGroup* createGroup(const TkGroupDesc& desc) = 0;
274
276
283 virtual TkActor* createActor(const TkActorDesc& desc) = 0;
284
286
298 virtual TkJoint* createJoint(const TkJointDesc& desc) = 0;
299
300 protected:
304 virtual ~TkFramework() {}
305 };
306
307 } // namespace Blast
308 } // namespace Nv
309
310
312
318 NVBLAST_API Nv::Blast::TkFramework* NvBlastTkFrameworkCreate();
319
320
326 NVBLAST_API Nv::Blast::TkFramework* NvBlastTkFrameworkGet();
327
328
329 #endif // ifndef NVBLASTTKFRAMEWORK_H
physx
Definition: NvBlastExtApexSharedParts.h:34
NvBlastTkFrameworkCreate
NVBLAST_API Nv::Blast::TkFramework * NvBlastTkFrameworkCreate()
Nv::Blast::TkFamily
Definition: NvBlastTkFamily.h:55
NvBlastActorDesc
Definition: NvBlastTypes.h:395
Nv::Blast::TkTypeIndex::Enum
Enum
Definition: NvBlastTkFramework.h:143
Nv::Blast::TkJoint
Definition: NvBlastTkJoint.h:63
Nv::Blast::TkAssetDesc::bondFlags
const uint8_t * bondFlags
Definition: NvBlastTkFramework.h:97
Nv::Blast::TkFramework::~TkFramework
virtual ~TkFramework()
Definition: NvBlastTkFramework.h:304
NvBlastTypes.h
Nv::Blast::TkAssetDesc::TkAssetDesc
TkAssetDesc()
Definition: NvBlastTkFramework.h:100
NvBlastAssetDesc
Definition: NvBlastTypes.h:345
Nv::Blast::TkActor
Definition: NvBlastTkActor.h:57
Nv::Blast::TkAsset
Definition: NvBlastTkAsset.h:59
NvBlastBondDesc
Definition: NvBlastTypes.h:322
NvBlastTkType.h
Nv::Blast::TkAssetDesc
Definition: NvBlastTkFramework.h:74
Nv::Blast::TkGroupDesc
Definition: NvBlastTkGroup.h:48
Nv::Blast::TkActorDesc::asset
const TkAsset * asset
The TkAsset to instance.
Definition: NvBlastTkFramework.h:116
Nv::Blast::TkJointDesc
Definition: NvBlastTkFramework.h:130
NvBlastTkFrameworkGet
NVBLAST_API Nv::Blast::TkFramework * NvBlastTkFrameworkGet()
Nv::Blast::TkIdentifiable
Definition: NvBlastTkIdentifiable.h:50
Nv::Blast::TkTypeIndex::Group
TkGroup object type.
Definition: NvBlastTkFramework.h:147
NVBLAST_API
#define NVBLAST_API
Definition: NvBlastPreprocessor.h:37
Nv::Blast::TkType
Definition: NvBlastTkType.h:46
Nv::Blast::TkActorDesc::TkActorDesc
TkActorDesc(const TkAsset *inAsset=nullptr)
Definition: NvBlastTkFramework.h:119
NvBlastID
Definition: NvBlastTypes.h:69
Nv::Blast::TkTypeIndex::Family
TkFamily object type.
Definition: NvBlastTkFramework.h:146
Nv::Blast::TkAssetDesc::BondFlags
BondFlags
Definition: NvBlastTkFramework.h:79
NvBlastChunkDesc
Definition: NvBlastTypes.h:292
Nv::Blast::TkActorDesc
Definition: NvBlastTkFramework.h:114
NvBlastAsset
Definition: NvBlastTypes.h:286
Nv::Blast::TkTypeIndex
Definition: NvBlastTkFramework.h:141
Nv::Blast::TkFramework
Definition: NvBlastTkFramework.h:160
Nv::Blast::TkAssetJointDesc
Definition: NvBlastTkAsset.h:48
Nv::Blast::TkGroup
Definition: NvBlastTkGroup.h:101
Nv
Definition: NvBlastArray.h:37
NvBlastPreprocessor.h
NvBlastTkEvent.h
Nv::Blast::Asset
Definition: NvBlastAsset.h:45