aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysXCharacterKinematic
diff options
context:
space:
mode:
authorSheikh Dawood <[email protected]>2018-08-13 13:37:04 -0500
committerSheikh Dawood <[email protected]>2018-08-13 13:37:04 -0500
commit3f9977d72f8a481e76b6ad643a3d312a8cf9b551 (patch)
tree8dfa563cf2a06498b56b055af133bd066f1f349c /PhysX_3.4/Source/PhysXCharacterKinematic
parentPhysX 3.4, APEX 1.4 patch release @24214033 (diff)
downloadphysx-3.4-3f9977d72f8a481e76b6ad643a3d312a8cf9b551.tar.xz
physx-3.4-3f9977d72f8a481e76b6ad643a3d312a8cf9b551.zip
PhysX 3.4, APEX 1.4 patch release @24698370
Diffstat (limited to 'PhysX_3.4/Source/PhysXCharacterKinematic')
-rw-r--r--PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.cpp2
-rw-r--r--PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h14
-rw-r--r--PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterControllerCallbacks.cpp10
3 files changed, 18 insertions, 8 deletions
diff --git a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.cpp b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.cpp
index f4d9b4c9..a6ac15a4 100644
--- a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.cpp
+++ b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.cpp
@@ -204,6 +204,8 @@ static PX_INLINE void relocateCapsule(PxCapsuleGeometry& capsuleGeom, PxTransfor
{
capsuleGeom.radius = radius;
pose = PxTransformFromSegment(p0, p1, &capsuleGeom.halfHeight);
+ if(capsuleGeom.halfHeight==0.0f)
+ capsuleGeom.halfHeight = FLT_EPSILON;
}
static PX_INLINE void relocateCapsule(PxCapsuleGeometry& capsuleGeom, PxTransform& pose, const TouchedUserCapsule& userCapsule)
diff --git a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h
index 6ba0aff2..eede65ff 100644
--- a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h
+++ b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterController.h
@@ -103,9 +103,12 @@ namespace Cct
// with fixed-size slabs to get the best of both worlds but it would make iterating over
// triangles more complicated and would need more refactoring. So for now we don't bother,
// but we'll keep this note here for the next time this problem shows up.
-// const PxU32 naturalGrowthSize = maxNbEntries ? maxNbEntries*2 : 2;
-// const PxU32 newSize = PxMax(requiredSize, naturalGrowthSize);
- const PxU32 newSize = requiredSize;
+ // PT: new August 2018: turns out PX-837 was correct. Not doing this produces very large
+ // performance problems (like: the app freezes!) in SampleCCT. We didn't see it because
+ // it's an internal sample that it rarely used these days...
+ const PxU32 naturalGrowthSize = maxNbEntries ? maxNbEntries*2 : 2;
+ const PxU32 newSize = PxMax(requiredSize, naturalGrowthSize);
+// const PxU32 newSize = requiredSize;
Ps::Array<PxTriangle>::reserve(newSize);
}
@@ -129,6 +132,11 @@ namespace Cct
return Ps::Array<PxTriangle>::size();
}
+ PX_FORCE_INLINE const PxTriangle* begin() const
+ {
+ return Ps::Array<PxTriangle>::begin();
+ }
+
PX_FORCE_INLINE void clear()
{
Ps::Array<PxTriangle>::clear();
diff --git a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterControllerCallbacks.cpp b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterControllerCallbacks.cpp
index 3539793a..3577cdd1 100644
--- a/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterControllerCallbacks.cpp
+++ b/PhysX_3.4/Source/PhysXCharacterKinematic/src/CctCharacterControllerCallbacks.cpp
@@ -44,7 +44,7 @@
#include "PsMathUtils.h"
#include "GuSIMDHelpers.h"
-static const bool gVisualizeTouchedTris = true;
+static const bool gVisualizeTouchedTris = false;
static const float gDebugVisOffset = 0.01f;
using namespace physx;
@@ -244,7 +244,7 @@ static void outputPlaneToStream(PxShape* planeShape, const PxRigidActor* actor,
TouchedTriangles[1].verts[2] = p3 + offset;
if(gVisualizeTouchedTris)
- visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, &worldTriangles.getTriangle(0), renderBuffer, offset, params.mUpDirection);
+ visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection);
}
static void outputSphereToStream(PxShape* sphereShape, const PxRigidActor* actor, const PxTransform& globalPose, IntArray& geomStream, const PxExtendedVec3& origin)
@@ -623,7 +623,7 @@ static void outputMeshToStream( PxShape* meshShape, const PxRigidActor* actor, c
}
if(gVisualizeTouchedTris)
- visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, &worldTriangles.getTriangle(0), renderBuffer, offset, params.mUpDirection);
+ visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -763,7 +763,7 @@ static void outputHeightFieldToStream( PxShape* hfShape, const PxRigidActor* act
}
if(gVisualizeTouchedTris)
- visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, &worldTriangles.getTriangle(0), renderBuffer, offset, params.mUpDirection);
+ visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -891,7 +891,7 @@ static void outputConvexToStream(PxShape* convexShape, const PxRigidActor* actor
}
}
if(gVisualizeTouchedTris)
- visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, &worldTriangles.getTriangle(0), renderBuffer, offset, params.mUpDirection);
+ visualizeTouchedTriangles(touchedMesh->mNbTris, touchedMesh->mIndexWorldTriangles, worldTriangles.begin(), renderBuffer, offset, params.mUpDirection);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////