Interface RasterDepthPixBuff
-
public interface RasterDepthPixBuffThis 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 voidclearScanLine(int beginIndex, int length, int color)The invocation of this method is triggered by a call toRasterDepthGraphics.clear().voiddrawPixel(int index, int color, int zDepth)Is told to "paint" the specified pixel location with the specified color (which is in ARGB, or0xaarrggbbformat), where the pixel's sampling point has the specified z depth.booleangetAccurateZ()Tells the 3D rendering context whether to employ a more accurate z computation strategy, the added expense being a slightly more significant CPU utilization.intgetHeight()Reports back the height in pixels.intgetWidth()Reports back the width in pixels.doublegetZBack()Returns the quantityzBackwhich is described in the plain vanilla constructor forRasterDepthGraphics.intgetZBits()This needs to return a value betweenRasterDepthGraphics.ZBITS_0andRasterDepthGraphics.ZBITS_24, inclusive.doublegetZFront()Returns the quantityzFrontwhich 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_0andRasterDepthGraphics.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 quantityzFrontwhich is described in the plain vanilla constructor forRasterDepthGraphics. This is polled once during construction of the graphics context.
-
getZBack
double getZBack()
Returns the quantityzBackwhich 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 thezFrontandzBackclipping 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, or0xaarrggbbformat), 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
zDepthwill fall between zero and a power of two minus one (the "upper bound"), inclusive. IfgetZBits()reportsRasterDepthGraphics.ZBITS_16then the upper inclusive bound forzDepthis0x0000ffff. On the other hand ifgetZBits()reportsZBITS_24then the upper inclusive bound forzDepthis0x00ffffff, 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.)
-
-