src/glRenderer.cc

changeset 795
195fa1fff9c3
parent 790
fe1b83f6ba82
child 815
efe34366e56a
equal deleted inserted replaced
794:c254ddc6618b 795:195fa1fff9c3
1450 updateRectVerts(); 1450 updateRectVerts();
1451 1451
1452 for (int i = 0; i < quad->numVertices(); ++i) 1452 for (int i = 0; i < quad->numVertices(); ++i)
1453 quad->setVertex (i, m_rectverts[i]); 1453 quad->setVertex (i, m_rectverts[i]);
1454 1454
1455 quad->setColor (maincolor); 1455 quad->setColor (maincolor());
1456 objs << quad; 1456 objs << quad;
1457 } 1457 }
1458 else 1458 else
1459 { 1459 {
1460 switch (verts.size()) 1460 switch (verts.size())
1462 case 1: 1462 case 1:
1463 { 1463 {
1464 // 1 vertex - add a vertex object 1464 // 1 vertex - add a vertex object
1465 LDVertexPtr obj = spawn<LDVertex>(); 1465 LDVertexPtr obj = spawn<LDVertex>();
1466 obj->pos = verts[0]; 1466 obj->pos = verts[0];
1467 obj->setColor (maincolor); 1467 obj->setColor (maincolor());
1468 objs << obj; 1468 objs << obj;
1469 } break; 1469 } break;
1470 1470
1471 case 2: 1471 case 2:
1472 { 1472 {
1473 // 2 verts - make a line 1473 // 2 verts - make a line
1474 LDLinePtr obj = spawn<LDLine> (verts[0], verts[1]); 1474 LDLinePtr obj = spawn<LDLine> (verts[0], verts[1]);
1475 obj->setColor (edgecolor); 1475 obj->setColor (edgecolor());
1476 objs << obj; 1476 objs << obj;
1477 } break; 1477 } break;
1478 1478
1479 case 3: 1479 case 3:
1480 case 4: 1480 case 4:
1481 { 1481 {
1482 LDObjectPtr obj = (verts.size() == 3) ? 1482 LDObjectPtr obj = (verts.size() == 3) ?
1483 static_cast<LDObjectPtr> (spawn<LDTriangle>()) : 1483 static_cast<LDObjectPtr> (spawn<LDTriangle>()) :
1484 static_cast<LDObjectPtr> (spawn<LDQuad>()); 1484 static_cast<LDObjectPtr> (spawn<LDQuad>());
1485 1485
1486 obj->setColor (maincolor); 1486 obj->setColor (maincolor());
1487 1487
1488 for (int i = 0; i < obj->numVertices(); ++i) 1488 for (int i = 0; i < obj->numVertices(); ++i)
1489 obj->setVertex (i, verts[i]); 1489 obj->setVertex (i, verts[i]);
1490 1490
1491 objs << obj; 1491 objs << obj;
1535 1535
1536 LDSubfilePtr ref = spawn<LDSubfile>(); 1536 LDSubfilePtr ref = spawn<LDSubfile>();
1537 ref->setFileInfo (refFile); 1537 ref->setFileInfo (refFile);
1538 ref->setTransform (getCircleDrawMatrix (cmp.scale)); 1538 ref->setTransform (getCircleDrawMatrix (cmp.scale));
1539 ref->setPosition (m_drawedVerts[0]); 1539 ref->setPosition (m_drawedVerts[0]);
1540 ref->setColor (maincolor); 1540 ref->setColor (maincolor());
1541 objs << ref; 1541 objs << ref;
1542 } 1542 }
1543 } 1543 }
1544 else 1544 else
1545 { 1545 {
1572 v2.setCoordinate (relY, v2[relY] + c1[i].y2()); 1572 v2.setCoordinate (relY, v2[relY] + c1[i].y2());
1573 v3.setCoordinate (relX, v3[relX] + c1[i].x1()); 1573 v3.setCoordinate (relX, v3[relX] + c1[i].x1());
1574 v3.setCoordinate (relY, v3[relY] + c1[i].y1()); 1574 v3.setCoordinate (relY, v3[relY] + c1[i].y1());
1575 1575
1576 LDQuadPtr quad (spawn<LDQuad> (v0, v1, v2, v3)); 1576 LDQuadPtr quad (spawn<LDQuad> (v0, v1, v2, v3));
1577 quad->setColor (maincolor); 1577 quad->setColor (maincolor());
1578 1578
1579 // Ensure the quads always are BFC-front towards the camera 1579 // Ensure the quads always are BFC-front towards the camera
1580 if (camera() % 3 <= 0) 1580 if (camera() % 3 <= 0)
1581 quad->invert(); 1581 quad->invert();
1582 1582
1588 { 1588 {
1589 LDSubfilePtr ref = spawn<LDSubfile>(); 1589 LDSubfilePtr ref = spawn<LDSubfile>();
1590 ref->setFileInfo (refFile); 1590 ref->setFileInfo (refFile);
1591 ref->setTransform (transform); 1591 ref->setTransform (transform);
1592 ref->setPosition (m_drawedVerts[0]); 1592 ref->setPosition (m_drawedVerts[0]);
1593 ref->setColor (maincolor); 1593 ref->setColor (maincolor());
1594 objs << ref; 1594 objs << ref;
1595 } 1595 }
1596 } break; 1596 } break;
1597 1597
1598 case ESelectMode: 1598 case ESelectMode:
2187 { 2187 {
2188 if (g_win != null && ev->source() == g_win->getPrimitivesTree()) 2188 if (g_win != null && ev->source() == g_win->getPrimitivesTree())
2189 { 2189 {
2190 QString primName = static_cast<SubfileListItem*> (g_win->getPrimitivesTree()->currentItem())->primitive()->name; 2190 QString primName = static_cast<SubfileListItem*> (g_win->getPrimitivesTree()->currentItem())->primitive()->name;
2191 LDSubfilePtr ref = spawn<LDSubfile>(); 2191 LDSubfilePtr ref = spawn<LDSubfile>();
2192 ref->setColor (maincolor); 2192 ref->setColor (maincolor());
2193 ref->setFileInfo (getDocument (primName)); 2193 ref->setFileInfo (getDocument (primName));
2194 ref->setPosition (g_origin); 2194 ref->setPosition (g_origin);
2195 ref->setTransform (g_identity); 2195 ref->setTransform (g_identity);
2196 LDDocument::current()->insertObj (g_win->getInsertionPoint(), ref); 2196 LDDocument::current()->insertObj (g_win->getInsertionPoint(), ref);
2197 ref->select(); 2197 ref->select();

mercurial