Sat, 01 Feb 2020 15:33:57 +0200
wired renderstyle up
24 | 1 | /* |
2 | * LDForge: LDraw parts authoring CAD | |
3 | * Copyright (C) 2013 - 2020 Teemu Piippo | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
0 | 19 | #pragma once |
2 | 20 | #include <QString> |
21 | #include <QVector> | |
22 | #include <QSet> | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
3
diff
changeset
|
23 | #include <memory> |
3 | 24 | #include "basics.h" |
8
44679e468ba9
major update with many things
Teemu Piippo <teemu@hecknology.net>
parents:
7
diff
changeset
|
25 | #include "utility.h" |
20 | 26 | #include "maths.h" |
2 | 27 | |
7
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
3
diff
changeset
|
28 | namespace settingGroups |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
3
diff
changeset
|
29 | { |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
3
diff
changeset
|
30 | // List of setting groups |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
3
diff
changeset
|
31 | constexpr char mainwindow[] = "mainwindow"; |
68443f5be176
added the settings editor
Teemu Piippo <teemu@hecknology.net>
parents:
3
diff
changeset
|
32 | } |
21 | 33 | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
26
diff
changeset
|
34 | namespace ldraw |
21 | 35 | { |
36 | // Uniquely identifies a model body object | |
37 | struct Id | |
38 | { | |
39 | unsigned int value; | |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
26
diff
changeset
|
40 | constexpr bool operator<(ldraw::Id other) const |
26 | 41 | { |
42 | return this->value < other.value; | |
43 | } | |
21 | 44 | }; |
45 | } | |
22
6da867fa5429
commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents:
21
diff
changeset
|
46 | |
6da867fa5429
commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents:
21
diff
changeset
|
47 | constexpr std::size_t operator""_z(const unsigned long long int x) |
6da867fa5429
commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents:
21
diff
changeset
|
48 | { |
6da867fa5429
commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents:
21
diff
changeset
|
49 | return static_cast<std::size_t>(x); |
6da867fa5429
commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents:
21
diff
changeset
|
50 | } |
26 | 51 | |
52 | inline QString operator""_q(const char* string, const unsigned long int length) | |
53 | { | |
54 | Q_UNUSED(length) | |
55 | return QString{string}; | |
56 | } | |
57 | ||
58 | inline QPointF pointToPointF(const QPoint& point) | |
59 | { | |
60 | return {static_cast<qreal>(point.x()), static_cast<qreal>(point.y())}; | |
61 | } | |
62 | ||
63 | inline QPoint pointFToPoint(const QPointF& point) | |
64 | { | |
65 | return {static_cast<int>(std::round(point.x())), static_cast<int>(std::round(point.y()))}; | |
66 | } | |
67 | ||
68 | /** | |
69 | * \brief Hints to the specified vector that a certain amount of new elements are going to be added. | |
70 | * \param vector vector to consider | |
71 | * \param amount amount of new elements to expect | |
72 | */ | |
73 | template<typename T> | |
74 | void reserveMore(std::vector<T>& vector, std::size_t amount) | |
75 | { | |
76 | vector.reserve(vector.size() + amount); | |
77 | } |