import java.awt.*; import java.util.*; import java.lang.*; import java.io.*; public class World extends Object implements Serializable { private Color backdropColor; public Item[] items; public int nItems, limititems; public static double kambient, kdiffuse, kspecular; public static int specularExponent; public static int lightx, lighty, lightz; static { kambient = .3; kdiffuse = .7; kspecular = .3; specularExponent = 10; lightx = lighty = lightz = 200; } public World() { System.out.println("Calling World()..."); backdropColor = Color.blue; nItems = 0; addTen(); System.out.println("Completed World()."); } public void spherulate(int w, int h) { System.out.println("Spherulating with "+w+", "+h); long seed = System.currentTimeMillis(); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); seed = addRandomSphere(seed, w, h); addRandomSphere(seed, w, h); } public void spherulate(int w, int h, int n) { System.out.println("Spherulating with "+w+", "+h); long seed = System.currentTimeMillis(); int i = 0; while (i++ < n-1) { seed = addRandomSphere(seed, w, h); } addRandomSphere(seed, w, h); } public Item itemAt(int k) { return items[k]; } public Color getColorAtItem(int k, int x, int y, double z) { return items[k].getColorAt(x,y,z); } public void addTen() { limititems += 10; Item[] newp = new Item[limititems]; for (int i=0; i