api cleanup

This commit is contained in:
benfry
2005-04-09 02:39:48 +00:00
parent 7f1bd74306
commit bc13d43bf5
7 changed files with 187 additions and 184 deletions

View File

@@ -5556,15 +5556,15 @@ v PApplet.this.stop();
}
public void push() {
if (recorder != null) recorder.push();
g.push();
public void pushMatrix() {
if (recorder != null) recorder.pushMatrix();
g.pushMatrix();
}
public void pop() {
if (recorder != null) recorder.pop();
g.pop();
public void popMatrix() {
if (recorder != null) recorder.popMatrix();
g.popMatrix();
}

View File

@@ -1872,11 +1872,9 @@ public class PGraphics extends PImage implements PConstants {
// TRANSFORMATION MATRIX
public void push() {
public void pushMatrix() {
if (matrixStackDepth+1 == MATRIX_STACK_DEPTH) {
throw new RuntimeException("too many calls to push()");
//message(COMPLAINT, "matrix stack overflow, to much pushmatrix");
//return;
throw new RuntimeException("too many calls to pushMatrix()");
}
float mat[] = matrixStack[matrixStackDepth];
mat[0] = m00; mat[1] = m01; mat[2] = m02;
@@ -1885,12 +1883,10 @@ public class PGraphics extends PImage implements PConstants {
}
public void pop() {
public void popMatrix() {
if (matrixStackDepth == 0) {
throw new RuntimeException("too many calls to pop() " +
"(and not enough to push)");
//message(COMPLAINT, "matrix stack underflow, to many popmatrix");
//return;
throw new RuntimeException("too many calls to popMatrix() " +
"(and not enough to pushMatrix)");
}
matrixStackDepth--;
float mat[] = matrixStack[matrixStackDepth];

View File

@@ -674,9 +674,9 @@ public class PGraphics2 extends PGraphics {
//////////////////////////////////////////////////////////////
public void push() {
public void pushMatrix() {
if (transformCount == transformStack.length) {
throw new RuntimeException("push() cannot use push more than " +
throw new RuntimeException("pushMatrix() cannot use push more than " +
transformStack.length + " times");
}
transformStack[transformCount] = g2.getTransform();
@@ -684,9 +684,10 @@ public class PGraphics2 extends PGraphics {
}
public void pop() {
public void popMatrix() {
if (transformCount == 0) {
throw new RuntimeException("missing a pop() to go with that push()");
throw new RuntimeException("missing a popMatrix() " +
"to go with that pushMatrix()");
}
transformCount--;
g2.setTransform(transformStack[transformCount]);

View File

@@ -1462,10 +1462,6 @@ public class PGraphics3 extends PGraphics {
//}
}
private float dot(float ax, float ay, float az, float bx, float by, float bz) {
return ax * bx + ay * by + az * bz;
}
/**
* lighting calculation of final color.
@@ -2038,7 +2034,7 @@ public class PGraphics3 extends PGraphics {
}
int v1,v11,v2;
push();
pushMatrix();
if (x!=0f && y!=0f && z!=0f) translate(x,y,z);
scale(r);
@@ -2097,7 +2093,7 @@ public class PGraphics3 extends PGraphics {
normal(0, 1, 0);
vertex(0, 1, 0);
endShape();
pop();
popMatrix();
if (triangle != null) { // triangle is null in gl
triangle.setCulling(false);
@@ -2315,20 +2311,20 @@ public class PGraphics3 extends PGraphics {
// TRANSFORMATION MATRIX
public void push() {
public void pushMatrix() {
if (!modelview.push()) {
throw new RuntimeException("too many calls to push()");
throw new RuntimeException("too many calls to pushMatrix()");
}
// Do this to the inverse regardless of the lights to keep stack pointers
// in sync
// Do this to the inverse regardless of the lights
// to keep stack pointers in sync
inverseModelview.push();
}
public void pop() {
public void popMatrix() {
if (!modelview.pop()) {
throw new RuntimeException("too many calls to pop() " +
"(and not enough to push)");
throw new RuntimeException("too many calls to popMatrix() " +
"(and not enough to pushMatrix)");
}
// Do this to the inverse regardless of the lights
// to keep stack pointers in sync
@@ -2336,17 +2332,13 @@ public class PGraphics3 extends PGraphics {
}
//public void resetProjection() {
//projection.reset();
//}
/**
* Load identity as the transform/model matrix.
* Same as glLoadIdentity().
*/
public void resetMatrix() {
forwardTransform.identity(); //reset();
reverseTransform.identity(); //reset();
forwardTransform.reset();
reverseTransform.reset();
}
@@ -2967,11 +2959,13 @@ public class PGraphics3 extends PGraphics {
}
}
public void ambient(float gray) {
colorCalc(gray);
colorAmbient();
}
public void ambient(float x, float y, float z) {
colorCalc(x, y, z);
colorAmbient();
@@ -3001,6 +2995,7 @@ public class PGraphics3 extends PGraphics {
}
}
public void specular(float gray) {
colorCalc(gray);
colorSpecular();
@@ -3264,6 +3259,7 @@ public class PGraphics3 extends PGraphics {
return lightCount-1;
}
//////////////////////////////////////////////////////////////
// MATH (internal use only)
@@ -3319,5 +3315,10 @@ public class PGraphics3 extends PGraphics {
//if (angleMode == DEGREES) angle *= DEG_TO_RAD;
return (float)Math.tan(angle);
}
private float dot(float ax, float ay, float az,
float bx, float by, float bz) {
return ax * bx + ay * by + az * bz;
}
}

View File

@@ -8,7 +8,7 @@ public final class PMatrix implements PConstants {
public float m20, m21, m22, m23;
public float m30, m31, m32, m33;
float reset[];
//float reset[];
final static int DEFAULT_STACK_DEPTH = 0;
int maxStackDepth;
@@ -50,7 +50,7 @@ public final class PMatrix implements PConstants {
}
public void identity() {
public void reset() {
set(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
@@ -58,6 +58,7 @@ public final class PMatrix implements PConstants {
}
/*
public void reset() {
if (reset == null) {
identity();
@@ -80,6 +81,7 @@ public final class PMatrix implements PConstants {
reset[8] = m20; reset[9] = m21; reset[10] = m22; reset[11] = m23;
reset[12] = m30; reset[13] = m31; reset[14] = m32; reset[15] = m33;
}
*/
public void clearStack() {
@@ -311,24 +313,26 @@ public final class PMatrix implements PConstants {
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
apply(n00, n01, n02, n03, n10, n11, n12, n13,
n20, n21, n22, n23, n30, n31, n32, n33);
apply(n00, n01, n02, n03,
n10, n11, n12, n13,
n20, n21, n22, n23,
n30, n31, n32, n33);
}
public void preApply(PMatrix lhs) {
preApply(lhs.m00, lhs.m01, lhs.m02, lhs.m03,
lhs.m10, lhs.m11, lhs.m12, lhs.m13,
lhs.m20, lhs.m21, lhs.m22, lhs.m23,
lhs.m30, lhs.m31, lhs.m32, lhs.m33);
lhs.m10, lhs.m11, lhs.m12, lhs.m13,
lhs.m20, lhs.m21, lhs.m22, lhs.m23,
lhs.m30, lhs.m31, lhs.m32, lhs.m33);
}
// for inverse operations, like multiplying the matrix on the left
public void preApply(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
float r00 = n00*m00 + n01*m10 + n02*m20 + n03*m30;
float r01 = n00*m01 + n01*m11 + n02*m21 + n03*m31;
@@ -367,9 +371,9 @@ public final class PMatrix implements PConstants {
public boolean invApply(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33) {
PMatrix copy = new PMatrix(n00, n01, n02, n03,
n10, n11, n12, n13,
n20, n21, n22, n23,
@@ -383,9 +387,9 @@ public final class PMatrix implements PConstants {
public void apply(PMatrix rhs) {
apply(rhs.m00, rhs.m01, rhs.m02, rhs.m03,
rhs.m10, rhs.m11, rhs.m12, rhs.m13,
rhs.m20, rhs.m21, rhs.m22, rhs.m23,
rhs.m30, rhs.m31, rhs.m32, rhs.m33);
rhs.m10, rhs.m11, rhs.m12, rhs.m13,
rhs.m20, rhs.m21, rhs.m22, rhs.m23,
rhs.m30, rhs.m31, rhs.m32, rhs.m33);
}
@@ -510,13 +514,11 @@ public final class PMatrix implements PConstants {
float determinant = determinant();
if (determinant != 0) {
/*
* m00 m01 m02 m03
* m10 m11 m12 m13
* m20 m21 m22 m23
* m30 m31 m32 m33
*/
float determinant_inv = 1f/determinant;
// m00 m01 m02 m03
// m10 m11 m12 m13
// m20 m21 m22 m23
// m30 m31 m32 m33
float determinant_inv = 1f / determinant;
// first row
float t00 = determinant3x3(m11, m12, m13, m21, m22, m23, m31, m32, m33);

View File

@@ -3,9 +3,55 @@ X fix double key events
X fix mrj.version security error on the pc
X set() fixes for PGraphics2 and setImpl inside PGraphics
X remove angleMode (also from PMatrix classes)
X remove/rename postSetup() stuff from PGraphics/PApplet
X camera(), perspective(), ortho()
X matrix set by the camera on each beginFrame
lighting stuff
X make fill() cover ambient and diffuse
X provide separate call for ambient to shut it off
o why does diffuse just mirror fill()?
o seems to cover just diffuse, not ambient_and_diffuse like fill
o maybe fill() should set diffuse, and sep call to ambient() sets ambient?
X removed it
X move dot() to the bottom w/ the other math
already done
X remove PMethods as actual class, use recordFrame(PGraphics)
X size(200, 200, "processing.illustrator.PGraphicsAI");
_ make the 1.4 code in PApplet load via reflection
tweaking up simong light code
_ what's up with resetLights?
_ add PLight object to avoid method overflow
_ preApplyMatrix, invApplyMatrix?
_ applyMatrixPre and applyMatrixIn
_ rotateXInv is ugly..
_ irotateX?, papplyMatrix?
_ fix bezierVertex() for newer api
_ fix messages referring to depth()
_ route all of them through a single function rather than current waste
_ fix the flicker in java2d mode
X is it because the lock was taken off (g) in PApplet?
_ don't let users on < 1.3 load JAVA2D, or < 1.4 load OPENGL
_ track loadImage() with filenames that are inconsistent
_ really a problem with the ves61r kids
_ i.e. mixed case filename in sketch is different in windows
_ but when uploaded to a unix server causes a serious problem
_ use canonicalPath to flag possible problems
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1096508877;start=5
_ detect problems with caps (really a problem with the ves61r kids)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NOT NECESSARY BEFORE BETA
_ make get/getImpl for PGraphics/PGraphics2
@@ -23,37 +69,13 @@ _ otherwise no good way to color textures
_ textMode(SCREEN) having issues
_ fix bezierVertex() for newer api
_ set(x, y, image)
_ 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()?
_ 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?
_ move dot() to the bottom w/ the other math
_ add PLight object to avoid method overflow
_ preApplyMatrix, invApplyMatrix?
_ applyMatrixPre and applyMatrixIn
_ rotateXInv is ugly..
_ irotateX?, papplyMatrix?
_ fix the flicker in java2d mode
X is it because the lock was taken off (g) in PApplet?
_ don't let users on < 1.3 load JAVA2D, or < 1.4 load OPENGL
_ cellular automata examples broken
_ gl smoothing.. how to disable polygon but keep line enabled
@@ -81,12 +103,6 @@ _ The ref in PSound2 says volume accepts vals from 0...1
_ but values larger than one increase the volume.
_ SoundEvent // is sound finished?? Can't access now.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
BETA
_ get PGraphics.java engine working again
_ don't grab pixels of java2d images unless asked
@@ -97,8 +113,6 @@ _ if (modified) don't loadPixels again, just ignore it
_ make a note that updatePixels() only sets a flag in PImage
_ (but not PGraphics, which does it immediately)
_ remove PMethods as actual class, use recordFrame(PGraphics)
_ size(200, 200, "processing.illustrator.PGraphicsAI");
_ make vertexCount etc properly accessible in PGraphics3
_ so that people can do things like the dxf renderer
@@ -132,12 +146,6 @@ _ background color seems to be wrong?
_ check this once lighting actually works
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NOT NECESSARY BEFORE BETA
PApplet
_ printarr() of null array crashes without an error
_ actually, errors from many crashes not coming through on the mac?

163
todo.txt
View File

@@ -1,64 +1,20 @@
0083 pde
X move everything to packages, and start auto-javadoc
X how to get preproc to automatically prepend packages
o only build preproc from preproc/make.sh?
o and check in the preproc'd code to cvs?
X need to add classes dir to cp for jikes make (on win and linux)
X get both versions of size() properly detected on export
_ need to add classes dir to cp for jikes make (on win and linux)
_ how to get preproc to automatically prepend packages
_ only build preproc from preproc/make.sh?
_ and check in the preproc'd code to cvs?
fixed in 82
X border weirdness in PdeEditor panels on windows
_ npe is a runtimeex, so any npe in setup comes up weird
_ maybe the renderer exception is something different? newrendex?
_ why is gl being added on export, no matter what? or is it?
_ get both versions of size() properly detected on export
_ external apps don't stop at all when 'stop' is hit
_ worker thread is halting the app ala code folder bug
_ could this be dealt with by using nio?
_ host environment will be running 1.4 so...
_ runtime exceptions have stopped coming through (on pc only?)
_ 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()
_ external apps also seem to not do newlines properly on exceptions
_ appendText launches a new thread for every blip of text
_ this is totally wrong and really horks things
_ fishwick library export duplication stuff
_ remove PdeXxx prefixes on names, make PdeBase into just "Processing"
_ make a linux version
_ need to fix up the make/dist scripts for linux
_ saved window positions.. if displays has changed, becomes a problem
_ record the display that it was on?
_ GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice();
_ make sure that the applet is within the bounds of the current display?
_ (from 0, 0 to width, height)
_ make note that changing screen config requires restart of processing
_ static { checkScreens(); }
_ static void PApplet.checkScreens() { }
_ to run explicitly later
_ this seems too complicated.. just make people restart
_ ability to select monitor via preferences panel
_ this applies to any applet that's run externally currently (verify)
_ make it also work with anything that's run inside of p5 itself
_ check current present code with multiple monitors
_ if it's working, make it all reflection-based in PApplet
_ first pass on full screen
_ exceptions in full screen mode will quit the app completely
_ (can't keep window open because things are hosed)
_ default is that full screen app doesn't cover multiple displays
_ this is fine since opengl can't usually go across both
_ but include an example for how to use full in gl
_ (use toolkit.getscreensize)
_ move everything to packages, and start auto-javadoc
_ remove PdeXxx prefixes on names, make PdeBase into just "Processing"
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -80,31 +36,6 @@ _ lib could call queueEvent with the args
_ then call them inside post()
_ scrubbing all the code to include proper license and copyright info
Not sure what triggers it, possibly scrolling with mousewheel?, but
sometimes Processing output window gets stuck thinking it should
scroll to the top, so if you have an output larger than the allowable
space, it will show you the last line, but then pops the scrollbar
back to the top. I think the only way to stop it is to quit out of
processing and relaunch.
_ update checker (can be turned off in prefs)
_ send unique id, and information about person's java vm/platform
_ using timezone would be an interesting method for tracking location
_ border weirdness in PdeEditor panels on windows
_ stop() not working very well
_ doesn't seem to actually be stopping things
_ closing window w/o first hitting stop() causes freak out
_ opengl gives an OutOfMemoryError
_ java2d just goes into a lock
_ could also be code that's in an infinite loop (i.e. text error)
_ which then causes a full lock
_ something really bad happened with println() in this release
_ perhaps only without a code folder and/or running in java2d mode?
_ this may also be what's hosing
//
SAVE AS BUGS
@@ -144,6 +75,76 @@ saving a project over an already existing project does not get rid of the .pde f
NOT NECESSARY BEFORE BETA
_ update checker (can be turned off in prefs)
_ send unique id, and information about person's java vm/platform
_ using timezone would be an interesting method for tracking location
_ stop() not working very well
_ doesn't seem to actually be stopping things
_ closing window w/o first hitting stop() causes freak out
_ opengl gives an OutOfMemoryError
_ java2d just goes into a lock
_ could also be code that's in an infinite loop (i.e. text error)
_ which then causes a full lock
_ something really bad happened with println() in this release
_ perhaps only without a code folder and/or running in java2d mode?
_ this may also be what's hosing
Not sure what triggers it, possibly scrolling with mousewheel?, but
sometimes Processing output window gets stuck thinking it should
scroll to the top, so if you have an output larger than the allowable
space, it will show you the last line, but then pops the scrollbar
back to the top. I think the only way to stop it is to quit out of
processing and relaunch.
_ saved window positions.. if displays has changed, becomes a problem
_ record the display that it was on?
_ GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice();
_ make sure that the applet is within the bounds of the current display?
_ (from 0, 0 to width, height)
_ make note that changing screen config requires restart of processing
_ static { checkScreens(); }
_ static void PApplet.checkScreens() { }
_ to run explicitly later
_ this seems too complicated.. just make people restart
_ ability to select monitor via preferences panel
_ this applies to any applet that's run externally currently (verify)
_ make it also work with anything that's run inside of p5 itself
_ check current present code with multiple monitors
_ first pass on full screen
_ exceptions in full screen mode will quit the app completely
_ (can't keep window open because things are hosed)
_ default is that full screen app doesn't cover multiple displays
_ this is fine since opengl can't usually go across both
_ but include an example for how to use full in gl
_ (use toolkit.getscreensize)
_ fishwick library export duplication stuff
_ runtime exceptions have stopped coming through (on pc only?)
_ npe is a runtimeex, so any npe in setup comes up weird
_ maybe the renderer exception is something different? newrendex?
_ why is gl being added on export, no matter what? or is it?
_ sketch folder not really being emptied on export
_ so old libs will just perpetuate themselves
_ external apps don't stop at all when 'stop' is hit
_ worker thread is halting the app ala code folder bug
_ could this be dealt with by using nio?
_ host environment will be running 1.4 so...
_ 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()
_ external apps also seem to not do newlines properly on exceptions
_ appendText launches a new thread for every blip of text
_ this is totally wrong and really horks things
_ split Preferences and PreferencesFrame ?
_ lock the minimum size for the main processing editor frame
@@ -210,12 +211,6 @@ _ subfolders in the 'data' directory don't work
_ don't allow goofy case versions of reserved words
_ keypressed should maybe throw an error
_ track loadImage() with filenames that are inconsistent
_ i.e. mixed case filename in sketch is different in windows
_ but when uploaded to a unix server causes a serious problem
_ use canonicalPath to flag possible problems
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1096508877;start=5
_ mouse wheel broken in the text editor? (windows jdk 1.5?)