Sat, 08 Apr 2023 16:12:12 +0300
Use explicit captures in main
117 | 1 | #ifndef VERTEXMAP_H |
2 | #define VERTEXMAP_H | |
3 | #include <set> | |
264
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
4 | #include "src/basics.h" |
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
259
diff
changeset
|
5 | #include "src/model.h" |
117 | 6 | |
118 | 7 | /** |
8 | * @brief Collects a map of all vertices in a model to all objects that use the specified vertex. | |
9 | */ | |
117 | 10 | class VertexMap : public QObject |
11 | { | |
12 | Q_OBJECT | |
13 | public: | |
120
8c9fff699241
rework rendering of vertices
Teemu Piippo <teemu@hecknology.net>
parents:
119
diff
changeset
|
14 | struct VertexInfo |
8c9fff699241
rework rendering of vertices
Teemu Piippo <teemu@hecknology.net>
parents:
119
diff
changeset
|
15 | { |
8c9fff699241
rework rendering of vertices
Teemu Piippo <teemu@hecknology.net>
parents:
119
diff
changeset
|
16 | glm::vec3 point; |
333
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
17 | //std::set<ElementId> objects; |
120
8c9fff699241
rework rendering of vertices
Teemu Piippo <teemu@hecknology.net>
parents:
119
diff
changeset
|
18 | bool transformSet = false; |
8c9fff699241
rework rendering of vertices
Teemu Piippo <teemu@hecknology.net>
parents:
119
diff
changeset
|
19 | glm::mat4 transform; |
8c9fff699241
rework rendering of vertices
Teemu Piippo <teemu@hecknology.net>
parents:
119
diff
changeset
|
20 | }; |
8c9fff699241
rework rendering of vertices
Teemu Piippo <teemu@hecknology.net>
parents:
119
diff
changeset
|
21 | using ApplyFunction = std::function<void(const glm::vec3&, const VertexInfo&)>; |
338 | 22 | VertexMap(const QTextDocument *model); |
117 | 23 | Q_SLOT void build(); |
118 | 24 | void apply(ApplyFunction fn) const; |
25 | Q_SIGNALS: | |
26 | Q_SIGNAL void verticesChanged(); | |
117 | 27 | private: |
338 | 28 | const QTextDocument* const model; |
259
c27612f0eac0
- Made it build under Qt6
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
29 | QSet<hash_t> vertexHashes; |
119 | 30 | std::vector<glm::vec3> vertices; |
259
c27612f0eac0
- Made it build under Qt6
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
31 | std::map<hash_t, VertexInfo> map; |
117 | 32 | }; |
33 | ||
34 | #endif // VERTEXMAP_H |