VARKON Version 1.15 1997-10-24
light_view - Procedure
Configures a lightsource
Description
Sets the gemetric characteristics of a light source. Light sources are numbered from 0 to 7. By default only light 0 is on but a lightsource can be configured even when not active.The light_on() and light_off() procedures should be used to turn on or off light sources.
A light source can be configured as a distant light or a spotlight. A distant lightsource is thought of as beeing so far away from the scene that the light rays are practically parallell. The direction of a distant light is given by the pos parameter ie. the same direction as from pos to X=Y=Z=0. A distant light has either no spotang or a spotang equals to 180 degrees.
A spotlight has a true position given by pos and is always aimed at spotpos. The spreading angle is given by spotang and should be > 0 but not more than 90 degrees. A focus factor can be used to control the attenuation of the light from the center of the spot circle to its edge. A high value concentrates the light towards the center and a low value gives a more even distribution.
Syntax
light_view(light, pos, spotpos, spotang, spotfocus)
INT light; VECTOR pos; VECTOR spotpos; FLOAT spotang; FLOAT spotfocus;
Principal parameters
light - Light number 0 - 7 pos - Distant light from pos to (0,0,0) or true position of a spotlight
Optional parameters
spotpos - The position at which the spotlight is aimed. Default = (0,0,0). spotang - The angle of the spot lightcone (0-90) or 180 for a distant light. Default = 180. spotfocus - The focus factor, 0 = No focus and 100 equals Full focus. Default = 0 = No focus.
Examples
light_view(0, vec(1,1,1));
Makes lightsource 0 a distant light shining in the direction from (1,1,1) to (0,0,0).
light_view(1, vec(100,50,0), vec(20,20,10), 25, 50);
Makes lightsource 1 a spotlight placed in (100,50,0) aimed at (20,20,10) with a spotangle of 25 degrees and 50% focus.
light_view(1, vec(100,50,0), vec(20,20,10), 180, 50);
Same as above but the light becomes distant because of spotang = 180. Parameters spotpos and spotfocus are left without notice.
Comments
Smooth shading can improve the quality of images with spotlights.