Main Page Class List Class Members

NvBlastExtAuthoringBondGeneratorImpl.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) 2020 NVIDIA Corporation. All rights reserved.
27
28
29 #ifndef NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
30 #define NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
31
32 #include "NvBlastExtAuthoringBondGenerator.h"
33 #include "NvBlastExtAuthoringFractureTool.h"
34 #include <PxPlane.h>
35 #include <NvBlastExtAuthoringConvexMeshBuilder.h>
36 #include <vector>
37 #include <set>
38
39 namespace Nv
40 {
41 namespace Blast
42 {
43
48 class BlastBondGeneratorImpl : public BlastBondGenerator
49 {
50 public:
51
52 BlastBondGeneratorImpl(ConvexMeshBuilder* builder)
53 : mConvexMeshBuilder(builder) {};
54
55 virtual void release() override;
56
57 virtual int32_t buildDescFromInternalFracture(FractureTool* tool, const bool* chunkIsSupport,
58 NvBlastBondDesc*& resultBondDescs, NvBlastChunkDesc*& resultChunkDescriptors) override;
59
60 virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle* meshA, uint32_t meshBCount, const Triangle* meshB,
61 NvBlastBond& resultBond, BondGenerationConfig conf) override;
62
63 virtual int32_t createBondBetweenMeshes(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
64 uint32_t overlapsCount, const uint32_t* overlapsA, const uint32_t* overlapsB,
65 NvBlastBondDesc*& resultBond, BondGenerationConfig cfg) override;
66
67 virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
68 const bool* chunkIsSupport, NvBlastBondDesc*& resultBondDescs,
69 BondGenerationConfig conf) override;
70
71 virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t* convexHullOffset, const CollisionHull** chunkHulls,
72 const bool* chunkIsSupport, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, float maxSeparation) override;
73
74
75
76 private:
77 float processWithMidplanes(TriangleProcessor* trProcessor, const Triangle* mA, uint32_t mavc, const Triangle* mB, uint32_t mbvc, const CollisionHull* hull1, const CollisionHull* hull2,
78 const std::vector<physx::PxVec3>& hull1p, const std::vector<physx::PxVec3>& hull2p,
79 physx::PxVec3& normal, physx::PxVec3& centroid, float maxRelSeparation);
80
81 int32_t createFullBondListAveraged( uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry, const CollisionHull** chunkHulls,
82 const bool* supportFlags, const uint32_t* meshGroups, NvBlastBondDesc*& resultBondDescs, BondGenerationConfig conf, std::set<std::pair<uint32_t, uint32_t> >* pairNotToTest = nullptr);
83 int32_t createFullBondListExact( uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
84 const bool* supportFlags, NvBlastBondDesc*& resultBondDescs, BondGenerationConfig conf);
85 int32_t createFullBondListExactInternal(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry,
86 std::vector<PlaneChunkIndexer>& planeTriangleMapping , NvBlastBondDesc*& resultBondDescs);
87 int32_t createBondForcedInternal( const std::vector<physx::PxVec3>& hull0, const std::vector<physx::PxVec3>& hull1,const CollisionHull& cHull0,
88 const CollisionHull& cHull1, physx::PxBounds3 bound0, physx::PxBounds3 bound1, NvBlastBond& resultBond, float overlapping);
89
90 void buildGeometryCache(uint32_t meshCount, const uint32_t* geometryOffset, const Triangle* geometry);
91 void resetGeometryCache();
92
93 ConvexMeshBuilder* mConvexMeshBuilder;
94
95 std::vector<std::vector<Triangle> > mGeometryCache;
96
97 std::vector<PlaneChunkIndexer> mPlaneCache;
98 std::vector<CollisionHull*> mCHullCache;
99 std::vector<std::vector<physx::PxVec3> > mHullsPointsCache;
100 std::vector<physx::PxBounds3 > mBoundsCache;
101
102
103 };
104
105 } // namespace Blast
106 } // namespace Nv
107
108 #endif // NVBLASTEXTAUTHORINGBONDGENERATORIMPL_H
Nv::Blast::ConvexMeshBuilder
Definition: NvBlastExtAuthoringConvexMeshBuilder.h:47
NvBlastBond
Definition: NvBlastTypes.h:189
Nv::Blast::VecMath::normal
NV_INLINE float normal(const float a[3], float r[3])
Definition: NvBlastMath.h:93
NvBlastBondDesc
Definition: NvBlastTypes.h:322
Nv::Blast::FractureTool
Definition: NvBlastExtAuthoringFractureTool.h:264
Nv::Blast::BlastBondGeneratorImpl
Definition: NvBlastExtAuthoringBondGeneratorImpl.h:48
NvBlastExtAuthoringConvexMeshBuilder.h
Nv::Blast::BlastBondGenerator
Definition: NvBlastExtAuthoringBondGenerator.h:74
NvBlastExtAuthoringFractureTool.h
Nv::Blast::TriangleProcessor
Definition: NvBlastExtTriangleProcessor.h:107
Nv::Blast::CollisionHull
Definition: NvBlastExtAuthoringTypes.h:133
Nv::Blast::BlastBondGeneratorImpl::release
virtual void release() override
Nv::Blast::BlastBondGeneratorImpl::bondsFromPrefractured
virtual int32_t bondsFromPrefractured(uint32_t meshCount, const uint32_t *geometryOffset, const Triangle *geometry, const bool *chunkIsSupport, NvBlastBondDesc *&resultBondDescs, BondGenerationConfig conf) override
Nv::Blast::BlastBondGeneratorImpl::buildDescFromInternalFracture
virtual int32_t buildDescFromInternalFracture(FractureTool *tool, const bool *chunkIsSupport, NvBlastBondDesc *&resultBondDescs, NvBlastChunkDesc *&resultChunkDescriptors) override
Nv::Blast::Triangle
Definition: NvBlastExtAuthoringTypes.h:79
NvBlastChunkDesc
Definition: NvBlastTypes.h:292
Nv::Blast::BondGenerationConfig
Definition: NvBlastExtAuthoringBondGenerator.h:54
Nv::Blast::BlastBondGeneratorImpl::BlastBondGeneratorImpl
BlastBondGeneratorImpl(ConvexMeshBuilder *builder)
Definition: NvBlastExtAuthoringBondGeneratorImpl.h:52
Nv::Blast::BlastBondGeneratorImpl::createBondBetweenMeshes
virtual int32_t createBondBetweenMeshes(uint32_t meshACount, const Triangle *meshA, uint32_t meshBCount, const Triangle *meshB, NvBlastBond &resultBond, BondGenerationConfig conf) override
Nv
Definition: NvBlastArray.h:37
NvBlastExtAuthoringBondGenerator.h