/*A building loosely based on a plan to replace the California state capitol building from childhood recollections of the proposal.*/ SIZE = 1.0; YSIZE = 1.3*SIZE; FLOORS = 60;//larger than 8 //textures win = new UniformTexture(); win.diffuseColor.setRGB(0.4,0.4,0.4); win.specularity = 0.4f; win.shininess = 1.0f; cream = new UniformTexture(); cream.diffuseColor.setHSV(50,0.5f,0.65f); white = new UniformTexture(); white.diffuseColor.setRGB(0.75,0.75,0.75); dd = new UniformTexture(); dd.diffuseColor.setRGB(0.65,0.65,0.65); TriangleMesh triangle(double xsize, double ysize, double zsize, double top) { //a triangular with the top chopped off, width of the top cut is top double x = xsize/2; double y = ysize; double z = zsize/2; double x2 = top/2; vertices = new Vec3[8]; // 8 vertices + 6 faces vertices[0] = new Vec3(-x, 0.0, -z); vertices[1] = new Vec3(x, 0.0, -z);// vertices[2] = new Vec3(x2, y, -z);// vertices[3] = new Vec3(-x2, y, -z); vertices[4] = new Vec3(-x, 0.0, z); vertices[5] = new Vec3(x, 0.0, z);// vertices[6] = new Vec3(x2, y, z);// vertices[7] = new Vec3(-x2, y, z); //triangular faces int[][] faces = {{ 0, 3, 2}, { 0, 2, 1}, { 0, 1, 5}, { 0, 5, 4}, { 0, 4, 7}, {0, 7, 3}, { 6, 5, 1}, { 6, 1, 2}, { 6, 2, 3}, { 6, 3, 7}, { 6, 7, 4}, {6, 4, 5}}; mesh = new TriangleMesh(vertices, faces); mesh.setSmoothingMethod(0); return(mesh); } //fix variables FLOORS = FLOORS-7; //base box = new Cube(80*SIZE,7*YSIZE,27*SIZE); box.setTexture(win, win.getDefaultMapping(box)); p = new Vec3(0,3.5*YSIZE,0); script.addObject(box, new CoordinateSystem(p, 0,0,0)); box = new Cube(80.4*SIZE,0.4*YSIZE,27.4*SIZE); box.setTexture(cream, cream.getDefaultMapping(box)); for(i=0;i<=5;i++) { p = new Vec3(0,i*YSIZE,0); script.addObject(box, new CoordinateSystem(p, 0,0,0)); } box = new Cube(0.5*SIZE,5*YSIZE,0.5*SIZE); box.setTexture(cream, cream.getDefaultMapping(box)); for (i=-40;i<=40;i++) { p = new Vec3(i*SIZE,2.5*YSIZE,13.5*SIZE); script.addObject(box, new CoordinateSystem(p, 0,0,0)); p = new Vec3(i*SIZE,2.5*YSIZE,-13.5*SIZE); script.addObject(box, new CoordinateSystem(p, 0,0,0)); } for (i=-12;i<=13;i++) { p = new Vec3(-40*SIZE,2.5*YSIZE,(i-0.5)*SIZE); script.addObject(box, new CoordinateSystem(p, 0,0,0)); p = new Vec3(40*SIZE,2.5*YSIZE,(i-0.5)*SIZE); script.addObject(box, new CoordinateSystem(p, 0,0,0)); } //upper floors box = new Cube(82*SIZE,0.2*YSIZE,29*SIZE); box.setTexture(white, white.getDefaultMapping(box)); p = new Vec3(0,5.1*YSIZE,0); script.addObject(box, new CoordinateSystem(p, 0,0,0)); p = new Vec3(0,7.1*YSIZE,0); script.addObject(box, new CoordinateSystem(p, 0,0,0)); box = new Cube(0.3*SIZE,2*YSIZE,0.3*SIZE); box.setTexture(white, white.getDefaultMapping(box)); for (i=-80;i<=80;i++) { p = new Vec3(i*SIZE/2,6*YSIZE,13.5*SIZE); script.addObject(box, new CoordinateSystem(p, 0,0,0)); p = new Vec3(i*SIZE/2,6*YSIZE,-13.5*SIZE); script.addObject(box, new CoordinateSystem(p, 0,0,0)); } for (i=-26;i<=26;i++) { p = new Vec3(-40*SIZE,6*YSIZE,i*SIZE/2); script.addObject(box, new CoordinateSystem(p, 0,0,0)); p = new Vec3(40*SIZE,6*YSIZE,i*SIZE/2); script.addObject(box, new CoordinateSystem(p, 0,0,0)); } box = new Cube(80.3*SIZE,0.2*YSIZE,27.3*SIZE); box.setTexture(white, white.getDefaultMapping(box)); p = new Vec3(0,5.25*YSIZE,0); script.addObject(box, new CoordinateSystem(p, 0,0,0)); p = new Vec3(0,6.1*YSIZE,0); script.addObject(box, new CoordinateSystem(p, 0,0,0)); p = new Vec3(0,6.95*YSIZE,0); script.addObject(box, new CoordinateSystem(p, 0,0,0)); //porch c = new Cylinder(5*YSIZE,0.5*SIZE,0.5*SIZE,1.0f); c.setTexture(cream, cream.getDefaultMapping(c)); for(i=-2;i<2;i++) { p = new Vec3((i+0.5)*5*SIZE,2.5*YSIZE,16*SIZE); script.addObject(c, new CoordinateSystem(p, 0,0,0)); } box = new Cube(18*SIZE,0.2*YSIZE,4*SIZE); box.setTexture(white, white.getDefaultMapping(box)); p = new Vec3(0,5.1*YSIZE,15*SIZE); script.addObject(box, new CoordinateSystem(p, 0,0,0)); tri = triangle(18*SIZE,2*YSIZE,4*SIZE,0.2*SIZE); tri.setTexture(white, white.getDefaultMapping(tri)); p = new Vec3(0,5.2*YSIZE,15*SIZE); script.addObject(tri, new CoordinateSystem(p, 0,0,0)); //dome dome = new Sphere(11.5*SIZE,11.5*SIZE,11.5*SIZE); dome.setTexture(dd, dd.getDefaultMapping(dome)); p = new Vec3(0,7.3*YSIZE,0); script.addObject(dome, new CoordinateSystem(p, 0,0,0)); //towers offset = new Vec3(28.5*SIZE,7.2*YSIZE,0); for (k=0;k<2;k++) { //windows box = new Cube(23*SIZE,FLOORS*YSIZE,23*SIZE); box.setTexture(win, win.getDefaultMapping(box)); p = new Vec3(0,FLOORS*YSIZE/2,0); script.addObject(box, new CoordinateSystem(p.plus(offset), 0,0,0)); //floors box = new Cube(23.2*SIZE,0.2*YSIZE,23.2*SIZE); box.setTexture(cream, cream.getDefaultMapping(box)); for (i=0;i<=FLOORS;i++) { p = new Vec3(0,i*YSIZE,0); script.addObject(box, new CoordinateSystem(p.plus(offset), 0,0,0)); } box = new Cube(0.2*SIZE,YSIZE*FLOORS,0.2*SIZE); box.setTexture(cream, cream.getDefaultMapping(box)); for (i=-11;i<12;i++) { p = new Vec3((i-0.5)*SIZE,YSIZE*FLOORS/2,11.5*SIZE); script.addObject(box, new CoordinateSystem(p.plus(offset), 0,0,0)); p = new Vec3(11.5*SIZE,YSIZE*FLOORS/2,(i+0.5)*SIZE); script.addObject(box, new CoordinateSystem(p.plus(offset), 0,0,0)); p = new Vec3((i+0.5)*SIZE,YSIZE*FLOORS/2,-11.5*SIZE); script.addObject(box, new CoordinateSystem(p.plus(offset), 0,0,0)); p = new Vec3(-11.5*SIZE,YSIZE*FLOORS/2,(i-0.5)*SIZE); script.addObject(box, new CoordinateSystem(p.plus(offset), 0,0,0)); } offset = new Vec3(-offset.x,offset.y,offset.z); }