topical media & game development
graphic-processing-algorithm-Ch09-p226-p226.pde / pde
MyPoint [] points;
MySolid solid;
MyPoint origin = new MyPoint(0.,0.,0.);
void setup(){
size(200, 200, P3D);
//noFill();
fill(255,181,5);
camera(70.0, 35.0, 120.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
noStroke();
stroke(0);
points = new MyPoint[5];
points[0] = new MyPoint( 50, 50, 0);
points[1] = new MyPoint(-50, 50, 0);
points[2] = new MyPoint(-50, -50, 0);
points[3] = new MyPoint( 0, -75, 0);
points[4] = new MyPoint( 50, -50, 0);
solid = new MySolid(points, 20.);
solid.setColor(color(255,255,255));
// for(int i=0; i<solid.nfaces; i++)
// solid.faces[i].setColor(color(random(255),random(255),random(255)));
}
int xf, yf;
void draw(){
background(255);
//lights();
solid.rotatex((mouseX - xf) * PI/180.,origin);
solid.rotatey((mouseY - yf) * PI/180.,origin);
solid.draw();
xf = mouseX;
yf = mouseY;
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.