/*A tall building based loosely on Burj Khalifa.*/ SIZE = 1.0; LAYERS=9; //textures dark = new UniformTexture(); dark.diffuseColor.setRGB(0.4,0.4,0.4); light = new UniformTexture(); light.diffuseColor.setHSV(25.0f,0.6f,0.6f); window = new UniformTexture(); window.diffuseColor.setRGB(0.5,0.5,0.5); window.specularity = 0.5f; window.shininess = 1.0f; silver = new UniformTexture(); silver.diffuseColor.setRGB(0.7,0.7,0.7); silver.specularity = 0.3f; silver.shininess = 1.0f; for (j=0;j<=LAYERS;j++) { offset = SIZE*10*(LAYERS-j); for (i=0;i<2+j;i++) { theta = Math.PI*i*2/3; c = new Cylinder(SIZE*10,SIZE,SIZE,1.0); c.setTexture(window, window.getDefaultMapping(c)); r = 0+i/3.0; x = SIZE*r*Math.sin(theta); z = SIZE*r*Math.cos(theta); pos = new Vec3(x,offset+SIZE*5,z); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); //between windows c = new Cylinder(SIZE*0.2, SIZE*1.02, SIZE*1.02, 1.0); c.setTexture(light, light.getDefaultMapping(c)); for (k=0;k<19;k++) { pos = new Vec3(x,offset+0.5*SIZE*k,z); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); } box = new Cube(2.02*SIZE,SIZE*9.3,0.15*SIZE); box.setTexture(light, light.getDefaultMapping(box)); pos = new Vec3(x,offset+SIZE*4.65,z); for (k=0;k<18;k++) { theta = k*360.0/18; script.addObject(box, new CoordinateSystem(pos, 0, theta, 0)); } //a top to each layer c = new Cylinder(0.7*SIZE, SIZE*1.02, SIZE*1.02, 1.0); c.setTexture(dark, dark.getDefaultMapping(c)); pos = new Vec3(x,offset+9.65*SIZE,z); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); } } //top c = new Cylinder(SIZE*10,SIZE,SIZE,0.8); c.setTexture(window, window.getDefaultMapping(c)); offset = 10*SIZE*LAYERS+10*SIZE; pos = new Vec3(0.0,offset+5*SIZE,0.0); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); //between windows for (k=0;k<19;k++) { t = 1 - 0.2*k/21; c = new Cylinder(SIZE*0.2, t*SIZE*1.02, t*SIZE*1.02, 1.0); c.setTexture(light, light.getDefaultMapping(c)); pos = new Vec3(0,offset+0.5*SIZE*k,0); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); // box = new Cube(t*2.02*SIZE,SIZE*0.5,0.15*SIZE); box.setTexture(light, light.getDefaultMapping(box)); pos = new Vec3(0,offset+0.5*SIZE*k+0.25*SIZE,0); for (m=0;m<18;m++) { theta = m*360.0/18; script.addObject(box, new CoordinateSystem(pos, 0, theta, 0)); } } c = new Cylinder(0.7*SIZE, 0.85*SIZE*1.02, 0.85*SIZE*1.02, 1.0); c.setTexture(dark, dark.getDefaultMapping(c)); pos = new Vec3(0,offset+9.65*SIZE,0); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); //dome offset = 10*SIZE*LAYERS+15*SIZE; c = new Sphere(0.8*SIZE, SIZE*4, 0.8*SIZE); c.setTexture(silver, silver.getDefaultMapping(c)); offset = offset+4*SIZE; pos = new Vec3(0.0,offset,0.0); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); //spire c = new Cylinder(SIZE*10,0.2*SIZE,0.2*SIZE,0.5); c.setTexture(silver, silver.getDefaultMapping(c)); pos = new Vec3(0.0,offset+8.5*SIZE,0.0); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0));