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=utf-8"> 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 <revolution/gx.h> 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. 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. 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 54<P>When Light objects are being used for specular light, you can specify specular lighting in the <A href="GXSetChanCtrl.html"><CODE>GXSetChanCtrl</CODE></A> function by setting <A href="../Enumerated_Types/GXAttnFn.html"><CODE>GXAttnFn</CODE></A> to <A href="../Enumerated_Types/GXAttnFn.html"><CODE>GX_AF_SPEC</CODE></A>. Then use the <code>GXInitSpecularDir</code> function to specify the Light objects that you plan to use for specular lighting.</P> 55 56<P><B>Note:</B> Do not call the <A href="GXInitLightDir.html"><code>GXInitLightDir</code></A> function or the <A href="GXInitLightPos.html"><code>GXInitLightPos</code></A> function after Light objects have been specified with the <code>GXInitSpecularDir</code> function. These functions overwrite any information configured by the <code>GXInitSpecularDir</code> function.<br>The <CODE>GXInitSpecularDir</CODE> function adds necessary computation procedures when specular light is used in the <A href="GXInitLightDir.html"><code>GXInitLightDir</code></A> function. There is no inherent problem setting this up using the <A href="GXInitLightDir.html"><code>GXInitLightDir</code></A> and <A href="GXInitLightPos.html"><code>GXInitLightPos</code></A> functions. If you plan to use them, however, be sure to configure the settings correctly and remember that the light being used is specular light. 57</P> 58 59<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> 60 61<H2>See Also</H2> 62<P class="reference"> 63<A href="GXInitLightPos.html">GXInitLightPos</A><BR> <A href="GXInitLightDir.html">GXInitLightDir</A><BR> <A href="GXLoadLightObjImm.html">GXLoadLightObjImm</A><BR> <A href="GXLoadLightObjIndx.html">GXLoadLightObjIndx</A><BR> <A href="GXSetChanCtrl.html">GXSetChanCtrl</A><BR> <A href="GXLightObjInitFlow.html">GXLightObj Initialization Flow</A> 64</P> 65 66<H2>Revision History</H2> 67<P> 682009/05/13 Added Note to <B>Description</B>.<br>2006/03/01 Initial version.<br> 69</P> 70 71<hr><p>CONFIDENTIAL</p></body> 72</HTML>