CLightingState Class Reference

Implements the ILightingState interface. More...

Inheritance diagram for CLightingState:

ILightingState

List of all members.

Public Member Functions

 CLightingState (void)
 Constructs a CLightingState object.
void init (void)
 Initializes the object.
void shutdown (void)
 Frees resources and prepares the object for destruction.
void bindLights (const mat4_t &viewMatrix, const mat4_t &autoRotateMatrix)
 Applies the lighting state to the OpenGL context.
void bindMaterial (void)
 Applies the material parameters to the OpenGL context.
void drawLights (const mat4_t &viewMatrix, const mat4_t &autoRotateMatrix)
 Draws a sphere for every enabled light source.
void setShowLights (bool enable)
 Writes the show-lights flag.
void setLight (int index, const CLight &l)
 Sets the light source parameters of an indexed light.
void setMaterial (const CMaterial &m)
 Sets the current material parameters.
void setLightingEnabled (bool enable)
 Writes lighting-enables state bit.
bool getLight (int index, CLight &l) const
 Get parameters of an indexed light source.
bool getLightingEnabled (void) const
 Reads the lighting-enabled state bit.
void getMaterial (CMaterial &m) const
 Get the current material parameters.


Detailed Description

Implements the ILightingState interface.

Constructor & Destructor Documentation

CLightingState::CLightingState ( void   ) 

Constructs a CLightingState object.

The constructed object must be initialized before use.


Member Function Documentation

void CLightingState::init ( void   ) 

Initializes the object.

Loads required resources and makes the object ready for use. This call also loads the default lighting state for this object.

void CLightingState::shutdown ( void   ) 

Frees resources and prepares the object for destruction.

Must be called before deleting a n initialized CLightingState object.

void CLightingState::bindLights ( const mat4_t viewMatrix,
const mat4_t autoRotateMatrix 
)

Applies the lighting state to the OpenGL context.

This call applies the lighting-enables bit and the light sources.

Warning:
This call needs one free element of the OpenGL modelview matrix stack.
Parameters:
viewMatrix Transformation matrix from world space to eye space.
autoRotateMatrix This matrix is applied to the light position if the light's auto-rotate flag is set.

void CLightingState::drawLights ( const mat4_t viewMatrix,
const mat4_t autoRotateMatrix 
)

Draws a sphere for every enabled light source.

The spheres are specified in world coordinates.

Warning:
This call needs one free elements of the OpenGL modelview matrix stack.
Parameters:
viewMatrix Transformation matrix form world space to eye space.
autoRotateMatrix This matrix is applied to the light position if the light's auto-rotate flag is set.

void CLightingState::setShowLights ( bool  enable  )  [inline, virtual]

Writes the show-lights flag.

Parameters:
enable The show-lights flag.

Implements ILightingState.

void CLightingState::setLight ( int  index,
const CLight l 
) [virtual]

Sets the light source parameters of an indexed light.

Parameters:
index Light source index, must be in range [0,MAX_LIGHTS-1].
l Light source parameters.

Implements ILightingState.

void CLightingState::setMaterial ( const CMaterial m  )  [inline, virtual]

Sets the current material parameters.

Parameters:
m Material parameters.

Implements ILightingState.

void CLightingState::setLightingEnabled ( bool  enable  )  [virtual]

Writes lighting-enables state bit.

This represents the GL_LIGHTING state bit of OpenGL. The initial state is false.

Parameters:
enable The lighting-enabled state bit.

Implements ILightingState.

bool CLightingState::getLight ( int  index,
CLight l 
) const [virtual]

Get parameters of an indexed light source.

The call fails, if the light source index is out of range. In that case, results are undefined.

Parameters:
index Light source index, must be in range [0,MAX_LIGHTS-1].
l Buffer that is filled with ligh source parameters.
Returns:
Wether the call succeeded.

Implements ILightingState.

bool CLightingState::getLightingEnabled ( void   )  const [virtual]

Reads the lighting-enabled state bit.

Returns:
The lighting-enabled state bit.

Implements ILightingState.

void CLightingState::getMaterial ( CMaterial m  )  const [inline, virtual]

Get the current material parameters.

Parameters:
m Buffer that is filled with material parameters.

Implements ILightingState.


The documentation for this class was generated from the following file:
Generated on Sun Mar 2 17:12:32 2008 for Shader Maker by  doxygen 1.5.4