src/polygoncache.h

Sun, 03 Jul 2022 13:21:49 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sun, 03 Jul 2022 13:21:49 +0300
changeset 318
216f02b50b0a
parent 309
d862721d19a3
child 333
07e65a4c6611
permissions
-rw-r--r--

Reduce indent level

150
b6cbba6e29a1 extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #pragma once
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: 211
diff changeset
2 #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: 211
diff changeset
3 #include "src/model.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: 211
diff changeset
4 #include "src/gl/common.h"
309
d862721d19a3 Fixed ModelId being used to identify both models and elements, added ElementId to identify elements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 305
diff changeset
5 #include "src/documentmanager.h"
200
ca23936b455b Giant refactor
Teemu Piippo <teemu@hecknology.net>
parents: 193
diff changeset
6
210
232e7634cc8a more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 206
diff changeset
7 template<typename T>
232e7634cc8a more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 206
diff changeset
8 struct WithId : T
232e7634cc8a more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 206
diff changeset
9 {
309
d862721d19a3 Fixed ModelId being used to identify both models and elements, added ElementId to identify elements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 305
diff changeset
10 ElementId id;
210
232e7634cc8a more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 206
diff changeset
11 };
232e7634cc8a more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 206
diff changeset
12
200
ca23936b455b Giant refactor
Teemu Piippo <teemu@hecknology.net>
parents: 193
diff changeset
13 struct GetPolygonsContext
ca23936b455b Giant refactor
Teemu Piippo <teemu@hecknology.net>
parents: 193
diff changeset
14 {
ca23936b455b Giant refactor
Teemu Piippo <teemu@hecknology.net>
parents: 193
diff changeset
15 ModelId modelId;
ca23936b455b Giant refactor
Teemu Piippo <teemu@hecknology.net>
parents: 193
diff changeset
16 class DocumentManager* documents;
ca23936b455b Giant refactor
Teemu Piippo <teemu@hecknology.net>
parents: 193
diff changeset
17 };
150
b6cbba6e29a1 extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
193
b4beff48bb7a Simplify PolygonCache
Teemu Piippo <teemu@hecknology.net>
parents: 183
diff changeset
19 struct PolygonCache
150
b6cbba6e29a1 extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 {
211
b27b90fb993f Now builds again
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 210
diff changeset
21 using vector_type = std::vector<WithId<PolygonElement>>;
305
d891da20abca Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
22 vector_type polygons;
150
b6cbba6e29a1 extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 bool needRecache = true;
b6cbba6e29a1 extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 };
193
b4beff48bb7a Simplify PolygonCache
Teemu Piippo <teemu@hecknology.net>
parents: 183
diff changeset
25
305
d891da20abca Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 264
diff changeset
26 void recacheIfNeeded(
193
b4beff48bb7a Simplify PolygonCache
Teemu Piippo <teemu@hecknology.net>
parents: 183
diff changeset
27 PolygonCache* cache,
b4beff48bb7a Simplify PolygonCache
Teemu Piippo <teemu@hecknology.net>
parents: 183
diff changeset
28 Model* model,
b4beff48bb7a Simplify PolygonCache
Teemu Piippo <teemu@hecknology.net>
parents: 183
diff changeset
29 class DocumentManager* documents);
211
b27b90fb993f Now builds again
Teemu Piippo <teemu.s.piippo@gmail.com>
parents: 210
diff changeset
30 PolygonCache* findPolygonCacheForModel(Model* model, DocumentManager* context);

mercurial