Colobot
|
Manager for dynamic lights in 3D scene. More...
#include <lightman.h>
Classes | |
class | CLightsComparator |
Public Member Functions | |
CLightManager (CEngine *engine) | |
Constructor. More... | |
virtual | ~CLightManager () |
Destructor. More... | |
void | SetDevice (CDevice *device) |
Sets the device to be used. More... | |
void | DebugDumpLights () |
Prints debug info. More... | |
void | FlushLights () |
Clears and disables all lights. More... | |
int | CreateLight (LightPriority priority=LIGHT_PRI_LOW) |
Creates a new dynamic light and returns its index (lightRank) More... | |
bool | DeleteLight (int lightRank) |
Deletes and disables the given dynamic light. More... | |
bool | SetLight (int lightRank, const Light &light) |
Sets the light parameters for dynamic light. More... | |
bool | GetLight (int lightRank, Light &light) |
Returns the light parameters for given dynamic light. More... | |
bool | SetLightEnabled (int lightRank, bool enabled) |
Enables/disables the given dynamic light. More... | |
bool | SetLightPriority (int lightRank, LightPriority priority) |
Changes the light priority. More... | |
bool | SetLightIncludeType (int lightRank, EngineObjectType type) |
Sets what objects are included in given dynamic light. More... | |
bool | SetLightExcludeType (int lightRank, EngineObjectType type) |
Sets what objects are excluded from given dynamic light. More... | |
bool | SetLightPos (int lightRank, const Math::Vector &pos) |
Sets the position of dynamic light. More... | |
Math::Vector | GetLightPos (int lightRank) |
Returns the position of dynamic light. More... | |
bool | SetLightDir (int lightRank, const Math::Vector &dir) |
Sets the direction of dynamic light. More... | |
Math::Vector | GetLightDir (int lightRank) |
Returns the direction of dynamic light. More... | |
bool | SetLightIntensity (int lightRank, float value) |
Sets the destination intensity for dynamic light's intensity progression. More... | |
float | GetLightIntensity (int lightRank) |
Returns the current light intensity. More... | |
bool | SetLightIntensitySpeed (int lightRank, float speed) |
Sets the rate of change for dynamic light intensity. More... | |
void | AdaptLightColor (const Color &color, float factor) |
Adjusts the color of all dynamic lights. More... | |
bool | SetLightColor (int lightRank, const Color &color) |
Sets the destination color for dynamic light's color progression. More... | |
Color | GetLightColor (int lightRank) |
Returns current light color. More... | |
bool | SetLightColorSpeed (int lightRank, float speed) |
Sets the rate of change for dynamic light colors (RGB) More... | |
void | UpdateProgression (float rTime) |
Updates progression of dynamic lights. More... | |
void | UpdateLights () |
Updates (recalculates) all dynamic lights. More... | |
void | UpdateDeviceLights (EngineObjectType type) |
Enables or disables dynamic lights affecting the given object type. More... | |
Protected Attributes | |
CEngine * | m_engine |
CDevice * | m_device |
float | m_time |
Current time. More... | |
std::vector< DynamicLight > | m_dynLights |
List of dynamic lights. More... | |
std::vector< int > | m_lightMap |
Map of current light allocation: graphics light -> dynamic light. More... | |
Manager for dynamic lights in 3D scene.
The class is responsible for managing dynamic lights (struct DynamicLight) used in 3D scene. The dynamic lights are created, updated and deleted through the class' interface.
Since there is a limit on total number of lights available in OpenGL (usually up to 8), the dynamic lights must be emulated by displaying only some of them. All functions normally operate only on DynamicLight structs, updating the models with new values, while only one function, UpdateDeviceLights(), performs the actual synchronization to the device. It allocates device's light slots as necessary, with two priority levels for lights.
Gfx::CLightManager::CLightManager | ( | CEngine * | engine | ) |
Constructor.
|
virtual |
Destructor.
void Gfx::CLightManager::SetDevice | ( | CDevice * | device | ) |
Sets the device to be used.
void Gfx::CLightManager::DebugDumpLights | ( | ) |
Prints debug info.
void Gfx::CLightManager::FlushLights | ( | ) |
Clears and disables all lights.
int Gfx::CLightManager::CreateLight | ( | LightPriority | priority = LIGHT_PRI_LOW | ) |
Creates a new dynamic light and returns its index (lightRank)
Returns the index of light created.
bool Gfx::CLightManager::DeleteLight | ( | int | lightRank | ) |
Deletes and disables the given dynamic light.
bool Gfx::CLightManager::SetLight | ( | int | lightRank, |
const Light & | light | ||
) |
Sets the light parameters for dynamic light.
bool Gfx::CLightManager::GetLight | ( | int | lightRank, |
Light & | light | ||
) |
Returns the light parameters for given dynamic light.
bool Gfx::CLightManager::SetLightEnabled | ( | int | lightRank, |
bool | enabled | ||
) |
Enables/disables the given dynamic light.
bool Gfx::CLightManager::SetLightPriority | ( | int | lightRank, |
LightPriority | priority | ||
) |
Changes the light priority.
bool Gfx::CLightManager::SetLightIncludeType | ( | int | lightRank, |
EngineObjectType | type | ||
) |
Sets what objects are included in given dynamic light.
bool Gfx::CLightManager::SetLightExcludeType | ( | int | lightRank, |
EngineObjectType | type | ||
) |
Sets what objects are excluded from given dynamic light.
bool Gfx::CLightManager::SetLightPos | ( | int | lightRank, |
const Math::Vector & | pos | ||
) |
Sets the position of dynamic light.
Math::Vector Gfx::CLightManager::GetLightPos | ( | int | lightRank | ) |
Returns the position of dynamic light.
bool Gfx::CLightManager::SetLightDir | ( | int | lightRank, |
const Math::Vector & | dir | ||
) |
Sets the direction of dynamic light.
Math::Vector Gfx::CLightManager::GetLightDir | ( | int | lightRank | ) |
Returns the direction of dynamic light.
bool Gfx::CLightManager::SetLightIntensity | ( | int | lightRank, |
float | value | ||
) |
Sets the destination intensity for dynamic light's intensity progression.
float Gfx::CLightManager::GetLightIntensity | ( | int | lightRank | ) |
Returns the current light intensity.
bool Gfx::CLightManager::SetLightIntensitySpeed | ( | int | lightRank, |
float | speed | ||
) |
Sets the rate of change for dynamic light intensity.
void Gfx::CLightManager::AdaptLightColor | ( | const Color & | color, |
float | factor | ||
) |
Adjusts the color of all dynamic lights.
bool Gfx::CLightManager::SetLightColor | ( | int | lightRank, |
const Color & | color | ||
) |
Sets the destination color for dynamic light's color progression.
Color Gfx::CLightManager::GetLightColor | ( | int | lightRank | ) |
Returns current light color.
bool Gfx::CLightManager::SetLightColorSpeed | ( | int | lightRank, |
float | speed | ||
) |
Sets the rate of change for dynamic light colors (RGB)
void Gfx::CLightManager::UpdateProgression | ( | float | rTime | ) |
Updates progression of dynamic lights.
void Gfx::CLightManager::UpdateLights | ( | ) |
Updates (recalculates) all dynamic lights.
void Gfx::CLightManager::UpdateDeviceLights | ( | EngineObjectType | type | ) |
Enables or disables dynamic lights affecting the given object type.
|
protected |
Current time.
|
protected |
List of dynamic lights.
|
protected |
Map of current light allocation: graphics light -> dynamic light.