From 3f9977d72f8a481e76b6ad643a3d312a8cf9b551 Mon Sep 17 00:00:00 2001 From: Sheikh Dawood Date: Mon, 13 Aug 2018 13:37:04 -0500 Subject: PhysX 3.4, APEX 1.4 patch release @24698370 --- PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h') diff --git a/PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h b/PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h index 3cf182dd..0cf16987 100644 --- a/PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h +++ b/PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h @@ -600,15 +600,16 @@ inline uint32_t ClothImpl::getNumSpheres() const template inline void ClothImpl::setCapsules(Range capsules, uint32_t first, uint32_t last) { + const IndexPair* srcIndices = reinterpret_cast(capsules.begin()); + const uint32_t srcIndicesSize = uint32_t(capsules.size() / 2); + uint32_t oldSize = mCloth.mCapsuleIndices.size(); - uint32_t newSize = uint32_t(capsules.size() / 2) + oldSize - last + first; + uint32_t newSize = srcIndicesSize + oldSize - last + first; PX_ASSERT(newSize <= 32); PX_ASSERT(first <= oldSize); PX_ASSERT(last <= oldSize); - const IndexPair* srcIndices = reinterpret_cast(capsules.begin()); - if(mCloth.mCapsuleIndices.capacity() < newSize) { ContextLockType contextLock(mCloth.mFactory); @@ -634,8 +635,8 @@ inline void ClothImpl::setCapsules(Range capsules, uint32_t f } // fill existing elements from capsules - for(uint32_t i = first; i < last; ++i) - dstIndices[i] = srcIndices[i - first]; + for (uint32_t i=0; i < srcIndicesSize; ++i) + dstIndices[first + i] = srcIndices[i]; mCloth.wakeUp(); } -- cgit v1.2.3