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>GXInitLightSpot</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXInitLightSpot</H1>
12<H2>C Specification</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
16  <DD>
17  <PRE><CODE>void GXInitLightSpot(
18    <A href="../Structures/GXLightObj.html">GXLightObj</A>* lt_obj,
19    f32         cutoff,
20    <A href="../Enumerated_Types/GXSpotFn.html">GXSpotFn</A>    spot_func );</CODE></PRE>
21</DL>
22<H2>Arguments</H2>
23<TABLE border="1" cellpadding="3" cellspacing="0.1">
24  <TBODY>
25    <TR>
26<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>lt_obj</CODE></STRONG></EM></TD>
27<TD width="520">pointer to a light object</TD>
28    </TR>
29    <TR>
30<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>cutoff</CODE></STRONG></EM></TD>
31<TD width="520">spotlight cutoff angle (in degrees)0 &lt; <BR><CODE>cutoff&lt;=90</CODE></TD>
32    </TR>
33    <TR>
34<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>spot_func</CODE></STRONG></EM></TD>
35<TD width="520">type of light volume distribution functions <BR>Accepted values are:<BR>
36      <TABLE width="500" border="1" cellspacing="0.1">
37
38          <tr>
39<TD width="150" bgcolor="#C0C0C0">Name</TD>
40<TD width="350" bgcolor="#C0C0C0">Spot (Angular Attenuation) Function Types</TD>
41          </tr>
42          <tr>
43<TD width="150" height="7"><code>GX_SP_OFF</code></TD>
44<TD width="350" height="7">no attenuation</TD>
45          </tr>
46          <tr>
47<TD width="150" height="19"><code>GX_SP_FLAT</code></TD>
48<TD rowspan="6" height="43" width="350">refer to the figure below</TD>
49          </tr>
50          <tr>
51            <TD width="150"><code>GX_SP_COS</code></TD>
52          </tr>
53          <tr>
54            <TD width="150" height="22"><code>GX_SP_COS2</code></TD>
55          </tr>
56          <tr>
57            <TD width="150"><code>GX_SP_SHARP</code></TD>
58          </tr>
59          <tr>
60            <TD width="150"><code>GX_SP_RING1</code></TD>
61          </tr>
62          <tr>
63            <TD width="150"><code>GX_SP_RING2</code></TD>
64          </tr>
65
66      </TABLE>
67      </TD>
68    </TR>
69  </TBODY>
70</TABLE>
71<H2>Return Values</H2>
72<P>None.</P>
73<H2>Description</H2>
74<P>This function sets coefficients for angular (spotlight) attenuation in light objects. This can be also set with the <a href="GXInitLightAttn.html"><code>GXInitLightAttn</code></a> function. This function uses two easy-to-control parameters instead of the <EM><STRONG><CODE>a0</CODE></STRONG></EM>, <EM><STRONG><CODE>a1</CODE></STRONG></EM> and <EM><STRONG><CODE>a2</CODE></STRONG></EM> used by <a href="GXInitLightAttn.html"><code>GXInitLightAttn</code></a>.</P>
75<P>The parameter <EM><STRONG><CODE>cutoff</CODE></STRONG></EM> specifies the spotlight's cutoff angle in degrees. The spotlight works when the angle between the ray for a vertex and the light direction given by <a href="GXInitLightDir.html"><code>GXInitLightDir</code></a> is smaller than this cutoff angle. The <EM><STRONG><CODE>cutoff</CODE></STRONG></EM> value should be 0 &lt; <EM><STRONG><CODE>cutoff</CODE></STRONG></EM> &lt;= 90.0. Otherwise, the given light object doesn't become a spotlight. (Some spotlight types require tighter range.)&nbsp;</P>
76<P>The parameter <EM><STRONG><CODE>spot_func</CODE></STRONG></EM> defines the type of the illumination distribution within cutoff angle. The following graphs show curve shape of the distribution functions given by acceptable values for <EM><STRONG><CODE>spot_func</CODE></STRONG></EM>. And the value <code>GX_SP_OFF</code> turns the spotlight feature off even if the color channel setting uses <code>GX_AF_SPOT</code> (see <a href="GXSetChanCtrl.html"><code>GXSetChanCtrl</code></a>).</P>
77<DIV align="center">
78<CENTER>
79<table border="1" cellpadding="3" cellspacing="0" width="474">
80
81    <tr>
82<td width="168" align="center">Graph</td>
83      <td width="144" align="center">
84<IMG src="SpotFn1.gif" alt="SpotFn1.gif (1403 bytes)" width="128" height="128"></td>
85      <td width="141" align="center">
86<IMG src="SpotFn2.gif" alt="SpotFn2.gif (1457 bytes)" width="128" height="128"></td>
87      <td width="166" align="center">
88<IMG src="SpotFn3.gif" alt="SpotFn3.gif (1465 bytes)" width="128" height="128"></td>
89    </tr>
90    <tr>
91<td width="168" align="center">Type</td>
92<td width="144" align="center"><code>GX_SP_FLAT</code></td>
93<td width="141" align="center"><code>GX_SP_COS</code></td>
94<td width="166" align="center"><code>GX_SP_COS2</code></td>
95    </tr>
96    <tr>
97<td width="168" align="center">Valid Range</td>
98      <td width="144" align="center">
99<p align="center">0&lt;cutoff&lt;=90</CODE>
100      </td>
101<td width="141" align="center">0&lt;cutoff&lt;=90</CODE></td>
102<td width="166" align="center">0&lt;cutoff&lt;=90</CODE></td>
103    </tr>
104    <tr>
105<td width="168" align="center">Graph</td>
106      <td width="144" align="center">
107<IMG src="SpotFn4.gif" alt="SpotFn4.gif (1460 bytes)" width="128" height="128"></td>
108      <td width="141" align="center">
109<IMG src="SpotFn5.gif" alt="SpotFn5.gif (1554 bytes)" width="128" height="128"></td>
110      <td width="166" align="center">
111<IMG src="SpotFn6.gif" alt="SpotFn6.gif (1557 bytes)" width="128" height="128"></td>
112    </tr>
113    <tr>
114<td width="168" align="center">Type</td>
115<td width="144" align="center"><code>GX_SP_SHARP</code></td>
116<td width="141" align="center"><code>GX_SP_RING1</code></td>
117<td width="166" align="center"><code>GX_SP_RING2</code></td>
118    </tr>
119    <tr>
120<td width="168" align="center">Valid Range</td>
121      <td width="144" align="center">
122<p align="center">30&lt;<em><strong>cutoff</strong></em>&lt;=90
123      </td>
124<td width="141" align="center">30&lt;<em><strong>cutoff</strong></em>&lt;=90</td>
125<td width="166" align="center">30&lt;<em><strong>cutoff</strong></em>&lt;=90</td>
126    </tr>
127
128</table>
129</CENTER>
130</DIV>
131<P>This function can generate only some kinds of simple spotlights. For more flexible control, use <a href="GXInitLightAttn.html"><code>GXInitLightAttn</code></a> and calculate the appropriate coefficients.</P>
132<P>This function sets parameters only for angular attenuation. Parameters for distance attenuation should be set using <a href="GXInitLightDistAttn.html"><code>GXInitLightDistAttn</code></a> or <a href="GXInitLightAttnK.html"><code>GXInitLightAttnK</code></a>.</P>
133<P>This function does not load any hardware registers directly.&nbsp;To load a light object into a hardware light, use <a href="GXLoadLightObjImm.html"><code>GXLoadLightObjImm</code></a> or <a href="GXLoadLightObjIndx.html"><code>GXLoadLightObjIndx</code></a>.</P>
134<H2>See Also</H2>
135<P><CODE><A href="GXInitLightAttn.html">GXInitLightAttn</A><BR> <A href="GXInitLightAttnA.html">GXInitLightAttnA</A></CODE><BR> <A href="GXInitLightAttnK.html"><CODE>GXInitLightAttnK</CODE></A><BR> <CODE><A href="GXInitLightDistAttn.html">GXInitLightDistAttn</A></CODE></P>
136<P><A href="GXLightObjInitFlow.html"><CODE>GXLightObj</CODE> Initialization Flow</A></P>
137<H2>Revision History</H2>
138<P>2006/03/01 Initial version.</P>
139<hr>
140<P>CONFIDENTIAL</p>
141</BODY>
142</HTML>