From ad993f2926db6fe4ba2c75e17c4f099d9d853038 Mon Sep 17 00:00:00 2001 From: Sheikh Dawood Abdul Ajees Date: Tue, 25 Sep 2018 11:33:48 -0500 Subject: PhysX 3.4, APEX 1.4 patch release @24990349 --- .../Source/LowLevelAABB/src/BpBroadPhaseMBP.cpp | 31 ++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'PhysX_3.4/Source/LowLevelAABB/src/BpBroadPhaseMBP.cpp') diff --git a/PhysX_3.4/Source/LowLevelAABB/src/BpBroadPhaseMBP.cpp b/PhysX_3.4/Source/LowLevelAABB/src/BpBroadPhaseMBP.cpp index 313e27f3..cdaa2145 100644 --- a/PhysX_3.4/Source/LowLevelAABB/src/BpBroadPhaseMBP.cpp +++ b/PhysX_3.4/Source/LowLevelAABB/src/BpBroadPhaseMBP.cpp @@ -3354,6 +3354,14 @@ void BroadPhaseMBP::update(const PxU32 numCpuTasks, PxcScratchAllocator* scratch } } +void BroadPhaseMBP::singleThreadedUpdate(PxcScratchAllocator* /*scratchAllocator*/, const BroadPhaseUpdateData& updateData) +{ + // PT: TODO: the scratchAllocator isn't actually needed, is it? + setUpdateData(updateData); + update(); + postUpdate(); +} + static PX_FORCE_INLINE void computeMBPBounds(MBP_AABB& aabb, const PxBounds3* PX_RESTRICT boundsXYZ, const PxReal* PX_RESTRICT contactDistances, const BpHandle index) { const PxBounds3& b = boundsXYZ[index]; @@ -3614,23 +3622,24 @@ bool BroadPhaseMBP::isValid(const BroadPhaseUpdateData& updateData) const const BpHandle* created = updateData.getCreatedHandles(); if(created) { + Ps::HashSet set; + PxU32 nbObjects = mMBP->mMBP_Objects.size(); + const MBP_Object* PX_RESTRICT objects = mMBP->mMBP_Objects.begin(); + while(nbObjects--) + { + if(!(objects->mFlags & MBP_REMOVED)) + set.insert(objects->mUserID); + objects++; + } + PxU32 nbToGo = updateData.getNumCreatedHandles(); while(nbToGo--) { const BpHandle index = *created++; PX_ASSERT(indexmMBP_Objects.size(); - const MBP_Object* PX_RESTRICT objects = mMBP->mMBP_Objects.begin(); - while(nbObjects--) - { - if(!(objects->mFlags & MBP_REMOVED)) - { - if(objects->mUserID==index) - return false; // This object has been added already - } - objects++; - } + if(set.contains(index)) + return false; // This object has been added already } } -- cgit v1.2.3