guPosLight.3p
2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.TH guPosLight 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
guPosLight, guPosLightHilite \- simulate a positional light source.
.SH SYNOPSIS
.nf
\f3#include <gu.h>
void guPosLight(PositionalLight *pl,
Light *l,
float xOb, float yOb, float zOb);
void guPosLightHilite(PositionalLight *pl1, PositionalLight *pl2,
Light *l1, Light *l2,
LookAt *l, Hilite *h,
float xEye, float yEye, float zEye,
float xOb, float yOb, float zOb,
float xUp, float yUp, float zUp,
int twidth, int theight);
typedef struct {
float col[3];
float pos[3];
float a1, a2;
} PositionalLight
\fP
.fi
.SH PARAMETERS
.TP 10
.I pl,pl1,pl1
The description of the positional light to use (input to the function).
.TP
.I l,l1,l2
The light structure to create (output of the function).
.TP
.I xOB, yOB, zOB
The coordinates of the center of the object to be lit (in world coordinates).
.TP
.I l
Pointer to the LookAt struct (output of the function). See
.B guLookAtHilite (3P).
.TP
.I h
Pointer to the Hilite struct (output of the function). See
.B guLookAtHilite (3P).
.TP
.I xEye, yEye, zEye
The position of the eye (same as used in the
.B guLookAt (3P)
function.
.TP
.I xUp, yUp, zUp
The up vector (same as used in the
.B guLookAt (3P)
function.
.TP
.I twidth, theight
The widht and height of the texture map which will be used for
drawing the specular highlight.
.TP
.I col
The color (and intensity) of the positional light.
.TP
.I pos
The positon of the positional light (in world coordinates).
.TP
.I a1, a2
The attenuation. The light intensity on the object will be: col/(a1*dist + a2)
\fP
.fi
.SH DESCRIPTION
.B guPosLight
and
.B guPosLightHilite
take a
.B PositionalLight
structure (which you define) and creates a light structure. The light
direction and intensity depend on the distance and direction from the
light to the object being lit. These functions are useful for creating
the effect of a positional light with attenuation. It works well for lighting
small objects in a scene (especially moving objects), but it does not work
very well for lighting
large objects such as terrains, walls, or ground planes.
To use this function with multiple moving objects, call the function several
times: once for each object.
Then use the various different light structures to light each object
respectively.
.PP
The
.B guPosLightHilite
function calculates a light structure for 2 positional lights and their hilite
and lookat value for rendering specular highlights.
.PP
The
.B guPosLight
function calculates a light structure for a single positional light without
calculating specular hilite related values.
\fP
.fi
.SH SEE ALSO
.I gSPSetLights
(3P),
.I gdSPDefLights
(3P),
.I gSPNumLights
(3P),
.I gSPLightColor
(3P)