/*A building similar to the Title and Trust building in Chicago.*/ FLOORS = 87; SIZE = 1.0; YSIZE = 1.2; //textures red = new UniformTexture(); red.diffuseColor.setRGB(0.4, 0.08, 0.08); red.specularity = 0.3f; red.shininess = 1.0f; grey = new UniformTexture(); grey.diffuseColor.setRGB(0.32, 0.4, 0.4); grey.specularity = 0.3f; grey.shininess = 1.0f; light = new UniformTexture(); light.diffuseColor.setRGB(0.9, 0.9, 0.9); //main part of tower box = new Cube(20*SIZE, FLOORS*YSIZE, 20*SIZE); box.setTexture(red, red.getDefaultMapping(box)); p = new Vec3(0.0, FLOORS*YSIZE/2.0, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(20.2*SIZE, 0.3*SIZE, 20.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=0; i<=FLOORS; i++) { p = new Vec3(0.0, i*YSIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(0.2*SIZE, FLOORS*YSIZE, 20.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=-9; i<=9; i++) { p = new Vec3(i*SIZE, FLOORS*YSIZE/2.0, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); p = new Vec3(0.0, FLOORS*YSIZE/2.0, i*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 90, 0)); } //side part of tower box = new Cube(6*SIZE, FLOORS*YSIZE, 10*SIZE); box.setTexture(red, red.getDefaultMapping(box)); p = new Vec3(-13*SIZE, FLOORS*YSIZE/2.0, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(6.2*SIZE, 0.3*SIZE, 10.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=0; i<=FLOORS; i++) { p = new Vec3(-13*SIZE, i*YSIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(0.2*SIZE, FLOORS*YSIZE, 10.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=-2; i<=3; i++) { p = new Vec3(i*SIZE-13*SIZE, FLOORS*YSIZE/2.0, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(6.2*SIZE, FLOORS*YSIZE, 0.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=-4; i<=4; i++) { p = new Vec3(-13*SIZE, FLOORS*YSIZE/2.0, i*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } //corner part of tower box = new Cube(4*SIZE, (FLOORS-12)*YSIZE, 4*SIZE); box.setTexture(grey, grey.getDefaultMapping(box)); p = new Vec3(-12*SIZE, (FLOORS-12)*YSIZE/2.0, 7*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); box = new Cube(4.2*SIZE, 0.3*SIZE, 4.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=0; i<=FLOORS-12; i++) { p = new Vec3(-12*SIZE, i*YSIZE, 7*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(0.2*SIZE, (FLOORS-12)*YSIZE, 4.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=-1; i<=1; i++) { p = new Vec3(i*SIZE-12*SIZE, (FLOORS-12)*YSIZE/2.0, 7*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(4.2*SIZE, (FLOORS-12)*YSIZE, 0.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); for (i=-1; i<=1; i++) { p = new Vec3(-12*SIZE, (FLOORS-12)*YSIZE/2.0, i*SIZE+7*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } //top yoffset = FLOORS*YSIZE; box = new Cube(7*SIZE, 15*YSIZE, 2*SIZE); box.setTexture(grey, grey.getDefaultMapping(box)); for (i=-1; i<=1; i++) { p = new Vec3(-11.5*SIZE, yoffset+7.5*YSIZE, i*3*SIZE); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); for (j=0; j<=15; j++) { b = new Cube(7.2*SIZE, 0.2*SIZE, 2.2*SIZE); b.setTexture(light, light.getDefaultMapping(b)); p = new Vec3(-11.5*SIZE, yoffset+j*YSIZE, i*3*SIZE); script.addObject(b, new CoordinateSystem(p, 0, 0, 0)); } for (j=-3; j<=3; j++) { b = new Cube(0.2*SIZE, 15*YSIZE, 2.2*SIZE); b.setTexture(light, light.getDefaultMapping(b)); p = new Vec3(j*SIZE-11.5*SIZE, yoffset+7.5*YSIZE, i*3*SIZE); script.addObject(b, new CoordinateSystem(p, 0, 0, 0)); } b = new Cube(7*SIZE, 22*YSIZE, 0.4*SIZE); b.setTexture(light, light.getDefaultMapping(b)); p = new Vec3(-13*SIZE, yoffset+6*YSIZE, i*3*SIZE); script.addObject(b, new CoordinateSystem(p, 0, 0, 0)); } /*create a triangle mesh*/ x = 19*SIZE; z = 7*SIZE; y = 14*YSIZE; x2 = x/2.0 - 10*SIZE; vertices = new Vec3[8]; // 8 vertices + 6 faces vertices[0] = new Vec3(-x/2.0, 0.0, -z/2.0); vertices[1] = new Vec3(x/2.0, 0.0, -z/2.0); vertices[2] = new Vec3(x2, y, -z/2.0); vertices[3] = new Vec3(-x/2.0, y, -z/2.0); vertices[4] = new Vec3(-x/2.0, 0.0, z/2.0); vertices[5] = new Vec3(x/2.0, 0.0, z/2.0); vertices[6] = new Vec3(x2, y, z/2.0); vertices[7] = new Vec3(-x/2.0, y, z/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(grey, grey.getDefaultMapping(mesh)); p = new Vec3(-3*SIZE, yoffset, 0.0); script.addObject(mesh, new CoordinateSystem(p, 0, 0, 0)); //horizontals on angled part for (i=0; i<14; i++) { k = 19 - i*10/14.0; box = new Cube(SIZE*k, SIZE*0.2, SIZE*7.2); box.setTexture(light, light.getDefaultMapping(box)); p = new Vec3((k-25.2)*SIZE/2.0, yoffset+i*YSIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } box = new Cube(SIZE*9.3, SIZE*0.2, SIZE*7.2); box.setTexture(light, light.getDefaultMapping(box)); p = new Vec3(-7.95*SIZE, yoffset+14*YSIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); //verticals on angled part for (i=-8; i<=-4; i++) { box = new Cube(SIZE*0.2, YSIZE*14, SIZE*7.2); box.setTexture(light, light.getDefaultMapping(box)); p = new Vec3(i*SIZE, yoffset+7*YSIZE, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } for (i=-3; i<=6; i++) { j= i + 3.5; k = 14 - j*14/10.0; box = new Cube(SIZE*0.2, YSIZE*k, SIZE*7.2); box.setTexture(light, light.getDefaultMapping(box)); p = new Vec3(i*SIZE, yoffset+k*YSIZE/2.0, 0.0); script.addObject(box, new CoordinateSystem(p, 0, 0, 0)); } //slope windows y = (double) 14*YSIZE; x = (double) 10*SIZE; r = Math.sqrt(x*x+y*y); box = new Cube(0.5*SIZE, r, 7.2*SIZE); box.setTexture(light, light.getDefaultMapping(box)); p = new Vec3(1.5*SIZE, yoffset+y/2, 0.0); theta = Math.atan(-y/x)*180/Math.PI; script.addObject(box, new CoordinateSystem(p, 0, 0, 90-theta));