/*A building simmilar to the Williams Tower in Houston.*/ SIZE = 1.0; //a function to make the roof void mesh(double x, double y, double z, double cut, Vec3 p, Texture tex) { x2 = x - cut; z2 = z - cut; vertices = new Vec3[8]; // 8 vertices + 6 faces vertices[0] = new Vec3(-x/2.0, -y/2.0, -z/2.0); vertices[1] = new Vec3(x/2.0, -y/2.0, -z/2.0); vertices[2] = new Vec3(x2/2.0, y/2.0, -z2/2.0); vertices[3] = new Vec3(-x2/2.0, y/2.0, -z2/2.0); vertices[4] = new Vec3(-x/2.0, -y/2.0, z/2.0); vertices[5] = new Vec3(x/2.0, -y/2.0, z/2.0); vertices[6] = new Vec3(x2/2.0, y/2.0, z2/2.0); vertices[7] = new Vec3(-x2/2.0, y/2.0, z2/2.0); //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); mesh.setTexture(tex, tex.getDefaultMapping(mesh)); //p = new Vec3(0.0, 0.0, 0.0); script.addObject(mesh, new CoordinateSystem(p, 0, 0, 0)); } win = new UniformTexture(); win.diffuseColor.setRGB(0.4, 0.8, 0.4); win.specularColor.setRGB(0.9, 0.9, 0.9); win.specularity = 0.4f; win.shininess = 1.0f; conc = new UniformTexture(); conc.diffuseColor.setRGB(0.6, 0.6, 0.6); box = new Cube(30*SIZE, 100*SIZE, 20*SIZE); box.setTexture(win, win.getDefaultMapping(box)); p = new Vec3(0.0, 50*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(0.2*SIZE, 100*SIZE, 20.2*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); for (i=-14; i<=14; i++) { p = new Vec3(i*SIZE, 50*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); p = new Vec3(0.0, 50*SIZE, i*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 90, 0)); } box = new Cube(30.2*SIZE, 100*SIZE, 0.2*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); for (i=-9; i<=9; i++) { p = new Vec3(0.0, 50*SIZE, i*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); p = new Vec3(i*SIZE, 50*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 90, 0)); } box = new Cube(20*SIZE, 100*SIZE, 30*SIZE); box.setTexture(win, win.getDefaultMapping(box)); p = new Vec3(0.0, 50*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(25*SIZE, 80*SIZE, 25*SIZE); box.setTexture(win, win.getDefaultMapping(box)); p = new Vec3(0.0, 40*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(25.2*SIZE, 0.2*SIZE, 25.2*SIZE); box.setTexture(win, win.getDefaultMapping(box)); for (i=0; i<=80; i++) { p = new Vec3(0.0, i*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(15*SIZE, 10*SIZE, 15*SIZE); box.setTexture(win, win.getDefaultMapping(box)); p = new Vec3(0.0, 105*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(15.2*SIZE, 10*SIZE, 0.2*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); for (i=-7; i<=7; i++) { p = new Vec3(i*SIZE, 105*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 90, 0)); p = new Vec3(0.0, 105*SIZE, i*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } p = new Vec3(0.0, 115*SIZE, 0.0); mesh(14*SIZE, 10*SIZE, 14*SIZE, 13.5*SIZE, p, win); for (i=0; i<10; i++) { k = 15.2*(10.5-i)/11; box = new Cube(k*SIZE, 0.2*SIZE, k*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); p = new Vec3(0.0, (110+i)*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(0.2*SIZE, 4*SIZE, 0.2*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); p = new Vec3(0.0, 122*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(0.1*SIZE, 4*SIZE, 0.1*SIZE); box.setTexture(conc, conc.getDefaultMapping(box)); p = new Vec3(0.0, 126*SIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0));