| 124 class GLRenderer : public QGLWidget, protected QOpenGLFunctions, public HierarchyElement |
87 class GLRenderer : public QGLWidget, protected QOpenGLFunctions, public HierarchyElement |
| 125 { |
88 { |
| 126 Q_OBJECT |
89 Q_OBJECT |
| 127 |
90 |
| 128 public: |
91 public: |
| 129 GLRenderer(LDDocument* document, QWidget* parent = nullptr); |
92 GLRenderer(Model* model, QWidget* parent = nullptr); |
| 130 ~GLRenderer(); |
93 ~GLRenderer(); |
| 131 |
94 |
| 132 Camera camera() const; |
95 Camera camera() const; |
| 133 const CameraInfo& cameraInfo(Camera camera) const; |
96 const CameraInfo& cameraInfo(Camera camera) const; |
| 134 QString cameraName(Camera camera) const; |
97 QString cameraName(Camera camera) const; |
| 139 Vertex convert2dTo3d(const QPoint& pos2d, bool snap) const; |
102 Vertex convert2dTo3d(const QPoint& pos2d, bool snap) const; |
| 140 QPoint convert3dTo2d(const Vertex& pos3d) const; |
103 QPoint convert3dTo2d(const Vertex& pos3d) const; |
| 141 QString currentCameraName() const; |
104 QString currentCameraName() const; |
| 142 EditModeType currentEditModeType() const; |
105 EditModeType currentEditModeType() const; |
| 143 int depthNegateFactor() const; |
106 int depthNegateFactor() const; |
| 144 LDDocument* document() const; |
107 Model* model() const; |
| 145 void drawPoint(QPainter& painter, QPointF pos, QColor color = QColor (64, 192, 0)) const; |
108 void drawPoint(QPainter& painter, QPointF pos, QColor color = QColor (64, 192, 0)) const; |
| 146 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d); |
109 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d); |
| 147 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos); |
110 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos); |
| 148 void drawGLScene(); |
111 void drawGLScene(); |
| 149 void forgetObject(LDObject* obj); |
112 void forgetObject(LDObject* obj); |
| 199 void paintEvent(QPaintEvent* ev); |
162 void paintEvent(QPaintEvent* ev); |
| 200 void resizeGL(int w, int h); |
163 void resizeGL(int w, int h); |
| 201 void wheelEvent(QWheelEvent* ev); |
164 void wheelEvent(QWheelEvent* ev); |
| 202 |
165 |
| 203 private: |
166 private: |
| 204 LDDocument* m_document = nullptr; |
167 Model* const m_model; |
| 205 GLCompiler* m_compiler; |
168 GLCompiler* m_compiler; |
| 206 LDObject* m_objectAtCursor = nullptr; |
169 LDObject* m_objectAtCursor = nullptr; |
| 207 CameraIcon m_cameraIcons[7]; |
170 CameraIcon m_cameraIcons[7]; |
| 208 QTimer* m_toolTipTimer; |
171 QTimer* m_toolTipTimer; |
| 209 Qt::MouseButtons m_lastButtons; |
172 Qt::MouseButtons m_lastButtons; |
| 210 Qt::KeyboardModifiers m_currentKeyboardModifiers; |
173 Qt::KeyboardModifiers m_currentKeyboardModifiers; |
| 211 Vertex m_position3D; |
174 Vertex m_position3D; |
| 212 double m_virtualWidth; |
175 double m_virtualWidth; |
| 213 double m_virtualHeight; |
176 double m_virtualHeight; |
| |
177 QGenericMatrix<4, 4, GLfloat> m_rotationMatrix; |
| |
178 double m_panX[7] = {0}; |
| |
179 double m_panY[7] = {0}; |
| |
180 double m_zoom[7] = {30}; |
| |
181 double m_depthValues[6]; |
| |
182 LDGLOverlay m_overlays[6]; |
| 214 bool m_useDarkBackground = false; |
183 bool m_useDarkBackground = false; |
| 215 bool m_drawToolTip = false; |
184 bool m_drawToolTip = false; |
| 216 bool m_takingScreenCapture = false; |
185 bool m_takingScreenCapture = false; |
| 217 bool m_panning = false; |
186 bool m_panning = false; |
| 218 bool m_initialized = false; |
187 bool m_initialized = false; |
| 219 bool m_isDrawOnly = false; |
188 bool m_isDrawOnly = false; |
| 220 bool m_isDrawingSelectionScene = false; |
189 bool m_isDrawingSelectionScene = false; |
| 221 bool m_isCameraMoving = false; |
190 bool m_isCameraMoving = false; |
| |
191 bool m_needZoomToFit = true; |
| 222 QPoint m_mousePosition; |
192 QPoint m_mousePosition; |
| 223 QPoint m_globalpos; |
193 QPoint m_globalpos; |
| 224 QPointF m_mousePositionF; |
194 QPointF m_mousePositionF; |
| 225 QPen m_thinBorderPen; |
195 QPen m_thinBorderPen; |
| 226 Camera m_camera; |
196 Camera m_camera; |
| 233 AbstractEditMode* m_currentEditMode = nullptr; |
203 AbstractEditMode* m_currentEditMode = nullptr; |
| 234 GLuint m_axesVbo; |
204 GLuint m_axesVbo; |
| 235 GLuint m_axesColorVbo; |
205 GLuint m_axesColorVbo; |
| 236 |
206 |
| 237 void calcCameraIcons(); |
207 void calcCameraIcons(); |
| 238 LDGLData& currentDocumentData() const; |
|
| 239 void drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type); |
208 void drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type); |
| 240 LDOverlay* findOverlayObject (Camera cam); |
209 LDOverlay* findOverlayObject (Camera cam); |
| 241 double& panning (Axis ax); |
210 double& panning (Axis ax); |
| 242 double panning (Axis ax) const; |
211 double panning (Axis ax) const; |
| 243 double& zoom(); |
212 double& zoom(); |