// ZBuffer.pde (part of IsoBlox) // Dave Bollinger, Sep 2006 // http://www.davebollinger.com // for Processing 0115 Beta // (updated 08/16/2006 for 0125 Beta) public class ZBuffer { static final int MINZ = -999999; static final int MAXZ = 999999; int [][] z; int width, height; ZBuffer(int w, int h) { width = w; height = h; z = new int[height][width]; clear(); } public void clear() { for (int y=0; y=width) || (y>=height)) return MAXZ; return z[y][x]; } public boolean set(int x, int y, int newz) { if ((x<0) || (y<0) || (x>=width) || (y>=height)) return false; if (newz > z[y][x]) { z[y][x] = newz; return true; } return false; } }