PxBVH34TriangleMesh

Defined in include/geometry/PxTriangleMesh.h

Inheritance Relationships

Base Type

class PxBVH34TriangleMesh : public PxTriangleMesh

A triangle mesh containing the PxMeshMidPhase::eBVH34 structure.

See also

PxMeshMidPhase

Public Functions

virtual PxU32 getNbVertices() const = 0

Returns the number of vertices.

See also

getVertices()

Returns

number of vertices

virtual const PxVec3 *getVertices() const = 0

Returns the vertices.

See also

getNbVertices()

Returns

array of vertices

virtual PxVec3 *getVerticesForModification() = 0

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).

See also

getNbVertices()

See also

refitBVH()

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.

Returns

inplace vertex coordinates for each existing mesh vertex.

virtual PxBounds3 refitBVH() = 0

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.

See also

getNbVertices()

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.

Returns

New bounds for the entire mesh.

virtual PxU32 getNbTriangles() const = 0

Returns the number of triangles.

Returns

number of triangles

virtual const void *getTriangles() const = 0

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

virtual PxTriangleMeshFlags getTriangleMeshFlags() const = 0

Reads the PxTriangleMesh flags.

See the list of flags PxTriangleMeshFlag

See also

PxTriangleMesh

Returns

The values of the PxTriangleMesh flags.

virtual const PxU32 *getTrianglesRemap() const = 0

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)

virtual void release() = 0

Decrements the reference count of a triangle mesh and releases it if the new reference count is zero.

virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0

Returns material table index of given triangle.

This function takes a post cooking triangle index.

Parameters

triangleIndex[in] (internal) index of desired triangle

Returns

Material table index, or 0xffff if no per-triangle materials are used

virtual PxBounds3 getLocalBounds() const = 0

Returns the local-space (vertex space) AABB from the triangle mesh.

Returns

local-space bounds

virtual const PxReal *getSDF() const = 0

Returns the local-space Signed Distance Field for this mesh if it has one.

Returns

local-space SDF.

virtual void getSDFDimensions(PxU32 &numX, PxU32 &numY, PxU32 &numZ) const = 0

Returns the resolution of the local-space dense SDF.

virtual void setPreferSDFProjection(bool preferProjection) = 0

Sets whether this mesh should be preferred for SDF projection.

By default, meshes are flagged as preferring projection and the decisions on which mesh to project is based on the triangle and vertex count. The model with the fewer triangles is projected onto the SDF of the more detailed mesh. If one of the meshes is set to prefer SDF projection (default) and the other is set to not prefer SDF projection, model flagged as preferring SDF projection will be projected onto the model flagged as not preferring, regardless of the detail of the respective meshes. Where both models are flagged as preferring no projection, the less detailed model will be projected as before.

Parameters

preferProjection[in] Indicates if projection is preferred

virtual bool getPreferSDFProjection() const = 0

Returns whether this mesh prefers SDF projection.

Returns

whether this mesh prefers SDF projection.

virtual void getMassInformation(PxReal &mass, PxMat33 &localInertia, PxVec3 &localCenterOfMass) const = 0

Returns the mass properties of the mesh assuming unit density.

The following relationship holds between mass and volume:

mass = volume * density

The mass of a unit density mesh is equal to its volume, so this function returns the volume of the mesh.

Similarly, to obtain the localInertia of an identically shaped object with a uniform density of d, simply multiply the localInertia of the unit density mesh by d.

Parameters
  • mass[out] The mass of the mesh assuming unit density.

  • localInertia[out] The inertia tensor in mesh local space assuming unit density.

  • localCenterOfMass[out] Position of center of mass (or centroid) in mesh local space.

virtual PxU32 getReferenceCount() const = 0

Returns the reference count of the object.

At creation, the reference count of the object is 1. Every other object referencing this object increments the count by 1. When the reference count reaches 0, and only then, the object gets destroyed automatically.

Returns

the current reference count.

virtual void acquireReference() = 0

Acquires a counted reference to this object.

This method increases the reference count of the object by 1. Decrement the reference count by calling release()

virtual const char *getConcreteTypeName() const = 0

Returns string name of dynamic type.

Returns

Class name of most derived type of this object.

template<class T>
inline T *is()
template<class T>
inline const T *is() const
inline PxType getConcreteType() const

Returns concrete type of object.

See also

PxConcreteType

Returns

PxConcreteType::Enum of serialized object

inline void setBaseFlag(PxBaseFlag::Enum flag, bool value)

Set PxBaseFlag

Parameters
  • flag[in] The flag to be set

  • value[in] The flags new value

inline void setBaseFlags(PxBaseFlags inFlags)

Set PxBaseFlags

See also

PxBaseFlags

Parameters

inFlags[in] The flags to be set

inline PxBaseFlags getBaseFlags() const

Returns PxBaseFlags.

See also

PxBaseFlags

Returns

PxBaseFlags

inline virtual bool isReleasable() const

Whether the object is subordinate.

A class is subordinate, if it can only be instantiated in the context of another class.

Returns

Whether the class is subordinate

Protected Functions

inline PxBVH34TriangleMesh(PxType concreteType, PxBaseFlags baseFlags)
inline PxBVH34TriangleMesh(PxBaseFlags baseFlags)
inline virtual ~PxBVH34TriangleMesh()
inline virtual bool isKindOf(const char *name) const

Returns whether a given type name matches with the type of this instance.

inline virtual void onRefCountZero()
template<class T>
inline bool typeMatch() const

Protected Attributes

PxType mConcreteType
PxBaseFlags mBaseFlags
PxU32 mBuiltInRefCount