Interface RasterDepthPixBuff
-
public interface RasterDepthPixBuff
This is a hook to do custom pixel computation withRasterDepthGraphics
. In particular, pixels having translucency may be handled in a special way.- See Also:
RasterDepthGraphics
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearScanLine(int beginIndex, int length, int color)
The invocation of this method is triggered by a call toRasterDepthGraphics.clear()
.void
drawPixel(int index, int color, int zDepth)
Is told to "paint" the specified pixel location with the specified color (which is in ARGB, or0xaarrggbb
format), where the pixel's sampling point has the specified z depth.boolean
getAccurateZ()
Tells the 3D rendering context whether to employ a more accurate z computation strategy, the added expense being a slightly more significant CPU utilization.int
getHeight()
Reports back the height in pixels.int
getWidth()
Reports back the width in pixels.double
getZBack()
Returns the quantityzBack
which is described in the plain vanilla constructor forRasterDepthGraphics
.int
getZBits()
This needs to return a value betweenRasterDepthGraphics.ZBITS_0
andRasterDepthGraphics.ZBITS_24
, inclusive.double
getZFront()
Returns the quantityzFront
which is described in the plain vanilla constructor forRasterDepthGraphics
.
-
-
-
Method Detail
-
getWidth
int getWidth()
Reports back the width in pixels. This is polled once during construction of the 3D rendering graphics context.
-
getHeight
int getHeight()
Reports back the height in pixels. This is polled once during construction of the 3D rendering graphics context.
-
getZBits
int getZBits()
This needs to return a value betweenRasterDepthGraphics.ZBITS_0
andRasterDepthGraphics.ZBITS_24
, inclusive. It tells the 3D rendering context how many bits for the z buffering strategy to employ. This method is polled once during construction of the graphics context.
-
getZFront
double getZFront()
Returns the quantityzFront
which is described in the plain vanilla constructor forRasterDepthGraphics
. This is polled once during construction of the graphics context.
-
getZBack
double getZBack()
Returns the quantityzBack
which is described in the plain vanilla constructor forRasterDepthGraphics
. This is polled once during construction of the graphics context.
-
getAccurateZ
boolean getAccurateZ()
Tells the 3D rendering context whether to employ a more accurate z computation strategy, the added expense being a slightly more significant CPU utilization. This method is polled once during construction of the graphics context.Two things will happen when the accurate z computation method is chosen: (1) the "native" internal z space where computations take place will be shifted/translated to be centered around the origin [or the x/y plane in three dimensions], and (2) 64 bit to 32 bit aliasing will be employed as part of an attempt to chop away excessive computational/accumulation errors as pertaining to z buffer buckets.
The default, less accurate internally employed z space spans from z equals zero (that being the "back") to z equals two to the power of
getZBits()
(that being the "front"). When the accurate z computation method is employed, that space is simply shifted by half its span in the negative z direction, to make the z region centered around zero. These are automatic computations that the developer need not be concerned about. In order to minimize the errors introduced into z computations, developers may choose to match thezFront
andzBack
clipping planes with the internal ones just described.
-
drawPixel
void drawPixel(int index, int color, int zDepth)
Is told to "paint" the specified pixel location with the specified color (which is in ARGB, or0xaarrggbb
format), where the pixel's sampling point has the specified z depth. Obviously if there is an opaque color already set at a z value which is in front of the specified z depth, then this paint operation will probably do nothing. How translucent pixels are handled is up to the implementation of this interface.The value
zDepth
will fall between zero and a power of two minus one (the "upper bound"), inclusive. IfgetZBits()
reportsRasterDepthGraphics.ZBITS_16
then the upper inclusive bound forzDepth
is0x0000ffff
. On the other hand ifgetZBits()
reportsZBITS_24
then the upper inclusive bound forzDepth
is0x00ffffff
, etc. The z value zero is at the furthest distance from the viewer. Orientation: for pixelindex = y*getWidth() + x
(x,y)
.
-
clearScanLine
void clearScanLine(int beginIndex, int length, int color)
The invocation of this method is triggered by a call toRasterDepthGraphics.clear()
. Therefore all pixels in the underlying pixel buffer should be set to the specified color, and all z buffer data should be zeroed out as a result of this call, on the scan line specified. (Theclear()
operation is subject to clipping rectangle.)
-
-