src/gldraw.h

changeset 538
2f85d4d286e5
parent 534
3ed2ebcbc84f
child 539
72ad83a67165
equal deleted inserted replaced
537:1add0ee96fb3 538:2f85d4d286e5
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #ifndef GLDRAW_H 19 #ifndef LDFORGE_GLDRAW_H
20 #define GLDRAW_H 20 #define LDFORGE_GLDRAW_H
21 21
22 #include <QGLWidget> 22 #include <QGLWidget>
23 #include "common.h" 23 #include "common.h"
24 #include "ldtypes.h" 24 #include "ldtypes.h"
25 25
78 78
79 inline Camera camera() const 79 inline Camera camera() const
80 { return m_camera; 80 { return m_camera;
81 } 81 }
82 82
83 Axis cameraAxis (bool y, Camera camid = (Camera) - 1);
84 const char* cameraName() const;
85 void clearOverlay(); 83 void clearOverlay();
86 void compileObject (LDObject* obj); 84 void compileObject (LDObject* obj);
87 void compileAllObjects(); 85 void compileAllObjects();
88 double depthValue() const;
89 void drawGLScene(); 86 void drawGLScene();
90 void endDraw (bool accept); 87 void endDraw (bool accept);
88 Axis getCameraAxis (bool y, Camera camid = (Camera) - 1);
89 const char* getCameraName() const;
90 double getDepthValue() const;
91 QColor getMainColor(); 91 QColor getMainColor();
92 LDGLOverlay& getOverlay (int newcam); 92 LDGLOverlay& getOverlay (int newcam);
93 uchar* getScreencap (int& w, int& h);
93 void hardRefresh(); 94 void hardRefresh();
94 void initGLData(); 95 void initGLData();
95 void overlaysFromObjects(); 96 void initOverlaysFromObjects();
96 void refresh(); 97 void refresh();
97 void resetAngles(); 98 void resetAngles();
98 void resetAllAngles(); 99 void resetAllAngles();
99 uchar* screencap (int& w, int& h);
100 void setBackground(); 100 void setBackground();
101 void setCamera (const Camera cam); 101 void setCamera (const Camera cam);
102 void setDepthValue (double depth); 102 void setDepthValue (double depth);
103 bool setupOverlay (GLRenderer::Camera cam, str file, int x, int y, int w, int h); 103 bool setupOverlay (GLRenderer::Camera cam, str file, int x, int y, int w, int h);
104 void updateOverlayObjects(); 104 void updateOverlayObjects();
130 { QPixmap* img; 130 { QPixmap* img;
131 QRect srcRect, destRect, selRect; 131 QRect srcRect, destRect, selRect;
132 Camera cam; 132 Camera cam;
133 }; 133 };
134 134
135 CameraIcon m_cameraIcons[7]; 135 CameraIcon m_cameraIcons[7];
136 QTimer* m_toolTipTimer; 136 QTimer* m_toolTipTimer;
137 Qt::MouseButtons m_lastButtons; 137 Qt::MouseButtons m_lastButtons;
138 Qt::KeyboardModifiers m_keymods; 138 Qt::KeyboardModifiers m_keymods;
139 vertex m_hoverpos; 139 vertex m_hoverpos;
140 double m_virtWidth, 140 double m_virtWidth,
141 m_virtHeight, 141 m_virtHeight,
142 m_rotX[7], 142 m_rotX[7],
143 m_rotY[7], 143 m_rotY[7],
144 m_rotZ[7], 144 m_rotZ[7],
145 m_panX[7], 145 m_panX[7],
146 m_panY[7], 146 m_panY[7],
147 m_zoom[7]; 147 m_zoom[7];
148 bool m_darkbg, 148 bool m_darkbg,
149 m_rangepick, 149 m_rangepick,
150 m_addpick, 150 m_addpick,
151 m_drawToolTip, 151 m_drawToolTip,
152 m_screencap, 152 m_screencap,
153 m_panning; 153 m_panning;
154 QPoint m_pos, 154 QPoint m_pos,
155 m_globalpos, 155 m_globalpos,
156 m_rangeStart; 156 m_rangeStart;
157 QPen m_thickBorderPen, 157 QPen m_thickBorderPen,
158 m_thinBorderPen; 158 m_thinBorderPen;
159 Camera m_camera, 159 Camera m_camera,
160 m_toolTipCamera; 160 m_toolTipCamera;
161 GLuint m_axeslist; 161 GLuint m_axeslist;
162 int m_width, 162 int m_width,
163 m_height, 163 m_height,
164 m_totalmove; 164 m_totalmove;
165 QList<vertex> m_drawedVerts; 165 QList<vertex> m_drawedVerts;
166 bool m_rectdraw; 166 bool m_rectdraw;
167 vertex m_rectverts[4]; 167 vertex m_rectverts[4];
168 QColor m_bgcolor; 168 QColor m_bgcolor;
169 double m_depthValues[6]; 169 double m_depthValues[6];
170 LDGLOverlay m_overlays[6]; 170 LDGLOverlay m_overlays[6];
171 QList<vertex> m_knownVerts; 171 QList<vertex> m_knownVerts;
172 172
173 void addDrawnVertex (vertex m_hoverpos); 173 void addDrawnVertex (vertex m_hoverpos);
174 LDOverlay* findOverlayObject (Camera cam); 174 LDOverlay* findOverlayObject (Camera cam);
175 void updateRectVerts(); 175 void updateRectVerts();
176 void getRelativeAxes (Axis& relX, Axis& relY) const; 176 void getRelativeAxes (Axis& relX, Axis& relY) const;
179 179
180 // Compute geometry for camera icons 180 // Compute geometry for camera icons
181 void calcCameraIcons(); 181 void calcCameraIcons();
182 182
183 // How large is the circle we're drawing right now? 183 // How large is the circle we're drawing right now?
184 double circleDrawDist (int pos) const; 184 double getCircleDrawDist (int pos) const;
185 185
186 // Clamps an angle to [0, 360] 186 // Clamps an angle to [0, 360]
187 void clampAngle (double& angle) const; 187 void clampAngle (double& angle) const;
188 188
189 // Compile one of the lists of an object 189 // Compile one of the lists of an object
248 }; 248 };
249 249
250 extern const GL::Camera g_Cameras[7]; 250 extern const GL::Camera g_Cameras[7];
251 extern const char* g_CameraNames[7]; 251 extern const char* g_CameraNames[7];
252 252
253 #endif // GLDRAW_H 253 #endif // LDFORGE_GLDRAW_H

mercurial