Sun, 17 Jun 2018 13:53:33 +0300
replaced the Matrix class with QMatrix4x4
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
1 | #pragma once |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
2 | #include "../primitives.h" |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
3 | #include "modelobject.h" |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
4 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
5 | class LDCircularPrimitive : public LDMatrixObject |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
6 | { |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
7 | public: |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
8 | static const LDObjectType SubclassType = LDObjectType::CircularPrimitive; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
9 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
10 | LDCircularPrimitive() = default; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
11 | LDCircularPrimitive( |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
12 | PrimitiveModel::Type type, |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
13 | int segments, |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
14 | int divisions, |
1403
7a2d84112983
replaced the Matrix class with QMatrix4x4
Teemu Piippo <teemu@hecknology.net>
parents:
1402
diff
changeset
|
15 | const QMatrix4x4& matrix |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
16 | ); |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
17 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
18 | LDObjectType type() const override; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
19 | QString asText() const override; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
20 | void getVertices(DocumentManager *context, QSet<Vertex>& verts) const override; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
21 | bool isRasterizable() const override; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
22 | void rasterize( |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
23 | DocumentManager* context, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
24 | Winding parentWinding, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
25 | Model& model, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
26 | bool deep, |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
27 | bool render |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
28 | ) override; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
29 | QVector<LDPolygon> rasterizePolygons(DocumentManager* context, Winding parentWinding) override; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
30 | QString objectListText() const override; |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
31 | int triangleCount(DocumentManager*) const override; |
1402
8bbf2af8c3f5
some rework in description
Teemu Piippo <teemu@hecknology.net>
parents:
1399
diff
changeset
|
32 | QString iconName() const override; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
33 | void serialize(class Serializer& serializer) override; |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
34 | |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
35 | private: |
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
36 | QString buildFilename() const; |
1394
8d9d0532b3df
fixed cylinder rendering
Teemu Piippo <teemu@hecknology.net>
parents:
1391
diff
changeset
|
37 | void buildPrimitiveBody(Model& model) const; |
1399
f52ea4078f5d
added the disc and disc negative to the circular primitive type
Teemu Piippo <teemu@hecknology.net>
parents:
1398
diff
changeset
|
38 | QString stem() const; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
39 | |
1398
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
40 | PrimitiveModel::Type m_type = PrimitiveModel::Circle; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
41 | int m_segments = MediumResolution; |
1c70d3447d20
changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents:
1394
diff
changeset
|
42 | int m_divisions = MediumResolution; |
1391
5fa4bf1fc781
added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
43 | }; |