RavEngine
Loading...
Searching...
No Matches
physx::Gu::TriangleMesh Class Referenceabstract
Inheritance diagram for physx::Gu::TriangleMesh:
[legend]
Collaboration diagram for physx::Gu::TriangleMesh:
[legend]

Public Member Functions

 TriangleMesh (PxBaseFlags baseFlags)
 
void preExportDataReset ()
 
virtual void exportExtraData (PxSerializationContext &context)
 
void importExtraData (PxDeserializationContext &context)
 
virtual void release ()
 Decrements the reference count of a triangle mesh and releases it if the new reference count is zero.

 
virtual void requiresObjects (PxProcessPxBaseCallback &)
 
 TriangleMesh (MeshFactory *factory, TriangleMeshData &data)
 
 TriangleMesh (const PxTriangleMeshInternalData &data)
 
virtual void onRefCountZero ()
 
virtual void acquireReference ()
 Acquires a counted reference to this object.
 
virtual PxU32 getReferenceCount () const
 Returns the reference count of the object.
 
virtual PxU32 getNbVertices () const
 Returns the number of vertices.
 
virtual const PxVec3 * getVertices () const
 Returns the vertices.
 
virtual PxVec3 * getVerticesForModification ()
 Returns all mesh vertices for modification.
 
virtual PxBounds3 refitBVH ()
 Refits BVH for mesh vertices.
 
virtual PxU32 getNbTriangles () const
 Returns the number of triangles.
 
virtual const void * getTriangles () const
 Returns the triangle indices.
 
virtual PxTriangleMeshFlags getTriangleMeshFlags () const
 Reads the PxTriangleMesh flags.
 
virtual const PxU32 * getTrianglesRemap () const
 Returns the triangle remapping table.
 
virtual void setPreferSDFProjection (bool preferProjection)
 Sets whether this mesh should be preferred for SDF projection.
 
virtual bool getPreferSDFProjection () const
 Returns whether this mesh prefers SDF projection.
 
virtual PxMaterialTableIndex getTriangleMaterialIndex (PxTriangleID triangleIndex) const
 Returns material table index of given triangle.
 
virtual PxBounds3 getLocalBounds () const
 Returns the local-space (vertex space) AABB from the triangle mesh.
 
virtual const PxReal * getSDF () const
 Returns the local-space Signed Distance Field for this mesh if it has one.
 
virtual void getSDFDimensions (PxU32 &numX, PxU32 &numY, PxU32 &numZ) const
 Returns the resolution of the local-space dense SDF.
 
virtual void getMassInformation (PxReal &mass, PxMat33 &localInertia, PxVec3 &localCenterOfMass) const
 Returns the mass properties of the mesh assuming unit density.
 
virtual bool getInternalData (PxTriangleMeshInternalData &, bool) const
 
virtual PxMeshMidPhase::Enum getMidphaseID () const =0
 
PX_FORCE_INLINE const PxU32 * getFaceRemap () const
 
PX_FORCE_INLINE bool has16BitIndices () const
 
PX_FORCE_INLINE bool hasPerTriangleMaterials () const
 
PX_FORCE_INLINE PxU32 getNbVerticesFast () const
 
PX_FORCE_INLINE PxU32 getNbTrianglesFast () const
 
PX_FORCE_INLINE const void * getTrianglesFast () const
 
PX_FORCE_INLINE const PxVec3 * getVerticesFast () const
 
PX_FORCE_INLINE const PxU32 * getAdjacencies () const
 
PX_FORCE_INLINE PxReal getGeomEpsilon () const
 
PX_FORCE_INLINE const CenterExtents & getLocalBoundsFast () const
 
PX_FORCE_INLINE const PxU16 * getMaterials () const
 
PX_FORCE_INLINE const PxU8 * getExtraTrigData () const
 
PX_FORCE_INLINE const PxU32 * getAccumulatedTriangleRef () const
 
PX_FORCE_INLINE const PxU32 * getTriangleReferences () const
 
PX_FORCE_INLINE PxU32 getNbTriangleReferences () const
 
PX_FORCE_INLINE const CenterExtentsPadded & getPaddedBounds () const
 
PX_FORCE_INLINE void computeWorldTriangle (PxTriangle &worldTri, PxTriangleID triangleIndex, const PxMat34 &worldMatrix, bool flipNormal=false, PxU32 *PX_RESTRICT vertexIndices=NULL, PxU32 *PX_RESTRICT adjacencyIndices=NULL) const
 
PX_FORCE_INLINE void getLocalTriangle (PxTriangle &localTri, PxTriangleID triangleIndex, bool flipNormal=false) const
 
void setMeshFactory (MeshFactory *factory)
 
PX_FORCE_INLINE const SDF & getSdfDataFast () const
 
PX_FORCE_INLINE PxReal getMass () const
 
PX_PHYSX_COMMON_API const Gu::EdgeList * requestEdgeList () const
 
void setAllEdgesActive ()
 
- Public Member Functions inherited from physx::PxBase
virtual const char * getConcreteTypeName () const =0
 Returns string name of dynamic type.
 
template<class T >
T * is ()
 
template<class T >
const T * is () const
 
PX_FORCE_INLINE PxType getConcreteType () const
 Returns concrete type of object.
 
PX_FORCE_INLINE void setBaseFlag (PxBaseFlag::Enum flag, bool value)
 Set PxBaseFlag

 
PX_FORCE_INLINE void setBaseFlags (PxBaseFlags inFlags)
 Set PxBaseFlags

 
PX_FORCE_INLINE PxBaseFlags getBaseFlags () const
 Returns PxBaseFlags.
 
virtual bool isReleasable () const
 Whether the object is subordinate.
 
- Public Member Functions inherited from physx::PxUserAllocated
PX_INLINE void * operator new (size_t, void *address)
 
PX_INLINE void operator delete (void *, void *)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void * operator new[] (size_t size, size_t, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete (void *ptr, Alloc alloc, const char *fileName, int line)
 
template<typename Alloc >
PX_INLINE void operator delete[] (void *ptr, Alloc alloc, const char *fileName, int line)
 
PX_INLINE void operator delete (void *ptr)
 
PX_INLINE void operator delete[] (void *ptr)
 

Static Public Member Functions

static PX_PHYSX_COMMON_API void getBinaryMetaData (PxOutputStream &stream)
 

Public Attributes

void * mGRB_triIndices
 GRB: GPU-friendly tri indices.
 
void * mGRB_triAdjacencies
 GRB: adjacency data, with BOUNDARY and NONCONVEX flags (flags replace adj indices where applicable)
 
PxU32 * mGRB_faceRemap
 GRB : gpu to cpu triangle indice remap.
 
PxU32 * mGRB_faceRemapInverse
 
Gu::BV32Tree * mGRB_BV32Tree
 GRB: BV32 tree.
 
SDF mSdfData
 
PxU32 * mAccumulatedTrianglesRef
 
PxU32 * mTrianglesReferences
 
PxU32 mNbTrianglesReferences
 

Protected Attributes

PxU32 mNbVertices
 
PxU32 mNbTriangles
 
PxVec3 * mVertices
 
void * mTriangles
 16 (<= 0xffff #vertices) or 32 bit trig indices (mNbTriangles * 3)
 
CenterExtents mAABB
 
PxU8 * mExtraTrigData
 
PxReal mGeomEpsilon
 see comments in cooking code referencing this variable
 
PxU8 mFlags
 
PxU16 * mMaterialIndices
 the size of the array is numTriangles.
 
PxU32 * mFaceRemap
 new faces to old faces mapping (after cleaning, etc). Usage: old = faceRemap[new]
 
PxU32 * mAdjacencies
 
MeshFactory * mMeshFactory
 
Gu::EdgeList * mEdgeList
 
PxReal mMass
 
PxMat33 mInertia
 
PxVec3 mLocalCenterOfMass
 
- Protected Attributes inherited from physx::PxBase
PxType mConcreteType
 
PxBaseFlags mBaseFlags
 
PxU32 mBuiltInRefCount
 

Additional Inherited Members

- Protected Member Functions inherited from physx::PxTriangleMesh
PX_INLINE PxTriangleMesh (PxType concreteType, PxBaseFlags baseFlags)
 
PX_INLINE PxTriangleMesh (PxBaseFlags baseFlags)
 
virtual bool isKindOf (const char *name) const
 Returns whether a given type name matches with the type of this instance.
 
- Protected Member Functions inherited from physx::PxRefCounted
PX_INLINE PxRefCounted (PxType concreteType, PxBaseFlags baseFlags)
 
PX_INLINE PxRefCounted (PxBaseFlags baseFlags)
 
- Protected Member Functions inherited from physx::PxBase
PX_INLINE PxBase (PxType concreteType, PxBaseFlags baseFlags)
 Constructor setting concrete type and base flags.
 
PX_INLINE PxBase (PxBaseFlags baseFlags)
 Deserialization constructor setting base flags.
 
virtual ~PxBase ()
 Destructor.
 
template<class T >
bool typeMatch () const
 

Member Function Documentation

◆ acquireReference()

virtual void physx::Gu::TriangleMesh::acquireReference ( )
inlinevirtual

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

Implements physx::PxRefCounted.

◆ getLocalBounds()

virtual PxBounds3 physx::Gu::TriangleMesh::getLocalBounds ( ) const
inlinevirtual

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

Returns
local-space bounds

Implements physx::PxTriangleMesh.

◆ getMassInformation()

virtual void physx::Gu::TriangleMesh::getMassInformation ( PxReal &  mass,
PxMat33 &  localInertia,
PxVec3 &  localCenterOfMass 
) const
inlinevirtual

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
[out]massThe mass of the mesh assuming unit density.
[out]localInertiaThe inertia tensor in mesh local space assuming unit density.
[out]localCenterOfMassPosition of center of mass (or centroid) in mesh local space.

Implements physx::PxTriangleMesh.

◆ getNbTriangles()

virtual PxU32 physx::Gu::TriangleMesh::getNbTriangles ( ) const
inlinevirtual

Returns the number of triangles.

Returns
number of triangles
See also
getTriangles() getTrianglesRemap()

Implements physx::PxTriangleMesh.

◆ getNbVertices()

virtual PxU32 physx::Gu::TriangleMesh::getNbVertices ( ) const
inlinevirtual

Returns the number of vertices.

Returns
number of vertices
See also
getVertices()

Implements physx::PxTriangleMesh.

◆ getPreferSDFProjection()

virtual bool physx::Gu::TriangleMesh::getPreferSDFProjection ( ) const
inlinevirtual

Returns whether this mesh prefers SDF projection.

Returns
whether this mesh prefers SDF projection.

Implements physx::PxTriangleMesh.

◆ getReferenceCount()

virtual PxU32 physx::Gu::TriangleMesh::getReferenceCount ( ) const
inlinevirtual

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.

Implements physx::PxRefCounted.

◆ getSDF()

virtual const PxReal * physx::Gu::TriangleMesh::getSDF ( ) const
inlinevirtual

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

Returns
local-space SDF.

Implements physx::PxTriangleMesh.

◆ getSDFDimensions()

virtual void physx::Gu::TriangleMesh::getSDFDimensions ( PxU32 &  numX,
PxU32 &  numY,
PxU32 &  numZ 
) const
inlinevirtual

Returns the resolution of the local-space dense SDF.

Implements physx::PxTriangleMesh.

◆ getTriangleMaterialIndex()

virtual PxMaterialTableIndex physx::Gu::TriangleMesh::getTriangleMaterialIndex ( PxTriangleID  triangleIndex) const
inlinevirtual

Returns material table index of given triangle.

This function takes a post cooking triangle index.

Parameters
[in]triangleIndex(internal) index of desired triangle
Returns
Material table index, or 0xffff if no per-triangle materials are used

Implements physx::PxTriangleMesh.

◆ getTriangleMeshFlags()

virtual PxTriangleMeshFlags physx::Gu::TriangleMesh::getTriangleMeshFlags ( ) const
inlinevirtual

Reads the PxTriangleMesh flags.

See the list of flags #PxTriangleMeshFlag

Returns
The values of the PxTriangleMesh flags.
See also
PxTriangleMesh

Implements physx::PxTriangleMesh.

◆ getTriangles()

virtual const void * physx::Gu::TriangleMesh::getTriangles ( ) const
inlinevirtual

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
getNbTriangles() getTriangleMeshFlags() getTrianglesRemap()

Implements physx::PxTriangleMesh.

◆ getTrianglesRemap()

virtual const PxU32 * physx::Gu::TriangleMesh::getTrianglesRemap ( ) const
inlinevirtual

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
getNbTriangles() getTriangles() PxCookingParams::suppressTriangleMeshRemapTable

Implements physx::PxTriangleMesh.

◆ getVertices()

virtual const PxVec3 * physx::Gu::TriangleMesh::getVertices ( ) const
inlinevirtual

Returns the vertices.

Returns
array of vertices
See also
getNbVertices()

Implements physx::PxTriangleMesh.

◆ getVerticesForModification()

PxVec3 * TriangleMesh::getVerticesForModification ( )
virtual

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.
Size of array returned is equal to the number returned by getNbVertices().
This function operates on cooked vertex indices.
This means the index mapping and vertex count can be different from what was provided as an input to the cooking routine.
To achieve unchanged 1-to-1 index mapping with orignal mesh data (before cooking) please use the following cooking flags:
eWELD_VERTICES = 0, eDISABLE_CLEAN_MESH = 1.
It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled.
See also
getNbVertices()
refitBVH()

Implements physx::PxTriangleMesh.

Reimplemented in physx::Gu::BV4TriangleMesh, and physx::Gu::RTreeTriangleMesh.

◆ onRefCountZero()

void TriangleMesh::onRefCountZero ( )
virtual

Reimplemented from physx::PxRefCounted.

◆ refitBVH()

PxBounds3 TriangleMesh::refitBVH ( )
virtual

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)
PhysX does not keep a mapping from the mesh to mesh shapes that reference it.
Call PxShape::setGeometry on each shape which references the mesh, to ensure that internal data structures are updated to reflect the new geometry.
PxShape::setGeometry does not guarantee correct/continuous behavior when objects are resting on top of old or new geometry.
It is also recommended to make sure that a call to validateTriangleMesh returns true if mesh cleaning is disabled.
Active edges information will be lost during refit, the rigid body mesh contact generation might not perform as expected.
See also
getNbVertices()
getVerticesForModification()
PxBVH34MidphaseDesc::quantized

Implements physx::PxTriangleMesh.

Reimplemented in physx::Gu::BV4TriangleMesh, and physx::Gu::RTreeTriangleMesh.

◆ release()

void TriangleMesh::release ( )
virtual

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

See also
PxPhysics.createTriangleMesh()

Implements physx::PxTriangleMesh.

◆ setPreferSDFProjection()

virtual void physx::Gu::TriangleMesh::setPreferSDFProjection ( bool  preferProjection)
inlinevirtual

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
[in]preferProjectionIndicates if projection is preferred

Implements physx::PxTriangleMesh.

Member Data Documentation

◆ mAdjacencies

PxU32* physx::Gu::TriangleMesh::mAdjacencies
protected

Adjacency information for each face - 3 adjacent faces Set to 0xFFFFffff if no adjacent face

◆ mFlags

PxU8 physx::Gu::TriangleMesh::mFlags
protected

Flag whether indices are 16 or 32 bits wide Flag whether triangle adajacencies are build


The documentation for this class was generated from the following files: