Main Page Class List Class Members

NvBlastExtSync.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 NVBLASTEXTSYNC_H
30 #define NVBLASTEXTSYNC_H
31
32 #include "NvBlastTk.h"
33 #include "foundation/PxTransform.h"
34 #include "NvPreprocessor.h"
35 #include "NvBlastGlobals.h"
36
37
38 namespace Nv
39 {
40 namespace Blast
41 {
42
43 class ExtPxFamily;
44 class ExtPxManager;
45
46
50 struct ExtSyncEventType
51 {
52 enum Enum
53 {
54 Fracture = 0,
55 FamilySync,
56 Physics,
57
58 Count
59 };
60 };
61
62
66 struct NV_DLL_EXPORT ExtSyncEvent
67 {
68 ExtSyncEvent(ExtSyncEventType::Enum t) : type(t) {}
69 virtual ~ExtSyncEvent() {}
70
71 template<class T>
72 const T* getEvent() const { return reinterpret_cast<const T*>(this); }
73
79 virtual ExtSyncEvent* clone() const = 0;
80
81 void release();
82
83 ExtSyncEventType::Enum type;
84 uint64_t timestamp;
85 NvBlastID familyID;
86 };
87
88
92 template <class T, ExtSyncEventType::Enum eventType>
93 struct ExtSyncEventInstance : public ExtSyncEvent
94 {
95 ExtSyncEventInstance() : ExtSyncEvent(eventType) {}
96
97 static const ExtSyncEventType::Enum EVENT_TYPE = eventType;
98
99 ExtSyncEvent* clone() const override
100 {
101 return NVBLAST_NEW (T) (*(T*)this);
102 }
103 };
104
105
109 struct ExtSyncEventFracture : public ExtSyncEventInstance<ExtSyncEventFracture, ExtSyncEventType::Fracture>
110 {
111 std::vector<NvBlastBondFractureData> bondFractures;
112 std::vector<NvBlastChunkFractureData> chunkFractures;
113 };
114
115
119 struct ExtSyncEventFamilySync : public ExtSyncEventInstance<ExtSyncEventFamilySync, ExtSyncEventType::FamilySync>
120 {
121 std::vector<char> family;
122 };
123
124
128 struct ExtSyncEventPhysicsSync : public ExtSyncEventInstance<ExtSyncEventPhysicsSync, ExtSyncEventType::Physics>
129 {
130 struct ActorData
131 {
132 uint32_t actorIndex;
133 physx::PxTransform transform;
134 };
135
136 std::vector<ActorData> data;
137 };
138
139
145 class NV_DLL_EXPORT ExtSync : public TkEventListener
146 {
147 public:
149
155 static ExtSync* create();
156
157
159
163 virtual void release() = 0;
164
165
167
174 virtual void receive(const TkEvent* events, uint32_t eventCount) = 0;
175
181 virtual void syncFamily(const TkFamily& family) = 0;
182
188 virtual void syncFamily(const ExtPxFamily& family) = 0;
189
195 virtual uint32_t getSyncBufferSize() const = 0;
196
203 virtual void acquireSyncBuffer(const ExtSyncEvent*const*& buffer, uint32_t& size) const = 0;
204
208 virtual void releaseSyncBuffer() = 0;
209
210
212
223 virtual void applySyncBuffer(TkFramework& framework, const ExtSyncEvent** buffer, uint32_t size, TkGroup* groupForNewActors, ExtPxManager* manager = nullptr) = 0;
224
225 };
226
227 } // namespace Blast
228 } // namespace Nv
229
230
231 #endif // ifndef NVBLASTEXTSYNC_H
Nv::Blast::TkFamily
Definition: NvBlastTkFamily.h:55
Nv::Blast::ExtSyncEventPhysicsSync::data
std::vector< ActorData > data
actors data
Definition: NvBlastExtSync.h:136
Nv::Blast::ExtSyncEventInstance::ExtSyncEventInstance
ExtSyncEventInstance()
Definition: NvBlastExtSync.h:95
Nv::Blast::ExtSyncEventType::Count
Definition: NvBlastExtSync.h:58
Nv::Blast::ExtSyncEventFracture
Definition: NvBlastExtSync.h:109
Nv::Blast::ExtSyncEventFracture::bondFractures
std::vector< NvBlastBondFractureData > bondFractures
bond fracture data
Definition: NvBlastExtSync.h:111
Nv::Blast::TkEvent
Definition: NvBlastTkEvent.h:65
Nv::Blast::ExtSyncEvent::type
ExtSyncEventType::Enum type
Event type.
Definition: NvBlastExtSync.h:83
NvBlastTk.h
Nv::Blast::ExtSyncEvent::~ExtSyncEvent
virtual ~ExtSyncEvent()
Definition: NvBlastExtSync.h:69
Nv::Blast::ExtSyncEventFamilySync
Definition: NvBlastExtSync.h:119
Nv::Blast::ExtSyncEventPhysicsSync
Definition: NvBlastExtSync.h:128
NvBlastGlobals.h
Nv::Blast::ExtSyncEvent::getEvent
const T * getEvent() const
Definition: NvBlastExtSync.h:72
Nv::Blast::ExtSyncEventFamilySync::family
std::vector< char > family
family binary blob
Definition: NvBlastExtSync.h:121
Nv::Blast::ExtSyncEvent::ExtSyncEvent
ExtSyncEvent(ExtSyncEventType::Enum t)
Definition: NvBlastExtSync.h:68
Nv::Blast::TkEventListener
Definition: NvBlastTkEvent.h:168
Nv::Blast::ExtSyncEventPhysicsSync::ActorData::actorIndex
uint32_t actorIndex
actor index in family
Definition: NvBlastExtSync.h:132
Nv::Blast::ExtSyncEvent
Definition: NvBlastExtSync.h:66
Nv::Blast::ExtSyncEventPhysicsSync::ActorData
Definition: NvBlastExtSync.h:130
Nv::Blast::ExtSync
Definition: NvBlastExtSync.h:145
Nv::Blast::ExtSyncEventFracture::chunkFractures
std::vector< NvBlastChunkFractureData > chunkFractures
chunk fracture data
Definition: NvBlastExtSync.h:112
Nv::Blast::ExtSyncEventType::Enum
Enum
Definition: NvBlastExtSync.h:52
NVBLAST_NEW
#define NVBLAST_NEW(T)
Definition: NvBlastGlobals.h:228
Nv::Blast::ExtSyncEventType
Definition: NvBlastExtSync.h:50
NvBlastID
Definition: NvBlastTypes.h:69
Nv::Blast::ExtSyncEventPhysicsSync::ActorData::transform
physx::PxTransform transform
actor world transform
Definition: NvBlastExtSync.h:133
Nv::Blast::ExtSyncEvent::familyID
NvBlastID familyID
TkFamily ID.
Definition: NvBlastExtSync.h:85
Nv::Blast::ExtPxFamily
Definition: NvBlastExtPxFamily.h:105
Nv::Blast::ExtSyncEventType::FamilySync
Contains full family Family blob.
Definition: NvBlastExtSync.h:55
Nv::Blast::ExtSyncEventInstance
Definition: NvBlastExtSync.h:93
Nv::Blast::TkFramework
Definition: NvBlastTkFramework.h:160
Nv::Blast::ExtSyncEventType::Fracture
Contains Fracture commands.
Definition: NvBlastExtSync.h:54
Nv::Blast::ExtPxManager
Definition: NvBlastExtPxManager.h:99
Nv::Blast::TkGroup
Definition: NvBlastTkGroup.h:101
Nv::Blast::ExtSyncEventType::Physics
Contains actor&#39;s physical info, like transforms.
Definition: NvBlastExtSync.h:56
Nv
Definition: NvBlastExtAuthoring.h:34
Nv::Blast::ExtSyncEvent::timestamp
uint64_t timestamp
Event timestamp.
Definition: NvBlastExtSync.h:84
Nv::Blast::ExtSyncEventInstance::clone
ExtSyncEvent * clone() const override
Definition: NvBlastExtSync.h:99