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><CODE>GXSetTevColorOp</CODE></TITLE> 9</HEAD> 10<BODY> 11<H1 align="left"><CODE>GXSetTevColorOp</CODE></H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/gx.h> 16 17void GXSetTevColorOp( 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><STRONG><EM><CODE>stage</CODE></EM></STRONG></TH> 31<TD>The TEV stage <A href="../Enumerated_Types/GXTevStageID.html">name</A>. Accepted values are: <code>GX_TEVSTAGE0</code>, <code>GX_TEVSTAGE1</code>, <code>GX_TEVSTAGE2</code> through <code>GX_TEVSTAGE15</code>.</TD> 32 </TR> 33 <TR> 34<TH><STRONG><EM><CODE>op</CODE></EM></STRONG></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] > 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] > 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] > 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_RGB8_GT</TH> 75<TD><code><em>R: d[R] + ((a[R] > b[R]) ? c[R] :0 );<br> G: d[G] + ((a[G] > b[G]) ? c[G] :0 );<br> B: d[B] + ((a[B] > b[B]) ? c[B] : 0 );</em></code></TD> 76 </tr> 77 <tr> 78<TH>GX_TEV_COMP_RGB8_EQ</TH> 79<TD><code><em>R: d[R] + ((a[R] == b[R]) ? c[R] :0 );<br> G: d[G] + ((a[G] == b[G]) ? c[G] :0 );<br> B: d[B] + ((a[B] == b[B]) ? c[B] : 0 );</em></code></TD> 80 </tr> 81 </TABLE> 82 </TD> 83 </TR> 84 <TR> 85<TH>add_bias</TH> 86<TD>Bias <a href="../Enumerated_Types/GXTevBias.html">value</a>. 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> 105Be aware that the bias works 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><STRONG><EM><CODE>scale</CODE></EM></STRONG></TH> 109<TD>Scale <a href="../Enumerated_Types/GXTevScale.html">value</a>. 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 </TD> 133 </TR> 134 <TR> 135<TH><STRONG><EM><CODE>clamp</CODE></EM></STRONG></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><STRONG><EM><CODE>out_reg</CODE></EM></STRONG></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 color combiner functions for this <SPAN class="argument">stage</SPAN> of the texture environment (TEV) unit. This function also specifies the output register, <SPAN class="argument">out_reg</SPAN>, that will contain the result of the color combiner function. The color combiner function is:</P> 150<DL><DD><SPAN class="argument">out_reg</SPAN> = (<EM><CODE>d</EM></CODE> ( <SPAN class="argument">op</SPAN> ) (( 1.0 - <EM><CODE>c</EM></CODE> ) * <EM><CODE>a</EM></CODE> + <EM><CODE>c</EM></CODE> * <EM><CODE>b</EM></CODE> ) + <SPAN class="argument">bias</SPAN> ) * <SPAN class="argument">scale</SPAN>;</DD></DL> 151<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 selected using the <A href="GXSetTevColorIn.html"><CODE>GXSetTevColorIn</CODE></A> function. The input operands <EM><CODE>a</CODE></EM>, <EM><CODE>b</CODE></EM> and <EM><CODE>c</CODE></EM> are unsigned 8-bit inputs ( 0 <= <EM><CODE>a</CODE></EM>, <EM><CODE>b</CODE></EM>, <EM><CODE>c</CODE></EM> <= 255 ). The <EM><CODE>d</CODE></EM> input is a signed 10-bit input ( -1024 <= <EM><CODE>d</CODE></EM> <= 1023 ). 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 TEV output registers are shared among all the TEV stages. The TEV output registers can also be used as constant color inputs, so the application should be careful to allocate input and output registers so no collision occurs when implementing a particular equation. The application must output to <CODE>GX_TEVPREV</CODE> in the last active TEV stage.</P> 153<P>The <A href="GXSetTevOp.html"><CODE>GXSetTevOp</CODE></A> function provides a simpler way to set the parameters of the <A href="GXSetTevColorIn.html"><CODE>GXSetTevColorIn</CODE></A> and <CODE>GXSetTevColorOp</CODE> functions based on predefined equation names. You should not mix usage of the <A href="GXSetTevOp.html"><CODE>GXSetTevOp</CODE></A> function with the <A href="GXSetTevColorIn.html"><CODE>GXSetTevColorIn</CODE></A> and <CODE>GXSetTevColorOp</CODE> functions. The <A href="GXSetTevOp.html"><CODE>GXSetTevOp</CODE></A> function makes some assumptions about the output register usage, namely that <A href="../Enumerated_Types/GXTevRegID.html"><CODE>GX_TEVPREV</CODE></A> is always the output register and is used to pass the result of the previous TEV stage to the next TEV stage.</P> 154 155<H2>See Also</H2> 156<p>None.</p> 157 158<H2>Revision History</H2> 159<P> 1602006/03/01 Initial version.<br> 161</P> 162 163<hr><p>CONFIDENTIAL</p></body> 164</HTML>