--------------------------------------------------------------
| 1300 | |
| 1301 | // -------------------------------------------------------------- |
| 1302 | void PxsCCDContext::updateCCD(PxReal dt, PxBaseTask* continuation, IG::IslandSim& islandSim, bool disableResweep, PxI32 numFastMovingShapes) |
| 1303 | { |
| 1304 | //Flag to run a slightly less-accurate version of CCD that will ensure that objects don't tunnel through the static world but is not as reliable for dynamic-dynamic collisions |
| 1305 | mDisableCCDResweep = disableResweep; |
| 1306 | mThresholdStream.clear(); // clear force threshold report stream |
| 1307 | |
| 1308 | mContext->clearManagerTouchEvents(); |
| 1309 | |
| 1310 | if (miCCDPass == 0) |
| 1311 | { |
| 1312 | resetContactManagers(); |
| 1313 | } |
| 1314 | |
| 1315 | |
| 1316 | // If we're not in the first pass and the previous pass had no sweeps or the BP didn't generate any fast-moving shapes, we can skip CCD entirely |
| 1317 | if ((miCCDPass > 0 && mSweepTotalHits == 0) || (numFastMovingShapes == 0)) |
| 1318 | { |
| 1319 | mSweepTotalHits = 0; |
| 1320 | updateCCDEnd(); |
| 1321 | return; |
| 1322 | } |
| 1323 | mSweepTotalHits = 0; |
| 1324 | |
| 1325 | PX_ASSERT(continuation); |
| 1326 | PX_ASSERT(continuation->getReference() > 0); |
| 1327 | |
| 1328 | //printf("CCD 1\n"); |
| 1329 | |
| 1330 | mCCDThreadContext = mContext->getNpThreadContext(); |
| 1331 | mCCDThreadContext->mDt = dt; // doesn't get set anywhere else since it's only used for CCD now |
| 1332 | |
| 1333 | verifyCCDBegin(); |
| 1334 | |
| 1335 | // -------------------------------------------------------------------------------------- |
| 1336 | // From a list of active CMs, build a temporary array of PxsCCDPair objects (allocated in blocks) |
| 1337 | // this is done to gather scattered data from memory and also to reduce PxsRidigBody permanent memory footprint |
| 1338 | // we have to do it every pass since new CMs can become fast moving after each pass (and sometimes cease to be) |
| 1339 | mCCDPairs.clear_NoDelete(); |
| 1340 | mCCDPtrPairs.forceSize_Unsafe(0); |
| 1341 | |
| 1342 | mUpdatedCCDBodies.forceSize_Unsafe(0); |
| 1343 | |
| 1344 | mCCDOverlaps.clear_NoDelete(); |
| 1345 | |
| 1346 | PxU32 nbKinematicStaticCollisions = 0; |
| 1347 | |
| 1348 | |
| 1349 | bool needsSweep = false; |
| 1350 | |
| 1351 | { |
| 1352 | PX_PROFILE_ZONE("Sim.ccdPair", mContext->mContextID); |
| 1353 | |
| 1354 | Cm::BitMap::Iterator it(mContext->mActiveContactManagersWithCCD); |
| 1355 | for (PxU32 index = it.getNext(); index != Cm::BitMap::Iterator::DONE; index = it.getNext()) |
| 1356 | { |
| 1357 | PxsContactManager* cm = mContext->mContactManagerPool.findByIndexFast(index); |
| 1358 | |
| 1359 | // skip disabled pairs |
no test coverage detected