src/glrenderer.h

Thu, 20 Jun 2019 08:54:35 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 20 Jun 2019 08:54:35 +0300
changeset 1440
265b2e95a8e8
parent 1436
241d3e452b32
permissions
-rw-r--r--

uuid things

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
1326
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1306
diff changeset
3 * Copyright (C) 2013 - 2018 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"
1129
2b20261dc511 Exported GLRenderer cameras into a new class, GLCamera.
Teemu Piippo <teemu@hecknology.net>
parents: 1123
diff changeset
24 #include "glcamera.h"
1159
6ad8cdcd88d9 print() is no longer a global function but is tied to HierarchyElement.
Teemu Piippo <teemu@hecknology.net>
parents: 1158
diff changeset
25 #include "hierarchyelement.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
27 namespace gl
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
28 {
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
29 enum CameraType
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
30 {
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
31 TopCamera,
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
32 FrontCamera,
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
33 LeftCamera,
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
34 BottomCamera,
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
35 BackCamera,
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
36 RightCamera,
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
37 FreeCamera,
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
38 _End
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
39 };
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
40
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
41 struct CameraIcon
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
42 {
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
43 QPixmap image;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
44 QRect sourceRect;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
45 QRect targetRect;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
46 QRect hitRect;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
47 CameraType camera;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
48 };
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
49
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
50 class Renderer;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
51 class Compiler;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
52
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
53 static const QPen thinBorderPen {QColor {0, 0, 0, 208}, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin};
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
54
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
55 // Transformation matrices for the fixed cameras.
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
56 static const QMatrix4x4 topCameraMatrix = {};
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
57 static const QMatrix4x4 frontCameraMatrix = {1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1};
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
58 static const QMatrix4x4 leftCameraMatrix = {0, -1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 1};
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
59 static const QMatrix4x4 bottomCameraMatrix = {1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1};
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
60 static const QMatrix4x4 backCameraMatrix = {-1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1};
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
61 static const QMatrix4x4 rightCameraMatrix = {0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1};
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
62
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
63 // Conversion matrix from LDraw to OpenGL coordinates.
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
64 static const QMatrix4x4 ldrawToGLAdapterMatrix = {1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1};
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
65
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
66 enum { BlackRgb = 0xff000000 };
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
67 static constexpr GLfloat near = 1.0f;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
68 static constexpr GLfloat far = 10000.0f;
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
69 }
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
70
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
71 MAKE_ITERABLE_ENUM(gl::CameraType)
1129
2b20261dc511 Exported GLRenderer cameras into a new class, GLCamera.
Teemu Piippo <teemu@hecknology.net>
parents: 1123
diff changeset
72
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
73 // The main renderer object, draws the brick on the screen, manages the camera and selection picking.
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
74 class gl::Renderer : public QGLWidget, protected QOpenGLFunctions, public HierarchyElement
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 {
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
76 Q_OBJECT
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
78 public:
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
79 Renderer(const Model* model, QWidget* parent = nullptr);
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
80 ~Renderer();
1278
6e1ea24e5a5e moved LDObject indices from a global array into Model
Santeri Piippo
parents: 1251
diff changeset
81
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
82 gl::CameraType camera() const;
1129
2b20261dc511 Exported GLRenderer cameras into a new class, GLCamera.
Teemu Piippo <teemu@hecknology.net>
parents: 1123
diff changeset
83 GLCamera& currentCamera();
2b20261dc511 Exported GLRenderer cameras into a new class, GLCamera.
Teemu Piippo <teemu@hecknology.net>
parents: 1123
diff changeset
84 const GLCamera& currentCamera() const;
1306
be85306198a2 red/green view rework complete
Teemu Piippo <teemu@hecknology.net>
parents: 1278
diff changeset
85 Q_SLOT void fullUpdate();
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
86 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
87 const Model* model() const;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
88 QPoint const& mousePosition() const;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
89 QPointF const& mousePositionF() const;
1440
265b2e95a8e8 uuid things
Teemu Piippo <teemu@hecknology.net>
parents: 1436
diff changeset
90 const Uuid& objectAtCursor() const;
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1247
diff changeset
91 QItemSelection pick(const QRect& range);
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1247
diff changeset
92 QModelIndex pick(int mouseX, int mouseY);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
93 void resetAllAngles();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
94 void resetAngles();
1171
430ffa371d2a Turned GLRenderer::pixelCapture to GLRenderer::screenCapture() which encapsulates screen capturing properly and returns a ready image.
Teemu Piippo <teemu@hecknology.net>
parents: 1170
diff changeset
95 QImage screenCapture();
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
96 void setBackground();
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
97 void setCamera(gl::CameraType cam);
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
98 QPen textPen() const;
1251
e75cc5bff076 Converted magic wand mode and other selection stuff to mvc
Santeri Piippo
parents: 1247
diff changeset
99 QItemSelectionModel* selectionModel() const;
1246
0054d13ed614 used mvc selection models
Santeri Piippo
parents: 1244
diff changeset
100 void setSelectionModel(QItemSelectionModel* selectionModel);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101
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
102 signals:
1247
7e1ce2fc066b converted highlighting to mvc
Santeri Piippo
parents: 1246
diff changeset
103 void objectHighlightingChanged(const QModelIndex& oldIndex, const QModelIndex& newIndex);
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
104
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
105 protected:
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
106 void initializeGL();
1178
3a88e7a60b63 At long last, the grid is finally now rendered onto the viewport. Woop!
Teemu Piippo <teemu@hecknology.net>
parents: 1176
diff changeset
107 virtual void drawFixedCameraBackdrop();
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
108 void keyPressEvent(QKeyEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
109 void keyReleaseEvent(QKeyEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
110 void leaveEvent(QEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
111 void mousePressEvent(QMouseEvent* event);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
112 void mouseMoveEvent(QMouseEvent* ev);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
113 void mouseReleaseEvent(QMouseEvent* ev);
1104
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
114 void paintEvent(QPaintEvent*);
1056
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
115 void resizeGL(int w, int h);
27b7991b3bea Cleanup in GL renderer...
Teemu Piippo <teemu@hecknology.net>
parents: 1035
diff changeset
116 void wheelEvent(QWheelEvent* ev);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117
1170
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
118 QColor backgroundColor() const;
1104
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
119 virtual bool freeCameraAllowed() const;
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
120 bool isDrawingSelectionScene() const;
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
121 Qt::MouseButtons lastButtons() const;
1170
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
122 bool mouseHasMoved() const;
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
123 virtual void overpaint(QPainter& painter);
1104
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
124 double panning (Axis ax) const;
1129
2b20261dc511 Exported GLRenderer cameras into a new class, GLCamera.
Teemu Piippo <teemu@hecknology.net>
parents: 1123
diff changeset
125 double zoom();
1104
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
126
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
127 template<typename... Args>
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
128 QString format (QString fmtstr, Args... args)
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
129 {
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
130 return ::format (fmtstr, args...);
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
131 }
edddb9b0db9e Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents: 1100
diff changeset
132
802
2e220b9083bf - refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
133 private:
1109
a55b2608a395 Made GLRenderer's Model pointer const
Teemu Piippo <teemu@hecknology.net>
parents: 1108
diff changeset
134 const Model* const m_model;
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
135 gl::Compiler* m_compiler;
1440
265b2e95a8e8 uuid things
Teemu Piippo <teemu@hecknology.net>
parents: 1436
diff changeset
136 Uuid m_objectAtCursor;
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
137 gl::CameraIcon m_cameraIcons[7];
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
138 QTimer* m_toolTipTimer;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
139 Qt::MouseButtons m_lastButtons;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
140 Qt::KeyboardModifiers m_currentKeyboardModifiers;
1393
f0fe7ea82b81 changed rotation matrix to quaternion in GLRenderer
Teemu Piippo <teemu@hecknology.net>
parents: 1369
diff changeset
141 QQuaternion m_rotation;
1129
2b20261dc511 Exported GLRenderer cameras into a new class, GLCamera.
Teemu Piippo <teemu@hecknology.net>
parents: 1123
diff changeset
142 GLCamera m_cameras[7];
1061
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
143 bool m_useDarkBackground = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
144 bool m_panning = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
145 bool m_initialized = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
146 bool m_isDrawingSelectionScene = false;
273333700685 refactor
Teemu Piippo <teemu@hecknology.net>
parents: 1056
diff changeset
147 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
148 bool m_needZoomToFit = true;
1169
3da9287b4aff Cleanup GLRenderer::initializeAxes()
Teemu Piippo <teemu@hecknology.net>
parents: 1168
diff changeset
149 bool m_axesInitialized = false;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
150 QPoint m_mousePosition;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
151 QPoint m_globalpos;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
152 QPointF m_mousePositionF;
1436
241d3e452b32 moved GL stuff into a new gl namespace
Teemu Piippo <teemu@hecknology.net>
parents: 1404
diff changeset
153 gl::CameraType m_camera;
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
154 GLuint m_axeslist;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
155 int m_totalMouseMove;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
156 QColor m_backgroundColor;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
157 GLuint m_axesVbo;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
158 GLuint m_axesColorVbo;
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
159
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
160 void calcCameraIcons();
1170
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
161 void drawGLScene();
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
162 void drawVbos(VboClass surface, VboSubclass colors);
1169
3da9287b4aff Cleanup GLRenderer::initializeAxes()
Teemu Piippo <teemu@hecknology.net>
parents: 1168
diff changeset
163 void freeAxes();
1170
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
164 void highlightCursorObject();
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
165 void initializeAxes();
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
166 void initializeLighting();
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
167 void initGLData();
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
168 void needZoomToFit();
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
169 void setPicking(bool picking);
2045a395213a Hardened the GLRenderer interface, made methods more private.
Teemu Piippo <teemu@hecknology.net>
parents: 1169
diff changeset
170 Q_SLOT void showCameraIconTooltip();
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
171 void zoomToFit();
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 984
diff changeset
172 void zoomAllToFit();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173 };

mercurial