Sun, 08 May 2016 16:26:16 +0300
Further improved enum handling
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 |
1014
f0a8ecb6a357
Happy new year 2016!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1013
diff
changeset
|
3 | * Copyright (C) 2013 - 2016 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" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "macros.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "ldObject.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "ldDocument.h" |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
25 | #include "glShared.h" |
830
a741a0b9df49
- updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
827
diff
changeset
|
26 | #include "editmodes/abstractEditMode.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
28 | class GLCompiler; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | class MessageManager; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | class QDialogButtonBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | class RadioGroup; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | class QDoubleSpinBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | class QSpinBox; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | class QLineEdit; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | class QTimer; |
823
1a2f593f0c02
- saving work done on edit mode revamp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
818
diff
changeset
|
36 | class MagicWandMode; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
1034 | 38 | struct CameraInfo |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
39 | { |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
40 | int glrotate[3]; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
41 | Axis localX; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
42 | Axis localY; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
43 | bool negatedX; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
44 | bool negatedY; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
45 | bool negatedDepth; // is greater depth value closer to camera? |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
46 | }; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
47 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
48 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | // Meta for overlays |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
50 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | struct LDGLOverlay |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | { |
1023
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
53 | LDGLOverlay(); |
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
54 | ~LDGLOverlay(); |
9450ac3cd930
Split grid stuff into a new class Grid in grid.cpp/grid.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
55 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | Vertex v0, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | v1; |
1032
376db8dd6a42
Unabbreviated overlay member names
Teemu Piippo <teemu@compsta2.com>
parents:
1023
diff
changeset
|
58 | int offsetX, |
376db8dd6a42
Unabbreviated overlay member names
Teemu Piippo <teemu@compsta2.com>
parents:
1023
diff
changeset
|
59 | offsetY; |
376db8dd6a42
Unabbreviated overlay member names
Teemu Piippo <teemu@compsta2.com>
parents:
1023
diff
changeset
|
60 | double width, |
376db8dd6a42
Unabbreviated overlay member names
Teemu Piippo <teemu@compsta2.com>
parents:
1023
diff
changeset
|
61 | height; |
376db8dd6a42
Unabbreviated overlay member names
Teemu Piippo <teemu@compsta2.com>
parents:
1023
diff
changeset
|
62 | QString fileName; |
376db8dd6a42
Unabbreviated overlay member names
Teemu Piippo <teemu@compsta2.com>
parents:
1023
diff
changeset
|
63 | QImage* image; |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
64 | bool invalid; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
67 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | // Document-specific data |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | struct LDGLData |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | { |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
72 | double rotationX; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
73 | double rotationY; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
74 | double rotationZ; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
75 | double panX[7]; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
76 | double panY[7]; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
77 | double zoom[7]; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | double depthValues[6]; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | LDGLOverlay overlays[6]; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | bool init; |
737
e58bdb21cc54
- more elegant version of ded0a9b, do not zoom to fit in setDocument, instead zoom to fit before rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
718
diff
changeset
|
81 | bool needZoomToFit; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | |
737
e58bdb21cc54
- more elegant version of ded0a9b, do not zoom to fit in setDocument, instead zoom to fit before rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
718
diff
changeset
|
83 | LDGLData() : |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
84 | rotationX (0.0), |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
85 | rotationY (0.0), |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
86 | rotationZ (0.0), |
737
e58bdb21cc54
- more elegant version of ded0a9b, do not zoom to fit in setDocument, instead zoom to fit before rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
718
diff
changeset
|
87 | init (false), |
e58bdb21cc54
- more elegant version of ded0a9b, do not zoom to fit in setDocument, instead zoom to fit before rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
718
diff
changeset
|
88 | needZoomToFit (true) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | { |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
90 | for (int i = 0; i < 7; ++i) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | { |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
92 | if (i < 6) |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
93 | { |
1032
376db8dd6a42
Unabbreviated overlay member names
Teemu Piippo <teemu@compsta2.com>
parents:
1023
diff
changeset
|
94 | overlays[i].image = nullptr; |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
95 | overlays[i].invalid = false; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
96 | depthValues[i] = 0.0f; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
97 | } |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
98 | |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
99 | zoom[i] = 30.0; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
100 | panX[i] = 0.0; |
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
101 | panY[i] = 0.0; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | }; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | |
1033 | 106 | 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
|
107 | { |
1034 | 108 | TopCamera, |
109 | FrontCamera, | |
110 | LeftCamera, | |
111 | BottomCamera, | |
112 | BackCamera, | |
113 | RightCamera, | |
114 | 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
|
115 | }; |
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
|
116 | |
1034 | 117 | 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
|
118 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
119 | struct CameraIcon |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
120 | { |
1033 | 121 | QPixmap image; |
122 | QRect sourceRect; | |
123 | QRect targetRect; | |
124 | QRect hitRect; | |
125 | Camera camera; | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
126 | }; |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
127 | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
128 | // 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
|
129 | class GLRenderer : public QGLWidget, protected QOpenGLFunctions, public HierarchyElement |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | { |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
131 | Q_OBJECT |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
133 | public: |
984 | 134 | GLRenderer (QWidget* parent = nullptr); |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
135 | ~GLRenderer(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | |
1033 | 137 | Camera camera() const; |
1034 | 138 | const CameraInfo& cameraInfo (Camera camera) const; |
1033 | 139 | QString cameraName (Camera camera) const; |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
140 | QByteArray capturePixels(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
141 | void clearOverlay(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
142 | void compileObject (LDObject* obj); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
143 | GLCompiler* compiler() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
144 | Vertex convert2dTo3d (const QPoint& pos2d, bool snap) const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
145 | QPoint convert3dTo2d (const Vertex& pos3d); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
146 | QString currentCameraName() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
147 | EditModeType currentEditModeType() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
148 | int depthNegateFactor() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
149 | LDDocument* document() const; |
1008
74cb432812d3
Fixed circle, rectangle and line path modes not working anymore. Add blip coordinates to curve and line path modes. Circle mode for now only can show the coordinates of the initial blip
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
150 | void drawBlip (QPainter& painter, QPointF pos, QColor color = QColor (64, 192, 0)) const; |
74cb432812d3
Fixed circle, rectangle and line path modes not working anymore. Add blip coordinates to curve and line path modes. Circle mode for now only can show the coordinates of the initial blip
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
151 | void drawBlipCoordinates (QPainter& painter, const Vertex& pos3d); |
74cb432812d3
Fixed circle, rectangle and line path modes not working anymore. Add blip coordinates to curve and line path modes. Circle mode for now only can show the coordinates of the initial blip
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
152 | void drawBlipCoordinates (QPainter& painter, const Vertex& pos3d, QPointF pos); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
153 | void drawGLScene(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
154 | void forgetObject (LDObject* obj); |
1033 | 155 | Axis getCameraAxis (bool y, Camera camid = (Camera) -1); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
156 | double getDepthValue() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
157 | LDGLOverlay& getOverlay (int newcam); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
158 | void getRelativeAxes (Axis& relX, Axis& relY) const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
159 | Axis getRelativeZ() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
160 | void hardRefresh(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
161 | void highlightCursorObject(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
162 | void initGLData(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
163 | void initOverlaysFromObjects(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
164 | bool isDrawOnly() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
165 | bool isPicking() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
166 | Qt::KeyboardModifiers keyboardModifiers() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
167 | QPen linePen() const; |
1013
fa025ba493d8
Cleanup miscallenous.cpp/.h
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1008
diff
changeset
|
168 | void makeCurrent(); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
169 | MessageManager* messageLog() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
170 | bool mouseHasMoved() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
171 | QPoint const& mousePosition() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
172 | QPointF const& mousePositionF() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
173 | void needZoomToFit(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
174 | LDObject* objectAtCursor() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
175 | void pick (int mouseX, int mouseY, bool additive); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
176 | void pick (QRect const& range, bool additive); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
177 | LDObject* pickOneObject (int mouseX, int mouseY); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
178 | Vertex const& position3D() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
179 | void refresh(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
180 | void resetAllAngles(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
181 | void resetAngles(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
182 | void setBackground(); |
1033 | 183 | void setCamera (const Camera cam); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
184 | void setDepthValue (double depth); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
185 | void setDocument (LDDocument* document); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
186 | void setDrawOnly (bool value); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
187 | void setEditMode (EditModeType type); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
188 | void setPicking (bool a); |
1033 | 189 | bool setupOverlay (Camera camera, QString fileName, int x, int y, int w, int h); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
190 | QPen textPen() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
191 | void updateOverlayObjects(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
192 | void zoomNotch (bool inward); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
194 | protected: |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
195 | void contextMenuEvent (QContextMenuEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
196 | void dragEnterEvent (QDragEnterEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
197 | void dropEvent (QDropEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
198 | void initializeGL(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
199 | void keyPressEvent (QKeyEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
200 | void keyReleaseEvent (QKeyEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
201 | void leaveEvent (QEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
202 | void mouseDoubleClickEvent (QMouseEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
203 | void mousePressEvent (QMouseEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
204 | void mouseMoveEvent (QMouseEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
205 | void mouseReleaseEvent (QMouseEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
206 | void paintEvent (QPaintEvent* ev); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
207 | void resizeGL (int w, int h); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
208 | void wheelEvent (QWheelEvent* ev); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
210 | private: |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
211 | MessageManager* m_messageLog; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
212 | LDDocument* m_document; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
213 | GLCompiler* m_compiler; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
214 | LDObject* m_objectAtCursor; |
706
d79083b9f74d
Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents:
655
diff
changeset
|
215 | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
216 | CameraIcon m_cameraIcons[7]; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
217 | QTimer* m_toolTipTimer; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
218 | Qt::MouseButtons m_lastButtons; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
219 | Qt::KeyboardModifiers m_currentKeyboardModifiers; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
220 | Vertex m_position3D; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
221 | double m_virtualWidth; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
222 | double m_virtualHeight; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
223 | bool m_useDarkBackground; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
224 | bool m_drawToolTip; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
225 | bool m_takingScreenCapture; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
226 | bool m_panning; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
227 | bool m_initialized; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
228 | bool m_isDrawOnly; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
229 | bool m_isPicking; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
230 | bool m_isCameraMoving; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
231 | QPoint m_mousePosition; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
232 | QPoint m_globalpos; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
233 | QPointF m_mousePositionF; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
234 | QPen m_thinBorderPen; |
1033 | 235 | Camera m_camera; |
236 | Camera m_toolTipCamera; | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
237 | GLuint m_axeslist; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
238 | int m_width; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
239 | int m_height; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
240 | int m_totalMouseMove; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
241 | QColor m_backgroundColor; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
242 | AbstractEditMode* m_currentEditMode; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
243 | GLuint m_axesVbo; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
244 | GLuint m_axesColorVbo; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
245 | |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
246 | void calcCameraIcons(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
247 | void clampAngle (double& angle) const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
248 | LDGLData& currentDocumentData() const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
249 | void drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type); |
1033 | 250 | LDOverlay* findOverlayObject (Camera cam); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
251 | double& panning (Axis ax); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
252 | double panning (Axis ax) const; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
253 | double& rotation (Axis ax); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
254 | double& zoom(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
255 | void zoomToFit(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
256 | void zoomAllToFit(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
257 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
258 | template<typename... Args> |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
259 | QString format (QString fmtstr, Args... args) |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
260 | { |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
261 | return ::format (fmtstr, args...); |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
262 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
263 | |
802
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
264 | private slots: |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
265 | void slot_toolTipTimer(); |
2e220b9083bf
- refactor glRenderer.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
790
diff
changeset
|
266 | void initializeAxes(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
267 | }; |