src/gldraw.cpp

changeset 544
a52cfa218780
parent 542
46a33bdc0b36
child 550
d97594e3fc54
equal deleted inserted replaced
543:7029f7938dae 544:a52cfa218780
1431 circleOrDisc = true; 1431 circleOrDisc = true;
1432 } 1432 }
1433 elif (g_RingFinder (dist0, dist1)) 1433 elif (g_RingFinder (dist0, dist1))
1434 { // The ring finder found a solution, use that. Add the component rings to the file. 1434 { // The ring finder found a solution, use that. Add the component rings to the file.
1435 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents()) 1435 for (const RingFinder::Component& cmp : g_RingFinder.bestSolution()->getComponents())
1436 { if ((refFile = ::getFile (radialFileName (::Ring, lores, lores, cmp.num))) == null) 1436 { // Get a ref file for this primitive. If we cannot find it in the
1437 // LDraw library, generate it.
1438 if ((refFile = ::getFile (radialFileName (::Ring, lores, lores, cmp.num))) == null)
1437 { refFile = generatePrimitive (::Ring, lores, lores, cmp.num); 1439 { refFile = generatePrimitive (::Ring, lores, lores, cmp.num);
1438 refFile->setImplicit (false); 1440 refFile->setImplicit (false);
1439 } 1441 }
1440 1442
1441 LDSubfile* ref = new LDSubfile; 1443 LDSubfile* ref = new LDSubfile;
1445 ref->setColor (maincolor); 1447 ref->setColor (maincolor);
1446 objs << ref; 1448 objs << ref;
1447 } 1449 }
1448 } 1450 }
1449 else 1451 else
1450 { // Last resort: draw the ring with quads 1452 { // Ring finder failed, last resort: draw the ring with quads
1451 QList<QLineF> c0, c1; 1453 QList<QLineF> c0, c1;
1452 Axis relX, relY, relZ; 1454 Axis relX, relY, relZ;
1453 getRelativeAxes (relX, relY); 1455 getRelativeAxes (relX, relY);
1454 relZ = (Axis) (3 - relX - relY); 1456 relZ = (Axis) (3 - relX - relY);
1455 double x0 = m_drawedVerts[0][relX], 1457 double x0 = m_drawedVerts[0][relX],
1496 objs << ref; 1498 objs << ref;
1497 } 1499 }
1498 } break; 1500 } break;
1499 1501
1500 case Select: 1502 case Select:
1501 { assert (false); 1503 { // this shouldn't happen
1504 assert (false);
1502 return; 1505 return;
1503 } break; 1506 } break;
1504 } 1507 }
1505 1508
1506 if (objs.size() > 0) 1509 if (objs.size() > 0)

mercurial