From db71a3aa874ae6bfc5409398e6b8f6e6c288c63d Mon Sep 17 00:00:00 2001 From: Dan Royer Date: Thu, 27 Jun 2024 16:16:22 -0700 Subject: [PATCH] color fixes --- .../DirectionLoopTurtleRenderer.java | 4 ++-- .../turtlerenderer/Line2QuadHelper.java | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/DirectionLoopTurtleRenderer.java b/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/DirectionLoopTurtleRenderer.java index 51737ea7f..7042f2d00 100644 --- a/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/DirectionLoopTurtleRenderer.java +++ b/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/DirectionLoopTurtleRenderer.java @@ -59,8 +59,8 @@ private void drawPoints() { TurtleMove p1 = points.get(i+1); float b0 = (float)i/(float)size; float b1 = (float)(i+1)/(float)size; - var c0 = new Color(b0,0,1.0f - b0,1); - var c1 = new Color(b1,0,1.0f - b1,1); + var c0 = new Color(b0,0,(int)(255f*(1.0f - b0)),255); + var c1 = new Color(b1,0,(int)(255f*(1.0f - b1)),255); Vector3d p0v = new Vector3d(p0.x,p0.y,0); Vector3d p1v = new Vector3d(p1.x,p1.y,0); Line2QuadHelper.thicken(mesh, p0v, p1v, c0, c1, penDiameter); diff --git a/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/Line2QuadHelper.java b/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/Line2QuadHelper.java index 3adb2d85a..d19d38b91 100644 --- a/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/Line2QuadHelper.java +++ b/src/main/java/com/marginallyclever/makelangelo/apps/previewpanel/turtlerenderer/Line2QuadHelper.java @@ -43,10 +43,10 @@ public static void thicken(Mesh mesh, Vector3d p0, Vector3d p1, Color c0, Color float b0 = c0.getBlue() / 255.0f; float a0 = c0.getAlpha() / 255.0f; - float r1 = c0.getRed() / 255.0f; - float g1 = c0.getGreen() / 255.0f; - float b1 = c0.getBlue() / 255.0f; - float a1 = c0.getAlpha() / 255.0f; + float r1 = c1.getRed() / 255.0f; + float g1 = c1.getGreen() / 255.0f; + float b1 = c1.getBlue() / 255.0f; + float a1 = c1.getAlpha() / 255.0f; // d is the line p0->p1 scaled to thickness/2 Vector2d d = new Vector2d(p1.x-p0.x,p1.y-p0.y); @@ -74,14 +74,12 @@ public static void thicken(Mesh mesh, Vector3d p0, Vector3d p1, Color c0, Color mesh.addTexCoord((float)p1.x, (float)p1.y); } - mesh.addColor(r0, g0, b0, a0); mesh.addColor(r1, g1, b1, a1); - mesh.addColor(r0, g0, b0, a0); - mesh.addColor(r1, g1, b1, a1); + mesh.addColor(r1, g1, b1, a1); mesh.addColor(r0, g0, b0, a0); - + mesh.addColor(r0, g0, b0, a0); } }