diff --git a/processing/app/ProcessingApplet.java b/processing/app/ProcessingApplet.java index 560f01179..f39352cf8 100644 --- a/processing/app/ProcessingApplet.java +++ b/processing/app/ProcessingApplet.java @@ -489,22 +489,6 @@ public class ProcessingApplet extends Applet */ - // ------------------------------------------------------------ - - - public void rotateX(float angle) { - g.rotate(angle, 1, 0, 0); - } - - public void rotateY(float angle) { - g.rotate(angle, 0, 1, 0); - } - - public void rotateZ(float angle) { - g.rotate(angle, 0, 0, 1); - } - - // ------------------------------------------------------------ // math stuff for convenience @@ -591,253 +575,367 @@ public class ProcessingApplet extends Applet // ------------------------------------------------------------ + // public functions from bagel + public void beginFrame() { g.beginFrame(); } + + public void clear() { + g.clear(); + } + + public void endFrame() { g.endFrame(); } + public void beginShape(int kind) { g.beginShape(kind); } + public void textureImage(BagelImage image) { g.textureImage(image); } + public void vertexTexture(float u, float v) { g.vertexTexture(u, v); } + public void vertexNormal(float nx, float ny, float nz) { g.vertexNormal(nx, ny, nz); } + public void vertex(float x, float y) { g.vertex(x, y); } + public void vertex(float x, float y, float z) { g.vertex(x, y, z); } + + public void bezierVertex(float x, float y) { + g.bezierVertex(x, y); + } + + + public void catmullRomVertex(float x, float y) { + g.catmullRomVertex(x, y); + } + + public void endShape() { g.endShape(); } + public void point(float x, float y) { g.point(x, y); } + public void point(float x, float y, float z) { g.point(x, y, z); } + public void line(float x1, float y1, float x2, float y2) { g.line(x1, y1, x2, y2); } + public void line(float x1, float y1, float z1, float x2, float y2, float z2) { g.line(x1, y1, z1, x2, y2, z2); } - public void bezierCurve(float x1, float y1, float x2, float y2, - float x3, float y3, float x4, float y4) { - g.bezierCurve(x1, y1, x2, y2, x3, y3, x4, y4); - } - - public void drawBezier(float inX[], float inY[]) { - g.drawBezier(inX, inY); - } - - public void catmullRomCurve(float x1, float y1, - float cx1, float cy1, - float cx2, float cy2, - float x2, float y2) { - g.catmullRomCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2); - } public void rect(float x1, float y1, float x2, float y2) { g.rect(x1, y1, x2, y2); } + public void cube(float size) { g.cube(size); } + public void box(float x1, float y1, float z1, float x2, float y2, float z2) { g.box(x1, y1, z1, x2, y2, z2); } + public void circle(float x, float y, float radius) { g.circle(x, y, radius); } - public void sphere(float radius) { - g.sphere(radius); + + public void oval(float x, float y, float hradius, float vradius) { + g.oval(x, y, hradius, vradius); } + + public void sphere(float r) { + g.sphere(r); + } + + public void potato() { g.potato(); } - public void imageRect(float x1, float y1, float x2, float y2, - BagelImage image) { - g.imageRect(x1, y1, x2, y2, image); + + public void image(BagelImage image, float x1, float y1) { + g.image(image, x1, y1); } - public void imageRect(float x1, float y1, float x2, float y2, - BagelImage image, float maxU, float maxV) { - g.imageRect(x1, y1, x2, y2, image, maxU, maxV); + + public void image(BagelImage image, + float x1, float y1, float x2, float y2) { + g.image(image, x1, y1, x2, y2); } - public void loadIdentityMatrix() { - g.loadIdentityMatrix(); + + public void image(BagelImage 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 loadFont(String s) { + g.loadFont(s); + } + + + public void setFont(String s) { + g.setFont(s); + } + + + public void text(char c) { + g.text(c); + } + + + public void text(String s) { + g.text(s); + } + + public void push() { g.push(); } + public void pop() { g.pop(); } - public void multMatrix(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.multMatrix(n00, n01, n02, n03, n10, n11, n12, n13, n20, n21, n22, n23, n30, n31, n32, n33); + + public void mult_matrix(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.mult_matrix(n00, n01, n02, n03, n10, n11, n12, n13, n20, n21, n22, n23, n30, n31, n32, n33); } - public void setupProjection(int projectionMode) { - g.setupProjection(projectionMode); + + public void setupProjection(int projection) { + g.setupProjection(projection); } + public void projectPoint(float x, float y, float z) { g.projectPoint(x, y, z); } + + public void translate(float tx, float ty) { + g.translate(tx, ty); + } + + public void translate(float tx, float ty, float tz) { g.translate(tx, ty, tz); } + + public void shearX(float angle) { + g.shearX(angle); + } + + + public void shearY(float angle) { + g.shearY(angle); + } + + + public void rotate(float angle) { + g.rotate(angle); + } + + + public void rotateX(float angle) { + g.rotateX(angle); + } + + + public void rotateY(float angle) { + g.rotateY(angle); + } + + + public void rotateZ(float angle) { + g.rotateZ(angle); + } + + public void rotate(float angle, float v0, float v1, float v2) { g.rotate(angle, v0, v1, v2); } - public void scale(float xyz) { - g.scale(xyz); + + public void scale(float s) { + g.scale(s); } + public void scale(float x, float y, float z) { g.scale(x, y, z); } - public void multWithPerspective() { - g.multWithPerspective(); + + public void transform(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.transform(n00, n01, n02, n03, n10, n11, n12, n13, n20, n21, n22, n23, n30, n31, n32, n33); } + public void colorMode(int colorMode) { g.colorMode(colorMode); } + public void colorMode(int colorMode, int max) { g.colorMode(colorMode, max); } + public void colorMode(int colorMode, int maxX, int maxY, int maxZ, int maxA) { g.colorMode(colorMode, maxX, maxY, maxZ, maxA); } - public void colorScale(int max) { - g.colorScale(max); - } - - public void colorScale(int maxX, int maxY, int maxZ, int maxA) { - g.colorScale(maxX, maxY, maxZ, maxA); - } public void noFill() { g.noFill(); } + public void fill(float gray) { g.fill(gray); } + public void fill(float gray, float alpha) { g.fill(gray, alpha); } + public void fill(float x, float y, float z) { g.fill(x, y, z); } + public void fill(float x, float y, float z, float a) { g.fill(x, y, z, a); } + public void strokeWidth(float strokeWidth) { g.strokeWidth(strokeWidth); } + public void noStroke() { g.noStroke(); } + public void stroke(float gray) { g.stroke(gray); } + public void stroke(float gray, float alpha) { g.stroke(gray, alpha); } + public void stroke(float x, float y, float z) { g.stroke(x, y, z); } + public void stroke(float x, float y, float z, float a) { g.stroke(x, y, z, a); } - public void clear() { - g.clear(); - } public void noBackground() { g.noBackground(); } + public void background(float gray) { g.background(gray); } + public void background(float x, float y, float z) { g.background(x, y, z); } + public void lightsOn() { g.lightsOn(); } + public void lightsOff() { g.lightsOff(); } + + public void smoothingOn() { + g.smoothingOn(); + } + + + public void smoothingOff() { + g.smoothingOff(); + } + + public void message(int level, String message) { g.message(level, message); } + public void message(int level, String message, Exception e) { g.message(level, message, e); } - } diff --git a/processing/app/bagelpublic.pl b/processing/app/bagelpublic.pl index 67b8f86db..52faffd1e 100644 --- a/processing/app/bagelpublic.pl +++ b/processing/app/bagelpublic.pl @@ -2,12 +2,25 @@ open(F, "bagel/Bagel.java") || die $!; @contents = ; close(F); -open(OUT, ">>ProcessingApplet.java") || die $!; +open(APPLET, "ProcessingApplet.java") || die $!; +@applet = ; +close(APPLET); + +$insert = 'public functions from bagel'; + +open(OUT, ">ProcessingApplet.java") || die $!; +foreach $line (@applet) { + print OUT $line; + last if ($line =~ /$insert/); +} + + +#open(OUT, ">>ProcessingApplet.java") || die $!; select(OUT); $comments = 0; -print "\n\n"; +#print "\n\n"; #foreach $line (@contents) { while ($line = shift(@contents)) { @@ -24,7 +37,7 @@ while ($line = shift(@contents)) { if ($line =~ /^\s*(public \w+ [a-zA-z_]+\(.*$)/) { #print "$1\n"; #$decl .= $line; - print $line; + print "\n\n$line"; $decl .= $line; while (!($line =~ /\)/)) { $line = shift (@contents); @@ -58,7 +71,7 @@ while ($line = shift(@contents)) { #print "$decl\r\n"; - print " }\n\n"; + print " }\n"; #\n"; } } print "}\n"; diff --git a/processing/todo.txt b/processing/todo.txt index 381069feb..1fcae3f22 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -2,7 +2,22 @@ iprocessing todo list // last updated 28 september 2001 (most up-to-date version of this file is in processing cvs) +KjcEngine died on line 367 with this: +(trying to stop the applet) +void setup() { + size(300, 300); + colorScale(100); +} + +void loop() { + bezierCurve(10, 10, 100, 50, 50, 100, 290, 290); +} + for 0010 +X strangeness with stroke when a rect goes off outside the window +_ fix color cube applet +_ make it run in current version of processing +_ fix background from showing up black _ make note in documentation about getting access to pixel array _ check to see if get/set functions in applet actually work _ fix documentation appropriately @@ -91,6 +106,61 @@ _ show creas how to get access to cvs _ how to use ssh identity file to maintain auth for brancusi +BAGEL +X got rid of colorscale and using colormode for all instead +_ make note in documentation +_ catmullrom is broken +_ have to get rid of static i/o stuff before porting to c + +_ current acu fonts are broken + +_ 'ellipse' instead of 'oval'? +_ area copying function: copy(x1, y1, w, h, xto, yto); + +_ should math functions be moved in? +_ this could help porting, and sanity in processingapplet +_ io functions might be treated similarly + +_ loadImage/loadFont or getImage/getFont? +_ text(char c), text(string s) +_ image() and 2D/2D affine versions of it +_ min() seems funny/unavailable +_ some method of moving between +_ center oriented: x, y, radius (3D style) +_ and 2D style: x1, y1, x2, y2 +_ or x, y, diameter +_ make note in docs about removal of LINE from LINES +_ build in second matrix type: 2d affine +_ add convex polygon type +_ make note in documentation about convex polygons +_ sketch in antialiasing functions +_ how does color depth work on ipaq? 4-4-4? 5-6-5? +_ font usage/substition solution +_ java freetype? jni freetype to build texmap fonts? +_ look at flash file format? (does it have kerning?) + +_ screen grabbing code +_ simpler bitmap fonts w/o smoothing, just 2D +_ alpha blending (easier) +_ antialiasing +_ bresenham (flat) oval function +_ setting origins +_ should shapes draw from center or from upper left? +_ should ovals use radius or diameter? +_ should shapes use x1, y1 - x2, y2 or x, y, w, h? + +BAGEL - SHOULD DO +_ write shearing function +_ optimize rotation functions +_ test winding polygons in different directions +_ test lighting to see how it compares with gl + +BAGEL - FEATURES +_ non-homogenous colors for beginShape() +_ currently disabled b/c homogenousColors not set false for vertices +_ and code not written for curve vertices + + BUG WATCH _ getMillis() returning 0 in some instances/on some machines @@ -98,8 +168,6 @@ _ getMillis() returning 0 in some instances/on some machines PROCESSING - FEATURES _ run code with a main() that's not a processing applet _ want emacs-style editor that's faster loading than emacs -_ anti-aliasing -_ alpha _ regexps: http://javaregex.com/cgi-bin/pat/tutorial.asp _ a better editor: _ syntax coloring @@ -138,6 +206,30 @@ _ comments would contain descriptions //!blah for printing and formatting _ sketchbook - doodling/scribbling area.. since wacom tablet easily accessible +--------------------------------------------- + + +// ability to write data other than image into the buffer +// pixels won't go away, embrace pixels in sophisticated way +// lists of names of objects, or the 'line number' buffer +// maybe user can introduce new kinds of buffers at will (!!!) + +// better 3D for valence/illustrator output: +// sorting of polygons/lines on simple painters algorithm +// better lighting model to show darkness at various depths +// maybe just ultra-high res bitmaps from gl + +// drawLine vs moveto, lineto +// less of a deal, until fillpath, since that needs to store the +// last several points. but maybe if it's inside a begin/end +// then it's no big deal, and it's easy to implement + +// when casting to an int, should 0.5f be added first + +// functions that take 2d arguments are drawn on the +// z = 0 plane, and not affected by current 3D transform matrix + + --------------------------------------------- code tidbit: