aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/src/ClothImpl.h
diff options
context:
space:
mode:
authorMarijn Tamis <[email protected]>2018-09-12 14:12:47 +0200
committerMarijn Tamis <[email protected]>2018-09-12 14:12:47 +0200
commit7bceea80d4a04649f495f4f4331d7e3bdcdb05ca (patch)
tree824767cccf7b516a8c0b32467c6314eaa802f58d /NvCloth/src/ClothImpl.h
parentAdded missing GenerateProjectsIOS.sh file (diff)
downloadnvcloth-7bceea80d4a04649f495f4f4331d7e3bdcdb05ca.tar.xz
nvcloth-7bceea80d4a04649f495f4f4331d7e3bdcdb05ca.zip
1.1.5 Release (24934621)
Diffstat (limited to 'NvCloth/src/ClothImpl.h')
-rw-r--r--NvCloth/src/ClothImpl.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/NvCloth/src/ClothImpl.h b/NvCloth/src/ClothImpl.h
index 9bc4c36..dde7cdd 100644
--- a/NvCloth/src/ClothImpl.h
+++ b/NvCloth/src/ClothImpl.h
@@ -626,15 +626,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 = uint32_t(getChildCloth()->mCapsuleIndices.size());
- uint32_t newSize = uint32_t(capsules.size() / 2) + oldSize - last + first;
+ uint32_t newSize = srcIndicesSize + oldSize - last + first;
NV_CLOTH_ASSERT(newSize <= 32);
NV_CLOTH_ASSERT(first <= oldSize);
NV_CLOTH_ASSERT(last <= oldSize);
- const IndexPair* srcIndices = reinterpret_cast<const IndexPair*>(capsules.begin());
-
if (getChildCloth()->mCapsuleIndices.capacity() < newSize)
{
ContextLockType contextLock(getChildCloth()->mFactory);
@@ -660,8 +661,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];
getChildCloth()->wakeUp();
}
@@ -1201,7 +1202,7 @@ inline physx::PxVec3 ClothImpl<T>::getWindVelocity() const
template <typename T>
inline void ClothImpl<T>::setDragCoefficient(float coefficient)
{
- NV_CLOTH_ASSERT(coefficient < 1.f);
+ NV_CLOTH_ASSERT(coefficient <= 1.f);
float value = safeLog2(1.f - coefficient);
if (value == mDragLogCoefficient)
@@ -1221,7 +1222,7 @@ inline float ClothImpl<T>::getDragCoefficient() const
template <typename T>
inline void ClothImpl<T>::setLiftCoefficient(float coefficient)
{
- NV_CLOTH_ASSERT(coefficient < 1.f);
+ NV_CLOTH_ASSERT(coefficient <= 1.f);
float value = safeLog2(1.f - coefficient);
if (value == mLiftLogCoefficient)