From 8ccdc128a3998fe7bf1615bf91a4d3fcd8d13068 Mon Sep 17 00:00:00 2001 From: benfry Date: Wed, 6 Apr 2005 19:42:27 +0000 Subject: [PATCH] cleaning up coloring api --- app/PdeEditorStatus.java | 1 - core/PApplet.java | 260 ++++++++++++++++++++------------------- core/PGraphics.java | 118 +++++++++--------- core/PGraphics2.java | 12 +- core/PGraphics3.java | 110 +++++++++-------- core/todo.txt | 8 +- opengl/PGraphicsGL.java | 9 +- todo.txt | 2 + 8 files changed, 270 insertions(+), 250 deletions(-) diff --git a/app/PdeEditorStatus.java b/app/PdeEditorStatus.java index 62fc30548..f5f2ae39c 100644 --- a/app/PdeEditorStatus.java +++ b/app/PdeEditorStatus.java @@ -115,7 +115,6 @@ public class PdeEditorStatus extends JPanel implements ActionListener { } - public void prompt(String message) { mode = PROMPT; this.message = message; diff --git a/core/PApplet.java b/core/PApplet.java index ff3590591..a3dbb6eaa 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -905,7 +905,8 @@ public class PApplet extends Applet // can't remember when/why i changed that to '1' // (rather than 3 or 5, as has been traditional), but i // have a feeling that some platforms aren't gonna like that - // if !looping, sleeps for a nice long time + // if !looping, sleeps for a nice long time, + // or until interrupted int nap = looping ? 1 : 10000; // don't nap after setup, because if noLoop() is called this // will make the first draw wait 10 seconds before showing up @@ -914,7 +915,6 @@ public class PApplet extends Applet if (THREAD_DEBUG) println(Thread.currentThread().getName() + " outta sleep"); } catch (InterruptedException e) { } - //} } } catch (Exception e) { @@ -949,147 +949,148 @@ public class PApplet extends Applet public void display() { - if (PApplet.THREAD_DEBUG) println(Thread.currentThread().getName() + - " formerly nextFrame()"); - if (looping || redraw) { - /* - if (frameCount == 0) { // needed here for the sync - //createGraphics(); - // set up a dummy graphics in case size() is never - // called inside setup - size(INITIAL_WIDTH, INITIAL_HEIGHT); - } - */ + if (PApplet.THREAD_DEBUG) println(Thread.currentThread().getName() + + " formerly nextFrame()"); + if (looping || redraw) { + /* + if (frameCount == 0) { // needed here for the sync + //createGraphics(); + // set up a dummy graphics in case size() is never + // called inside setup + size(INITIAL_WIDTH, INITIAL_HEIGHT); + } + */ - // g may be rebuilt inside here, so turning of the sync - //synchronized (g) { - // use a different sync object - synchronized (glock) { - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 1a beginFrame"); - g.beginFrame(); - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 1b draw"); + // g may be rebuilt inside here, so turning of the sync + //synchronized (g) { + // use a different sync object + synchronized (glock) { + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " 1a beginFrame"); + g.beginFrame(); + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " 1b draw"); - if (frameCount == 0) { + if (frameCount == 0) { - try { - //System.out.println("attempting setup"); - //System.out.println("into try"); - setup(); - //g.defaults(); + try { + //System.out.println("attempting setup"); + //System.out.println("into try"); + setup(); + //g.defaults(); - //System.out.println("done attempting setup"); - //System.out.println("out of try"); - g.postSetup(); // FIXME + //System.out.println("done attempting setup"); + //System.out.println("out of try"); + g.postSetup(); // FIXME - } catch (RuntimeException e) { - //System.out.println("catching a cold " + e.getMessage()); - if (e.getMessage().indexOf(NEW_RENDERER) != -1) { - //System.out.println("got new renderer"); - return; - //continue; // will this work? - - } else { - throw e; - } - } - // if depth() is called inside setup, pixels/width/height - // will be ok by the time it's back out again - - //this.pixels = g.pixels; // make em call loadPixels - // now for certain that we've got a valid size - this.width = g.width; - this.height = g.height; + } catch (RuntimeException e) { + //System.out.println("catching a cold " + e.getMessage()); + if (e.getMessage().indexOf(NEW_RENDERER) != -1) { + //System.out.println("got new renderer"); + return; + //continue; // will this work? } else { - // update the current framerate - if (framerateLastMillis != 0) { - float elapsed = (float) - (System.currentTimeMillis() - framerateLastMillis); - if (elapsed != 0) { - framerate = - (framerate * 0.9f) + ((1.0f / (elapsed / 1000.0f)) * 0.1f); - } - } - framerateLastMillis = System.currentTimeMillis(); - - if (framerateTarget != 0) { - if (framerateLastDelayTime == 0) { - framerateLastDelayTime = System.currentTimeMillis(); - - } else { - long timeToLeave = - framerateLastDelayTime + (long)(1000.0f / framerateTarget); - int napTime = - (int) (timeToLeave - System.currentTimeMillis()); - framerateLastDelayTime = timeToLeave; - delay(napTime); - } - } - - preMethods.handle(); - - pmouseX = dmouseX; - pmouseY = dmouseY; - - draw(); - - // dmouseX/Y is updated only once per frame - dmouseX = mouseX; - dmouseY = mouseY; - - // these are called *after* loop so that valid - // drawing commands can be run inside them. it can't - // be before, since a call to background() would wipe - // out anything that had been drawn so far. - dequeueMouseEvents(); - - dequeueKeyEvents(); - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 2b endFrame"); - - drawMethods.handle(); - //for (int i = 0; i < libraryCount; i++) { - //if (libraryCalls[i][PLibrary.DRAW]) libraries[i].draw(); - //} - - redraw = false; // unset 'redraw' flag in case it was set - // (only do this once draw() has run, not just setup()) + throw e; } + } + // if depth() is called inside setup, pixels/width/height + // will be ok by the time it's back out again - g.endFrame(); - if (recorder != null) { - recorder.endFrame(); - recorder = null; + //this.pixels = g.pixels; // make em call loadPixels + // now for certain that we've got a valid size + this.width = g.width; + this.height = g.height; + + } else { + // update the current framerate + if (framerateLastMillis != 0) { + float elapsed = (float) + (System.currentTimeMillis() - framerateLastMillis); + if (elapsed != 0) { + framerate = + (framerate * 0.9f) + ((1.0f / (elapsed / 1000.0f)) * 0.1f); } + } + framerateLastMillis = System.currentTimeMillis(); - //} // older end sync + if (framerateTarget != 0) { + //System.out.println("delaying"); + if (framerateLastDelayTime == 0) { + framerateLastDelayTime = System.currentTimeMillis(); - //update(); - // formerly 'update' - //if (firstFrame) firstFrame = false; - // internal frame counter - frameCount++; - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 3a calling repaint() " + frameCount); - repaint(); - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 3b calling Toolkit.sync " + frameCount); - getToolkit().sync(); // force repaint now (proper method) - if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 3c done " + frameCount); - //if (THREAD_DEBUG) println(" 3d waiting"); - //wait(); - //if (THREAD_DEBUG) println(" 3d out of wait"); - //frameCount++; + } else { + long timeToLeave = + framerateLastDelayTime + (long)(1000.0f / framerateTarget); + int napTime = + (int) (timeToLeave - System.currentTimeMillis()); + framerateLastDelayTime = timeToLeave; + delay(napTime); + } + } - postMethods.handle(); - //for (int i = 0; i < libraryCount; i++) { - //if (libraryCalls[i][PLibrary.POST]) libraries[i].post(); - //} - } // end of synchronize + preMethods.handle(); + + pmouseX = dmouseX; + pmouseY = dmouseY; + + draw(); + + // dmouseX/Y is updated only once per frame + dmouseX = mouseX; + dmouseY = mouseY; + + // these are called *after* loop so that valid + // drawing commands can be run inside them. it can't + // be before, since a call to background() would wipe + // out anything that had been drawn so far. + dequeueMouseEvents(); + + dequeueKeyEvents(); + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " 2b endFrame"); + + drawMethods.handle(); + //for (int i = 0; i < libraryCount; i++) { + //if (libraryCalls[i][PLibrary.DRAW]) libraries[i].draw(); + //} + + redraw = false; // unset 'redraw' flag in case it was set + // (only do this once draw() has run, not just setup()) } + + g.endFrame(); + if (recorder != null) { + recorder.endFrame(); + recorder = null; + } + + //} // older end sync + + //update(); + // formerly 'update' + //if (firstFrame) firstFrame = false; + // internal frame counter + frameCount++; + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " 3a calling repaint() " + frameCount); + repaint(); + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " 3b calling Toolkit.sync " + frameCount); + getToolkit().sync(); // force repaint now (proper method) + if (THREAD_DEBUG) println(Thread.currentThread().getName() + + " 3c done " + frameCount); + //if (THREAD_DEBUG) println(" 3d waiting"); + //wait(); + //if (THREAD_DEBUG) println(" 3d out of wait"); + //frameCount++; + + postMethods.handle(); + //for (int i = 0; i < libraryCount; i++) { + //if (libraryCalls[i][PLibrary.POST]) libraries[i].post(); + //} + } // end of synchronize + } } @@ -4641,6 +4642,7 @@ v PApplet.this.stop(); * * --present-stop-color color of the 'stop' text used to quit an * applet when it's in present mode. + * */ static public void main(String args[]) { if (args.length < 1) { diff --git a/core/PGraphics.java b/core/PGraphics.java index 6b2dddcd4..e13c4b1bf 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -2177,12 +2177,12 @@ public class PGraphics extends PImage implements PConstants { ////////////////////////////////////////////////////////////// - protected void calc_color(float gray) { - calc_color(gray, colorModeA); + protected void colorCalc(float gray) { + colorCalc(gray, colorModeA); } - protected void calc_color(float gray, float alpha) { + protected void colorCalc(float gray, float alpha) { if (gray > colorModeX) gray = colorModeX; if (alpha > colorModeA) alpha = colorModeA; @@ -2201,12 +2201,12 @@ public class PGraphics extends PImage implements PConstants { } - protected void calc_color(float x, float y, float z) { - calc_color(x, y, z, colorModeA); + protected void colorCalc(float x, float y, float z) { + colorCalc(x, y, z, colorModeA); } - protected void calc_color(float x, float y, float z, float a) { + protected void colorCalc(float x, float y, float z, float a) { if (x > colorModeX) x = colorModeX; if (y > colorModeY) y = colorModeY; if (z > colorModeZ) z = colorModeZ; @@ -2265,7 +2265,7 @@ public class PGraphics extends PImage implements PConstants { /** - * unpacks AARRGGBB color for direct use with calc_color. + * unpacks AARRGGBB color for direct use with colorCalc. * handled here with its own function since this is indepenent * of the color mode. * @@ -2274,7 +2274,7 @@ public class PGraphics extends PImage implements PConstants { * * (note: no need for bounds check since it's a 32 bit number) */ - protected void calc_color_from(int argb) { + protected void colorFrom(int argb) { calcColor = argb; calcAi = (argb >> 24) & 0xff; calcRi = (argb >> 16) & 0xff; @@ -2288,7 +2288,7 @@ public class PGraphics extends PImage implements PConstants { } - protected void calc_tint() { + protected void colorTint() { tint = true; tintR = calcR; tintG = calcG; @@ -2303,7 +2303,7 @@ public class PGraphics extends PImage implements PConstants { } - protected void calc_fill() { + protected void colorFill() { fill = true; //fillChanged = true; fillR = calcR; @@ -2319,7 +2319,7 @@ public class PGraphics extends PImage implements PConstants { } - protected void calc_stroke() { + protected void colorStroke() { stroke = true; //strokeChanged = true; strokeR = calcR; @@ -2335,7 +2335,7 @@ public class PGraphics extends PImage implements PConstants { } - protected void calc_background() { + protected void colorBackground() { backgroundR = calcR; backgroundG = calcG; backgroundB = calcB; @@ -2363,32 +2363,32 @@ public class PGraphics extends PImage implements PConstants { tint((float) rgb); } else { - calc_color_from(rgb); - calc_tint(); + colorFrom(rgb); + colorTint(); } } public void tint(float gray) { - calc_color(gray); - calc_tint(); + colorCalc(gray); + colorTint(); } public void tint(float gray, float alpha) { - calc_color(gray, alpha); - calc_tint(); + colorCalc(gray, alpha); + colorTint(); } public void tint(float x, float y, float z) { - calc_color(x, y, z); - calc_tint(); + colorCalc(x, y, z); + colorTint(); } public void tint(float x, float y, float z, float a) { - calc_color(x, y, z, a); - calc_tint(); + colorCalc(x, y, z, a); + colorTint(); } @@ -2425,32 +2425,32 @@ public class PGraphics extends PImage implements PConstants { fill((float) rgb); } else { - calc_color_from(rgb); - calc_fill(); + colorFrom(rgb); + colorFill(); } } public void fill(float gray) { - calc_color(gray); - calc_fill(); + colorCalc(gray); + colorFill(); } public void fill(float gray, float alpha) { - calc_color(gray, alpha); - calc_fill(); + colorCalc(gray, alpha); + colorFill(); } public void fill(float x, float y, float z) { - calc_color(x, y, z); - calc_fill(); + colorCalc(x, y, z); + colorFill(); } public void fill(float x, float y, float z, float a) { - calc_color(x, y, z, a); - calc_fill(); + colorCalc(x, y, z, a); + colorFill(); } @@ -2498,8 +2498,10 @@ public class PGraphics extends PImage implements PConstants { throw new RuntimeException("ambient() can only be used with depth()"); } + ////////////////////////////////////////////////////////////// + public void specular(int rgb) { throw new RuntimeException("specular() can only be used with depth()"); } @@ -2524,8 +2526,10 @@ public class PGraphics extends PImage implements PConstants { throw new RuntimeException("shininess() can only be used with depth()"); } + ////////////////////////////////////////////////////////////// + public void emissive(int rgb) { throw new RuntimeException("emissive() can only be used with depth()"); } @@ -2538,8 +2542,10 @@ public class PGraphics extends PImage implements PConstants { throw new RuntimeException("emissive() can only be used with depth()"); } + ////////////////////////////////////////////////////////////// + public int createAmbientLight(int rgb) { throw new RuntimeException("createAmbientLight() can only be used with depth()"); } @@ -2621,33 +2627,33 @@ public class PGraphics extends PImage implements PConstants { stroke((float) rgb); } else { - calc_color_from(rgb); - calc_stroke(); + colorFrom(rgb); + colorStroke(); } } public void stroke(float gray) { - calc_color(gray); - calc_stroke(); + colorCalc(gray); + colorStroke(); } public void stroke(float gray, float alpha) { - calc_color(gray, alpha); - calc_stroke(); + colorCalc(gray, alpha); + colorStroke(); } public void stroke(float x, float y, float z) { - calc_color(x, y, z); - calc_stroke(); + colorCalc(x, y, z); + colorStroke(); } public void stroke(float x, float y, float z, float a) { - calc_color(x, y, z, a); - calc_stroke(); + colorCalc(x, y, z, a); + colorStroke(); } @@ -2665,23 +2671,23 @@ public class PGraphics extends PImage implements PConstants { background((float) rgb); } else { - calc_color_from(rgb); - calc_background(); + colorFrom(rgb); + colorBackground(); } clear(); } public void background(float gray) { - calc_color(gray); - calc_background(); + colorCalc(gray); + colorBackground(); clear(); } public void background(float x, float y, float z) { - calc_color(x, y, z); - calc_background(); + colorCalc(x, y, z); + colorBackground(); clear(); } @@ -2771,12 +2777,12 @@ public class PGraphics extends PImage implements PConstants { if (gray > 255) gray = 255; else if (gray < 0) gray = 0; return 0xff000000 | (gray << 16) | (gray << 8) | gray; } - calc_color(gray); + colorCalc(gray); return calcColor; } public final int color(float gray) { // ignore - calc_color(gray); + colorCalc(gray); return calcColor; } @@ -2789,12 +2795,12 @@ public class PGraphics extends PImage implements PConstants { return ((alpha & 0xff) << 24) | (gray << 16) | (gray << 8) | gray; } - calc_color(gray, alpha); + colorCalc(gray, alpha); return calcColor; } public final int color(float gray, float alpha) { // ignore - calc_color(gray, alpha); + colorCalc(gray, alpha); return calcColor; } @@ -2808,12 +2814,12 @@ public class PGraphics extends PImage implements PConstants { return 0xff000000 | (x << 16) | (y << 8) | z; } - calc_color(x, y, z); + colorCalc(x, y, z); return calcColor; } public final int color(float x, float y, float z) { // ignore - calc_color(x, y, z); + colorCalc(x, y, z); return calcColor; } @@ -2828,12 +2834,12 @@ public class PGraphics extends PImage implements PConstants { return (a << 24) | (x << 16) | (y << 8) | z; } - calc_color(x, y, z, a); + colorCalc(x, y, z, a); return calcColor; } public final int color(float x, float y, float z, float a) { // ignore - calc_color(x, y, z, a); + colorCalc(x, y, z, a); return calcColor; } diff --git a/core/PGraphics2.java b/core/PGraphics2.java index fb9378eab..1b0dac45b 100644 --- a/core/PGraphics2.java +++ b/core/PGraphics2.java @@ -925,19 +925,19 @@ public class PGraphics2 extends PGraphics { ////////////////////////////////////////////////////////////// - protected void calc_tint() { - super.calc_tint(); + protected void colorTint() { + super.colorTint(); // TODO actually implement tinted images tintColorObject = new Color(tintColor, true); } - protected void calc_fill() { - super.calc_fill(); + protected void colorFill() { + super.colorFill(); fillColorObject = new Color(fillColor, true); } - protected void calc_stroke() { - super.calc_stroke(); + protected void colorStroke() { + super.colorStroke(); strokeColorObject = new Color(strokeColor, true); } diff --git a/core/PGraphics3.java b/core/PGraphics3.java index b49c8c6b9..0929dcb6a 100644 --- a/core/PGraphics3.java +++ b/core/PGraphics3.java @@ -2720,21 +2720,21 @@ public class PGraphics3 extends PGraphics { } public void lightAmbient(int num, float x, float y, float z) { - calc_color(x, y, z); + colorCalc(x, y, z); lightDiffuseR[num] = calcR; lightDiffuseG[num] = calcG; lightDiffuseB[num] = calcB; } public void lightDiffuse(int num, float x, float y, float z) { - calc_color(x, y, z); + colorCalc(x, y, z); lightDiffuseR[num] = calcR; lightDiffuseG[num] = calcG; lightDiffuseB[num] = calcB; } public void lightSpecular(int num, float x, float y, float z) { - calc_color(x, y, z); + colorCalc(x, y, z); lightSpecularR[num] = calcR; lightSpecularG[num] = calcG; lightSpecularB[num] = calcB; @@ -2793,39 +2793,30 @@ public class PGraphics3 extends PGraphics { public void fill(int rgb) { super.fill(rgb); - calc_ambient(); + colorAmbient(); } public void fill(float gray) { super.fill(gray); - calc_ambient(); + colorAmbient(); } public void fill(float gray, float alpha) { super.fill(gray, alpha); - calc_ambient(); + colorAmbient(); } public void fill(float x, float y, float z) { super.fill(x, y, z); - calc_ambient(); + colorAmbient(); } public void fill(float x, float y, float z, float a) { super.fill(x, y, z, a); - calc_ambient(); - } - - private void calc_ambient() { - ambientR = calcR; - ambientG = calcG; - ambientB = calcB; - ambientRi = calcRi; - ambientGi = calcGi; - ambientBi = calcBi; + colorAmbient(); } @@ -2866,19 +2857,29 @@ public class PGraphics3 extends PGraphics { ambient((float) rgb); } else { - calc_color_from(rgb); - calc_ambient(); + colorFrom(rgb); + colorAmbient(); } } public void ambient(float gray) { - calc_color(gray); - calc_ambient(); + colorCalc(gray); + colorAmbient(); } public void ambient(float x, float y, float z) { - calc_color(x, y, z); - calc_ambient(); + colorCalc(x, y, z); + colorAmbient(); + } + + + private void colorAmbient() { + ambientR = calcR; + ambientG = calcG; + ambientB = calcB; + ambientRi = calcRi; + ambientGi = calcGi; + ambientBi = calcBi; } @@ -2890,36 +2891,36 @@ public class PGraphics3 extends PGraphics { specular((float) rgb); } else { - calc_color_from(rgb); - calc_specular(); + colorFrom(rgb); + colorSpecular(); } } public void specular(float gray) { - calc_color(gray); - calc_specular(); + colorCalc(gray); + colorSpecular(); } public void specular(float gray, float alpha) { - calc_color(gray, alpha); - calc_specular(); + colorCalc(gray, alpha); + colorSpecular(); } public void specular(float x, float y, float z) { - calc_color(x, y, z); - calc_specular(); + colorCalc(x, y, z); + colorSpecular(); } public void specular(float x, float y, float z, float a) { - calc_color(x, y, z, a); - calc_specular(); + colorCalc(x, y, z, a); + colorSpecular(); } - protected void calc_specular() { + protected void colorSpecular() { specularR = calcR; specularG = calcG; specularB = calcB; @@ -2939,22 +2940,25 @@ public class PGraphics3 extends PGraphics { emissive((float) rgb); } else { - calc_color_from(rgb); - calc_emissive(); + colorFrom(rgb); + colorEmissive(); } } + public void emissive(float gray) { - calc_color(gray); - calc_emissive(); + colorCalc(gray); + colorEmissive(); } + public void emissive(float x, float y, float z) { - calc_color(x, y, z); - calc_emissive(); + colorCalc(x, y, z); + colorEmissive(); } - protected void calc_emissive() { + + protected void colorEmissive() { emissiveR = calcR; emissiveG = calcG; emissiveB = calcB; @@ -2982,7 +2986,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color_from(rgb); + colorFrom(rgb); return internalCreateAmbientLight(calcR, calcG, calcB); } } @@ -2991,7 +2995,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(gray); + colorCalc(gray); return internalCreateAmbientLight(calcR, calcG, calcB); } @@ -2999,7 +3003,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(lr, lg, lb); + colorCalc(lr, lg, lb); return internalCreateAmbientLight(calcR, calcG, calcB); } @@ -3024,7 +3028,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color_from(rgb); + colorFrom(rgb); return internalCreateDirectionalLight(calcR, calcG, calcB, nx, ny, nz); } } @@ -3033,7 +3037,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(gray); + colorCalc(gray); return internalCreateDirectionalLight(calcR, calcG, calcB, nx, ny, nz); } @@ -3041,7 +3045,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(lr, lg, lb); + colorCalc(lr, lg, lb); return internalCreateDirectionalLight(calcR, calcG, calcB, nx, ny, nz); } @@ -3069,7 +3073,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color_from(rgb); + colorFrom(rgb); return internalCreatePointLight(calcR, calcG, calcB, x, y, z); } } @@ -3078,7 +3082,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(gray); + colorCalc(gray); return internalCreatePointLight(calcR, calcG, calcB, x, y, z); } @@ -3086,7 +3090,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(lr, lg, lb); + colorCalc(lr, lg, lb); return internalCreatePointLight(calcR, calcG, calcB, x, y, z); } @@ -3114,7 +3118,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color_from(rgb); + colorFrom(rgb); return internalCreateSpotLight(calcR, calcG, calcB, x, y, z, nx, ny, nz, angle); } } @@ -3123,7 +3127,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(gray); + colorCalc(gray); return internalCreateSpotLight(calcR, calcG, calcB, x, y, z, nx, ny, nz, angle); } @@ -3131,7 +3135,7 @@ public class PGraphics3 extends PGraphics { if (lightCount >= MAX_LIGHTS) { throw new RuntimeException("can only create " + MAX_LIGHTS + " lights"); } - calc_color(lr, lg, lb); + colorCalc(lr, lg, lb); return internalCreateSpotLight(calcR, calcG, calcB, x, y, z, nx, ny, nz, angle); } diff --git a/core/todo.txt b/core/todo.txt index 87b65d962..6f707eb2f 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -12,10 +12,16 @@ _ x, y not setting with processing _ y reversed in openGL _ fix messages referring to depth() +_ route all of them through a single function rather than current waste + +_ gl alpha on images when flipped around backwards +_ will sorting based on depth help this? also ask simon for ideas tweaking up simong light code _ why does diffuse just mirror fill()? -X just removed it +_ seems to cover just diffuse, not ambient_and_diffuse like fill +_ maybe fill() should set diffuse, and sep call to ambient() sets ambient? +X removed it _ remove/rename postSetup() stuff from PGraphics/PApplet _ what's up with resetLights? _ angleMode stuff is kinda overkill diff --git a/opengl/PGraphicsGL.java b/opengl/PGraphicsGL.java index 5be976aba..39f135f9b 100644 --- a/opengl/PGraphicsGL.java +++ b/opengl/PGraphicsGL.java @@ -701,9 +701,10 @@ public class PGraphicsGL extends PGraphics3 { syncMatrices(); } - ////////////////////////////////////////////////////////////// -/* + ////////////////////////////////////////////////////////////// + +/* public void endCamera() { //System.out.println("PGraphicsGL.endCamera() 1"); super.endCamera(); @@ -936,8 +937,8 @@ public class PGraphicsGL extends PGraphics3 { } */ - protected void calc_fill() { - super.calc_fill(); + protected void colorFill() { + super.colorFill(); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE, new float[] { calcR, calcG, calcB, calcA }); } diff --git a/todo.txt b/todo.txt index 91b1d4e3e..d44651e0a 100644 --- a/todo.txt +++ b/todo.txt @@ -13,6 +13,8 @@ X windows version was smashing it at the bottom when new prefs X don't allow saved window position to be outside the current display X change to how keywords are loaded +_ runtime exceptions have stopped coming through + _ moving an external window around a lot will halt the parent _ does move even need to be called? could just wait till stop? _ PdeMessageSiphon has problems with message()