1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="Microsoft FrontPage 5.0">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
8<TITLE>GXSetTevAlphaOp</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXSetTevAlphaOp</H1>
12<H2>C Specification</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17  <PRE><CODE>void GXSetTevAlphaOp(
18    <A href="../Enumerated_Types/GXTevStageID.html">GXTevStageID</A>    stage,
19    <A href="../Enumerated_Types/GXTevOp.html">GXTevOp</A>         op,
20    <A href="../Enumerated_Types/GXTevBias.html">GXTevBias</A>       bias,
21    <A href="../Enumerated_Types/GXTevScale.html">GXTevScale</A>      scale,
22    <A href="../Enumerated_Types/GXBool.html">GXBool</A>          clamp,
23    <A href="../Enumerated_Types/GXTevRegID.html">GXTevRegID</A>      out_reg );</CODE></PRE>
24</DL>
25<H2>Arguments</H2>
26<TABLE border="1" cellpadding="3" cellspacing="0.1">
27  <TBODY>
28    <TR>
29<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>stage</FONT></STRONG></EM></TD>
30<TD width="520">Name of the TEV <a href="../Enumerated_Types/GXTevStageID.html">stage</a><code>.</code><BR>Accepted values are: <code>GX_TEVSTAGE0</code>, <code>GX_TEVSTAGE1</code>, <code>GX_TEVSTAGE2</code> through <code>GX_TEVSTAGE15</code>.</TD>
31    </TR>
32    <TR>
33<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>op</FONT></STRONG></EM></TD>
34<TD width="520">TEV <a href="../Enumerated_Types/GXTevOp.html">operation</a>. Accepted values are:<BR>
35      <TABLE border="1" width="500" cellspacing="0.1">
36
37          <tr>
38<TD width="150" bgcolor="#C0C0C0">Name</TD>
39<TD width="350" bgcolor="#C0C0C0">Equation</TD>
40          </tr>
41          <tr>
42<TD width="150"><code>GX_TEV_ADD</code></TD>
43<TD width="350"><code><em>(d + ((1.0 - c)*a + c*b) + bias) * scale;</em></code></TD>
44          </tr>
45          <tr>
46<TD width="150"><code>GX_TEV_SUB</code></TD>
47<TD width="350"><code><em>(d - ((1.0 - c)*a + c*b) + bias) * scale;</em></code></TD>
48          </tr>
49          <tr>
50<TD width="150"><code>GX_TEV_COMP_R8_GT</code></TD>
51<TD width="350"><code><em>d + ((a[R] &gt; b[R]) ? c : 0 );</em></code></TD>
52          </tr>
53          <tr>
54<TD width="150"><code>GX_TEV_COMP_R8_EQ </code></TD>
55<TD width="350"><code><em>d + ((a[R] == b[R]) ? c : 0 );</em></code></TD>
56          </tr>
57          <tr>
58<TD width="150"><code>GX_TEV_COMP_GR16_GT</code></TD>
59<TD width="350"><code><em>d + ((a[GR] &gt; b[GR]) ? c : 0 );</em></code></TD>
60          </tr>
61          <tr>
62<TD width="150"><code>GX_TEV_COMP_GR16_EQ</code></TD>
63<TD width="350"><code><em>d + ((a[GR] == b[GR]) ? c : 0 );</em></code></TD>
64          </tr>
65          <tr>
66<TD width="150"><code>GX_TEV_COMP_BGR24_GT</code></TD>
67<TD width="350"><code><em>d + ((a[BGR] &gt; b[BGR]) ? c : 0 );</em></code></TD>
68          </tr>
69          <tr>
70<TD width="150"><code>GX_TEV_COMP_BGR24_EQ</code></TD>
71<TD width="350"><code><em>d + ((a[BGR] == b[BGR]) ? c : 0 );</em></code></TD>
72          </tr>
73          <tr>
74<TD width="150"><code>GX_TEV_COMP_A8_GT</code></TD>
75<TD width="350"><code><em>d + ((a[A] &gt; b[A]) ?c : 0 );</em></code></TD>
76          </tr>
77          <tr>
78<TD width="150"><code>GX_TEV_COMP_A8_EQ</code></TD>
79<TD width="350"><code><em>d + ((a[A] &gt; b[A]) ?c : 0 );</em></code></TD>
80          </tr>
81
82      </TABLE>
83      </TD>
84    </TR>
85    <TR>
86<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>bias</FONT></STRONG></EM></TD>
87<TD width="520">Bias <a href="../Enumerated_Types/GXTevBias.html">value</a>.&nbsp;Accepted values are:<BR>
88      <TABLE border="1" width="500" cellspacing="0.1">
89
90          <tr>
91<TD width="150" bgcolor="#C0C0C0">Name</TD>
92<TD width="350" bgcolor="#C0C0C0">bias value</TD>
93          </tr>
94          <tr>
95<TD width="150"><code>GX_TB_ZERO</code></TD>
96            <TD width="350">0</TD>
97          </tr>
98          <tr>
99<TD width="150"><code>GX_TB_ADDHALF</code></TD>
100            <TD width="350">0.5 (128)</TD>
101          </tr>
102          <tr>
103<TD width="150"><code>GX_TB_SUBHALF</code></TD>
104            <TD width="350">-0.5 (-128)</TD>
105          </tr>
106
107      </TABLE>
108<B>Note:</B> The bias works only when <strong><em><CODE>op</code></em></strong> is set to <code>GX_TEV_ADD</code> or <code>GX_TEV_SUB</code>. Otherwise this argument must be always set to <code>GX_TB_ZERO</code>.</TD>
109    </TR>
110    <TR>
111<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>scale</FONT></STRONG></EM></TD>
112<TD width="520">Scale <a href="../Enumerated_Types/GXTevScale.html">value</a>.&nbsp;<BR>Accepted values are:<BR>
113      <TABLE border="1" width="500" cellspacing="0.1">
114
115          <tr>
116<TD width="150" bgcolor="#C0C0C0">Name</TD>
117<TD width="350" bgcolor="#C0C0C0">scale value</TD>
118          </tr>
119          <tr>
120<TD width="150"><code>GX_CS_SCALE_1</code></TD>
121            <td width="350">1</td>
122          </tr>
123          <tr>
124<TD width="150"><code>GX_CS_SCALE_2</code></TD>
125            <td width="350"> 2</td>
126          </tr>
127          <tr>
128<TD width="150"><code>GX_CS_SCALE_4</code></TD>
129            <td width="350"> 4</td>
130          </tr>
131          <tr>
132<TD width="150"><code>GX_CS_DIVIDE_2</code></TD>
133            <td width="350"> 1/2</td>
134          </tr>
135
136      </TABLE>
137<BR><BR><B>Note:</B> The scale works only when <strong><em><CODE>op</font></em></strong> is set to <code>GX_TEV_ADD</code> or <code>GX_TEV_SUB</code>. Otherwise this argument must be always set to <code>GX_CS_SCALE_1</code>.</TD>
138    </TR>
139    <TR>
140<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>clamp</FONT></STRONG></EM></TD>
141<TD width="520">Clamp results when <code>GX_TRUE</code>.&nbsp;The range becomes 0.0 to 1.0 (0 to 255) after clamping.</TD>
142    </TR>
143    <TR>
144<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>out_reg</FONT></STRONG></EM></TD>
145<TD width="520">Output register <a href="../Enumerated_Types/GXTevRegID.html">name</a>. Accepted values are: <code>GX_TEVPREV</code>, <code>GX_TEVREG0</code>, <code>GX_TEVREG1</code>, <code>GX_TEVREG2</code>. The last active TEV stage must write <code>GX_TEVPREV</code>.</TD>
146    </TR>
147  </TBODY>
148</TABLE>
149<H2>Return Values</H2>
150<P>None.</P>
151<H2>Description</H2>
152<P>This function sets the <code><em><strong>op</strong></em></code>, <code><em><strong>scale</strong></em></code>, <code><em><strong>bias</strong></em></code>, and <em><code><strong>clamp</strong></code></em> values for the alpha combiner function for this <code><em><strong>stage</strong></em></code> of the Texture Environment (TEV) unit. In addition, this function also specifies the output register, <code><em><strong>out_reg</strong></em></code>, that will contain the result of the alpha combiner function.&nbsp;The alpha combiner function is as follows:</P>
153<P><font size="2"><code><em><strong>out_reg</strong> = (d (<strong>op</strong>) ((1.0 - c)*a + c*b) + <strong>bias</strong>) * <strong>scale</strong>;</em></code></font></P>
154<P>The input parameters, <EM><CODE>a</CODE></EM>, <EM><CODE>b</CODE></EM>, <EM><CODE>c</CODE></EM>, and <EM><CODE>d</CODE></EM> are set with the <A href="GXSetTevAlphaIn.html"><CODE>GXSetTevAlphaIn</CODE></A> function. The <EM><CODE>a</CODE></EM>, <EM><CODE>b</CODE></EM>, and <EM><CODE>c</CODE></EM> inputs are unsigned 8-bit inputs (where <EM><CODE>0 &lt;= a, b, c &lt;= 255</CODE></EM>). The <EM><CODE>d</CODE></EM> input is a signed 10 bit input (where <EM><CODE>-1024 &lt;= d &lt;= 1023</CODE></EM>).&nbsp;The result, <code><em><strong>out_reg</strong></em></code>, can also be a signed 10-bit result, depending on the <code><em><strong>clamp</strong></em></code> enable and the current clamping mode,</P>
155<P>The <A href="GXSetNumTevStages.html"><CODE>GXSetTevStages</CODE></A> functions needs to be used to make it possible to sequential TEV stages. Output the final active TEV stage's output and register to <CODE>GX_TEVPREV</CODE>.</P>
156<H2>See Also</H2>
157<P><A href="GXSetTevAlphaIn.html"><CODE>GXSetTevAlphaIn</CODE></A><A href="GXSetTevColorIn.html"><BR> <CODE>GXSetTevColorIn</CODE></A><BR> <A href="GXSetTevColorOp.html"><CODE>GXSetTevColorOp</CODE></A><BR> <A href="GXSetTevOp.html"><CODE>GXSetTevOp</CODE></A></P>
158<H2>Revision History</H2>
159<P>2006/03/01 Initial version.</P>
160<hr>
161<P>CONFIDENTIAL</p>
162</BODY>
163</HTML>
164