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>GXInitSpecularDir</TITLE>
9</HEAD>
10<BODY>
11<H1 align="left">GXInitSpecularDir</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/gx.h&gt;
16
17void GXInitSpecularDir(
18    <A href="../Structures/GXLightObj.html">GXLightObj</A>* lt_obj,
19    f32         nx,
20    f32         ny,
21    f32         nz );
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>nx</TH>
33<TD>X coordinate for the light direction.</TD>
34    </TR>
35    <TR>
36<TH>ny</TH>
37<TD>Y coordinate for the light direction.</TD>
38    </TR>
39    <TR>
40<TH>nz</TH>
41<TD>Z coordinate for the light direction</TD>
42    </TR>
43  </TBODY>
44</TABLE>
45
46<H2>Return Values</H2>
47<P>None.</P>
48
49<H2>Description</H2>
50<P>This function sets the direction of a specular light for a light object.&nbsp;This direction is used when the light object is used as specular light. The application must allocate the memory for the light object; 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>
51<P>The coordinate space of the light direction should be consistent with a vertex normal transformed by a normal matrix. In other words, it should be transformed to view space. The direction vector must be normalized.</P>
52<P>The half-angle vector, necessary for specular lighting, is automatically calculated from the input light direction (<SPAN class="argument">nx</SPAN>, <SPAN class="argument">ny</SPAN>, <SPAN class="argument">nz</SPAN>) by assuming the view vector as (0, 0, 1). If you specify the direction vector as (0, 0, 1), the half-angle vector becomes zero (no lighting effect) because the two vector directions are identical.</P>
53<P><B>Note:</B> Be aware that this function must be used if the light object is used as specular light.&nbsp;You can activate a channel for specular lighting by setting the <code><a href="../Enumerated_Types/GXAttnFn.html">GXAttnFn</a></code> argument in <code><a href="GXSetChanCtrl.html">GXSetChanCtrl</a></code> to <code><a href="../Enumerated_Types/GXAttnFn.html">GX_AF_SPEC</a></code>.&nbsp;Do not use the <A href="GXInitLightDir.html"><code>GXInitLightDir</code></A> and <A href="GXInitLightPos.html"><code>GXInitLightPos</code></A> functions to set up a light object to be used as a specular light. These functions will destroy data set by the <code>GXInitSpecularDir</code> function.</P>
54<P>In contrast to diffuse lights (including spotlights) that are considered local lights, a specular light is a parallel light (i.e., the specular light is infinitely far away such that all rays of the light are parallel); only directional information can be specified. If you use a light object which is set by this function for diffuse light, it acts as a (pseudo) parallel diffuse light.</P>
55
56<H2>See Also</H2>
57<P class="reference">
58<A href="GXInitLightPos.html">GXInitLightPos</A>,
59<A href="GXInitLightDir.html">GXInitLightDir</A>,
60<A href="GXLoadLightObjImm.html">GXLoadLightObjImm</A>,
61<A href="GXLoadLightObjIndx.html">GXLoadLightObjIndx</A>,
62<A href="GXSetChanCtrl.html">GXSetChanCtrl</A>,
63<A href="GXLightObjInitFlow.html">GXLightObj Initialization Flow</A>
64</P>
65
66<H2>Revision History</H2>
67<P>
682006/03/01 Initial version.<br>
69</P>
70
71<hr><p>CONFIDENTIAL</p></body>
72</HTML>