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>GXSetTexCoordGen2</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXSetTexCoordGen2</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17void GXSetTexCoordGen2(
18    <A href="../Enumerated_Types/GXTexCoordID.html">GXTexCoordID</A>   dst_coord,
19    <A href="../Enumerated_Types/GXTexGenType.html">GXTexGenType</A>   func,
20    <A href="../Enumerated_Types/GXTexGenSrc.html">GXTexGenSrc</A>    src_param,
21    u32            <A href="../Enumerated_Types/GXTexMtx.html">mtx</A>,
22    <A href="../Enumerated_Types/GXBool.html">GXBool</A>         normalize,
23    u32            postmtx );
24</pre></dd></dl>
25
26<H2>Arguments</H2>
27<TABLE class="arguments" border="1" >
28  <TBODY>
29    <TR>
30      <TH>dst_coord</TH>
31      <TD><A href="../Enumerated_Types/GXTexCoordID.html">Name</A> of the texture coordinate to be generated. Accepted values are: <code>GX_TEXCOORD0</code>, <code>GX_TEXCOORD1</code>, <code>GX_TEXCOORD2</code> through <code>GX_TEXCOORD7</code>.</TD>
32    </TR>
33    <TR>
34      <TH><STRONG><EM><CODE>func</CODE></EM></STRONG></TH>
35      <TD><A href="../Enumerated_Types/GXTexGenType.html">Feature</A> used to generate texture coordinates. Accepted values are:<BR>
36      <TABLE class="arguments" border="1" >
37          <tr>
38            <TD bgcolor="#C0C0C0">Name</TD>
39            <TD bgcolor="#C0C0C0">Type of Texture Coordinate Generation</TD>
40          </tr>
41          <tr>
42            <TH>GX_TG_MTX2x4</TH>
43            <TD>Source attributes are converted into a 2x4 matrix.</TD>
44          </tr>
45          <tr>
46            <TH>GX_TG_MTX3x4</TH>
47            <TD>Source attributes are converted into a 3x4 matrix.</TD>
48          </tr>
49          <tr>
50            <TH>GX_TG_BUMP0-7</TH>
51            <TD>Embossed-style bump texture coordinates.</TD>
52          </tr>
53          <tr>
54            <TH>GX_TG_SRTG</TH>
55            <TD>R (red)/G (green) components from color channel output.</TD>
56          </tr>
57      </TABLE>
58      </TD>
59    </TR>
60    <TR>
61      <TH>src_param</TH>
62      <TD>Name of source attributes used to generate texture coordinates.
63      <TABLE class="arguments" border="1" >
64        <TBODY>
65          <TR>
66            <TD bgcolor="#C0C0C0">Features</TD>
67            <TD bgcolor="#C0C0C0">Specifiable values for <SPAN class="argument">src_param</SPAN> are:</TD>
68          </TR>
69          <TR>
70            <TH>GX_TG_MTX3x4<BR>
71            GX_TG_MTX2x4</TH>
72            <TD><CODE>GX_TG_POS</CODE> (Position coordinates)<BR>
73            <CODE>GX_TG_NRM</CODE> (Normal vector)<BR>
74            <CODE>GX_TG_BINRM</CODE> (Binormal vector)<BR>
75            <CODE>GX_TG_TANGENT</CODE> (Tangent)<BR>
76            <CODE>GX_TG_TEX0-7</CODE> (Input texture coordinates)</TD>
77          </TR>
78          <TR>
79            <TH>GX_TG_BUMP0-7</TH>
80            <TD><CODE>GX_TG_TEXCOORD0-6</CODE></TD>
81          </TR>
82          <TR>
83            <TH>GX_TG_SRTG</TH>
84            <TD><CODE>GX_TG_COLOR0</CODE><BR>
85            <CODE>GX_TG_COLOR1</CODE></TD>
86          </TR>
87        </TBODY>
88      </TABLE>
89      </TD>
90    </TR>
91    <TR>
92      <TH>mtx</TH>
93      <TD>
94      <TABLE class="arguments" border="1" >
95        <TBODY>
96          <TR>
97            <TD bgcolor="#C0C0C0">Features</TD>
98            <TD bgcolor="#C0C0C0">Specifiable values for <SPAN class="argument">mtx</SPAN> are:</TD>
99          </TR>
100          <TR>
101            <TH>GX_TG_MTX2x4<BR>
102            GX_TG_MTX3x4</TH>
103            <TD><CODE>GX_TEXMTX0-9</CODE>, <CODE>GX_IDENTITY</CODE></TD>
104          </TR>
105          <TR>
106            <TH>GX_TG_BUMP0-7</TH>
107            <TD>Not used.</TD>
108          </TR>
109          <TR>
110            <TH>GX_TG_SRTG</TH>
111            <TD>Not used.</TD>
112          </TR>
113        </TBODY>
114      </TABLE>
115      </TD>
116    </TR>
117    <TR>
118      <TH>normalize</TH>
119      <TD>Specifies whether or not to normalize texture coordinates after conversion on the first path (<CODE>GX_TG_MTX</CODE>* only).</TD>
120    </TR>
121    <TR>
122      <TH>postmtx</TH>
123      <TD>Specifies the <a href="../Enumerated_Types/GXPTTexMtx.html">post conversion matrix</a> for multiplying texture coordinates by (<CODE>GX_TG_MTX</CODE>* only).<BR>
124      Specifiable values are <CODE>GX_PTTEXMTX0-19</CODE> and <CODE>GX_PTIDENTITY</CODE>.</TD>
125    </TR>
126  </TBODY>
127</TABLE>
128
129<H2>Return Values</H2>
130<P>None.</P>
131
132<H2>Description</H2>
133<P>This function is an expanded version of the <A href="GXSetTexCoordGen.html"><CODE>GXSetTexCoordGen</CODE></A> function which can specify options for generating texture coordinates.</P>
134<P>The first four arguments are identical to those for the <A href="GXSetTexCoordGen.html"><CODE>GXSetTexCoordGen</CODE></A> function and operate in the same way. Only the new arguments are reviewed here.&nbsp;All other requirements specified in the <a href="GXSetTexCoordGen.html"><code>GXSetTexCoordGen</code></a> function still apply for the <code>GXSetTexCoordGen2</code> function.</P>
135<P>The new options apply only for ordinary texture coordinate generation, where the type is either <CODE>GX_TG_MTX2x4</CODE> or <CODE>GX_TG_MTX3x4</CODE>. They do not work for light-based texgens or emboss texgens.</P>
136<P>The <SPAN class="argument">normalize</SPAN> argument allows the calculated texture coordinate to be normalized after being multiplied by <SPAN class="argument">mtx</SPAN>, the first-pass transformation. The following calculation is performed (where [<EM>St<SUB>n</SUB>, Tt<SUB>n</SUB>, Qt<SUB>n</SUB></EM>] is the texture coordinate after the first-pass transformation):</P>
137<P align="CENTER"><IMG src="./image/Normalize.gif" width="245" height="74"></P>
138<P>After the optional normalization step, the texture coordinate is then multiplied by the 3x4 matrix, <SPAN class="argument">postmtx</SPAN>. This matrix is referred to as the <a href="../Enumerated_Types/GXPTTexMtx.html">post-transform matrix</a> (see <EM>PTMatrix</EM>, below).</P>
139<P align="CENTER"><IMG src="./image/PTransform.gif" width="346" height="98"></P>
140<P>There are certain limitations when a vertex contains only position and one texture coordinate and the texgen type is <CODE>GX_TG_MTX2x4</CODE>.&nbsp;In this special performance case, normalization is not performed (even when specified).&nbsp;In addition, the value of <EM>Qt<SUB>n</SUB></EM> is assumed to be 1.0, and <EM>Qt'<SUB>n</SUB></EM> is not calculated.</P>
141<P>This step results in a texture coordinate for the texture lookup.</P>
142<P>The post-transform matrices are separate from the first-pass matrices.&nbsp;They are stored in a separate memory area in the same format as the first-pass matrices except that all matrices have three rows.<br>When the texture coordinate generation type is <CODE>GX_TG_MTX3x4</CODE>, the actual 2D texture coordinate calculation is carried out by dividing S and T coordinates by Q after post-conversion multiplication has been performed.
143
144</P>
145
146<H2>See Also</H2>
147<P class="reference">
148<A href="GXSetNumTexGens.html">GXSetNumTexGens</A>,
149<A href="GXSetTexCoordGen.html">GXSetTexCoordGen</A>,
150<A href="../Geometry/GXSetVtxDesc.html">GXSetVtxDesc</A>,
151<A href="../Tev/GXSetTevOrder.html">GXSetTevOrder</A>
152</P>
153
154<H2>Revision History</H2>
155<P>
1562008/09/08 Added information about the method of calculating 2D coordinates when using <CODE>GX_TG_MTX3x4</CODE>.<br>2007/06/11 Added a link to <CODE>GXPTTexMtx</CODE>, the post-transform matrix enumerator. Corrected typos.<br>2006/03/01 Initial version.<br>
157</P>
158
159<hr><p>CONFIDENTIAL</p></body>
160</HTML>