# cLight Class Reference
[Scenegraph]

cLight describes an OpenGL light source, generally rendered by a cWorld object, which is typically the top of a scene graph.
By default, lights are directional and non-spot. More...

`#include <CLight.h>`

Inheritance diagram for cLight:

[legend]

List of all members.

## Public Member Functions
| cLight (cWorld *a_world=NULL)
| Constructor of cLight.
| ~cLight ()
| Destructor of cLight.
void | setDir (const cVector3d &a_direction)
| Set the direction of the light beam... only affects _positional_ lights with angular cutoffs (spotlights).
void | setDir (const double a_x, const double a_y, const double a_z)
| Set the direction of the light beam... only affects _positional_ lights with angular cutoffs (spotlights).
cVector3d | getDir () const
| Read the direction of the light beam... only affects _positional_ lights with angular cutoffs (spotlights).
void | setDirectionalLight (bool a_directionalLight)
| Set this light to be purely directional (true) or purely positional (false).
bool | getDirectionalLight ()
| Returns true for a directional light, false for a positional light.
void | setAttConstant (const GLfloat &a_value)
| Set my constant attenuation parameter.
GLfloat | getAttConstant () const
| Read my constant attenuation parameter.
void | setAttLinear (const GLfloat &a_value)
| Set my linear attenuation parameter.
GLfloat | getAttLinear () const
| Read my linear attenuation parameter.
void | setAttQuadratic (const GLfloat &a_value)
| Set my quadratic attenuation parameter.
GLfloat | getAttQuadratic () const
| Read my quadratic attenuation parameter.
void | setSpotExponent (const GLfloat &a_value)
| Set concentration level of the light.
GLfloat | getSpotExponent () const
| Read concentration level of the light.
void | setCutOffAngle (const GLfloat &a_value)
| Set the cutoff angle in degrees (only affects spotlights) (positional lights with angular cutoffs).
GLfloat | getCutOffAngle () const
| Read Cut off angle.
void | setEnabled (const bool &a_enabled)
| Enable or disable this light source.
bool | getEnabled () const
| Is this light source enabled?
## Public Attributes
cColorf | m_ambient
| Ambient light component.
cColorf | m_diffuse
| Diffuse light component.
cColorf | m_specular
| Specular light component.
## Protected Member Functions
void | renderLightSource ()
| Render the light in OpenGL.
## Protected Attributes
cWorld * | m_parentWorld
| Parent world.
GLfloat | m_attConstant
| Constant attenuation parameter.
GLfloat | m_attLinear
| Linear attenuation parameter.
GLfloat | m_attQuadratic
| Quadratic attenuation parameter.
GLfloat | m_spotExponent
| Concentration of the light.
GLfloat | m_cutOffAngle
| Cut off angle (for spot lights only). Only values in the range [0, 90], and the special value 180, are accepted.
bool | m_enabled
| Enable light source (ON/OFF).
bool | m_directionalLight
| Is this a directional (true) or positional (false) light.
GLint | m_glLightNumber
| GL reference number of the light (0-7).
## Friends
class | cWorld
| cWorld needs to access OpenGL information stored privately in cLight
class | cCamera
| cCamera needs to access OpenGL information stored privately in cLight

## Detailed Description

cLight describes an OpenGL light source, generally rendered by a cWorld object, which is typically the top of a scene graph.
By default, lights are directional and non-spot.

## Constructor & Destructor Documentation

cLight::cLight | ( | cWorld * | a_world = `NULL` | ) |

Constructor of cLight.

When creating an OpenGL light source, an identity number between 0 and 7 is attributed to the light. This number is used during the rendering process. Lights are automatically created inside class cWorld.

Parameters:

  | a_world | parent world in which light source will be located

cLight::~cLight | ( |  | ) |

Destructor of cLight.

Destructor of cLight. Disables this light in OpenGL and removes it from the parent's list of lights.

## Member Function Documentation

void cLight::renderLightSource | ( |  | ) | `[protected]`

Render the light in OpenGL.

Render this light source in OpenGL.

Note that if this light source is disabled, the corresponding GL light source is disabled. That means you can't disable your CHAI light but turn on the GL light somewhere else.

void cLight::setCutOffAngle | ( | const GLfloat & | a_value | ) |

Set the cutoff angle in degrees (only affects spotlights) (positional lights with angular cutoffs).

Set the cutoff angle (in degrees) of my light beam.

Should range between 0 and 90 for spot lights. Use 180.0 to specify that there should be no cutoff.

Parameters:

  | a_value | Cutoff angle of light beam.

void cLight::setDir | ( | const double | a_x,
|  | const double | a_y,
|  | const double | a_z |
| ) |  |  |

Set the direction of the light beam... only affects _positional_ lights with angular cutoffs (spotlights).

Set the direction of my light beam.

Parameters:

  | a_x | X Coordinate of light beam.
  | a_y | Y Coordinate of light beam.
  | a_z | Z Coordinate of light beam.

void cLight::setDir | ( | const cVector3d & | a_direction | ) |

Set the direction of the light beam... only affects _positional_ lights with angular cutoffs (spotlights).

Set the direction of my light beam.

Parameters:

  | a_direction | Direction of light beam

The documentation for this class was generated from the following files:

- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/scenegraph/CLight.h
- D:/CHAI3D/build-2-0-0/2.0.0/win32/src/scenegraph/CLight.cpp

CHAI3D 2.0.0 documentation
Please address any questions to support@chai3d.org
(C) 2003-2009 - CHAI 3D
All Rights Reserved.