src/glRenderer.h

Thu, 09 Feb 2017 00:52:23 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 09 Feb 2017 00:52:23 +0200
changeset 1100
9b2797729c82
parent 1099
14276e435640
child 1104
edddb9b0db9e
permissions
-rw-r--r--

Removed all overlay support. It's a messy pile of mess and I will reimplement it later as background images and it will be much better then.

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
9ce9496427f2 Happy new year 2017!
Teemu Piippo <teemu@hecknology.net>
parents: 1061
diff changeset
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"
830
a741a0b9df49 - updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents: 827
diff changeset
24 #include "editmodes/abstractEditMode.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25
706
d79083b9f74d Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
26 class GLCompiler;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 class MessageManager;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 class QDialogButtonBox;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 class RadioGroup;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 class QDoubleSpinBox;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 class QSpinBox;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 class QLineEdit;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 class QTimer;
823
1a2f593f0c02 - saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
34 class MagicWandMode;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35
1034
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
36 struct CameraInfo
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
37 {
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
38 int glrotate[3];
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
39 Axis localX;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
40 Axis localY;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
41 bool negatedX;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
42 bool negatedY;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
43 bool negatedDepth; // is greater depth value closer to camera?
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
44 };
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
45
1033
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
46 enum 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
47 {
1034
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
48 TopCamera,
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
49 FrontCamera,
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
50 LeftCamera,
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
51 BottomCamera,
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
52 BackCamera,
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
53 RightCamera,
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
54 FreeCamera,
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
55 };
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
56
1034
a05fc8256a3a Enum stuff
Teemu Piippo <teemu@compsta2.com>
parents: 1033
diff changeset
57 MAKE_ITERABLE_ENUM(Camera, TopCamera, FreeCamera)
1023
9450ac3cd930 Split grid stuff into a new class Grid in grid.cpp/grid.h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
58
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
59 struct CameraIcon
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
60 {
1033
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
61 QPixmap image;
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
62 QRect sourceRect;
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
63 QRect targetRect;
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
64 QRect hitRect;
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
65 Camera camera;
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
66 };
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
67
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
68 // 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
69 class GLRenderer : public QGLWidget, protected QOpenGLFunctions, public HierarchyElement
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70 {
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
71 Q_OBJECT
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 public:
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
74 GLRenderer(Model* model, QWidget* parent = nullptr);
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
75 ~GLRenderer();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76
1033
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
77 Camera camera() const;
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
78 const CameraInfo& cameraInfo(Camera camera) const;
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
79 QString cameraName(Camera camera) const;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
80 QByteArray capturePixels();
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
81 void compileObject(LDObject* obj);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
82 GLCompiler* compiler() const;
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
83 Vertex convert2dTo3d(const QPoint& pos2d, bool snap) const;
1096
7cc929d8fc4d Simplified GLRenderer::convert3dTo2d. The multiplication with the modelview matrix is not necessary, it's identity all the time... with that, I think the function makes much more sense now.
Teemu Piippo <teemu@hecknology.net>
parents: 1095
diff changeset
84 QPoint convert3dTo2d(const Vertex& pos3d) const;
986
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 EditModeType currentEditModeType() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
87 int depthNegateFactor() const;
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
88 void drawPoint(QPainter& painter, QPointF pos, QColor color = QColor (64, 192, 0)) const;
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
89 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
90 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
91 void drawGLScene();
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
92 void forgetObject(LDObject* obj);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
93 Axis getCameraAxis(bool y, Camera camid = (Camera) -1);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
94 double getDepthValue() const;
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
95 void getRelativeAxes(Axis& relX, Axis& relY) const;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
96 Axis getRelativeZ() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
97 void hardRefresh();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
98 void highlightCursorObject();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
99 void initGLData();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
100 bool isDrawOnly() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
101 bool isPicking() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
102 Qt::KeyboardModifiers keyboardModifiers() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
103 QPen linePen() const;
1013
fa025ba493d8 Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1008
diff changeset
104 void makeCurrent();
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
105 bool mouseHasMoved() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
106 QPoint const& mousePosition() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
107 QPointF const& mousePositionF() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
108 void needZoomToFit();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
109 LDObject* objectAtCursor() const;
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
110 void pick(int mouseX, int mouseY, bool additive);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
111 void pick(const QRect& range, bool additive);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
112 LDObject* pickOneObject(int mouseX, int mouseY);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
113 Vertex const& position3D() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
114 void refresh();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
115 void resetAllAngles();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
116 void resetAngles();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
117 void setBackground();
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
118 void setCamera(Camera cam);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
119 void setDepthValue(double depth);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
120 void setDrawOnly(bool value);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
121 void setEditMode(EditModeType type);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
122 void setPicking(bool a);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
123 QPen textPen() const;
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
124 void zoomNotch(bool inward);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
126 protected:
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
127 void contextMenuEvent(QContextMenuEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
128 void dragEnterEvent(QDragEnterEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
129 void dropEvent(QDropEvent* event);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
130 void initializeGL();
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
131 void keyPressEvent(QKeyEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
132 void keyReleaseEvent(QKeyEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
133 void leaveEvent(QEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
134 void mouseDoubleClickEvent(QMouseEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
135 void mousePressEvent(QMouseEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
136 void mouseMoveEvent(QMouseEvent* ev);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
137 void mouseReleaseEvent(QMouseEvent* ev);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
138 void paintEvent(QPaintEvent* ev);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
139 void resizeGL(int w, int h);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
140 void wheelEvent(QWheelEvent* ev);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
142 private:
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
143 Model* const m_model;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
144 GLCompiler* m_compiler;
1061
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
145 LDObject* m_objectAtCursor = nullptr;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
146 CameraIcon m_cameraIcons[7];
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
147 QTimer* m_toolTipTimer;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
148 Qt::MouseButtons m_lastButtons;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
149 Qt::KeyboardModifiers m_currentKeyboardModifiers;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
150 Vertex m_position3D;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
151 double m_virtualWidth;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
152 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
153 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
154 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
155 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
156 double m_zoom[7] = {30};
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_depthValues[6];
1061
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
158 bool m_useDarkBackground = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
159 bool m_drawToolTip = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
160 bool m_takingScreenCapture = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
161 bool m_panning = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
162 bool m_initialized = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
163 bool m_isDrawOnly = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
164 bool m_isDrawingSelectionScene = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
165 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
166 bool m_needZoomToFit = true;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
167 QPoint m_mousePosition;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
168 QPoint m_globalpos;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
169 QPointF m_mousePositionF;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
170 QPen m_thinBorderPen;
1033
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
171 Camera m_camera;
32153a1dbb15 - Refactoring...
Teemu Piippo <teemu@compsta2.com>
parents: 1032
diff changeset
172 Camera m_toolTipCamera;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
173 GLuint m_axeslist;
1061
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
174 int m_width = 0;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
175 int m_height = 0;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
176 int m_totalMouseMove;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
177 QColor m_backgroundColor;
1061
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
178 AbstractEditMode* m_currentEditMode = nullptr;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
179 GLuint m_axesVbo;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
180 GLuint m_axesColorVbo;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
181
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
182 void calcCameraIcons();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
183 void drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type);
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
184 double& panning (Axis ax);
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
185 double panning (Axis ax) const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
186 double& zoom();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
187 void zoomToFit();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
188 void zoomAllToFit();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
189
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
190 template<typename... Args>
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
191 QString format (QString fmtstr, Args... args)
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
192 {
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
193 return ::format (fmtstr, args...);
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
194 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
196 private slots:
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
197 void slot_toolTipTimer();
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
198 void initializeAxes();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199 };

mercurial