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
17<h2>C Specification</h2>
18
19<dl>
20<dd><PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
21  </dd>
22<dd><pre><CODE>void GXSetZTexture(
23<a href="../Enumerated_Types/GXZTexOp.html">GXZTexOp</a>    op,
24<a href="../Enumerated_Types/GXTexFmt.html">GXTexFmt</a>  fmt,
25u32         bias );</CODE></pre>
26  </dd>
27</dl>
28
29<h2>Arguments</h2>
30<TABLE border="1" cellspacing="0.1" cellpadding="3">
31  <tr>
32<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>op</font></strong></em></TD>
33<TD width="520">specifies the Z texture <a href="../Enumerated_Types/GXZTexOp.html">process</a><BR>Accepted values are:<BR>
34      <TABLE border="1" width="500" cellspacing="0.1">
35
36          <tr>
37<TD width="150" bgcolor="#C0C0C0">Name</TD>
38<TD width="350" bgcolor="#C0C0C0">Z Texture Mode</TD>
39          </tr>
40          <tr>
41<TD width="150"><code> GX_ZT_DISABLE</code></TD>
42<TD width="350">disables Z textures</TD>
43          </tr>
44          <tr>
45<TD width="150"><code>GX_ZT_ADD</code></TD>
46<TD width="350">Z texture is added to the original reference Z</TD>
47          </tr>
48          <tr>
49<TD width="150"><code>GX_ZT_REPLACE</code></TD>
50<TD width="350">Z texture replaces the original reference Z</TD>
51          </tr>
52
53      </TABLE>
54      </TD>
55    </tr>
56  <tr>
57<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>fmt</font></strong></em></TD>
58<TD width="520">Z format <BR>Accepted values are:<BR>
59      <TABLE border="1" width="500" cellspacing="0.1">
60
61          <tr>
62<TD width="150" bgcolor="#C0C0C0">Name</TD>
63<TD width="350" bgcolor="#C0C0C0">Z Texture Format</TD>
64          </tr>
65          <tr>
66<TD width="150"><code> GX_TF_Z8</code></TD>
67<TD width="350">8-bit Z</TD>
68          </tr>
69          <tr>
70<TD width="150"><code>GX_TF_Z16</code></TD>
71<TD width="350">16-bit Z</TD>
72          </tr>
73          <tr>
74<TD width="150"><code>GX_TF_Z24X8</code></TD>
75<TD width="350">24-bit Z</TD>
76          </tr>
77
78      </TABLE>
79      </TD>
80    </tr>
81  <tr>
82<TD width="120" bgcolor="#ffffe8"><em><strong><CODE>bias</font></strong></em></TD>
83<TD width="520">the bias <BR>The format is <CODE>u24</CODE>, right-aligned.</TD>
84    </tr>
85</TABLE>
86<h2>Return Values</h2>
87
88<p>None.</p>
89<H2>Description</H2>
90<P>This function&nbsp;controls Z texture operations.&nbsp;Z textures can be used to implement image-based rendering algorithms.&nbsp;A composite image consisting of color and depth image planes can be merged into the embedded frame buffer (EFB).</P>
91<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 is calculated by adding a Z texel to the reference Z (<code>op = GX_ZT_ADD</code>) or by replacing the reference Z with the Z texel value (<code>op = GX_ZT_REPLACE</code>).</P>
92<P>Z textures are always the output from the last active texture environment (TEV) stage (see <a href="GXSetNumTevStages.html"><code>GXSetNumTevStages</code></a>) when enabled.&nbsp;When Z texturing is enabled, the texture color of the last TEV stage is not available, but all other color inputs and operations are.&nbsp;The pixel color is always output from the last active TEV stage.&nbsp;TEV processes cannot be used with Z textures. They are sent directly into the Z texture logic.</P>
93<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 remainder. The 24-bit constant <code>bias</code> is added to the Z texture. If the pixel format is <code>GX_PF_RGB565_Z16</code>&nbsp; the 24-bit result is converted to the current 16-bit Z format before comparison against the EFB Z value.</P>
94<P>Z-texture calculations are done before fog range interpolations.</P>
95<P><a href="../Management/GXInit.html"><code>GXInit</code></a> disables Z texturing.</P>
96
97<h2>See Also</h2>
98<P><A href="GXSetNumTevStages.html"><CODE>GXSetNumTevStages</CODE></A><br> <A href="GXSetTevOrder.html"><CODE>GXSetTevOrder</CODE></A><br> <A href="../Texture/GXInitTexObj.html"><CODE>GXInitTexObj</CODE></A></P>
99<H2>Revision History</H2>
100<P>03/01/2006 Initial version.</P>