2 #define VERTEXMAP_H |
2 #define VERTEXMAP_H |
3 #include <set> |
3 #include <set> |
4 #include "main.h" |
4 #include "main.h" |
5 #include "model.h" |
5 #include "model.h" |
6 |
6 |
|
7 /** |
|
8 * @brief Collects a map of all vertices in a model to all objects that use the specified vertex. |
|
9 */ |
7 class VertexMap : public QObject |
10 class VertexMap : public QObject |
8 { |
11 { |
9 Q_OBJECT |
12 Q_OBJECT |
10 public: |
13 public: |
|
14 using ApplyFunction = std::function<void(const glm::vec3&, const std::set<ldraw::id_t>&)>; |
11 VertexMap(const Model *model); |
15 VertexMap(const Model *model); |
12 Q_SLOT void build(); |
16 Q_SLOT void build(); |
|
17 void apply(ApplyFunction fn) const; |
|
18 Q_SIGNALS: |
|
19 Q_SIGNAL void verticesChanged(); |
13 private: |
20 private: |
14 const Model* const model; |
21 const Model* const model; |
|
22 std::map<unsigned int, glm::vec3> vertices; |
15 std::map<unsigned int, std::set<ldraw::id_t>> map; |
23 std::map<unsigned int, std::set<ldraw::id_t>> map; |
16 }; |
24 }; |
17 |
25 |
18 #endif // VERTEXMAP_H |
26 #endif // VERTEXMAP_H |