Light Class Reference

Can be used to illuminate a scene. More...

#include <Light.h>

List of all members.

Public Member Functions

 Light ()
 ~Light ()
void Apply (int time)
void SetAmbient (float red, float green, float blue, float alpha)
void SetDiffuse (float red, float green, float blue, float alpha)
void SetSpecular (float red, float green, float blue, float alpha)
void Bind (int id)

Static Public Member Functions

static int GetId ()

Public Attributes

PositionPathposition

Private Attributes

float ambient [4]
float diffuse [4]
float specular [4]
int id

Static Private Attributes

static int current_id


Detailed Description

Can be used to illuminate a scene.

The Light class just bundles together the code needed to apply lighting in OpenGL. Like any other object that can be added to a scene, a Light has a position that may vary over time. Furthermore, it contains values for the ambient, diffuse and specular illumination of a scene.

Definition at line 18 of file Light.h.


Constructor & Destructor Documentation

Light::Light  ) 
 

Constructor: Initialized the light to default values.

Definition at line 3 of file Light.cpp.

Light::~Light  ) 
 

Destructor.

Definition at line 23 of file Light.cpp.


Member Function Documentation

void Light::Apply int  time  ) 
 

Applies the light to the current OpenGL environment.

Parameters:
time Specifies the time for which the position of the light shall be evaluated.

Definition at line 57 of file Light.cpp.

void Light::Bind int  id  ) 
 

Binds the light to OpenGL

Parameters:
id Identifies this light under OpenGL.

Definition at line 52 of file Light.cpp.

static int Light::GetId  )  [static]
 

Returns a new unique value which identifies the light under OpenGL.

void Light::SetAmbient float  red,
float  green,
float  blue,
float  alpha
 

Sets the ambient contribution of the light.

Parameters:
red Red part of the ambient illumination.
green Green part of the ambient illumination.
blue Blue part of the ambient illumination.
alpha Alpha value of the ambient illumination.

Definition at line 28 of file Light.cpp.

void Light::SetDiffuse float  red,
float  green,
float  blue,
float  alpha
 

Set the diffuse contribution of the light.

Parameters:
red Red part of the diffuse illumination.
green Green part of the diffuse illumination.
blue Blue part of the diffuse illumination.
alpha Alpha value of the diffuse illumination.

Definition at line 36 of file Light.cpp.

void Light::SetSpecular float  red,
float  green,
float  blue,
float  alpha
 

Sets the specular contributino of the light.

Parameters:
red Red part of the specular illuminaion.
green Green part of the specular illumination.
blue Blue part of the specular illumination.
alpha Alpha value of the specular illumination.

Definition at line 44 of file Light.cpp.


Member Data Documentation

float Light::ambient[4] [private]
 

Ambient contribution.

Definition at line 87 of file Light.h.

int Light::current_id [static, private]
 

holds id that will be distributed by the next call to 'GetId ()'.

Definition at line 99 of file Light.h.

float Light::diffuse[4] [private]
 

Diffuse contribution.

Definition at line 90 of file Light.h.

int Light::id [private]
 

Stores the identifier which is used to bind the light to OpenGL

Definition at line 96 of file Light.h.

PositionPath* Light::position
 

Path of the light over time.

Definition at line 41 of file Light.h.

float Light::specular[4] [private]
 

Specular contribution.

Definition at line 93 of file Light.h.


Generated on Sun Jul 2 13:20:40 2006 for Demo by  doxygen 1.4.6-NO