///////////////////////////////////////////////////////////////////// remove object
| 362 | ////////////////////////////////////////////////////////////////////////// |
| 363 | // remove object |
| 364 | bool ExtendedBucketPruner::removeObject(const PrunerPayload& object, PxU32 objectIndex, const PrunerPayload& swapObject, |
| 365 | PxU32 swapObjectIndex, PxU32& timeStamp) |
| 366 | { |
| 367 | ExtendedBucketPrunerMap::Entry dataEntry; |
| 368 | |
| 369 | // if object is not in tree of trees, it is in bucket pruner core |
| 370 | if (!mExtendedBucketPrunerMap.erase(object, dataEntry)) |
| 371 | { |
| 372 | // we need to call invalidateObjects, it might happen that the swapped object |
| 373 | // does belong to the extended bucket pruner, in that case the objects index |
| 374 | // needs to be swapped. |
| 375 | // do not call additional bucket pruner swap, that does happen during remove |
| 376 | swapIndex(objectIndex, swapObject, swapObjectIndex, false); |
| 377 | #if USE_INCREMENTAL_PRUNER |
| 378 | return mPrunerCore.removeObject(objectIndex, swapObjectIndex, timeStamp); |
| 379 | #else |
| 380 | return mPrunerCore.removeObject(object, timeStamp); |
| 381 | #endif |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | const ExtendedBucketPrunerData& data = dataEntry.second; |
| 386 | |
| 387 | // mark tree nodes where objects belongs to |
| 388 | AABBTree& tree = *mMergedTrees[data.mMergeIndex].mTree; |
| 389 | PX_ASSERT(data.mSubTreeNode < tree.getNbNodes()); |
| 390 | // mark the merged tree for refit |
| 391 | tree.markNodeForRefit(data.mSubTreeNode); |
| 392 | PX_ASSERT(mMainTreeUpdateMap[data.mMergeIndex] < mMainTree->getNbNodes()); |
| 393 | // mark the main tree for refit |
| 394 | mMainTree->markNodeForRefit(mMainTreeUpdateMap[data.mMergeIndex]); |
| 395 | |
| 396 | // call invalidate object to swap the object indices in the merged trees |
| 397 | invalidateObject(data, objectIndex, swapObject, swapObjectIndex); |
| 398 | |
| 399 | mTreesDirty = true; |
| 400 | } |
| 401 | #if PX_DEBUG |
| 402 | checkValidity(); |
| 403 | #endif // PX_DEBUG |
| 404 | return true; |
| 405 | } |
| 406 | |
| 407 | ////////////////////////////////////////////////////////////////////////// |
| 408 | // invalidate object |
nothing calls this directly
no test coverage detected