//A building in three sections, kind of based on a hospital in Rotterdam. SIZE = 1.0; FLOORS = 51;//divisible by 3 TriangleMesh blade()//double xsize, double ysize, double zsize, double top) { xsize = 0.25*SIZE; ysize = (FLOORS+5.5)*SIZE; zsize = 0.8*SIZE; top = SIZE*0.15; double x = xsize/2; double y = ysize; double z = zsize/2; double x2 = top/2; vertices = new Vec3[8]; // 8 vertices + 6 faces vertices[0] = new Vec3(-x, 0.0, -z); vertices[1] = new Vec3(x, 0.0, -z);// vertices[2] = new Vec3(x, y, -z);// vertices[3] = new Vec3(-x, y, -z); vertices[4] = new Vec3(-x2, 0.0, z); vertices[5] = new Vec3(x2, 0.0, z);// vertices[6] = new Vec3(x2, y-SIZE, z);// vertices[7] = new Vec3(-x2, y-SIZE, z); //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); return(mesh); } //textures white = new UniformTexture(); white.diffuseColor.setRGB(0.8,0.75,0.7); win = new UniformTexture(); win.diffuseColor.setRGB(0.5,0.5,0.5); win.specularity = 0.5f; win.shininess = 1.0f; //set up variables width = (int) Math.floor(FLOORS/1.5); bheight = FLOORS/3; P = new Vec3(0,0.5*SIZE,0); center = new Cube((width-2)*SIZE,(FLOORS+5)*SIZE,6*SIZE); center.setTexture(white, white.getDefaultMapping(center)); pos = new Vec3(0,(FLOORS+4)*SIZE/2,0); script.addObject(center, new CoordinateSystem(pos.plus(P), 0,0,0)); //three parts box = new Cube(width*SIZE,bheight*SIZE,3*SIZE); box.setTexture(win, win.getDefaultMapping(box)); for (i=0;i<3;i++) { pos = new Vec3(0,(bheight+1)*SIZE*(i+0.5),2.5*SIZE); script.addObject(box, new CoordinateSystem(pos.plus(P), 0,0,0)); pos = new Vec3(0,(bheight+1)*SIZE*(i+0.5),-2.5*SIZE); script.addObject(box, new CoordinateSystem(pos.plus(P), 0,0,0)); between = new Cube(0.5*SIZE,bheight*SIZE,0.1*SIZE); between.setTexture(white, white.getDefaultMapping(between)); for (j=-width/2+1;j