GXInitLightDistAttn

Syntax

#include <revolution/gx.h>

void GXInitLightDistAttn(
    GXLightObj*  lt_obj,
    f32          ref_distance,
    f32          ref_brightness,
    GXDistAttnFn dist_func );

Arguments

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:
Name Type of distance attenuation function
GX_DA_OFF No attenuation.
GX_DA_GENTLE See the figures below.
GX_DA_MEDIUM
GX_DA_STEEP

Return Values

None.

Description

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.

DistFn1.gif (1605 bytes) DistFn2.gif (1611 bytes) DistFn3.gif (1600 bytes)
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.

See Also

GXInitLightAttn, GXInitLightAttnA, GXInitLightAttnK, GXInitLightSpot, GXLightObj Initialization Flow

Revision History

2006/03/01 Initial version.


CONFIDENTIAL