| 1328 | |
| 1329 | |
| 1330 | void IslandSim::processLostEdges(Ps::Array<NodeIndex>& destroyedNodes, bool allowDeactivation, bool permitKinematicDeactivation, |
| 1331 | PxU32 dirtyNodeLimit) |
| 1332 | { |
| 1333 | PX_UNUSED(dirtyNodeLimit); |
| 1334 | PX_PROFILE_ZONE("Basic.processLostEdges", getContextId()); |
| 1335 | //At this point, all nodes and edges are activated. |
| 1336 | |
| 1337 | //Bit map for visited |
| 1338 | mVisitedState.resizeAndClear(mNodes.size()); |
| 1339 | |
| 1340 | //Reserve space on priority queue for at least 1024 nodes. It will resize if more memory is required during traversal. |
| 1341 | mPriorityQueue.reserve(1024); |
| 1342 | |
| 1343 | mIslandSplitEdges[0].reserve(1024); |
| 1344 | mIslandSplitEdges[1].reserve(1024); |
| 1345 | |
| 1346 | mVisitedNodes.reserve(mNodes.size()); //Make sure we have enough space for all nodes! |
| 1347 | |
| 1348 | const PxU32 nbDestroyedEdges = mDestroyedEdges.size(); |
| 1349 | PX_UNUSED(nbDestroyedEdges); |
| 1350 | { |
| 1351 | PX_PROFILE_ZONE("Basic.removeEdgesFromIslands", getContextId()); |
| 1352 | for (PxU32 a = 0; a < mDestroyedEdges.size(); ++a) |
| 1353 | { |
| 1354 | EdgeIndex lostIndex = mDestroyedEdges[a]; |
| 1355 | Edge& lostEdge = mEdges[lostIndex]; |
| 1356 | |
| 1357 | if (lostEdge.isPendingDestroyed() && !lostEdge.isInDirtyList()) |
| 1358 | { |
| 1359 | //Process this edge... |
| 1360 | if (!lostEdge.isReportOnlyDestroy() && lostEdge.isInserted()) |
| 1361 | { |
| 1362 | PxU32 index1 = mEdgeNodeIndices[mDestroyedEdges[a] * 2].index(); |
| 1363 | PxU32 index2 = mEdgeNodeIndices[mDestroyedEdges[a] * 2 + 1].index(); |
| 1364 | |
| 1365 | IslandId islandId = IG_INVALID_ISLAND; |
| 1366 | if (index1 != IG_INVALID_NODE && index2 != IG_INVALID_NODE) |
| 1367 | { |
| 1368 | PX_ASSERT(mIslandIds[index1] == IG_INVALID_ISLAND || mIslandIds[index2] == IG_INVALID_ISLAND || |
| 1369 | mIslandIds[index1] == mIslandIds[index2]); |
| 1370 | islandId = mIslandIds[index1] != IG_INVALID_ISLAND ? mIslandIds[index1] : mIslandIds[index2]; |
| 1371 | } |
| 1372 | else if (index1 != IG_INVALID_NODE) |
| 1373 | { |
| 1374 | PX_ASSERT(index2 == IG_INVALID_NODE); |
| 1375 | Node& node = mNodes[index1]; |
| 1376 | if (!node.isKinematic()) |
| 1377 | { |
| 1378 | islandId = mIslandIds[index1]; |
| 1379 | node.mStaticTouchCount--; |
| 1380 | //Island& island = mIslands[islandId]; |
| 1381 | mIslandStaticTouchCount[islandId]--; |
| 1382 | //island.mStaticTouchCount--; |
| 1383 | } |
| 1384 | } |
| 1385 | else if (index2 != IG_INVALID_NODE) |
| 1386 | { |
| 1387 | PX_ASSERT(index1 == IG_INVALID_NODE); |
no test coverage detected