RavEngine
Loading...
Searching...
No Matches
PxTriangleMesh.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_TRIANGLE_MESH_H
30#define PX_TRIANGLE_MESH_H
34#include "foundation/PxVec3.h"
35#include "foundation/PxBounds3.h"
36#include "common/PxPhysXCommonConfig.h"
37#include "common/PxBase.h"
38#include "foundation/PxUserAllocated.h"
39
40#if !PX_DOXYGEN
41namespace physx
42{
43#endif
44
56{
57 enum Enum
58 {
59 eBVH33 = 0,
60 eBVH34 = 1,
61
62 eLAST
63 };
64};
65
72{
73 enum Enum
74 {
75 e16_BIT_INDICES = (1<<1),
76 eADJACENCY_INFO = (1<<2),
77 ePREFER_NO_SDF_PROJ = (1<<3)
78 };
79};
80
87PX_FLAGS_OPERATORS(PxTriangleMeshFlag::Enum,PxU8)
88
89
118{
119 public:
125 virtual PxU32 getNbVertices() const = 0;
126
132 virtual const PxVec3* getVertices() const = 0;
133
154
173 virtual PxBounds3 refitBVH() = 0;
174
180 virtual PxU32 getNbTriangles() const = 0;
181
193 virtual const void* getTriangles() const = 0;
194
205
218 virtual const PxU32* getTrianglesRemap() const = 0;
219
225 virtual void release() = 0;
226
235 virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0;
236
242 virtual PxBounds3 getLocalBounds() const = 0;
243
248 virtual const PxReal* getSDF() const = 0;
249
253 virtual void getSDFDimensions(PxU32& numX, PxU32& numY, PxU32& numZ) const = 0;
254
266 virtual void setPreferSDFProjection(bool preferProjection) = 0;
267
272 virtual bool getPreferSDFProjection() const = 0;
273
290 virtual void getMassInformation(PxReal& mass, PxMat33& localInertia, PxVec3& localCenterOfMass) const = 0;
291
292protected:
293 PX_INLINE PxTriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {}
294 PX_INLINE PxTriangleMesh(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {}
295 virtual ~PxTriangleMesh() {}
296
297 virtual bool isKindOf(const char* name) const { return !::strcmp("PxTriangleMesh", name) || PxRefCounted::isKindOf(name); }
298};
299
308{
309 public:
310protected:
311 PX_INLINE PxBVH33TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {}
313 virtual ~PxBVH33TriangleMesh() {}
314 virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH33TriangleMesh", name) || PxTriangleMesh::isKindOf(name); }
315};
316
324{
325 public:
326protected:
327 PX_INLINE PxBVH34TriangleMesh(PxType concreteType, PxBaseFlags baseFlags) : PxTriangleMesh(concreteType, baseFlags) {}
329 virtual ~PxBVH34TriangleMesh() {}
330 virtual bool isKindOf(const char* name) const { return !::strcmp("PxBVH34TriangleMesh", name) || PxTriangleMesh::isKindOf(name); }
331};
332
333#if !PX_DOXYGEN
334} // namespace physx
335#endif
336
338#endif
A triangle mesh containing the PxMeshMidPhase::eBVH33 structure.
Definition PxTriangleMesh.h:308
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxTriangleMesh.h:314
A triangle mesh containing the PxMeshMidPhase::eBVH34 structure.
Definition PxTriangleMesh.h:324
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxTriangleMesh.h:330
Class representing 3D range or axis aligned bounding box.
Definition PxBounds3.h:58
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
3x3 matrix class
Definition PxMat33.h:91
Base class for ref-counted objects.
Definition PxBase.h:200
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxBase.h:231
A triangle mesh, also called a 'polygon soup'.
Definition PxTriangleMesh.h:118
virtual PxVec3 * getVerticesForModification()=0
Returns all mesh vertices for modification.
virtual const PxReal * getSDF() const =0
Returns the local-space Signed Distance Field for this mesh if it has one.
virtual bool getPreferSDFProjection() const =0
Returns whether this mesh prefers SDF projection.
virtual const void * getTriangles() const =0
Returns the triangle indices.
virtual PxBounds3 refitBVH()=0
Refits BVH for mesh vertices.
virtual void release()=0
Decrements the reference count of a triangle mesh and releases it if the new reference count is zero.
virtual const PxU32 * getTrianglesRemap() const =0
Returns the triangle remapping table.
virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const =0
Returns material table index of given triangle.
virtual void setPreferSDFProjection(bool preferProjection)=0
Sets whether this mesh should be preferred for SDF projection.
virtual PxBounds3 getLocalBounds() const =0
Returns the local-space (vertex space) AABB from the triangle mesh.
virtual PxTriangleMeshFlags getTriangleMeshFlags() const =0
Reads the PxTriangleMesh flags.
virtual const PxVec3 * getVertices() const =0
Returns the vertices.
virtual PxU32 getNbTriangles() const =0
Returns the number of triangles.
virtual void getMassInformation(PxReal &mass, PxMat33 &localInertia, PxVec3 &localCenterOfMass) const =0
Returns the mass properties of the mesh assuming unit density.
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxTriangleMesh.h:297
virtual PxU32 getNbVertices() const =0
Returns the number of vertices.
virtual void getSDFDimensions(PxU32 &numX, PxU32 &numY, PxU32 &numZ) const =0
Returns the resolution of the local-space dense SDF.
3 Element vector class.
Definition PxVec3.h:50
#define PX_INLINE
Definition PxPreprocessor.h:320
#define PX_DEPRECATED
Definition PxPreprocessor.h:418
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxFlags< PxTriangleMeshFlag::Enum, PxU8 > PxTriangleMeshFlags
collection of set bits defined in PxTriangleMeshFlag.
Definition PxTriangleMesh.h:86
Mesh midphase structure. This enum is used to select the desired acceleration structure for midphase ...
Definition PxTriangleMesh.h:56
Enum
Definition PxTriangleMesh.h:58
@ eBVH33
Default midphase mesh structure, as used up to PhysX 3.3 (deprecated)
Definition PxTriangleMesh.h:59
@ eBVH34
New midphase mesh structure, introduced in PhysX 3.4.
Definition PxTriangleMesh.h:60
Flags for the mesh geometry properties.
Definition PxTriangleMesh.h:72
Enum
Definition PxTriangleMesh.h:74
@ eADJACENCY_INFO
The triangle mesh has adjacency information build.
Definition PxTriangleMesh.h:76
@ e16_BIT_INDICES
The triangle mesh has 16bits vertex indices.
Definition PxTriangleMesh.h:75
@ ePREFER_NO_SDF_PROJ
Indicates that this mesh would preferably not be the mesh projected for mesh-mesh collision....
Definition PxTriangleMesh.h:77