light_attenuation(3G)
NAME
light_attenuation − define attenuation constants for POSITIONAL light sources
SYNOPSIS
C Syntax:
void light_attenuation(fildes,index,quadratic,c1,c2,c3);
int fildes,index,quadratic;
float c1,c2,c3;
FORTRAN77 Syntax:
subroutine light_attenuation(fildes,index,quadratic,c1,c2,c3)
integer∗4 fildes,index,quadratic
real c1,c2,c3
Pascal Syntax:
procedure light_attenuation (fildes,index,quadratic:integer;c1,c2,c3:real);
DESCRIPTION
Input Parameters
fildes Integer file descriptor returned by gopen when an I/O path to a graphics device is opened.
index Number of the POSITIONAL light source to be modified.
quadratic If TRUE (1), the attenuation constants specified by the c1,c2,c3 parameters are substituted into the quadratic equation used to calculate light attenuation. If FALSE (0), the attenuation constants are not used.
c1 Constant term in the light attenuation quadratic equation.
c2 Linear term in the light attenuation quadratic equation.
c3 Quadratic term in the light attenuation quadratic equation.
Discussion
If the quadratic parameter is TRUE , the light_attenuation subroutine specifies the parameters used to determine the intensity of shaded polygonal objects, based on the distance between the light source and object. These parameters are the attenuation constants in the following quadratic equation:
La=1 over ( c1 + c2 |Lp−Op| + c3 |Lp−Op|2 )
where Lp is the light source position, and Op is the object position. The light attenuation factor La is then multiplied by the diffuse and specular terms of the lighting equation. The value of La is clamped at 1.0 to avoid increasing the total intensity of the image as a result of light attenuation.
If the quadratic parameter is FALSE then the attenuation constants specified by this routine are ignored. Instead, values for the quadratic equation are determined from parameters to the light_model routine. Refer to the light_model (3G) manual page for a description of these parameters.
The shade_mode routine must be called to turn shading on before light_attenuation is actually enabled.
DEFAULTS
The quadratic parameter is FALSE so the light attenuation constants are determined by the atten parameter to light_model.
SEE ALSO
light_model(3G), light_source(3G), shade_mode(3G), vertex_format(3G), Starbase Graphics Techniques.
Hewlett-Packard Company — HP-UX Release 9.03: April 1994