/*An imposing building for the center of a city.*/ SIZE = 1.0; FLOORS = 25; TODEG = Math.PI/180; //textures window = new UniformTexture(); window.specularColor.setRGB(0.7, 0.7, 0.7); window.specularity = 0.6f; concrete = new UniformTexture(); concrete.diffuseColor.setRGB(0.7*0.8, 0.65*0.8, 0.6*0.8); //the first floor segment void firstFloor(double xpos, double zpos, double theta) { //top and bottom offset = new Vec3(xpos, 0.0, zpos); c = new Cube(0.1*SIZE, 0.1*SIZE, 0.9*SIZE); c.setTexture(concrete, concrete.getDefaultMapping(c)); pos = new Vec3(0.0, 0.05*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); pos = new Vec3(0.0, 0.95*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); //sides c = new Cube(0.12*SIZE, SIZE, 0.1*SIZE); c.setTexture(concrete, concrete.getDefaultMapping(c)); pos = new Vec3(0.5*SIZE*Math.sin(theta*TODEG), 0.5*SIZE, 0.5*SIZE*Math.cos(theta*TODEG)); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); pos = new Vec3(-0.5*SIZE*Math.sin(theta*TODEG), 0.5*SIZE, -0.5*SIZE*Math.cos(theta*TODEG)); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); //window c = new Cube(0.05*SIZE, 0.15*SIZE, 0.9*SIZE); c.setTexture(concrete, concrete.getDefaultMapping(c)); pos = new Vec3(0.0, 0.175*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); pos = new Vec3(0.0, 0.825*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); c = new Cube(0.05*SIZE, 0.5*SIZE, 0.6*SIZE); c.setTexture(concrete, concrete.getDefaultMapping(c)); pos = new Vec3(0.0, 0.5*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); c = new Cube(0.01*SIZE, 0.5*SIZE, .9*SIZE); c.setTexture(window, window.getDefaultMapping(c)); pos = new Vec3(0.0, 0.5*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, theta, 0)); } //the corner unit void corner(double xpos, double zpos) { offset = new Vec3(xpos, 0.0, zpos); c = new Cube(0.55*SIZE, SIZE, 0.55*SIZE); c.setTexture(concrete, concrete.getDefaultMapping(c)); pos = new Vec3(0.0, 0.5*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); c = new Cube(0.6*SIZE, 0.1*SIZE, 0.6*SIZE); c.setTexture(concrete, concrete.getDefaultMapping(c)); pos = new Vec3(0.0, 0.05*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); pos = new Vec3(0.0, 0.95*SIZE, 0.0); pos.add(offset); script.addObject(c, new CoordinateSystem(pos, 0, 0, 0)); for (ix=1; ix