MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / beforeSolver

Method beforeSolver

physx/source/simulationcontroller/src/ScScene.cpp:3862–3934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3860
3861
3862void Sc::Scene::beforeSolver(PxBaseTask* continuation)
3863{
3864 PX_PROFILE_ZONE("Sim.updateForces", getContextId());
3865
3866 // Note: For contact notifications it is important that force threshold checks are done after new/lost touches have been processed
3867 // because pairs might get added to the list processed below
3868
3869 // Atoms that passed contact force threshold
3870 ThresholdStream& thresholdStream = mDynamicsContext->getThresholdStream();
3871 thresholdStream.clear();
3872
3873 const IG::IslandSim& islandSim = mSimpleIslandManager->getAccurateIslandSim();
3874
3875 const PxU32 nbActiveBodies = islandSim.getNbActiveNodes(IG::Node::eRIGID_BODY_TYPE);
3876
3877 mNumDeactivatingNodes[IG::Node::eRIGID_BODY_TYPE] = 0;//islandSim.getNbNodesToDeactivate(IG::Node::eRIGID_BODY_TYPE);
3878 mNumDeactivatingNodes[IG::Node::eARTICULATION_TYPE] = 0;//islandSim.getNbNodesToDeactivate(IG::Node::eARTICULATION_TYPE);
3879
3880 const PxU32 MaxBodiesPerTask = ScBeforeSolverTask::MaxBodiesPerTask;
3881
3882 Cm::FlushPool& flushPool = mLLContext->getTaskPool();
3883
3884 mSimulationController->reserve(nbActiveBodies);
3885
3886 bool simUsesAdaptiveForce = mPublicFlags & PxSceneFlag::eADAPTIVE_FORCE;
3887
3888 {
3889 Cm::BitMap::Iterator iter(mVelocityModifyMap);
3890
3891 for (PxU32 i = iter.getNext(); i != Cm::BitMap::Iterator::DONE; /*i = iter.getNext()*/)
3892 {
3893 ScBeforeSolverTask* task = PX_PLACEMENT_NEW(flushPool.allocate(sizeof(ScBeforeSolverTask)), ScBeforeSolverTask(mDt, mSimpleIslandManager, mSimulationController, getContextId(), simUsesAdaptiveForce));
3894 PxU32 count = 0;
3895 for (; count < MaxBodiesPerTask && i != Cm::BitMap::Iterator::DONE; i = iter.getNext())
3896 {
3897 PxsRigidBody* body = islandSim.getRigidBody(IG::NodeIndex(i));
3898 bool retainsAccelerations = false;
3899 if (body)
3900 {
3901 task->mBodies[count++] = IG::NodeIndex(i);
3902
3903 retainsAccelerations = (body->mCore->mFlags & PxRigidBodyFlag::eRETAIN_ACCELERATIONS);
3904
3905 }
3906
3907 if(!retainsAccelerations)
3908 {
3909 mVelocityModifyMap.reset(i);
3910 }
3911 }
3912 task->mNumBodies = count;
3913 task->setContinuation(continuation);
3914 task->removeReference();
3915 }
3916 }
3917
3918 const PxU32 nbActiveArticulations = islandSim.getNbActiveNodes(IG::Node::eARTICULATION_TYPE);
3919 const IG::NodeIndex* const articIndices = islandSim.getActiveNodes(IG::Node::eARTICULATION_TYPE);

Callers

nothing calls this directly

Calls 15

ScBeforeSolverTaskClass · 0.85
PxMinFunction · 0.85
getNbActiveNodesMethod · 0.80
getRigidBodyMethod · 0.80
setContinuationMethod · 0.80
getActiveNodesMethod · 0.80
getContextIdFunction · 0.50
NodeIndexClass · 0.50
clearMethod · 0.45
reserveMethod · 0.45
getNextMethod · 0.45

Tested by

no test coverage detected