src/gl/compiler.cpp

changeset 205
1a4342d80de7
parent 200
ca23936b455b
child 210
232e7634cc8a
--- a/src/gl/compiler.cpp	Wed Jun 08 19:33:00 2022 +0300
+++ b/src/gl/compiler.cpp	Wed Jun 08 20:41:21 2022 +0300
@@ -232,15 +232,15 @@
 static QColor getColorForPolygon(
 	const gl::Polygon& polygon,
 	const gl::RenderPreferences& preferences,
-	const ldraw::ColorTable& colorTable)
+	const ColorTable& colorTable)
 {
 	QColor color;
 	// For normal colors, use the polygon's color.
-	if (polygon.color == ldraw::MAIN_COLOR)
+	if (polygon.color == MAIN_COLOR)
 	{
 		color = preferences.mainColor;
 	}
-	else if (polygon.color == ldraw::EDGE_COLOR)
+	else if (polygon.color == EDGE_COLOR)
 	{
 		// Edge color is black, unless we have a dark background, in which case lines need to be bright.
 		color = luma(preferences.backgroundColor) > (40.0 / 256.0) ? Qt::black : Qt::white;
@@ -248,7 +248,7 @@
 	else
 	{
 		// Not main or edge color, use the polygon's color as is.
-		color = colorTable[polygon.color].faceColor;
+		color = colorFace(polygon.color, colorTable).value_or(Qt::black);
 	}
 	return color;
 }
@@ -275,7 +275,7 @@
 void gl::build(
 	gl::ModelShaders* shaders,
 	Model* model,
-	const ldraw::ColorTable& colorTable,
+	const ColorTable& colorTable,
 	DocumentManager* context,
 	const gl::RenderPreferences& preferences)
 {

mercurial