Wed, 25 May 2022 17:47:06 +0300
simplify further
183
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
1 | #pragma once |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
2 | #include "object.h" |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
3 | |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
4 | class Model; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
5 | |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
6 | namespace ldraw |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
7 | { |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
8 | class CompoundObject; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
9 | } |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
10 | |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
11 | /** |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
12 | * @brief An abstract object that has a transformation mmatrix and can be inverted. |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
13 | * It can be inlined into multiple objects. |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
14 | */ |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
15 | class ldraw::CompoundObject : public ColoredObject |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
16 | { |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
17 | public: |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
18 | CompoundObject() = default; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
19 | CompoundObject( |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
20 | const glm::mat4& transformation, |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
21 | const Color color = ldraw::MAIN_COLOR); |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
22 | QVariant getProperty(Property property) const override; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
23 | glm::vec3 position() const; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
24 | void invert(GetPolygonsContext*context) override; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
25 | Model* resolve(const ModelId callingModelId, DocumentManager* documents) const; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
26 | QDataStream& serialize(QDataStream& stream) const override; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
27 | QDataStream& deserialize(QDataStream& stream) override; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
28 | std::optional<Axis> flatDimension(GetPolygonsContext *context) const; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
29 | glm::mat4 transformation; |
186 | 30 | QString transformToBareString() const; |
183
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
31 | bool isInverted = false; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
32 | protected: |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
33 | void setProperty(SetPropertyResult* result, const PropertyKeyValue& pair) override; |
97b591813c8b
- Add editors for string and bool properties
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
34 | }; |