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>GXInitLightDirv</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXInitLightDirv</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>#define GXInitLightDirv(lo, vec) \
18 (GXInitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))</CODE></PRE>
19</DL>
20<H2>Arguments</H2>
21<TABLE border="1" cellpadding="3" cellspacing="0.1">
22  <TBODY>
23    <TR>
24<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>lo</CODE></STRONG></EM></TD>
25<TD width="520">Pointer to a light object.</TD>
26    </TR>
27    <TR>
28<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>vec</CODE></STRONG></EM></TD>
29<TD width="520">Direction vector. You may use an array of f32 or a structure.</TD>
30    </TR>
31  </TBODY>
32</TABLE>
33<H2>Return Values</H2>
34<P>None.</P>
35<H2>Description</H2>
36<P>This macro function sets the direction of light in the light object using a vector structure.&nbsp;This direction is used when the light object is used as a spotlight or a specular light, see the <STRONG><EM><CODE>attn_fn</CODE></EM></STRONG> parameter of <a href="GXSetChanCtrl.html"><code>GXSetChanCtrl</code></a>. The memory for the light object must be allocated by the application; this function does not load any hardware registers.&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>
37<P>The coordinate space of the light normal should be consistent with a vertex normal transformed by a normal matrix; i.e., it should be transformed to view space. The direction vector is required to be normalized.</P>
38<P><B>Note:</B> This function doesn't set the direction of parallel lights.</P>
39<H2>Example</H2>
40<P>You may set an array of f32 values as <strong><em>vec </em></strong>argument<strong><em>.</em></strong></P>
41<P><font size="2"><code>// Use an array<br> f32&nbsp; dir[3] = { 0.0f, 0.0f, 1.0f };<br> GXLightObj&nbsp; myLightObj;<br> <br> GXInitLightDirv( &amp;myLightObj, dir );</code></font></P>
42<P>You can also use a structure which contains three f32 members (like Vec type of Matrix-Vector library).</P>
43<P><font size="2"><code>// Use a structure<br> typedef structure<br> {<br> &nbsp;&nbsp;&nbsp; f32&nbsp; x, y, z;<br> } Vec;<br> <br> Vec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dir = { 0.0F, 0.0F, 1.0F };<br> GXLightObj&nbsp; myLightObj;<br> <br> GXInitLightDirv( &amp;myLightObj, &amp;dir );</code></font></P>
44<H2>See Also</H2>
45<P><A href="GXInitLightDir.html"><CODE>GXInitLightDir</CODE></A></P>
46<P><A href="GXLightObjInitFlow.html">GXLightObj Initialization Flow</A></P>
47<H2>Revision History</H2>
48<P>2006/03/01 Initial version.</P>
49<hr>
50<P>CONFIDENTIAL</p>
51</BODY>
52</HTML>