/** Simple checkerboard texture * 3D material, works best for non-moving objects * @author: Phil Gage */ class CheckerMaterial extends Material { Color color2; // alternate checker grid square color int gridSize = 10; // spacing of checker grid CheckerMaterial (Color color, Color color2, int gridSize) { super(color); this.color2 = color2; this.gridSize = gridSize; } /** Return 3D checker texture color based on location */ Color getColor (Point point) { // Add 1000 to avoid wide squares at origin if (((int)(point.x+1000)/gridSize + (int)(point.y+1000)/gridSize + (int)(point.z+1000)/gridSize) % 2 == 0) return color; else return color2; } }