diff options
| author | Marijn Tamis <[email protected]> | 2018-09-12 14:12:47 +0200 |
|---|---|---|
| committer | Marijn Tamis <[email protected]> | 2018-09-12 14:12:47 +0200 |
| commit | 7bceea80d4a04649f495f4f4331d7e3bdcdb05ca (patch) | |
| tree | 824767cccf7b516a8c0b32467c6314eaa802f58d /NvCloth/src | |
| parent | Added missing GenerateProjectsIOS.sh file (diff) | |
| download | nvcloth-7bceea80d4a04649f495f4f4331d7e3bdcdb05ca.tar.xz nvcloth-7bceea80d4a04649f495f4f4331d7e3bdcdb05ca.zip | |
1.1.5 Release (24934621)
Diffstat (limited to 'NvCloth/src')
| -rw-r--r-- | NvCloth/src/ClothImpl.h | 15 | ||||
| -rw-r--r-- | NvCloth/src/SwSolver.h | 2 | ||||
| -rw-r--r-- | NvCloth/src/SwSolverKernel.cpp | 6 |
3 files changed, 12 insertions, 11 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) diff --git a/NvCloth/src/SwSolver.h b/NvCloth/src/SwSolver.h index ad58a7c..3aa1d92 100644 --- a/NvCloth/src/SwSolver.h +++ b/NvCloth/src/SwSolver.h @@ -61,7 +61,7 @@ class SwSolver : public Solver public: SwSolver(); - virtual ~SwSolver(); + virtual ~SwSolver() override; virtual void addCloth(Cloth*) override; virtual void addCloths(Range<Cloth*> cloths) override; diff --git a/NvCloth/src/SwSolverKernel.cpp b/NvCloth/src/SwSolverKernel.cpp index ab612e2..782e758 100644 --- a/NvCloth/src/SwSolverKernel.cpp +++ b/NvCloth/src/SwSolverKernel.cpp @@ -458,9 +458,9 @@ void applyWind(T4f* __restrict curIt, const T4f* __restrict prevIt, const uint16 T4f impulse = (drag + lift) * fluidDensity * doubleArea & ~isZero; //fluidDensity compensates for double area - curIt[i0] = c0 - impulse * splat<3>(c0); - curIt[i1] = c1 - impulse * splat<3>(c1); - curIt[i2] = c2 - impulse * splat<3>(c2); + curIt[i0] = c0 - ((impulse * splat<3>(c0)) & sMaskXYZ); + curIt[i1] = c1 - ((impulse * splat<3>(c1)) & sMaskXYZ); + curIt[i2] = c2 - ((impulse * splat<3>(c2)) & sMaskXYZ); } } |