diff --git a/languages/dust3d_zh_CN.ts b/languages/dust3d_zh_CN.ts
index 623adccd..6d65a7e2 100644
--- a/languages/dust3d_zh_CN.ts
+++ b/languages/dust3d_zh_CN.ts
@@ -754,7 +754,7 @@ Tips:
-
+ 硬度
diff --git a/src/clothsimulator.cpp b/src/clothsimulator.cpp
index 77f8a0f4..23d686eb 100644
--- a/src/clothsimulator.cpp
+++ b/src/clothsimulator.cpp
@@ -111,6 +111,19 @@ public:
}
}
}
+
+ void fixPoints(CgPointFixNode *fixNode) {
+ for (unsigned int i = 0; i < system->n_points; i++) {
+ auto offset = 3 * i;
+ Point point(vbuff[offset + 0],
+ vbuff[offset + 1],
+ vbuff[offset + 2]);
+ if (nullptr != m_insideTester &&
+ (*m_insideTester)(point) != CGAL::ON_UNBOUNDED_SIDE) {
+ fixNode->fixPoint(i);
+ }
+ }
+ }
};
ClothSimulator::ClothSimulator(const std::vector &vertices,
@@ -131,6 +144,7 @@ ClothSimulator::~ClothSimulator()
delete m_rootNode;
delete m_deformationNode;
delete m_meshCollisionNode;
+ delete m_fixNode;
}
void ClothSimulator::setStiffness(float stiffness)
@@ -239,9 +253,14 @@ void ClothSimulator::create()
m_rootNode = new CgRootNode(m_massSpringSystem, m_clothPointBuffer.data());
m_rootNode->addChild(m_deformationNode);
-
+
m_meshCollisionNode = new CgMeshCollisionNode(m_massSpringSystem, m_clothPointBuffer.data(),
m_collisionVertices,
m_collisionTriangles);
+
+ m_fixNode = new CgPointFixNode(m_massSpringSystem, m_clothPointBuffer.data());
+ m_meshCollisionNode->fixPoints(m_fixNode);
+ m_deformationNode->addChild(m_fixNode);
+
m_rootNode->addChild(m_meshCollisionNode);
}
diff --git a/src/clothsimulator.h b/src/clothsimulator.h
index c7b7c412..b8b7e7e0 100644
--- a/src/clothsimulator.h
+++ b/src/clothsimulator.h
@@ -9,6 +9,7 @@ class MassSpringSolver;
class CgRootNode;
class CgSpringDeformationNode;
class CgMeshCollisionNode;
+class CgPointFixNode;
class ClothSimulator : public QObject
{
@@ -37,6 +38,7 @@ private:
CgRootNode *m_rootNode = nullptr;
CgSpringDeformationNode *m_deformationNode = nullptr;
CgMeshCollisionNode *m_meshCollisionNode = nullptr;
+ CgPointFixNode *m_fixNode = nullptr;
void convertMeshToCloth();
};