It is represented as an indexed triangle list. There are no restrictions on the triangle data.
To avoid duplicating data when you have several instances of a particular mesh positioned differently, you do not use this class to represent a mesh object directly. Instead, you create an instance of this mesh via the PxTriangleMeshGeometry and PxShape classes.
Creation
To create an instance of this class call PxPhysics::createTriangleMesh(), and release() to delete it. This is only possible once you have released all of its PxShape instances.
Visualizations:
\li #PxVisualizationParameter::eCOLLISION_AABBS \li #PxVisualizationParameter::eCOLLISION_SHAPES \li #PxVisualizationParameter::eCOLLISION_AXES \li #PxVisualizationParameter::eCOLLISION_FNORMALS \li #PxVisualizationParameter::eCOLLISION_EDGES-
Nested Class Summary
Nested classes/interfaces inherited from class physx.NativeObject
NativeObject.Allocator<T> -
Field Summary
FieldsFields inherited from class physx.NativeObject
address, isExternallyAllocated, SIZEOF_BYTE, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_INT, SIZEOF_LONG, SIZEOF_POINTER, SIZEOF_SHORT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PxTriangleMesharrayGet(long baseAddress, int index) Returns the local-space (vertex space) AABB from the triangle mesh.intReturns the number of triangles.intReturns the number of vertices.shortgetTriangleMaterialIndex(int triangleIndex) Returns material table index of given triangleReads the PxTriangleMesh flags.Returns the triangle indices.Returns the triangle remapping table.Returns the vertices.Returns all mesh vertices for modification.refitBVH()Refits BVH for mesh vertices.static PxTriangleMeshwrapPointer(long address) Methods inherited from class physx.common.PxRefCounted
acquireReference, getReferenceCountMethods inherited from class physx.common.PxBase
getBaseFlags, getConcreteType, getConcreteTypeName, isReleasable, release, setBaseFlag, setBaseFlagsMethods inherited from class physx.NativeObject
checkNotNull, equals, getAddress, hashCode
-
Field Details
-
SIZEOF
public static final int SIZEOF -
ALIGNOF
public static final int ALIGNOF- See Also:
-
-
Constructor Details
-
PxTriangleMesh
protected PxTriangleMesh() -
PxTriangleMesh
protected PxTriangleMesh(long address)
-
-
Method Details
-
wrapPointer
-
arrayGet
-
getNbVertices
public int getNbVertices()Returns the number of vertices.- Returns:
- number of vertices
- See Also:
-
getVertices
Returns the vertices.- Returns:
- array of vertices
- See Also:
-
getVerticesForModification
Returns all mesh vertices for modification.This function will return the vertices of the mesh so that their positions can be changed in place. After modifying the vertices you must call refitBVH for the refitting to actually take place. This function maintains the old mesh topology (triangle indices).
- Returns:
- inplace vertex coordinates for each existing mesh vertex.
Note: It is recommended to use this feature for scene queries only. Note: Size of array returned is equal to the number returned by getNbVertices(). Note: This function operates on cooked vertex indices. Note: This means the index mapping and vertex count can be different from what was provided as an input to the cooking routine. Note: To achieve unchanged 1-to-1 index mapping with orignal mesh data (before cooking) please use the following cooking flags: Note: eWELD_VERTICES = 0, eDISABLE_CLEAN_MESH = 1. Note: It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled.
- See Also:
-
refitBVH
Refits BVH for mesh vertices.This function will refit the mesh BVH to correctly enclose the new positions updated by getVerticesForModification. Mesh BVH will not be reoptimized by this function so significantly different new positions will cause significantly reduced performance.
- Returns:
- New bounds for the entire mesh.
Note: For PxMeshMidPhase::eBVH34 trees the refit operation is only available on non-quantized trees (see PxBVH34MidphaseDesc::quantized) Note: PhysX does not keep a mapping from the mesh to mesh shapes that reference it. Note: Call PxShape::setGeometry on each shape which references the mesh, to ensure that internal data structures are updated to reflect the new geometry. Note: PxShape::setGeometry does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry. Note: It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled. Note: Active edges information will be lost during refit, the rigid body mesh contact generation might not perform as expected.
- See Also:
-
getNbTriangles
public int getNbTriangles()Returns the number of triangles.- Returns:
- number of triangles
- See Also:
-
getTriangles
Returns the triangle indices.The indices can be 16 or 32bit depending on the number of triangles in the mesh. Call getTriangleMeshFlags() to know if the indices are 16 or 32 bits.
The number of indices is the number of triangles * 3.
- Returns:
- array of triangles
- See Also:
-
getTriangleMeshFlags
Reads the PxTriangleMesh flags.See the list of flags #PxTriangleMeshFlag
- Returns:
- The values of the PxTriangleMesh flags.
- See Also:
-
getTrianglesRemap
Returns the triangle remapping table.The triangles are internally sorted according to various criteria. Hence the internal triangle order does not always match the original (user-defined) order. The remapping table helps finding the old indices knowing the new ones:
remapTable[ internalTriangleIndex ] = originalTriangleIndex
- Returns:
- the remapping table (or NULL if 'PxCookingParams::suppressTriangleMeshRemapTable' has been used)
- See Also:
-
getTriangleMaterialIndex
public short getTriangleMaterialIndex(int triangleIndex) Returns material table index of given triangleThis function takes a post cooking triangle index.
- Parameters:
triangleIndex- (internal) index of desired triangle- Returns:
- Material table index, or 0xffff if no per-triangle materials are used
-
getLocalBounds
Returns the local-space (vertex space) AABB from the triangle mesh.- Returns:
- local-space bounds
-