NvBlastExtDamageAcceleratorInternal.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 #pragma once
29 
31 #include "PxBounds3.h"
32 
33 
34 namespace Nv
35 {
36 namespace Blast
37 {
38 
39 
41 {
42 public:
44  {
45  uint32_t bond;
46  uint32_t node0;
47  uint32_t node1;
48  };
49 
51  {
52  public:
53  ResultCallback(QueryBondData* buffer, uint32_t count) :
54  m_bondBuffer(buffer), m_bondMaxCount(count), m_bondCount(0) {}
55 
56  virtual void processResults(const QueryBondData* bondBuffer, uint32_t count) = 0;
57 
58  void push(uint32_t bond, uint32_t node0, uint32_t node1)
59  {
60  m_bondBuffer[m_bondCount].bond = bond;
61  m_bondBuffer[m_bondCount].node0 = node0;
62  m_bondBuffer[m_bondCount].node1 = node1;
63  m_bondCount++;
64  if (m_bondCount == m_bondMaxCount)
65  {
66  dispatch();
67  }
68  }
69 
70  void dispatch()
71  {
72  if (m_bondCount)
73  {
74  processResults(m_bondBuffer, m_bondCount);
75  m_bondCount = 0;
76  }
77  }
78 
79  private:
80  QueryBondData* m_bondBuffer;
81  uint32_t m_bondMaxCount;
82 
83  uint32_t m_bondCount;
84  };
85 
86  virtual void findBondCentroidsInBounds(const physx::PxBounds3& bounds, ResultCallback& resultCallback) const = 0;
87  virtual void findBondSegmentsInBounds(const physx::PxBounds3& bounds, ResultCallback& resultCallback) const = 0;
88  virtual void findBondSegmentsPlaneIntersected(const physx::PxPlane& plane, ResultCallback& resultCallback) const = 0;
89 
90  // Non-thread safe! Multiple calls return the same memory.
91  virtual void* getImmediateScratch(size_t size) = 0;
92 };
93 
94 
95 } // namespace Blast
96 } // namespace Nv
virtual void findBondCentroidsInBounds(const physx::PxBounds3 &bounds, ResultCallback &resultCallback) const =0
void push(uint32_t bond, uint32_t node0, uint32_t node1)
Definition: NvBlastExtDamageAcceleratorInternal.h:58
Definition: NvBlastExtDamageAcceleratorInternal.h:40
Definition: NvBlastExtDamageAcceleratorInternal.h:43
Definition: NvBlastExtDamageShaders.h:45
uint32_t node1
Definition: NvBlastExtDamageAcceleratorInternal.h:47
Definition: NvBlastExtDamageAcceleratorInternal.h:50
virtual void * getImmediateScratch(size_t size)=0
uint32_t node0
Definition: NvBlastExtDamageAcceleratorInternal.h:46
virtual void findBondSegmentsInBounds(const physx::PxBounds3 &bounds, ResultCallback &resultCallback) const =0
uint32_t bond
Definition: NvBlastExtDamageAcceleratorInternal.h:45
virtual void findBondSegmentsPlaneIntersected(const physx::PxPlane &plane, ResultCallback &resultCallback) const =0
ResultCallback(QueryBondData *buffer, uint32_t count)
Definition: NvBlastExtDamageAcceleratorInternal.h:53
Definition: NvBlastArray.h:37
void dispatch()
Definition: NvBlastExtDamageAcceleratorInternal.h:70