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;
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.

AlDirectionLight::AlDirectionLight()

Description

Constructs an AlDirectionLight wrapper object.

AlDirectionLight::~AlDirectionLight()

Description

Deletes an AlDirectionLight wrapper object.

statusCode AlDirectionLight::create()

Description

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 - everything was successful

sInsufficientMemory - not enough memory available

sAlreadyCreated - light is already created

AlObjectType AlDirectionLight::type() const

Description

Returns the class identifier, kDirectionLightType.

AlLightNode *AlDirectionLight::lookAtNode() const

Description

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

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

> x - the direction vector in x

> y - the direction vector in y

> 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 rotations in the DAG node 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

< x - the direction vector in x

< y - the direction vector in y

< 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