NvBlastExtRTImpl.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 NVBLASTAUTHORINGRTIMPL_H
30 #define NVBLASTAUTHORINGRTIMPL_H
31 
32 #include <NvBlastExtRT.h>
33 #include <thread>
34 #include <mutex>
35 #include <condition_variable>
36 #include <atomic>
37 
38 namespace physx
39 {
40  class PxCooking;
41 };
42 
43 namespace Nv
44 {
45  namespace Blast
46  {
47 
48  class BooleanToolV2;
49  class TriangulatorV2;
50 
52  {
53  BooleanToolOutputDataImpl(bool createOnlyEdgeBuffer = false);
54 
55  void release() override;
56 
57  void reset() override;
58  void resetEdges() override;
59 
60  void copyVerticesAndResults(const BooleanToolOutputData* other) override;
61 
62  uint32_t edgesCount() const override
63  {
64  return *mEdgesCount;
65  }
66  uint32_t verticesCount() const override
67  {
68  return *mVerticesCount;
69  }
70  uint32_t ffResultCount() const override
71  {
72  return *mFfResultCount;
73  }
74 
75  uint32_t addEdge(const BooleanResultEdge&) override;
76  uint32_t addVertex(const Vertex&) override;
77  uint32_t addFfResult(const FacetFacetResult&) override;
78 
79  BooleanResultEdge& getNewEdge() override;
80  Vertex& getNewVertex() override;
81  FacetFacetResult& getNewFfResult() override;
82 
83  std::atomic<uint32_t>* mEdgesCount;
84  std::atomic<uint32_t>* mVerticesCount;
85  std::atomic<uint32_t>* mFfResultCount;
86 
88  };
89 
90  class FractureRTImpl : public FractureRT
91  {
92  public:
93 
95 
96  virtual void release() override;
97  virtual void processMesh(DamagePattern* pattern, const Mesh* msh) override;
98 
99  virtual uint32_t getResultChunkCount() override
100  {
101  return resultChunkCount;
102  };
103  virtual Vertex* getVertexBuffer() override
104  {
105  return verticesBuffer;
106  };
107  virtual uint32_t* getVertexOffset() override
108  {
109  return vertexOffset;
110  };
111  virtual uint32_t* getIndexBuffer() override
112  {
113  return indexBuffer;
114  };
115  virtual uint32_t* getIndexOffset() override
116  {
117  return indexOffset;
118  };
120  {
121  return adata;
122  };
123 
124  void dumpChunksToObj(const char* path) override;
125 
126  private:
127 
128  BooleanToolV2* btool;
129  TriangulatorV2* triangulator;
130  Vertex* verticesBuffer;
131  uint32_t* indexBuffer;
133 
134  uint32_t triangleCount;
135  uint32_t vertexCount;
136 
137  uint32_t* indexOffset;
138  uint32_t* vertexOffset;
139  uint32_t resultChunkCount;
140 
141  BooleanToolOutputDataImpl* outputData;
142  };
143  }
144 }
145 
147 
148 #ifdef USE_MERGED_MESH
149 void sortResultBuffer(Nv::Blast::FacetFacetResult*& ffResultBuffer, uint32_t ffCount);
150 void procesOutputEdges(Nv::Blast::BooleanToolOutputData* outputData, Nv::Blast::DamagePattern* pattern, uint32_t facetCount);
151 #endif
152 
153 #endif // ifndef NVBLASTAUTHORINGRTIMPL_H
Definition: NvBlastExtApexSharedParts.h:34
virtual uint32_t getResultChunkCount() override
Definition: NvBlastExtRTImpl.h:99
Definition: NvBlastExtRT.h:68
std::atomic< uint32_t > * mFfResultCount
Definition: NvBlastExtRTImpl.h:85
virtual Vertex * getVertexBuffer() override
Definition: NvBlastExtRTImpl.h:103
Definition: NvBlastExtRT.h:144
virtual uint32_t * getIndexBuffer() override
Definition: NvBlastExtRTImpl.h:111
std::atomic< uint32_t > * mEdgesCount
Definition: NvBlastExtRTImpl.h:83
Definition: NvBlastExtRTImpl.h:51
Definition: NvBlastExtRTImpl.h:90
Nv::Blast::BooleanToolOutputData * CreateBooleanToolOutputData(bool isMergedMesh=false)
std::atomic< uint32_t > * mVerticesCount
Definition: NvBlastExtRTImpl.h:84
Definition: NvBlastExtAuthoringMesh.h:42
uint32_t ffResultCount() const override
Definition: NvBlastExtRTImpl.h:70
Definition: NvBlastExtRTGeometry.h:180
Definition: NvBlastExtAuthoringPatternGenerator.h:85
Definition: NvBlastExtRT.h:86
virtual uint32_t * getVertexOffset() override
Definition: NvBlastExtRTImpl.h:107
Definition: NvBlastExtRT.h:160
Definition: NvBlastExtRTGeometry.h:62
virtual uint32_t * getIndexOffset() override
Definition: NvBlastExtRTImpl.h:115
bool isVerticesAndResultsAllocated
Definition: NvBlastExtRTImpl.h:87
uint32_t edgesCount() const override
Definition: NvBlastExtRTImpl.h:62
Definition: NvBlastExtRT.h:54
PerTriangleAdditionalData * getPerTriangleData() override
Definition: NvBlastExtRTImpl.h:119
Definition: NvBlastExtAuthoringTypes.h:67
Definition: NvBlastArray.h:37
uint32_t verticesCount() const override
Definition: NvBlastExtRTImpl.h:66