| 1065 | // BpHandle = index in main/shared arrays like mAABBManagerBounds / mAABBManagerDistances |
| 1066 | PX_COMPILE_TIME_ASSERT(sizeof(BpHandle)==sizeof(ABP_Index)); |
| 1067 | void BoxManager::addObjects(const BpHandle* PX_RESTRICT userIDs, PxU32 nb, ABP_SharedData* PX_RESTRICT sharedData) |
| 1068 | { |
| 1069 | // PT: we're called for each batch. |
| 1070 | |
| 1071 | // PT: TODO: fix the BpHandle/ABP_Index mix |
| 1072 | const PxU32 currentSize = mNbUpdated; |
| 1073 | const PxU32 currentCapacity = mMaxNbUpdated; |
| 1074 | const PxU32 newSize = currentSize + nb; |
| 1075 | |
| 1076 | ABP_Index* remap; |
| 1077 | if(newSize>currentCapacity) |
| 1078 | { |
| 1079 | const PxU32 minCapacity = PxMax(newSize, 1024u); |
| 1080 | const PxU32 newCapacity = PxMax(minCapacity, currentCapacity*2); |
| 1081 | PX_ASSERT(newCapacity>=newSize); |
| 1082 | mMaxNbUpdated = newCapacity; |
| 1083 | remap = resizeMapping(currentSize, newCapacity, mInToOut_Updated); |
| 1084 | } |
| 1085 | else |
| 1086 | { |
| 1087 | remap = mInToOut_Updated; |
| 1088 | } |
| 1089 | mInToOut_Updated = remap; |
| 1090 | mNbUpdated = newSize; |
| 1091 | |
| 1092 | // PT: we only copy the new handles for now. The bounds will be computed later in "prepareData". |
| 1093 | // PT: TODO: do we even need to copy them? Can't we just reuse the source ptr directly? |
| 1094 | { |
| 1095 | PX_ASSERT(currentSize+nb<=mMaxNbUpdated); |
| 1096 | remap += currentSize; |
| 1097 | PxU32 nbToGo = nb; |
| 1098 | while(nbToGo--) |
| 1099 | { |
| 1100 | const BpHandle userID = *userIDs++; |
| 1101 | |
| 1102 | PX_ASSERT(!isNewOrUpdated(userID)); |
| 1103 | *remap++ = markAsNewOrUpdated(userID); |
| 1104 | |
| 1105 | if(sharedData) |
| 1106 | sharedData->mUpdatedObjects.setBit(userID); |
| 1107 | } |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | // PT: TODO: inline this again |
| 1112 | void BoxManager::removeObject(ABPEntry& object, BpHandle userID) |
no test coverage detected