PhongLight Class Reference

Models a light source for Phong lighting MUCH TODO! More...

#include <PhongLight.h>

Inheritance diagram for PhongLight:

Object3d ViewObject Object

List of all members.

Public Member Functions

 PhongLight (const PhongMaterial &color)
 Standard constructor.
 PhongLight (const PhongLight &source)
 Copy constructor.
 ~PhongLight ()
 Standard destructor.
GLfloat getSpotAngle ()
 Getter for Spot Angle (180.0 = omni).
void setSpotAngle (const GLfloat &angle)
 Setter for Spot Angle (180.0 = omni).
GLfloat getSpotExponent ()
 Getter for Spot falloff Exponent.
void setSpotExponent (const GLfloat &exponent)
 Setter for Spot falloff Exponent.
void renderGl ()
 Display the Light.
void selectGl ()
 Not needed for lights.
const PhongMaterial getMaterial () const
 Getter for Material.
const GLint getLightId () const
 Getter for OpenGL light id.
void setLightId (const GLint &lightId)
 Setter for OpenGL light id.
GLfloat getAttenConst ()
 Getter for constant attenuation.
void setAttenConst (const GLfloat &attenConst)
 Setter for constant attenuation.
GLfloat getAttenLin ()
 Getter for linear attenuation.
void setAttenLin (const GLfloat &attenLin)
 Setter for linear attenuation.
GLfloat getAttenQuad ()
 Getter for quadratic attenuation.
void setAttenQuad (const GLfloat &attenQuad)
 Setter for quadratic attenuation.
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Private Member Functions

void takeSlotGl ()
 Finds the next free light id in OpenGL and assigns it.

Private Attributes

PhongMaterial material
 Color properties.
GLint lightId
 Light id in OpenGL.
GLfloat spotAngle
GLfloat spotExponent
GLfloat attenConst
 Attenuation Parameters.
GLfloat attenLin
GLfloat attenQuad

Static Private Attributes

static bool lightSlotGl [] = {true, true, true, true, true, true, true, true}
 Static array of free lights.


Detailed Description

Models a light source for Phong lighting MUCH TODO!

An animatable lightsource.
Needs a static member that automatically checks, if a light id is already in use.


Constructor & Destructor Documentation

PhongLight::PhongLight ( const PhongMaterial color  ) 

Standard constructor.

Creates a new simple white omni light, that will be the fist light in the scene. So if more than one light is invoked with the standard constructor, these lights will conflict.

PhongLight::PhongLight ( const PhongLight source  ) 

Copy constructor.

PhongLight::~PhongLight (  ) 

Standard destructor.

Disables the corresponding light in OpenGL


Member Function Documentation

void PhongLight::takeSlotGl (  )  [private]

Finds the next free light id in OpenGL and assigns it.

Does nothing if all slots are taken

GLfloat PhongLight::getSpotAngle (  ) 

Getter for Spot Angle (180.0 = omni).

void PhongLight::setSpotAngle ( const GLfloat &  angle  ) 

Setter for Spot Angle (180.0 = omni).

GLfloat PhongLight::getSpotExponent (  ) 

Getter for Spot falloff Exponent.

void PhongLight::setSpotExponent ( const GLfloat &  exponent  ) 

Setter for Spot falloff Exponent.

void PhongLight::renderGl (  )  [virtual]

Display the Light.

Sets light in OpenGL for rendering.

Parameters:
time The time in ms for which the light shall be rendered (used for animation).

Implements Object3d.

void PhongLight::selectGl (  )  [virtual]

Not needed for lights.

Not needed for lights

Implements Object3d.

const PhongMaterial PhongLight::getMaterial (  )  const

Getter for Material.

Returns:
A copy of the light's color properties as material. The shininess is of no relevance.

const GLint PhongLight::getLightId (  )  const

Getter for OpenGL light id.

Returns:
The light id of this object in OpenGL

void PhongLight::setLightId ( const GLint &  lightId  ) 

Setter for OpenGL light id.

Parameters:
lightId The OpenGl light id (GL_LIGHT0 - GL_LIGHT7) to be used. If the light id is invalid, this call will have no effect.

GLfloat PhongLight::getAttenConst (  ) 

Getter for constant attenuation.

void PhongLight::setAttenConst ( const GLfloat &  attenConst  ) 

Setter for constant attenuation.

GLfloat PhongLight::getAttenLin (  ) 

Getter for linear attenuation.

void PhongLight::setAttenLin ( const GLfloat &  attenLin  ) 

Setter for linear attenuation.

GLfloat PhongLight::getAttenQuad (  ) 

Getter for quadratic attenuation.

void PhongLight::setAttenQuad ( const GLfloat &  attenQuad  ) 

Setter for quadratic attenuation.

string PhongLight::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Reimplemented from Object3d.

string PhongLight::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

Reimplemented from Object3d.

enum classId PhongLight::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Reimplemented from Object3d.


Member Data Documentation

Color properties.

GLint PhongLight::lightId [private]

Light id in OpenGL.

GLfloat PhongLight::spotAngle [private]

GLfloat PhongLight::spotExponent [private]

GLfloat PhongLight::attenConst [private]

Attenuation Parameters.

GLfloat PhongLight::attenLin [private]

GLfloat PhongLight::attenQuad [private]

bool PhongLight::lightSlotGl = {true, true, true, true, true, true, true, true} [static, private]

Static array of free lights.


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

Generated on Mon Jul 7 13:30:34 2008 for Firefly by  doxygen 1.5.6