PxDeformableSurfaceExt
Defined in include/extensions/PxDeformableSurfaceExt.h
-
class PxDeformableSurfaceExt
Utility functions for use with PxDeformableSurface.
Public Static Functions
-
static void copyToDevice(PxDeformableSurface &deformableSurface, PxDeformableSurfaceDataFlags flags, PxU32 nbVertices, PxVec4 *positionsPinned, PxVec4 *velocitiesPinned, PxVec4 *restPositionsPinned, CUstream copyStream = CUstream(0))
Uploads prepared deformable surface data to the GPU.
See also
PxDeformableSurface
- Parameters
deformableSurface – [in] The deformable surface to perform the data upload to.
flags – [in] Specifies which buffers the data transfer should include.
nbVertices – [in] The number of vertices in the surface deformable mesh.
positionsPinned – [in] A pointer to a pinned host memory buffer containing position and inverse mass for each vertex.
velocitiesPinned – [in] A pointer to a pinned host memory buffer containing the velocity for each vertex.
restPositionsPinned – [in] A pointer to a pinned host memory buffer containing the rest position for each vertex.
copyStream – [in] An optional cuda stream to schedule the copy on.
-
static void distributeTriangleMassToVertices(PxDeformableSurface &deformableSurface, const PxReal *triangleMasses, PxVec4 *positionInvMassPinned)
Distributes a list of triangles masses to vertices.
The mass for each triangle will be distributed in equal parts to the vertices of said triangle.
See also
PxDeformableSurface
- Parameters
deformableSurface – [in] The deformable surface to perform the operation on.
triangleMasses – [in] A list of floats specifying the mass of each triangle.
positionInvMassPinned – [in] A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex.
-
static void distributeDensityToVertices(PxDeformableSurface &deformableSurface, PxReal massPerVolume, PxReal clothThickness, PxVec4 *positionInvMassPinned)
Distributes a uniform density to the vertices of a deformable surface.
This method distributes mass based on a specified mass per unit area. The mass for each vertex is calculated according to the area of the triangles connected to it, and the resulting mass is assigned to the vertex.
See also
PxDeformableSurface
- Parameters
deformableSurface – [in] The deformable surface to perform the operation on.
massPerVolume – [in] The mass per unit volume (=density) to be distributed across the vertices.
clothThickness – [in] The cloth thickness to compute the mass
positionInvMassPinned – [in] A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex.
-
static void distributeMassToVertices(PxDeformableSurface &deformableSurface, PxReal totalMass, PxVec4 *positionInvMassPinned)
Distributes a total mass uniformly to the vertices of a deformable surface.
This method calculates the total mass to be distributed across all vertices, and assigns a proportional mass to each vertex based on the geometry of the surface. The mass is distributed equally to ensure the total mass of the surface matches the specified value.
See also
PxDeformableSurface
- Parameters
deformableSurface – [in] The deformable surface to perform the operation on.
totalMass – [in] The total mass to be distributed across the vertices.
positionInvMassPinned – [in] A pointer to a pinned host memory buffer containing positions and inverse masses for each vertex.
-
static PxU32 allocateAndInitializeHostMirror(PxDeformableSurface &deformableSurface, const PxVec3 *positions, const PxVec3 *velocities, const PxVec3 *restPositions, float mass, const PxTransform &transform, PxCudaContextManager *cudaContextManager, PxVec4 *&positionInvMassPinned, PxVec4 *&velocityPinned, PxVec4 *&restPositionPinned)
Allocates and initializes a pinned host memory from a PxTriangleMesh attached to a PxDeformableSurface using a PxShape.
This method fails if the deformable surface does not have a shape attached to it.
See also
PxDeformableSurface
Note
The user is responsible for deallocation and lifetime management of the positionInvMassPinned, velocityPinned and restPositionsPinned buffers.
- Parameters
deformableSurface – [in] The deformable surface to perform the operation on.
positions – [in] The initial positions of the surface deformable vertices.
velocities – [in] The initial velocities of the surface deformable vertices.
restPositions – [in] The rest positions of the surface deformable vertices.
mass – [in] The mass of the deformable surface, will be distributed equally among vertices.
transform – [in] The world-space transform of the deformable surface.
cudaContextManager – [in] The PxCudaContextManager of the scene this deformable surface will be simulated in.
positionInvMassPinned – [in] A reference to a pointer for the return value of the positionInvMassPinned buffer, will be set by this function.
velocityPinned – [in] A reference to a pointer for the return value of the velocityPinned buffer, will be set by this function.
restPositionPinned – [in] A reference to a pointer for the return value of the restPositionPinned buffer, will be set by this function.
- Returns
The number of vertices in the surface deformable mesh.
-
static PxU32 allocateAndInitializeHostMirror(const PxVec3 *positions, const PxVec3 *velocities, const PxVec3 *restPositions, PxU32 nbVertices, float mass, const PxTransform &transform, PxCudaContextManager *cudaContextManager, PxVec4 *&positionInvMassPinned, PxVec4 *&velocityPinned, PxVec4 *&restPositionPinned)
Allocates and initializes a pinned host memory from given positions, velocities, and rest positions.
If the input ‘restPositions’ is a null pointer, positions are used in place of restPositions. If the input ‘velocities’ is a null pointer, zero velocities are assigned to velocityPinned.
See also
PxDeformableSurface
Note
The user is responsible for deallocation and lifetime management of the positionInvMassPinned, velocityPinned and restPositionsPinned buffers.
- Parameters
positions – [in] The positions of the surface deformable vertices, will be used to assign positionInvMassPinned buffer.
velocities – [in] The velocities of the surface deformable vertices, will be used to assign velocityPinned buffer.
restPositions – [in] The rest positions of the surface deformable vertices, will be used to assign restPositionPinned buffer.
nbVertices – [in] The number of vertices in the surface deformable mesh.
mass – [in] The mass of the deformable surface, will be distributed equally among vertices.
transform – [in] The world-space transform of the deformable surface.
cudaContextManager – [in] The PxCudaContextManager of the scene this deformable surface will be simulated in.
positionInvMassPinned – [in] A reference to a pointer for the return value of the positionInvMassPinned buffer, will be set by this function.
velocityPinned – [in] A reference to a pointer for the return value of the velocityPinned buffer, will be set by this function.
restPositionPinned – [in] A reference to a pointer for the return value of the restPositionPinned buffer, will be set by this function.
- Returns
The number of vertices in the surface deformable mesh.
-
static void copyToDevice(PxDeformableSurface &deformableSurface, PxDeformableSurfaceDataFlags flags, PxU32 nbVertices, PxVec4 *positionsPinned, PxVec4 *velocitiesPinned, PxVec4 *restPositionsPinned, CUstream copyStream = CUstream(0))