From 6dc368e8fbf7f850cdb0efe3694a39499e4b2441 Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 30 Aug 2005 21:26:44 +0000 Subject: [PATCH] tweaks to PPolygon and bug fix for lowercase naming on PApplet --- core/PApplet.java | 8 ++++++- core/PPolygon.java | 52 +++++++++++++++++++++++----------------------- core/todo.txt | 3 +++ 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/core/PApplet.java b/core/PApplet.java index d48562164..4b7670b65 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -3174,7 +3174,13 @@ public class PApplet extends Applet try { String path = file.getCanonicalPath(); String filenameActual = new File(path).getName(); - if (!filenameActual.equals(filename)) { + // if the actual filename is the same, but capitalized + // differently, warn the user. unfortunately this won't + // work in subdirectories because getName() on a relative + // path will return just the name, while 'filename' may + // contain part of a relative path. + if (filenameActual.equalsIgnoreCase(filename) && + !filenameActual.equals(filename)) { throw new RuntimeException("This file is named " + filenameActual + " not " + filename + "."); diff --git a/core/PPolygon.java b/core/PPolygon.java index 184da7c68..fe69c594d 100644 --- a/core/PPolygon.java +++ b/core/PPolygon.java @@ -63,8 +63,8 @@ public class PPolygon implements PConstants { int pixels[]; // the parent's width/height, - // or if smoothing is enabled, parent's w/h scaled - // up by the smoothing dimension + // or if smooth is enabled, parent's w/h scaled + // up by the smooth dimension int width, height; int width1, height1; @@ -84,7 +84,7 @@ public class PPolygon implements PConstants { static final int SUBYRES1 = 7; static final int MAX_COVERAGE = SUBXRES * SUBYRES; - boolean smoothing; + boolean smooth; int firstModY; int lastModY; int lastY; @@ -178,16 +178,16 @@ public class PPolygon implements PConstants { //zbuffer = parent.zbuffer; noDepthTest = parent.hints[NO_DEPTH_TEST]; //!parent.depthTest; - smoothing = parent.smooth; + smooth = parent.smooth; - // by default, text turns on smoothing for the textures + // by default, text turns on smooth for the textures // themselves. but this should be shut off if the hint // for DISABLE_TEXT_SMOOTH is set. texture_smooth = (//parent.drawing_text && !parent.hints[DISABLE_TEXT_SMOOTH]); - width = smoothing ? parent.width*SUBXRES : parent.width; - height = smoothing ? parent.height*SUBYRES : parent.height; + width = smooth ? parent.width*SUBXRES : parent.width; + height = smooth ? parent.height*SUBYRES : parent.height; width1 = width - 1; height1 = height - 1; @@ -221,7 +221,7 @@ public class PPolygon implements PConstants { } } - if (smoothing) { + if (smooth) { for (int i = 0; i < vertexCount; i++) { vertices[i][X] *= SUBXRES; vertices[i][Y] *= SUBYRES; @@ -306,14 +306,14 @@ public class PPolygon implements PConstants { increment(r, dr); } } - //if (smoothing) { + //if (smooth) { //System.out.println("y/lasty/lastmody = " + y + " " + lastY + " " + lastModY); //} } public void unexpand() { - if (smoothing) { + if (smooth) { for (int i = 0; i < vertexCount; i++) { vertices[i][X] /= SUBXRES; vertices[i][Y] /= SUBYRES; @@ -328,7 +328,7 @@ public class PPolygon implements PConstants { sp[i] = 0; sdp[i] = 0; } - // this rounding doesn't seem to be relevant with smoothing + // this rounding doesn't seem to be relevant with smooth int lx = (int) (l[X] + 0.49999f); // ceil(l[X]-.5); if (lx < 0) lx = 0; int rx = (int) (r[X] - 0.5f); @@ -336,7 +336,7 @@ public class PPolygon implements PConstants { if (lx > rx) return; - if (smoothing) { + if (smooth) { int mody = MODYRES(y); aaleft[mody] = lx; @@ -373,11 +373,11 @@ public class PPolygon implements PConstants { // scan in x, generating pixels // using parent.width to get actual pixel index - // rather than scaled by smoothing factor - int offset = smoothing ? parent.width * (y / SUBYRES) : parent.width*y; + // rather than scaled by smooth factor + int offset = smooth ? parent.width * (y / SUBYRES) : parent.width*y; int truelx = 0, truerx = 0; - if (smoothing) { + if (smooth) { truelx = lx / SUBXRES; truerx = (rx + SUBXRES1) / SUBXRES; @@ -408,7 +408,7 @@ public class PPolygon implements PConstants { int txy = tv*twidth + tu; - if (smoothing || texture_smooth) { + if (smooth || texture_smooth) { //if (FRY) System.out.println("sp u v = " + sp[U] + " " + sp[V]); //System.out.println("sp u v = " + sp[U] + " " + sp[V]); // tuf1/tvf1 is the amount of coverage for the adjacent @@ -500,13 +500,13 @@ public class PPolygon implements PConstants { } } - // get coverage for pixel if smoothing - // checks smoothing again here because of + // get coverage for pixel if smooth + // checks smooth again here because of // hints[SMOOTH_IMAGES] used up above - int weight = smoothing ? coverage(x) : 255; + int weight = smooth ? coverage(x) : 255; if (weight != 255) ta = ta*weight >> 8; - } else { // no smoothing, just get the pixels + } else { // no smooth, just get the pixels int tpixel = tpixels[txy]; // TODO i doubt splitting these guys really gets us @@ -567,7 +567,7 @@ public class PPolygon implements PConstants { } } else { // no image applied - int weight = smoothing ? coverage(x) : 255; + int weight = smooth ? coverage(x) : 255; if (interpARGB) { r2 = (int) (sp[R] * 255); @@ -603,10 +603,10 @@ public class PPolygon implements PConstants { } } } - // if smoothing enabled, don't increment values + // if smooth enabled, don't increment values // for the pixel in the stretch out version // of the scanline used to get smooth edges. - if (!smoothing || ((x >= truelx) && (x <= truerx))) { + if (!smooth || ((x >= truelx) && (x <= truerx))) { increment(sp, sdp); } } @@ -670,7 +670,7 @@ public class PPolygon implements PConstants { dp[U] = (p2[U] - p1[U]) / delta; dp[V] = (p2[V] - p1[V]) / delta; - //if (smoothing) { + //if (smooth) { //p[U] = p1[U]; //+ dp[U] * fraction; //p[V] = p1[V]; //+ dp[V] * fraction; @@ -688,7 +688,7 @@ public class PPolygon implements PConstants { float delta = p2[X] - p1[X]; if (delta == 0) delta = ONE; float fraction = x + HALF - p1[X]; - if (smoothing) { + if (smooth) { delta /= SUBXRES; fraction /= SUBXRES; } @@ -718,7 +718,7 @@ public class PPolygon implements PConstants { dp[U] = (p2[U] - p1[U]) / delta; dp[V] = (p2[V] - p1[V]) / delta; - //if (smoothing) { + //if (smooth) { //p[U] = p1[U]; // offset for the damage that will be done by the // 8 consecutive calls to scanline diff --git a/core/todo.txt b/core/todo.txt index 57c8f0ddd..bb2db371b 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -10,6 +10,7 @@ X nope, because it requires grabbing the font metrics and other calculations X bezierDetail, curveDetail made public X added textMode(SHAPE) for OPENGL X error message saying that strokeCap and strokeJoin don't work in P3D +X fix a bug with filename capitalization error throwing nixed or fixed in previous releases X textMode(SCREEN) having issues on Mac OS X @@ -20,6 +21,8 @@ X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpen o noLoop() is behaving strangely o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1116002432;start=0 +_ "this file is named" errors don't like subdirectories +_ need to strip off past the file separator or something _ stop() not getting called _ and start() is supposedly called by the applet viewer _ http://java.sun.com/j2se/1.4.2/docs/api/java/applet/Applet.html#start()