PxConvexMesh

Defined in include/geometry/PxConvexMesh.h

Inheritance Relationships

Base Type

class PxConvexMesh : public PxRefCounted

A convex mesh.

Internally represented as a list of convex polygons. The number of polygons is limited to 256.

To avoid duplicating data when you have several instances of a particular mesh positioned differently, you do not use this class to represent a convex object directly. Instead, you create an instance of this mesh via the PxConvexMeshGeometry and PxShape classes.

Creation

To create an instance of this class call PxPhysics::createConvexMesh(), and PxConvexMesh::release() to delete it. This is only possible once you have released all of its PxShape instances.

Visualizations:

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 const PxU8 *getIndexBuffer() const = 0

Returns the index buffer.

Returns

Index buffer.

virtual PxU32 getNbPolygons() const = 0

Returns the number of polygons.

Returns

Number of polygons.

virtual bool getPolygonData(PxU32 index, PxHullPolygon &data) const = 0

Returns the polygon data.

Parameters
  • index[in] Polygon index in [0 ; getNbPolygons()[.

  • data[out] Polygon data.

Returns

True if success.

virtual void release() = 0

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

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 PxBounds3 getLocalBounds() const = 0

Returns the local-space (vertex space) AABB from the convex 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.

inline virtual const char *getConcreteTypeName() const

Returns string name of dynamic type.

Returns

Class name of most derived type of this object.

virtual bool isGpuCompatible() const = 0

This method decides whether a convex mesh is gpu compatible.

If the total number of vertices are more than 64 or any number of vertices in a polygon is more than 32, or convex hull data was not cooked with GPU data enabled during cooking or was loaded from a serialized collection, the convex hull is incompatible with GPU collision detection. Otherwise it is compatible.

Returns

True if the convex hull is gpu compatible

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

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 PxConvexMesh(PxType concreteType, PxBaseFlags baseFlags)
inline PxConvexMesh(PxBaseFlags baseFlags)
inline virtual ~PxConvexMesh()
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