src/gldraw.h

changeset 207
e8c47e51e03d
parent 198
f246725199dc
child 208
0bb57b81c92a
equal deleted inserted replaced
206:c069e7b5f5f3 207:e8c47e51e03d
40 // ============================================================================= 40 // =============================================================================
41 class GLRenderer : public QGLWidget { 41 class GLRenderer : public QGLWidget {
42 Q_OBJECT 42 Q_OBJECT
43 43
44 public: 44 public:
45 enum Camera { 45 enum Camera { Top, Front, Left, Bottom, Back, Right, Free };
46 Top, 46 enum EditMode { Select, Draw };
47 Front,
48 Left,
49 Bottom,
50 Back,
51 Right,
52 Free
53 };
54
55 enum ListType { NormalList, PickList, BFCFrontList, BFCBackList }; 47 enum ListType { NormalList, PickList, BFCFrontList, BFCBackList };
56 48
57 GLRenderer (QWidget* parent = null); 49 GLRenderer (QWidget* parent = null);
58 ~GLRenderer (); 50 ~GLRenderer ();
59 51
61 Camera camera () const { return m_camera; } 53 Camera camera () const { return m_camera; }
62 Axis cameraAxis (bool y); 54 Axis cameraAxis (bool y);
63 void clearOverlay (); 55 void clearOverlay ();
64 void compileObject (LDObject* obj); 56 void compileObject (LDObject* obj);
65 void compileAllObjects (); 57 void compileAllObjects ();
66 void endPlaneDraw (bool accept); 58 EditMode editMode () const { return m_editmode; }
59 void endDraw (bool accept);
67 QColor getMainColor (); 60 QColor getMainColor ();
68 void hardRefresh (); 61 void hardRefresh ();
69 bool picking () const { return m_picking; } 62 bool picking () const { return m_picking; }
70 void refresh (); 63 void refresh ();
71 void resetAngles (); 64 void resetAngles ();
72 uchar* screencap (ushort& w, ushort& h); 65 uchar* screencap (ushort& w, ushort& h);
73 void setBackground (); 66 void setBackground ();
74 void setCamera (const GLRenderer::Camera cam); 67 void setCamera (const Camera cam);
68 void setEditMode (const EditMode mode);
75 void setupOverlay (); 69 void setupOverlay ();
76 void setZoom (const double zoom) { m_zoom = zoom; } 70 void setZoom (const double zoom) { m_zoom = zoom; }
77 double zoom () const { return m_zoom; } 71 double zoom () const { return m_zoom; }
78 72
79 static void deleteLists (LDObject* obj); 73 static void deleteLists (LDObject* obj);
96 Qt::MouseButtons m_lastButtons; 90 Qt::MouseButtons m_lastButtons;
97 Qt::KeyboardModifiers m_keymods; 91 Qt::KeyboardModifiers m_keymods;
98 ulong m_totalmove; 92 ulong m_totalmove;
99 vertex m_hoverpos; 93 vertex m_hoverpos;
100 double m_virtWidth, m_virtHeight, m_rotX, m_rotY, m_rotZ, m_panX, m_panY, m_zoom; 94 double m_virtWidth, m_virtHeight, m_rotX, m_rotY, m_rotZ, m_panX, m_panY, m_zoom;
101 bool m_darkbg, m_picking, m_rangepick, m_addpick, m_drawToolTip, m_screencap, m_planeDraw; 95 bool m_darkbg, m_picking, m_rangepick, m_addpick, m_drawToolTip, m_screencap;
102 QPoint m_pos, m_rangeStart; 96 QPoint m_pos, m_rangeStart;
103 QPen m_thinBorderPen, m_thickBorderPen; 97 QPen m_thinBorderPen, m_thickBorderPen;
104 Camera m_camera, m_toolTipCamera; 98 Camera m_camera, m_toolTipCamera;
105 uint m_axeslist; 99 uint m_axeslist;
106 ushort m_width, m_height; 100 ushort m_width, m_height;
107 std::vector<vertex> m_planeDrawVerts; 101 std::vector<vertex> m_drawedVerts;
102 EditMode m_editmode;
108 103
109 void calcCameraIcons (); // Compute geometry for camera icons 104 void calcCameraIcons (); // Compute geometry for camera icons
110 void clampAngle (double& angle) const; // Clamps an angle to [0, 360] 105 void clampAngle (double& angle) const; // Clamps an angle to [0, 360]
111 void compileList (LDObject* obj, const ListType list); // Compile one of the lists of an object 106 void compileList (LDObject* obj, const ListType list); // Compile one of the lists of an object
112 void compileSubObject (LDObject* obj, const GLenum gltype); // Sub-routine for object compiling 107 void compileSubObject (LDObject* obj, const GLenum gltype); // Sub-routine for object compiling

mercurial