//The Kimbal tower on the BYU campus in Provo Utah. SIZE = 1.0; FLOORS = 15; //number of floors after the first RT2 = Math.sqrt(2); TORAD = Math.PI/180; //textures brick = new UniformTexture(); brick.diffuseColor.setHSV(17,0.7f,0.5f); window = new UniformTexture(); window.diffuseColor.setRGB(0.1,0.1,0.1); window.specularity = 0.1f; window.shininess = 1.0f; black = new UniformTexture(); black.diffuseColor.setRGB(0.1,0.1,0.1); white = new UniformTexture(); white.diffuseColor.setRGB(0.8,0.8,0.8); //one face void face(double xpos, double zpos, int angle) { var offset = new Vec3(xpos, 0, zpos); double y = 2.15*FLOORS+1.5+2.15; double x,z,r, th; int i,j; var pos; var box = new Cube(0.2*SIZE,SIZE*y,2*SIZE); box.setTexture(brick, brick.getDefaultMapping(box)); x = -5.6*SIZE; z = 0; r = Math.sqrt(x*x + z*z); th = Math.atan2(z,x); pos = new Vec3(r*Math.cos(th+angle*TORAD),SIZE*y/2,r*Math.sin(th+angle*TORAD)); script.addObject(box, new CoordinateSystem(pos.plus(offset), 0,angle,0)); x = 5.6*SIZE; z = 0; r = Math.sqrt(x*x + z*z); th = Math.atan2(z,x); pos = new Vec3(r*Math.cos(th+angle*TORAD),SIZE*y/2,r*Math.sin(th+angle*TORAD)); script.addObject(box, new CoordinateSystem(pos.plus(offset), 0,angle,0)); box = new Cube(11*SIZE,0.4*SIZE, 1.8*SIZE); box.setTexture(white, white.getDefaultMapping(box)); pos = new Vec3(0,1.7*SIZE,0); script.addObject(box, new CoordinateSystem(pos.plus(offset), 0,angle,0)); box = new Cube(11*SIZE,1.8/RT2*SIZE,.6/RT2*SIZE); box.setTexture(white, white.getDefaultMapping(box)); x = 0; z = 0.3*SIZE; r = Math.sqrt(x*x + z*z); th = Math.atan2(z,x); pos = new Vec3(r*Math.cos(th+angle*TORAD),2.2*SIZE,r*Math.sin(th+angle*TORAD)); script.addObject(box, new CoordinateSystem(pos.plus(offset), 45,angle,0)); //each level up for (j=0;j