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. |
CLightingState::CLightingState | ( | void | ) |
Constructs a CLightingState object.
The constructed object must be initialized before use.
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.
Applies the lighting state to the OpenGL context.
This call applies the lighting-enables bit and the light sources.
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. |
Draws a sphere for every enabled light source.
The spheres are specified in world coordinates.
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] |
void CLightingState::setLight | ( | int | index, | |
const CLight & | l | |||
) | [virtual] |
Sets the light source parameters of an indexed light.
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] |
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.
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.
index | Light source index, must be in range [0,MAX_LIGHTS-1]. | |
l | Buffer that is filled with ligh source parameters. |
Implements ILightingState.
bool CLightingState::getLightingEnabled | ( | void | ) | const [virtual] |
Reads the lighting-enabled state bit.
Implements ILightingState.
void CLightingState::getMaterial | ( | CMaterial & | m | ) | const [inline, virtual] |
Get the current material parameters.
m | Buffer that is filled with material parameters. |
Implements ILightingState.