diff --git a/app/Sketch.java b/app/Sketch.java index e9cdbb0e0..e0af1a54d 100644 --- a/app/Sketch.java +++ b/app/Sketch.java @@ -320,7 +320,8 @@ public class Sketch { newFlavor = PDE; } else if (newName.endsWith(".java")) { - if (code[0] == current) { + // don't show this error if creating a new tab + if (renamingCode && (code[0] == current)) { Base.showWarning("Problem with rename", "The main .pde file cannot be .java file.\n" + "(It may be time for your to graduate to a\n" + diff --git a/core/PApplet.java b/core/PApplet.java index 8cb7dd36c..5d0f8f496 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -3060,6 +3060,21 @@ public class PApplet extends Applet } + /** + * Simplified method to open a Java InputStream. + *

+ * This method is useful if you want to use the facilities provided + * by PApplet to easily open things from the data folder or from a URL, + * but want an InputStream object so that you can use other Java + * methods to take more control of how the stream is read. + *

+ * The filename passed in can be: + *

+ */ public InputStream openStream(String filename) { InputStream stream = null; diff --git a/core/PGraphics.java b/core/PGraphics.java index a7037acbc..b92dd26b0 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -2126,41 +2126,96 @@ public class PGraphics extends PImage implements PConstants { // SCREEN TRANSFORMS + /** + * Given an x and y coordinate, returns the x position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ public float screenX(float x, float y) { return m00*x + m01*y + m02; } + /** + * Given an x and y coordinate, returns the y position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ public float screenY(float x, float y) { return m10*x + m11*y + m12; } + /** + * Maps a three dimensional point to its placement on-screen. + *

+ * Given an (x, y, z) coordinate, returns the x position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ public float screenX(float x, float y, float z) { depthErrorXYZ("screenX"); return 0; } + + /** + * Maps a three dimensional point to its placement on-screen. + *

+ * Given an (x, y, z) coordinate, returns the y position of where + * that point would be placed on screen, once affected by translate(), + * scale(), or any other transformations. + */ public float screenY(float x, float y, float z) { depthErrorXYZ("screenY"); return 0; } + + /** + * Maps a three dimensional point to its placement on-screen. + *

+ * Given an (x, y, z) coordinate, returns its z value. + * This value can be used to determine if an (x, y, z) coordinate + * is in front or in back of another (x, y, z) coordinate. + * The units are based on how the zbuffer is set up, and don't + * relate to anything "real". They're only useful for in + * comparison to another value obtained from screenZ(), + * or directly out of the zbuffer[]. + */ public float screenZ(float x, float y, float z) { depthErrorXYZ("screenZ"); return 0; } + + /** + * Returns the model space x value for an x, y, z coordinate. + *

+ * This will give you a coordinate after it has been transformed + * by translate(), rotate(), and camera(), but not yet transformed + * by the projection matrix. For instance, his can be useful for + * figuring out how points in 3D space relate to the edge + * coordinates of a shape. + */ public float modelX(float x, float y, float z) { depthErrorXYZ("modelX"); return 0; } + + /** + * Returns the model space y value for an x, y, z coordinate. + */ public float modelY(float x, float y, float z) { depthErrorXYZ("modelY"); return 0; } + + /** + * Returns the model space z value for an x, y, z coordinate. + */ public float modelZ(float x, float y, float z) { depthErrorXYZ("modelZ"); return 0; @@ -2183,13 +2238,18 @@ public class PGraphics extends PImage implements PConstants { } - // note that this doesn't set the alpha color max.. - // so colorMode(RGB, 255, 255, 255) would retain the previous max alpha - // could be a problem when colorMode(HSB, 360, 100, 100); - + /** + * Set the colorMode and the maximum values for (r, g, b) + * or (h, s, b). + *

+ * Note that this doesn't set the maximum for the alpha value, + * which might be confusing if for instance you switched to + *

colorMode(HSB, 360, 100, 100);
+ * because the alpha values were still between 0 and 255. + */ public void colorMode(int mode, float maxX, float maxY, float maxZ) { - colorMode(mode, maxX, maxY, maxZ, colorModeA); //maxX); //ONE); + colorMode(mode, maxX, maxY, maxZ, colorModeA); } @@ -2305,14 +2365,15 @@ public class PGraphics extends PImage implements PConstants { /** - * unpacks AARRGGBB color for direct use with colorCalc. - * handled here with its own function since this is indepenent + * Unpacks AARRGGBB color for direct use with colorCalc. + *

+ * Handled here with its own function since this is indepenent * of the color mode. - * - * strangely the old version of this code ignored the alpha + *

+ * Strangely the old version of this code ignored the alpha * value. not sure if that was a bug or what. - * - * (note: no need for bounds check since it's a 32 bit number) + *

+ * Note, no need for a bounds check since it's a 32 bit number. */ protected void colorFrom(int argb) { calcColor = argb; diff --git a/core/PGraphics3.java b/core/PGraphics3.java index 1aeb14c16..57585fc99 100644 --- a/core/PGraphics3.java +++ b/core/PGraphics3.java @@ -499,8 +499,20 @@ public class PGraphics3 extends PGraphics { /** - * Sets the current normal. Only applies - * inside a beginShape/endShape block. + * Sets the current normal vector. + *

+ * This is for drawing three dimensional shapes and surfaces, + * allowing you to specify a vector perpendicular to the surface + * of the shape, which determines how lighting affects it. + *

+ * For the most part, PGraphics will attempt to automatically + * assign normals to shapes, but since that's imperfect, + * this is a better option when you want more control. + *

+ * For people familiar with OpenGL, this function is basically + * identical to glNormal3f(). + *

+ * Only applies inside a beginShape/endShape block. */ public void normal(float nx, float ny, float nz) { normalX = nx; diff --git a/core/todo.txt b/core/todo.txt index bb6d498c2..2457bc280 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -89,6 +89,7 @@ _ would be cool if could sort w/o the sort class.. _ meaning use reflection to sort objects, just by implementing a few methods _ make a PException that extends RuntimeException but packages an ex? +_ http://java.sun.com/docs/books/tutorial/essential/exceptions/runtime.html _ catch sun.dc.pr.PRException? _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1113990788;start=0 diff --git a/todo.txt b/todo.txt index 2b3613b88..b64fcb548 100644 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,8 @@ 0087 pde +X bug with creating a new tab that's a .java file +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115059069;start=0 +X small explanation and tiny example(s) for the following? +X modelX(), modelY(), modelZ(), screenZ(), openStream(), normal() already completed in 86 X remove requirement for osx to install fink @@ -12,8 +16,6 @@ _ make simple tool for casey to rebuild all the examples at once _ need to rebuild with this release because of 1.3/1.4 issues documentation -_ small explanation and tiny example(s) for the following? -_ modelX(), modelY(), modelZ(), screenZ(), openStream(), normal() _ auto-run the javadoc in dist.sh _ doctor a copy of the css file to use p5 defaults _ and re-copy the css in after generating the doc each time