/** A 3d Wood - The day 22 door for my 2010 Advent calendar
by Guru */ void setup() { size(300,300,P3D); } float a = 0; void draw() { a += 0.01; background(0); camera( 400,100,800,0,100,0,0,1,0 ); lights(); rotateY( a ); translate( width/2,height/2); for ( int x = - 10; x < 10; x++ ) { for( int y = -10; y < 10; y++ ) { pushMatrix(); translate( x * 60, 0 ,y * 60); tree(); popMatrix(); } } } void tree() { fill(0,255,0); noStroke(); beginShape( TRIANGLE_FAN ); vertex( 0,-100,0); for( int i = 0; i < 36; i++) { vertex( cos( radians( i * 40 )) * 30, -10, sin( radians(i * 40)) * 20); } endShape(CLOSE ); fill( 200, 128, 0 ); beginShape(QUAD_STRIP); for( int i = 0; i < 36; i++) { vertex( cos( radians( i * 40 )) * 5, -10, sin( radians(i * 40)) * 5); vertex( cos( radians( i * 40 )) * 5, 0, sin( radians(i * 40)) * 5); } endShape(); }