LIGHT_MODEL(3G)
NAME
light_model − modify aspects of POSITIONAL light sources
SYNOPSIS
C Syntax:
void light_model(fildes,index,attr,spot,atten,ang,x,y,z);
int fildes,index,attr,spot;
float atten,ang,x,y,z;
FORTRAN77 Syntax:
subroutine light_model(fildes,index,attr,spot,atten,ang,x,y,z)
integer*4 fildes,index,attr,spot
real atten,ang,x,y,z
Pascal Syntax:
procedure light_model(fildes,index,attr,spot:integer; atten,ang,x,y,z: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; the total number of light sources is device dependent.
attr Sets the attributes of the POSITIONAL light source. Can be any of ATTEN_LIGHT, SPOT_LIGHT, or CONE_LIGHT ORed together.
spot Specifies the spotlight power of the POSITIONAL light source in the range 0 to 16383 if SPOT_LIGHT is set in attr.
atten Specifies the attenuation factor if ATTEN_LIGHT is set in attr. Must be greater than 0.0.
ang Specifies the angle of the cone in degrees, where the light is cut off if CONE_LIGHT is set in attr. Must be greater than 0.0.
x,y,z Specifies the direction the POSITIONAL light source is pointing. Note that this vector does not need to be normalized to unit length.
Discussion
Light_model modifies certain aspects of POSITIONAL light sources as defined by light_source. If the ATTEN_LIGHT bit is set, the POSITIONAL light source intensity falls off as atten divided by R, where R is the distance from the light source to the vertex. Atten can be any positive floating point value, including values greater than 1.0. Vertices at a distance of atten from the light source or closer are fully illuminated while more distant vertices are more dimly illuminated, according to the factor given above.
When the SPOT_LIGHT bit is set, the intensity of the light falls off as the cosine of A raised to the spot power, where A is the angle between the direction the light source is pointing and the vector from the vertex to the light source. The spot parameter specifies how focused the spot light is: the higher the number, the more focused the light.
The CONE_LIGHT function is comparable to placing an opaque circular lamp shade around the light source. The light abruptly stops when the angle between the direction the light source is pointing and the vector from the vertex to the light source is greater than ang.
Any of these functions can be defined separately or combined together to form a realistic light source.
The number of light sources is device dependent. Currently eight (8) light sources are supported on an HP98721 device, and fifteen (15) light sources are supported on an HP98731 device.
DEFAULTS
Simple light source as specified by light_source with no modifications.
SEE ALSO
light_ambient(3G), light_source(3G), light_switch(3G), shade_mode(3G), vertex_format(3G), Starbase Graphics Techniques.
Hewlett-Packard Company — May 11, 2021