Sun, 03 Jul 2022 21:47:44 +0300
Fix normal of the plane used to find cylinder height
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:
250
diff
changeset
|
1 | #include "src/circularprimitive.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:
250
diff
changeset
|
2 | #include "src/documentmanager.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:
250
diff
changeset
|
3 | #include "src/invert.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:
250
diff
changeset
|
4 | #include "src/polygoncache.h" |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
5 | |
200 | 6 | Model* resolve(const QString& name, const ModelId callingModelId, DocumentManager* documents) |
7 | { | |
8 | return documents->findDependencyByName(callingModelId, name); | |
9 | } | |
10 | ||
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
11 | static PolygonElement transformed( |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
12 | PolygonElement element, |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
13 | const glm::mat4& transform) |
200 | 14 | { |
211 | 15 | visitPoints([&transform](glm::vec3& p) { |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
16 | p = transform * glm::vec4{p, 1}; |
211 | 17 | }, element); |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
18 | return element; |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
19 | } |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
20 | |
211 | 21 | PolygonCache* findPolygonCacheForModel(Model* model, DocumentManager* context) |
22 | { | |
23 | std::optional<ModelId> modelId = context->findIdForModel(model); | |
24 | if (modelId.has_value()) { | |
25 | return context->getPolygonCacheForModel(modelId.value()); | |
26 | } | |
27 | else { | |
28 | return nullptr; | |
29 | } | |
30 | } | |
31 | ||
318
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
32 | constexpr bool n_xor(bool a) |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
33 | { |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
34 | return a; |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
35 | } |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
36 | |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
37 | template<typename... Args> |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
38 | constexpr bool n_xor(bool a, Args&&... rest) |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
39 | { |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
40 | return a xor n_xor(rest...); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
41 | } |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
42 | |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
43 | template<typename Fn, typename Fn2> |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
44 | static void inlineSubfileReference( |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
45 | const PolygonCache::vector_type& polygons, |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
46 | const Colored<SubfileReference>& ref, |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
47 | Fn&& add, |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
48 | Fn2&& reserve) |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
49 | { |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
50 | const bool needInverting = 0 |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
51 | ^ (glm::determinant(ref.transformation) < 0) |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
52 | ^ (ref.inverted); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
53 | reserve(polygons.size()); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
54 | for (const PolygonElement& cacheElement : polygons) { |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
55 | PolygonElement polygon = transformed(cacheElement, ref.transformation); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
56 | if (needInverting) { |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
57 | gl::invert(polygon); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
58 | } |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
59 | if (polygon.color == MAIN_COLOR) { |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
60 | polygon.color = ref.color; |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
61 | } |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
62 | add(polygon); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
63 | } |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
64 | } |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
65 | |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
66 | Model* findDependency(const SubfileReference& ref, GetPolygonsContext* context) |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
67 | { |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
68 | return context->documents->findDependencyByName(context->modelId, ref.name); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
69 | } |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
70 | |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
71 | template<typename Fn, typename Fn2> |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
72 | static void collectPolygons( |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
73 | const ModelElement& element, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
74 | Winding& winding, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
75 | GetPolygonsContext* context, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
76 | Fn&& add, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
77 | Fn2&& reserve) |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
78 | { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
79 | std::visit<void>(overloaded{ |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
80 | [&](const Colored<LineSegment>& edge) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
81 | add({edge, edge.color}); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
82 | }, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
83 | [&](const Colored<Triangle>& triangle) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
84 | add({triangle, triangle.color}); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
85 | }, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
86 | [&](const Colored<Quadrilateral>& quad) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
87 | add({quad, quad.color}); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
88 | }, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
89 | [&](const Colored<ConditionalEdge>& cedge) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
90 | add({cedge, cedge.color}); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
91 | }, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
92 | [&add, context, &reserve](const Colored<SubfileReference>& ref) { |
318
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
93 | Model* const dependency = findDependency(ref, context); |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
94 | if (PolygonCache* cache = (dependency != nullptr) |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
95 | ? findPolygonCacheForModel(dependency, context->documents) |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
96 | : nullptr |
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
97 | ) { |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
98 | recacheIfNeeded(cache, dependency, context->documents); |
318
216f02b50b0a
Reduce indent level
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
99 | inlineSubfileReference(cache->polygons, ref, add, reserve); |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
100 | } |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
101 | }, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
102 | [&add](const Colored<CircularPrimitive>& circ) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
103 | rasterize(circ, [&](const PlainPolygonElement& polygon, ColorIndex color){ |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
104 | if (color == MAIN_COLOR) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
105 | color = circ.color; |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
106 | } |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
107 | add(PolygonElement{polygon, color}); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
108 | }); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
109 | }, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
110 | [&winding](const Comment& comment) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
111 | if (comment.text == QStringLiteral("BFC CERTIFY CW")) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
112 | winding = Clockwise; |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
113 | } |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
114 | else if (comment.text == QStringLiteral("BFC CERTIFY CCW")) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
115 | winding = Anticlockwise; |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
116 | } |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
117 | else if (comment.text == QStringLiteral("BFC NOCERTIFY")) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
118 | winding = NoWinding; |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
119 | } |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
120 | }, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
121 | [](const ModelElement&) {} |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
122 | }, element); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
123 | } |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
124 | |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
125 | static std::vector<WithId<PolygonElement>> inlinePolygons( |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
126 | const Model* model, |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
127 | GetPolygonsContext* context) |
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
128 | { |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
129 | Winding winding = NoWinding; |
210
232e7634cc8a
more refactoring, dosn't build yet
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
205
diff
changeset
|
130 | std::vector<WithId<PolygonElement>> result; |
250
2837b549e616
I felt that the compiler was too kind to me, so I enabled a big pile of warnings
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
232
diff
changeset
|
131 | for (std::size_t i = 0; i < model->size(); i += 1) |
200 | 132 | { |
133 | const ModelElement& element = (*model)[i]; | |
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
|
134 | const ElementId id = model->idAt(i); |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
135 | collectPolygons(element, winding, context, |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
136 | [&result, winding, id](const PolygonElement& poly){ |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
137 | result.push_back({poly, id}); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
138 | if (winding == Winding::Clockwise) { |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
139 | gl::invert(result.back()); |
200 | 140 | } |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
141 | }, [&result](std::size_t incomingsize){ |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
142 | reserveMore(result, incomingsize); |
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
143 | }); |
200 | 144 | } |
145 | return result; | |
146 | } | |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
147 | |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
148 | void recacheIfNeeded(PolygonCache *cache, Model *model, DocumentManager *documents) |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
149 | { |
193 | 150 | if (cache->needRecache) |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
151 | { |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
152 | cache->polygons.clear(); |
193 | 153 | const std::optional<ModelId> modelId = documents->findIdForModel(model); |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
154 | if (modelId.has_value()) |
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
155 | { |
200 | 156 | GetPolygonsContext context{modelId.value(), documents}; |
305
d891da20abca
Add support for BFC CERTIFY statements
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
157 | cache->polygons = inlinePolygons(model, &context); |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
158 | } |
193 | 159 | cache->needRecache = false; |
150
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
160 | } |
b6cbba6e29a1
extract polygon cache out of Model
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
161 | } |