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 17<h2>C Specification</h2> 18 19<dl> 20 <dd><PRE><CODE>#include <revolution/gx.h></CODE></PRE> 21 </dd> 22 <dd><pre><CODE>void GXSetAlphaCompare( 23 <a href="../Enumerated_Types/GXCompare.html">GXCompare</a> comp0, 24 u8 ref0, 25 <a href="../Enumerated_Types/GXAlphaOp.html">GXAlphaOp</a> op, 26 <a href="../Enumerated_Types/GXCompare.html">GXCompare</a> comp1, 27 u8 ref1 );</CODE></pre> 28 </dd> 29</dl> 30 31<h2>Arguments</h2> 32<TABLE border="1" cellspacing="0.1" cellpadding="3"> 33 <tr> 34<TD width="120" valign="top" bgcolor="#ffffe8"><code><strong><em>comp0</em></strong></code></TD> 35<TD width="520">comparison subfunction 0 <BR>Applicable values are as follows:<br> 36 <TABLE cellspacing="0.1" border="1" width="500"> 37 38 <tr> 39<TD bgcolor="#C0C0C0" width="150">Name</TD> 40<TD bgcolor="#C0C0C0" width="320">Comparison Expression for Subfunction 0</TD> 41 </tr> 42 <tr> 43<TD width="150"><code>GX_NEVER</code></TD> 44<TD width="320">always false</TD> 45 </tr> 46 <tr> 47<TD width="150"><code>GX_LESS</code></TD> 48<TD width="320"><em><code>(alpha_src <<strong>ref0</strong>)</code></em></TD> 49 </tr> 50 <tr> 51<TD width="150"><code>GX_LEQUAL</code></TD> 52<TD width="320"><em><code>(alpha_src <=<strong>ref0</strong>)</code></em></TD> 53 </tr> 54 <tr> 55<TD width="150"><code>GX_EQUAL</code></TD> 56<TD width="320"><em><code>(alpha_src ==<strong>ref0</strong>)</code></em></TD> 57 </tr> 58 <tr> 59<TD width="150"><code>GX_NEQUAL</code></TD> 60<TD width="320"><em><code>(alpha_src !=<strong>ref0</strong>)</code></em></TD> 61 </tr> 62 <tr> 63<TD width="150"><code>GX_GEQUAL</code></TD> 64<TD width="320"><em><code>(alpha_src >=<strong>ref0</strong>)</code></em></TD> 65 </tr> 66 <tr> 67<TD width="150"><code>GX_GREATER</code></TD> 68<TD width="320"><em><code>(alpha_src ><strong>ref0</strong>)</code></em></TD> 69 </tr> 70 <tr> 71<TD width="150"><code>GX_ALWAYS</code></TD> 72<TD width="320">always true</TD> 73 </tr> 74 75 </TABLE> 76 </TD> 77 </tr> 78 <tr> 79<TD width="120" valign="top" bgcolor="#ffffe8"><code><strong><em>ref0</em></strong></code></TD> 80<TD width="500">reference value for subfunction 0 <BR>An 8-bit value.</TD> 81 </tr> 82 <tr> 83<TD width="120" valign="top" bgcolor="#ffffe8"><code><strong><em>op</em></strong></code></TD> 84<TD width="500">an operator for combining subfunction 0 and subfunction 1 <BR>Applicable values are as follows:<br> 85 <TABLE border="1" cellspacing="0.1" width="500"> 86 87 <tr> 88<TD bgcolor="#C0C0C0" width="150">Name</TD> 89<TD bgcolor="#C0C0C0" width="320">Logical Formula</TD> 90 </tr> 91 <tr> 92<TD width="150"><code>GX_AOP_AND</code></TD> 93<TD width="320"><em><code>(subfunction0) <strong>AND</strong> (subfunction1)</code></em></TD> 94 </tr> 95 <tr> 96<TD width="150"><code>GX_AOP_OR</code></TD> 97<TD width="320"><em><code>(subfunction0) <strong>OR</strong> (subfunction1)</code></em></TD> 98 </tr> 99 <tr> 100<TD width="150"><code>GX_AOP_XOR</code></TD> 101<TD width="320"><em><code>(subfunction0) <strong>XOR</strong> (subfunction1)</code></em></TD> 102 </tr> 103 <tr> 104<TD width="150"><code>GX_AOP_XNOR</code></TD> 105<TD width="320"><em><code>(subfunction0) <strong>XNOR</strong> (subfunction1)</code></em></TD> 106 </tr> 107 108 </TABLE> 109 </TD> 110 </tr> 111 <tr> 112<TD width="120" valign="top" bgcolor="#ffffe8"><code><strong><em>comp1</em></strong></code></TD> 113<TD width="500">comparison subfunction 1 <BR>Applicable values are as follows:<br> 114 <TABLE border="1" cellspacing="0.1" width="500"> 115 116 <tr> 117<TD bgcolor="#C0C0C0" width="150">Name</TD> 118<TD bgcolor="#C0C0C0" width="320">comparison method for subfunction 1</TD> 119 </tr> 120 <tr> 121<TD width="150"><code>GX_NEVER</code></TD> 122<TD width="320">always false</TD> 123 </tr> 124 <tr> 125<TD width="150"><code>GX_LESS</code></TD> 126<TD width="320"><em><code>(alpha_src <<strong>ref1</strong>)</code></em></TD> 127 </tr> 128 <tr> 129<TD width="150"><code>GX_LEQUAL</code></TD> 130<TD width="320"><em><code>(alpha_src <=<strong>ref1</strong>)</code></em></TD> 131 </tr> 132 <tr> 133<TD width="150"><code>GX_EQUAL</code></TD> 134<TD width="320"><em><code>(alpha_src ==<strong>ref1</strong>)</code></em></TD> 135 </tr> 136 <tr> 137<TD width="150"><code>GX_NEQUAL</code></TD> 138<TD width="320"><em><code>(alpha_src !=<strong>ref1</strong>)</code></em></TD> 139 </tr> 140 <tr> 141<TD width="150"><code>GX_GEQUAL</code></TD> 142<TD width="320"><em><code>(alpha_src >=<strong>ref1</strong>)</code></em></TD> 143 </tr> 144 <tr> 145<TD width="150"><code>GX_GREATER</code></TD> 146<TD width="320"><em><code>(alpha_src ><strong>ref1</strong>)</code></em></TD> 147 </tr> 148 <tr> 149<TD width="150"><code>GX_ALWAYS</code></TD> 150<TD width="320">always true</TD> 151 </tr> 152 153 </TABLE> 154 </TD> 155 </tr> 156 <tr> 157<TD width="120" valign="top" bgcolor="#ffffe8"><code><strong><em>ref1</em></strong></code></TD> 158<TD width="500">reference value for subfunction 1 <BR>An 8-bit value.</TD> 159 </tr> 160</TABLE> 161<h2>Return Values</h2> 162 163<p>None.</p> 164<H2>Description</H2> 165<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 are specified using <a href="GXSetNumTevStages.html"><code>GXSetNumTevStages</code></a>.</P> 166<P>The output alpha can be used in blending equations (see <code><a href="../PixelProc/GXSetBlendMode.html">GXSetBlendMode</a></code>) to control how source and target (frame buffer) pixels are combined. </P> 167<P>The alpha comparison is:</P> 168<P><CODE><EM>alpha_pass</EM> = (<EM>alpha_src</EM> (<EM><STRONG>comp0</STRONG></EM>) <EM><STRONG>ref0</STRONG></EM>) (<EM><STRONG>op</STRONG></EM>) (<EM>alpha_src</EM> (<EM><STRONG>comp1</STRONG></EM>) <EM><STRONG>ref1</STRONG></EM>)</CODE></P> 169<P>where <em>alpha_src</em> is the alpha from the last active TEV stage. As an example, you can implement these equations:</P> 170<P><CODE><EM>alpha_pass</EM> = (<EM>alpha_src</EM> <STRONG>></STRONG> <EM><STRONG>ref0</STRONG></EM>) <STRONG>AND</STRONG> (<EM>alpha_src</EM> <STRONG><</STRONG> <EM><STRONG>ref1</STRONG></EM>)<BR> <EM>or</EM> <BR> <EM>alpha_pass</EM> = (<EM>alpha_src</EM> <STRONG>></STRONG> <EM><STRONG>ref0</STRONG></EM>) <STRONG>OR</STRONG> (<EM>alpha_src</EM> <STRONG><</STRONG> <EM><STRONG>ref1</STRONG></EM>)</CODE></P> 171<P>Z comparisons can occur either before or after texturing. Please refer to <a href="../PixelProc/GXSetZCompLoc.html"><code>GXSetZCompLoc</code></a>. In the case where Z comparison occurs before texturing, the Z is written based only on the Z test. The color is written if both the Z and alpha tests pass.</P> 172<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> 173<h2>See Also</h2> 174 175<p><A href="GXSetNumTevStages.html"><CODE>GXSetNumTevStages</CODE></A><br> <a href="GXSetTevAlphaIn.html"><CODE>GXSetTevAlphaIn</CODE></a><br> <a href="GXSetTevAlphaOp.html"><CODE>GXSetTevAlphaOp</CODE></a><br> <a href="../PixelProc/GXSetBlendMode.html"><CODE>GXSetBlendMode</CODE></a><br> <a href="../PixelProc/GXSetZCompLoc.html"><CODE>GXSetZCompLoc</CODE></a> 176</p> 177<H2>Revision History</H2> 178<P>2006/03/01 Initial version.</P> 179<hr> 180<P>CONFIDENTIAL</p> 181</BODY> 182</HTML> 183