GXInitLightDirv

C Specification

#include <revolution/gx.h>
#define GXInitLightDirv(lo, vec) \
(GXInitLightDir((lo), *(f32*)(vec), *((f32*)(vec)+1), *((f32*)(vec)+2)))

Arguments

lo Pointer to a light object.
vec Direction vector. You may use an array of f32 or a structure.

Return Values

None.

Description

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 GXLoadLightObjImm or GXLoadLightObjIndx.

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.

Example

You may set an array of f32 values as vec argument.

// Use 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 Vec type of Matrix-Vector library).

// Use a structure
typedef structure
{
    f32  x, y, z;
} Vec;

Vec         dir = { 0.0F, 0.0F, 1.0F };
GXLightObj  myLightObj;

GXInitLightDirv( &myLightObj, &dir );

See Also

GXInitLightDir

GXLightObj Initialization Flow

Revision History

03/01/2006 Initial version.