#include <revolution/gx.h>
void GXInitLightSpot(
GXLightObj* lt_obj,
f32 cutoff,
GXSpotFn spot_func );
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:
|
None.
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 |
![]() |
![]() |
![]() |
| Type | GX_SP_FLAT |
GX_SP_COS |
GX_SP_COS2 |
| Valid Range |
0<cutoff<=90 |
0<cutoff<=90 | 0<cutoff<=90 |
| Graph |
![]() |
![]() |
![]() |
| 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.
GXInitLightAttn
GXInitLightAttnA
GXInitLightAttnK
GXInitLightDistAttn
GXLightObj Initialization Flow
03/01/2006 Initial version.