From c7a921796332e8fcd51f3e05c1a318a41282e1e2 Mon Sep 17 00:00:00 2001 From: sschirm Date: Fri, 6 Jan 2017 14:45:46 +0100 Subject: PhysX 3.4, APEX 1.4 release candidate update: @21542069 --- .../src/convex/InflationConvexHullLib.cpp | 31 +++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'PhysX_3.4/Source/PhysXCooking/src/convex/InflationConvexHullLib.cpp') diff --git a/PhysX_3.4/Source/PhysXCooking/src/convex/InflationConvexHullLib.cpp b/PhysX_3.4/Source/PhysXCooking/src/convex/InflationConvexHullLib.cpp index 8f60275c..392a890a 100644 --- a/PhysX_3.4/Source/PhysXCooking/src/convex/InflationConvexHullLib.cpp +++ b/PhysX_3.4/Source/PhysXCooking/src/convex/InflationConvexHullLib.cpp @@ -23,7 +23,7 @@ // components in life support devices or systems without express written approval of // NVIDIA Corporation. // -// Copyright (c) 2008-2016 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -572,20 +572,34 @@ PxConvexMeshCookingResult::Enum InflationConvexHullLib::createConvexHull() PxConvexMeshCookingResult::Enum res = PxConvexMeshCookingResult::eFAILURE; PxU32 vcount = mConvexMeshDesc.points.count; - if ( vcount < 8 ) + if (vcount < 8) vcount = 8; - // allocate additional vec3 for V4 safe load in VolumeInteration + // allocate additional vec3 for V4 safe load in VolumeIntegration PxVec3* vsource = reinterpret_cast (PX_ALLOC_TEMP( sizeof(PxVec3)*vcount + 1, "PxVec3")); PxVec3 scale; PxVec3 center; PxU32 ovcount; // cleanup the vertices first - if(!cleanupVertices(mConvexMeshDesc.points.count, reinterpret_cast (mConvexMeshDesc.points.data), mConvexMeshDesc.points.stride, - ovcount, vsource, scale, center )) - return res; - + if(mConvexMeshDesc.flags & PxConvexFlag::eSHIFT_VERTICES) + { + if(!shiftAndcleanupVertices(mConvexMeshDesc.points.count, reinterpret_cast (mConvexMeshDesc.points.data), mConvexMeshDesc.points.stride, + ovcount, vsource, scale, center )) + { + PX_FREE(vsource); + return res; + } + } + else + { + if(!cleanupVertices(mConvexMeshDesc.points.count, reinterpret_cast (mConvexMeshDesc.points.data), mConvexMeshDesc.points.stride, + ovcount, vsource, scale, center )) + { + PX_FREE(vsource); + return res; + } + } // scale vertices back to their original size. for (PxU32 i=0; i