MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / addObjects

Method addObjects

physx/source/lowlevelaabb/src/BpBroadPhaseABP.cpp:1067–1109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1065// BpHandle = index in main/shared arrays like mAABBManagerBounds / mAABBManagerDistances
1066PX_COMPILE_TIME_ASSERT(sizeof(BpHandle)==sizeof(ABP_Index));
1067void 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
1112void BoxManager::removeObject(ABPEntry& object, BpHandle userID)

Callers 3

addStaticObjectsMethod · 0.45
addDynamicObjectsMethod · 0.45
addKinematicObjectsMethod · 0.45

Calls 12

PxMaxFunction · 0.85
isNewOrUpdatedFunction · 0.85
markAsNewOrUpdatedFunction · 0.85
getNumCreatedHandlesMethod · 0.80
getCreatedHandlesMethod · 0.80
addStaticObjectsMethod · 0.80
addKinematicObjectsMethod · 0.80
addDynamicObjectsMethod · 0.80
resizeMappingFunction · 0.70
EnumEnum · 0.50
setBitMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected