AlDirectionLight
Encapsulates the functionality common to all directional lights.
Synopsis
#include <AlDirectionLight.h>
class AlDirectionLight: public AlNonAmbientLight
AlDirectionLight();
virtual ~AlDirectionLight();
virtual AlObject* copyWrapper() const;
statusCode create();
AlObjectType type() const;
AlDirectionLight* asDirectionLightPtr();
AlLightNode* lookAtNode() const;
AlLightNode* upNode() const;
virtual statusCode direction( double&, double&, double& ) const;
virtual statusCode setDirection( double, double, double );
Description
There are two ways that this class is used. If the user instantiates and calls the create method on an AlDirectionLight, the resulting object is a light that has color, intensity, and direction but no obvious source in a scene. This type of direction light does not decay with distance. Sunlight is a direction light of this type.
Alternatively, the user could instantiate and create an AlSpotLight, AlLinearLight, or AlAreaLight (which are all considered "directional" and which are all derived from this light class).
Although all direction lights can access the "look at" and "up" nodes of a light, only the spot light uses these nodes.
Summary
AlDirectionLight::AlDirectionLight()
Description
Constructs an AlDirectionLight wrapper object.
AlDirectionLight::~AlDirectionLight()
Description
Deletes an AlDirectionLight wrapper object.
statusCode AlDirectionLight::create()
Description
This method creates all the dag nodes for this light and adds them to the universe. The dag nodes are for 'position', 'look at' and 'up', and another dag node that groups these three together.
Return codes
sSuccess - if everything was successful
sInsufficientMemory - if not enough memory available
sAlreadyCreated - light is already created
AlObjectType AlDirectionLight::type() const
Description
Returns the class identifier, kDirectionLightType.
AlDirectionLight* AlDirectionLight::asDirectionLightPtr()
Description
This virtual function returns a non-null pointer to itself, indicating that it is safe to cast to an object of this class.
AlLightNode *AlDirectionLight::lookAtNode() const
Description
This method returns a pointer to the light's "look at" node. This node is an AlLightNode (which is a dag node).
AlLightNode *AlDirectionLight::upNode() const
Description
This method returns a pointer to the light's "up" node. This node is an AlLightNode (which is a dag node).
statusCode AlDirectionLight::direction( double &x, double &y, double &z ) const
Description
Returns a world space vector indicating the direction that this light is pointing. The default direction for the light is (0,0,-1)
Arguments
> double &x - the direction vector in x
> double &y - the direction vector in y
> double &z - the direction vector in z
Return codes
sSuccess - the direction was returned
sFailure - the direction could not be determined
sInvalidObject - the light was invalid
statusCode AlDirectionLight::setDirection( double x, double y, double z )
Description
This is a 'convenience' function. It calculates the appropriate rotations in the dagnode to set the world direction of the light. This will overwrite the current rotations in the light node. The default direction for the light is (0,0,-1)
Arguments
double x - the direction vector in x
double y - the direction vector in y
double z - the direction vector in z
Return codes
sSuccess - the direction was returned
sFailure - the direction could not be determined
sInvalidObject - the light was invalid
aliasdocs@aw.sgi.com
Copyright © 1996, Alias|Wavefront, a Silicon Graphics Company. All rights
reserved.