PxCooking Class Referenceabstract

#include <PxCooking.h>

Public Member Functions

virtual void release ()=0
 Closes this instance of the interface. More...
 
virtual void setParams (const PxCookingParams &params)=0
 Sets cooking parameters. More...
 
virtual const PxCookingParamsgetParams () const =0
 Gets cooking parameters. More...
 
virtual bool platformMismatch () const =0
 Checks endianness is the same between cooking & target platforms. More...
 
virtual bool cookTriangleMesh (const PxTriangleMeshDesc &desc, PxOutputStream &stream, PxTriangleMeshCookingResult::Enum *condition=NULL) const =0
 Cooks a triangle mesh. The results are written to the stream. More...
 
virtual PxTriangleMeshcreateTriangleMesh (const PxTriangleMeshDesc &desc, PxPhysicsInsertionCallback &insertionCallback, PxTriangleMeshCookingResult::Enum *condition=NULL) const =0
 Cooks and creates a triangle mesh and inserts it into PxPhysics. More...
 
virtual bool validateTriangleMesh (const PxTriangleMeshDesc &desc) const =0
 Verifies if the triangle mesh is valid. Prints an error message for each inconsistency found. More...
 
virtual bool cookConvexMesh (const PxConvexMeshDesc &desc, PxOutputStream &stream, PxConvexMeshCookingResult::Enum *condition=NULL) const =0
 Cooks a convex mesh. The results are written to the stream. More...
 
virtual PxConvexMeshcreateConvexMesh (const PxConvexMeshDesc &desc, PxPhysicsInsertionCallback &insertionCallback, PxConvexMeshCookingResult::Enum *condition=NULL) const =0
 Cooks and creates a convex mesh and inserts it into PxPhysics. More...
 
virtual bool validateConvexMesh (const PxConvexMeshDesc &desc) const =0
 Verifies if the convex mesh is valid. Prints an error message for each inconsistency found. More...
 
virtual bool computeHullPolygons (const PxSimpleTriangleMesh &mesh, PxAllocatorCallback &inCallback, PxU32 &nbVerts, PxVec3 *&vertices, PxU32 &nbIndices, PxU32 *&indices, PxU32 &nbPolygons, PxHullPolygon *&hullPolygons) const =0
 Computed hull polygons from given vertices and triangles. Polygons are needed for PxConvexMeshDesc rather than triangles. More...
 
virtual bool cookHeightField (const PxHeightFieldDesc &desc, PxOutputStream &stream) const =0
 Cooks a heightfield. The results are written to the stream. More...
 
virtual PxHeightFieldcreateHeightField (const PxHeightFieldDesc &desc, PxPhysicsInsertionCallback &insertionCallback) const =0
 Cooks and creates a heightfield mesh and inserts it into PxPhysics. More...
 
virtual bool cookBVHStructure (const PxBVHStructureDesc &desc, PxOutputStream &stream) const =0
 Cooks a bounding volume hierarchy structure. The results are written to the stream. More...
 
virtual PxBVHStructurecreateBVHStructure (const PxBVHStructureDesc &desc, PxPhysicsInsertionCallback &insertionCallback) const =0
 Cooks and creates a bounding volume hierarchy structure and inserts it into PxPhysics. More...
 

Protected Member Functions

virtual ~PxCooking ()
 

Constructor & Destructor Documentation

◆ ~PxCooking()

virtual PxCooking::~PxCooking ( )
inlineprotectedvirtual

Member Function Documentation

◆ computeHullPolygons()

virtual bool PxCooking::computeHullPolygons ( const PxSimpleTriangleMesh mesh,
PxAllocatorCallback inCallback,
PxU32 nbVerts,
PxVec3 *&  vertices,
PxU32 nbIndices,
PxU32 *&  indices,
PxU32 nbPolygons,
PxHullPolygon *&  hullPolygons 
) const
pure virtual

Computed 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 array's. It is the user responsibility to deallocated those array's.

Parameters
[in]meshSimple triangle mesh containing vertices and triangles used to compute polygons.
[in]inCallbackMemory allocator for out array allocations.
[out]nbVertsNumber of vertices used by polygons.
[out]verticesVertices array used by polygons.
[out]nbIndicesNumber of indices used by polygons.
[out]indicesIndices array used by polygons.
[out]nbPolygonsNumber of created polygons.
[out]hullPolygonsPolygons array.
Returns
true on success
See also
cookConvexMesh() PxConvexFlags PxConvexMeshDesc PxSimpleTriangleMesh

◆ cookBVHStructure()

virtual bool PxCooking::cookBVHStructure ( const PxBVHStructureDesc desc,
PxOutputStream stream 
) const
pure virtual

Cooks a bounding volume hierarchy structure. The results are written to the stream.

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

Parameters
[in]descThe BVH structure descriptor.
[in]streamUser stream to output the cooked data.
Returns
true on success.
See also
PxBVHStructure PxRigidActorExt::getRigidActorShapeLocalBoundsList

◆ cookConvexMesh()

virtual bool PxCooking::cookConvexMesh ( const PxConvexMeshDesc desc,
PxOutputStream stream,
PxConvexMeshCookingResult::Enum condition = NULL 
) const
pure virtual

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.

cookConvexMesh() 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.
If those limits are exceeded in either the user-provided data or the final cooked mesh, an error is reported.
Parameters
[in]descThe convex mesh descriptor to read the mesh from.
[in]streamUser stream to output the cooked data.
[out]conditionResult from convex mesh cooking.
Returns
true on success.
See also
cookTriangleMesh() setParams() PxConvexMeshCookingResult::Enum

◆ cookHeightField()

virtual bool PxCooking::cookHeightField ( const PxHeightFieldDesc desc,
PxOutputStream stream 
) const
pure virtual

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.

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

Parameters
[in]descThe heightfield descriptor to read the HF from.
[in]streamUser stream to output the cooked data.
Returns
true on success
See also
PxPhysics.createHeightField()

◆ cookTriangleMesh()

virtual bool PxCooking::cookTriangleMesh ( const PxTriangleMeshDesc desc,
PxOutputStream stream,
PxTriangleMeshCookingResult::Enum condition = NULL 
) const
pure virtual

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.

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

Parameters
[in]descThe triangle mesh descriptor to read the mesh from.
[in]streamUser stream to output the cooked data.
[out]conditionResult from triangle mesh cooking.
Returns
true on success
See also
cookConvexMesh() setParams() PxPhysics.createTriangleMesh() PxTriangleMeshCookingResult::Enum

◆ createBVHStructure()

virtual PxBVHStructure* PxCooking::createBVHStructure ( const PxBVHStructureDesc desc,
PxPhysicsInsertionCallback insertionCallback 
) const
pure virtual

Cooks and creates a bounding volume hierarchy structure and inserts it into PxPhysics.

Note
This method does the same as cookBVHStructure, but the produced BVH structure is not stored into a stream but is directly inserted in PxPhysics. Use this method if you are unable to cook offline.
PxPhysicsInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback().
Parameters
[in]descThe BVH structure descriptor.
[in]insertionCallbackThe insertion interface from PxPhysics.
Returns
PxBVHStructure pointer on success
See also
cookBVHStructure() PxPhysicsInsertionCallback

◆ createConvexMesh()

virtual PxConvexMesh* PxCooking::createConvexMesh ( const PxConvexMeshDesc desc,
PxPhysicsInsertionCallback insertionCallback,
PxConvexMeshCookingResult::Enum condition = NULL 
) const
pure virtual

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

Note
This method does the same as cookConvexMesh, but the produced convex mesh is not stored into a stream but is directly inserted in PxPhysics. Use this method if you are unable to cook offline.
PxPhysicsInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback().
Parameters
[in]descThe convex mesh descriptor to read the mesh from.
[in]insertionCallbackThe insertion interface from PxPhysics.
[out]conditionResult from convex mesh cooking.
Returns
PxConvexMesh pointer on success
See also
cookConvexMesh() setParams() PxPhysicsInsertionCallback

◆ createHeightField()

virtual PxHeightField* PxCooking::createHeightField ( const PxHeightFieldDesc desc,
PxPhysicsInsertionCallback insertionCallback 
) const
pure virtual

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

Parameters
[in]descThe heightfield descriptor to read the HF from.
[in]insertionCallbackThe insertion interface from PxPhysics.
Returns
PxHeightField pointer on success
See also
cookConvexMesh() setParams() PxPhysics.createTriangleMesh() PxPhysicsInsertionCallback

◆ createTriangleMesh()

virtual PxTriangleMesh* PxCooking::createTriangleMesh ( const PxTriangleMeshDesc desc,
PxPhysicsInsertionCallback insertionCallback,
PxTriangleMeshCookingResult::Enum condition = NULL 
) const
pure virtual

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

Note
PxPhysicsInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback().
Parameters
[in]descThe triangle mesh descriptor to read the mesh from.
[in]insertionCallbackThe insertion interface from PxPhysics.
[out]conditionResult from triangle mesh cooking.
Returns
PxTriangleMesh pointer on success.
See also
cookTriangleMesh() setParams() PxPhysics.createTriangleMesh() PxPhysicsInsertionCallback

◆ getParams()

virtual const PxCookingParams& PxCooking::getParams ( ) const
pure virtual

Gets cooking parameters.

Returns
Current cooking parameters.
See also
PxCookingParams setParams()

◆ platformMismatch()

virtual bool PxCooking::platformMismatch ( ) const
pure virtual

Checks endianness is the same between cooking & target platforms.

Returns
True if there is and endian mismatch.

◆ release()

virtual void PxCooking::release ( )
pure virtual

Closes this instance of the interface.

This function should be called to cleanly shut down the Cooking library before application exit.

Note
This function is required to be called to release foundation usage.

◆ setParams()

virtual void PxCooking::setParams ( const PxCookingParams params)
pure virtual

Sets cooking parameters.

Parameters
[in]paramsCooking parameters
See also
getParams()

◆ validateConvexMesh()

virtual bool PxCooking::validateConvexMesh ( const PxConvexMeshDesc desc) const
pure virtual

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
[in]descThe convex mesh descriptor to read the mesh from.
Returns
true if all the validity conditions hold, false otherwise.
See also
cookConvexMesh()

◆ validateTriangleMesh()

virtual bool PxCooking::validateTriangleMesh ( const PxTriangleMeshDesc desc) const
pure virtual

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
[in]descThe triangle mesh descriptor to read the mesh from.
Returns
true if all the validity conditions hold, false otherwise.
See also
cookTriangleMesh()

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