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>GXSetTexCoordGen2</CODE></TITLE> 9</HEAD> 10<BODY> 11<H1 align="left"><CODE>GXSetTexCoordGen2</CODE></H1> 12<H2>C Specification</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <revolution/gx.h></CODE></PRE> 16 <DD> 17 <PRE><CODE>void 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 );</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>dst_coord</CODE></STRONG></EM></TD> 30<TD width="520"><A href="../Enumerated_Types/GXTexCoordID.html">name</A> of the texture coordinate to be generated. <BR>Accepted values are <code>GX_TEXCOORD0</code>, <code>GX_TEXCOORD1</code>, <code>GX_TEXCOORD2</code> through <code>GX_TEXCOORD7</code>.</TD> 31 </TR> 32 <TR> 33<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE><STRONG><EM><CODE>func</CODE></EM></STRONG></CODE></STRONG></EM></TD> 34<TD width="520"><A href="../Enumerated_Types/GXTexGenType.html">feature</A> used to generate texture coordinates 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">Type of Texture Coordinate Generation</TD> 40 </tr> 41 <tr> 42<TD width="150"><code>GX_TG_MTX2x4</code></TD> 43<TD width="350">Source attributes are converted into a 2x4 matrix.</TD> 44 </tr> 45 <tr> 46<TD width="150"><code>GX_TG_MTX3x4</code></TD> 47<TD width="350">Source attributes are converted into a 3x4 matrix.</TD> 48 </tr> 49 <tr> 50<TD width="150"><code>GX_TG_BUMP0-7</code></TD> 51<TD width="350">Embossed-style bump texture coordinates.</TD> 52 </tr> 53 <tr> 54<TD width="150"><code>GX_TG_SRTG</code></TD> 55<TD width="350">R (red)/G (green) components from color channel output.</TD> 56 </tr> 57 58 </TABLE> 59 </TD> 60 </TR> 61 <TR> 62<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE><STRONG><EM><CODE>src_param</CODE></EM></STRONG></CODE></STRONG></EM></TD> 63<TD width="520">Name of source attributes used to generate texture coordinates. 64 <DIV align="left"> 65 <TABLE border="1" width="500" cellspacing="0.1"> 66 <TBODY> 67 <TR> 68<TD width="150" bgcolor="#C0C0C0">Functions</TD> 69<TD width="350" bgcolor="#C0C0C0">Specifiable values for <CODE>src_param</CODE> are:</TD> 70 </TR> 71 <TR> 72<TD width="150"><CODE>GX_TG_MTX3x4<BR> GX_TG_MTX2x4</CODE></TD> 73<TD width="350"><CODE>GX_TG_POS (position coordinate)<BR> GX_TG_NRM (normal)<BR> GX_TG_BINRM (binormal) <BR> GX_TG_TANGENT (tangential)<BR> GX_TG_TEX0-7 (input texture coordinates)</CODE></TD> 74 </TR> 75 <TR> 76 <TD width="150"><CODE>GX_TG_BUMP0-7</CODE></TD> 77 <TD width="350"><CODE>GX_TG_TEXCOORD0-6</CODE></TD> 78 </TR> 79 <TR> 80<TD width="150"><CODE>GX_TG_SRTG</CODE></TD> 81<TD width="350"><CODE>GX_TG_COLOR0<BR> GX_TG_COLOR1</CODE></TD> 82 </TR> 83 </TBODY> 84 </TABLE> 85 </DIV> 86 </TD> 87 </TR> 88 <TR> 89<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE><STRONG><EM><CODE>mtx</CODE></EM></STRONG></CODE></STRONG></EM></TD> 90 <TD width="520"> 91 <DIV align="left"> 92 <TABLE border="1" width="500" cellspacing="0.1"> 93 <TBODY> 94 <TR> 95<TD width="150" bgcolor="#C0C0C0">Functions</TD> 96<TD width="350" bgcolor="#C0C0C0">Specifiable values for <CODE>mtx</CODE> are:</TD> 97 </TR> 98 <TR> 99<TD width="150"><CODE>GX_TG_MTX2x4</CODE><BR><CODE>GX_TG_MTX3x4</CODE> </TD> 100 <TD width="350"><CODE>GX_TEXMTX0-9, GX_IDENTITY</CODE></TD> 101 </TR> 102 <TR> 103 <TD width="150"><CODE>GX_TG_BUMP0-7</CODE></TD> 104 <TD width="350"><CODE>not used</CODE></TD> 105 </TR> 106 <TR> 107 <TD width="150"><CODE>GX_TG_SRTG</CODE></TD> 108 <TD width="350"><CODE>not used</CODE></TD> 109 </TR> 110 </TBODY> 111 </TABLE> 112 </DIV> 113 </TD> 114 </TR> 115 <TR> 116<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>normalize</CODE></STRONG></EM></TD> 117<TD width="520">Specifies whether or not to normalize texture coordinates after conversion on the first path (<CODE>GX_TG_MTX</CODE>* only).</TD> 118 </TR> 119 <TR> 120<TD width="120" valign="top" bgcolor="#ffffe8"><EM><STRONG><CODE>postmtx</CODE></STRONG></EM></TD> 121<TD width="520">Specifies the <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> 122 </TR> 123 </TBODY> 124</TABLE> 125<H2>Return Values</H2> 126<P>None.</P> 127<H2>Description</H2> 128<P>This function is an expanded version of <A href="GXSetTexCoordGen.html"><CODE>GXSetTexCoordGen</CODE></A> which can specify options for generating texture coordinates.</P> 129<P>The first four arguments are identical to those for <a href="GXSetTexCoordGen.html"><code>GXSetTexCoordGen</code></a> and function in the same way. Only the new arguments are reviewed here. All other requirements specified in <a href="GXSetTexCoordGen.html"><code>GXSetTexCoordGen</code></a> still apply for <code>GXSetTexCoordGen2</code>.</P> 130<P>The new options apply only for ordinary texture coordinate generation, where the texgen 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> 131<P>The <code>normalize</code> argument allows the calculated texcoord to be normalized after the multiplication by <code>mtx</code> (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> 132<P align="CENTER"><FONT size="2"><IMG src="./image/Normalize.gif" width="245" height="74"></FONT></P> 133<P>After the optional normalization step, the texcoord is then multiplied by the 3x4 matrix, <code>postmtx</code>. This matrix is referred to as the <a href="../Enumerated_Types/GXPTTexMtx.html">post-transform matrix</a> (<em>PTMatrix</em> below):</P> 134<P align="CENTER"><FONT size="2"><IMG src="./image/PTransform.gif" width="346" height="98"></FONT></P> 135<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> 136<P>This step results in a texture coordinate for the texture lookup.</P> 137<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.</P> 138<P> </P> 139<H2>See Also</H2> 140<P><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></P> 141<H2>Revision History</H2> 142<P> 1432007/06/11 Added a link to the GXPTTexMtx enumerated type of post-transform matrices. Corrected typos.<br>2006/03/01 Initial version. <BR> 144</P> 145<hr> 146<P>CONFIDENTIAL</p> 147</BODY> 148</HTML>