diff options
| author | Sheikh Dawood <[email protected]> | 2018-08-13 13:37:04 -0500 |
|---|---|---|
| committer | Sheikh Dawood <[email protected]> | 2018-08-13 13:37:04 -0500 |
| commit | 3f9977d72f8a481e76b6ad643a3d312a8cf9b551 (patch) | |
| tree | 8dfa563cf2a06498b56b055af133bd066f1f349c /PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h | |
| parent | PhysX 3.4, APEX 1.4 patch release @24214033 (diff) | |
| download | physx-3.4-3f9977d72f8a481e76b6ad643a3d312a8cf9b551.tar.xz physx-3.4-3f9977d72f8a481e76b6ad643a3d312a8cf9b551.zip | |
PhysX 3.4, APEX 1.4 patch release @24698370
Diffstat (limited to 'PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h')
| -rw-r--r-- | PhysX_3.4/Source/LowLevelCloth/src/ClothImpl.h | 11 |
1 files changed, 6 insertions, 5 deletions
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<T>::getNumSpheres() const template <typename T> inline void ClothImpl<T>::setCapsules(Range<const uint32_t> capsules, uint32_t first, uint32_t last) { + const IndexPair* srcIndices = reinterpret_cast<const IndexPair*>(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<const IndexPair*>(capsules.begin()); - if(mCloth.mCapsuleIndices.capacity() < newSize) { ContextLockType contextLock(mCloth.mFactory); @@ -634,8 +635,8 @@ inline void ClothImpl<T>::setCapsules(Range<const uint32_t> 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(); } |