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
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17#define GXInitLightDirv(lo, vec) \
18 (GXInitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))
19</pre></dd></dl>
20
21<H2>Arguments</H2>
22<TABLE class="arguments" border="1" >
23  <TBODY>
24    <TR>
25<TH>lo</TH>
26<TD>Pointer to a light object.</TD>
27    </TR>
28    <TR>
29<TH>vec</TH>
30<TD>Direction vector. You may use an <CODE>f32</CODE>-type array or structure.</TD>
31    </TR>
32  </TBODY>
33</TABLE>
34
35<H2>Return Values</H2>
36<P>None.</P>
37
38<H2>Description</H2>
39<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 <SPAN class="argument">attn_fn</SPAN> 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 the <A href="GXLoadLightObjImm.html"><CODE>GXLoadLightObjImm</CODE></A> or <A href="GXLoadLightObjIndx.html"><CODE>GXLoadLightObjIndx</CODE></A> function.</P>
40<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>
41<P><B>Note:</B> This function doesn't set the direction of parallel lights.</P>
42
43<H2>Example</H2>
44<P>You may set an array of <CODE>f32</CODE> values as as the <SPAN class="argument">vec</SPAN> argument.</P>
45<dl><dd><CODE>// Using an array<BR> f32&nbsp; dir[3] = { 0.0f, 0.0f, 1.0f };<BR> GXLightObj&nbsp; myLightObj;<BR> <BR> GXInitLightDirv( &amp;myLightObj, dir );</CODE></dd></dl>
46<P>You can also use a structure which contains three <CODE>f32</CODE> members (like the matrix-vector library's <CODE>Vec</CODE> type).</P>
47<dl><dd><CODE>// Using 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></dd></dl>
48
49<H2>See Also</H2>
50<P class="reference">
51<A href="GXInitLightDir.html">GXInitLightDir</A>,
52<A href="GXLightObjInitFlow.html">GXLightObj Initialization Flow</A>
53</P>
54
55<H2>Revision History</H2>
56<P>
572006/03/01 Initial version.<br>
58</P>
59
60<hr><p>CONFIDENTIAL</p></body>
61</HTML>