Using Lights in Scenes
91
csSpotLight
csSpotLight is a directional light source. Because csSpotLight is subclassed from
csPointLight, csSpotLight can be positioned.
The light emanates as a cone; the axis of the cone specifies the direction of the spot light
and is defined in the following methods:
void setDirection (const csVec3f& direction)
void setDirection (csFloat v0, csFloat v1, csFloat v2)
The intensity distribution and the cut off angle of the light are set with the following
methods:
void setExponent(csFloat component);
void setCutOffAngle(csFloat cutOffAngle);
csPointLight
csPointLight is a point light source that radiates equally in all directions. The range of a
csPointLight’s effect is localized to a csEnvironment object when the csPointLight is
included in its light array.
All descendants of a csEnvironment object that lie within the csPointLight’s shining
radius are affected by the csPointLight. csTransform objects affect the location and
shining radius of each csPointLight.
Use the following methods to define a csPointLight.
void setLocation(const csVec3f& location);
void setLocation(csFloat v0, csFloat v1, csFloat v2);
void setRadius(csFloat radius);
void setAttenuation(const csVec3f& attenuation);
void setAttenuation(csFloat v0, csFloat v1, csFloat v2);
There is a corresponding set of get...() methods that return the current point light settings.
setLocation() defines the location of the csPointLight.
setRadius() defines the maximum range of the light.
setAttenuation() defines how quickly the intensity of the light declines over distance.