_C_ License Applicability. Except to the extent portions of this file are _C_ made subject to an alternative license as permitted in the SGI Free _C_ Software License B, Version 1.1 (the "License"), the contents of this _C_ file are subject only to the provisions of the License. You may not use _C_ this file except in compliance with the License. You may obtain a copy _C_ of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 _C_ Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: _C_ _C_ http://oss.sgi.com/projects/FreeB _C_ _C_ Note that, as provided in the License, the Software is distributed on an _C_ "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS _C_ DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND _C_ CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A _C_ PARTICULAR PURPOSE, AND NON-INFRINGEMENT. _C_ _C_ Original Code. The Original Code is: OpenGL Sample Implementation, _C_ Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, _C_ Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. _C_ Copyright in any portions created by third parties is as indicated _C_ elsewhere herein. All Rights Reserved. _C_ _C_ Additional Notice Provisions: The application programming interfaces _C_ established by SGI in conjunction with the Original Code are The _C_ OpenGL(R) Graphics System: A Specification (Version 1.2.1), released _C_ April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version _C_ 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X _C_ Window System(R) (Version 1.3), released October 19, 1998. This software _C_ was created using the OpenGL(R) version 1.2.1 Sample Implementation _C_ published by SGI, but has not been independently verified as being _C_ compliant with the OpenGL(R) version 1.2.1 Specification. _C_ _C_ The first character in this file must be an '_'! _C_ Anything on a line after _C_ is ignored _define(_filters,tbl|eqn)_C_ _C_ eqn is automatically replaced with neqn for nroff _header(Light,set light source parameters) _names(Light,[fi]) .EQ delim $$ .EN .SH PARAMETERS _phead(_param1) Specifies a light. The number of lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the form _const(LIGHT)$i$ where 0 \(<= $ i $ < _const(MAX_LIGHTS). _phead(_param2) Specifies a single-valued light source parameter for _param1. _const(SPOT_EXPONENT), _const(SPOT_CUTOFF), _const(CONSTANT_ATTENUATION), _const(LINEAR_ATTENUATION), and _const(QUADRATIC_ATTENUATION) are accepted. _phead(_param3) Specifies the value that parameter _param2 of light source _param1 will be set to. _names(Light,[fi]v) .SH PARAMETERS _phead(_param1) Specifies a light. The number of lights depends on the implementation, but at least eight lights are supported. They are identified by symbolic names of the form _const(LIGHT)$i$ where 0 \(<= $ i $ < _const(MAX_LIGHTS). _phead(_param2) Specifies a light source parameter for _param1. _const(AMBIENT), _const(DIFFUSE), _const(SPECULAR), _const(POSITION), _const(SPOT_CUTOFF), _const(SPOT_DIRECTION), _const(SPOT_EXPONENT), _const(CONSTANT_ATTENUATION), _const(LINEAR_ATTENUATION), and _const(QUADRATIC_ATTENUATION) are accepted. _phead(_param3) Specifies a pointer to the value or values that parameter _param2 of light source _param1 will be set to. .SH DESCRIPTION _cmnd sets the values of individual light source parameters. _param1 names the light and is a symbolic name of the form _const(LIGHT)$i$, where 0 \(<= i < _const(MAX_LIGHTS). _param2 specifies one of ten light source parameters, again by symbolic name. _param3 is either a single value or a pointer to an array that contains the new values. .P To enable and disable lighting calculation, call _cmnd(Enable) and _cmnd(Disable) with argument _const(LIGHTING). Lighting is initially disabled. When it is enabled, light sources that are enabled contribute to the lighting calculation. Light source $i$ is enabled and disabled using _cmnd(Enable) and _cmnd(Disable) with argument _const(LIGHT)$i$. .P The ten light parameters are as follows: .TP 20 _const(AMBIENT) _param3 contains four integer or floating-point values that specify the ambient RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to \-1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial ambient light intensity is (0, 0, 0, 1). .TP _const(DIFFUSE) _param3 contains four integer or floating-point values that specify the diffuse RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to \-1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial value for _const(LIGHT0) is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0). .TP _const(SPECULAR) _param3 contains four integer or floating-point values that specify the specular RGBA intensity of the light. Integer values are mapped linearly such that the most positive representable value maps to 1.0, and the most negative representable value maps to \-1.0. Floating-point values are mapped directly. Neither integer nor floating-point values are clamped. The initial value for _const(LIGHT0) is (1, 1, 1, 1); for other lights, the initial value is (0, 0, 0, 0). .TP _const(POSITION) _param3 contains four integer or floating-point values that specify the position of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating-point values are clamped. .IP The position is transformed by the modelview matrix when _cmnd is called (just as if it were a point), and it is stored in eye coordinates. If the $w$ component of the position is 0, the light is treated as a directional source. Diffuse and specular lighting calculations take the light's direction, but not its actual position, into account, and attenuation is disabled. Otherwise, diffuse and specular lighting calculations are based on the actual location of the light in eye coordinates, and attenuation is enabled. The initial position is (0, 0, 1, 0); thus, the initial light source is directional, parallel to, and in the direction of the $-z$ axis. .TP _const(SPOT_DIRECTION) _param3 contains three integer or floating-point values that specify the direction of the light in homogeneous object coordinates. Both integer and floating-point values are mapped directly. Neither integer nor floating-point values are clamped. .IP The spot direction is transformed by the inverse of the modelview matrix when _cmnd is called (just as if it were a normal), and it is stored in eye coordinates. It is significant only when _const(SPOT_CUTOFF) is not 180, which it is initially. The initial direction is (0, 0, \-1). .TP _const(SPOT_EXPONENT) _param3 is a single integer or floating-point value that specifies the intensity distribution of the light. Integer and floating-point values are mapped directly. Only values in the range [0,128] are accepted. .IP Effective light intensity is attenuated by the cosine of the angle between the direction of the light and the direction from the light to the vertex being lighted, raised to the power of the spot exponent. Thus, higher spot exponents result in a more focused light source, regardless of the spot cutoff angle (see _const(SPOT_CUTOFF), next paragraph). The initial spot exponent is 0, resulting in uniform light distribution. .TP _const(SPOT_CUTOFF) _param3 is a single integer or floating-point value that specifies the maximum spread angle of a light source. Integer and floating-point values are mapped directly. Only values in the range [0,90] and the special value 180 are accepted. If the angle between the direction of the light and the direction from the light to the vertex being lighted is greater than the spot cutoff angle, the light is completely masked. .BP Otherwise, its intensity is controlled by the spot exponent and the attenuation factors. The initial spot cutoff is 180, resulting in uniform light distribution. .TP _const(CONSTANT_ATTENUATION) .TP _const(LINEAR_ATTENUATION ) .TP _const(QUADRATIC_ATTENUATION) _param3 is a single integer or floating-point value that specifies one of the three light attenuation factors. Integer and floating-point values are mapped directly. Only nonnegative values are accepted. If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant factor, the linear factor times the distance between the light and the vertex being lighted, and the quadratic factor times the square of the same distance. The initial attenuation factors are (1, 0, 0), resulting in no attenuation. .SH NOTES It is always the case that _const(LIGHT)$i$ = _const(LIGHT0) + $i$. .SH ERRORS _const(INVALID_ENUM) is generated if either _param1 or _param2 is not an accepted value. .P _const(INVALID_VALUE) is generated if a spot exponent value is specified outside the range [0,128], or if spot cutoff is specified outside the range [0,90] (except for the special value 180), or if a negative attenuation factor is specified. .P _const(INVALID_OPERATION) is generated if _cmnd is executed between the execution of _cmnd(Begin) and the corresponding execution of _cmnd(End). .SH ASSOCIATED GETS _cmnd(GetLight) .br _cmnd(IsEnabled) with argument _const(LIGHTING) .SH SEE ALSO _cmnd(ColorMaterial), _cmnd(LightModel), _cmnd(Material)