Sun, 12 Feb 2017 16:02:02 +0200
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1072 | 3 | * Copyright (C) 2013 - 2017 Teemu Piippo |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
1006
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1000
diff
changeset
|
8 | * (at your option) any later version. |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <QGLWidget> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "main.h" |
1098
0b837bed121d
LDGLData merged into GLRenderer since it only deals with one document now. GLRenderer generalised from rendering documents to models.
Teemu Piippo <teemu@hecknology.net>
parents:
1097
diff
changeset
|
22 | #include "model.h" |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
23 | #include "glShared.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
25 | class GLCompiler; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | class MessageManager; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | class QDialogButtonBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | class RadioGroup; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | class QDoubleSpinBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | class QSpinBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | class QLineEdit; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | class QTimer; |
823
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
818
diff
changeset
|
33 | class MagicWandMode; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | |
1034 | 35 | struct CameraInfo |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
36 | { |
1108
90d6f4b7782e
Moved more editing-related methods to Canvas.
Teemu Piippo <teemu@hecknology.net>
parents:
1107
diff
changeset
|
37 | CameraInfo(const CameraInfo&) = delete; |
90d6f4b7782e
Moved more editing-related methods to Canvas.
Teemu Piippo <teemu@hecknology.net>
parents:
1107
diff
changeset
|
38 | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
39 | int glrotate[3]; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
40 | Axis localX; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
41 | Axis localY; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
42 | bool negatedX; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
43 | bool negatedY; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
44 | bool negatedDepth; // is greater depth value closer to camera? |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
45 | }; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
46 | |
1123
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
47 | enum class Camera |
762
d259256e1394
- added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents:
760
diff
changeset
|
48 | { |
1123
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
49 | Top, |
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
50 | Front, |
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
51 | Left, |
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
52 | Bottom, |
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
53 | Back, |
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
54 | Right, |
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
55 | Free, |
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
56 | _End |
762
d259256e1394
- added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents:
760
diff
changeset
|
57 | }; |
d259256e1394
- added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents:
760
diff
changeset
|
58 | |
1123
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
59 | MAKE_ITERABLE_ENUM(Camera) |
1023
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
60 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
61 | struct CameraIcon |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
62 | { |
1033 | 63 | QPixmap image; |
64 | QRect sourceRect; | |
65 | QRect targetRect; | |
66 | QRect hitRect; | |
67 | Camera camera; | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
68 | }; |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
69 | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
70 | // The main renderer object, draws the brick on the screen, manages the camera and selection picking. |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
71 | class GLRenderer : public QGLWidget, protected QOpenGLFunctions, public HierarchyElement |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | { |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
73 | Q_OBJECT |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
75 | public: |
1109
a55b2608a395
Made GLRenderer's Model pointer const
Teemu Piippo <teemu@hecknology.net>
parents:
1108
diff
changeset
|
76 | GLRenderer(const Model* model, QWidget* parent = nullptr); |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
77 | ~GLRenderer(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | |
1106
7541b0209057
Moved more methods only used by canvas code from GLRenderer to Canvas. Thin border pen is now a static constant.
Teemu Piippo <teemu@hecknology.net>
parents:
1104
diff
changeset
|
79 | QColor backgroundColor() const; |
1033 | 80 | Camera camera() const; |
1056
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
81 | const CameraInfo& cameraInfo(Camera camera) const; |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
82 | QString cameraName(Camera camera) const; |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
83 | QByteArray capturePixels(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
84 | GLCompiler* compiler() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
85 | QString currentCameraName() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
86 | void drawGLScene(); |
1056
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
87 | void forgetObject(LDObject* obj); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
88 | Axis getCameraAxis(bool y, Camera camid = (Camera) -1); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
89 | void highlightCursorObject(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
90 | void initGLData(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
91 | bool isDrawOnly() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
92 | bool isPicking() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
93 | Qt::KeyboardModifiers keyboardModifiers() const; |
1113
5f3139c802bf
Cleaned up GLCompiler. Among other changes, the compiler no longer has to be told what to compile.
Teemu Piippo <teemu@hecknology.net>
parents:
1111
diff
changeset
|
94 | const Model* model() const; |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
95 | bool mouseHasMoved() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
96 | QPoint const& mousePosition() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
97 | QPointF const& mousePositionF() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
98 | void needZoomToFit(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
99 | LDObject* objectAtCursor() const; |
1110
ec3ee7da7806
Moved more business logic out of GLRenderer into Canvas. GLRenderer::pick(const QRange&) now returns a set of LDObjects without modifying them. Replaced the GLRenderer::pick(int, int) overload with GLRenderer::pickOneObject.
Teemu Piippo <teemu@hecknology.net>
parents:
1109
diff
changeset
|
100 | QSet<LDObject*> pick(const QRect& range); |
ec3ee7da7806
Moved more business logic out of GLRenderer into Canvas. GLRenderer::pick(const QRange&) now returns a set of LDObjects without modifying them. Replaced the GLRenderer::pick(int, int) overload with GLRenderer::pickOneObject.
Teemu Piippo <teemu@hecknology.net>
parents:
1109
diff
changeset
|
101 | LDObject* pick(int mouseX, int mouseY); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
102 | void refresh(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
103 | void resetAllAngles(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
104 | void resetAngles(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
105 | void setBackground(); |
1056
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
106 | void setCamera(Camera cam); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
107 | void setDrawOnly(bool value); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
108 | void setPicking(bool a); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
109 | QPen textPen() const; |
1108
90d6f4b7782e
Moved more editing-related methods to Canvas.
Teemu Piippo <teemu@hecknology.net>
parents:
1107
diff
changeset
|
110 | double virtualHeight() const; |
90d6f4b7782e
Moved more editing-related methods to Canvas.
Teemu Piippo <teemu@hecknology.net>
parents:
1107
diff
changeset
|
111 | double virtualWidth() const; |
1056
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
112 | void zoomNotch(bool inward); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | |
1106
7541b0209057
Moved more methods only used by canvas code from GLRenderer to Canvas. Thin border pen is now a static constant.
Teemu Piippo <teemu@hecknology.net>
parents:
1104
diff
changeset
|
114 | static const QPen thinBorderPen; |
7541b0209057
Moved more methods only used by canvas code from GLRenderer to Canvas. Thin border pen is now a static constant.
Teemu Piippo <teemu@hecknology.net>
parents:
1104
diff
changeset
|
115 | |
1113
5f3139c802bf
Cleaned up GLCompiler. Among other changes, the compiler no longer has to be told what to compile.
Teemu Piippo <teemu@hecknology.net>
parents:
1111
diff
changeset
|
116 | signals: |
5f3139c802bf
Cleaned up GLCompiler. Among other changes, the compiler no longer has to be told what to compile.
Teemu Piippo <teemu@hecknology.net>
parents:
1111
diff
changeset
|
117 | void objectHighlightingChanged(LDObject* object); |
5f3139c802bf
Cleaned up GLCompiler. Among other changes, the compiler no longer has to be told what to compile.
Teemu Piippo <teemu@hecknology.net>
parents:
1111
diff
changeset
|
118 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
119 | protected: |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
120 | void initializeGL(); |
1056
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
121 | void keyPressEvent(QKeyEvent* event); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
122 | void keyReleaseEvent(QKeyEvent* event); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
123 | void leaveEvent(QEvent* event); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
124 | void mousePressEvent(QMouseEvent* event); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
125 | void mouseMoveEvent(QMouseEvent* ev); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
126 | void mouseReleaseEvent(QMouseEvent* ev); |
1104
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
127 | void paintEvent(QPaintEvent*); |
1056
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
128 | void resizeGL(int w, int h); |
27b7991b3bea
Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents:
1035
diff
changeset
|
129 | void wheelEvent(QWheelEvent* ev); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | |
1104
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
131 | virtual void overpaint(QPainter& painter); |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
132 | virtual bool freeCameraAllowed() const; |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
133 | bool isDrawingSelectionScene() const; |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
134 | Qt::MouseButtons lastButtons() const; |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
135 | double panning (Axis ax) const; |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
136 | const QGenericMatrix<4, 4, GLfloat>& rotationMatrix() const; |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
137 | double& panning (Axis ax); |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
138 | double& zoom(); |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
139 | |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
140 | template<typename... Args> |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
141 | QString format (QString fmtstr, Args... args) |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
142 | { |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
143 | return ::format (fmtstr, args...); |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
144 | } |
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1100
diff
changeset
|
145 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
146 | private: |
1109
a55b2608a395
Made GLRenderer's Model pointer const
Teemu Piippo <teemu@hecknology.net>
parents:
1108
diff
changeset
|
147 | const Model* const m_model; |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
148 | GLCompiler* m_compiler; |
1061 | 149 | LDObject* m_objectAtCursor = nullptr; |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
150 | CameraIcon m_cameraIcons[7]; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
151 | QTimer* m_toolTipTimer; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
152 | Qt::MouseButtons m_lastButtons; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
153 | Qt::KeyboardModifiers m_currentKeyboardModifiers; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
154 | double m_virtualWidth; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
155 | double m_virtualHeight; |
1098
0b837bed121d
LDGLData merged into GLRenderer since it only deals with one document now. GLRenderer generalised from rendering documents to models.
Teemu Piippo <teemu@hecknology.net>
parents:
1097
diff
changeset
|
156 | QGenericMatrix<4, 4, GLfloat> m_rotationMatrix; |
0b837bed121d
LDGLData merged into GLRenderer since it only deals with one document now. GLRenderer generalised from rendering documents to models.
Teemu Piippo <teemu@hecknology.net>
parents:
1097
diff
changeset
|
157 | double m_panX[7] = {0}; |
0b837bed121d
LDGLData merged into GLRenderer since it only deals with one document now. GLRenderer generalised from rendering documents to models.
Teemu Piippo <teemu@hecknology.net>
parents:
1097
diff
changeset
|
158 | double m_panY[7] = {0}; |
0b837bed121d
LDGLData merged into GLRenderer since it only deals with one document now. GLRenderer generalised from rendering documents to models.
Teemu Piippo <teemu@hecknology.net>
parents:
1097
diff
changeset
|
159 | double m_zoom[7] = {30}; |
1061 | 160 | bool m_useDarkBackground = false; |
161 | bool m_drawToolTip = false; | |
162 | bool m_takingScreenCapture = false; | |
163 | bool m_panning = false; | |
164 | bool m_initialized = false; | |
165 | bool m_isDrawOnly = false; | |
166 | bool m_isDrawingSelectionScene = false; | |
167 | bool m_isCameraMoving = false; | |
1098
0b837bed121d
LDGLData merged into GLRenderer since it only deals with one document now. GLRenderer generalised from rendering documents to models.
Teemu Piippo <teemu@hecknology.net>
parents:
1097
diff
changeset
|
168 | bool m_needZoomToFit = true; |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
169 | QPoint m_mousePosition; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
170 | QPoint m_globalpos; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
171 | QPointF m_mousePositionF; |
1033 | 172 | Camera m_camera; |
173 | Camera m_toolTipCamera; | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
174 | GLuint m_axeslist; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
175 | int m_totalMouseMove; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
176 | QColor m_backgroundColor; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
177 | GLuint m_axesVbo; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
178 | GLuint m_axesColorVbo; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
179 | |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
180 | void calcCameraIcons(); |
1123
15e46ea3151f
Reworked iterable enums: they all are enum classes now and the end value is marked with "_End"
Teemu Piippo <teemu@hecknology.net>
parents:
1119
diff
changeset
|
181 | void drawVbos (VboClass surface, VboSubclass colors, GLenum type); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
182 | void zoomToFit(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
183 | void zoomAllToFit(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
185 | private slots: |
1119
749fdf61b5cd
Implemented lighting. Yay! Unfortunately, faces that show up the wrong way around in BFC red/green mode also show up with inverted lighting here.
Teemu Piippo <teemu@hecknology.net>
parents:
1113
diff
changeset
|
186 | void slot_toolTipTimer(); |
749fdf61b5cd
Implemented lighting. Yay! Unfortunately, faces that show up the wrong way around in BFC red/green mode also show up with inverted lighting here.
Teemu Piippo <teemu@hecknology.net>
parents:
1113
diff
changeset
|
187 | void initializeAxes(); |
749fdf61b5cd
Implemented lighting. Yay! Unfortunately, faces that show up the wrong way around in BFC red/green mode also show up with inverted lighting here.
Teemu Piippo <teemu@hecknology.net>
parents:
1113
diff
changeset
|
188 | void initializeLighting(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
189 | }; |