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