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>GXInitTexObjLOD</TITLE> 9</HEAD> 10<BODY> 11<H1 align="left">GXInitTexObjLOD</H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/gx.h> 16 17void GXInitTexObjLOD( 18 <A href="../Structures/GXTexObj.html">GXTexObj</A>* obj, 19 <A href="../Enumerated_Types/GXTexFilter.html">GXTexFilter</A> min_filt, 20 <A href="../Enumerated_Types/GXTexFilter.html">GXTexFilter</A> mag_filt, 21 f32 min_lod, 22 f32 max_lod, 23 f32 lod_bias, 24 <A href="../Enumerated_Types/GXBool.html">GXBool</A> bias_clamp, 25 <A href="../Enumerated_Types/GXBool.html">GXBool</A> do_edge_lod, 26 <A href="../Enumerated_Types/GXAnisotropy.html">GXAnisotropy</A> max_aniso ); 27</pre></dd></dl> 28 29<H2>Arguments</H2> 30<TABLE class="arguments" border="1" > 31 <TBODY> 32 <TR> 33<TH><em><strong><code>obj</code></strong></em></TH> 34<TD>Pointer to a texture object.</TD> 35 </TR> 36 <TR> 37<TH><STRONG><EM><CODE>min_filt</CODE></EM></STRONG></TH> 38<TD>Filter mode to use when the texel/pixel ratio is >= 1.0. Accepted values are:<BR> 39 <TABLE class="arguments" border="1" > 40 <tr> 41<TD bgcolor="#C0C0C0">Name</TD> 42<TD bgcolor="#C0C0C0">Filter Type</TD> 43 </tr> 44 <tr> 45<TH>GX_NEAR</TH> 46<TD>Point sampling, no mipmap.</TD> 47 </tr> 48 <tr> 49<TH>GX_LINEAR</TH> 50<TD>Bi-linear filtering, no mipmap.</TD> 51 </tr> 52 <tr> 53<TH>GX_NEAR_MIP_NEAR</TH> 54<TD>Point sampling, discreet mipmap.</TD> 55 </tr> 56 <tr> 57<TH>GX_LIN_MIP_NEAR</TH> 58<TD>Bi-linear filtering, discreet mipmap</TD> 59 </tr> 60 <tr> 61<TH>GX_NEAR_MIP_LIN</TH> 62<TD>Point sampling, linear mipmap</TD> 63 </tr> 64 <tr> 65<TH>GX_LIN_MIP_LIN</TH> 66<TD>Tri-linear filtering</TD> 67 </tr> 68 </TABLE> 69 </TD> 70 </TR> 71 <TR> 72<TH><STRONG><EM><CODE>mag_filt</CODE></EM></STRONG></TH> 73<TD>Filter mode to use when the texel/pixel ratio is < 1.0. Accepted values are:<BR> 74 <TABLE class="arguments" border="1" > 75 <tr> 76<TD bgcolor="#C0C0C0">Name</TD> 77<TD bgcolor="#C0C0C0">Filter Type</TD> 78 </tr> 79 <tr> 80<TH>GX_NEAR</TH> 81<TD>Point sampling</TD> 82 </tr> 83 <tr> 84<TH>GX_LINEAR</TH> 85<TD>Bi-linear filtering.</TD> 86 </tr> 87 </TABLE> 88 </TD> 89 </TR> 90 <TR> 91<TH><STRONG><EM><CODE>min_lod</CODE></EM></STRONG></TH> 92<TD>Minimum LOD value. The hardware uses MAX ( <SPAN class="argument">min_lod</SPAN>, lod ). Range is 0.0 to 10.0.</TD> 93 </TR> 94 <TR> 95<TH><STRONG><EM><CODE>max_lod</CODE></EM></STRONG></TH> 96<TD>Maximum LOD value. The hardware uses MIN ( <SPAN class="argument">max_lod</SPAN>, lod ). Range is 0.0 to 10.0.</TD> 97 </TR> 98 <TR> 99<TH><STRONG><EM><CODE>lod_bias</CODE></EM></STRONG></TH> 100<TD>Bias added to calculated LOD value.</TD> 101 </TR> 102 <TR> 103<TH><STRONG><EM><CODE>bias_clamp</CODE></EM></STRONG></TH> 104<TD>If <CODE>GX_ENABLE</CODE>, clamp the (LOD + <SPAN class="argument">lod_bias</SPAN>) so that it can never be smaller than the reduced area of the pixel projection in texture space. Prevents over-biasing the LOD when the polygon is perpendicular to the line of sight.</TD> 105 </TR> 106 <TR> 107<TH><STRONG><EM><CODE>do_edge_lod</CODE></EM></STRONG></TH> 108<TD>If <CODE>GX_ENABLE</CODE> is set, the LOD is calculated using texel interpolation. Otherwise, use diagonal texels. This must be set to <CODE>GX_ENABLE</CODE> when using a bias clamp (when <CODE>GX_ENABLE</CODE> is set for <SPAN class="argument">bias_clamp</SPAN>) or when performing anisotropic filtering (when <CODE>GX_ANISO_2</CODE> or <CODE>GX_ANISO_4</CODE> is set for <SPAN class="argument">max_aniso</SPAN>).</TD> 109 </TR> 110 <TR> 111<TH><STRONG><EM><CODE>max_aniso</CODE></EM></STRONG></TH> 112<TD>The maximum <a href="../Enumerated_Types/GXAnisotropy.html">anisotropic</a> filter to use. Accepted values are:<BR> 113 <TABLE class="arguments" border="1" > 114 <tr> 115<TD bgcolor="#C0C0C0">Name</TD> 116<TD bgcolor="#C0C0C0">Filter Type</TD> 117 </tr> 118 <tr> 119<TH>GX_ANISO_1</TH> 120<TD>Max anisotropy = 1. (No anisotropic filtering.)</TD> 121 </tr> 122 <tr> 123<TH>GX_ANISO_2</TH> 124<TD>maximum anisotropy = 2</TD> 125 </tr> 126 <tr> 127<TH>GX_ANISO_4</TH> 128<TD>maximum anisotropy = 4</TD> 129 </tr> 130 </TABLE> 131This only functions when <code>GX_LIN_MIP_LIN</code> has been set for <SPAN class="argument">min_filt</SPAN>.</TD> 132 </TR> 133 </TBODY> 134</TABLE> 135 136<H2>Return Values</H2> 137<P>None.</P> 138 139<H2>Description</H2> 140<P>This function explicitly sets texture level of detail (LOD) controls for a texture object. It is the application's responsibility to provide memory for a texture object. When initializing a texture object using <a href="GXInitTexObj.html"><code>GXInitTexObj</code></a> or <a href="GXInitTexObjCI.html"><code>GXInitTexObjCI</code></a>, this information is set to default values based on the <SPAN class="argument">mipmap</SPAN> flag. This function allows the programmer to override those defaults. Be aware that this function should be called after calling the <A href="GXInitTexObj.html"><CODE>GXInitTexObj</CODE></A> or <A href="GXInitTexObjCI.html"><CODE>GXInitTexObjCI</CODE></A> function for a particular texture object.</P> 141<P>The hardware supports anisotropic texture filtering. The default <SPAN class="argument">max_aniso</SPAN> setting of <code>GX_ANISO_1</code> uses a standard square filter to approximate the quadrilateral formed when a pixel is projected into texture space. This type of filter is said to be isotropic.<br>Anisotropic filtering is accomplished by iterating the square filter along the direction of anisotropy to better approximate the quadrilateral. This type of filtering results in sharper textures at the expense of multiple cycles per quad. The hardware will only use multiple cycles when necessary, and the maximum number of cycles is clamped by the <SPAN class="argument">max_aniso</SPAN > argument. So setting <SPAN class="argument">max_aniso</SPAN> to <CODE>GX_ANISO_2</CODE> will use, at most, two filter cycles per texture. Be aware that these filter cycles are internal to the texture filter hardware and do not effect the available number of TEV stages. When setting <SPAN class="argument">max_aniso</SPAN> to <CODE>GX_ANISO_2</CODE> or <CODE>GX_ANISO_4</CODE>, the <SPAN class="argument">min_filt</SPAN> parameter must be set to <CODE>GX_LIN_MIP_LIN</CODE>.</P> 142<P>The LOD computed by the graphics hardware can be biased using the <SPAN class="argument">lod_bias</SPAN> argument. <SPAN class="argument">lod_bias</SPAN> is added to the calculated LOD and the result is clamped between <SPAN class="argument">min_lod</SPAN> and <SPAN class="argument">max_lod</SPAN>. If <SPAN class="argument">bias_clamp</SPAN> is enabled, the effect of <SPAN class="argument">lod_bias</SPAN> will diminish as the polygon becomes more perpendicular to the view direction. This prevents over-sharpening the texture in this situation, but allows LOD biasing for oblique polygons.</P> 143 144<H2>Performance Notes</H2> 145<P>Theoretically, there is no performance difference amongst various magnification/minimization filter settings except the use of the <CODE>GX_LIN_MIP_LIN</CODE> filter with the <CODE>GX_TF_RGBA8</CODE> texture format which takes twice as much as other formats. However, this assumes an environment where the texture cache can always be hit. On real environments, you will see some performance differences by changing the filter modes (especially the reduction filter) because cache-hit ratio changes according to which filter mode is being used.</P> 146<P>The following is the list of minification filters sorted in the order of performance in common case:</P> 147<UL> 148<LI><code>GX_NEAR_MIP_NEAR</code> (fastest) 149<LI><CODE>GX_LIN_MIP_NEAR</CODE> 150<LI><CODE>GX_NEAR_MIP_LIN</CODE> 151<LI><CODE>GX_LIN_MIP_LIN</CODE> 152<LI><CODE>GX_NEAR</CODE> 153<LI><code>GX_LINEAR</code> (slowest)<br> 154</UL> 155 156<H2>See Also</H2> 157<P class="reference"> 158<A href="GXLoadTexObj.html">GXLoadTexObj</A>, 159<A href="GXInitTexObj.html">GXInitTexObj</A>, 160<A href="GXInitTexObjCI.html">GXInitTexObjCI</A>, 161<A href="GXGetTexObjLODAll.html">GXGetTexObjLODAll</A>, 162<A href="GXTexObjInitFlow.html">GXTexObj Initialization Flow</A> 163</P> 164 165<H2>Revision History</H2> 166<P> 1672008/06/03 Corrected errors.<br>2006/03/01 Initial version.<br> 168</P> 169 170<hr><p>CONFIDENTIAL</p></body> 171</HTML>