aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
diff options
context:
space:
mode:
authorSheikh Dawood Abdul Ajees <[email protected]>2017-09-15 15:41:57 -0500
committerSheikh Dawood Abdul Ajees <[email protected]>2017-09-15 15:41:57 -0500
commitd1c812f1162e5fdb13c215792725b2591d7428f5 (patch)
tree407056c45c7e9320c48fca6a3697d81a061c4ea0 /PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
parentPhysX 3.4, APEX 1.4 patch release @22121272 (diff)
downloadphysx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.tar.xz
physx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.zip
PhysX 3.4.1, APEX 1.4.1 Release @22845541v3.4.1
Diffstat (limited to 'PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp')
-rw-r--r--PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp105
1 files changed, 65 insertions, 40 deletions
diff --git a/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp b/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
index cb3b5f66..159450ce 100644
--- a/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
+++ b/PhysX_3.4/Source/SimulationController/src/ScShapeSim.cpp
@@ -443,64 +443,89 @@ Ps::IntBool Sc::ShapeSim::updateSweptBounds()
return isFastMoving;
}
-void Sc::ShapeSim::onVolumeOrTransformChange(bool asPartOfActorTransformChange, bool forceBoundsUpdate)
+void Sc::ShapeSim::markBoundsForUpdate(bool forceBoundsUpdate, bool isDynamic)
{
+ PX_UNUSED(isDynamic);
+
Sc::Scene& scene = getScene();
- Sc::BodySim* body = getBodySim();
- const bool isDynamic = (body != NULL);
- bool isAsleep;
- if (body)
+ const PxU32 elementID = getElementID();
+
+ if(forceBoundsUpdate)
+ updateCached(0, &scene.getAABBManager()->getChangedAABBMgActorHandleMap());
+ else if(isInBroadPhase())
+ scene.getDirtyShapeSimMap().growAndSet(elementID);
+
+#if PX_USE_PARTICLE_SYSTEM_API
+#if PX_SUPPORT_GPU_PHYSX
+ // PT: onShapeChange currently only used for GPU physics. Inlined 'getSceneGpu' call avoids
+ // extra function calls and additional work from getPxsRigidCore(), etc
+ Pt::Context* context = scene.getParticleContext();
+ if(context->getSceneGpuFast())
+ context->getSceneGpuFast()->onShapeChange(size_t(&mCore.getCore()), size_t(&getPxsRigidCore()), isDynamic);
+#endif
+#endif
+}
+
+static PX_FORCE_INLINE void updateInteraction(Sc::Scene& scene, Sc::Interaction* i, const bool isDynamic, const bool isAsleep)
+{
+ if(i->getType() == Sc::InteractionType::eOVERLAP)
{
- isAsleep = !body->isActive();
- body->postShapeChange(asPartOfActorTransformChange);
+ Sc::ShapeInteraction* si = static_cast<Sc::ShapeInteraction*>(i);
+ si->resetManagerCachedState();
+
+ if(isAsleep)
+ si->onShapeChangeWhileSleeping(isDynamic);
}
- else
- isAsleep = true;
+ else if(i->getType() == Sc::InteractionType::eTRIGGER)
+ (static_cast<Sc::TriggerInteraction*>(i))->forceProcessingThisFrame(scene); // trigger pairs need to be checked next frame
+#if PX_USE_PARTICLE_SYSTEM_API
+ else if(i->getType() == Sc::InteractionType::ePARTICLE_BODY)
+ (static_cast<Sc::ParticleElementRbElementInteraction *>(i))->onRbShapeChange();
+#endif
+}
+
+void Sc::ShapeSim::onVolumeOrTransformChange(bool forceBoundsUpdate)
+{
+ Sc::Scene& scene = getScene();
+ Sc::BodySim* body = getBodySim();
+ const bool isDynamic = (body != NULL);
+ const bool isAsleep = body ? !body->isActive() : true;
ElementSim::ElementInteractionIterator iter = getElemInteractions();
ElementSimInteraction* i = iter.getNext();
while(i)
{
- if(i->getType() == InteractionType::eOVERLAP)
- {
- Sc::ShapeInteraction* si = static_cast<Sc::ShapeInteraction*>(i);
- si->resetManagerCachedState();
-
- if (isAsleep)
- si->onShapeChangeWhileSleeping(isDynamic);
- }
- else if (i->getType() == InteractionType::eTRIGGER)
- (static_cast<Sc::TriggerInteraction*>(i))->forceProcessingThisFrame(scene); // trigger pairs need to be checked next frame
-#if PX_USE_PARTICLE_SYSTEM_API
- else if (i->getType() == InteractionType::ePARTICLE_BODY)
- (static_cast<Sc::ParticleElementRbElementInteraction *>(i))->onRbShapeChange();
-#endif
-
+ updateInteraction(scene, i, isDynamic, isAsleep);
i = iter.getNext();
}
+ markBoundsForUpdate(forceBoundsUpdate, isDynamic);
+}
- const PxU32 elementID = getElementID();
-
- if (forceBoundsUpdate)
+bool notifyActorInteractionsOfTransformChange(Sc::ActorSim& actor)
+{
+ bool isDynamic;
+ bool isAsleep;
+ if(actor.isDynamicRigid())
{
- updateCached(0, &scene.getAABBManager()->getChangedAABBMgActorHandleMap());
+ isDynamic = true;
+ isAsleep = !static_cast<Sc::BodySim&>(actor).isActive();
}
- else if (isInBroadPhase())
- scene.getDirtyShapeSimMap().growAndSet(elementID);
-
-#if PX_USE_PARTICLE_SYSTEM_API
-#if PX_SUPPORT_GPU_PHYSX
- // PT: onShapeChange currently only used for GPU physics. Inlined 'getSceneGpu' call avoids
- // extra function calls and additional work from getPxsRigidCore(), etc
- Pt::Context* context = scene.getParticleContext();
- if(context->getSceneGpuFast())
+ else
{
- context->getSceneGpuFast()->onShapeChange(size_t(&mCore.getCore()), size_t(&getPxsRigidCore()), (body != NULL));
+ isDynamic = false;
+ isAsleep = true;
}
-#endif
-#endif
+
+ Sc::Scene& scene = actor.getScene();
+
+ PxU32 nbInteractions = actor.getActorInteractionCount();
+ Sc::Interaction** interactions = actor.getActorInteractions();
+ while(nbInteractions--)
+ updateInteraction(scene, *interactions++, isDynamic, isAsleep);
+
+ return isDynamic;
}
void Sc::ShapeSim::createSqBounds()