#include <revolution/gx.h> #define GXInitLightDirv(lo, vec) \ (GXInitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))
| lo | Pointer to a light object. |
|---|---|
| vec | Direction vector. You may use an f32-type array or structure. |
None.
This macro function sets the direction of light in the light object using a vector structure. This direction is used when the light object is used as a spotlight or a specular light. See the attn_fn parameter of GXSetChanCtrl. The memory for the light object must be allocated by the application; this function does not load any hardware registers. To load a light object into a hardware light, use the GXLoadLightObjImm or GXLoadLightObjIndx function.
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.
Note: This function doesn't set the direction of parallel lights.
You can set an f32 type array of values as the vec argument.
// Using an array
f32 dir[3] = { 0.0f, 0.0f, 1.0f };
GXLightObj myLightObj;
GXInitLightDirv( &myLightObj, dir );You can also use a structure which contains three f32 members (like the matrix-vector library's Vec type).
// Using a structure
typedef structure
{
f32 x, y, z;
} Vec;
Vec dir = { 0.0F, 0.0F, 1.0F };
GXLightObj myLightObj;
GXInitLightDirv( &myLightObj, &dir );
GXInitLightDir
GXLightObj Initialization Flow
2006/03/01 Initial version.
CONFIDENTIAL