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
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17void 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 );
24</pre></dd></dl>
25
26<H2>Arguments</H2>
27<TABLE class="arguments" border="1" >
28  <TBODY>
29    <TR>
30<TH>stage</TH>
31<TD>Name of the TEV <A href="../Enumerated_Types/GXTevStageID.html">stage</A>. Accepted values are <code>GX_TEVSTAGE0</code>, <code>GX_TEVSTAGE1</code>, <code>GX_TEVSTAGE2</code>, ... , <code>GX_TEVSTAGE15</code>.</TD>
32    </TR>
33    <TR>
34<TH>op</TH>
35<TD>TEV <a href="../Enumerated_Types/GXTevOp.html">operation</a>. Accepted values are:<BR>
36      <TABLE class="arguments" border="1" >
37          <tr>
38<TD bgcolor="#C0C0C0">Name</TD>
39<TD bgcolor="#C0C0C0">Equation</TD>
40          </tr>
41          <tr>
42            <TH>GX_TEV_ADD</TH>
43            <TD><code><em>(d + ((1.0 - c)*a + c*b) + bias) * scale;</em></code></TD>
44          </tr>
45          <tr>
46            <TH>GX_TEV_SUB</TH>
47            <TD><code><em>(d - ((1.0 - c)*a + c*b) + bias) * scale;</em></code></TD>
48          </tr>
49          <tr>
50            <TH>GX_TEV_COMP_R8_GT</TH>
51            <TD><code><em>d + ((a[R] &gt; b[R]) ? c : 0 );</em></code></TD>
52          </tr>
53          <tr>
54            <TH>GX_TEV_COMP_R8_EQ</TH>
55            <TD><code><em>d + ((a[R] == b[R]) ? c : 0 );</em></code></TD>
56          </tr>
57          <tr>
58            <TH>GX_TEV_COMP_GR16_GT</TH>
59            <TD><code><em>d + ((a[GR] &gt; b[GR]) ? c : 0 );</em></code></TD>
60          </tr>
61          <tr>
62            <TH>GX_TEV_COMP_GR16_EQ</TH>
63            <TD><code><em>d + ((a[GR] == b[GR]) ? c : 0 );</em></code></TD>
64          </tr>
65          <tr>
66            <TH>GX_TEV_COMP_BGR24_GT</TH>
67            <TD><code><em>d + ((a[BGR] &gt; b[BGR]) ? c : 0 );</em></code></TD>
68          </tr>
69          <tr>
70            <TH>GX_TEV_COMP_BGR24_EQ</TH>
71            <TD><code><em>d + ((a[BGR] == b[BGR]) ? c : 0 );</em></code></TD>
72          </tr>
73          <tr>
74            <TH>GX_TEV_COMP_A8_GT</TH>
75            <TD><code><em>d + ((a[A] &gt; b[A]) ? c : 0 );</em></code></TD>
76          </tr>
77          <tr>
78            <TH>GX_TEV_COMP_A8_EQ</TH>
79            <TD><code><em>d + ((a[A] &gt; b[A]) ? c : 0 );</em></code></TD>
80          </tr>
81      </TABLE>
82      </TD>
83    </TR>
84    <TR>
85<TH>bias</TH>
86<TD>Bias <a href="../Enumerated_Types/GXTevBias.html">value</a>.&nbsp;Accepted values are:<BR>
87      <TABLE class="arguments" border="1" >
88          <tr>
89<TD bgcolor="#C0C0C0">Name</TD>
90<TD bgcolor="#C0C0C0">Bias value.</TD>
91          </tr>
92          <tr>
93<TH>GX_TB_ZERO</TH>
94            <TD>0</TD>
95          </tr>
96          <tr>
97<TH>GX_TB_ADDHALF</TH>
98            <TD>0.5 ( 128 )</TD>
99          </tr>
100          <tr>
101<TH>GX_TB_SUBHALF</TH>
102            <TD>-0.5 ( -128 )</TD>
103          </tr>
104      </TABLE>
105<B>Note:</B> The bias works properly only when <SPAN class="argument">op</SPAN> 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>
106    </TR>
107    <TR>
108<TH>scale</TH>
109<TD>Scale <a href="../Enumerated_Types/GXTevScale.html">value</a>.&nbsp;Accepted values are:<BR>
110      <TABLE class="arguments" border="1" >
111          <tr>
112<TD bgcolor="#C0C0C0">Name</TD>
113<TD bgcolor="#C0C0C0">Scale value.</TD>
114          </tr>
115          <tr>
116<TH>GX_CS_SCALE_1</TH>
117            <td>1</td>
118          </tr>
119          <tr>
120<TH>GX_CS_SCALE_2</TH>
121            <td>2</td>
122          </tr>
123          <tr>
124<TH>GX_CS_SCALE_4</TH>
125            <td>4</td>
126          </tr>
127          <tr>
128<TH>GX_CS_DIVIDE_2</TH>
129            <td>1/2</td>
130          </tr>
131      </TABLE>
132<B>Note:</B> The scale works properly only when <SPAN class="argument">op</SPAN> 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>
133    </TR>
134    <TR>
135<TH>clamp</TH>
136<TD>Clamp results when <CODE>GX_TRUE</CODE>. The range becomes 0.0 to 1.0 (0 to 255) after clamping.</TD>
137    </TR>
138    <TR>
139<TH>out_reg</TH>
140<TD>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>
141    </TR>
142  </TBODY>
143</TABLE>
144
145<H2>Return Values</H2>
146<P>None.</P>
147
148<H2>Description</H2>
149<P>This function sets the <SPAN class="argument">op</SPAN>, <SPAN class="argument">scale</SPAN>, <SPAN class="argument">bias</SPAN>, and <SPAN class="argument">clamp</SPAN> for the alpha combiner functions for this <SPAN class="argument">stage</SPAN> of the Texture Environment (TEV) unit. In addition, this function also specifies the output register, <SPAN class="argument">out_reg</SPAN>, that will contain the result of the alpha combiner function.&nbsp;The alpha combiner function is as follows.</P>
150<DL><DD><SPAN class="argument">out_reg</SPAN> = (<CODE><EM>d</EM></CODE> ( <SPAN class="argument">op</SPAN> ) (( 1.0 - <CODE><EM>c</EM></CODE> ) * <CODE><EM>a</EM></CODE> + <CODE><EM>c</EM></CODE> * <CODE><EM>b</EM></CODE> ) + <SPAN class="argument">bias</SPAN> ) * <SPAN class="argument">scale</SPAN>;</DD></DL>
151<P>The input parameters, <CODE><EM>a</EM></CODE>, <CODE><EM>b</EM></CODE>, <CODE><EM>c</EM></CODE>, and <CODE><EM>d</EM></CODE> are set with the <A href="GXSetTevAlphaIn.html"><CODE>GXSetTevAlphaIn</CODE></A> function. The inputs <CODE><EM>a</EM></CODE>, <CODE><EM>b</EM></CODE>, and <CODE><EM>c</EM></CODE> are unsigned, 8-bit numbers (where <CODE>0 &lt;= <EM>a</EM>, <EM>b</EM>, <EM>c</EM> &lt;= 255</CODE>). The input <CODE><EM>d</EM></CODE> is a signed 10-bit number (where <CODE>-1024 &lt;= <EM>d</EM> &lt;= 1023</CODE>). The result, <SPAN class="argument">out_reg</SPAN>, can also be a signed 10-bit result, depending on the clamping state <SPAN class="argument">clamp</SPAN> and the current clamping mode.</P>
152<P>The <A href="GXSetNumTevStages.html"><CODE>GXSetNumTevStages</CODE></A> function must be used to make it possible to use sequentially-numbered TEV stages. Output the final active TEV stage's output and register to <CODE>GX_TEVPREV</CODE>.</P>
153
154<H2>See Also</H2>
155<P class="reference">
156<A href="GXSetTevAlphaIn.html">GXSetTevAlphaIn</A>,
157<A href="GXSetTevColorIn.html">GXSetTevColorIn</A>,
158<A href="GXSetTevColorOp.html">GXSetTevColorOp</A>,
159<A href="GXSetTevOp.html">GXSetTevOp</A>
160</P>
161
162<H2>Revision History</H2>
163<P>
1642008/05/12 Corrected the old function name, <CODE>GXSetTevStages</CODE>, to the new name, <CODE>GXSetNumTevStages</CODE>.<br><br> 2006/03/01 Initial version.<br><br>
165</P>
166
167<hr><p>CONFIDENTIAL</p></body>
168</HTML>