Enable a concave overlapping pair
| 347 | |
| 348 | // Enable a concave overlapping pair |
| 349 | void OverlappingPairs::enableConcavePairWithIndex(uint64 pairIndex) { |
| 350 | |
| 351 | RP3D_PROFILE("OverlappingPairs::enableConcavePairWithIndex()", mProfiler); |
| 352 | |
| 353 | ConcaveOverlappingPair* pair = &(mDisabledConcavePairs[static_cast<uint32>(pairIndex)]); |
| 354 | |
| 355 | assert(!pair->isEnabled); |
| 356 | |
| 357 | const uint64 newPairIndex = mConcavePairs.size(); |
| 358 | |
| 359 | // Map the entity with the new pair lookup index |
| 360 | mMapConcavePairIdToPairIndex.add(Pair<uint64, uint64>(pair->pairID, newPairIndex)); |
| 361 | |
| 362 | // Create a new pair to be added into the array of disable pairs |
| 363 | mConcavePairs.emplace(pair->pairID, pair->broadPhaseId1, pair->broadPhaseId2, pair->collider1, pair->collider2, |
| 364 | pair->narrowPhaseAlgorithmType, pair->isShape1Convex, mPoolAllocator, mHeapAllocator, true); |
| 365 | mConcavePairs[newPairIndex].collidingInCurrentFrame = pair->collidingInCurrentFrame; |
| 366 | mConcavePairs[newPairIndex].collidingInPreviousFrame = pair->collidingInPreviousFrame; |
| 367 | |
| 368 | // Remove the previous overlapping pair from the concave array |
| 369 | removeDisabledConcavePairWithIndex(pairIndex, false); |
| 370 | } |
| 371 | |
| 372 | // Disable a concave overlapping pair (because both bodies of the pair are disabled) |
| 373 | void OverlappingPairs::disableConcavePairWithIndex(uint64 pairIndex) { |