src/linetypes/circularprimitive.h

Sun, 10 Jun 2018 23:07:24 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 10 Jun 2018 23:07:24 +0300
changeset 1401
59b578c77111
parent 1399
f52ea4078f5d
child 1402
8bbf2af8c3f5
permissions
-rw-r--r--

fixed bugs regarding circular primitives

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,
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
15 const Matrix& transformationMatrix,
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
16 const Vertex& position
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
17 );
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
19 LDObjectType type() const override;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
20 QString asText() const override;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
21 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
22 bool isRasterizable() const override;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 void rasterize(
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 DocumentManager* context,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 Winding parentWinding,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 Model& model,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 bool deep,
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 bool render
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29 ) override;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 QVector<LDPolygon> rasterizePolygons(DocumentManager* context, Winding parentWinding) override;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 QString objectListText() const override;
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
32 int triangleCount(DocumentManager*) const override;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
33 QString typeName() const override;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 void serialize(class Serializer& serializer) override;
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36 private:
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 QString buildFilename() const;
1394
8d9d0532b3df fixed cylinder rendering
Teemu Piippo <teemu@hecknology.net>
parents: 1391
diff changeset
38 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
39 QString stem() const;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40
1398
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
41 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
42 int m_segments = MediumResolution;
1c70d3447d20 changed LDCylinder to LDCircularPrimitive and moved circles to it
Teemu Piippo <teemu@hecknology.net>
parents: 1394
diff changeset
43 int m_divisions = MediumResolution;
1391
5fa4bf1fc781 added work done on cylinders
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 };

mercurial