import processing.opengl.*; int stories = int(random(10,30)); int shite = int(random(6,12)); float gravity = .1; float vely = 0; boolean pressed = false; Building[] bldg = new Building[1]; boolean mpressed = false; import ddf.minim.*; int lastbldg = 0; //ground = new Ground(); float orbitx = 0.0; float orbitz = 0.0; float orbity = 0.; float inc = .1; Ground ground; Minim minim; AudioInput input; //-----------------setup ------------------ void setup() { ground = new Ground(30,100,100); minim = new Minim(this); input = minim.getLineIn(Minim.MONO,16); size(800,600,P3D); hint(ENABLE_OPENGL_2X_SMOOTH); background(0); stroke(255,255,255,255); bldg[0] = new Building(10,10,1,100,.01); fill(150,150,150,150); // bldg = new Building(10,10,10,10); } //--------------------------draw--------------------------------- void draw() { if(input.left.get(1) > .1) { mpressed = true; } else { mpressed = false; } background(0,0,0,1); lights(); lastbldg = bldg.length; println(lastbldg); pointLight(251, 202, 226, -3, -140, -36); inc+=.002; orbitx = sin(inc)*300; orbitz = cos(inc)*300; orbity = -100-(sin(inc*4)*50); camera(orbitx,orbity,orbitz,0,-10,0,0,1,0); // frustum(-width/2, width, 0, height, -100, 200.0); for(int i = 0; i < bldg.length; i++) { bldg[i].move(); bldg[i].display(); bldg[i].shadow(); } //println(bldg[0].yc[0]); //box(15,5,5); fill(80,10,10,225); stroke(255,255,255,255); ground.display(); /* pushMatrix(); translate(0,.2,1); rotateX(PI/2); rect(-1000,-1000,2000,2000); noFill(); popMatrix(); */ if(pressed || mpressed) { Building b = new Building(int(random(1,20)),int(random(1,20)),int(random(1,2)),int(random(1,140)),.01); bldg = (Building[]) append(bldg,b); } } //--------------------------stop----------------------------- void stop() { input.close(); minim.stop(); super.stop(); } void mousePressed() { pressed = true; } void mouseReleased() { pressed = false; }