#pragma once #include #include #include #include #include #include #include "constraints.hpp" using std::unordered_map; using std::unordered_set; using std::vector; struct Vertex; typedef unordered_map> Graph; class Mesh; class SoftBody { public: explicit SoftBody(Mesh* mesh, float edgeCompliance, float triangleCompliance=0, float tetrahedronCompliance=0); uint32_t firstIndex = 0; int32_t vertexOffset = 0; vector vertices; vector faces; ConstraintData constraintData; void applyVertexWorldOffset(const glm::vec3& offset); SoftBody& operator =(const SoftBody& other) = delete; private: void splitConstraints(); void reorderConstraintIndices(const vector> &partitions); };