aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
diff options
context:
space:
mode:
authorsschirm <[email protected]>2017-02-27 16:40:12 +0100
committersschirm <[email protected]>2017-03-01 18:04:26 +0100
commit7840347c32755e94a807f978f1cbb558717ac8cf (patch)
tree295cd3ca93a45f8fcc43cf3cbf3887c0e0c5526b /PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
parentPre-release comments marking end of beta. (diff)
downloadphysx-3.4-7840347c32755e94a807f978f1cbb558717ac8cf.tar.xz
physx-3.4-7840347c32755e94a807f978f1cbb558717ac8cf.zip
PhysX 3.4, APEX 1.4 final release @21757769v3.4.0-rc-2
Diffstat (limited to 'PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp')
-rw-r--r--PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp b/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
index cb3208ed..8dbdec16 100644
--- a/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
+++ b/PhysX_3.4/Source/PhysXCooking/src/Cooking.cpp
@@ -201,7 +201,13 @@ bool Cooking::cookConvexMeshInternal(const PxConvexMeshDesc& desc_, ConvexMeshBu
if (mParams.areaTestEpsilon <= 0.0f)
{
- Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Cooking::cookConvexMesh: user-provided convex mesh areaTestEpsilon is invalid!");
+ Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Cooking::cookConvexMesh: provided cooking parameter areaTestEpsilon is invalid!");
+ return false;
+ }
+
+ if(mParams.planeTolerance < 0.0f)
+ {
+ Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "Cooking::cookConvexMesh: provided cooking parameter planeTolerance is invalid!");
return false;
}
@@ -262,12 +268,12 @@ bool Cooking::cookConvexMesh(const PxConvexMeshDesc& desc_, PxOutputStream& stre
if(desc_.flags & PxConvexFlag::eCOMPUTE_CONVEX)
{
- const PxU32 gpuMaxVertsLimit = 64;
+ const PxU16 gpuMaxVertsLimit = 64;
// GRB supports 64 verts max
if(desc_.flags & PxConvexFlag::eGPU_COMPATIBLE)
{
- desc.vertexLimit = gpuMaxVertsLimit;
+ desc.vertexLimit = PxMin(desc.vertexLimit, gpuMaxVertsLimit);
}
if(mParams.convexMeshCookingType == PxConvexMeshCookingType::eINFLATION_INCREMENTAL_HULL)
@@ -308,13 +314,23 @@ bool Cooking::cookConvexMesh(const PxConvexMeshDesc& desc_, PxOutputStream& stre
//////////////////////////////////////////////////////////////////////////
// cook convex mesh from given desc, copy the results into internal convex mesh
// and insert the mesh into PxPhysics
-PxConvexMesh* Cooking::createConvexMesh(const PxConvexMeshDesc& desc, PxPhysicsInsertionCallback& insertionCallback)
+PxConvexMesh* Cooking::createConvexMesh(const PxConvexMeshDesc& desc_, PxPhysicsInsertionCallback& insertionCallback)
{
PX_FPU_GUARD;
// choose cooking library if needed
ConvexHullLib* hullLib = NULL;
+ PxConvexMeshDesc desc = desc_;
+
if(desc.flags & PxConvexFlag::eCOMPUTE_CONVEX)
{
+ const PxU16 gpuMaxVertsLimit = 64;
+
+ // GRB supports 64 verts max
+ if(desc_.flags & PxConvexFlag::eGPU_COMPATIBLE)
+ {
+ desc.vertexLimit = PxMin(desc.vertexLimit, gpuMaxVertsLimit);
+ }
+
if (mParams.convexMeshCookingType == PxConvexMeshCookingType::eINFLATION_INCREMENTAL_HULL)
{
hullLib = PX_NEW(InflationConvexHullLib) (desc, mParams);