aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/GeomUtils/src/pcm
diff options
context:
space:
mode:
authorSheikh Dawood <[email protected]>2018-04-09 10:13:48 -0500
committerSheikh Dawood <[email protected]>2018-04-09 10:13:48 -0500
commit238605d8225a9135d6b60646e05d066e25424eee (patch)
tree2b013bd4946bb3c699d7a06ef1f21be85d367f63 /PhysX_3.4/Source/GeomUtils/src/pcm
parentAdd ParamTool.exe (diff)
downloadphysx-3.4-238605d8225a9135d6b60646e05d066e25424eee.tar.xz
physx-3.4-238605d8225a9135d6b60646e05d066e25424eee.zip
PhysX 3.4, APEX 1.4 patch release @23879214
Diffstat (limited to 'PhysX_3.4/Source/GeomUtils/src/pcm')
-rw-r--r--PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactCapsuleHeightField.cpp4
-rw-r--r--PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactConvexHeightField.cpp6
-rw-r--r--PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereBox.cpp3
-rw-r--r--PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereHeightField.cpp3
-rw-r--r--PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp15
5 files changed, 12 insertions, 19 deletions
diff --git a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactCapsuleHeightField.cpp b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactCapsuleHeightField.cpp
index 1136d522..8c83b145 100644
--- a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactCapsuleHeightField.cpp
+++ b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactCapsuleHeightField.cpp
@@ -109,9 +109,7 @@ bool Gu::pcmContactCapsuleHeightField(GU_CONTACT_METHOD_ARGS)
multiManifold.mNumManifolds = 0;
multiManifold.setRelativeTransform(curTransform);
- const Gu::HeightField& hf = *static_cast<Gu::HeightField*>(shapeHeight.heightField);
-
- Gu::HeightFieldUtil hfUtil(shapeHeight, hf);
+ Gu::HeightFieldUtil hfUtil(shapeHeight);
const PxVec3 tmp = getCapsuleHalfHeightVector(transform0, shapeCapsule);
diff --git a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactConvexHeightField.cpp b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactConvexHeightField.cpp
index 45bec74c..d7a58bdb 100644
--- a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactConvexHeightField.cpp
+++ b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactConvexHeightField.cpp
@@ -129,10 +129,8 @@ bool Gu::PCMContactConvexHeightfield(
const PxTransform t0to1 = transform1.transformInv(transform0);
- const Gu::HeightField& hf = *static_cast<Gu::HeightField*>(shapeHeightfield.heightField);
- Gu::HeightFieldUtil hfUtil(shapeHeightfield, hf);
-
- //Gu::HeightFieldUtil hfUtil(shapeHeightfield);
+ Gu::HeightFieldUtil hfUtil(shapeHeightfield);
+ const Gu::HeightField& hf = hfUtil.getHeightField();
////////////////////
diff --git a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereBox.cpp b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereBox.cpp
index 30fda7de..213833f7 100644
--- a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereBox.cpp
+++ b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereBox.cpp
@@ -115,10 +115,9 @@ bool pcmContactSphereBox(GU_CONTACT_METHOD_ARGS)
const FloatV dist = FNeg(FSel(con0, z, FSel(con1, x, y)));
//separation so far is just the embedding of the center point; we still have to push out all of the radius.
- const Vec3V point = sphereOrigin;
const Vec3V normal = transf1.rotate(locNorm);
const FloatV penetration = FSub(dist, radius);
-
+ const Vec3V point = V3Sub(sphereOrigin, V3Scale(normal, dist));
Gu::ContactPoint& contact = contactBuffer.contacts[contactBuffer.count++];
V4StoreA(Vec4V_From_Vec3V(normal), &contact.normal.x);
diff --git a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereHeightField.cpp b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereHeightField.cpp
index cce99cd4..f642a751 100644
--- a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereHeightField.cpp
+++ b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereHeightField.cpp
@@ -116,8 +116,7 @@ bool Gu::pcmContactSphereHeightField(GU_CONTACT_METHOD_ARGS)
multiManifold.setRelativeTransform(curTransform);
const FloatV replaceBreakingThreshold = FMul(sphereRadius, FLoad(0.001f));
- const Gu::HeightField& hf = *static_cast<Gu::HeightField*>(shapeHeight.heightField);
- Gu::HeightFieldUtil hfUtil(shapeHeight, hf);
+ Gu::HeightFieldUtil hfUtil(shapeHeight);
const PxVec3 sphereCenterShape1Space = transform1.transformInv(transform0.p);
const Vec3V sphereCenter = V3LoadU(sphereCenterShape1Space);
PxReal inflatedRadius = shapeSphere.radius + params.mContactDistance;
diff --git a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
index c56f4df5..0a18286b 100644
--- a/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
+++ b/PhysX_3.4/Source/GeomUtils/src/pcm/GuPCMContactSphereSphere.cpp
@@ -62,19 +62,18 @@ bool pcmContactSphereSphere(GU_CONTACT_METHOD_ARGS)
if(FAllGrtr(FMul(inflatedSum, inflatedSum), distanceSq))
{
const FloatV eps = FLoad(0.00001f);
- const FloatV nhalf = FLoad(-0.5f);
- const FloatV magn = FSqrt(distanceSq);
- const BoolV bCon = FIsGrtrOrEq(eps, magn);
- const Vec3V normal = V3Sel(bCon, V3UnitX(), V3ScaleInv(_delta, magn));
- const FloatV scale = FMul(FSub(FAdd(r0, magn), r1), nhalf);
- const Vec3V point = V3ScaleAdd(normal, scale, p0);
- const FloatV dist = FSub(magn, radiusSum);
+ const FloatV dist = FSqrt(distanceSq);
+ const BoolV bCon = FIsGrtrOrEq(eps, dist);
+ const Vec3V normal = V3Sel(bCon, V3UnitX(), V3ScaleInv(_delta, dist));
+
+ const Vec3V point = V3ScaleAdd(normal, r1, p1);
+ const FloatV pen = FSub(dist, radiusSum);
PX_ASSERT(contactBuffer.count < ContactBuffer::MAX_CONTACTS);
Gu::ContactPoint& contact = contactBuffer.contacts[contactBuffer.count++];
V4StoreA(Vec4V_From_Vec3V(normal), &contact.normal.x);
V4StoreA(Vec4V_From_Vec3V(point), &contact.point.x);
- FStore(dist, &contact.separation);
+ FStore(pen, &contact.separation);
contact.internalFaceIndex1 = PXC_CONTACT_NO_FACE_INDEX;