src/circularprimitive.h

changeset 305
d891da20abca
parent 264
76a025db4948
child 379
8d88adffb779
--- a/src/circularprimitive.h	Tue Jun 28 22:18:11 2022 +0300
+++ b/src/circularprimitive.h	Wed Jun 29 14:11:58 2022 +0300
@@ -17,23 +17,23 @@
 	case CircularPrimitive::Circle:
 		ldraw::circle(circ.fraction.segments, circ.fraction.divisions, [&]
 		(const glm::vec2&, const glm::vec2& p1, const glm::vec2& p2){
-			fn(edge(xform(p1, 0), xform(p2, 0)));
+			fn(LineSegment{xform(p1, 0), xform(p2, 0)}, EDGE_COLOR);
 		});
 		break;
 	case CircularPrimitive::Disc:
 		ldraw::circle(circ.fraction.segments, circ.fraction.divisions, [&]
 		(const glm::vec2&, const glm::vec2& p1, const glm::vec2& p2){
-			fn(triangle(primitiveOrigin, xform(p1, 0), xform(p2, 0)));
+			fn(Triangle{primitiveOrigin, xform(p1, 0), xform(p2, 0)}, MAIN_COLOR);
 		});
 		break;
 	case CircularPrimitive::Cylinder:
 		ldraw::circle(circ.fraction.segments, circ.fraction.divisions, [&]
 		(const glm::vec2&, const glm::vec2& p1, const glm::vec2& p2){
-			Colored<Quadrilateral> quad = quadrilateral(xform(p1, 1), xform(p2, 1), xform(p2, 0), xform(p1, 0));
+			Quadrilateral quad{xform(p1, 1), xform(p2, 1), xform(p2, 0), xform(p1, 0)};
 			if (invertedMatrix) {
 				std::swap(quad.p2, quad.p4);
 			}
-			fn(quad);
+			fn(quad, MAIN_COLOR);
 		});
 		break;
 	case CircularPrimitive::CylinderOpen:
@@ -77,7 +77,7 @@
 					{+1, -1},
 				};
 				const glm::vec2& corner = corners[i * 4 / circ.fraction.divisions];
-				fn(triangle(xform(p2, 0), xform(p1, 0), xform(corner, 0)));
+				fn(Triangle{xform(p2, 0), xform(p1, 0), xform(corner, 0)}, MAIN_COLOR);
 				++i;
 			});
 		}
@@ -86,7 +86,7 @@
 		for (unsigned int i = 1; i < circ.fraction.segments; ++i) {
 			const glm::vec2& p1 = ldraw::rimpoint(circ.fraction.divisions, i);
 			const glm::vec2& p2 = ldraw::rimpoint(circ.fraction.divisions, i + 1);
-			fn(triangle(xform(p2, 0), xform(p1, 0), xform({1, 0}, 0)));
+			fn(Triangle{xform(p2, 0), xform(p1, 0), xform({1, 0}, 0)}, MAIN_COLOR);
 		}
 		break;
 	}

mercurial