probably temporary, but adding api.txt info and PMaterial class

This commit is contained in:
benfry
2008-09-18 23:27:34 +00:00
parent ac58aaca0a
commit c79c39cb7f
2 changed files with 458 additions and 0 deletions

253
core/api.txt Normal file
View File

@@ -0,0 +1,253 @@
setMainDrawingSurface() -> setPrimarySurface()
mainDrawingSurface = primarySurface;
resize() -> setSize() (roughly)
endShape() with no params is no longer 'final'
X/Y/Z -> TX/TY/TZ
MX/MY/MZ -> X/Y/Z (for sake of PShape)
//
setParent()
setPrimary()
setPath()
setSize(int w, int h)
allocate()
canDraw()
beginDraw()
endDraw()
flush() - flushDraw()?
checkSettings()
defaultSettings()
reapplySettings()
hint()
unhint()
public void beginShape()
public void beginShape(int kind)
public void normal(float nx, float ny, float nz)
public void textureMode(int mode)
public void texture(PImage image)
public void vertex(float x, float y)
public void vertex(float x, float y, float z)
public void vertex(float x, float y, float u, float v)
public void vertex(float x, float y, float z, float u, float v)
public void bezierVertex(float x2, float y2,
public void bezierVertex(float x2, float y2, float z2,
public void curveVertex(float x, float y)
public void curveVertex(float x, float y, float z)
public void breakShape()
public void endShape()
public void endShape(int mode)
public void point(float x, float y)
public void point(float x, float y, float z)
public void line(float x1, float y1, float x2, float y2)
public void line(float x1, float y1, float z1,
public void triangle(float x1, float y1, float x2, float y2,
public void quad(float x1, float y1, float x2, float y2,
public void rectMode(int mode)
public void rect(float x1, float y1, float x2, float y2)
public void ellipseMode(int mode)
public void ellipse(float a, float b, float c, float d)
public void arc(float a, float b, float c, float d,
public void box(float size)
public void box(float w, float h, float d)
public void sphereDetail(int res)
public void sphereDetail(int ures, int vres)
public void sphere(float r)
public float bezierPoint(float a, float b, float c, float d, float t)
public float bezierTangent(float a, float b, float c, float d, float t)
public void bezierDetail(int detail)
public void bezier(float x1, float y1,
public void bezier(float x1, float y1, float z1,
public float curvePoint(float a, float b, float c, float d, float t)
public float curveTangent(float a, float b, float c, float d,
public void curveDetail(int detail)
public void curveTightness(float tightness)
public void curve(float x1, float y1,
public void curve(float x1, float y1, float z1,
public void image(PImage image, float x, float y)
public void image(PImage image,
public void image(PImage image,
public void textAlign(int align)
public void textAlign(int alignX, int alignY)
public float textAscent()
public float textDescent()
public void textFont(PFont which)
public void textFont(PFont which, float size)
public void textLeading(float leading)
public void textMode(int mode)
public void textSize(float size)
public float textWidth(char c)
public float textWidth(String str)
public void text(char c)
public void text(char c, float x, float y)
public void text(char c, float x, float y, float z)
public void text(String str)
public void text(String str, float x, float y)
public void text(String str, float x, float y, float z)
public void text(String str, float x1, float y1, float x2, float y2)
public void text(String s, float x1, float y1, float x2, float y2, float z)
public void text(int num, float x, float y)
public void text(int num, float x, float y, float z)
public void text(float num, float x, float y)
public void text(float num, float x, float y, float z)
public void translate(float tx, float ty)
public void translate(float tx, float ty, float tz)
public void rotate(float angle)
public void rotateX(float angle)
public void rotateY(float angle)
public void rotateZ(float angle)
public void rotate(float angle, float vx, float vy, float vz)
public void scale(float s)
public void scale(float sx, float sy)
public void scale(float x, float y, float z)
public void pushMatrix()
public void popMatrix()
public void resetMatrix()
public void applyMatrix(float n00, float n01, float n02,
public void applyMatrix(float n00, float n01, float n02, float n03,
public void loadMatrix()
public void printMatrix()
public void beginCamera()
public void endCamera()
public void camera()
public void camera(float eyeX, float eyeY, float eyeZ,
public void printCamera()
public void ortho()
public void ortho(float left, float right,
public void perspective()
public void perspective(float fovy, float aspect, float zNear, float zFar)
public void frustum(float left, float right, float bottom,
public void printProjection()
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 modelX(float x, float y, float z)
public float modelY(float x, float y, float z)
public float modelZ(float x, float y, float z)
public void colorMode(int mode)
public void colorMode(int mode, float max)
public void colorMode(int mode,
public void colorMode(int mode,
public void noStroke()
public void stroke(int rgb)
public void stroke(int rgb, float alpha)
public void stroke(float gray)
public void stroke(float gray, float alpha)
public void stroke(float x, float y, float z)
public void stroke(float x, float y, float z, float a)
public void strokeCap(int cap)
public void strokeJoin(int join)
public void strokeWeight(float weight)
public void noTint()
public void tint(int rgb)
public void tint(int rgb, float alpha)
public void tint(float gray)
public void tint(float gray, float alpha)
public void tint(float x, float y, float z)
public void tint(float x, float y, float z, float a)
public void noFill()
public void fill(int rgb)
public void fill(int rgb, float alpha)
public void fill(float gray)
public void fill(float gray, float alpha)
public void fill(float x, float y, float z)
public void fill(float x, float y, float z, float a)
public void ambient(int rgb)
public void ambient(float gray)
public void ambient(float x, float y, float z)
public void specular(int rgb)
public void specular(float gray)
public void specular(float x, float y, float z)
public void shininess(float shine)
public void emissive(int rgb)
public void emissive(float gray)
public void emissive(float x, float y, float z )
public void lights()
public void noLights()
public void ambientLight(float red, float green, float blue)
public void ambientLight(float red, float green, float blue,
public void directionalLight(float red, float green, float blue,
public void pointLight(float red, float green, float blue,
public void spotLight(float red, float green, float blue,
public void lightFalloff(float constant, float linear, float quadratic)
public void lightSpecular(float x, float y, float z)
public void background(int rgb)
public void background(int rgb, float alpha)
public void background(float gray)
public void background(float gray, float alpha)
public void background(float x, float y, float z)
public void background(float x, float y, float z, float a)
public void background(PImage image)
public final float alpha(int what)
public final float red(int what)
public final float green(int what)
public final float blue(int what)
public final float hue(int what)
public final float saturation(int what)
public final float brightness(int what)
public int lerpColor(int c1, int c2, float amt)
static public int lerpColor(int c1, int c2, float amt, int mode)
public boolean displayable()
//
public void smooth()
public void noSmooth()
public void imageMode(int mode)
public void loadPixels()
public void updatePixels()
public void updatePixels(int x1, int y1, int x2, int y2)
public int get(int x, int y)
public PImage get(int x, int y, int w, int h)
public PImage get()
public void set(int x, int y, int c)
public void set(int dx, int dy, PImage src)
public void mask(int alpha[])
public void mask(PImage alpha)
public void filter(int kind)
public void filter(int kind, float param)
public void copy(int sx1, int sy1, int sx2, int sy2,
public void copy(PImage src,
static public int blendColor(int c1, int c2, int mode)
public void blend(int sx1, int sy1, int sx2, int sy2,
public void blend(PImage src,

View File

@@ -0,0 +1,205 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2008 Ben Fry and Casey Reas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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,
Boston, MA 02111-1307 USA
*/
package processing.core;
public class PMaterial {
/** Ka parameters of the material. */
public float ambientR, ambientG, ambientB;
/** Kd parameters of the material */
public float diffuseR, diffuseG, diffuseB;
/** Ks parameters of the material */
public float specularR, specularG, specularB;
/** Ke parameters of the material */
public float emissiveR, emissiveG, emissiveB;
/** Se parameter of the material */
public float shininess; // Se
public PMaterial(float ambientR, float ambientG, float ambientB,
float diffuseR, float diffuseG, float diffuseB,
float specularR, float specularG, float specularB,
float emissiveR, float emissiveG, float emissiveB,
float shininess) {
ambient(ambientR, ambientG, ambientB);
diffuse(diffuseR, diffuseG, diffuseB);
specular(specularR, specularG, specularB);
emissive(emissiveR, emissiveG, emissiveB);
shininess(shininess);
}
public void ambient(float r, float g, float b) {
ambientR = r;
ambientG = g;
ambientB = b;
}
public void diffuse(float r, float g, float b) {
diffuseR = r;
diffuseG = g;
diffuseB = b;
}
public void specular(float r, float g, float b) {
specularR = r;
specularG = g;
specularB = b;
}
public void emissive(float r, float g, float b) {
emissiveR = r;
emissiveG = g;
emissiveB = b;
}
public void shininess(float s) {
shininess = s;
}
/*
static public PMaterial BRASS =
new PMaterial(0.329412f, 0.223529f, 0.027451f, 1,
0.780392f, 0.568627f, 0.113725f, 1,
0.992157f, 0.941176f, 0.807843f, 1,
27.89740f);
static public PMaterial BRONZE =
new PMaterial(0.212500f, 0.127500f, 0.054000f, 1,
0.714000f, 0.428400f, 0.181440f, 1,
0.393548f, 0.271906f, 0.166721f, 1,
25.60000f);
static public PMaterial POLISHED_BRONZE =
new PMaterial(0.250000f, 0.148000f, 0.064750f, 1,
0.400000f, 0.236800f, 0.103600f, 1,
0.774597f, 0.458561f, 0.200621f, 1,
76.80000f);
static public PMaterial CHROME =
new PMaterial(0.250000f, 0.250000f, 0.250000f, 1,
0.400000f, 0.400000f, 0.400000f, 1,
0.774597f, 0.774597f, 0.774597f, 1,
76.80000f);
static public PMaterial COPPER =
new PMaterial(0.191250f, 0.073500f, 0.022500f, 1,
0.703800f, 0.270480f, 0.082800f, 1,
0.256777f, 0.137622f, 0.086014f, 1,
12.80000f);
static public PMaterial POLISHED_COPPER =
new PMaterial(0.229500f, 0.088250f, 0.027500f, 1f,
0.550800f, 0.211800f, 0.066000f, 1f,
0.580594f, 0.223257f, 0.069570f, 1f,
51.20000f);
static public PMaterial GOLD =
new PMaterial(0.247250f, 0.199500f, 0.074500f, 1,
0.751640f, 0.606480f, 0.226480f, 1,
0.628281f, 0.555802f, 0.366065f, 1,
51.20000f);
static public PMaterial POLISHED_GOLD =
new PMaterial(0.247250f, 0.224500f, 0.064500f, 1,
0.346150f, 0.314300f, 0.090300f, 1,
0.797357f, 0.723991f, 0.208006f, 1,
83.20000f);
static public PMaterial PEWTER =
new PMaterial(0.105882f, 0.058824f, 0.113725f, 1,
0.427451f, 0.470588f, 0.541176f, 1,
0.333333f, 0.333333f, 0.521569f, 1,
9.846150f);
static public PMaterial SILVER =
new PMaterial(0.192250f, 0.192250f, 0.192250f, 1,
0.507540f, 0.507540f, 0.507540f, 1,
0.508273f, 0.508273f, 0.508273f, 1,
51.20000f);
static public PMaterial POLISHED_SILVER =
new PMaterial(0.231250f, 0.231250f, 0.231250f, 1,
0.277500f, 0.277500f, 0.277500f, 1,
0.773911f, 0.773911f, 0.773911f, 1,
89.59999f);
static public PMaterial EMERALD =
new PMaterial(0.021500f, 0.174500f, 0.021500f, 0.55f,
0.075680f, 0.614240f, 0.075680f, 0.55f,
0.633000f, 0.727811f, 0.633000f, 0.55f,
76.80000f);
static public PMaterial JADE =
new PMaterial(0.135000f, 0.222500f, 0.157500f, 0.95f,
0.540000f, 0.890000f, 0.630000f, 0.95f,
0.316228f, 0.316228f, 0.316228f, 0.95f,
12.80000f);
static public PMaterial OBSIDIAN =
new PMaterial(0.053750f, 0.050000f, 0.066250f, 0.82f,
0.182750f, 0.170000f, 0.225250f, 0.82f,
0.332741f, 0.328634f, 0.346435f, 0.82f,
38.40000f);
static public PMaterial PEARL =
new PMaterial(0.250000f, 0.207250f, 0.207250f, 0.922f,
1.000000f, 0.829000f, 0.829000f, 0.922f,
0.296648f, 0.296648f, 0.296648f, 0.922f,
11.26400f);
static public PMaterial RUBY =
new PMaterial(0.174500f, 0.011750f, 0.011750f, 0.55f,
0.614240f, 0.041360f, 0.041360f, 0.55f,
0.727811f, 0.626959f, 0.626959f, 0.55f,
76.80000f);
static public PMaterial TURQUOISE =
new PMaterial(0.100000f, 0.187250f, 0.174500f, 0.8f,
0.396000f, 0.741510f, 0.691020f, 0.8f,
0.297254f, 0.308290f, 0.306678f, 0.8f,
12.80000f);
static public PMaterial BLACK_PLASTIC =
new PMaterial(0.000000f, 0.000000f, 0.000000f, 1,
0.010000f, 0.010000f, 0.010000f, 1,
0.500000f, 0.500000f, 0.500000f, 1,
32.00000f);
static public PMaterial BLACK_RUBBER =
new PMaterial(0.020000f, 0.020000f, 0.020000f, 1,
0.010000f, 0.010000f, 0.010000f, 1,
0.400000f, 0.400000f, 0.400000f, 1,
10.00000f);
*/
}