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