699 |
699 |
700 const short numverts = (obj->getType () != LDObject::CondLine) ? obj->vertices () : 2; |
700 const short numverts = (obj->getType () != LDObject::CondLine) ? obj->vertices () : 2; |
701 |
701 |
702 if (g_glInvert == false) |
702 if (g_glInvert == false) |
703 for (short i = 0; i < numverts; ++i) |
703 for (short i = 0; i < numverts; ++i) |
704 compileVertex (obj->coords[i]); |
704 compileVertex (obj->m_coords[i]); |
705 else |
705 else |
706 for (short i = numverts - 1; i >= 0; --i) |
706 for (short i = numverts - 1; i >= 0; --i) |
707 compileVertex (obj->coords[i]); |
707 compileVertex (obj->m_coords[i]); |
708 |
708 |
709 glEnd (); |
709 glEnd (); |
710 } |
710 } |
711 |
711 |
712 // ============================================================================= |
712 // ============================================================================= |
1237 if (m_rectdraw) { |
1237 if (m_rectdraw) { |
1238 LDQuad* quad = new LDQuad; |
1238 LDQuad* quad = new LDQuad; |
1239 |
1239 |
1240 // Copy the vertices from m_rectverts |
1240 // Copy the vertices from m_rectverts |
1241 updateRectVerts (); |
1241 updateRectVerts (); |
1242 memcpy (quad->coords, m_rectverts, sizeof quad->coords); |
1242 |
|
1243 for (int i = 0; i < quad->vertices (); ++i) |
|
1244 quad->setVertex (i, m_rectverts[i]); |
1243 |
1245 |
1244 quad->setColor (maincolor); |
1246 quad->setColor (maincolor); |
1245 obj = quad; |
1247 obj = quad; |
1246 } else { |
1248 } else { |
1247 switch (verts.size ()) { |
1249 switch (verts.size ()) { |
1252 obj->setColor (maincolor); |
1254 obj->setColor (maincolor); |
1253 break; |
1255 break; |
1254 |
1256 |
1255 case 2: |
1257 case 2: |
1256 // 2 verts - make a line |
1258 // 2 verts - make a line |
1257 obj = new LDLine; |
1259 obj = new LDLine (verts[0], verts[1]); |
1258 obj->setColor (edgecolor); |
1260 obj->setColor (edgecolor); |
1259 for (ushort i = 0; i < 2; ++i) |
|
1260 obj->coords[i] = verts[i]; |
|
1261 break; |
1261 break; |
1262 |
1262 |
1263 case 3: |
1263 case 3: |
1264 case 4: |
1264 case 4: |
1265 obj = (verts.size () == 3) ? |
1265 obj = (verts.size () == 3) ? |
1266 static_cast<LDObject*> (new LDTriangle) : |
1266 static_cast<LDObject*> (new LDTriangle) : |
1267 static_cast<LDObject*> (new LDQuad); |
1267 static_cast<LDObject*> (new LDQuad); |
1268 |
1268 |
1269 obj->setColor (maincolor); |
1269 obj->setColor (maincolor); |
1270 for (ushort i = 0; i < obj->vertices (); ++i) |
1270 for (ushort i = 0; i < obj->vertices (); ++i) |
1271 obj->coords[i] = verts[i]; |
1271 obj->setVertex (i, verts[i]); |
1272 break; |
1272 break; |
1273 } |
1273 } |
1274 } |
1274 } |
1275 |
1275 |
1276 if (obj) { |
1276 if (obj) { |
1288 static vector<vertex> getVertices (LDObject* obj) { |
1288 static vector<vertex> getVertices (LDObject* obj) { |
1289 vector<vertex> verts; |
1289 vector<vertex> verts; |
1290 |
1290 |
1291 if (obj->vertices () >= 2) |
1291 if (obj->vertices () >= 2) |
1292 for (int i = 0; i < obj->vertices (); ++i) |
1292 for (int i = 0; i < obj->vertices (); ++i) |
1293 verts << obj->coords[i]; |
1293 verts << obj->getVertex (i); |
1294 else if (obj->getType () == LDObject::Subfile || obj->getType () == LDObject::Radial) { |
1294 else if (obj->getType () == LDObject::Subfile || obj->getType () == LDObject::Radial) { |
1295 vector<LDObject*> objs; |
1295 vector<LDObject*> objs; |
1296 |
1296 |
1297 if (obj->getType () == LDObject::Subfile) |
1297 if (obj->getType () == LDObject::Subfile) |
1298 objs = static_cast<LDSubfile*> (obj)->inlineContents (true, true); |
1298 objs = static_cast<LDSubfile*> (obj)->inlineContents (true, true); |