aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/src/ClothImpl.h
diff options
context:
space:
mode:
authorMarijn Tamis <[email protected]>2017-07-03 11:49:08 +0200
committerMarijn Tamis <[email protected]>2017-07-03 11:49:08 +0200
commitcfa944ded7370fb5f22b1fb894ecf6b9bd3f7381 (patch)
tree5cc014922d20561d87105d279b6f7eb3e628c6d9 /NvCloth/src/ClothImpl.h
parentFix windows line endings in github. (diff)
downloadnvcloth-1.1.1.tar.xz
nvcloth-1.1.1.zip
NvCloth 1.1.1 Release. (22392725)v1.1.1
Diffstat (limited to 'NvCloth/src/ClothImpl.h')
-rw-r--r--NvCloth/src/ClothImpl.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/NvCloth/src/ClothImpl.h b/NvCloth/src/ClothImpl.h
index 0c2b362..1e8d9a1 100644
--- a/NvCloth/src/ClothImpl.h
+++ b/NvCloth/src/ClothImpl.h
@@ -157,6 +157,8 @@ class ClothImpl : public Cloth
virtual float getDragCoefficient() const;
virtual void setLiftCoefficient(float);
virtual float getLiftCoefficient() const;
+ virtual void setFluidDensity(float);
+ virtual float getFluidDensity() const;
virtual void setSelfCollisionDistance(float);
virtual float getSelfCollisionDistance() const;
@@ -216,6 +218,7 @@ public: //Fields shared between all cloth classes
physx::PxVec3 mWind;
float mDragLogCoefficient;
float mLiftLogCoefficient;
+ float mFluidDensity;
// sleeping
uint32_t mSleepTestInterval; // how often to test for movement
@@ -313,7 +316,8 @@ inline physx::PxVec3 ClothImpl<T>::getGravity() const
inline float safeLog2(float x)
{
- return x ? physx::shdfnd::log2(x) : -FLT_MAX_EXP;
+ NV_CLOTH_ASSERT(("safeLog2",x >= 0.0f));
+ return x > 0 ? physx::shdfnd::log2(x) : -FLT_MAX_EXP;
}
inline physx::PxVec3 safeLog2(const physx::PxVec3& v)
@@ -1214,11 +1218,30 @@ inline float ClothImpl<T>::getLiftCoefficient() const
}
template <typename T>
+inline void ClothImpl<T>::setFluidDensity(float fluidDensity)
+{
+ NV_CLOTH_ASSERT(fluidDensity < 0.f);
+ if (fluidDensity == mFluidDensity)
+ return;
+
+ mFluidDensity = fluidDensity;
+ getChildCloth()->notifyChanged();
+ wakeUp();
+}
+
+template <typename T>
+inline float ClothImpl<T>::getFluidDensity() const
+{
+ return mFluidDensity;
+}
+
+template <typename T>
inline uint32_t ClothImpl<T>::getNumSelfCollisionIndices() const
{
return uint32_t(getChildCloth()->mSelfCollisionIndices.size());
}
+
// Fixed 4505:local function has been removed
template <typename T>
inline void ClothImpl<T>::setRestPositions(Range<const physx::PxVec4> restPositions)
@@ -1255,6 +1278,7 @@ inline float ClothImpl<T>::getSelfCollisionDistance() const
template <typename T>
inline void ClothImpl<T>::setSelfCollisionStiffness(float stiffness)
{
+ NV_CLOTH_ASSERT(stiffness <= 1.0f);
float value = safeLog2(1 - stiffness);
if (value == getChildCloth()->mSelfCollisionLogStiffness)
return;