#include <revolution/gx.h>
void GXSetAlphaCompare(
GXCompare comp0,
u8 ref0,
GXAlphaOp op,
GXCompare comp1,
u8 ref1 );
comp0 |
Comparison subfunction0. Applicable values are as follows:
|
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ref0 |
Reference value for subfunction0. An 8-bit value. | ||||||||||||||||||
op |
An operator for combining subfunction0 and subfunction1. Applicable values are as follows:
|
||||||||||||||||||
comp1 |
Comparison subfunction1. Applicable values are as follows:
|
||||||||||||||||||
ref1 |
Reference value for subfunction1. An 8-bit value. |
None.
This function sets the arguments for the alpha comparison function which uses alpha output from the last active texture environment (TEV) stage. The number of active TEV stages is specified using the GXSetNumTevStages function.
The output alpha can be used in blending equations (see the GXSetBlendMode function) to control how input and target (frame buffer) pixels are blended.
The alpha comparison is:
alpha_pass = ( alpha_src ( comp0 ) ref0 ) ( op ) ( alpha_src ( comp1 ) ref1 )Where alpha_src is the alpha from the last active TEV stage. As an example, you can implement these equations:
alpha_pass = ( alpha_src > ref0 ) AND ( alpha_src < ref1 )or
alpha_pass = ( alpha_src > ref0 ) OR ( alpha_src < ref1 )The Z compare can occur either before or after texturing. See the GXSetZCompLoc function. In the case where Z comparison occurs before texturing, the Z value is written based only on the Z test. The color is written if both the Z and alpha tests pass.
When Z comparisons occur after texturing, the color and Z are written if both the Z and alpha tests pass. When using texture to make cutout shapes (like billboard trees) that need to be correctly Z buffered, you should configure the pipeline for Z buffering after texturing.
GXSetNumTevStages, GXSetTevAlphaIn, GXSetTevAlphaOp, GXSetBlendMode, GXSetZCompLoc
2008/05/12 Corrected the old function name, GXSetTevStages, to the new name, GXSetNumTevStages
2006/03/01 Initial version.
CONFIDENTIAL