48 enum ListType { NormalList, PickList, BFCFrontList, BFCBackList }; |
48 enum ListType { NormalList, PickList, BFCFrontList, BFCBackList }; |
49 |
49 |
50 GLRenderer (QWidget* parent = null); |
50 GLRenderer (QWidget* parent = null); |
51 ~GLRenderer (); |
51 ~GLRenderer (); |
52 |
52 |
53 void beginPlaneDraw (); |
53 void beginPlaneDraw (); |
54 Camera camera () const { return m_camera; } |
54 Camera camera () const { return m_camera; } |
55 void compileObject (LDObject* obj); |
55 void compileObject (LDObject* obj); |
56 void compileAllObjects (); |
56 void compileAllObjects (); |
57 void endPlaneDraw (bool accept); |
57 void endPlaneDraw (bool accept); |
58 QColor getMainColor (); |
58 QColor getMainColor (); |
59 void hardRefresh (); |
59 void hardRefresh (); |
60 bool picking () const { return m_picking; } |
60 bool picking () const { return m_picking; } |
61 void refresh (); |
61 void refresh (); |
62 void resetAngles (); |
62 void resetAngles (); |
63 uchar* screencap (ushort& w, ushort& h); |
63 uchar* screencap (ushort& w, ushort& h); |
64 void setBackground (); |
64 void setBackground (); |
65 void setCamera (const GLRenderer::Camera cam); |
65 void setCamera (const GLRenderer::Camera cam); |
66 void setZoom (const double zoom) { m_zoom = zoom; } |
66 void setZoom (const double zoom) { m_zoom = zoom; } |
67 void setWireframe (const bool set); |
67 void setWireframe (const bool set); |
68 bool wireframe () const; |
68 bool wireframe () const; |
69 double zoom () const { return m_zoom; } |
69 double zoom () const { return m_zoom; } |
|
70 |
|
71 static void deleteLists (LDObject* obj); |
70 |
72 |
71 protected: |
73 protected: |
72 void contextMenuEvent (QContextMenuEvent* ev); |
74 void contextMenuEvent (QContextMenuEvent* ev); |
73 void initializeGL (); |
75 void initializeGL (); |
74 void keyPressEvent (QKeyEvent* ev); |
76 void keyPressEvent (QKeyEvent* ev); |
94 Camera m_camera, m_toolTipCamera; |
96 Camera m_camera, m_toolTipCamera; |
95 uint m_axeslist; |
97 uint m_axeslist; |
96 ushort m_width, m_height; |
98 ushort m_width, m_height; |
97 std::vector<vertex> m_planeDrawVerts; |
99 std::vector<vertex> m_planeDrawVerts; |
98 |
100 |
99 void calcCameraIcons (); |
101 void calcCameraIcons (); // Compute geometry for camera icons |
100 void clampAngle (double& angle); |
102 void clampAngle (double& angle) const; // Clamps an angle to [0, 360] |
101 void compileList (LDObject* obj, const ListType list); |
103 void compileList (LDObject* obj, const ListType list); // Compile one of the lists of an object |
102 void compileSubObject (LDObject* obj, const GLenum gltype); |
104 void compileSubObject (LDObject* obj, const GLenum gltype); // Sub-routine for object compiling |
103 void compileVertex (const vertex& vrt); |
105 void compileVertex (const vertex& vrt); // Compile a single vertex to a list |
104 vertex coord_2to3 (const QPoint& pos2d, const bool snap) const; |
106 vertex coordconv2_3 (const QPoint& pos2d, bool snap) const; // Convert a 2D point to a 3D point |
105 QPoint coord_3to2 (const vertex& pos3d) const; |
107 QPoint coordconv3_2 (const vertex& pos3d) const; // Convert a 3D point to a 2D point |
106 void drawGLScene () const; |
108 void drawGLScene () const; // Paint the GL scene |
107 void pick (uint mouseX, uint mouseY); |
109 void pick (uint mouseX, uint mouseY); // Perform object selection |
108 void setObjectColor (LDObject* obj, const ListType list); |
110 void setObjectColor (LDObject* obj, const ListType list); // Set the color to an object list |
109 |
111 |
110 private slots: |
112 private slots: |
111 void slot_toolTipTimer (); |
113 void slot_toolTipTimer (); |
112 }; |
114 }; |
113 |
115 |