diff options
| author | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-11-20 14:41:07 -0600 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-11-20 15:22:41 -0600 |
| commit | 4bda45ce4e8b509eb0da786a6044006942ac259c (patch) | |
| tree | a51eb808016e1710a4bbd537000a493250602944 /PhysX_3.4/Source/SimulationController/src | |
| parent | Update README.md (diff) | |
| parent | PhysX 3.4.1, APEX 1.4.1 Release @23131702 (diff) | |
| download | physx-3.4-4bda45ce4e8b509eb0da786a6044006942ac259c.tar.xz physx-3.4-4bda45ce4e8b509eb0da786a6044006942ac259c.zip | |
Merge branch 'master'
Diffstat (limited to 'PhysX_3.4/Source/SimulationController/src')
4 files changed, 29 insertions, 25 deletions
diff --git a/PhysX_3.4/Source/SimulationController/src/ScConstraintSim.cpp b/PhysX_3.4/Source/SimulationController/src/ScConstraintSim.cpp index d9ebf841..f55954a9 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScConstraintSim.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScConstraintSim.cpp @@ -482,23 +482,29 @@ PX_INLINE Sc::BodySim* Sc::ConstraintSim::getConstraintGroupBody() void Sc::ConstraintSim::visualize(PxRenderBuffer& output) { - if (!(getCore().getFlags() & PxConstraintFlag::eVISUALIZATION)) + if(!(getCore().getFlags() & PxConstraintFlag::eVISUALIZATION)) return; PxsRigidBody* b0 = mLowLevelConstraint.body0; PxsRigidBody* b1 = mLowLevelConstraint.body1; - const PxTransform& t0 = b0 ? b0->getPose() : PxTransform(PxIdentity); - const PxTransform& t1 = b1 ? b1->getPose() : PxTransform(PxIdentity); + const PxTransform idt(PxIdentity); + const PxTransform& t0 = b0 ? b0->getPose() : idt; + const PxTransform& t1 = b1 ? b1->getPose() : idt; - PxReal frameScale = mScene.getVisualizationScale() * mScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LOCAL_FRAMES); - PxReal limitScale = mScene.getVisualizationScale() * mScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LIMITS); + const PxReal frameScale = mScene.getVisualizationScale() * mScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LOCAL_FRAMES); + const PxReal limitScale = mScene.getVisualizationScale() * mScene.getVisualizationParameter(PxVisualizationParameter::eJOINT_LIMITS); - Cm::RenderOutput renderOut( static_cast<Cm::RenderBuffer &>( output ) ); - Cm::ConstraintImmediateVisualizer viz( frameScale, limitScale, renderOut ); + Cm::RenderOutput renderOut(static_cast<Cm::RenderBuffer &>(output)); + Cm::ConstraintImmediateVisualizer viz(frameScale, limitScale, renderOut); - mCore.getVisualize()(viz, mLowLevelConstraint.constantBlock, t0, t1, - PxConstraintVisualizationFlag::eLOCAL_FRAMES | PxConstraintVisualizationFlag::eLIMITS); + PxU32 flags = 0; + if(frameScale!=0.0f) + flags |= PxConstraintVisualizationFlag::eLOCAL_FRAMES; + if(limitScale!=0.0f) + flags |= PxConstraintVisualizationFlag::eLIMITS; + + mCore.getVisualize()(viz, mLowLevelConstraint.constantBlock, t0, t1, flags); } diff --git a/PhysX_3.4/Source/SimulationController/src/ScElementInteractionMarker.h b/PhysX_3.4/Source/SimulationController/src/ScElementInteractionMarker.h index 58e69069..743de966 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScElementInteractionMarker.h +++ b/PhysX_3.4/Source/SimulationController/src/ScElementInteractionMarker.h @@ -32,6 +32,7 @@ #define PX_COLLISION_ELEMENT_INTERACTION_MARKER #include "ScElementSimInteraction.h" +#include "ScNPhaseCore.h" namespace physx { @@ -62,6 +63,7 @@ PX_INLINE Sc::ElementInteractionMarker::ElementInteractionMarker(ElementSim& ele PX_UNUSED(active); PX_ASSERT(!active); getScene().registerInteraction(this, false); + getScene().getNPhaseCore()->registerInteraction(this); } } diff --git a/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp b/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp index 8a4b4b07..b0cf7a5a 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScNPhaseCore.cpp @@ -523,9 +523,6 @@ ElementSimInteraction* Sc::NPhaseCore::onOverlapRemovedStage1(ElementSim* volume void Sc::NPhaseCore::onOverlapRemoved(ElementSim* volume0, ElementSim* volume1, const PxU32 ccdPass, void* elemSim, PxsContactManagerOutputIterator& outputs, bool useAdaptiveForce) { - PX_UNUSED(elemSim); - // PT: ordering them here is again useless, as "findInteraction" will reorder according to counts... - ElementSim* elementHi = volume1; ElementSim* elementLo = volume0; // No actor internal interactions @@ -1490,14 +1487,23 @@ Sc::ElementSimInteraction* Sc::NPhaseCore::convert(ElementSimInteraction* pair, ElementSim& elementA = pair->getElement0(); ElementSim& elementB = pair->getElement1(); - ElementSimInteraction* result = NULL; - // Wake up the actors of the pair if ((pair->getActor0().getActorType() == PxActorType::eRIGID_DYNAMIC) && !(static_cast<BodySim&>(pair->getActor0()).isActive())) static_cast<BodySim&>(pair->getActor0()).internalWakeUp(); if ((pair->getActor1().getActorType() == PxActorType::eRIGID_DYNAMIC) && !(static_cast<BodySim&>(pair->getActor1()).isActive())) static_cast<BodySim&>(pair->getActor1()).internalWakeUp(); + // Since the FilterPair struct might have been re-used in the newly created interaction, we need to clear + // the filter pair marker of the old interaction to avoid that the FilterPair gets deleted by the releaseElementPair() + // call that follows. + pair->clearInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); + + // PT: we need to unregister the old interaction *before* creating the new one, because Sc::NPhaseCore::registerInteraction will use + // ElementSim pointers which are the same for both. + unregisterInteraction(pair); + releaseElementPair(pair, PairReleaseFlag::eWAKE_ON_LOST_TOUCH | PairReleaseFlag::eBP_VOLUME_REMOVED, 0, removeFromDirtyList, outputs, useAdaptiveForce); + + ElementSimInteraction* result = NULL; switch (newType) { case InteractionType::eINVALID: @@ -1543,16 +1549,6 @@ Sc::ElementSimInteraction* Sc::NPhaseCore::convert(ElementSimInteraction* pair, result->setFilterPairIndex(filterInfo.filterPairIndex); } - if (pair->readInteractionFlag(InteractionFlag::eIS_FILTER_PAIR)) - pair->clearInteractionFlag(InteractionFlag::eIS_FILTER_PAIR); - // Since the FilterPair struct might have been re-used in the newly created interaction, we need to clear - // the filter pair marker of the old interaction to avoid that the FilterPair gets deleted by the releaseElementPair() - // call that follows. - - unregisterInteraction(pair); - - releaseElementPair(pair, PairReleaseFlag::eWAKE_ON_LOST_TOUCH | PairReleaseFlag::eBP_VOLUME_REMOVED, 0, removeFromDirtyList, outputs, useAdaptiveForce); - return result; } diff --git a/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp b/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp index 8956983e..d18961e2 100644 --- a/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp +++ b/PhysX_3.4/Source/SimulationController/src/ScShapeInteraction.cpp @@ -103,8 +103,8 @@ Sc::ShapeInteraction::ShapeInteraction(ShapeSim& s1, ShapeSim& s2, ActorPair* aP mEdgeIndex = simpleIslandManager->addContactManager(NULL, indexA, indexB, this); bool active = registerInActors(contactManager); + scene.getNPhaseCore()->registerInteraction(this); scene.registerInteraction(this, active); // this will call onActivate() on the interaction - } else { |