Cooking

Classes

Functions

Structs

Typedefs

Functions

physx::PxSoftBodyMesh *PxAssembleSoftBodyMesh(physx::PxTetrahedronMeshData &simulationMesh, physx::PxSoftBodySimulationData &simulationData, physx::PxTetrahedronMeshData &collisionMesh, physx::PxSoftBodyCollisionData &collisionData, physx::PxCollisionMeshMappingData &mappingData, physx::PxInsertionCallback &insertionCallback)

Bundles all data required for softbody simulation.

Creates a container that provides everything to create a PxSoftBody

See also

PxSoftBody createSoftBody()

Parameters
  • simulationMesh[in] The geometry (tetrahedral mesh) to be used as simulation mesh

  • simulationData[in] Additional non-tetmesh data that contains mass information etc. for the simulation mesh

  • collisionMesh[in] The geometry (tetrahedral mesh) to be used for collision detection

  • collisionData[in] Additional non-tetmesh data that contains surface information, acceleration structures etc. for the simulation mesh

  • mappingData[in] Mapping that describes how the collision mesh’s vertices are embedded into the simulation mesh

  • insertionCallback[in] The insertion interface from PxPhysics.

Returns

PxSoftBodyMesh pointer that represents a softbody mesh bundling all data (simulation mesh, collision mesh etc.)

physx::PxSoftBodyMesh *PxAssembleSoftBodyMesh_Sim(physx::PxSimulationTetrahedronMeshData &simulationMesh, physx::PxCollisionTetrahedronMeshData &collisionMesh, physx::PxCollisionMeshMappingData &mappingData, physx::PxInsertionCallback &insertionCallback)

Bundles all data required for softbody simulation.

Creates a container that provides everything to create a PxSoftBody

See also

PxSoftBody createSoftBody()

Parameters
  • simulationMesh[in] Container that provides all information about the simulation mesh (geometry, mass distribution etc.)

  • collisionMesh[in] Container that provides all information about the collision mesh (geometry, surface information, acceleration structures etc.)

  • mappingData[in] Mapping that describes how the collision mesh’s vertices are embedded into the simulation mesh

  • insertionCallback[in] The insertion interface from PxPhysics.

Returns

PxSoftBodyMesh pointer that represents a softbody mesh bundling all data (simulation mesh, collision mesh etc.)

physx::PxCollisionTetrahedronMeshData *PxComputeCollisionData(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &collisionMeshDesc)

Computes data to accelerate collision detection of tetrahedral meshes.

Computes data structures to speed up collision detection with tetrahedral meshes.

Parameters
  • params[in] The cooking parameters

  • collisionMeshDesc[in] Raw tetrahedral mesh descriptor wich will be used for collision detection

Returns

PxCollisionTetrahedronMeshData pointer that describes the collision mesh

bool PxComputeHullPolygons(const physx::PxCookingParams &params, const physx::PxSimpleTriangleMesh &mesh, physx::PxAllocatorCallback &inCallback, physx::PxU32 &nbVerts, physx::PxVec3 *&vertices, physx::PxU32 &nbIndices, physx::PxU32 *&indices, physx::PxU32 &nbPolygons, physx::PxHullPolygon *&hullPolygons)

Compute hull polygons from given vertices and triangles.

Polygons are needed for PxConvexMeshDesc rather than triangles.

Please note that the resulting polygons may have different number of vertices. Some vertices may be removed. The output vertices, indices and polygons must be used to construct a hull.

The provided PxAllocatorCallback does allocate the out arrays. It is the user responsibility to deallocated those arrays.

Parameters
  • params[in] The cooking parameters

  • mesh[in] Simple triangle mesh containing vertices and triangles used to compute polygons.

  • inCallback[in] Memory allocator for out array allocations.

  • nbVerts[out] Number of vertices used by polygons.

  • vertices[out] Vertices array used by polygons.

  • nbIndices[out] Number of indices used by polygons.

  • indices[out] Indices array used by polygons.

  • nbPolygons[out] Number of created polygons.

  • hullPolygons[out] Polygons array.

Returns

true on success

physx::PxCollisionMeshMappingData *PxComputeModelsMapping(const physx::PxCookingParams &params, physx::PxTetrahedronMeshData &simulationMesh, const physx::PxTetrahedronMeshData &collisionMesh, const physx::PxSoftBodyCollisionData &collisionData, const physx::PxBoundedData *vertexToTet = NULL)

Computes the mapping between collision and simulation mesh.

The softbody deformation is computed on the simulation mesh. To deform the collision mesh accordingly it needs to be specified how its vertices need to be placed and updated inside the deformation mesh. This method computes that embedding information.

Parameters
  • params[in] The cooking parameters

  • simulationMesh[in] A tetrahedral mesh that defines the shape of the simulation mesh which is used to compute the body’s deformation

  • collisionMesh[in] A tetrahedral mesh that defines the shape of the collision mesh which is used for collision detection

  • collisionData[in] A data container that contains acceleration structures and surface information of the collision mesh

  • vertexToTet[in] Optional indices (array of integers) that specifies the index of the tetrahedron in the simulation mesh that contains a collision mesh vertex. If not provided, the embedding will be computed internally. If the simulation mesh is obtained from PxTetMaker::createVoxelTetrahedronMesh, then the vertexToTet map createVoxelTetrahedronMesh returned should be used here.

Returns

PxCollisionMeshMappingData pointer that describes how the collision mesh is embedded into the simulation mesh

physx::PxSimulationTetrahedronMeshData *PxComputeSimulationData(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &simulationMeshDesc)

Computes data to accelerate collision detection of tetrahedral meshes.

Computes data to compute and store a softbody’s deformation using FEM.

Parameters
  • params[in] The cooking parameters

  • simulationMeshDesc[in] Raw tetrahedral mesh descriptor wich will be used for FEM simulation

Returns

PxSimulationTetrahedronMeshData pointer that describes the simulation mesh

bool PxCookBVH(const physx::PxBVHDesc &desc, physx::PxOutputStream &stream)

Cooks a bounding volume hierarchy.

The results are written to the stream.

PxCookBVH() allows a BVH description to be cooked into a binary stream suitable for loading and performing BVH detection at runtime.

Parameters
  • desc[in] The BVH descriptor.

  • stream[in] User stream to output the cooked data.

Returns

true on success.

bool PxCookConvexMesh(const physx::PxCookingParams &params, const physx::PxConvexMeshDesc &desc, physx::PxOutputStream &stream, physx::PxConvexMeshCookingResult::Enum *condition = NULL)

Cooks a convex mesh.

The results are written to the stream.

To create a triangle mesh object it is necessary to first ‘cook’ the mesh data into a form which allows the SDK to perform efficient collision detection.

PxCookConvexMesh() allows a mesh description to be cooked into a binary stream suitable for loading and performing collision detection at runtime.

Note

The number of vertices and the number of convex polygons in a cooked convex mesh is limited to 255.

Note

If those limits are exceeded in either the user-provided data or the final cooked mesh, an error is reported.

Parameters
  • params[in] The cooking parameters

  • desc[in] The convex mesh descriptor to read the mesh from.

  • stream[in] User stream to output the cooked data.

  • condition[out] Result from convex mesh cooking.

Returns

true on success.

bool PxCookHeightField(const physx::PxHeightFieldDesc &desc, physx::PxOutputStream &stream)

Cooks a heightfield.

The results are written to the stream.

To create a heightfield object there is an option to precompute some of calculations done while loading the heightfield data.

PxCookHeightField() allows a heightfield description to be cooked into a binary stream suitable for loading and performing collision detection at runtime.

Parameters
  • desc[in] The heightfield descriptor to read the HF from.

  • stream[in] User stream to output the cooked data.

Returns

true on success

bool PxCookSoftBodyMesh(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &simulationMeshDesc, const physx::PxTetrahedronMeshDesc &collisionMeshDesc, const physx::PxSoftBodySimulationDataDesc &softbodyDataDesc, physx::PxOutputStream &stream)

Cooks a softbody mesh.

The results are written to the stream.

To create a softbody mesh object it is necessary to first ‘cook’ the mesh data into a form which allows the SDK to perform efficient collision detection and to store data used during the FEM calculations.

PxCookSoftBodyMesh() allows a mesh description to be cooked into a binary stream suitable for loading and performing collision detection at runtime.

Parameters
  • params[in] The cooking parameters

  • simulationMeshDesc[in] The tetrahedron mesh descriptor to read the simulation mesh from.

  • collisionMeshDesc[in] The tetrahedron mesh descriptor to read the collision mesh from.

  • softbodyDataDesc[in] The softbody data descriptor to read mapping information from.

  • stream[in] User stream to output the cooked data.

Returns

true on success

bool PxCookTetrahedronMesh(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &meshDesc, physx::PxOutputStream &stream)

Cooks a tetrahedron mesh.

The results are written to the stream.

To create a tetrahedron mesh object it is necessary to first ‘cook’ the mesh data into a form which allows the SDK to perform efficient collision detection.

PxCookTetrahedronMesh() allows a mesh description to be cooked into a binary stream suitable for loading and performing collision detection at runtime.

Parameters
  • params[in] The cooking parameters

  • meshDesc[in] The tetrahedron mesh descriptor to read the mesh from.

  • stream[in] User stream to output the cooked data.

Returns

true on success

bool PxCookTriangleMesh(const physx::PxCookingParams &params, const physx::PxTriangleMeshDesc &desc, physx::PxOutputStream &stream, physx::PxTriangleMeshCookingResult::Enum *condition = NULL)

Cooks a triangle mesh.

The results are written to the stream.

To create a triangle mesh object it is necessary to first ‘cook’ the mesh data into a form which allows the SDK to perform efficient collision detection.

PxCookTriangleMesh() allows a mesh description to be cooked into a binary stream suitable for loading and performing collision detection at runtime.

Parameters
  • params[in] The cooking parameters

  • desc[in] The triangle mesh descriptor to read the mesh from.

  • stream[in] User stream to output the cooked data.

  • condition[out] Result from triangle mesh cooking.

Returns

true on success

physx::PxBVH *PxCreateBVH(const physx::PxBVHDesc &desc, physx::PxInsertionCallback &insertionCallback)

Cooks and creates a bounding volume hierarchy without going through a stream.

Note

This method does the same as PxCookBVH, but the produced BVH is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • desc[in] The BVH descriptor.

  • insertionCallback[in] The insertion interface.

Returns

PxBVH pointer on success

inline physx::PxBVH *PxCreateBVH(const physx::PxBVHDesc &desc)

Cooks and creates a bounding volume hierarchy without going through a stream.

Convenience function for standalone objects.

Note

This method does the same as PxCookBVH, but the produced BVH is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters

desc[in] The BVH descriptor.

Returns

PxBVH pointer on success

physx::PxBVH *PxCreateBVHInternal(const physx::PxBVHInternalData &data)
inline physx::PxConvexMesh *PxCreateConvexMesh(const physx::PxCookingParams &params, const physx::PxConvexMeshDesc &desc)

Cooks and creates a convex mesh without going through a stream.

Convenience function for standalone objects.

Note

This method does the same as cookConvexMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • desc[in] The convex mesh descriptor to read the mesh from.

Returns

PxConvexMesh pointer on success

physx::PxConvexMesh *PxCreateConvexMesh(const physx::PxCookingParams &params, const physx::PxConvexMeshDesc &desc, physx::PxInsertionCallback &insertionCallback, physx::PxConvexMeshCookingResult::Enum *condition = NULL)

Cooks and creates a convex mesh without going through a stream.

Note

This method does the same as PxCookConvexMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • desc[in] The convex mesh descriptor to read the mesh from.

  • insertionCallback[in] The insertion interface from PxPhysics.

  • condition[out] Result from convex mesh cooking.

Returns

PxConvexMesh pointer on success

physx::PxHeightField *PxCreateHeightField(const physx::PxHeightFieldDesc &desc, physx::PxInsertionCallback &insertionCallback)

Cooks and creates a heightfield mesh and inserts it into PxPhysics.

Parameters
  • desc[in] The heightfield descriptor to read the HF from.

  • insertionCallback[in] The insertion interface from PxPhysics.

Returns

PxHeightField pointer on success

inline physx::PxHeightField *PxCreateHeightField(const physx::PxHeightFieldDesc &desc)

Cooks and creates a heightfield mesh and inserts it into PxPhysics.

Convenience function for standalone objects.

Parameters

desc[in] The heightfield descriptor to read the HF from.

Returns

PxHeightField pointer on success

inline physx::PxSoftBodyMesh *PxCreateSoftBodyMesh(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &simulationMeshDesc, const physx::PxTetrahedronMeshDesc &collisionMeshDesc, const physx::PxSoftBodySimulationDataDesc &softbodyDataDesc)

Cooks and creates a softbody mesh without going through a stream.

Convenience function for standalone objects.

Note

This method does the same as PxCookSoftBodyMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • simulationMeshDesc[in] The tetrahedron mesh descriptor to read the simulation mesh from.

  • collisionMeshDesc[in] The tetrahedron mesh descriptor to read the collision mesh from.

  • softbodyDataDesc[in] The softbody data descriptor to read mapping information from.

Returns

PxSoftBodyMesh pointer on success.

physx::PxSoftBodyMesh *PxCreateSoftBodyMesh(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &simulationMeshDesc, const physx::PxTetrahedronMeshDesc &collisionMeshDesc, const physx::PxSoftBodySimulationDataDesc &softbodyDataDesc, physx::PxInsertionCallback &insertionCallback)

Cooks and creates a softbody mesh without going through a stream.

Note

This method does the same as PxCookSoftBodyMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • simulationMeshDesc[in] The tetrahedron mesh descriptor to read the simulation mesh from.

  • collisionMeshDesc[in] The tetrahedron mesh descriptor to read the collision mesh from.

  • softbodyDataDesc[in] The softbody data descriptor to read mapping information from.

  • insertionCallback[in] The insertion interface from PxPhysics.

Returns

PxSoftBodyMesh pointer on success.

physx::PxTetrahedronMesh *PxCreateTetrahedronMesh(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &meshDesc, physx::PxInsertionCallback &insertionCallback)

Cooks and creates a tetrahedron mesh without going through a stream.

Note

This method does the same as PxCookTetrahedronMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • meshDesc[in] The tetrahedron mesh descriptor to read the mesh from.

  • insertionCallback[in] The insertion interface from PxPhysics.

Returns

PxTetrahedronMesh pointer on success.

inline physx::PxTetrahedronMesh *PxCreateTetrahedronMesh(const physx::PxCookingParams &params, const physx::PxTetrahedronMeshDesc &meshDesc)

Cooks and creates a tetrahedron mesh without going through a stream.

Convenience function for standalone objects.

Note

This method does the same as PxCookTetrahedronMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • meshDesc[in] The tetrahedron mesh descriptor to read the mesh from.

Returns

PxTetrahedronMesh pointer on success.

inline physx::PxTriangleMesh *PxCreateTriangleMesh(const physx::PxCookingParams &params, const physx::PxTriangleMeshDesc &desc)

Cooks and creates a triangle mesh without going through a stream.

Convenience function for standalone objects.

Note

This method does the same as cookTriangleMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • desc[in] The triangle mesh descriptor to read the mesh from.

Returns

PxTriangleMesh pointer on success.

physx::PxTriangleMesh *PxCreateTriangleMesh(const physx::PxCookingParams &params, const physx::PxTriangleMeshDesc &desc, physx::PxInsertionCallback &insertionCallback, physx::PxTriangleMeshCookingResult::Enum *condition = NULL)

Cooks and creates a triangle mesh without going through a stream.

Note

This method does the same as PxCookTriangleMesh, but the produced mesh is not stored into a stream but is either directly inserted in PxPhysics, or created as a standalone object. Use this method if you are unable to cook offline.

Parameters
  • params[in] The cooking parameters

  • desc[in] The triangle mesh descriptor to read the mesh from.

  • insertionCallback[in] The insertion interface from PxPhysics.

  • condition[out] Result from triangle mesh cooking.

Returns

PxTriangleMesh pointer on success.

physx::PxTriangleMesh *PxCreateTriangleMeshInternal(const physx::PxTriangleMeshInternalData &data)
physx::PxInsertionCallback *PxGetStandaloneInsertionCallback()

Gets standalone object insertion interface.

This interface allows the creation of standalone objects that can exist without a PxPhysics or PxScene object.

bool PxValidateConvexMesh(const physx::PxCookingParams &params, const physx::PxConvexMeshDesc &desc)

Verifies if the convex mesh is valid.

Prints an error message for each inconsistency found.

The convex mesh descriptor must contain an already created convex mesh - the vertices, indices and polygons must be provided.

Note

This function should be used if PxConvexFlag::eDISABLE_MESH_VALIDATION is planned to be used in release builds.

Parameters
  • params[in] The cooking parameters

  • desc[in] The convex mesh descriptor to read the mesh from.

Returns

true if all the validity conditions hold, false otherwise.

bool PxValidateTriangleMesh(const physx::PxCookingParams &params, const physx::PxTriangleMeshDesc &desc)

Verifies if the triangle mesh is valid.

Prints an error message for each inconsistency found.

The following conditions are true for a valid triangle mesh:

  1. There are no duplicate vertices (within specified vertexWeldTolerance. See PxCookingParams::meshWeldTolerance)

  2. There are no large triangles (within specified PxTolerancesScale.)

Parameters
  • params[in] The cooking parameters

  • desc[in] The triangle mesh descriptor to read the mesh from.

Returns

true if all the validity conditions hold, false otherwise.

Typedefs

typedef PxFlags<PxConvexFlag::Enum, PxU16> PxConvexFlags

collection of set bits defined in PxConvexFlag.

See also

PxConvexFlag

typedef PxFlags<PxMeshPreprocessingFlag::Enum, PxU32> PxMeshPreprocessingFlags