src/linetypes/edge.cpp

Wed, 25 May 2022 20:36:34 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Wed, 25 May 2022 20:36:34 +0300
changeset 199
6988973515d2
parent 177
f69d53c053df
permissions
-rw-r--r--

Fix pick() picking from weird places on the screen with high DPI scaling

glReadPixels reads data from the frame buffer, which contains data after
high DPI scaling, so any reads to that need to take this scaling into account

3
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 #include "edge.h"
55a55a9ec2c2 Added lots of code
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2
35
98906a94732f renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents: 33
diff changeset
3 QString ldraw::Edge::textRepresentation() const
6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
4 {
87
93ec4d630346 added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
5 return utility::format(
93ec4d630346 added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
6 "%1 %2",
93ec4d630346 added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
7 utility::vertexToStringParens(this->points[0]),
93ec4d630346 added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
8 utility::vertexToStringParens(this->points[1]));
6
73e448b2943d language support
Teemu Piippo <teemu@hecknology.net>
parents: 3
diff changeset
9 }
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
10
35
98906a94732f renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents: 33
diff changeset
11 void ldraw::Edge::getPolygons(
21
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
12 std::vector<gl::Polygon>& polygons,
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
13 GetPolygonsContext* context) const
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
14 {
Teemu Piippo <teemu@hecknology.net>
parents: 18
diff changeset
15 Q_UNUSED(context)
87
93ec4d630346 added PolygonObject and refactored away a lot of boilerplate
Teemu Piippo <teemu@hecknology.net>
parents: 86
diff changeset
16 polygons.push_back(gl::edgeLine(this->points[0], this->points[1], this->colorIndex, this->id));
81
62373840e33a object editor widgets start to form up
Teemu Piippo <teemu@hecknology.net>
parents: 77
diff changeset
17 }
132
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 87
diff changeset
18
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 87
diff changeset
19 ldraw::Object::Type ldraw::Edge::typeIdentifier() const
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 87
diff changeset
20 {
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 87
diff changeset
21 return Type::EdgeLine;
488d0ba6070b Begin work with serialization
Teemu Piippo <teemu@hecknology.net>
parents: 87
diff changeset
22 }
141
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
23
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
24 QString ldraw::Edge::toLDrawCode() const
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
25 {
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
26 return utility::format(
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
27 "2 %1 %2 %3",
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
28 this->colorIndex.index,
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
29 utility::vertexToString(this->points[0]),
158
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
30 utility::vertexToString(this->points[1]));
141
185eb297dc1e Saving works now
Teemu Piippo <teemu@hecknology.net>
parents: 132
diff changeset
31 }
158
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
32
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
33 QString ldraw::Edge::iconName() const
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
34 {
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
35 return ":/icons/linetype-edgeline.png";
5bd755eaa5a8 Add icons from ionicons
Teemu Piippo <teemu@hecknology.net>
parents: 141
diff changeset
36 }
177
f69d53c053df Show type of object in the object editor
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
37
f69d53c053df Show type of object in the object editor
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
38 QString ldraw::Edge::typeName() const
f69d53c053df Show type of object in the object editor
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
39 {
f69d53c053df Show type of object in the object editor
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
40 return QObject::tr("edge");
f69d53c053df Show type of object in the object editor
Teemu Piippo <teemu@hecknology.net>
parents: 158
diff changeset
41 }

mercurial