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 <revolution/gx.h> 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>, and <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> GX_TG_MTX2x4</TH> 71<TD><CODE>GX_TG_POS</CODE> (position coordinate)<BR> <CODE>GX_TG_NRM</CODE> (normal)<BR> <CODE>GX_TG_BINRM</CODE> (binormal)<BR> <CODE>GX_TG_TANGENT</CODE> (tangent)<BR> <CODE>GX_TG_TEX0-7</CODE> (input texture coordinates)</TD> 72 </TR> 73 <TR> 74 <TH>GX_TG_BUMP0-7</TH> 75 <TD><CODE>GX_TG_TEXCOORD0-6</CODE></TD> 76 </TR> 77 <TR> 78<TH>GX_TG_SRTG</TH> 79<TD><CODE>GX_TG_COLOR0</CODE><BR> <CODE>GX_TG_COLOR1</CODE></TD> 80 </TR> 81 </TBODY> 82 </TABLE> 83 </TD> 84 </TR> 85 <TR> 86 <TH>mtx</TH> 87 <TD> 88 <TABLE class="arguments" border="1" > 89 <TBODY> 90 <TR> 91 <TD bgcolor="#C0C0C0">Features</TD> 92 <TD bgcolor="#C0C0C0">Specifiable values for <SPAN class="argument">mtx</SPAN> are:</TD> 93 </TR> 94 <TR> 95<TH>GX_TG_MTX2x4<BR> GX_TG_MTX3x4</TH> 96<TD><CODE>GX_TEXMTX0-9</CODE>, <CODE>GX_IDENTITY</CODE></TD> 97 </TR> 98 <TR> 99 <TH>GX_TG_BUMP0-7</TH> 100 <TD>Not used.</TD> 101 </TR> 102 <TR> 103 <TH>GX_TG_SRTG</TH> 104 <TD>Not used.</TD> 105 </TR> 106 </TBODY> 107 </TABLE> 108 </TD> 109 </TR> 110 <TR> 111<TH>normalize</TH> 112<TD>Whether to normalize texture coordinates after conversion on the first path (<CODE>GX_TG_MTX</CODE>* only).</TD> 113 </TR> 114 <TR> 115<TH>postmtx</TH> 116<TD><a href="../Enumerated_Types/GXPTTexMtx.html">Post conversion matrix</a> for multiplying texture coordinates by (<CODE>GX_TG_MTX</CODE>* only).<BR>Specifiable values are <CODE>GX_PTTEXMTX0-19</CODE> and <CODE>GX_PTIDENTITY</CODE>.</TD> 117 </TR> 118 </TBODY> 119</TABLE> 120 121<H2>Return Values</H2> 122<P>None.</P> 123 124<H2>Description</H2> 125<P>Expanded version of the <A href="GXSetTexCoordGen.html"><CODE>GXSetTexCoordGen</CODE></A> function that can specify options for generating texture coordinates.</P> 126<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. All other requirements specified in the <a href="GXSetTexCoordGen.html"><code>GXSetTexCoordGen</code></a> function still apply for the <code>GXSetTexCoordGen2</code> function.</P> 127<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> 128<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> 129<P align="CENTER"><IMG src="./image/Normalize.gif" width="245" height="74"></P> 130<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> 131<P align="CENTER"><IMG src="./image/PTransform.gif" width="346" height="98"></P> 132<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>. In this special performance case, normalization is not performed (even when specified). 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> 133<P>This step results in a texture coordinate for the texture lookup.</P> 134<P>The post-transform matrices are separate from the first-pass matrices. 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. 135 136</P> 137 138<H2>See Also</H2> 139<P> 140<A href="GXSetNumTexGens.html"><CODE>GXSetNumTexGens</CODE></A><BR> <A href="GXSetTexCoordGen.html"><CODE>GXSetTexCoordGen</CODE></A><BR> <A href="../Geometry/GXSetVtxDesc.html"><CODE>GXSetVtxDesc</CODE></A><BR> <A href="../Tev/GXSetTevOrder.html"><CODE>GXSetTevOrder</CODE></A> 141</P> 142 143<H2>Revision History</H2> 144<P> 1452008/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. 146</P> 147 148<hr><p>CONFIDENTIAL</p></body> 149</HTML>