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<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 GXInitSpecularDir(
18<A href="../Structures/GXLightObj.html">GXLightObj</A>* lt_obj,
19f32         nx,
20f32         ny,
21f32         nz );</CODE></PRE>
22</DL>
23<H2>Arguments</H2>
24<TABLE border="1" cellpadding="3" cellspacing="0.1">
25  <TBODY>
26    <TR>
27<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>lt_obj</CODE></STRONG></EM></TD>
28<TD width="520">pointer to a light object</TD>
29    </TR>
30    <TR>
31<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>nx</CODE></STRONG></EM></TD>
32<TD width="520">X coordinate for the light direction</TD>
33    </TR>
34    <TR>
35<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>ny</CODE></STRONG></EM></TD>
36<TD width="520">Y coordinate for the light direction</TD>
37    </TR>
38    <TR>
39<TD width="120" bgcolor="#ffffe8"><EM><STRONG><CODE>nz</CODE></STRONG></EM></TD>
40<TD width="520">Z coordinate for the light direction</TD>
41    </TR>
42  </TBODY>
43</TABLE>
44<H2>Return Values</H2>
45<P>None.</P>
46<H2>Description</H2>
47<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 <a href="GXLoadLightObjImm.html"><code>GXLoadLightObjImm</code></a> or <a href="GXLoadLightObjIndx.html"><code>GXLoadLightObjIndx</code></a>.</P>
48<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>
49<P>The half-angle vector, necessary for specular lighting, is automatically calculated from the input light direction (<em>nx, ny, nz</em>) 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>
50<P><B>Note:</B> This function should 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 functions <A href="GXInitLightDir.html"><code>GXInitLightDir</code></A> and <A href="GXInitLightPos.html"><code>GXInitLightPos</code></A> to set up a light object to be used as a specular light. This is due to the fact that these functions will override data set by <a href="GXInitSpecularDir.html"><code>GXInitSpecularDir</code></a>.</P>
51<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>
52<H2>See Also</H2>
53<P><CODE><A href="GXInitLightPos.html">GXInitLightPos</A><BR> <A href="GXInitLightDir.html">GXInitLightDir</A><BR> <A href="GXLoadLightObjImm.html">GXLoadLightObjImm</A></CODE><BR> <A href="GXLoadLightObjIndx.html"><CODE>GXLoadLightObjIndx</CODE></A><BR> <CODE><A href="GXSetChanCtrl.html">GXSetChanCtrl</A></CODE></P>
54<P><A href="GXLightObjInitFlow.html"><CODE>GXLightObj</CODE> Initialization Flow</A></P>
55<H2>Revision History</H2>
56<P>03/01/2006 Initial version.</P>
57</BODY>
58</HTML>