Tue, 11 Apr 2023 22:39:18 +0300
Split GL preferences that affect GL build to a new build preferences structure, modifying that requires rebuild, modifying render preferences does not
17 | 1 | #pragma once |
264
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
237
diff
changeset
|
2 | #include "src/basics.h" |
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
237
diff
changeset
|
3 | #include "src/documentmanager.h" |
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
237
diff
changeset
|
4 | #include "src/types/boundingbox.h" |
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
237
diff
changeset
|
5 | #include "src/gl/common.h" |
76a025db4948
Convert all includes to be relative to project root directory. Files that cannot be found in this manner use angle brackets.
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
237
diff
changeset
|
6 | #include "src/gl/compiler.h" |
291
42b4953dff85
Let's bring GLEW back after all
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
264
diff
changeset
|
7 | #include <QOpenGLWidget> |
17 | 8 | |
217
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
9 | class PartRenderer final : public QOpenGLWidget |
17 | 10 | { |
21 | 11 | Q_OBJECT |
338 | 12 | QTextDocument* const model; |
217
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
13 | DocumentManager* const documents; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
14 | const ColorTable& colorTable; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
15 | BoundingBox boundingBox; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
16 | gl::ModelShaders shaders; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
17 | ModelId highlighted = {0}; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
18 | glm::mat4 projectionMatrix; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
19 | glm::mat4 viewMatrix; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
20 | glm::mat4 modelMatrix; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
21 | glm::vec4 viewportVector; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
22 | glm::quat modelQuaternion; |
359
73b6c478378e
The renderer now centers on the grid origin, not the part origin
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
338
diff
changeset
|
23 | glm::vec3 modelViewOrigin = {0, 0, 0}; |
217
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
24 | QPoint lastMousePosition; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
25 | int totalMouseMove = 0; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
26 | double zoom = 1.0; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
27 | bool initialized = false; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
28 | bool needBuild = true; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
29 | std::vector<RenderLayer*> activeRenderLayers; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
30 | std::vector<RenderLayer*> inactiveRenderLayers; |
313
c24d87f64bed
Improve click handling
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
31 | std::chrono::time_point<std::chrono::steady_clock> lastClickTime; |
232
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
217
diff
changeset
|
32 | bool frozen = false; |
17 | 33 | public: |
376
3cef3b016330
Split GL preferences that affect GL build to a new build preferences structure, modifying that requires rebuild, modifying render preferences does not
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
372
diff
changeset
|
34 | static const gl::RenderPreferences default_render_preferences; |
3cef3b016330
Split GL preferences that affect GL build to a new build preferences structure, modifying that requires rebuild, modifying render preferences does not
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
372
diff
changeset
|
35 | static const gl::build_preferences default_build_preferences; |
3cef3b016330
Split GL preferences that affect GL build to a new build preferences structure, modifying that requires rebuild, modifying render preferences does not
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
372
diff
changeset
|
36 | const gl::RenderPreferences* render_preferences = &PartRenderer::default_render_preferences; |
3cef3b016330
Split GL preferences that affect GL build to a new build preferences structure, modifying that requires rebuild, modifying render preferences does not
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
372
diff
changeset
|
37 | const gl::build_preferences* build_preferences = &PartRenderer::default_build_preferences; |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
34
diff
changeset
|
38 | PartRenderer( |
338 | 39 | QTextDocument* model, |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
34
diff
changeset
|
40 | DocumentManager* documents, |
205 | 41 | const ColorTable& colorTable, |
35
98906a94732f
renamed the linetypes namespace to ldraw namespace and added more structures to it
Teemu Piippo <teemu@hecknology.net>
parents:
34
diff
changeset
|
42 | QWidget* parent = nullptr); |
26 | 43 | ~PartRenderer() override; |
200 | 44 | ModelId getHighlightedObject() const; |
215
34c6e7bc4ee1
Reimplement the axes program as a layer that can be added to PartRenderer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
45 | void addRenderLayer(RenderLayer* layer); |
34c6e7bc4ee1
Reimplement the axes program as a layer that can be added to PartRenderer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
206
diff
changeset
|
46 | void setLayerEnabled(RenderLayer* layer, bool enabled); |
217
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
47 | std::optional<glm::vec3> screenToModelCoordinates(const QPointF& point, const Plane& plane) const; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
48 | QPointF modelToScreenCoordinates(const glm::vec3& point) const; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
49 | bool isDark() const; |
333
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
322
diff
changeset
|
50 | std::int32_t pick(QPoint where); |
07e65a4c6611
Experiment to delete the Model class and rely solely on text documents
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
322
diff
changeset
|
51 | void setSelection(const QSet<std::int32_t>& selectedIds); |
313
c24d87f64bed
Improve click handling
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
52 | glm::vec3 cameraVector(const QPointF& point) const; |
c24d87f64bed
Improve click handling
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
309
diff
changeset
|
53 | Line<3> cameraLine(const QPointF& point) const; |
359
73b6c478378e
The renderer now centers on the grid origin, not the part origin
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
338
diff
changeset
|
54 | Q_SLOT void setModelViewOrigin(const glm::vec3& newViewOrigin); |
376
3cef3b016330
Split GL preferences that affect GL build to a new build preferences structure, modifying that requires rebuild, modifying render preferences does not
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
372
diff
changeset
|
55 | Q_SLOT void build(); |
112 | 56 | Q_SIGNALS: |
70 | 57 | void projectionMatrixChanged(const glm::mat4& newMatrix); |
58 | void modelMatrixChanged(const glm::mat4& newMatrix); | |
59 | void viewMatrixChanged(const glm::mat4& newMatrix); | |
237
10a6298f636f
Add an option to log opengl messages
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
232
diff
changeset
|
60 | void message(const Message& message); |
17 | 61 | private: |
217
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
62 | void initializeGL() override; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
63 | void resizeGL(int width, int height) override; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
64 | void paintGL() override; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
65 | void mouseMoveEvent(QMouseEvent* event) override; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
66 | void mousePressEvent(QMouseEvent* event) override; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
67 | void mouseReleaseEvent(QMouseEvent* event) override; |
232
8efa3a33172e
Add base code for circular primitives
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
217
diff
changeset
|
68 | void keyReleaseEvent(QKeyEvent* event) override; |
217
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
69 | void wheelEvent(QWheelEvent* event) override; |
6d95c1a41e6e
reimplement EditTools as a render layer
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
215
diff
changeset
|
70 | glm::vec3 unproject(const glm::vec3& win) const; |
37 | 71 | void setFragmentStyle(gl::FragmentStyle fragStyle); |
22
6da867fa5429
commit work on GL rendering
Teemu Piippo <teemu@hecknology.net>
parents:
21
diff
changeset
|
72 | void renderScene(); |
31
b6df269a2c6b
fix remaining rendering control issues
Teemu Piippo <teemu@hecknology.net>
parents:
30
diff
changeset
|
73 | void updateViewMatrix(); |
55 | 74 | void updateModelMatrix(); |
360
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
75 | void renderVao(const gl::ArrayClass arrayClass, const GLenum glType); |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
76 | template<gl::ArrayClass arrayClass> |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
77 | void renderVao(); |
26 | 78 | void checkForGLErrors(); |
17 | 79 | }; |
322
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
80 | |
360
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
81 | inline constexpr opt<GLenum> getGlTypeForArrayClass(const gl::ArrayClass vboClass) |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
82 | { |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
83 | switch (vboClass) |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
84 | { |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
85 | case gl::ArrayClass::Lines: |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
86 | case gl::ArrayClass::ConditionalLines: |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
87 | return GL_LINES; |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
88 | case gl::ArrayClass::Triangles: |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
89 | return GL_TRIANGLES; |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
90 | case gl::ArrayClass::Quads: |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
91 | return GL_QUADS; |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
92 | } |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
93 | return {}; |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
94 | } |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
95 | |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
96 | template<gl::ArrayClass arrayClass> |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
97 | void PartRenderer::renderVao() |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
98 | { |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
99 | constexpr opt<GLenum> glType = getGlTypeForArrayClass(arrayClass); |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
100 | static_assert(glType.has_value()); |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
101 | this->renderVao(arrayClass, *glType); |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
102 | } |
41b38b9e05a2
`PartRenderer::renderVao` no longer throws if bad array class is given, this is now checked on compile time
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
359
diff
changeset
|
103 | |
322
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
104 | inline QVector<QPointF> convertWorldPointsToScreenPoints( |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
105 | const std::vector<glm::vec3> &worldPoints, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
106 | const PartRenderer* renderer) |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
107 | { |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
108 | QVector<QPointF> points2d; |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
109 | points2d.reserve(static_cast<int>(worldPoints.size())); |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
110 | for (const glm::vec3& point : worldPoints) |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
111 | { |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
112 | points2d.push_back(renderer->modelToScreenCoordinates(point)); |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
113 | } |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
114 | return points2d; |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
115 | } |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
116 | |
372
b2914aaeec1a
Winding is now an enum class winding_e
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
360
diff
changeset
|
117 | inline winding_e worldPolygonWinding( |
322
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
118 | const std::vector<glm::vec3> &points, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
119 | const PartRenderer* renderer) |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
120 | { |
372
b2914aaeec1a
Winding is now an enum class winding_e
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
360
diff
changeset
|
121 | return calculate_polygon_winding(QPolygonF{convertWorldPointsToScreenPoints(points, renderer)}); |
322
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
122 | } |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
123 | |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
124 | inline void drawWorldPoint( |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
125 | QPainter* painter, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
126 | const glm::vec3& worldPoint, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
127 | const PartRenderer* renderer) |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
128 | { |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
129 | const QPointF center = renderer->modelToScreenCoordinates(worldPoint); |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
130 | painter->drawEllipse(inscribe(CircleF{center, 5})); |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
131 | } |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
132 | |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
133 | inline void drawWorldPolyline( |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
134 | QPainter *painter, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
135 | const std::vector<glm::vec3> &points, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
136 | const PartRenderer* renderer) |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
137 | { |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
138 | painter->drawPolyline(QPolygonF{convertWorldPointsToScreenPoints(points, renderer)}); |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
139 | } |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
140 | |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
141 | inline void drawWorldPolygon( |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
142 | QPainter* painter, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
143 | const std::vector<glm::vec3> &points, |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
144 | const PartRenderer* renderer) |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
145 | { |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
146 | painter->drawPolygon(QPolygonF{convertWorldPointsToScreenPoints(points, renderer)}); |
a39f454a3d7f
Reduce edittools.cpp further
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
313
diff
changeset
|
147 | } |