From fa37044459817a028b9d29d8eb60436342342a87 Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 13 Jul 2004 05:03:13 +0000 Subject: [PATCH] fixes for two nasty line() bugs --- core/PGraphics.java | 3 ++- core/PLine.java | 23 +++++++++++++++-------- core/PPolygon.java | 6 +++--- core/todo.txt | 11 +++++------ 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/core/PGraphics.java b/core/PGraphics.java index c688de2e0..11e1c43a6 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -2093,7 +2093,8 @@ public class PGraphics extends PImage implements PConstants { vertexCount++; // since it had already been read above v1[X] = v0[X]; v1[Y] = v0[Y]; v1[Z] = v0[Z]; - v1[SR] = v0[SR]; v1[SG] = v0[SG]; v1[SB] = v0[SB]; + v1[SR] = v0[SR]; v1[SG] = v0[SG]; + v1[SB] = v0[SB]; v1[SA] = v0[SA]; } // increment by two for individual lines diff --git a/core/PLine.java b/core/PLine.java index b425c6299..033e7a621 100644 --- a/core/PLine.java +++ b/core/PLine.java @@ -270,16 +270,23 @@ public class PLine implements PConstants yLonger = false; - // HACK for drawing lines left-to-right [fry] + // HACK for drawing lines left-to-right for rev 0069 // some kind of bug exists with the line-stepping algorithm - // that causes strange patterns in the anti-aliasing + // that causes strange patterns in the anti-aliasing. + // [040228 fry] + // + // swap rgba as well as the coords.. oops + // [040712 fry] + // if (x_array[1] < x_array[0]) { - float t = x_array[1]; - x_array[1] = x_array[0]; - x_array[0] = t; - t = y_array[1]; - y_array[1] = y_array[0]; - y_array[0] = t; + float t; + + t = x_array[1]; x_array[1] = x_array[0]; x_array[0] = t; + t = y_array[1]; y_array[1] = y_array[0]; y_array[0] = t; + t = r_array[1]; r_array[1] = r_array[0]; r_array[0] = t; + t = g_array[1]; g_array[1] = g_array[0]; g_array[0] = t; + t = b_array[1]; b_array[1] = b_array[0]; b_array[0] = t; + t = z_array[1]; z_array[1] = z_array[0]; z_array[0] = t; } // important - dont change the casts diff --git a/core/PPolygon.java b/core/PPolygon.java index 1c6cd0d15..543629ddb 100644 --- a/core/PPolygon.java +++ b/core/PPolygon.java @@ -142,9 +142,9 @@ public class PPolygon implements PConstants { // vertexCount-1 is the current vertex that would be used // vertexCount-2 would be the previous feller - if ((Math.abs(vertices[vertexCount-2][MX] - x) < 0.0001f) && - (Math.abs(vertices[vertexCount-2][MY] - y) < 0.0001f) && - (Math.abs(vertices[vertexCount-2][MZ] - z) < 0.0001f)) { + if ((Math.abs(vertices[vertexCount-2][MX] - x) < EPSILON) && + (Math.abs(vertices[vertexCount-2][MY] - y) < EPSILON) && + (Math.abs(vertices[vertexCount-2][MZ] - z) < EPSILON)) { vertexCount--; return true; } diff --git a/core/todo.txt b/core/todo.txt index 1e3ab55b5..a83359005 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -27,9 +27,13 @@ X bug in BImage.smooth() when resizing an image X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077669847 X shut off the automatic gunzipping of streams, keep for fonts X fix for duplicated points in polygons that foiled the tesselator +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077819175 X cleaned up texture() code between NEW/OLD graphics X not quite so much duplicated in cases etc. - +X lines: vertex coloring bug with my swap hack +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1085348942 +X last vertex on LINE_LOOP fades out +X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1076911893 cleaning up X make bagel more usable as standalone @@ -174,10 +178,6 @@ CORE / PImage CORE / PGraphics b _ lines - b _ last vertex on LINE_LOOP fades out - b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1076911893 - b _ vertex coloring bug with carlos' new line code - b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1085348942 b X rewrite line and stroke code, it's a buggy mess b X lines become 2 pixels thick after a 3D transform b X better handling of single-pixel special se @@ -200,7 +200,6 @@ CORE / PGraphics b _ setting stroke width on circle makes odd patterns b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1077013848;start=0 b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1080347160 - b _ more weirdness with stroke on rect, prolly not alpha b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1085799526 b _ rect is not getting it's stroke color set