FCDLight Class Reference
[COLLADA Document Object Model.]

A COLLADA light. More...

#include <FCDLight.h>

Inheritance diagram for FCDLight:

FCDTargetedEntity FCDEntity FCDObjectWithId FCDObject FUObject List of all members.

Public Types

enum  LightType { POINT, SPOT, AMBIENT, DIRECTIONAL }
 The types of lights supported by this class. More...

Public Member Functions

 FCDLight (FCDocument *document)
 Constructor: do not use directly.
virtual ~FCDLight ()
 Destructor: do not release directly.
virtual Type GetType () const
 Retrieves the entity type for this class.
FMVector3GetColor ()
 Retrieves the base color for the light.
const FMVector3GetColor () const
 See above.
void SetColor (const FMVector3 &col)
 Sets the base color for the light.
float & GetIntensity ()
 Retrieves the intensity of the light.
const float & GetIntensity () const
 See above.
void SetIntensity (float _intensity)
 Sets the intensity of the light.
LightType GetLightType () const
 Retrieves the type of the light.
void SetLightType (LightType type)
 Sets the type of the light.
float & GetConstantAttenuationFactor ()
 Retrieves the constant attenuation factor for the light.
const float & GetConstantAttenuationFactor () const
 See above.
void SetConstantAttenuationFactor (float factor)
 Sets the constant attenuation factor for the light.
float & GetLinearAttenuationFactor ()
 Retrieves the linear attenuation factor for the light.
const float & GetLinearAttenuationFactor () const
 See above.
void SetLinearAttenuationFactor (float factor)
 Sets the linear attenuation factor for the light.
float & GetQuadraticAttenuationFactor ()
 Retrieves the quadratic attenuation factor for the light.
const float & GetQuadraticAttenuationFactor () const
 See above.
void SetQuadraticAttenuationFactor (float factor)
 Sets the quadratic attenuation factor for the light.
float & GetFallOffExponent ()
 Retrieves the fall-off exponent for the light.
const float & GetFallOffExponent () const
 See above.
void SetFallOffExponent (float exponent)
 Sets the fall-off exponent for the light.
float & GetFallOffAngle ()
 Retrieves the fall-off angle for the light.
const float & GetFallOffAngle () const
 See above.
void SetFallOffAngle (float angle)
 Sets the fall-off angle for the light.
float & GetOuterAngle ()
 Retrieves the outer angle for the light.
const float & GetOuterAngle () const
 See above.
void SetOuterAngle (float angle)
 Sets the outer angle for the light.
float & GetPenumbraAngle ()
 Retrieves the penumbra angle for the light.
const float & GetPenumbraAngle () const
 See above.
void SetPenumbraAngle (float angle)
 Sets the penumbra angle for the light.
float & GetAspectRatio ()
 Retrieves the aspect ratio for the light.
const float & GetAspectRatio () const
 See above.
void SetAspectRatio (float ratio)
 Sets the aspect ratio for the light.
float & GetDropoff ()
 Retrieves the drop-off for the light.
const float & GetDropoff () const
 See above.
void SetDropoff (float factor)
 Sets the drop-off for the light.
bool DoesOvershoot () const
 Retrieves whether the directional light overshoots.
void SetOvershoot (bool _overshoots)
 Sets whether the directional light overshoots.
FUStatus LoadFromXML (xmlNode *lightNode)
 [INTERNAL] Reads in the <light> element from a given COLLADA XML tree node.
virtual xmlNode * WriteToXML (xmlNode *parentNode) const
 [INTERNAL] Writes out the <light> element to the given COLLADA XML tree node.

Detailed Description

A COLLADA light.

Based on the FCDTargetedEntity class to supported aimed lights. COLLADA defines four types of native lights: point, spot, ambient and directional. These four types are fully handled by this class: make sure to check the type flag as well as which information to expect for each light type.

A COLLADA ambient light has a global color, which should be added to all other lighting on all geometry.

A COLLADA directional light has a global color, which should be multiplied to the cosine of the angle between the normal vector of a triangle and the direction of the light. Note that the direction will be calculated from the transforms, for each instance, and is not provided by this class.

A COLLADA point light has a color which attenuates as the distance increases between the light position and the vertex being shaded. Note that the position will be calculated from the transforms, for each instance, and is not provided by this class.

A COLLADA spot light is a point light which lights only the objects that appear within a specific angle, with respect to the direction of the light. Note that the position and the direction will be calculated from the transforms, for each instance, and is not provided by this class.


Member Enumeration Documentation

enum FCDLight::LightType
 

The types of lights supported by this class.

Enumerator:
POINT  A point light.

This is the default type.

SPOT  A spot light.
AMBIENT  An ambient light.
DIRECTIONAL  A directional light.


Constructor & Destructor Documentation

FCDLight::FCDLight FCDocument document  ) 
 

Constructor: do not use directly.

Create new lights using the FCDLibrary::AddEntity function.

Parameters:
document The COLLADA document that contains this light entity.

virtual FCDLight::~FCDLight  )  [virtual]
 

Destructor: do not release directly.

Release lights using the FCDLibrary::ReleaseEntity function. All lights are also released with the document that they belong to.


Member Function Documentation

bool FCDLight::DoesOvershoot  )  const [inline]
 

Retrieves whether the directional light overshoots.

This value is only used by documents exported by ColladaMax. This value is valid only for directional lights. This flag represents whether the directional light has a global projection, as defined in COLLADA, or a cylinder/prism projection. Note that there is no way to know if the projection is conic or pyramidal.

Returns:
Whether the directional light overshoots.

float& FCDLight::GetAspectRatio  )  [inline]
 

Retrieves the aspect ratio for the light.

This value is only used by documents exported by ColladaMax. This value is valid only for spot lights and directional lights which project a rectangle (for pyramidal projection). It represents the ratio of the projection's height to the projection's width and defines the projection's rectangle. For pyramidal projections, the fall-off and outer angles represent the width of the projection. Note that there is no way to know if the projection is conic or pyramidal.

Returns:
The aspect ratio of the light pyramidal projection.

FMVector3& FCDLight::GetColor  )  [inline]
 

Retrieves the base color for the light.

To calculate the light color, multiply the base color with the intensity.

Returns:
The base color for the light.

float& FCDLight::GetConstantAttenuationFactor  )  [inline]
 

Retrieves the constant attenuation factor for the light.

This value is valid only for point and spot lights.

Returns:
The constant attenuation factor.

float& FCDLight::GetDropoff  )  [inline]
 

Retrieves the drop-off for the light.

This value is only used by documents exported by ColladaMaya.

Returns:
The drop-off for the light.

float& FCDLight::GetFallOffAngle  )  [inline]
 

Retrieves the fall-off angle for the light.

This value is valid only for spot lights. It defines the cone of the spot light.

Returns:
The spot light fall-off angle.

float& FCDLight::GetFallOffExponent  )  [inline]
 

Retrieves the fall-off exponent for the light.

This value is valid only for spot lights. It determines how fast the lighting turns off, with respect to angles greater than the fall-off angle. This results in a smooth lighting at the spot light's edges.

IMPORTANT NOTE: Neither ColladaMaya or ColladaMax use this value as neither Maya or 3dsMax use this technique for soft lighting.

Returns:
The spot light fall-off exponent.

float& FCDLight::GetIntensity  )  [inline]
 

Retrieves the intensity of the light.

To calculate the light color, multiply the base color with the intensity.

Returns:
The intensity of the light.

LightType FCDLight::GetLightType  )  const [inline]
 

Retrieves the type of the light.

Make sure to check the type of light before using the values, as some values may not make sense with some types of light.

Returns:
The light type.

float& FCDLight::GetLinearAttenuationFactor  )  [inline]
 

Retrieves the linear attenuation factor for the light.

This value is valid only for point and spot lights.

Returns:
The linear attenuation factor.

float& FCDLight::GetOuterAngle  )  [inline]
 

Retrieves the outer angle for the light.

This value is valid only for spot lights. This value is only used by documents exported by ColladaMax. This value should always be greater than the fall-off angle. It represents the angle at which the lighting is black. All lighting between the fall-off angle and the outer angle is a linear interpolation between the light color and black.

Returns:
The spot light outer angle.

float& FCDLight::GetPenumbraAngle  )  [inline]
 

Retrieves the penumbra angle for the light.

This value is valid only for spot lights. The value is only used by documents exported by ColladaMaya. This value is relative to the fall-off angle and may be negative. If this value is positive, it determines the outer angle, as described above. If this value is negative, the fall-off angle is used as the outer angle and the fall-off angle + the penumbra angle is used as the full-lighting angle.

See also:
GetOuterAngle
Returns:
The spot light penumbra angle.

float& FCDLight::GetQuadraticAttenuationFactor  )  [inline]
 

Retrieves the quadratic attenuation factor for the light.

This value is valid only for point and spot lights.

Returns:
The quadratic attenuation factor.

virtual Type FCDLight::GetType  )  const [inline, virtual]
 

Retrieves the entity type for this class.

This function is part of the FCDEntity interface.

Returns:
The entity type: LIGHT.

Reimplemented from FCDEntity.

FUStatus FCDLight::LoadFromXML xmlNode *  lightNode  )  [virtual]
 

[INTERNAL] Reads in the <light> element from a given COLLADA XML tree node.

Parameters:
lightNode A COLLADA XML tree node.
Returns:
The status of the import. If the status is not successful, it may be dangerous to extract information from the light.

Reimplemented from FCDEntity.

void FCDLight::SetAspectRatio float  ratio  )  [inline]
 

Sets the aspect ratio for the light.

See also:
GetAspectRatio
Parameters:
ratio The aspect ratio of the light pyramidal projection.

void FCDLight::SetColor const FMVector3 col  )  [inline]
 

Sets the base color for the light.

To calculate the light color, multiply the base color with the intensity.

Parameters:
col The base color for the light.

void FCDLight::SetConstantAttenuationFactor float  factor  )  [inline]
 

Sets the constant attenuation factor for the light.

This value is valid only for point and spot lights.

Parameters:
factor The constant attenuation factor.

void FCDLight::SetDropoff float  factor  )  [inline]
 

Sets the drop-off for the light.

This value is only used by documents exported by ColladaMaya.

Parameters:
factor The drop-off for the light.

void FCDLight::SetFallOffAngle float  angle  )  [inline]
 

Sets the fall-off angle for the light.

See also:
GetFallOffAngle
Parameters:
angle The spot light fall-off angle.

void FCDLight::SetFallOffExponent float  exponent  )  [inline]
 

Sets the fall-off exponent for the light.

See also:
GetFallOffExponent
Parameters:
exponent The spot light fall-off exponent.

void FCDLight::SetIntensity float  _intensity  )  [inline]
 

Sets the intensity of the light.

To calculate the light color, multiply the base color with the intensity.

Parameters:
_intensity The intensity of the light.

void FCDLight::SetLightType LightType  type  )  [inline]
 

Sets the type of the light.

The default type of a new light is POINT.

Parameters:
type The light type.

void FCDLight::SetLinearAttenuationFactor float  factor  )  [inline]
 

Sets the linear attenuation factor for the light.

This value is valid only for point and spot lights.

Parameters:
factor The linear attenuation factor.

void FCDLight::SetOuterAngle float  angle  )  [inline]
 

Sets the outer angle for the light.

See also:
GetOuterAngle
Parameters:
angle The spot light outer angle.

void FCDLight::SetOvershoot bool  _overshoots  )  [inline]
 

Sets whether the directional light overshoots.

See also:
DoesOvershoot
Parameters:
_overshoots The overshoot flag for the directional light.

void FCDLight::SetPenumbraAngle float  angle  )  [inline]
 

Sets the penumbra angle for the light.

See also:
GetPenumbraAngle
Parameters:
angle The spot light penumbra angle.

void FCDLight::SetQuadraticAttenuationFactor float  factor  )  [inline]
 

Sets the quadratic attenuation factor for the light.

This value is valid only for point and spot lights.

Parameters:
factor The quadratic attenuation factor.

virtual xmlNode* FCDLight::WriteToXML xmlNode *  parentNode  )  const [virtual]
 

[INTERNAL] Writes out the <light> element to the given COLLADA XML tree node.

Parameters:
parentNode The COLLADA XML parent node in which to insert the geometry information.
Returns:
The created XML tree node.

Reimplemented from FCDEntity.


The documentation for this class was generated from the following file:
Generated on Fri May 12 16:44:43 2006 for FCollada by  doxygen 1.4.6-NO