utility functions for use with PxSoftBody and subclasses
More...
#include <PxSoftBodyExt.h>
|
| static void | updateMass (PxSoftBody &softBody, const PxReal density, const PxReal maxInvMassRatio) |
| | Computes the SoftBody's vertex masses from the provided density and the volume of the tetrahedra.
|
| |
| static void | setMass (PxSoftBody &softBody, const PxReal mass, const PxReal maxInvMassRatio) |
| | Computes the SoftBody's vertex masses such that the sum of all masses is equal to the provided mass.
|
| |
| static void | transform (PxSoftBody &softBody, const PxTransform &transform, const PxReal scale) |
| | Transforms a SoftBody.
|
| |
| static void | updateEmbeddedCollisionMesh (PxSoftBody &softBody) |
| | Updates the collision mesh's vertex positions to match the simulation mesh's transformation and scale.
|
| |
| static void | commit (PxSoftBody &softBody, PxSoftBodyDataFlags flags, bool flush=false) |
| | Uploads prepared SoftBody data to the GPU. It ensures that the embedded collision mesh matches the simulation mesh's transformation and scale.
|
| |
| static PxSoftBodyMesh * | createSoftBodyMesh (const PxCookingParams ¶ms, const PxSimpleTriangleMesh &surfaceMesh, PxU32 numVoxelsAlongLongestAABBAxis, PxInsertionCallback &insertionCallback, const bool validate=true) |
| | Creates a full SoftBody mesh matching the shape given as input. Uses a voxel mesh for FEM simulation and a surface-matching mesh for collision detection.
|
| |
| static PxSoftBodyMesh * | createSoftBodyMeshNoVoxels (const PxCookingParams ¶ms, const PxSimpleTriangleMesh &surfaceMesh, PxInsertionCallback &insertionCallback, PxReal maxWeightRatioInTet=1.5f, const bool validate=true) |
| | Creates a full SoftBody mesh matching the shape given as input. Uses the same surface-matching mesh for collision detection and FEM simulation.
|
| |
| static PxSoftBody * | createSoftBodyFromMesh (PxSoftBodyMesh *softBodyMesh, const PxTransform &transform, const PxFEMSoftBodyMaterial &material, PxCudaContextManager &cudaContextManager, PxReal density=100.0f, PxU32 solverIterationCount=30, const PxFEMParameters &femParams=PxFEMParameters(), PxReal scale=1.0f) |
| | Creates a SoftBody instance from a SoftBody mesh.
|
| |
| static PxSoftBody * | createSoftBodyBox (const PxTransform &transform, const PxVec3 &boxDimensions, const PxFEMSoftBodyMaterial &material, PxCudaContextManager &cudaContextManager, PxReal maxEdgeLength=-1.0f, PxReal density=100.0f, PxU32 solverIterationCount=30, const PxFEMParameters &femParams=PxFEMParameters(), PxU32 numVoxelsAlongLongestAABBAxis=10, PxReal scale=1.0f) |
| | Creates a SoftBody instance with a box shape.
|
| |
utility functions for use with PxSoftBody and subclasses
◆ commit()
Uploads prepared SoftBody data to the GPU. It ensures that the embedded collision mesh matches the simulation mesh's transformation and scale.
- Parameters
-
| [in] | softBody | The soft body which will perform the data upload |
| [in] | flags | Specifies which buffers the data transfer should include |
| [in] | flush | If set to true, the upload will get processed immediately, otherwise it will take place before the data is needed for calculations on the GPU |
- See also
- PxSoftBody
◆ createSoftBodyBox()
Creates a SoftBody instance with a box shape.
- Parameters
-
| [in] | transform | The transform that defines initial position and orientation of the SoftBody |
| [in] | boxDimensions | The dimensions (side lengths) of the box shape |
| [in] | material | The material |
| [in] | cudaContextManager | A cuda context manager |
| [in] | maxEdgeLength | The maximal length of a triangle edge. Subdivision will get applied until the edge length criteria is matched. -1 means no subdivision is applied. |
| [in] | density | The density used to compute the mass properties |
| [in] | solverIterationCount | The number of iterations the solver should apply during simulation |
| [in] | femParams | Additional parameters to specify e. g. damping |
| [in] | numVoxelsAlongLongestAABBAxis | The number of voxels to use for the simulation mesh along the longest bounding box dimension |
| [in] | scale | The scaling of the SoftBody |
- Returns
- SoftBody instance
- See also
- PxSoftBodyMesh, PxSoftBody
◆ createSoftBodyFromMesh()
Creates a SoftBody instance from a SoftBody mesh.
- Parameters
-
| [in] | softBodyMesh | The SoftBody mesh |
| [in] | transform | The transform that defines initial position and orientation of the SoftBody |
| [in] | material | The material |
| [in] | cudaContextManager | A cuda context manager |
| [in] | density | The density used to compute the mass properties |
| [in] | solverIterationCount | The number of iterations the solver should apply during simulation |
| [in] | femParams | Additional parameters to specify e. g. damping |
| [in] | scale | The scaling of the SoftBody |
- Returns
- SoftBody instance
- See also
- PxSoftBodyMesh, PxSoftBody
◆ createSoftBodyMesh()
Creates a full SoftBody mesh matching the shape given as input. Uses a voxel mesh for FEM simulation and a surface-matching mesh for collision detection.
- Parameters
-
| [in] | params | Cooking params instance required for mesh processing |
| [in] | surfaceMesh | Input triangle mesh that represents the surface of the SoftBody |
| [in] | numVoxelsAlongLongestAABBAxis | The number of voxels along the longest bounding box axis |
| [in] | insertionCallback | The insertion interface from PxPhysics |
| [in] | validate | If set to true the input triangle mesh will get analyzed to find possible deficiencies |
- Returns
- SoftBody mesh if cooking was successful, NULL otherwise
- See also
- PxSoftBodyMesh
◆ createSoftBodyMeshNoVoxels()
Creates a full SoftBody mesh matching the shape given as input. Uses the same surface-matching mesh for collision detection and FEM simulation.
- Parameters
-
| [in] | params | Cooking params instance required for mesh processing |
| [in] | surfaceMesh | Input triangle mesh that represents the surface of the SoftBody |
| [in] | insertionCallback | The insertion interface from PxPhysics |
| [in] | maxWeightRatioInTet | Upper limit for the ratio of node weights that are adjacent to the same tetrahedron. The closer to one (while remaining larger than one), the more stable the simulation. |
| [in] | validate | If set to true the input triangle mesh will get analyzed to find possible deficiencies |
- Returns
- SoftBody mesh if cooking was successful, NULL otherwise
- See also
- PxSoftBodyMesh
◆ setMass()
Computes the SoftBody's vertex masses such that the sum of all masses is equal to the provided mass.
The buffers affected by this operation can be obtained from the SoftBody using the methods getSimPositionInvMassCPU() and getSimVelocityInvMassCPU()
The inverse mass is stored in the 4th component (the first three components are x, y, z coordinates) of the simulation mesh's position and velocity buffer. Performance optimizations are the reason why the mass inverse is stored in two locations.
- Parameters
-
| [in] | softBody | The soft body which will get its mass updated |
| [in] | mass | The SoftBody's mass |
| [in] | maxInvMassRatio | Maximum allowed ratio defined as max(vertexMasses) / min(vertexMasses) where vertexMasses is a list of float values with a mass for every vertex in the simulation mesh |
- See also
- PxSoftBody PxSoftBody::getSimPositionInvMassCPU() PxSoftBody::getSimVelocityInvMassCPU()
◆ transform()
Transforms a SoftBody.
The buffers affected by this operation can be obtained from the SoftBody using the methods getSimPositionInvMassCPU() and getSimVelocityInvMassCPU()
Applies a transformation to the simulation mesh's positions an velocities. Velocities only get rotated and scaled (translation is not applicable to direction vectors). It does not modify the body's mass. If the method is called multiple times, the transformation will compound with the ones previously applied.
- Parameters
-
| [in] | softBody | The soft body which is transformed |
| [in] | transform | The transform to apply |
| [in] | scale | A scaling factor |
- See also
- PxSoftBody PxSoftBody::getSimPositionInvMassCPU() PxSoftBody::getSimVelocityInvMassCPU()
◆ updateEmbeddedCollisionMesh()
| void PxSoftBodyExt::updateEmbeddedCollisionMesh |
( |
PxSoftBody & |
softBody | ) |
|
|
static |
Updates the collision mesh's vertex positions to match the simulation mesh's transformation and scale.
The buffer affected by this operation can be obtained from the SoftBody using the method getPositionInvMassCPU()
- Parameters
-
| [in] | softBody | The soft body which will get its collision mesh vertices updated |
- See also
- PxSoftBody PxSoftBody::getPositionInvMassCPU()
◆ updateMass()
Computes the SoftBody's vertex masses from the provided density and the volume of the tetrahedra.
The buffers affected by this operation can be obtained from the SoftBody using the methods getSimPositionInvMassCPU() and getSimVelocityInvMassCPU()
The inverse mass is stored in the 4th component (the first three components are x, y, z coordinates) of the simulation mesh's position and velocity buffer. Performance optimizations are the reason why the mass inverse is stored in two locations.
- Parameters
-
| [in] | softBody | The soft body which will get its mass updated |
| [in] | density | The density to used to calculate the mass from the body's volume |
| [in] | maxInvMassRatio | Maximum allowed ratio defined as max(vertexMasses) / min(vertexMasses) where vertexMasses is a list of float values with a mass for every vertex in the simulation mesh |
- See also
- PxSoftBody PxSoftBody::getSimPositionInvMassCPU() PxSoftBody::getSimVelocityInvMassCPU()
The documentation for this class was generated from the following files:
- RavEngine/deps/physx/physx/include/extensions/PxSoftBodyExt.h
- RavEngine/deps/physx/physx/source/physxextensions/src/ExtSoftBodyExt.cpp