aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/src/dx/DxClothData.cpp
diff options
context:
space:
mode:
authorMarijn Tamis <[email protected]>2017-04-28 14:19:07 +0200
committerMarijn Tamis <[email protected]>2017-04-28 14:19:07 +0200
commitb350eb5f4d44e8448115796144375d79438d74ae (patch)
tree8e102e8c28f45a1b87bd335ceee4f33c3d4ee7c2 /NvCloth/src/dx/DxClothData.cpp
parentAdd visual samples. (diff)
downloadnvcloth-b350eb5f4d44e8448115796144375d79438d74ae.tar.xz
nvcloth-b350eb5f4d44e8448115796144375d79438d74ae.zip
NvCloth 1.1.0 Release. (22041545)
Diffstat (limited to 'NvCloth/src/dx/DxClothData.cpp')
-rw-r--r--NvCloth/src/dx/DxClothData.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/NvCloth/src/dx/DxClothData.cpp b/NvCloth/src/dx/DxClothData.cpp
index 2625eac..075dc81 100644
--- a/NvCloth/src/dx/DxClothData.cpp
+++ b/NvCloth/src/dx/DxClothData.cpp
@@ -51,6 +51,9 @@ cloth::DxClothData::DxClothData(DxCloth& cloth)
mConstraintOffset = cloth.mFabric.mConstraints.mOffset;
mStiffnessOffset = cloth.mFabric.mStiffnessValues.empty() ? -1: cloth.mFabric.mStiffnessValues.mOffset;
+ mNumTriangles = cloth.mFabric.getNumTriangles();
+ mStartTriangleOffset = cloth.mFabric.mTriangles.mOffset;
+
mNumTethers = cloth.mFabric.mTethers.size();
mTetherOffset = cloth.mFabric.mTethers.mOffset;
mTetherConstraintScale = cloth.mTetherConstraintScale * cloth.mFabric.mTetherLengthScale;
@@ -94,14 +97,24 @@ cloth::DxFrameData::DxFrameData(DxCloth& cloth, uint32_t numSharedPositions, con
mFirstIteration = firstIteration;
mNumIterations = state.mRemainingIterations;
- Simd4f logStiffness = simd4f(0.0f, cloth.mSelfCollisionLogStiffness, cloth.mMotionConstraintLogStiffness,
- cloth.mTetherConstraintLogStiffness);
Simd4f stiffnessExponent = simd4f(cloth.mStiffnessFrequency * mIterDt);
- Simd4f stiffness = gSimd4fOne - exp2(logStiffness * stiffnessExponent);
+ {
+ Simd4f logStiffness = simd4f(0.0f, cloth.mSelfCollisionLogStiffness, cloth.mMotionConstraintLogStiffness,
+ cloth.mTetherConstraintLogStiffness);
+ Simd4f stiffness = gSimd4fOne - exp2(logStiffness * stiffnessExponent);
- mTetherConstraintStiffness = array(stiffness)[3];
- mMotionConstraintStiffness = array(stiffness)[2];
- mSelfCollisionStiffness = array(stiffness)[1];
+ mTetherConstraintStiffness = array(stiffness)[3];
+ mMotionConstraintStiffness = array(stiffness)[2];
+ mSelfCollisionStiffness = array(stiffness)[1];
+ }
+ {
+ Simd4f logStiffness = simd4f(cloth.mDragLogCoefficient, cloth.mLiftLogCoefficient, 0.0f, 0.0f);
+ Simd4f stiffness = gSimd4fOne - exp2(logStiffness * stiffnessExponent);
+ mDragCoefficient = array(stiffness)[0];
+ mLiftCoefficient = array(stiffness)[1];
+ for(int i = 0; i < 9; ++i)
+ mRotation[i] = array(state.mRotationMatrix[i / 3])[i % 3];
+ }
mStartSphereOffset = cloth.mStartCollisionSpheres.mOffset;
mTargetSphereOffset =
@@ -111,7 +124,6 @@ cloth::DxFrameData::DxFrameData(DxCloth& cloth, uint32_t numSharedPositions, con
mTargetCollisionPlaneOffset =
cloth.mTargetCollisionPlanes.empty() ? mStartCollisionPlaneOffset : cloth.mTargetCollisionPlanes.mOffset;
-
mStartCollisionTrianglesOffset = cloth.mStartCollisionTriangles.mOffset;
mTargetCollisionTrianglesOffset =
cloth.mTargetCollisionTriangles.empty() ? mStartCollisionTrianglesOffset : cloth.mTargetCollisionTriangles.mOffset;
@@ -172,6 +184,10 @@ cloth::DxIterationData::DxIterationData(const IterationState<Simd4f>& state)
copySquareTransposed(mIntegrationTrafo + 15, array(*state.mCurMatrix));
mIsTurning = uint32_t(state.mIsTurning);
+
+ mWind[0] = array(state.mWind)[0];
+ mWind[1] = array(state.mWind)[1];
+ mWind[2] = array(state.mWind)[2];
}
#endif // NV_CLOTH_ENABLE_DX11