Main Page Class List Class Members

NvBlastTkEvent.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 NVBLASTTKEVENT_H
30 #define NVBLASTTKEVENT_H
31
32 #include <vector>
33
34 #include "NvBlastTypes.h"
35
36
37 namespace Nv
38 {
39 namespace Blast
40 {
41
42 // Forward declarations
43 class TkObject;
44 class TkActor;
45 class TkFamily;
46 class TkJoint;
47
48
53 struct TkActorData
54 {
55 TkFamily* family;
56 void* userData;
57 uint32_t index;
58 };
59
60
65 struct TkEvent
66 {
67 // Enums
68 enum Type
69 {
70 Split,
71 FractureCommand,
72 FractureEvent,
73 JointUpdate,
74
75 TypeCount
76 };
77
78 // Data
79 const void* payload;
80 Type type;
81
87 template<typename T>
88 const T* getPayload() const { return reinterpret_cast<const T*>(payload); }
89 };
90
91
99 struct TkSplitEvent
100 {
101 enum { EVENT_TYPE = TkEvent::Split };
102
103 TkActorData parentData;
104 uint32_t numChildren;
105 TkActor** children;
106 };
107
108
114 struct TkFractureCommands
115 {
116 enum { EVENT_TYPE = TkEvent::FractureCommand };
117
118 TkActorData tkActorData;
119 NvBlastFractureBuffers buffers;
120 };
121
122
128 struct TkFractureEvents
129 {
130 enum { EVENT_TYPE = TkEvent::FractureEvent };
131
132 TkActorData tkActorData;
133 NvBlastFractureBuffers buffers;
134 uint32_t bondsDamaged;
135 uint32_t bondsBroken;
136 uint32_t chunksDamaged;
137 uint32_t chunksBroken;
138 };
139
140
148 struct TkJointUpdateEvent
149 {
150 enum { EVENT_TYPE = TkEvent::JointUpdate };
151
152 enum Subtype
153 {
154 External,
155 Changed,
156 Unreferenced
157 };
158
159 TkJoint* joint;
160 Subtype subtype;
161 };
162
163
168 class TkEventListener
169 {
170 public:
177 virtual void receive(const TkEvent* events, uint32_t eventCount) = 0;
178 };
179
180 } // namespace Blast
181 } // namespace Nv
182
183
184 #endif // ifndef NVBLASTTKEVENT_H
Nv::Blast::TkFamily
Definition: NvBlastTkFamily.h:55
Nv::Blast::TkJointUpdateEvent::joint
TkJoint * joint
The joint being updated.
Definition: NvBlastTkEvent.h:159
Nv::Blast::TkEvent::getPayload
const T * getPayload() const
Definition: NvBlastTkEvent.h:88
Nv::Blast::TkEvent::payload
const void * payload
Type-dependent payload data.
Definition: NvBlastTkEvent.h:79
Nv::Blast::TkJointUpdateEvent
Definition: NvBlastTkEvent.h:148
Nv::Blast::TkEvent
Definition: NvBlastTkEvent.h:65
Nv::Blast::TkJoint
Definition: NvBlastTkJoint.h:63
Nv::Blast::TkSplitEvent
Definition: NvBlastTkEvent.h:99
Nv::Blast::TkEvent::JointUpdate
Sent when TkJoints change their attachment state. See TkJointUpdateEvent.
Definition: NvBlastTkEvent.h:73
NvBlastTypes.h
Nv::Blast::TkFractureEvents::bondsDamaged
uint32_t bondsDamaged
number of damaged bonds (health remains)
Definition: NvBlastTkEvent.h:134
Nv::Blast::TkActor
Definition: NvBlastTkActor.h:57
Nv::Blast::TkEvent::type
Type type
See the Type enum, above.
Definition: NvBlastTkEvent.h:80
Nv::Blast::TkFractureEvents::bondsBroken
uint32_t bondsBroken
number of broken bonds (health exhausted)
Definition: NvBlastTkEvent.h:135
Nv::Blast::TkActorData::family
TkFamily * family
TkFamily of the originating TkActor.
Definition: NvBlastTkEvent.h:55
Nv::Blast::TkEvent::FractureEvent
Sent when a TkActor is fractured using TkActor::applyFracture.
Definition: NvBlastTkEvent.h:72
Nv::Blast::TkFractureCommands
Definition: NvBlastTkEvent.h:114
Nv::Blast::TkFractureEvents::buffers
NvBlastFractureBuffers buffers
The fracture result of the modified TkActor.
Definition: NvBlastTkEvent.h:133
Nv::Blast::TkSplitEvent::children
TkActor ** children
An array of pointers to the children into which the TkActor was split.
Definition: NvBlastTkEvent.h:105
Nv::Blast::TkEvent::Type
Type
Definition: NvBlastTkEvent.h:68
Nv::Blast::TkJointUpdateEvent::Subtype
Subtype
Definition: NvBlastTkEvent.h:152
Nv::Blast::TkFractureEvents::tkActorData
TkActorData tkActorData
The data of TkActor that received the fracture command.
Definition: NvBlastTkEvent.h:132
Nv::Blast::TkEventListener
Definition: NvBlastTkEvent.h:168
Nv::Blast::TkJointUpdateEvent::External
A joint that used to be internal to a single TkActor now joins two different TkActors.
Definition: NvBlastTkEvent.h:154
Nv::Blast::TkActorData::index
uint32_t index
TkActor::getIndex() of the originating TkActor.
Definition: NvBlastTkEvent.h:57
Nv::Blast::TkFractureCommands::buffers
NvBlastFractureBuffers buffers
The fracture commands used to modify the TkActor.
Definition: NvBlastTkEvent.h:119
Nv::Blast::TkFractureCommands::tkActorData
TkActorData tkActorData
The data of TkActor that received the fracture command.
Definition: NvBlastTkEvent.h:118
Nv::Blast::TkEvent::Split
Sent when a TkActor is split. See TkSplitEvent.
Definition: NvBlastTkEvent.h:70
NvBlastFractureBuffers
Definition: NvBlastTypes.h:468
Nv::Blast::TkFractureEvents
Definition: NvBlastTkEvent.h:128
Nv::Blast::TkJointUpdateEvent::Changed
One or both of the joint&#39;s attached TkActors has changed. The previous TkActors were distinct...
Definition: NvBlastTkEvent.h:155
Nv::Blast::TkEvent::FractureCommand
Sent when a TkActor generated fracture commands using TkActor::generateFracture.
Definition: NvBlastTkEvent.h:71
Nv::Blast::TkActorData
Definition: NvBlastTkEvent.h:53
Nv::Blast::TkJointUpdateEvent::subtype
Subtype subtype
The type of update event this is (see Subtype)
Definition: NvBlastTkEvent.h:160
Nv::Blast::TkActorData::userData
void * userData
TkActor.userData of the originating TkActor.
Definition: NvBlastTkEvent.h:56
Nv::Blast::TkSplitEvent::numChildren
uint32_t numChildren
The number of children into which the parent TkActor was split.
Definition: NvBlastTkEvent.h:104
Nv::Blast::TkFractureEvents::chunksDamaged
uint32_t chunksDamaged
number of damaged chunks (health remains) including child chunks
Definition: NvBlastTkEvent.h:136
Nv
Definition: NvBlastArray.h:37
Nv::Blast::TkFractureEvents::chunksBroken
uint32_t chunksBroken
number of broken chunks (health exhausted) including child chunks
Definition: NvBlastTkEvent.h:137
Nv::Blast::TkSplitEvent::parentData
TkActorData parentData
The data of parent TkActor that was split.
Definition: NvBlastTkEvent.h:103