/** Top class for rendered objects * @author: Phil Gage */ abstract class AbstractObject { /** Surface properties */ Material material; /** Optional grid mailbox for acceleration */ long rayId; double rayDistance; Intersection rayIntersection; //temp /** Create an object */ AbstractObject (Color color) { material = new Material (color); rayIntersection = new Intersection (); //temp } void setColor (Color color) { this.material.color = color; } void setMaterial (Material material) { this.material = material; } /** Return intersection distance, negative if none, and set intersection parameters */ abstract double intersect (Ray ray, Intersection intersection); /** Return color at a point using surface texture */ Color getColor (Point point) { return material.getColor(point); } /** Override to transform object for animation frames */ boolean animate (int frame) { return false; // return true if object changed } /** Return bounding box around this object, this should be recomputed each time due to animation */ abstract Extent getExtent (); }