gdSPDefLights.3p 2.53 KB
.TH gdSPDefLights 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
gdSPDefLights \- load parameters defining the lights into light structures.
.SH C SPECIFICATION
.nf
\f3#include "gbi.h"

typedef struct {
  Ambient       a;
  Light         l[M];
} LightsM;

LightsM gdSPDefLightsM(
            unsigned char ar, unsigned char ag, unsigned char ab,

            unsigned char d1r, unsigned char d1g, unsigned char d1b,
            unsigned char n1x, unsigned char n1y, unsigned char n1z,
            ...
            unsigned char dMr, unsigned char dMg, unsigned char dMb,
            unsigned char nMx, unsigned char nMy, unsigned char nMz)
.fi
\fP
.SH PARAMETERS
.TP 10
.I ar, ag, ab
red, green, blue components of ambient light color.
.TP
.I d1r, d1g, d1b
red, green, blue components of first diffuse light color.
.TP
.I n1x, n1y, n1z
x, y, z components of first diffuse light direction.
.TP
.I dMr, dMg, dMb
red, green, blue components of Mth diffuse light color.
.TP
.I nMx, nMy, nMz
x, y, z components of Mth diffuse light direction.
.TP

.SH DESCRIPTION
The
.I gdSPDefLightsM
command loads parameters defining the lights into light structures.
The diffuse light direction coordinates specify the direction from
the origin to the diffuse light. The last character in the command,
indicated by M above, represents the number of diffuse lights in the
scene. In the command and in the structure LightsM, M must be an actual
integer in the range of 0 to 7. 
.PP
For example, with 3 diffuse lights,
the command is
.I gdSPDefLights3,
and the corresponding structure is Lights3. In this case, arguments for colors
of the ambient light and both colors and directions of 3 diffuse lights must be
supplied. When M = 0, only the arguments for colors of the ambient light
need be supplied.
.SH EXAMPLE
The following defines an ambient and one diffuse
light in a variable named "lite". The ambient color is a very dark
gray, while the diffuse color is a bright red. As this example shows,
the diffuse light direction vector does not need to be normalized.
If the scale of the modelview matrix is S and the magnitude of the
light direction is L then try to keep   1 < L*S < 23040.
.PP
Lights1 lite = gdSPDefLights1( 
                         0x05, 0x05, 0x05, /* amb col */
                         0xc0, 0x00, 0x00, /* col 1   */
                         13,   25,  30);   /* dir 1   */
.PP
The variable ("lite" in the example above) may be used in the
.I gSPSetLights (3P)
command or the
.I gSPLight (3P)
command to set the lighting state of the RSP.
			       
.SH SEE ALSO
.IR gSPSetLights (3P)