#include <revolution/gx.h>
void GXInitLightDistAttn(
GXLightObj* lt_obj,
f32 ref_distance,
f32 ref_brightness,
GXDistAttnFn dist_func );
| lt_obj | Pointer to a light object. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| ref_distance | Distance between the light and the reference point. | ||||||||
| ref_brightness | Brightness of the reference point.0 < ref_brightness < 1. | ||||||||
| dist_func | Type of brightness reduction function. Accepted values are:
|
None.
This function sets coefficients for distance attenuation in light objects. These can be also set using the GXInitLightAttn function. This function uses three easy-to-control parameters instead of the k0, k1 and k2 parameters used in the GXInitLightAttn function.
This function can specify the brightness on an assumed reference point. The ref_distance parameter is the distance between the light and the reference point. The ref_brightness parameter specifies the ratio of the brightness at the reference point. The value for ref_distance should be greater than 0. In addition, the value for ref_brightness must be within 0 < ref_brightness < 1. If not, distance attenuation will not work.
The dist_func parameter defines the type of brightness decrease over distance. The following graphs show curve shape of the decreasing functions given by acceptable values for dist_func. The value GX_DA_OFF turns the distance attenuation feature off.
![]() |
![]() |
![]() |
GX_DA_GENTLE |
GX_DA_MEDIUM |
GX_DA_STEEP |
For more flexible control, use the GXInitLightAttn function and calculate the appropriate coefficients.
Be aware that this function sets parameters only for distance attenuation. Parameters for angular attenuation should be set using the GXInitLightSpot or GXInitLightAttnA function.
This function does not load any hardware registers directly. To load a light object into a hardware light, use the GXLoadLightObjImm or GXLoadLightObjIndx function.
GXInitLightAttn, GXInitLightAttnA, GXInitLightAttnK, GXInitLightSpot, GXLightObj Initialization Flow
2006/03/01 Initial version.
CONFIDENTIAL