1103 g_win->updateEditModeActions(); |
1103 g_win->updateEditModeActions(); |
1104 } |
1104 } |
1105 |
1105 |
1106 // ============================================================================= |
1106 // ============================================================================= |
1107 // ----------------------------------------------------------------------------- |
1107 // ----------------------------------------------------------------------------- |
1108 void GLRenderer::pick (uint mouseX, uint mouseY) |
1108 void GLRenderer::pick (int mouseX, int mouseY) |
1109 { GLint viewport[4]; |
1109 { GLint viewport[4]; |
1110 makeCurrent(); |
1110 makeCurrent(); |
1111 |
1111 |
1112 // Use particularly thick lines while picking ease up selecting lines. |
1112 // Use particularly thick lines while picking ease up selecting lines. |
1113 glLineWidth (max<double> (gl_linethickness, 6.5f)); |
1113 glLineWidth (max<double> (gl_linethickness, 6.5f)); |
1192 // If this is an additive single pick and the object is currently selected, |
1192 // If this is an additive single pick and the object is currently selected, |
1193 // we remove it from selection instead. |
1193 // we remove it from selection instead. |
1194 if (!m_rangepick && m_addpick) |
1194 if (!m_rangepick && m_addpick) |
1195 { bool removed = false; |
1195 { bool removed = false; |
1196 |
1196 |
1197 for (ulong i = 0; i < g_win->sel().size(); ++i) |
1197 for (int i = 0; i < g_win->sel().size(); ++i) |
1198 { if (g_win->sel() [i] == obj) |
1198 { if (g_win->sel() [i] == obj) |
1199 { g_win->sel().erase (i); |
1199 { g_win->sel().erase (i); |
1200 obj->setSelected (false); |
1200 obj->setSelected (false); |
1201 removed = true; |
1201 removed = true; |
1202 removedObj = obj; |
1202 removedObj = obj; |
1339 static_cast<LDObject*> (new LDTriangle) : |
1339 static_cast<LDObject*> (new LDTriangle) : |
1340 static_cast<LDObject*> (new LDQuad); |
1340 static_cast<LDObject*> (new LDQuad); |
1341 |
1341 |
1342 obj->setColor (maincolor); |
1342 obj->setColor (maincolor); |
1343 |
1343 |
1344 for (ushort i = 0; i < obj->vertices(); ++i) |
1344 for (int i = 0; i < obj->vertices(); ++i) |
1345 obj->setVertex (i, verts[i]); |
1345 obj->setVertex (i, verts[i]); |
1346 |
1346 |
1347 break; |
1347 break; |
1348 } |
1348 } |
1349 } |
1349 } |
1457 obj->m_glinit = true; |
1457 obj->m_glinit = true; |
1458 } |
1458 } |
1459 |
1459 |
1460 // ============================================================================= |
1460 // ============================================================================= |
1461 // ----------------------------------------------------------------------------- |
1461 // ----------------------------------------------------------------------------- |
1462 uchar* GLRenderer::screencap (ushort& w, ushort& h) |
1462 uchar* GLRenderer::screencap (int& w, int& h) |
1463 { w = m_width; |
1463 { w = m_width; |
1464 h = m_height; |
1464 h = m_height; |
1465 uchar* cap = new uchar[4 * w * h]; |
1465 uchar* cap = new uchar[4 * w * h]; |
1466 |
1466 |
1467 m_screencap = true; |
1467 m_screencap = true; |
1648 glReadPixels (0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, cap); |
1648 glReadPixels (0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, cap); |
1649 uint32* imgdata = reinterpret_cast<uint32*> (cap); |
1649 uint32* imgdata = reinterpret_cast<uint32*> (cap); |
1650 bool filled = false; |
1650 bool filled = false; |
1651 |
1651 |
1652 // Check the top and bottom rows |
1652 // Check the top and bottom rows |
1653 for (ushort i = 0; i < w && !filled; ++i) |
1653 for (int i = 0; i < w && !filled; ++i) |
1654 if (imgdata[i] != white || imgdata[ ( (h - 1) * w) + i] != white) |
1654 if (imgdata[i] != white || imgdata[ ( (h - 1) * w) + i] != white) |
1655 filled = true; |
1655 filled = true; |
1656 |
1656 |
1657 // Left and right edges |
1657 // Left and right edges |
1658 for (ushort i = 0; i < h && !filled; ++i) |
1658 for (int i = 0; i < h && !filled; ++i) |
1659 if (imgdata[i * w] != white || imgdata[ (i * w) + (w - 1)] != white) |
1659 if (imgdata[i * w] != white || imgdata[ (i * w) + (w - 1)] != white) |
1660 filled = true; |
1660 filled = true; |
1661 |
1661 |
1662 if (firstrun) |
1662 if (firstrun) |
1663 { // If this is the first run, we don't know enough to determine |
1663 { // If this is the first run, we don't know enough to determine |
1811 // this into the header, which is everything up to the first scemantic |
1811 // this into the header, which is everything up to the first scemantic |
1812 // object. If we find another overlay object, place this object after |
1812 // object. If we find another overlay object, place this object after |
1813 // the last one found. Otherwise, place it before the first schemantic |
1813 // the last one found. Otherwise, place it before the first schemantic |
1814 // object and put an empty object after it (though don't do this if |
1814 // object and put an empty object after it (though don't do this if |
1815 // there was no schemantic elements at all) |
1815 // there was no schemantic elements at all) |
1816 ulong i, lastOverlay = -1u; |
1816 int i, lastOverlay = -1; |
1817 bool found = false; |
1817 bool found = false; |
1818 |
1818 |
1819 for (i = 0; i < file()->numObjs(); ++i) |
1819 for (i = 0; i < file()->numObjs(); ++i) |
1820 { LDObject* obj = file()->obj (i); |
1820 { LDObject* obj = file()->obj (i); |
1821 |
1821 |