more moving things around

This commit is contained in:
benfry
2004-11-16 17:22:41 +00:00
parent 4bd0a99028
commit 3dcba2943d
5 changed files with 1609 additions and 2118 deletions

View File

@@ -4269,8 +4269,8 @@ public class PApplet extends Applet
}
public void texture(PImage image) {
g.texture(image);
public void normal(float nx, float ny, float nz) {
g.normal(nx, ny, nz);
}
@@ -4279,8 +4279,8 @@ public class PApplet extends Applet
}
public void normal(float nx, float ny, float nz) {
g.normal(nx, ny, nz);
public void texture(PImage image) {
g.texture(image);
}
@@ -4362,12 +4362,6 @@ public class PApplet extends Applet
}
public void quad(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4) {
g.quad(x1, y1, x2, y2, x3, y3, x4, y4);
}
public void rectMode(int mode) {
g.rectMode(mode);
}
@@ -4378,6 +4372,40 @@ public class PApplet extends Applet
}
public void quad(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4) {
g.quad(x1, y1, x2, y2, x3, y3, x4, y4);
}
public void image(PImage image, float x1, float y1) {
g.image(image, x1, y1);
}
public void image(PImage image,
float x1, float y1, float x2, float y2) {
g.image(image, x1, y1, x2, y2);
}
public void image(PImage image,
float x1, float y1, float x2, float y2,
float u1, float v1, float u2, float v2) {
g.image(image, x1, y1, x2, y2, u1, v1, u2, v2);
}
public void cache(PImage image) {
g.cache(image);
}
public void cache(PImage images[]) {
g.cache(images);
}
public void ellipseMode(int mode) {
g.ellipseMode(mode);
}
@@ -4388,31 +4416,6 @@ public class PApplet extends Applet
}
public void box(float size) {
g.box(size);
}
public void box(float w, float h, float d) {
g.box(w, h, d);
}
public void sphereDetail(int res) {
g.sphereDetail(res);
}
public void sphere(float r) {
g.sphere(r);
}
public void sphere(float x, float y, float z, float r) {
g.sphere(x, y, z, r);
}
public float bezierPoint(float a, float b, float c, float d,
float t) {
return g.bezierPoint(a, b, c, d, t);
@@ -4484,31 +4487,28 @@ public class PApplet extends Applet
}
public void image(PImage image, float x1, float y1) {
g.image(image, x1, y1);
public void box(float size) {
g.box(size);
}
public void image(PImage image,
float x1, float y1, float x2, float y2) {
g.image(image, x1, y1, x2, y2);
public void box(float w, float h, float d) {
g.box(w, h, d);
}
public void image(PImage image,
float x1, float y1, float x2, float y2,
float u1, float v1, float u2, float v2) {
g.image(image, x1, y1, x2, y2, u1, v1, u2, v2);
public void sphereDetail(int res) {
g.sphereDetail(res);
}
public void cache(PImage image) {
g.cache(image);
public void sphere(float r) {
g.sphere(r);
}
public void cache(PImage images[]) {
g.cache(images);
public void sphere(float x, float y, float z, float r) {
g.sphere(x, y, z, r);
}
@@ -4592,119 +4592,6 @@ public class PApplet extends Applet
}
public void push() {
g.push();
}
public void pop() {
g.pop();
}
public void resetMatrix() {
g.resetMatrix();
}
public void applyMatrix(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) {
g.applyMatrix(n00, n01, n02, n03, n10, n11, n12, n13, n20, n21, n22, n23, n30, n31, n32, n33);
}
public void printMatrix() {
g.printMatrix();
}
public void beginCamera() {
g.beginCamera();
}
public void cameraMode(int mode) {
g.cameraMode(mode);
}
public void endCamera() {
g.endCamera();
}
public void printCamera() {
g.printCamera();
}
public float screenX(float x, float y) {
return g.screenX(x, y);
}
public float screenY(float x, float y) {
return g.screenY(x, y);
}
public float screenX(float x, float y, float z) {
return g.screenX(x, y, z);
}
public float screenY(float x, float y, float z) {
return g.screenY(x, y, z);
}
public float screenZ(float x, float y, float z) {
return g.screenZ(x, y, z);
}
public float objectX(float x, float y, float z) {
return g.objectX(x, y, z);
}
public float objectY(float x, float y, float z) {
return g.objectY(x, y, z);
}
public float objectZ(float x, float y, float z) {
return g.objectZ(x, y, z);
}
public void ortho(float left, float right,
float bottom, float top,
float near, float far) {
g.ortho(left, right, bottom, top, near, far);
}
public void perspective(float fovy, float aspect, float zNear, float zFar) {
g.perspective(fovy, aspect, zNear, zFar);
}
public void frustum(float left, float right, float bottom,
float top, float znear, float zfar) {
g.frustum(left, right, bottom, top, znear, zfar);
}
public void lookat(float eyeX, float eyeY, float eyeZ,
float centerX, float centerY, float centerZ,
float upX, float upY, float upZ) {
g.lookat(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
}
public void angleMode(int mode) {
g.angleMode(mode);
}
@@ -4768,6 +4655,125 @@ public class PApplet extends Applet
}
public void push() {
g.push();
}
public void pop() {
g.pop();
}
public void resetMatrix() {
g.resetMatrix();
}
public void applyMatrix(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) {
g.applyMatrix(n00, n01, n02, n03, n10, n11, n12, n13, n20, n21, n22, n23, n30, n31, n32, n33);
}
public void applyMatrix(float n00, float n01, float n02,
float n10, float n11, float n12) {
g.applyMatrix(n00, n01, n02, n10, n11, n12);
}
public void printMatrix() {
g.printMatrix();
}
public void cameraMode(int mode) {
g.cameraMode(mode);
}
public void beginCamera() {
g.beginCamera();
}
public void endCamera() {
g.endCamera();
}
public void ortho(float left, float right,
float bottom, float top,
float near, float far) {
g.ortho(left, right, bottom, top, near, far);
}
public void perspective(float fovy, float aspect, float zNear, float zFar) {
g.perspective(fovy, aspect, zNear, zFar);
}
public void frustum(float left, float right, float bottom,
float top, float znear, float zfar) {
g.frustum(left, right, bottom, top, znear, zfar);
}
public void lookat(float eyeX, float eyeY, float eyeZ,
float centerX, float centerY, float centerZ,
float upX, float upY, float upZ) {
g.lookat(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
}
public void printCamera() {
g.printCamera();
}
public float screenX(float x, float y) {
return g.screenX(x, y);
}
public float screenY(float x, float y) {
return g.screenY(x, y);
}
public float screenX(float x, float y, float z) {
return g.screenX(x, y, z);
}
public float screenY(float x, float y, float z) {
return g.screenY(x, y, z);
}
public float screenZ(float x, float y, float z) {
return g.screenZ(x, y, z);
}
public float objectX(float x, float y, float z) {
return g.objectX(x, y, z);
}
public float objectY(float x, float y, float z) {
return g.objectY(x, y, z);
}
public float objectZ(float x, float y, float z) {
return g.objectZ(x, y, z);
}
public void colorMode(int mode) {
g.colorMode(mode);
}

View File

@@ -420,7 +420,7 @@ public class PFont implements PConstants {
boolean savedStroke = parent.stroke;
parent.textureMode = IMAGE_SPACE;
parent.drawing_text = true;
//parent.drawing_text = true;
parent.stroke = false;
float x1 = x + lextent * size;
@@ -446,7 +446,7 @@ public class PFont implements PConstants {
parent.endShape();
parent.textureMode = savedTextureMode;
parent.drawing_text = false;
//parent.drawing_text = false;
parent.stroke = savedStroke;
} else { // SCREEN_SPACE

File diff suppressed because it is too large Load Diff

View File

@@ -58,11 +58,11 @@ public interface PMethods {
public void beginShape(int kind);
public void texture(PImage image);
public void normal(float nx, float ny, float nz);
public void textureMode(int mode);
public void normal(float nx, float ny, float nz);
public void texture(PImage image);
public void vertex(float x, float y);
@@ -97,27 +97,30 @@ public interface PMethods {
public void triangle(float x1, float y1, float x2, float y2,
float x3, float y3);
public void quad(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4);
public void rectMode(int mode);
public void rect(float x1, float y1, float x2, float y2);
public void quad(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4);
public void image(PImage image, float x1, float y1);
public void image(PImage image,
float x1, float y1, float x2, float y2);
public void image(PImage image,
float x1, float y1, float x2, float y2,
float u1, float v1, float u2, float v2);
public void cache(PImage image);
public void cache(PImage images[]);
public void ellipseMode(int mode);
public void ellipse(float x, float y, float hradius, float vradius);
public void box(float size);
public void box(float w, float h, float d);
public void sphereDetail(int res);
public void sphere(float r);
public void sphere(float x, float y, float z, float r);
public float bezierPoint(float a, float b, float c, float d,
float t);
@@ -156,18 +159,15 @@ public interface PMethods {
float x3, float y3, float z3,
float x4, float y4, float z4);
public void image(PImage image, float x1, float y1);
public void box(float size);
public void image(PImage image,
float x1, float y1, float x2, float y2);
public void box(float w, float h, float d);
public void image(PImage image,
float x1, float y1, float x2, float y2,
float u1, float v1, float u2, float v2);
public void sphereDetail(int res);
public void cache(PImage image);
public void sphere(float r);
public void cache(PImage images[]);
public void sphere(float x, float y, float z, float r);
public void textFont(PFont which);
@@ -201,56 +201,6 @@ public interface PMethods {
public void text(float num, float x, float y, float z);
public void push();
public void pop();
public void resetMatrix();
public void applyMatrix(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);
public void printMatrix();
public void beginCamera();
public void cameraMode(int mode);
public void endCamera();
public void printCamera();
public float screenX(float x, float y);
public float screenY(float x, float y);
public float screenX(float x, float y, float z);
public float screenY(float x, float y, float z);
public float screenZ(float x, float y, float z);
public float objectX(float x, float y, float z);
public float objectY(float x, float y, float z);
public float objectZ(float x, float y, float z);
public void ortho(float left, float right,
float bottom, float top,
float near, float far);
public void perspective(float fovy, float aspect, float zNear, float zFar);
public void frustum(float left, float right, float bottom,
float top, float znear, float zfar);
public void lookat(float eyeX, float eyeY, float eyeZ,
float centerX, float centerY, float centerZ,
float upX, float upY, float upZ);
public void angleMode(int mode);
public void translate(float tx, float ty);
@@ -278,6 +228,59 @@ public interface PMethods {
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33);
public void push();
public void pop();
public void resetMatrix();
public void applyMatrix(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);
public void applyMatrix(float n00, float n01, float n02,
float n10, float n11, float n12);
public void printMatrix();
public void cameraMode(int mode);
public void beginCamera();
public void endCamera();
public void ortho(float left, float right,
float bottom, float top,
float near, float far);
public void perspective(float fovy, float aspect, float zNear, float zFar);
public void frustum(float left, float right, float bottom,
float top, float znear, float zfar);
public void lookat(float eyeX, float eyeY, float eyeZ,
float centerX, float centerY, float centerZ,
float upX, float upY, float upZ);
public void printCamera();
public float screenX(float x, float y);
public float screenY(float x, float y);
public float screenX(float x, float y, float z);
public float screenY(float x, float y, float z);
public float screenZ(float x, float y, float z);
public float objectX(float x, float y, float z);
public float objectY(float x, float y, float z);
public float objectZ(float x, float y, float z);
public void colorMode(int mode);
public void colorMode(int mode, float max);

View File

@@ -4,8 +4,8 @@
PPolygon - zbuffer polygon rendering object for BGraphics
Part of the Processing project - http://Proce55ing.net
Copyright (c) 2001-03
Ben Fry, Massachusetts Institute of Technology and
Copyright (c) 2001-03
Ben Fry, Massachusetts Institute of Technology and
Casey Reas, Interaction Design Institute Ivrea
This library is free software; you can redistribute it and/or
@@ -18,9 +18,9 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
@@ -32,7 +32,7 @@ public class PPolygon implements PConstants {
float vertices[][] = new float[DEFAULT_SIZE][VERTEX_FIELD_COUNT];
int vertexCount;
// really this is "debug" but..
// really this is "debug" but..
static final boolean FRY = false;
// after some fiddling, this seems to produce the best results
@@ -60,10 +60,10 @@ public class PPolygon implements PConstants {
PGraphics parent;
int pixels[];
// the parent's width/height,
// the parent's width/height,
// or if smoothing is enabled, parent's w/h scaled
// up by the smoothing dimension
int width, height;
int width, height;
int width1, height1;
PImage timage;
@@ -115,7 +115,7 @@ public class PPolygon implements PConstants {
public float[] nextVertex() {
if (vertexCount == vertices.length) {
//parent.message(CHATTER, "re-allocating for " +
//parent.message(CHATTER, "re-allocating for " +
// (vertexCount*2) + " vertices");
float temp[][] = new float[vertexCount<<1][VERTEX_FIELD_COUNT];
System.arraycopy(vertices, 0, temp, 0, vertexCount);
@@ -180,8 +180,8 @@ public class PPolygon implements PConstants {
// by default, text turns on smoothing for the textures
// themselves. but this should be shut off if the hint
// for DISABLE_TEXT_SMOOTH is set.
texture_smooth = (parent.drawing_text &&
// for DISABLE_TEXT_SMOOTH is set.
texture_smooth = (//parent.drawing_text &&
!parent.hints[DISABLE_TEXT_SMOOTH]);
width = smoothing ? parent.width*SUBXRES : parent.width;
@@ -200,7 +200,7 @@ public class PPolygon implements PConstants {
}
for (int i = 0; i < vertexCount; i++) {
r[i] = 0; dr[i] = 0; l[i] = 0; dl[i] = 0;
r[i] = 0; dr[i] = 0; l[i] = 0; dl[i] = 0;
}
// hack to not make polygons fly into the screen
@@ -243,12 +243,12 @@ public class PPolygon implements PConstants {
// necessarily be 8 rows of subpixel lines that will force
// the final line to render. so instead, the algo keeps track
// of the lastY (in subpixel resolution) that will be rendered
// and that will force a scanline to happen the same as
// and that will force a scanline to happen the same as
// every eighth in the other situations
//lastY = -1; // fry 031001
lastY = (int) (ymax - 0.5f); // global to class bc used by other fxns
int lefti = topi; // li, index of left vertex
int lefti = topi; // li, index of left vertex
int righti = topi; // ri, index of right vertex
int y = (int) (ymin + 0.5f); // current scan line
int lefty = y - 1; // lower end of left edge
@@ -273,7 +273,7 @@ public class PPolygon implements PConstants {
// advance right edge?
while ((righty <= y) && (remaining > 0)) {
remaining--;
remaining--;
// step cw down right edge
int i = (righti != vertexCount-1) ? (righti + 1) : 0;
incrementalize_y(vertices[righti], vertices[i], r, dr, y);
@@ -395,8 +395,8 @@ public class PPolygon implements PConstants {
// map texture based on U, V coords in sp[U] and sp[V]
if (interpUV) {
int tu = (int)sp[U];
int tv = (int)sp[V];
int tu = (int)sp[U];
int tv = (int)sp[V];
if (tu > twidth1) tu = twidth1;
if (tv > theight1) tv = theight1;
@@ -459,7 +459,7 @@ public class PPolygon implements PConstants {
px0 = (p00*tuf + p10*tuf1) >> 8;
px1 = (p01*tuf + p11*tuf1) >> 8;
tr = (((px0*tvf + px1*tvf1) >> 8) *
tr = (((px0*tvf + px1*tvf1) >> 8) *
(interpRGBA ? ((int) sp[R]*255) : r2)) >> 8;
@@ -470,7 +470,7 @@ public class PPolygon implements PConstants {
px0 = (p00*tuf + p10*tuf1) >> 8;
px1 = (p01*tuf + p11*tuf1) >> 8;
tg = (((px0*tvf + px1*tvf1) >> 8) *
tg = (((px0*tvf + px1*tvf1) >> 8) *
(interpRGBA ? ((int) sp[G]*255) : g2)) >> 8;
@@ -481,7 +481,7 @@ public class PPolygon implements PConstants {
px0 = (p00*tuf + p10*tuf1) >> 8;
px1 = (p01*tuf + p11*tuf1) >> 8;
tb = (((px0*tvf + px1*tvf1) >> 8) *
tb = (((px0*tvf + px1*tvf1) >> 8) *
(interpRGBA ? ((int) sp[B]*255) : b2)) >> 8;
} else { // alpha image, only use current fill color
@@ -498,7 +498,7 @@ public class PPolygon implements PConstants {
}
// get coverage for pixel if smoothing
// checks smoothing again here because of
// checks smoothing again here because of
// hints[SMOOTH_IMAGES] used up above
int weight = smoothing ? coverage(x) : 255;
if (weight != 255) ta = ta*weight >> 8;
@@ -556,7 +556,7 @@ public class PPolygon implements PConstants {
int g1 = (pixels[offset+x] >> 8) & 0xff;
int b1 = (pixels[offset+x]) & 0xff;
pixels[offset+x] = 0xff000000 |
pixels[offset+x] = 0xff000000 |
(((tr*ta + r1*a1) >> 8) << 16) |
((tg*ta + g1*a1) & 0xff00) |
((tb*ta + b1*a1) >> 8);
@@ -593,7 +593,7 @@ public class PPolygon implements PConstants {
pixels[offset+x] = (0xff000000 |
((r1*a1 + r2*a2) >> 8) << 16 |
// use & instead of >> and << below
((g1*a1 + g2*a2) >> 8) << 8 |
((g1*a1 + g2*a2) >> 8) << 8 |
((b1*a1 + b2*a2) >> 8));
if (a2 > ZBUFFER_MIN_COVERAGE) zbuffer[offset+x] = sp[Z];
@@ -601,7 +601,7 @@ public class PPolygon implements PConstants {
}
}
// if smoothing enabled, don't increment values
// for the pixel in the stretch out version
// for the pixel in the stretch out version
// of the scanline used to get smooth edges.
if (!smoothing || ((x >= truelx) && (x <= truerx))) {
increment(sp, sdp);
@@ -629,7 +629,7 @@ public class PPolygon implements PConstants {
continue;
}
// does this need a +1 ?
amt += ((aaright[i] < pixelRight ? aaright[i] : pixelRight) -
amt += ((aaright[i] < pixelRight ? aaright[i] : pixelRight) -
(aaleft[i] > pixelLeft ? aaleft[i] : pixelLeft));
}
amt <<= 2;
@@ -686,7 +686,7 @@ public class PPolygon implements PConstants {
if (delta == 0) delta = ONE;
float fraction = x + HALF - p1[X];
if (smoothing) {
delta /= SUBXRES;
delta /= SUBXRES;
fraction /= SUBXRES;
}