src/gldraw.h

Mon, 20 Jan 2014 15:04:26 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 20 Jan 2014 15:04:26 +0200
changeset 667
31540c1f22ea
parent 666
c595cfb4791c
parent 619
8bfe34c6ab1a
child 668
6a05c4969074
permissions
-rw-r--r--

- Merge commit '5c835eb' into HEAD

Conflicts:
src/file.cpp
src/gldraw.cc
src/gldraw.h

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
600
209e3f1f7b2c - updated copyright year. Best wishes for 2014!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 578
diff changeset
3 * Copyright (C) 2013, 2014 Santeri Piippo
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 447
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 412
diff changeset
8 * (at your option) any later version.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 447
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 447
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
19 #ifndef LDFORGE_GLDRAW_H
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
20 #define LDFORGE_GLDRAW_H
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QGLWidget>
541
0e38beeb050a - Renamed common.h to main.h, split the PROPERTY macro and supporting macros to property.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 540
diff changeset
23 #include "main.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include "ldtypes.h"
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
25 #include "document.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
322
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 318
diff changeset
27 class MessageManager;
196
47f4f4543152 Allow one of the dimensions be filled via aspect ratio
Santeri Piippo <crimsondusk64@gmail.com>
parents: 195
diff changeset
28 class QDialogButtonBox;
479
f179241a72a8 rename RadioBox to RadioGroup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
29 class RadioGroup;
195
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
30 class QDoubleSpinBox;
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
31 class QSpinBox;
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
32 class QLineEdit;
253
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
33 class QTimer;
195
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
34
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
35 enum EditMode
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
36 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
37 ESelectMode,
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
38 EDrawMode,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
39 ECircleMode,
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
40 };
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
41
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
42 // Meta for overlays
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
43 struct LDGLOverlay
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
44 {
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
45 Vertex v0,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
46 v1;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
47 int ox,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
48 oy;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
49 double lw,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
50 lh;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
51 QString fname;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
52 QImage* img;
251
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
53 };
c4b96bc41298 Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
54
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
55 struct LDFixedCameraInfo
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
56 {
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
57 const char glrotate[3];
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
58 const Axis axisX,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
59 axisY;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
60 const bool negX,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
61 negY;
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
62 };
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
63
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 // =============================================================================
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
65 // Document-specific data
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
66 //
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
67 struct LDGLData
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
68 {
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
69 double rotX,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
70 rotY,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
71 rotZ,
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
72 panX[7],
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
73 panY[7],
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
74 zoom[7];
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
75 double depthValues[6];
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
76 LDGLOverlay overlays[6];
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
77 bool init;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
78
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
79 LDGLData()
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
80 {
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
81 for (int i = 0; i < 6; ++i)
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
82 {
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
83 overlays[i].img = null;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
84 depthValues[i] = 0.0f;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
85 }
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
86
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
87 init = false;
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
88 }
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
89 };
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
90
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
91 // =============================================================================
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 // The main renderer object, draws the brick on the screen, manages the camera
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 // and selection picking. The instance of GLRenderer is accessible as
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 412
diff changeset
94 // g_win->R()
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
95 //
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
96 class GLRenderer : public QGLWidget
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
97 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
98 typedefs:
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
99 enum EFixedCamera
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
100 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
101 ETopCamera,
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
102 EFrontCamera,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
103 ELeftCamera,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
104 EBottomCamera,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
105 EBackCamera,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
106 ERightCamera,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
107 EFreeCamera
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
108 };
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
109
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
110 enum ListType
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
111 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
112 NormalList,
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
113 PickList,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
114 BFCFrontList,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
115 BFCBackList
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
116 };
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
117
667
31540c1f22ea - Merge commit '5c835eb' into HEAD
Santeri Piippo <crimsondusk64@gmail.com>
parents: 666 619
diff changeset
118 enum VAOType
31540c1f22ea - Merge commit '5c835eb' into HEAD
Santeri Piippo <crimsondusk64@gmail.com>
parents: 666 619
diff changeset
119 {
666
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
120 MainArray,
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
121 EdgeArray,
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
122 CondEdgeArray,
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
123 BFCArray,
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
124 PickArray,
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
125 EdgePickArray,
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
126 NumArrays
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
127 };
c595cfb4791c now compiles again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 665
diff changeset
128
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
129 // CameraIcon::img is a heap-allocated QPixmap because otherwise it gets
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
130 // initialized before program gets to main() and constructs a QApplication
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
131 // and Qt doesn't like that.
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
132 struct CameraIcon
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
133 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
134 QPixmap* img;
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
135 QRect srcRect,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
136 destRect,
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
137 selRect;
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
138 EFixedCamera cam;
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
139 };
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
140
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
141 properties:
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
142 Q_OBJECT
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
143 PROPERTY (public, bool, DrawOnly, BOOL_OPS, STOCK_WRITE)
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
144 PROPERTY (public, MessageManager*, MessageLog, NO_OPS, STOCK_WRITE)
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
145 PROPERTY (private, bool, Picking, BOOL_OPS, STOCK_WRITE)
578
a86ae85a277c - added visible line angles when drawing
Santeri Piippo <crimsondusk64@gmail.com>
parents: 574
diff changeset
146 PROPERTY (public, LDDocument*, File, NO_OPS, CUSTOM_WRITE)
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
147 PROPERTY (public, EditMode, EditMode, NO_OPS, CUSTOM_WRITE)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
148
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
149 public:
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
150 GLRenderer (QWidget* parent = null);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
151 ~GLRenderer();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
152
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
153 inline EFixedCamera camera() const
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
154 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
155 return m_camera;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
156 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
157
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
158 void clearOverlay();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
159 void compileObject (LDObject* obj);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
160 void compileAllObjects();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
161 void drawGLScene();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
162 void endDraw (bool accept);
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
163 Axis getCameraAxis (bool y, EFixedCamera camid = (EFixedCamera) - 1);
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
164 const char* getCameraName() const;
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
165 double getDepthValue() const;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
166 QColor getMainColor();
497
c51941e590b6 a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
167 LDGLOverlay& getOverlay (int newcam);
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
168 uchar* getScreencap (int& w, int& h);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
169 void hardRefresh();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
170 void initGLData();
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
171 void initOverlaysFromObjects();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
172 void refresh();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
173 void resetAngles();
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
174 void resetAllAngles();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
175 void setBackground();
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
176 void setCamera (const EFixedCamera cam);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
177 void setDepthValue (double depth);
606
3dd6f343ec06 - removed the 'str' typedef, use QString directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 604
diff changeset
178 bool setupOverlay (EFixedCamera cam, QString file, int x, int y, int w, int h);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
179 void updateOverlayObjects();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
180 void zoomNotch (bool inward);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
181 void zoomToFit();
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
182 void zoomAllToFit();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
183
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
184 static void deleteLists (LDObject* obj);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
185
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
186 protected:
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
187 void contextMenuEvent (QContextMenuEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
188 void initializeGL();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
189 void keyPressEvent (QKeyEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
190 void keyReleaseEvent (QKeyEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
191 void leaveEvent (QEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
192 void mouseDoubleClickEvent (QMouseEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
193 void mousePressEvent (QMouseEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
194 void mouseMoveEvent (QMouseEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
195 void mouseReleaseEvent (QMouseEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
196 void paintEvent (QPaintEvent* ev);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
197 void resizeGL (int w, int h);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
198 void wheelEvent (QWheelEvent* ev);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
200 private:
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
201 CameraIcon m_cameraIcons[7];
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
202 QTimer* m_toolTipTimer;
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
203 Qt::MouseButtons m_lastButtons;
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
204 Qt::KeyboardModifiers m_keymods;
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
205 Vertex m_hoverpos;
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
206 double m_virtWidth,
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
207 m_virtHeight;
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
208 bool m_darkbg,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
209 m_rangepick,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
210 m_addpick,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
211 m_drawToolTip,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
212 m_screencap,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
213 m_panning;
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
214 QPoint m_pos,
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
215 m_globalpos,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
216 m_rangeStart;
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
217 QPen m_thickBorderPen,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
218 m_thinBorderPen;
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
219 EFixedCamera m_camera,
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
220 m_toolTipCamera;
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
221 GLuint m_axeslist;
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
222 int m_width,
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
223 m_height,
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
224 m_totalmove;
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
225 QList<Vertex> m_drawedVerts;
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
226 bool m_rectdraw;
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
227 Vertex m_rectverts[4];
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
228 QColor m_bgcolor;
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
229 QList<Vertex> m_knownVerts;
492
e964085e6913 Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 479
diff changeset
230
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
231 void addDrawnVertex (Vertex m_hoverpos);
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
232 LDOverlay* findOverlayObject (EFixedCamera cam);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
233 void updateRectVerts();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
234 void getRelativeAxes (Axis& relX, Axis& relY) const;
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
235 Matrix getCircleDrawMatrix (double scale);
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
236 void drawBlip (QPainter& paint, QPoint pos) const;
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
237
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
238 // Compute geometry for camera icons
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
239 void calcCameraIcons();
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
240
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
241 // How large is the circle we're drawing right now?
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
242 double getCircleDrawDist (int pos) const;
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
243
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
244 // Clamps an angle to [0, 360]
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
245 void clampAngle (double& angle) const;
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
246
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
247 // Compile one of the lists of an object
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
248 void compileList (LDObject* obj, const ListType list);
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
249
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
250 // Sub-routine for object compiling
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
251 void compileSubObject (LDObject* obj, const GLenum gltype);
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
252
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
253 // Compile a single vertex to a list
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
254 void compileVertex (const Vertex& vrt);
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
255
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
256 // Convert a 2D point to a 3D point
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
257 Vertex coordconv2_3 (const QPoint& pos2d, bool snap) const;
539
72ad83a67165 - upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 538
diff changeset
258
667
31540c1f22ea - Merge commit '5c835eb' into HEAD
Santeri Piippo <crimsondusk64@gmail.com>
parents: 666 619
diff changeset
259 <<<<<<< HEAD
665
4355e72ffd47 Merge branch 'master' into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents: 489 534
diff changeset
260 // Draw a VAO array
4355e72ffd47 Merge branch 'master' into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents: 489 534
diff changeset
261 void drawVAOs (VAOType arrayType, GLenum type);
4355e72ffd47 Merge branch 'master' into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents: 489 534
diff changeset
262
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
263 // Determine which color to draw text with
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
264 QColor getTextPen() const;
667
31540c1f22ea - Merge commit '5c835eb' into HEAD
Santeri Piippo <crimsondusk64@gmail.com>
parents: 666 619
diff changeset
265 =======
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
266 // Convert a 3D point to a 2D point
604
01bdac75994a - some cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 603
diff changeset
267 QPoint coordconv3_2 (const Vertex& pos3d) const;
667
31540c1f22ea - Merge commit '5c835eb' into HEAD
Santeri Piippo <crimsondusk64@gmail.com>
parents: 666 619
diff changeset
268 >>>>>>> 5c835eb
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
269
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
270 // Perform object selection
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
271 void pick (int mouseX, int mouseY);
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
272
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
273 // Set the color to an object list
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
274 void setObjectColor (LDObject* obj, const ListType list);
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
275
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
276 LDGLData& currentDocumentData() const
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
277 {
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
278 return *getFile()->getGLData();
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
279 }
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
280
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
281 // Get a rotation value
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
282 inline double& rot (Axis ax)
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
283 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
284 return
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
285 (ax == X) ? currentDocumentData().rotX :
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
286 (ax == Y) ? currentDocumentData().rotY :
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
287 currentDocumentData().rotZ;
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
288 }
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
289
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
290 // Get a panning value
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
291 inline double& pan (Axis ax)
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
292 {
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
293 return (ax == X) ? currentDocumentData().panX[camera()] :
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
294 currentDocumentData().panY[camera()];
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
295 }
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
296
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
297 // Same except const (can be used in const methods)
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
298 inline const double& pan (Axis ax) const
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
299 {
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
300 return (ax == X) ? currentDocumentData().panX[camera()] :
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
301 currentDocumentData().panY[camera()];
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
302 }
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
303
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
304 // Get the zoom value
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
305 inline double& zoom()
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
306 {
619
8bfe34c6ab1a - GL-variables that should be document-specific are now properly document-specific (i.e. pan and zoom won't be shared across documents anymore)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 606
diff changeset
307 return currentDocumentData().zoom[camera()];
534
3ed2ebcbc84f Made rotation/pan/zoom values camera-dependant (so now there's 7 sets of them instead of 1)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 516
diff changeset
308 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
309
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
310 private slots:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
311 void slot_toolTipTimer();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
313
317
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
314 // Alias for short namespaces
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
315 typedef GLRenderer GL;
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 316
diff changeset
316
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 492
diff changeset
317 static const GLRenderer::ListType g_glListTypes[] =
603
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
318 {
47e7773c7841 - reformatting
Santeri Piippo <crimsondusk64@gmail.com>
parents: 600
diff changeset
319 GL::NormalList,
185
6fea53f1ffc2 Speed up picking - no need to rebuild the object list as its contents do not change while picking. Fixed transparent stuff always being opaque (although it still appears messed up for some reason)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
320 GL::PickList,
191
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 185
diff changeset
321 GL::BFCFrontList,
9bb6a17305ad Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 185
diff changeset
322 GL::BFCBackList,
185
6fea53f1ffc2 Speed up picking - no need to rebuild the object list as its contents do not change while picking. Fixed transparent stuff always being opaque (although it still appears messed up for some reason)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
323 };
6fea53f1ffc2 Speed up picking - no need to rebuild the object list as its contents do not change while picking. Fixed transparent stuff always being opaque (although it still appears messed up for some reason)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
324
550
d97594e3fc54 more stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 541
diff changeset
325 extern const GL::EFixedCamera g_Cameras[7];
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 197
diff changeset
326 extern const char* g_CameraNames[7];
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 197
diff changeset
327
538
2f85d4d286e5 - ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents: 534
diff changeset
328 #endif // LDFORGE_GLDRAW_H

mercurial