1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 7<META http-equiv="Content-Style-Type" content="text/css"> 8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 9<title>GXSetZTexture</title> 10</head> 11 12<body> 13 14<h1 align="left">GXSetZTexture</h1> 15 16<h2>Syntax</h2> 17<dl><dd><pre class="construction"> 18#include <revolution/gx.h> 19 20void GXSetZTexture( 21 <a href="../Enumerated_Types/GXZTexOp.html">GXZTexOp</a> op, 22 <a href="../Enumerated_Types/GXTexFmt.html">GXTexFmt</a> fmt, 23 u32 bias ); 24</pre></dd></dl> 25 26<h2>Arguments</h2> 27<TABLE class="arguments" border="1" > 28 <tr> 29<TH>op</TH> 30<TD>Specifies the Z texture <a href="../Enumerated_Types/GXZTexOp.html">operation</a>. Accepted values are:<BR> 31 <TABLE class="arguments" border="1" > 32 <tr> 33<TD bgcolor="#C0C0C0">Name</TD> 34<TD bgcolor="#C0C0C0">Z Texture Mode</TD> 35 </tr> 36 <tr> 37<TH>GX_ZT_DISABLE</TH> 38<TD>Disables Z textures.</TD> 39 </tr> 40 <tr> 41<TH>GX_ZT_ADD</TH> 42<TD>The Z texture is added to the original reference Z.</TD> 43 </tr> 44 <tr> 45<TH>GX_ZT_REPLACE</TH> 46<TD>The Z texture replaces the original reference Z.</TD> 47 </tr> 48 </TABLE> 49 </TD> 50 </tr> 51 <tr> 52<TH>fmt</TH> 53<TD>The format for Z. Accepted values are:<BR> 54 <TABLE class="arguments" border="1" > 55 <tr> 56<TD bgcolor="#C0C0C0">Name</TD> 57<TD bgcolor="#C0C0C0">Z Texture Format</TD> 58 </tr> 59 <tr> 60<TH>GX_TF_Z8</TH> 61<TD>8-bit Z</TD> 62 </tr> 63 <tr> 64<TH>GX_TF_Z16</TH> 65<TD>16-bit Z</TD> 66 </tr> 67 <tr> 68<TH>GX_TF_Z24X8</TH> 69<TD>24-bit Z</TD> 70 </tr> 71 </TABLE> 72 </TD> 73 </tr> 74 <tr> 75<TH>bias</TH> 76<TD>The bias. The format is u24, right-aligned.</TD> 77 </tr> 78</TABLE> 79 80<h2>Return Values</h2> 81<p>None.</p> 82 83<H2>Description</H2> 84<P>This function controls Z texture operations. Z textures can be used to implement image-based rendering algorithms. A composite image consisting of color and depth image planes can be merged into the embedded frame buffer (EFB).</P> 85<P>Normally, the Z for a quad (2x2) of pixels is calculated as a reference Z and two slopes. Once Z texturing is enabled, the Z value is calculated by adding a Z texel to the reference Z value (<SPAN class="argument">op</SPAN> = <CODE>GX_ZT_ADD</CODE>), or by replacing the reference Z value with the Z texel value (<SPAN class="argument">op</SPAN> = <CODE>GX_ZT_REPLACE</CODE>).</P> 86<P>When enabled, Z textures are always the output from the last active texture environment (TEV) stage (see the <A href="GXSetNumTevStages.html"><CODE>GXSetNumTevStages</CODE></A> function). When Z texturing is enabled, the texture color of the last TEV stage is not available, but all other color inputs and operations are. The pixel color is always output from the last active TEV stage. TEV processes cannot be used on Z textures. Z textures are handed directly to the Z texture logic.</P> 87<P>Z texel formats can be unsigned 8-bit (<CODE>GX_TF_Z8</CODE>), 16-bit (<CODE>GX_TF_Z16</CODE>) or 24-bit (<CODE>GX_TF_Z24X8</CODE> (32-bit texture)). The graphics processor converts Z-textures to 24-bit values by placing the texel value in the least-significant bits and zeroing any remaining higher bits. The 24-bit constant <SPAN class="argument">bias</SPAN> is added to the Z texture. If the pixel format is <CODE>GX_PF_RGB565_Z16</CODE>, the 24-bit result is converted to the current 16-bit Z format before comparison against the EFB Z value.</P> 88<P>Z-texture calculations are done <EM>before</EM> fog range interpolations.</P> 89<P>The <A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> function disables Z texturing.</P> 90 91<h2>See Also</h2> 92<P class="reference"> 93<A href="GXSetNumTevStages.html">GXSetNumTevStages</A>, 94<A href="GXSetTevOrder.html">GXSetTevOrder</A>, 95<A href="../Texture/GXInitTexObj.html">GXInitTexObj</A> 96</P> 97 98<H2>Revision History</H2> 99<P> 1002008/05/12 Corrected the old function name, <CODE>GXSetTevStages</CODE>, to the new name, <CODE>GXSetNumTevStages</CODE>.<br><br> 2006/03/01 Initial version.<br><br> 101</P> 102 103<hr><p>CONFIDENTIAL</p></body> 104</HTML>