AlNonAmbientLight
Contains functionality common to non-ambient lights.
Synopsis
#include <AlNonAmbientLight.h>
class AlNonAmbientLight: public AlLight
virtual ~AlNonAmbientLight();
virtual AlObject* copyWrapper() const = 0;
AlObjectType type() const;
double intensity() const;
int decay() const;
boolean shadows() const;
statusCode setIntensity( double );
statusCode setDecay( int );
statusCode setShadows( boolean );
Description
This virtual class encapsulates all methods that are common to non-ambient lights such as point, directional, spot, linear, and area lights. All non-ambient lights have variable intensity and decay and all have a ’shadows’ flag.
To create a non-ambient light, the user must instantiate and call the create method on a specific type of light (as listed above). For more information on lights in general, see the Class Description of the AlLight object.
AlNonAmbientLight::~AlNonAmbientLight()
Description
Deletes an AlNonAmbientLight wrapper object.
AlObjectType AlNonAmbientLight::type() const
Description
Returns the class identifier, kNonAmbientLightType.
double AlNonAmbientLight::intensity() const
Description
Returns the light’s intensity. Allowable range is from 0.0 to infinity. This method returns -1 if the light is invalid.
int AlNonAmbientLight::decay() const
Description
Returns the light’s decay. Decay controls how quickly the light fades with distance; that is, how far it reaches. It can be set to 0, 1, 2, or 3. A value of 0 means no decay - the light reaches everything. A value of 1 is standard decay. Higher values increase the decay exponentially: 2 squares it; 3 cubes it. The initial default is 1. Decay has no effect at distances less than one unit. This method returns -1 if the light is invalid or if there is an error.
boolean AlNonAmbientLight::shadows() const
Description
Returns the light’s shadow flag. If the shadows flag is TRUE, then this light will cast shadows if ray tracing is used to render an image. Default is FALSE.
statusCode AlNonAmbientLight::setIntensity( double newIntensity)
Description
Sets the light’s intensity. The allowable range for the intensity is from 0.0 to infinity.
Arguments
< double newIntensity - the new light intensity
Return Codes
sSuccess - setting intensity succeeded
sInvalidObject - not a valid ambient light
sInvalidArgument - the intensity was less than 0
statusCode AlNonAmbientLight::setDecay( int newDecay )
Description
Sets the light’s decay. The decay controls how quickly the light fades with distance; that is, how far it reaches. It can be set to 0, 1, 2, or 3. A value of 0 means no decay - the light reaches everything. A value of 1 is a standard linear decay. Higher values increase the decay exponentially, that is, 2 squares it and 3 cubes it. The initial default is 1. The decay has no effect at distances less than one unit.
Arguments
< int newDecay - the new decay value
Return Codes
sSuccess - setting decay succeeded
sInvalidObject - not a valid ambient light
sInvalidArgument - decay out of range 0..3
statusCode AlNonAmbientLight::setShadows( boolean shadows )
Description
Sets the light’s shadow flag. If the shadows flag is TRUE, then this light will cast shadows if ray tracing is used to render an image. The default state is FALSE.
Arguments
< boolean shadows - the new value of the shadow flag
Return Codes
sSuccess - shadows set
sInvalidObject - object is invalid