/*A simplified version of the Oakland city hall.*/ SIZE = 1.0; YSIZE = 1.3; FLOORS = 24;//greater than 6 //textures win = new UniformTexture(); win.diffuseColor.setRGB(0.4,0.4,0.4); win.specularity = 0.55f; win.shininess = 1.0f; white = new UniformTexture(); white.diffuseColor.setRGB(0.9,0.85,0.85); black = new UniformTexture(); black.diffuseColor.setRGB(0.1,0.1,0.1); TriangleMesh arch(double scale) { //an arch var bb, cyl; Vec3 pos; double r = 0.35*SIZE*scale; bb = new Cube(SIZE*scale,YSIZE*scale/2,0.3*SIZE*scale); cyl = new Cylinder(SIZE*scale,r,r,1.0f); pos = new Vec3(0,0.25*YSIZE*scale,0); one = new ObjectInfo(bb, new CoordinateSystem(pos, 0,0,0), "one"); pos = new Vec3(0,0,0); two = new ObjectInfo(cyl, new CoordinateSystem(pos, 90,0,0), "two"); lens = new CSGObject(one, two, 2); return (lens.convertToTriangleMesh(0.02)); } //adjust variables FLOORS = FLOORS-5; /*base*/ box = new Cube(SIZE*15,YSIZE*4,SIZE*13); box.setTexture(win, win.getDefaultMapping(box)); pos = new Vec3(0,YSIZE*2,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); box = new Cube(15.4*SIZE,0.4*YSIZE,13.4*SIZE); box.setTexture(white, white.getDefaultMapping(box)); pos = new Vec3(0,3.6*YSIZE,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); box = new Cube(15.9*SIZE,0.2*YSIZE,13.9*SIZE); box.setTexture(white, white.getDefaultMapping(box)); pos = new Vec3(0,3.9*YSIZE,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); round = arch(2.0); round.setTexture(white, white.getDefaultMapping(round)); for(i=1;i<=3;i++) { y =YSIZE*2.6; pos = new Vec3(2*i*SIZE,y,6.3*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(-2*i*SIZE,y,6.3*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(2*i*SIZE,y,-6.3*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(-2*i*SIZE,y,-6.3*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(7.3*SIZE,y,2*i*SIZE-SIZE); script.addObject(round, new CoordinateSystem(pos, 0,90,0)); pos = new Vec3(7.3*SIZE,y,-2*i*SIZE+SIZE); script.addObject(round, new CoordinateSystem(pos, 0,90,0)); pos = new Vec3(-7.3*SIZE,y,2*i*SIZE-SIZE); script.addObject(round, new CoordinateSystem(pos, 0,90,0)); pos = new Vec3(-7.3*SIZE,y,-2*i*SIZE+SIZE); script.addObject(round, new CoordinateSystem(pos, 0,90,0)); } bar = new Cube(0.6*SIZE,4*YSIZE,13.4*SIZE); bar.setTexture(white, white.getDefaultMapping(bar)); for(i=1;i<=4;i++) { pos = new Vec3(2*i*SIZE-SIZE,2*YSIZE,0); script.addObject(bar, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(-2*i*SIZE+SIZE,2*YSIZE,0); script.addObject(bar, new CoordinateSystem(pos, 0,0,0)); } bar = new Cube(15.4*SIZE,4*YSIZE,0.6*SIZE); bar.setTexture(white, white.getDefaultMapping(bar)); for(i=-3;i<=3;i++) { pos = new Vec3(0,2*YSIZE,2*i*SIZE); script.addObject(bar, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(0,2*YSIZE,2*i*SIZE); script.addObject(bar, new CoordinateSystem(pos, 0,0,0)); } //horizontals box = new Cube(15.2*SIZE,0.3*YSIZE,13.2*SIZE); box.setTexture(white, white.getDefaultMapping(box)); for (i=1;i<3;i++) { pos = new Vec3(0,i*YSIZE,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); } //corners box = new Cube(0.4*SIZE,4*YSIZE,0.4*SIZE); box.setTexture(white, white.getDefaultMapping(box)); pos = new Vec3(7.4*SIZE,2*YSIZE,6.4*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(-7.4*SIZE,2*YSIZE,6.4*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(7.4*SIZE,2*YSIZE,-6.4*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(-7.4*SIZE,2*YSIZE,-6.4*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); box = new Cube(15*SIZE,0.01*SIZE,13*SIZE); box.setTexture(black, black.getDefaultMapping(box)); pos = new Vec3(0,4*YSIZE,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); /*tower*/ box = new Cube(7.1*SIZE,FLOORS*YSIZE,5.1*SIZE); box.setTexture(win, win.getDefaultMapping(box)); pos = new Vec3(0,YSIZE*4+YSIZE*FLOORS/2,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); //verticals box = new Cube(0.3*SIZE,(FLOORS-1)*YSIZE,5.3*SIZE); box.setTexture(white, white.getDefaultMapping(box)); for (i=-3;i<3;i++) { pos = new Vec3((i+0.5)*SIZE,YSIZE*3.5+FLOORS*YSIZE/2,0); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); } box = new Cube(7.3*SIZE,(FLOORS-1)*YSIZE,0.3*SIZE); box.setTexture(white, white.getDefaultMapping(box)); for (i=-2;i<2;i++) { pos = new Vec3(0,YSIZE*3.5+FLOORS*YSIZE/2,(i+0.5)*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); } round = arch(1.0); round.setTexture(white, white.getDefaultMapping(round)); bar = new Cube(0.05*SIZE,FLOORS*YSIZE,5.2*SIZE); bar.setTexture(white, white.getDefaultMapping(bar)); for (i=-3;i<=3;i++) { pos = new Vec3(i*SIZE,YSIZE*3+FLOORS*YSIZE,2.5*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(i*SIZE,YSIZE*3+FLOORS*YSIZE,-2.5*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(i*SIZE,YSIZE*3.5+FLOORS*YSIZE/2,0); script.addObject(bar, new CoordinateSystem(pos, 0,0,0)); } bar = new Cube(7.2*SIZE,FLOORS*YSIZE,0.05*SIZE); bar.setTexture(white, white.getDefaultMapping(bar)); for (i=-2;i<=2;i++) { pos = new Vec3(3.5*SIZE,YSIZE*3+FLOORS*YSIZE,i*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,90,0)); pos = new Vec3(-3.5*SIZE,YSIZE*3+FLOORS*YSIZE,i*SIZE); script.addObject(round, new CoordinateSystem(pos, 0,90,0)); pos = new Vec3(0,YSIZE*3.5+FLOORS*YSIZE/2,i*SIZE); script.addObject(bar, new CoordinateSystem(pos, 0,0,0)); } //corners box = new Cube(0.3*SIZE,FLOORS*YSIZE,0.3*SIZE); box.setTexture(white, white.getDefaultMapping(box)); pos = new Vec3(-3.5*SIZE,YSIZE*4+FLOORS*YSIZE/2,2.5*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(3.5*SIZE,YSIZE*4+FLOORS*YSIZE/2,2.5*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(-3.5*SIZE,YSIZE*4+FLOORS*YSIZE/2,-2.5*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); pos = new Vec3(3.5*SIZE,YSIZE*4+FLOORS*YSIZE/2,-2.5*SIZE); script.addObject(box, new CoordinateSystem(pos, 0,0,0)); //horizontals box = new Cube(3*SIZE,0.3*SIZE,5.2*SIZE); box.setTexture(white, white.getDefaultMapping(box)); box2 = new Cube(1.2*SIZE,0.3*SIZE,5.2*SIZE); box2.setTexture(white, white.getDefaultMapping(box2)); bar = new Cube(7.3*SIZE,0.05*SIZE,5.3*SIZE); bar.setTexture(white, white.getDefaultMapping(bar)); for (i=0;i