Skip to content

Commit

Permalink
color fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
i-make-robots committed Jun 27, 2024
1 parent 79aa331 commit db71a3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}

0 comments on commit db71a3a

Please sign in to comment.