From 9807be4f0d39b3c815ce5dfc4e8d5bd429964a03 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Wed, 18 Apr 2012 08:37:14 +0200 Subject: [PATCH] Fix a problem with cockpit shadows added in previous commit --- Shaders/sunlight.frag | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Shaders/sunlight.frag b/Shaders/sunlight.frag index 6d453c6ec..f99f6637d 100644 --- a/Shaders/sunlight.frag +++ b/Shaders/sunlight.frag @@ -20,10 +20,11 @@ vec4 DynamicShadow( in vec4 ecPosition, out vec4 tint ) vec4 coords; vec2 shift = vec2( 0.0 ); int index = 4; - float factor = 0.5; + float factor = 0.5; if (ecPosition.z > -fg_ShadowDistances.x) { index = 1; - factor = 1.0; + if (fg_ShadowNumber == 1) + factor = 1.0; tint = vec4(0.0,1.0,0.0,1.0); } else if (ecPosition.z > -fg_ShadowDistances.y && fg_ShadowNumber > 1) { index = 2; @@ -64,7 +65,7 @@ void main() { #elif 1 float shadow = shadow2DProj( shadow_tex, DynamicShadow( vec4( pos, 1.0 ), tint ) ).r; #elif 0 - float shadow = 0.0; + float shadow = 0.0; shadow += 0.333 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos, 1.0), tint ) ).r; shadow += 0.166 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos + vec3(-0.003 * pos.z, -0.003 * pos.z, 0), 1.0), tint ) ).r; shadow += 0.166 * shadow2DProj( shadow_tex, DynamicShadow( vec4(pos + vec3( 0.003 * pos.z, 0.003 * pos.z, 0), 1.0), tint ) ).r;