94 { QColor (80, 192, 0), vertex (0, 10000, 0) }, |
94 { QColor (80, 192, 0), vertex (0, 10000, 0) }, |
95 { QColor (0, 160, 192), vertex (0, 0, 10000) }, |
95 { QColor (0, 160, 192), vertex (0, 0, 10000) }, |
96 }; |
96 }; |
97 |
97 |
98 static bool g_glInvert = false; |
98 static bool g_glInvert = false; |
99 static List<short> g_warnedColors; |
99 static QList<short> g_warnedColors; |
100 |
100 |
101 // ============================================================================= |
101 // ============================================================================= |
102 // ----------------------------------------------------------------------------- |
102 // ----------------------------------------------------------------------------- |
103 GLRenderer::GLRenderer (QWidget* parent) : QGLWidget (parent) |
103 GLRenderer::GLRenderer (QWidget* parent) : QGLWidget (parent) |
104 { m_picking = m_rangepick = false; |
104 { m_picking = m_rangepick = false; |
843 compileSubObject (obj, GL_QUADS); |
843 compileSubObject (obj, GL_QUADS); |
844 break; |
844 break; |
845 |
845 |
846 case LDObject::Subfile: |
846 case LDObject::Subfile: |
847 { LDSubfile* ref = static_cast<LDSubfile*> (obj); |
847 { LDSubfile* ref = static_cast<LDSubfile*> (obj); |
848 List<LDObject*> objs; |
848 QList<LDObject*> objs; |
849 |
849 |
850 objs = ref->inlineContents ( |
850 objs = ref->inlineContents ( |
851 LDSubfile::DeepInline | |
851 LDSubfile::DeepInline | |
852 LDSubfile::CacheInline | |
852 LDSubfile::CacheInline | |
853 LDSubfile::RendererInline); |
853 LDSubfile::RendererInline); |
1140 // Use particularly thick lines while picking ease up selecting lines. |
1140 // Use particularly thick lines while picking ease up selecting lines. |
1141 glLineWidth (max<double> (gl_linethickness, 6.5f)); |
1141 glLineWidth (max<double> (gl_linethickness, 6.5f)); |
1142 |
1142 |
1143 // Clear the selection if we do not wish to add to it. |
1143 // Clear the selection if we do not wish to add to it. |
1144 if (!m_addpick) |
1144 if (!m_addpick) |
1145 { List<LDObject*> oldsel = g_win->sel(); |
1145 { QList<LDObject*> oldsel = g_win->sel(); |
1146 g_win->sel().clear(); |
1146 g_win->sel().clear(); |
1147 |
1147 |
1148 for (LDObject* obj : oldsel) |
1148 for (LDObject* obj : oldsel) |
1149 { obj->setSelected (false); |
1149 { obj->setSelected (false); |
1150 compileObject (obj); |
1150 compileObject (obj); |
1336 // ----------------------------------------------------------------------------- |
1336 // ----------------------------------------------------------------------------- |
1337 void GLRenderer::endDraw (bool accept) |
1337 void GLRenderer::endDraw (bool accept) |
1338 { (void) accept; |
1338 { (void) accept; |
1339 |
1339 |
1340 // Clean the selection and create the object |
1340 // Clean the selection and create the object |
1341 List<vertex>& verts = m_drawedVerts; |
1341 QList<vertex>& verts = m_drawedVerts; |
1342 List<LDObject*> objs; |
1342 QList<LDObject*> objs; |
1343 |
1343 |
1344 switch (editMode()) |
1344 switch (editMode()) |
1345 { case Draw: |
1345 { case Draw: |
1346 { if (m_rectdraw) |
1346 { if (m_rectdraw) |
1347 { LDQuad* quad = new LDQuad; |
1347 { LDQuad* quad = new LDQuad; |
1425 objs << ref; |
1425 objs << ref; |
1426 } |
1426 } |
1427 } |
1427 } |
1428 else |
1428 else |
1429 { // Last resort: draw the ring with quads |
1429 { // Last resort: draw the ring with quads |
1430 List<QLineF> c0, c1; |
1430 QList<QLineF> c0, c1; |
1431 |
1431 |
1432 makeCircle (segs, divs, dist0, c0); |
1432 makeCircle (segs, divs, dist0, c0); |
1433 makeCircle (segs, divs, dist1, c1); |
1433 makeCircle (segs, divs, dist1, c1); |
1434 |
1434 |
1435 for (int i = 0; i < 16; ++i) |
1435 for (int i = 0; i < 16; ++i) |
1490 relY = cam->axisY; |
1490 relY = cam->axisY; |
1491 } |
1491 } |
1492 |
1492 |
1493 // ============================================================================= |
1493 // ============================================================================= |
1494 // ----------------------------------------------------------------------------- |
1494 // ----------------------------------------------------------------------------- |
1495 static List<vertex> getVertices (LDObject* obj) |
1495 static QList<vertex> getVertices (LDObject* obj) |
1496 { List<vertex> verts; |
1496 { QList<vertex> verts; |
1497 |
1497 |
1498 if (obj->vertices() >= 2) |
1498 if (obj->vertices() >= 2) |
1499 { for (int i = 0; i < obj->vertices(); ++i) |
1499 { for (int i = 0; i < obj->vertices(); ++i) |
1500 verts << obj->getVertex (i); |
1500 verts << obj->getVertex (i); |
1501 } elif (obj->getType() == LDObject::Subfile) |
1501 } elif (obj->getType() == LDObject::Subfile) |
1502 |
1502 |
1503 { LDSubfile* ref = static_cast<LDSubfile*> (obj); |
1503 { LDSubfile* ref = static_cast<LDSubfile*> (obj); |
1504 List<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline); |
1504 QList<LDObject*> objs = ref->inlineContents (LDSubfile::DeepCacheInline); |
1505 |
1505 |
1506 for (LDObject * obj : objs) |
1506 for (LDObject * obj : objs) |
1507 { verts << getVertices (obj); |
1507 { verts << getVertices (obj); |
1508 delete obj; |
1508 delete obj; |
1509 } |
1509 } |