src/polygoncache.cpp

changeset 374
75efc3ba5a56
parent 372
b2914aaeec1a
--- a/src/polygoncache.cpp	Mon Apr 10 14:46:36 2023 +0300
+++ b/src/polygoncache.cpp	Tue Apr 11 11:11:28 2023 +0300
@@ -10,13 +10,13 @@
 }
 
 static PolygonElement transformed(
-	PolygonElement element,
+	PolygonElement coloredElement,
 	const glm::mat4& transform)
 {
 	visitPoints([&transform](glm::vec3& p) {
 		p = transform * glm::vec4{p, 1};
-	}, element);
-	return element;
+	}, coloredElement.element);
+	return coloredElement;
 }
 
 PolygonCache* findPolygonCacheForModel(QTextDocument* model, DocumentManager* context)
@@ -59,13 +59,13 @@
 	Fn2&& reserve)
 {
 	const bool needInverting = 0
-		^ (glm::determinant(ref.transformation) < 0)
+		^ (glm::determinant(ref.element.transformation) < 0)
 		^ (context->invertnext);
 	reserve(polygons.size());
 	for (const PolygonElement& cacheElement : polygons) {
-		PolygonElement polygon = transformed(cacheElement, ref.transformation);
+		PolygonElement polygon = transformed(cacheElement, ref.element.transformation);
 		if (needInverting) {
-			gl::invert(polygon);
+			gl::invert(polygon.element);
 		}
 		if (polygon.color == MAIN_COLOR) {
 			polygon.color = ref.color;
@@ -106,19 +106,19 @@
 			}
 		},
 		[&](const LineType2& line2) {
-			add(2, {line2.value, line2.value.color});
+			add(2, {line2.value.element, line2.value.color});
 		},
 		[&](const LineType3& line3) {
-			add(3, {line3.value, line3.value.color});
+			add(3, {line3.value.element, line3.value.color});
 		},
 		[&](const LineType4& line4) {
-			add(4, {line4.value, line4.value.color});
+			add(4, {line4.value.element, line4.value.color});
 		},
 		[&](const LineType5& line5) {
-			add(5, {line5.value, line5.value.color});
+			add(5, {line5.value.element, line5.value.color});
 		},
 		[&add, context, &reserve](const LineType1& line1) {
-			QTextDocument* const dependency = findDependency(line1.value, context);
+			QTextDocument* const dependency = findDependency(line1.value.element, context);
 			if (PolygonCache* cache = (dependency != nullptr)
 				? findPolygonCacheForModel(dependency, context->documents)
 				: nullptr
@@ -153,7 +153,7 @@
 	const auto add = [&result, &winding, &i](int lineno, const PolygonElement& poly){
 		result.push_back({poly, i});
 		if (lineno != 1 and winding == winding_e::clockwise) {
-			gl::invert(result.back());
+			gl::invert(result.back().element);
 		}
 	};
 	const auto reserve = [&result](std::size_t incomingsize){

mercurial