Fri, 01 Jul 2022 13:41:46 +0300
Simplify some code
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 | 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 | 13 | struct GetPolygonsContext |
14 | { | |
15 | ModelId modelId; | |
16 | class DocumentManager* documents; | |
17 | }; | |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
18 | |
193 | 19 | struct PolygonCache |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
20 | { |
211 | 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 | 25 | |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
26 | void recacheIfNeeded( |
193 | 27 | PolygonCache* cache, |
28 | Model* model, | |
29 | class DocumentManager* documents); | |
211 | 30 | PolygonCache* findPolygonCacheForModel(Model* model, DocumentManager* context); |