diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-06-20 23:14:37 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-06-20 23:14:37 +0200 |
commit | 28b4e9a63450110978d60de80a9af2e901d49a97 (patch) | |
tree | 8a935f0350f695453353155d5efc561b13db9632 /src/graphics/engine/lightman.cpp | |
parent | 4c33172e173b8f815a367f1e1c0fae06d9051df5 (diff) | |
download | colobot-28b4e9a63450110978d60de80a9af2e901d49a97.tar.gz colobot-28b4e9a63450110978d60de80a9af2e901d49a97.tar.bz2 colobot-28b4e9a63450110978d60de80a9af2e901d49a97.zip |
Fixed terrain light priorities (fix for #139)
* lights illuminating the terrain specified in scene file are now
always moved to front of light ordering
Diffstat (limited to 'src/graphics/engine/lightman.cpp')
-rw-r--r-- | src/graphics/engine/lightman.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/graphics/engine/lightman.cpp b/src/graphics/engine/lightman.cpp index cd743a5..295b3da 100644 --- a/src/graphics/engine/lightman.cpp +++ b/src/graphics/engine/lightman.cpp @@ -236,6 +236,15 @@ bool CLightManager::SetLightEnabled(int lightRank, bool enabled) return true; } +bool CLightManager::SetLightPriority(int lightRank, LightPriority priority) +{ + if ( (lightRank < 0) || (lightRank >= static_cast<int>( m_dynLights.size() )) ) + return false; + + m_dynLights[lightRank].priority = priority; + return true; +} + bool CLightManager::SetLightIncludeType(int lightRank, EngineObjectType type) { if ( (lightRank < 0) || (lightRank >= static_cast<int>( m_dynLights.size() )) ) @@ -503,6 +512,9 @@ CLightManager::LightsComparator::LightsComparator(Math::Vector eyePos, EngineObj float CLightManager::LightsComparator::GetLightWeight(const DynamicLight& dynLight) { + if (dynLight.priority == LIGHT_PRI_HIGHEST) + return -1.0f; + bool enabled = true; if (!dynLight.used || !dynLight.enabled || dynLight.intensity.current == 0.0f) enabled = false; |