#ifndef DUST3D_CLOTH_SIMULATOR_H #define DUST3D_CLOTH_SIMULATOR_H #include #include #include struct mass_spring_system; class MassSpringSolver; class CgRootNode; class CgSpringDeformationNode; class CgMeshCollisionNode; class ClothSimulator : public QObject { Q_OBJECT public: ClothSimulator(const std::vector &vertices, const std::vector> &faces, const std::vector &collisionVertices, const std::vector> &collisionTriangles); ~ClothSimulator(); void create(); void step(); void getCurrentVertices(std::vector *currentVertices); private: std::vector m_vertices; std::vector> m_faces; std::vector m_collisionVertices; std::vector> m_collisionTriangles; std::vector m_clothPointBuffer; std::vector m_clothPointSources; std::vector> m_clothSprings; mass_spring_system *m_massSpringSystem = nullptr; MassSpringSolver *m_massSpringSolver = nullptr; CgRootNode *m_rootNode = nullptr; CgSpringDeformationNode *m_deformationNode = nullptr; CgMeshCollisionNode *m_meshCollisionNode = nullptr; void convertMeshToCloth(); }; #endif