summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-27 23:18:12 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-27 23:18:12 +0200
commit6d0ed0d26aebead7c79e4fb97c6962e06e7dcb41 (patch)
tree8b2a144e64f54145d06a5c45a0d8ab4a295db137 /src/object
parenta394c9efec830b275c0b738974126aead284ec4e (diff)
downloadcolobot-6d0ed0d26aebead7c79e4fb97c6962e06e7dcb41.tar.gz
colobot-6d0ed0d26aebead7c79e4fb97c6962e06e7dcb41.tar.bz2
colobot-6d0ed0d26aebead7c79e4fb97c6962e06e7dcb41.zip
Completely fixed light issues
Directional and spot lights are now set properly
Diffstat (limited to 'src/object')
-rw-r--r--src/object/object.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/object/object.cpp b/src/object/object.cpp
index e93fa1e..0b1a39c 100644
--- a/src/object/object.cpp
+++ b/src/object/object.cpp
@@ -2244,14 +2244,12 @@ bool CObject::CreateInsect(Math::Vector pos, float angle, ObjectType type)
bool CObject::CreateShadowLight(float height, Gfx::Color color)
{
- Gfx::Light light;
- Math::Vector pos;
-
if ( !m_engine->GetLightMode() ) return true;
- pos = GetPosition(0);
+ Math::Vector pos = GetPosition(0);
m_shadowHeight = height;
+ Gfx::Light light;
light.type = Gfx::LIGHT_SPOT;
light.diffuse.r = color.r;
light.diffuse.g = color.g;
@@ -2262,12 +2260,10 @@ bool CObject::CreateShadowLight(float height, Gfx::Color color)
light.direction.x = 0.0f;
light.direction.y = -1.0f; // against the bottom
light.direction.z = 0.0f;
- //TODO Is this value correct
light.spotIntensity = 128;
light.attenuation0 = 1.0f;
light.attenuation1 = 0.0f;
light.attenuation2 = 0.0f;
- //TODO Is this value correct
light.spotAngle = 90;
m_shadowLight = m_lightMan->CreateLight();
@@ -2292,13 +2288,11 @@ int CObject::GetShadowLight()
bool CObject::CreateEffectLight(float height, Gfx::Color color)
{
- Gfx::Light light;
-
if ( !m_engine->GetLightMode() ) return true;
m_effectHeight = height;
- memset( &light, 0, sizeof(light) );
+ Gfx::Light light;
light.type = Gfx::LIGHT_SPOT;
light.diffuse.r = color.r;
light.diffuse.g = color.g;
@@ -2309,12 +2303,10 @@ bool CObject::CreateEffectLight(float height, Gfx::Color color)
light.direction.x = 0.0f;
light.direction.y = -1.0f; // against the bottom
light.direction.z = 0.0f;
- //TODO Is this value correct
- light.spotIntensity = 1.0f;
+ light.spotIntensity = 0.0f;
light.attenuation0 = 1.0f;
light.attenuation1 = 0.0f;
light.attenuation2 = 0.0f;
- //TODO Is this value correct
light.spotAngle = 90;
m_effectLight = m_lightMan->CreateLight();