1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>GXSetAlphaCompare</title> 10</head> 11 12<body> 13 14<h1 align="left">GXSetAlphaCompare</h1> 15 16<h2>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/gx.h> 19 20void GXSetAlphaCompare( 21 <a href="../Enumerated_Types/GXCompare.html">GXCompare</a> comp0, 22 u8 ref0, 23 <a href="../Enumerated_Types/GXAlphaOp.html">GXAlphaOp</a> op, 24 <a href="../Enumerated_Types/GXCompare.html">GXCompare</a> comp1, 25 u8 ref1 ); 26</pre></dd></dl> 27 28<h2>Arguments</h2> 29<TABLE class="arguments" border="1" > 30 <tr> 31<TH><STRONG><EM><CODE>comp0</CODE></EM></STRONG></TH> 32<TD>Comparison subfunction0. Applicable values are as follows:<BR> 33 <TABLE class="arguments" border="1" > 34 <tr> 35<TD bgcolor="#C0C0C0">Name</TD> 36<TD bgcolor="#C0C0C0">Comparison Method for subfunction0</TD> 37 </tr> 38 <tr> 39<TH>GX_NEVER</TH> 40<TD>Always <CODE>FALSE</CODE>.</TD> 41 </tr> 42 <tr> 43<TH>GX_LESS</TH> 44<TD>( ( <em><code>alpha_src</code></em> < <SPAN class="argument">ref0</SPAN> )</TD> 45 </tr> 46 <tr> 47<TH>GX_LEQUAL</TH> 48<TD>( ( <em><code>alpha_src</code></em> <= <SPAN class="argument">ref0</SPAN> )</TD> 49 </tr> 50 <tr> 51<TH>GX_EQUAL</TH> 52<TD>( ( <em><code>alpha_src</code></em> == <SPAN class="argument">ref0</SPAN> )</TD> 53 </tr> 54 <tr> 55<TH>GX_NEQUAL</TH> 56<TD>( ( <em><code>alpha_src</code></em> != <SPAN class="argument">ref0</SPAN> )</TD> 57 </tr> 58 <tr> 59<TH>GX_GEQUAL</TH> 60<TD>( ( <em><code>alpha_src</code></em> >= <SPAN class="argument">ref0</SPAN> )</TD> 61 </tr> 62 <tr> 63<TH>GX_GREATER</TH> 64<TD>( ( <em><code>alpha_src</code></em> > <SPAN class="argument">ref0</SPAN> )</TD> 65 </tr> 66 <tr> 67<TH>GX_ALWAYS</TH> 68<TD>Always true</TD> 69 </tr> 70 </TABLE> 71 </TD> 72 </tr> 73 <tr> 74<TH><STRONG><EM><CODE>ref0</CODE></EM></STRONG></TH> 75<TD>Reference value for subfunction0. An 8-bit value.</TD> 76 </tr> 77 <tr> 78<TH><STRONG><EM><CODE>op</CODE></EM></STRONG></TH> 79<TD>An operator for combining subfunction0 and subfunction1. Applicable values are as follows:<BR> 80 <TABLE class="arguments" border="1" > 81 <tr> 82<TD bgcolor="#C0C0C0">Name</TD> 83<TD bgcolor="#C0C0C0">Logical Method</TD> 84 </tr> 85 <tr> 86<TH>GX_AOP_AND</TH> 87<TD>( ( <em><code>subfunction0</code></em> ) <strong>AND</strong> ( <em><code>subfunction1</code></em> )</TD> 88 </tr> 89 <tr> 90<TH>GX_AOP_OR</TH> 91<TD>( <em><code>subfunction0</code></em> ) <strong>OR</strong> ( <em><code>subfunction1</code></em> )</TD> 92 </tr> 93 <tr> 94<TH>GX_AOP_XOR</TH> 95<TD>( <em><code>subfunction0</code></em> ) <strong>XOR</strong> ( <em><code>subfunction1</code></em> )</TD> 96 </tr> 97 <tr> 98<TH>GX_AOP_XNOR</TH> 99<TD>( <em><code>subfunction0</code></em> ) <strong>XNOR</strong> ( <em><code>subfunction1</code></em> )</TD> 100 </tr> 101 </TABLE> 102 </TD> 103 </tr> 104 <tr> 105<TH><STRONG><EM><CODE>comp1</CODE></EM></STRONG></TH> 106<TD>Comparison subfunction1. Applicable values are as follows:<BR> 107 <TABLE class="arguments" border="1" > 108 <tr> 109<TD bgcolor="#C0C0C0">Name</TD> 110<TD bgcolor="#C0C0C0">Comparison Method for subfunction1</TD> 111 </tr> 112 <tr> 113<TH>GX_NEVER</TH> 114<TD>Always false</TD> 115 </tr> 116 <tr> 117<TH>GX_LESS</TH> 118<TD>( ( <em><code>alpha_src</code></em> < <SPAN class="argument">ref1</SPAN> )</TD> 119 </tr> 120 <tr> 121<TH>GX_LEQUAL</TH> 122<TD>( ( <em><code>alpha_src</code></em> <= <SPAN class="argument">ref1</SPAN> )</TD> 123 </tr> 124 <tr> 125<TH>GX_EQUAL</TH> 126<TD>( ( <em><code>alpha_src</code></em> == <SPAN class="argument">ref1</SPAN> )</TD> 127 </tr> 128 <tr> 129<TH>GX_NEQUAL</TH> 130<TD>( ( <em><code>alpha_src</code></em> != <SPAN class="argument">ref1</SPAN> )</TD> 131 </tr> 132 <tr> 133<TH>GX_GEQUAL</TH> 134<TD>( ( <em><code>alpha_src</code></em> >= <SPAN class="argument">ref1</SPAN> )</TD> 135 </tr> 136 <tr> 137<TH>GX_GREATER</TH> 138<TD>( ( <em><code>alpha_src</code></em> > <SPAN class="argument">ref1</SPAN> )</TD> 139 </tr> 140 <tr> 141<TH>GX_ALWAYS</TH> 142<TD>Always true</TD> 143 </tr> 144 </TABLE> 145 </TD> 146 </tr> 147 <tr> 148<TH><STRONG><EM><CODE>ref1</CODE></EM></STRONG></TH> 149<TD>Reference value for subfunction1. An 8-bit value.</TD> 150 </tr> 151</TABLE> 152 153<h2>Return Values</h2> 154<p>None.</p> 155 156<H2>Description</H2> 157<P>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 <A href="GXSetNumTevStages.html"><CODE>GXSetNumTevStages</CODE></A> function.</P> 158<P>The output alpha can be used in blending equations (see the <A href="../PixelProc/GXSetBlendMode.html"><CODE>GXSetBlendMode</CODE></A> function) to control how input and target (frame buffer) pixels are blended.</P> 159<P>The alpha comparison is:</P> 160<DL><DD><CODE><EM>alpha_pass</EM></CODE> = ( <CODE><EM>alpha_src</EM></CODE> ( <SPAN class="argument">comp0</SPAN> ) <SPAN class="argument">ref0</SPAN> ) ( <SPAN class="argument">op</SPAN> ) ( <CODE><EM>alpha_src</EM></CODE> ( <SPAN class="argument">comp1</SPAN> ) <SPAN class="argument">ref1</SPAN> )</DD></DL> 161<P>Where <CODE><EM>alpha_src</EM></CODE> is the alpha from the last active TEV stage. As an example, you can implement these equations:</P> 162<DL><DD><CODE><EM>alpha_pass</EM></CODE> = ( <CODE><EM>alpha_src</EM></CODE> <STRONG>></STRONG> <SPAN class="argument">ref0</SPAN> ) <STRONG>AND</STRONG> ( <CODE><EM>alpha_src</EM></CODE> <STRONG><</STRONG> <SPAN class="argument">ref1</SPAN> )</DD></DL> 163<P>or</P> 164<DL><DD><CODE><EM>alpha_pass</EM></CODE> = ( <CODE><EM>alpha_src</EM></CODE> <STRONG>></STRONG> <SPAN class="argument">ref0</SPAN> ) <STRONG>OR</STRONG> ( <CODE><EM>alpha_src</EM></CODE> <STRONG><</STRONG> <SPAN class="argument">ref1</SPAN> )</DD></DL> 165<P>The Z compare can occur either before or after texturing. See the <a href="../PixelProc/GXSetZCompLoc.html"><code>GXSetZCompLoc</code></a> 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.</P> 166<P>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.</P> 167 168<h2>See Also</h2> 169<P class="reference"> 170<A href="GXSetNumTevStages.html">GXSetNumTevStages</A>, 171<a href="GXSetTevAlphaIn.html">GXSetTevAlphaIn</a>, 172<a href="GXSetTevAlphaOp.html">GXSetTevAlphaOp</a>, 173<a href="../PixelProc/GXSetBlendMode.html">GXSetBlendMode</a>, 174<a href="../PixelProc/GXSetZCompLoc.html">GXSetZCompLoc</a> 175</p> 176 177<H2>Revision History</H2> 178<P> 1792008/05/12 Corrected the old function name, <CODE>GXSetTevStages</CODE>, to the new name, <CODE>GXSetNumTevStages</CODE><br> 2006/03/01 Initial version.<br><br> 180</P> 181 182<hr><p>CONFIDENTIAL</p></body> 183</HTML>