Wed, 25 May 2022 18:29:49 +0300
move drawState to Document
154 | 1 | #pragma once |
2 | #include "modeleditor.h" | |
3 | ||
4 | namespace ldraw | |
5 | { | |
6 | /// Determines how quadrilaterals are split into triangles | |
7 | enum class Diagonal | |
8 | { | |
9 | Diagonal_13, | |
10 | Diagonal_24 | |
11 | }; | |
12 | ||
13 | // Splits the specified quadrilateral into triangles. | |
14 | // If it is not a quadrilateral then no action is performed | |
15 | auto splitQuadrilateral(ModelEditor& editor, | |
16 | quadrilateralid_t quadrilateral_id, | |
17 | Diagonal splitType = Diagonal::Diagonal_13 | |
18 | ) -> std::optional<std::pair<triangleid_t, triangleid_t>>; | |
19 | ||
183
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
154
diff
changeset
|
20 | void invert(ModelEditor& editor, ldraw::id_t id, GetPolygonsContext *context); |
154 | 21 | void makeUnofficial(ModelEditor &editor); |
186 | 22 | |
23 | template<typename Fn> | |
24 | void circle(int segments, int divisions, Fn&& fn) | |
25 | { | |
196 | 26 | float factor = 2.0f * pi<> / divisions; |
186 | 27 | for (int i = 0; i < segments; i += 1) |
28 | { | |
29 | fn( | |
30 | glm::vec2{std::sin((i - 1) * factor), std::cos((i - 1) * factor)}, | |
31 | glm::vec2{std::sin(i * factor), std::cos(i * factor)}, | |
32 | glm::vec2{std::sin((i + 1) * factor), std::cos((i - 1) * factor)} | |
33 | ); | |
34 | } | |
35 | } | |
154 | 36 | } |