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 http-equiv="Content-Style-Type" content="text/css"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<LINK rel="stylesheet" type="text/css" href="../../../CSS/revolution.css"> 8<TITLE>tg-dual</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">tg-dual</H1> 12 13<H2>Description</H2> 14<P>This program demonstrates a few methods of dual-transform texture coordinate generation. The dual-transform texgen feature makes it easy to render some texture effects such as the two examples shown in this demo. One is a texture projection (like shadows) which uses position for texgen source. Another is normal-based reflection mapping. In both cases, you can simply set position or normal transform matrices for the first texgen transform and one pre-calculated constant matrix for the second texgen. You don't have to recalculate texgen matrix every time and therefore you can save the CPU processing costs. This method is also suitable for stitched models.</P> 15 16<H2>Coverage</H2> 17<TABLE border="1" cellpadding="3" cellspacing="0.1" width="640"> 18 <TBODY> 19 <TR> 20<TD width="30%" bgcolor="#C0C0C0"><EM><STRONG>Functions</STRONG></EM></TD> 21<TD width="25%" bgcolor="#C0C0C0"><EM><STRONG>Parameters</STRONG></EM></TD> 22<TD width="45%" bgcolor="#C0C0C0"><EM><STRONG>Description</STRONG></EM></TD> 23 </TR> 24 <TR> 25<TD width="30%" rowspan="3"><A href="../../../gx/Transform/GXLoadTexMtxImm.html"><CODE>GXLoadTexMtxImm</CODE></A></TD> 26<TD width="25%"><SPAN class="argument">Matrices</SPAN></TD> 27<TD width="45%">Appropriate projection matrix.</TD> 28 </TR> 29 <TR> 30<TD width="25%"><SPAN class="argument">Matrix destination.</SPAN></TD> 31<TD width="45%"><CODE>GX_TEXMTX0</CODE>, <CODE><STRONG>GX_PTTEXMTX0</STRONG></CODE>, <CODE><STRONG>GX_PTTEXMTX1</STRONG></CODE></TD> 32 </TR> 33 <TR> 34<TD width="25%"><SPAN class="argument">Types</SPAN></TD> 35<TD width="45%"><CODE>GX_MTX3x4</CODE></TD> 36 </TR> 37 <TR> 38<TD width="30%" rowspan="6"><A href="../../../gx/TexCoordGen/GXSetTexCoordGen2.html"><CODE><CODE>GXSetTexCoordGen2</CODE></CODE></A></TD> 39<TD width="25%"><SPAN class="argument">Destination coordinates.</SPAN></TD> 40<TD width="45%">Always <CODE>GX_TEXCOORD0</CODE>.</TD> 41 </TR> 42 <TR> 43<TD width="25%"><SPAN class="argument">Generation type.</SPAN></TD> 44<TD width="45%"><CODE>GX_TG_MTX3x4</CODE></TD> 45 </TR> 46 <TR> 47<TD width="25%"><SPAN class="argument">Generation source.</SPAN></TD> 48<TD width="45%"><CODE>GX_TG_POS</CODE>, <CODE>GX_TG_NRM</CODE></TD> 49 </TR> 50 <TR> 51<TD width="25%"><SPAN class="argument">mtx src for the first transform</SPAN></TD> 52<TD width="45%"><CODE>GX_TEXMTX0</CODE></TD> 53 </TR> 54 <TR> 55<TD width="25%"><SPAN class="argument">normalization</SPAN></TD> 56<TD width="45%"><CODE>GX_TRUE</CODE> / <CODE>GX_FALSE</CODE></TD> 57 </TR> 58 <TR> 59<TD width="25%"><SPAN class="argument">mtx src for the second transform</SPAN></TD> 60<TD width="45%"><CODE>GX_PTTEXMTX0</CODE>, <CODE>GX_PTTEXMTX1</CODE></TD> 61 </TR> 62 </TBODY> 63</TABLE> 64 65<H2>Using the Demo</H2> 66<P>PAUSE exits the test. The main stick rotates the model. The sub stick moves the location of light source. The A Button switches the texgen mode. (Projection/Reflection)<BR> The L/R Buttons control the width of the light frustum. This is available only on projection mode.</P> 67 68<H2>Snapshot</H2> 69<P>Texture projection by dual-transform.</P> 70<P><IMG src="./images/tg-dual-0.jpg" alt="tg-dual-0.jpg (21849 bytes)" width="640" height="448"></P> 71 72<P>Reflection mapping by dual-transform.</P> 73<P><IMG src="./images/tg-dual-1.jpg" alt="tg-dual-1.jpg (19547 bytes)" width="640" height="448"></P> 74 75<H2>Required Data Files</H2> 76<P><CODE>$REVOLUTION_SDK_ROOT/dvddata/gxTests/tg-dual.tpl</CODE></P> 77 78<H2>Revision History</H2> 79<P> 802006/03/01 Initial version.<br> 81</P> 82 83<hr><p>CONFIDENTIAL</p></body> 84</HTML>