src/glCompiler.cpp

changeset 996
9ecc878c7dea
parent 986
525921eae58c
--- a/src/glCompiler.cpp	Sun Sep 06 20:45:51 2015 +0300
+++ b/src/glCompiler.cpp	Tue Sep 22 00:59:21 2015 +0300
@@ -151,7 +151,7 @@
 		}
 		else if (poly.color == EdgeColor)
 		{
-			qcol = Luma (QColor (m_config->backgroundColor())) > 40 ? Qt::black : Qt::white;
+			qcol = luma (QColor (m_config->backgroundColor())) > 40 ? Qt::black : Qt::white;
 		}
 		else
 		{
@@ -308,37 +308,26 @@
 	info.isChanged = true;
 	dropObjectInfo (obj);
 
-	switch (obj->type())
+	if (obj->hasVertices())
+	{
+		LDVertexObject* vo = static_cast<LDVertexObject*> (obj);
+		LDPolygon* poly = vo->getPolygon();
+		poly->id = obj->id();
+		compilePolygon (*poly, obj, &info);
+		delete poly;
+	}
+	else if (obj->type() == OBJ_Subfile)
 	{
 		// Note: We cannot split quads into triangles here, it would mess up the
 		// wireframe view. Quads must go into separate vbos.
-		case OBJ_Triangle:
-		case OBJ_Quad:
-		case OBJ_Line:
-		case OBJ_CondLine:
-		{
-			LDPolygon* poly = obj->getPolygon();
-			poly->id = obj->id();
-			compilePolygon (*poly, obj, &info);
-			delete poly;
-			break;
-		}
+		LDSubfile* ref = static_cast<LDSubfile*> (obj);
+		QList<LDPolygon> polygons = ref->inlinePolygons();
 
-		case OBJ_Subfile:
+		for (LDPolygon& polygon : polygons)
 		{
-			LDSubfile* ref = static_cast<LDSubfile*> (obj);
-			auto data = ref->inlinePolygons();
-
-			for (LDPolygon& poly : data)
-			{
-				poly.id = obj->id();
-				compilePolygon (poly, obj, &info);
-			}
-			break;
+			polygon.id = obj->id();
+			compilePolygon (polygon, obj, &info);
 		}
-
-		default:
-			break;
 	}
 
 	m_objectInfo[obj] = info;

mercurial