9 */ |
9 */ |
10 class VertexMap : public QObject |
10 class VertexMap : public QObject |
11 { |
11 { |
12 Q_OBJECT |
12 Q_OBJECT |
13 public: |
13 public: |
14 using ApplyFunction = std::function<void(const glm::vec3&, const std::set<ldraw::id_t>&)>; |
14 struct VertexInfo |
|
15 { |
|
16 glm::vec3 point; |
|
17 std::set<ldraw::id_t> objects; |
|
18 bool transformSet = false; |
|
19 glm::mat4 transform; |
|
20 }; |
|
21 using ApplyFunction = std::function<void(const glm::vec3&, const VertexInfo&)>; |
15 VertexMap(const Model *model); |
22 VertexMap(const Model *model); |
16 Q_SLOT void build(); |
23 Q_SLOT void build(); |
17 void apply(ApplyFunction fn) const; |
24 void apply(ApplyFunction fn) const; |
18 Q_SIGNALS: |
25 Q_SIGNALS: |
19 Q_SIGNAL void verticesChanged(); |
26 Q_SIGNAL void verticesChanged(); |
20 private: |
27 private: |
21 const Model* const model; |
28 const Model* const model; |
22 QSet<unsigned int> vertexHashes; |
29 QSet<unsigned int> vertexHashes; |
23 std::vector<glm::vec3> vertices; |
30 std::vector<glm::vec3> vertices; |
24 std::map<unsigned int, std::set<ldraw::id_t>> map; |
31 std::map<unsigned int, VertexInfo> map; |
25 }; |
32 }; |
26 |
33 |
27 #endif // VERTEXMAP_H |
34 #endif // VERTEXMAP_H |