| 3989 | }; |
| 3990 | |
| 3991 | void Sc::Scene::afterIntegration(PxBaseTask* continuation) |
| 3992 | { |
| 3993 | PX_PROFILE_ZONE("Sc::Scene::afterIntegration", getContextId()); |
| 3994 | mLLContext->getTransformCache().resetChangedState(); //Reset the changed state. If anything outside of the GPU kernels updates any shape's transforms, this will be raised again |
| 3995 | getBoundsArray().resetChangedState(); |
| 3996 | |
| 3997 | PxsTransformCache& cache = getLowLevelContext()->getTransformCache(); |
| 3998 | Bp::BoundsArray& boundArray = getBoundsArray(); |
| 3999 | |
| 4000 | { |
| 4001 | PX_PROFILE_ZONE("AfterIntegration::lockStage", getContextId()); |
| 4002 | mLLContext->getLock().lock(); |
| 4003 | |
| 4004 | |
| 4005 | mSimulationController->udpateScBodyAndShapeSim(cache, boundArray, continuation); |
| 4006 | |
| 4007 | const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim(); |
| 4008 | |
| 4009 | const PxU32 rigidBodyOffset = Sc::BodySim::getRigidBodyOffset(); |
| 4010 | |
| 4011 | const PxU32 numBodiesToDeactivate = islandSim.getNbNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE); |
| 4012 | |
| 4013 | const IG::NodeIndex*const deactivatingIndices = islandSim.getNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE); |
| 4014 | |
| 4015 | PxU32 previousNumBodiesToDeactivate = mNumDeactivatingNodes[IG::Node::eRIGID_BODY_TYPE]; |
| 4016 | |
| 4017 | { |
| 4018 | Cm::BitMapPinned& changedAABBMgrActorHandles = mAABBManager->getChangedAABBMgActorHandleMap(); |
| 4019 | PX_PROFILE_ZONE("AfterIntegration::deactivateStage", getContextId()); |
| 4020 | for (PxU32 i = previousNumBodiesToDeactivate; i < numBodiesToDeactivate; i++) |
| 4021 | { |
| 4022 | PxsRigidBody* rigid = islandSim.getRigidBody(deactivatingIndices[i]); |
| 4023 | Sc::BodySim* bodySim = reinterpret_cast<Sc::BodySim*>(reinterpret_cast<PxU8*>(rigid) - rigidBodyOffset); |
| 4024 | //we need to set the rigid body back to the previous pose for the deactivated objects. This emulates the previous behavior where island gen ran before the solver, ensuring |
| 4025 | //that bodies that should be deactivated this frame never reach the solver. We now run the solver in parallel with island gen, so objects that should be deactivated this frame |
| 4026 | //still reach the solver and are integrated. However, on the frame when they should be deactivated, we roll back to their state at the beginning of the frame to ensure that the |
| 4027 | //user perceives the same behavior as before. |
| 4028 | |
| 4029 | PxsBodyCore& bodyCore = bodySim->getBodyCore().getCore(); |
| 4030 | |
| 4031 | //if(!islandSim.getNode(bodySim->getNodeIndex()).isActive()) |
| 4032 | rigid->setPose(rigid->getLastCCDTransform()); |
| 4033 | |
| 4034 | |
| 4035 | bodySim->updateCached(&changedAABBMgrActorHandles); |
| 4036 | mSimulationController->updateDynamic(bodySim->isArticulationLink(), bodySim->getNodeIndex()); |
| 4037 | |
| 4038 | //solver is running in parallel with IG(so solver might solving the body which IG identify as deactivatedNodes). After we moved sleepCheck into the solver after integration, sleepChecks |
| 4039 | //might have processed bodies that are now considered deactivated. This could have resulted in either freezing or unfreezing one of these bodies this frame, so we need to process those |
| 4040 | //events to ensure that the SqManager's bounds arrays are consistently maintained. Also, we need to clear the frame flags for these bodies. |
| 4041 | |
| 4042 | if (rigid->isFreezeThisFrame()) |
| 4043 | bodySim->freezeTransforms(&mAABBManager->getChangedAABBMgActorHandleMap()); |
| 4044 | /*else if(bodyCore.isUnfreezeThisFrame()) |
| 4045 | bodySim->createSqBounds();*/ |
| 4046 | |
| 4047 | //PX_ASSERT(bodyCore.wakeCounter == 0.0f); |
| 4048 | //KS - the IG deactivates bodies in parallel with the solver. It appears that under certain circumstances, the solver's integration (which performs |
nothing calls this directly
no test coverage detected