PxCooking Class Reference
[Cooking]
#include <PxCooking.h>
Public Member Functions | |
virtual void | release ()=0 |
Closes this instance of the interface. | |
virtual void | setParams (const PxCookingParams ¶ms)=0 |
Sets cooking parameters. | |
virtual const PxCookingParams & | getParams () const =0 |
Gets cooking parameters. | |
virtual bool | platformMismatch () const =0 |
Checks endianness is the same between cooking & target platforms. | |
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. | |
virtual PxTriangleMesh * | createTriangleMesh (const PxTriangleMeshDesc &desc, PxPhysicsInsertionCallback &insertionCallback) const =0 |
Cooks and creates a triangle mesh and inserts it into PxPhysics. | |
virtual bool | validateTriangleMesh (const PxTriangleMeshDesc &desc) const =0 |
Verifies if the triangle mesh is valid. Prints an error message for each inconsistency found. | |
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. | |
virtual PxConvexMesh * | createConvexMesh (const PxConvexMeshDesc &desc, PxPhysicsInsertionCallback &insertionCallback) const =0 |
Cooks and creates a convex mesh and inserts it into PxPhysics. | |
virtual bool | validateConvexMesh (const PxConvexMeshDesc &desc) const =0 |
Verifies if the convex mesh is valid. Prints an error message for each inconsistency found. | |
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. | |
virtual bool | cookHeightField (const PxHeightFieldDesc &desc, PxOutputStream &stream) const =0 |
Cooks a heightfield. The results are written to the stream. | |
virtual PxHeightField * | createHeightField (const PxHeightFieldDesc &desc, PxPhysicsInsertionCallback &insertionCallback) const =0 |
Cooks and creates a heightfield mesh and inserts it into PxPhysics. | |
Protected Member Functions | |
virtual | ~PxCooking () |
Constructor & Destructor Documentation
virtual PxCooking::~PxCooking | ( | ) | [inline, protected, virtual] |
Member Function Documentation
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] mesh Simple triangle mesh containing vertices and triangles used to compute polygons. [in] inCallback Memory allocator for out array allocations. [out] nbVerts Number of vertices used by polygons. [out] vertices Vertices array used by polygons. [out] nbIndices Number of indices used by polygons. [out] indices Indices array used by polygons. [out] nbPolygons Number of created polygons. [out] hullPolygons Polygons array.
- Returns:
- true on success
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.
Example
//TODO: Add Code Snippet Here
- 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] desc The convex mesh descriptor to read the mesh from. [in] stream User stream to output the cooked data. [out] condition Result from convex mesh cooking.
- Returns:
- true on success.
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] desc The heightfield descriptor to read the HF from. [in] stream User stream to output the cooked data.
- Returns:
- true on success
- See also:
- PxPhysics.createHeightField()
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.
Example
//TODO: Add Code Snippet Here
- Parameters:
-
[in] desc The triangle mesh descriptor to read the mesh from. [in] stream User stream to output the cooked data. [out] condition Result from triangle mesh cooking.
- Returns:
- true on success
virtual PxConvexMesh* PxCooking::createConvexMesh | ( | const PxConvexMeshDesc & | desc, | |
PxPhysicsInsertionCallback & | insertionCallback | |||
) | 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] desc The convex mesh descriptor to read the mesh from. [in] insertionCallback The insertion interface from PxPhysics.
- Returns:
- PxConvexMesh pointer on success
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] desc The heightfield descriptor to read the HF from. [in] insertionCallback The insertion interface from PxPhysics.
- Returns:
- PxHeightField pointer on success
virtual PxTriangleMesh* PxCooking::createTriangleMesh | ( | const PxTriangleMeshDesc & | desc, | |
PxPhysicsInsertionCallback & | insertionCallback | |||
) | const [pure virtual] |
Cooks and creates a triangle mesh and inserts it into PxPhysics.
- Note:
- PxPhysicsInsertionCallback can be obtained through PxPhysics::getPhysicsInsertionCallback().
- Parameters:
-
[in] desc The triangle mesh descriptor to read the mesh from. [in] insertionCallback The insertion interface from PxPhysics.
- Returns:
- PxTriangleMesh pointer on success.
virtual const PxCookingParams& PxCooking::getParams | ( | ) | const [pure virtual] |
virtual bool PxCooking::platformMismatch | ( | ) | const [pure virtual] |
Checks endianness is the same between cooking & target platforms.
- Returns:
- True if there is and endian mismatch.
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.
virtual void PxCooking::setParams | ( | const PxCookingParams & | params | ) | [pure virtual] |
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] desc The convex mesh descriptor to read the mesh from.
- Returns:
- true if all the validity conditions hold, false otherwise.
- See also:
- cookConvexMesh()
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] desc The 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:
Copyright © 2008-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com