PxTriangleMesh.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 
31 #ifndef PX_PHYSICS_GEOMUTILS_NX_TRIANGLEMESH
32 #define PX_PHYSICS_GEOMUTILS_NX_TRIANGLEMESH
33 
36 #include "foundation/PxVec3.h"
37 #include "foundation/PxBounds3.h"
39 #include "common/PxBase.h"
40 
41 #if !PX_DOXYGEN
42 namespace physx
43 {
44 #endif
45 
51 #define PX_ENABLE_DYNAMIC_MESH_RTREE 1
52 
65 {
66  enum Enum
67  {
68  eBVH33 = 0,
69  eBVH34 = 1,
70 
71  eLAST
72  };
73 };
74 
81 {
82  enum Enum
83  {
84  e16_BIT_INDICES = (1<<1),
85  eADJACENCY_INFO = (1<<2)
86  };
87 };
88 
95 PX_FLAGS_OPERATORS(PxTriangleMeshFlag::Enum,PxU8)
96 
97 
126 class PxTriangleMesh : public PxBase
127 {
128  public:
134  virtual PxU32 getNbVertices() const = 0;
135 
141  virtual const PxVec3* getVertices() const = 0;
142 
143 #if PX_ENABLE_DYNAMIC_MESH_RTREE
144 
163  virtual PxVec3* getVerticesForModification() = 0;
164 
182  virtual PxBounds3 refitBVH() = 0;
183 #endif // PX_ENABLE_DYNAMIC_MESH_RTREE
184 
190  virtual PxU32 getNbTriangles() const = 0;
191 
203  virtual const void* getTriangles() const = 0;
204 
214  virtual PxTriangleMeshFlags getTriangleMeshFlags() const = 0;
215 
228  virtual const PxU32* getTrianglesRemap() const = 0;
229 
230 
236  virtual void release() = 0;
237 
246  virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0;
247 
253  virtual PxBounds3 getLocalBounds() const = 0;
254 
263  virtual PxU32 getReferenceCount() const = 0;
264 
270  virtual void acquireReference() = 0;
271 
272 protected:
273  PX_INLINE PxTriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags) {}
274  PX_INLINE PxTriangleMesh(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
275  virtual ~PxTriangleMesh() {}
276 
277  virtual bool isKindOf(const char* name) const { return !::strcmp("PxTriangleMesh", name) || PxBase::isKindOf(name); }
278 };
279 
287 {
288  public:
289 protected:
290  PX_INLINE PxBVH33TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {}
292  virtual ~PxBVH33TriangleMesh() {}
293  virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH33TriangleMesh", name) || PxTriangleMesh::isKindOf(name); }
294 };
295 
303 {
304  public:
305 protected:
306  PX_INLINE PxBVH34TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {}
308  virtual ~PxBVH34TriangleMesh() {}
309  virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH34TriangleMesh", name) || PxTriangleMesh::isKindOf(name); }
310 };
311 
312 #if !PX_DOXYGEN
313 } // namespace physx
314 #endif
315 
317 #endif
Definition: GuContactBuffer.h:37
virtual ~PxTriangleMesh()
Definition: PxTriangleMesh.h:275
virtual ~PxBVH33TriangleMesh()
Definition: PxTriangleMesh.h:292
Mesh midphase structure. This enum is used to select the desired acceleration structure for midphase ...
Definition: PxTriangleMesh.h:64
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition: PxBase.h:178
A triangle mesh, also called a &#39;polygon soup&#39;.
Definition: PxTriangleMesh.h:126
Flags for the mesh geometry properties.
Definition: PxTriangleMesh.h:80
PxU16 PxType
Definition: PxBase.h:49
PX_INLINE PxBVH33TriangleMesh(PxBaseFlags baseFlags)
Definition: PxTriangleMesh.h:291
PX_INLINE PxBVH34TriangleMesh(PxType concreteType, PxBaseFlags baseFlags)
Definition: PxTriangleMesh.h:306
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxTriangleMesh.h:293
Enum
Definition: PxTriangleMesh.h:82
virtual ~PxBVH34TriangleMesh()
Definition: PxTriangleMesh.h:308
A triangle mesh containing the PxMeshMidPhase::eBVH33 structure.
Definition: PxTriangleMesh.h:286
PX_INLINE PxTriangleMesh(PxBaseFlags baseFlags)
Definition: PxTriangleMesh.h:274
Enum
Definition: PxTriangleMesh.h:66
PxU16 PxMaterialTableIndex
Definition: PxPhysXCommonConfig.h:117
PX_INLINE PxTriangleMesh(PxType concreteType, PxBaseFlags baseFlags)
Definition: PxTriangleMesh.h:273
uint8_t PxU8
Definition: PxSimpleTypes.h:75
PxFlags< PxTriangleMeshFlag::Enum, PxU8 > PxTriangleMeshFlags
collection of set bits defined in PxTriangleMeshFlag.
Definition: PxTriangleMesh.h:94
Class representing 3D range or axis aligned bounding box.
Definition: PxBounds3.h:58
A triangle mesh containing the PxMeshMidPhase::eBVH34 structure.
Definition: PxTriangleMesh.h:302
PxU32 PxTriangleID
Definition: PxPhysXCommonConfig.h:114
Container for bitfield flag variables associated with a specific enum type.
Definition: PxFlags.h:73
uint32_t PxU32
Definition: Px.h:48
PX_INLINE PxBVH33TriangleMesh(PxType concreteType, PxBaseFlags baseFlags)
Definition: PxTriangleMesh.h:290
Base class for objects that can be members of a PxCollection.
Definition: PxBase.h:73
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxTriangleMesh.h:277
#define PX_INLINE
Definition: PxPreprocessor.h:336
3 Element vector class.
Definition: PxVec3.h:49
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxTriangleMesh.h:309
PX_INLINE PxBVH34TriangleMesh(PxBaseFlags baseFlags)
Definition: PxTriangleMesh.h:307