Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
Menge::SceneGraph::GLLight Class Reference

The OpenGL light class. Defines a light for the basic OpenGL pipeline. More...

#include <GLLight.h>

Public Types

enum  LightSpace { WORLD, CAMERA }
 Defines the space of the camera: world or camera. More...
 
enum  LightType { POINT, DIRECTIONAL }
 Defines the type of the light: point or directional. More...
 

Public Member Functions

 GLLight ()
 Default constructor.
 
void setDefaults ()
 Sets the default light parameters.
 
void setColor (float r, float g, float b, float a=1.0)
 Sets the light color. More...
 
void setPosition (float x, float y, float z, float w=-1.f)
 Sets the light color. More...
 
void setLightType (LightType lightType)
 Sets the light type. More...
 
void setSpace (LightSpace space)
 Sets the space of the camera. More...
 
void initGL (int i, LightSpace space=WORLD) const
 Initializes the corresponding OpenGL light. More...
 

Protected Attributes

float _diff [4]
 The diffuse color of the light. It includes the red, green, blue and alpha values.
 
float _pos [4]
 The position of the light. It includes the x, y, z and type values. If type is 0, the light is directional, otherwise it is a point light.
 
LightSpace _space
 Space of the light.
 

Detailed Description

The OpenGL light class. Defines a light for the basic OpenGL pipeline.

Member Enumeration Documentation

Defines the space of the camera: world or camera.

If world, the camera is fixed to the world. If camera, it is fixed to the camera and moves with the camera.

Defines the type of the light: point or directional.

If the light is point light, it acts like a single point source originating from the position. If the light is a directional light, it is a light source, infinitely far away oriented in the direction of the vector defined by the light position.

Member Function Documentation

void Menge::SceneGraph::GLLight::initGL ( int  i,
LightSpace  space = WORLD 
) const

Initializes the corresponding OpenGL light.

Parameters
iThe GL identifier for this light, such that this light is GL_LIGHTi.
spaceThe space being initialized. If the light is defined in a different space, then it shouldn't execute itself
void Menge::SceneGraph::GLLight::setColor ( float  r,
float  g,
float  b,
float  a = 1.0 
)

Sets the light color.

Parameters
rThe red component of the light's diffuse color. Must lie in the range [0, 1]
gThe green component of the light's diffuse color. Must lie in the range [0, 1]
bThe blue component of the light's diffuse color. Must lie in the range [0, 1]
aThe alpha component of the light's diffuse color. Must lie in the range [0, 1]
void Menge::SceneGraph::GLLight::setLightType ( LightType  lightType)

Sets the light type.

Parameters
lightTypeThe enumeration specifying either POINT or DIRECTIONAL light.
void Menge::SceneGraph::GLLight::setPosition ( float  x,
float  y,
float  z,
float  w = -1.f 
)

Sets the light color.

Parameters
xThe x-value of the light's position.
yThe y-value of the light's position.
zThe z-value of the light's position.
wThe w-value of the light's position. It determines the light type (point or directional). If the value is 0, the light is set to directional, if > 0 it is set to point, if < 0, it remains unchanged.
void Menge::SceneGraph::GLLight::setSpace ( LightSpace  space)
inline

Sets the space of the camera.

Parameters
spaceThe space for the camera.

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