AlAreaLight
 
 
 

Encapsulates the creation, deletion and manipulation of area lights.

Synopsis

#include <AlAreaLight.h>
class AlAreaLight: public AlDirectionLight
	AlAreaLight();
virtual	~AlAreaLight();
statusCode	create();
virtual AlObject*	copyWrapper() const;
AlObjectType	type() const;
statusCode	longAxis( double&, double&, double& ) const;
statusCode	shortAxis( double&, double&, double& ) const;
statusCode	setLongAxis( double, double, double );
statusCode	setShortAxis( double, double, double );
statusCode	cornerPoints( double&, double&, double&, double&, double&, double&) const;

Description

An area light is a rectangular area that emits light in all directions. An area light would be used, for instance, to simulate bright light coming through a rectangular window. The size of the rectangle is defined by a long and short axis.

To create an area light, the user must instantiate and call the create method on an AlAreaLight object. (For more information on lights in general, see the Class Description of the AlDirectionLight object.)

To determine the orientation of the rectangular area of this light, use the worldPosition() of this light and the method cornerPoints(). The cornerPoints() method returns points A and B in world space, as in the following diagram: (WP is the World Position)

Although this class inherits methods to access the ’look at’ and ’up’ nodes of a light, they are not used. The direction and twist of an area light is changed by translating and rotating the transformation of the light’s position node.

AlAreaLight::AlAreaLight()

Description

Constructs an AlAreaLight wrapper object.

AlAreaLight::~AlAreaLight()

Description

Deletes an AlAreaLight wrapper object.

statusCode AlAreaLight::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 AlAreaLight::type() const

Description

Returns the class identifier, kAreaLightType.

statusCode AlAreaLight::longAxis( double &x, double &y, double &z) const

Description

Returns the linear light’s long axis in x, y & z.

Arguments

> double &x - the length of the axis in the x direction

> double &y - the length of the axis in the y direction

> double &z - the length of the axis in the z direction

Return Codes

sSuccess - successfully determined long axis of the light

sInvalidObject - the light was not valid

sFailure - the axis was not set

statusCode AlAreaLight::shortAxis( double &x, double &y, double &z) const

Description

Returns the linear light’s short axis in x, y & z.

Arguments

> double &x - the length of the axis in the x direction

> double &y - the length of the axis in the y direction

> double &z - the length of the axis in the z direction

Return Codes

sSuccess - successfully determined short axis of the light

sInvalidObject - the light was not valid

sFailure - the axis was not set

statusCode AlAreaLight::setLongAxis( double x, double y, double z )

Description

Sets the long axis of the light to be x, y, & z. The given vector must be non-zero.

Arguments

< double x - the new length of the axis in the x direction

< double y - the new length of the axis in the y direction

< double z - the new length of the axis in the z direction

Return Codes

sSuccess - setting long axis succeeded

sInvalidObject - not a valid area light

sInvalidArgument - axis vector was zero

sFailure - the axis was not set

statusCode AlAreaLight::setShortAxis( double x, double y, double z )

Description

Sets the short axis of the light to be x, y, & z. The given vector must be non-zero.

Arguments

< double x - the new length of the axis in the x direction

< double y - the new length of the axis in the y direction

< double z - the new length of the axis in the z direction

Return Codes

sSuccess - setting short axis succeeded

sInvalidObject - not a valid area light

sFailure - the axis was not set

sInvalidArgument - axis vector was zero

statusCode AlAreaLight::cornerPoints( double &x1, double &y1, double &z1,double &x2, double &y2, double &z2) const

Description

Returns the corner points of the rectangular area of this area light. The corner points are in world space. The corner points are A and B in the following diagram (WP is World Position of the light)

Arguments

> double &x1 - the world space short axis corner point in x direction

> double &y1 - the world space short axis corner point in y direction

> double &z1 - the world space short axis corner point in z direction

> double &x2 - the world space long axis corner point in x direction

> double &y2 - the world space long axis corner point in y direction

> double &z2 - the world space long axis corner point in z direction

Return Codes

sSuccess - successfully determined the light’s corner points

sInvalidObject - the light was not valid

sFailure - unable to complete the request