GXInitLightSpot

C Specification

#include <revolution/gx.h>
void GXInitLightSpot(
GXLightObj* lt_obj,
f32         cutoff,
GXSpotFn    spot_func );

Arguments

lt_obj pointer to a light object
cutoff spotlight cutoff angle (in degrees)0 <
cutoff<=90
spot_func type of light volume distribution functions
Accepted values are:
Name Spot (Angular Attenuation) Function Types
GX_SP_OFF no attenuation
GX_SP_FLAT refer to the figure below
GX_SP_COS
GX_SP_COS2
GX_SP_SHARP
GX_SP_RING1
GX_SP_RING2

Return Values

None.

Description

This function sets coefficients for angular (spotlight) attenuation in light objects. This can be also set with the GXInitLightAttn function. This function uses two easy-to-control parameters instead of the a0, a1 and a2 used by GXInitLightAttn.

The parameter cutoff specifies the spotlight's cutoff angle in degrees. The spotlight works when the angle between the ray for a vertex and the light direction given by GXInitLightDir is smaller than this cutoff angle. The cutoff value should be 0 < cutoff <= 90.0. Otherwise, the given light object doesn't become a spotlight. (Some spotlight types require tighter range.) 

The parameter spot_func defines the type of the illumination distribution within cutoff angle. The following graphs show curve shape of the distribution functions given by acceptable values for spot_func. And the value GX_SP_OFF turns the spotlight feature off even if the color channel setting uses GX_AF_SPOT (see GXSetChanCtrl).

Graph SpotFn1.gif (1403 bytes) SpotFn2.gif (1457 bytes) SpotFn3.gif (1465 bytes)
Type GX_SP_FLAT GX_SP_COS GX_SP_COS2
Valid Range

0<cutoff<=90

0<cutoff<=90 0<cutoff<=90
Graph SpotFn4.gif (1460 bytes) SpotFn5.gif (1554 bytes) SpotFn6.gif (1557 bytes)
Type GX_SP_SHARP GX_SP_RING1 GX_SP_RING2
Valid Range

30<cutoff<=90

30<cutoff<=90 30<cutoff<=90

This function can generate only some kinds of simple spotlights. For more flexible control, use GXInitLightAttn and calculate the appropriate coefficients.

This function sets parameters only for angular attenuation. Parameters for distance attenuation should be set using GXInitLightDistAttn or GXInitLightAttnK.

This function does not load any hardware registers directly. To load a light object into a hardware light, use GXLoadLightObjImm or GXLoadLightObjIndx.

See Also

GXInitLightAttn
GXInitLightAttnA

GXInitLightAttnK
GXInitLightDistAttn

GXLightObj Initialization Flow

Revision History

03/01/2006 Initial version.