Thu, 12 Dec 2013 19:44:09 +0200
- LDFile renamed to LDDocument, file.h -> document.h
- Added the INSTALL document
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 |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 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" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | |
322
5e701c3c3d8e
Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
318
diff
changeset
|
26 | class MessageManager; |
196
47f4f4543152
Allow one of the dimensions be filled via aspect ratio
Santeri Piippo <crimsondusk64@gmail.com>
parents:
195
diff
changeset
|
27 | class QDialogButtonBox; |
479
f179241a72a8
rename RadioBox to RadioGroup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
28 | 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
|
29 | 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
|
30 | 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
|
31 | class QLineEdit; |
553
2418d5955421
- LDFile renamed to LDDocument, file.h -> document.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
550
diff
changeset
|
32 | class LDDocument; |
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 |
550 | 36 | { ESelectMode, |
37 | EDrawMode, | |
38 | 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
|
39 | }; |
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 | // Meta for overlays |
497
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
42 | struct LDGLOverlay |
550 | 43 | { vertex v0, |
44 | v1; | |
45 | int ox, | |
46 | oy; | |
47 | double lw, | |
48 | lh; | |
49 | str fname; | |
50 | 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
|
51 | }; |
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
|
52 | |
497
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
53 | struct LDFixedCameraInfo |
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
54 | { const char glrotate[3]; |
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
55 | const Axis axisX, axisY; |
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
56 | const bool negX, negY; |
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
57 | }; |
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
58 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | // GLRenderer |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
61 | // |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | // 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
|
63 | // 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
|
64 | // g_win->R() |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | // ============================================================================= |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
66 | class GLRenderer : public QGLWidget |
550 | 67 | { typedefs: |
68 | enum EFixedCamera | |
69 | { ETopCamera, | |
70 | EFrontCamera, | |
71 | ELeftCamera, | |
72 | EBottomCamera, | |
73 | EBackCamera, | |
74 | ERightCamera, | |
75 | EFreeCamera | |
76 | }; | |
77 | ||
78 | enum ListType | |
79 | { NormalList, | |
80 | PickList, | |
81 | BFCFrontList, | |
82 | BFCBackList | |
83 | }; | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
84 | |
550 | 85 | // CameraIcon::img is a heap-allocated QPixmap because otherwise it gets |
86 | // initialized before program gets to main() and constructs a QApplication | |
87 | // and Qt doesn't like that. | |
88 | struct CameraIcon | |
89 | { QPixmap* img; | |
90 | QRect srcRect, | |
91 | destRect, | |
92 | selRect; | |
93 | EFixedCamera cam; | |
94 | }; | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
95 | |
550 | 96 | properties: |
97 | Q_OBJECT | |
98 | PROPERTY (public, bool, DrawOnly, BOOL_OPS, STOCK_WRITE) | |
99 | PROPERTY (public, MessageManager*, MessageLog, NO_OPS, STOCK_WRITE) | |
100 | PROPERTY (private, bool, Picking, BOOL_OPS, STOCK_WRITE) | |
553
2418d5955421
- LDFile renamed to LDDocument, file.h -> document.h
Santeri Piippo <crimsondusk64@gmail.com>
parents:
550
diff
changeset
|
101 | PROPERTY (public, LDDocument*, File, NO_OPS, CUSTOM_WRITE) |
550 | 102 | PROPERTY (public, EditMode, EditMode, NO_OPS, CUSTOM_WRITE) |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
103 | |
550 | 104 | public methods: |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
105 | GLRenderer (QWidget* parent = null); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
106 | ~GLRenderer(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
107 | |
550 | 108 | inline EFixedCamera camera() const |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
109 | { return m_camera; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
110 | } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
112 | void clearOverlay(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
113 | void compileObject (LDObject* obj); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
114 | void compileAllObjects(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
115 | void drawGLScene(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
116 | void endDraw (bool accept); |
550 | 117 | 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
|
118 | const char* getCameraName() const; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
119 | double getDepthValue() const; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
120 | QColor getMainColor(); |
497
c51941e590b6
a bit more cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
121 | LDGLOverlay& getOverlay (int newcam); |
538
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
122 | uchar* getScreencap (int& w, int& h); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
123 | void hardRefresh(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
124 | void initGLData(); |
538
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
125 | void initOverlaysFromObjects(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
126 | void refresh(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
127 | 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
|
128 | void resetAllAngles(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
129 | void setBackground(); |
550 | 130 | void setCamera (const EFixedCamera cam); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
131 | void setDepthValue (double depth); |
550 | 132 | bool setupOverlay (EFixedCamera cam, str 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
|
133 | void updateOverlayObjects(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
134 | void zoomNotch (bool inward); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
135 | 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
|
136 | void zoomAllToFit(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
137 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
138 | static void deleteLists (LDObject* obj); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
139 | |
550 | 140 | protected methods: |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
141 | void contextMenuEvent (QContextMenuEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
142 | void initializeGL(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
143 | void keyPressEvent (QKeyEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
144 | void keyReleaseEvent (QKeyEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
145 | void leaveEvent (QEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
146 | void mouseDoubleClickEvent (QMouseEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
147 | void mousePressEvent (QMouseEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
148 | void mouseMoveEvent (QMouseEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
149 | void mouseReleaseEvent (QMouseEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
150 | void paintEvent (QPaintEvent* ev); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
151 | void resizeGL (int w, int h); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
152 | 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
|
153 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
154 | private: |
538
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
155 | CameraIcon m_cameraIcons[7]; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
156 | QTimer* m_toolTipTimer; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
157 | Qt::MouseButtons m_lastButtons; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
158 | Qt::KeyboardModifiers m_keymods; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
159 | vertex m_hoverpos; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
160 | double m_virtWidth, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
161 | m_virtHeight, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
162 | m_rotX[7], |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
163 | m_rotY[7], |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
164 | m_rotZ[7], |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
165 | m_panX[7], |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
166 | m_panY[7], |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
167 | m_zoom[7]; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
168 | bool m_darkbg, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
169 | m_rangepick, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
170 | m_addpick, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
171 | m_drawToolTip, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
172 | m_screencap, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
173 | m_panning; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
174 | QPoint m_pos, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
175 | m_globalpos, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
176 | m_rangeStart; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
177 | QPen m_thickBorderPen, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
178 | m_thinBorderPen; |
550 | 179 | EFixedCamera m_camera, |
538
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
180 | m_toolTipCamera; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
181 | GLuint m_axeslist; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
182 | int m_width, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
183 | m_height, |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
184 | m_totalmove; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
185 | QList<vertex> m_drawedVerts; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
186 | bool m_rectdraw; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
187 | vertex m_rectverts[4]; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
188 | QColor m_bgcolor; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
189 | double m_depthValues[6]; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
190 | LDGLOverlay m_overlays[6]; |
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
191 | QList<vertex> m_knownVerts; |
492
e964085e6913
Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
479
diff
changeset
|
192 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
193 | void addDrawnVertex (vertex m_hoverpos); |
550 | 194 | LDOverlay* findOverlayObject (EFixedCamera cam); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
195 | void updateRectVerts(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
196 | void getRelativeAxes (Axis& relX, Axis& relY) const; |
501
8f314f3f5054
ring finder integrated! it lives!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
499
diff
changeset
|
197 | 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
|
198 | 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
|
199 | |
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
|
200 | // 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
|
201 | void calcCameraIcons(); |
539
72ad83a67165
- upgraded the PROPERTY macro, resulting in a major code refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
538
diff
changeset
|
202 | |
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
|
203 | // 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
|
204 | 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
|
205 | |
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
|
206 | // 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
|
207 | 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
|
208 | |
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
|
209 | // 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
|
210 | 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
|
211 | |
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
|
212 | // 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
|
213 | 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
|
214 | |
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
|
215 | // Compile a single vertex to a 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
|
216 | 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
|
217 | |
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
|
218 | // Convert a 2D point to a 3D point |
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
|
219 | 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
|
220 | |
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
|
221 | // Convert a 3D point to a 2D point |
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
|
222 | QPoint coordconv3_2 (const vertex& pos3d) const; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
223 | |
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
|
224 | // 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
|
225 | QColor getTextPen() const; |
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
|
226 | |
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
|
227 | // 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
|
228 | 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
|
229 | |
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
|
230 | // 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
|
231 | 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
|
232 | |
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
|
233 | // 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
|
234 | inline double& rot (Axis ax) |
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
|
235 | { return |
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 | (ax == X) ? m_rotX[camera()] : |
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
|
237 | (ax == Y) ? m_rotY[camera()] : |
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 | m_rotZ[camera()]; |
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 | } |
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
|
240 | |
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 | // 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
|
242 | inline double& pan (Axis ax) |
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
|
243 | { return (ax == X) ? m_panX[camera()] : m_panY[camera()]; |
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 | } |
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 | |
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
|
246 | // 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
|
247 | inline const double& pan (Axis ax) const |
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 | { return (ax == X) ? m_panX[camera()] : m_panY[camera()]; |
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
|
249 | } |
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 | |
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 | // 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
|
252 | inline double& zoom() |
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 | { return m_zoom[camera()]; |
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
|
254 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
255 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
256 | private slots: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
257 | void slot_toolTipTimer(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
258 | }; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | |
317
e41ab239ed28
Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents:
316
diff
changeset
|
260 | // Alias for short namespaces |
e41ab239ed28
Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents:
316
diff
changeset
|
261 | typedef GLRenderer GL; |
e41ab239ed28
Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents:
316
diff
changeset
|
262 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
263 | static const GLRenderer::ListType g_glListTypes[] = |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
264 | { 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
|
265 | 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
|
266 | 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
|
267 | 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
|
268 | }; |
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
|
269 | |
550 | 270 | extern const GL::EFixedCamera g_Cameras[7]; |
198
f246725199dc
Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
197
diff
changeset
|
271 | extern const char* g_CameraNames[7]; |
f246725199dc
Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
197
diff
changeset
|
272 | |
538
2f85d4d286e5
- ensured header files' guards start with LDFORGE_
Santeri Piippo <crimsondusk64@gmail.com>
parents:
534
diff
changeset
|
273 | #endif // LDFORGE_GLDRAW_H |