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>GXInitLightDistAttn</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXInitLightDistAttn</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17void GXInitLightDistAttn(
18    <A href="../Structures/GXLightObj.html">GXLightObj</A>*  lt_obj,
19    f32          ref_distance,
20    f32          ref_brightness,
21    <A href="../Enumerated_Types/GXDistAttnFn.html">GXDistAttnFn</A> dist_func );
22</pre></dd></dl>
23
24<H2>Arguments</H2>
25<TABLE class="arguments" border="1" >
26  <TBODY>
27    <TR>
28<TH>lt_obj</TH>
29<TD>Pointer to a light object.</TD>
30    </TR>
31    <TR>
32<TH>ref_distance</CODE></TH>
33<TD>Distance between the light and the reference point.</TD>
34    </TR>
35    <TR>
36<TH>ref_brightness</CODE></TH>
37<TD>Brightness of the reference point.0 &lt; <SPAN class="argument">ref_brightness</SPAN> &lt; 1.</TD>
38    </TR>
39    <TR>
40<TH>dist_func</CODE></TH>
41<TD>Type of brightness reduction function. Accepted values are:<BR>
42      <TABLE class="arguments" border="1" >
43        <TBODY>
44          <TR>
45<TD bgcolor="#C0C0C0">Name</TD>
46<TD bgcolor="#C0C0C0">Type of distance attenuation function</TD>
47          </TR>
48          <TR>
49<TH>GX_DA_OFF</TH>
50<TD>No attenuation.</TD>
51          </TR>
52          <TR>
53<TH>GX_DA_GENTLE</TH>
54<TD rowspan="3">See the figures below.</TD>
55          </TR>
56          <TR>
57<TH>GX_DA_MEDIUM</TH>
58          </TR>
59          <TR>
60<TH>GX_DA_STEEP</TH>
61          </TR>
62        </TBODY>
63      </TABLE>
64      </TD>
65    </TR>
66  </TBODY>
67</TABLE>
68
69<H2>Return Values</H2>
70<P>None.</P>
71
72<H2>Description</H2>
73<P>This function sets coefficients for distance attenuation in light objects. These can be also set using the <A href="GXInitLightAttn.html"><CODE>GXInitLightAttn</CODE></A> function. This function uses three easy-to-control parameters instead of the <SPAN class="argument">k0</SPAN>, <SPAN class="argument">k1</SPAN> and <SPAN class="argument">k2</SPAN> parameters used in the <A href="GXInitLightAttn.html"><CODE>GXInitLightAttn</CODE></A> function.</P>
74<P>This function can specify the brightness on an assumed reference point. The <SPAN class="argument">ref_distance</SPAN> parameter is the distance between the light and the reference point. The <SPAN class="argument">ref_brightness</SPAN> parameter specifies the ratio of the brightness at the reference point. The value for <SPAN class="argument">ref_distance</SPAN> should be greater than 0. In addition, the value for <SPAN class="argument">ref_brightness</SPAN> must be within 0 &lt; <SPAN class="argument">ref_brightness</SPAN> &lt; 1. If not, distance attenuation will not work.</P>
75<P>The <SPAN class="argument">dist_func</SPAN> parameter defines the type of brightness decrease over distance. The following graphs show curve shape of the decreasing functions given by acceptable values for <SPAN class="argument">dist_func</SPAN>. The value <code>GX_DA_OFF</code> turns the distance attenuation feature off.</P>
76<DIV align="center">
77<CENTER>
78<TABLE border="1" width="128" cellpadding="0">
79  <TBODY>
80    <TR>
81      <TD><IMG src="DistFn1.gif" alt="DistFn1.gif (1605 bytes)" width="128" height="128"></TD>
82      <TD><IMG src="DistFn2.gif" alt="DistFn2.gif (1611 bytes)" width="128" height="128"></TD>
83      <TD><IMG src="DistFn3.gif" alt="DistFn3.gif (1600 bytes)" width="128" height="128"></TD>
84    </TR>
85    <TR>
86      <TD align="center"><CODE>GX_DA_GENTLE</CODE></TD>
87      <TD align="center"><CODE>GX_DA_MEDIUM</CODE></TD>
88      <TD align="center"><CODE>GX_DA_STEEP</CODE></TD>
89    </TR>
90  </TBODY>
91</TABLE>
92</CENTER>
93</DIV>
94<P>For more flexible control, use the <A href="GXInitLightAttn.html"><CODE>GXInitLightAttn</CODE></A> function and calculate the appropriate coefficients.</P>
95<P>Be aware that this function sets parameters only for distance attenuation. Parameters for angular attenuation should be set using the <A href="GXInitLightSpot.html"><CODE>GXInitLightSpot</CODE></A> or <A href="GXInitLightAttnA.html"><CODE>GXInitLightAttnA</CODE></A> function.</P>
96<P>This function does not load any hardware registers directly.&nbsp;To load a light object into a hardware light, use the <A href="GXLoadLightObjImm.html"><CODE>GXLoadLightObjImm</CODE></A> or <A href="GXLoadLightObjIndx.html"><CODE>GXLoadLightObjIndx</CODE></A> function.</P>
97
98<H2>See Also</H2>
99<P class="reference">
100<A href="GXInitLightAttn.html">GXInitLightAttn</A>,
101<A href="GXGetLightAttnA.html">GXInitLightAttnA</A>,
102<A href="GXInitLightAttnK.html">GXInitLightAttnK</A>,
103<A href="GXInitLightSpot.html">GXInitLightSpot</A>,
104<A href="GXLightObjInitFlow.html">GXLightObj Initialization Flow</A>
105</P>
106
107<H2>Revision History</H2>
108<P>
1092006/03/01 Initial version.<br>
110</P>
111
112<hr><p>CONFIDENTIAL</p></body>
113</HTML>