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>GXSetFog</title> 10</head> 11 12<body> 13 14<h1 align="left">GXSetFog</h1> 15 16 17<h2>C Specification</h2> 18 19<dl> 20<dd><PRE><CODE>#include <revolution/gx.h></CODE></PRE> 21 </dd> 22<dd><pre><CODE>void GXSetFog( 23<a href="../Enumerated_Types/GXFogType.html">GXFogType</a> type, 24f32 startz, 25f32 endz, 26f32 nearz, 27f32 farz, 28<a href="../Structures/GXColor.html">GXColor</a> color );</CODE></pre> 29 </dd> 30</dl> 31 32<h2>Arguments</h2> 33<TABLE border="1" cellpadding="3" cellspacing="0.1"> 34 <tr> 35<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>type</font></strong></em></TD> 36<TD width="520">The types of <A href="../Enumerated_Types/GXFogType.html">fog functions</A>. <BR>Accepted values are:<BR> 37 <TABLE border="1" width="500" cellpadding="3" cellspacing="0.1"> 38 39 <tr> 40<TD width="33%" bgcolor="#C0C0C0">Name</TD> 41<TD width="42%" bgcolor="#C0C0C0">Fog Function Types</TD> 42 <TD width="25%" bgcolor="#C0C0C0"></TD> 43 </tr> 44 <tr> 45<TD width="33%"><code>GX_FOG_NONE</code></TD> 46<TD width="42%">no fog</TD> 47 <TD width="25%"></TD> 48 </tr> 49 <TR> 50<TD width="33%"><code>GX_FOG_PERSP_LIN</code></TD> 51<TD width="42%">linear</TD> 52<TD rowspan="5" width="25%"><BR>for perspective projection mode</TD> 53 </TR> 54 <TR> 55<TD width="33%"><code>GX_FOG_PERSP_EXP</code></TD> 56<TD width="42%">exponential</TD> 57 </TR> 58 <TR> 59<TD width="33%"><code>GX_FOG_PERSP_EXP2</code></TD> 60<TD width="42%">exponent squared</TD> 61 </TR> 62 <TR> 63<TD width="33%"><code>GX_FOG_PERSP_REVEXP</code></TD> 64<TD width="42%">inverse exponent</TD> 65 </TR> 66 <TR> 67<TD width="33%"><code>GX_FOG_PERSP_REVEXP2</code></TD> 68<TD width="42%">inverse of the squared exponent</TD> 69 </TR> 70 <TR> 71<TD width="33%"><code>GX_FOG_ORTHO_LIN</code></TD> 72<TD width="42%">linear</TD> 73<TD rowspan="5" width="25%"><BR>for orthographic projection mode</TD> 74 </TR> 75 <TR> 76<TD width="33%"><code>GX_FOG_ORTHO_EXP</code></TD> 77<TD width="42%">exponential</TD> 78 </TR> 79 <TR> 80<TD width="33%"><code>GX_FOG_ORTHO_EXP2</code></TD> 81<TD width="42%">exponent squared</TD> 82 </TR> 83 <TR> 84<TD width="33%"><code>GX_FOG_ORTHO_REVEXP</code></TD> 85<TD width="42%">inverse exponent</TD> 86 </TR> 87 <TR> 88<TD width="33%"><code>GX_FOG_ORTHO_REVEXP2</code></TD> 89<TD width="42%">inverse of the squared exponent</TD> 90 </TR> 91 <tr> 92<TD width="33%"><code>GX_FOG_LIN</code></TD> 93<TD width="42%"><code>same as GX_FOG_PERSP_LIN</code></TD> 94<TD width="25%" rowspan="5"><BR>for compatibility with prior versions</TD> 95 </tr> 96 <tr> 97<TD width="33%"><code>GX_FOG_EXP</code></TD> 98<TD width="42%"><code>same as GX_FOG_PERSP_EXP</code></TD> 99 </tr> 100 <tr> 101<TD width="33%"><code>GX_FOG_EXP2</code></TD> 102<TD width="42%"><code>same as GX_FOG_PERSP_EXP2</code></TD> 103 </tr> 104 <tr> 105<TD width="33%"><code>GX_FOG_REVEXP</code></TD> 106<TD width="42%"><code>same as GX_FOG_PERSP_REVEXP</code></TD> 107 </tr> 108 <tr> 109<TD width="33%"><code>GX_FOG_REVEXP2</code></TD> 110<TD width="42%"><code>same as GX_FOG_PERSP_REVEXP2</code></TD> 111 </tr> 112 </TABLE> 113 </TD> 114 </tr> 115 <tr> 116<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>startz</font></strong></em></TD> 117<TD width="520">The minimum Z value for which the fog function is active, in visual space coordinates.</TD> 118 </tr> 119 <tr> 120<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>endz</font></strong></em></TD> 121<TD width="520">The maximum Z value for which the fog function is active, in visual space coordinates.</TD> 122 </tr> 123 <tr> 124<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>nearz</font></strong></em></TD> 125<TD width="520">The near plane (should match the projection matrix parameters).</TD> 126 </tr> 127 <tr> 128<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>farz</font></strong></em></TD> 129<TD width="520">The far plane (must match the projection matrix parameters). <BR><CODE>farz</CODE> must be greater than <CODE>nearz</CODE>.</TD> 130 </tr> 131 <tr> 132<TD width="120" valign="top" bgcolor="#ffffe8"><em><strong><CODE>color</font></strong></em></TD> 133<TD width="520">Fog color, in RGBX format (alpha is not used).</TD> 134 </tr> 135</TABLE> 136<h2>Return Values</h2> 137 138<p>None.</p> 139<H2>Description</H2> 140<P>This function enables fog. Using <code>type</code>, the programmer may select one of several functions (see the table below) to control fog density as a function of range to a quad (2x2 pixels). The range is a cosine-corrected Z value in the XZ plane (visual coordinates), but is not corrected in the Y direction. Please refer to the <a href="GXSetFogRangeAdj.html"><code>GXSetFogRangeAdj</code></a> function.</P> 141<P>The parameters <code>startz</code> and <code>endz</code> allow further control over fog behavior. The arguments <code>nearz</code> and <code>farz</code> should be set consistently with the projection matrix arguments. Note that these parameters are defined in visual space.</P> 142<P>The fog color (in RGBX format; the alpha component is ignored) is set using the <code>color</code> parameter. This will be the color of the pixel when fully fogged.</P> 143<P><a href="../Management/GXInit.html"><code>GXInit</code></a> disables fog by default.</P> 144<h4>Fog Function Types (Equation and Density Curve)</h4> 145<table border="1" cellpadding="3" cellspacing="0"> 146 147 <tr> 148<td width="160">Linear</td> 149<td width="160">Exponential</td> 150<td width="160">Exponential Squared</td> 151 </tr> 152 <tr> 153 <td width="160"><IMG border="0" src="FogEqLi.gif" width="160" height="56"></td> 154 <td width="160"><IMG border="0" src="FogEqE1.gif" width="160" height="56"></td> 155 <td width="160"><IMG border="0" src="FogEqE2.gif" width="160" height="56"></td> 156 </tr> 157 <tr> 158 <td width="160"><IMG border="0" src="FogCurveLi.gif" width="160" height="144"></td> 159 <td width="160"><IMG border="0" src="FogCurveE1.gif" width="160" height="144"></td> 160 <td width="160"><IMG border="0" src="FogCurveE2.gif" width="160" height="144"></td> 161 </tr> 162 <tr> 163<td width="160" rowspan="3" valign="top"><code><b>F</b>: fog density [0,1]<br> <b>s</b>: <em>startz</em><br> <b>e</b>: <em>endz</em><br> <b>z</b>: pixel z<br> (range adjusted)<br></code></td> 164<td width="160"><code>Inverse Exponential</code></td> 165<td width="160">Inverse Exponential Squared</td> 166 </tr> 167 <tr> 168 <td width="160"><IMG border="0" src="FogEqR1.gif" width="160" height="56"></td> 169 <td width="160"><IMG border="0" src="FogEqR2.gif" width="160" height="56"></td> 170 </tr> 171 <tr> 172 <td width="160"><IMG border="0" src="FogCurveR1.gif" width="160" height="144"></td> 173 <td width="160"><IMG border="0" src="FogCurveR2.gif" width="160" height="144"></td> 174 </tr> 175 176</table> 177 178 179<h2>See Also</h2> 180 181<P><A href="GXSetFogRangeAdj.html"><CODE>GXSetFogRangeAdj</CODE></A><BR> <A href="GXSetFogColor.html"><CODE>GXSetFogColor</CODE></A></P> 182<H2>Revision History</H2> 183<P>03/01/2006 Initial version.</P> 184</BODY> 185</HTML>