|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.brackeen.javagamebook.graphics3D.ZBuffer
The ZBuffer class implements a z-buffer, or depth-buffer, that records the depth of every pixel in a 3D view window. The value recorded for each pixel is the inverse of the depth (1/z), so there is higher precision for close objects and a lower precision for far-away objects (where high depth precision is not as visually important).
Constructor Summary | |
ZBuffer(int width,
int height)
Creates a new z-buffer with the specified width and height. |
Method Summary | |
boolean |
checkDepth(int offset,
short depth)
Checks the depth at the specified offset, and if the specified depth is lower (is greater than or equal to the current depth at the specified offset), then the depth is set and this method returns true. |
void |
clear()
Clears the z-buffer. |
short[] |
getArray()
Gets the array used for the depth buffer |
int |
getHeight()
Gets the height of this z-buffer. |
int |
getWidth()
Gets the width of this z-buffer. |
void |
setDepth(int offset,
short depth)
Sets the depth of the pixel at at specified offset, overwriting its current depth. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZBuffer(int width, int height)
Method Detail |
public int getWidth()
public int getHeight()
public short[] getArray()
public void clear()
public void setDepth(int offset, short depth)
public boolean checkDepth(int offset, short depth)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |