From 7ebe34e95cffa9ac038ec5dccc530953ad988424 Mon Sep 17 00:00:00 2001 From: fredb Date: Sun, 28 Mar 2010 17:20:04 +0000 Subject: [PATCH] Put the color of night lighting in a uniform --- Effects/urban.eff | 5 +++++ Shaders/urban.frag | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Effects/urban.eff b/Effects/urban.eff index 19fbf7e22..3e71ec3a4 100644 --- a/Effects/urban.eff +++ b/Effects/urban.eff @@ -107,6 +107,11 @@ float 2000.0 + + night_color + float-vec3 + 0.75 0.59 0.05 + diff --git a/Shaders/urban.frag b/Shaders/urban.frag index 7458971d7..b471c6322 100644 --- a/Shaders/urban.frag +++ b/Shaders/urban.frag @@ -17,6 +17,7 @@ uniform sampler2D BaseTex; uniform sampler2D NormalTex; uniform float depth_factor; uniform float tile_size; +uniform vec3 night_color; const float zFar = 120000.0; const float zNear = 100.0; @@ -94,7 +95,7 @@ void main (void) float emission_factor = (1.0 - smoothstep(0.15, 0.25, reflectance)) * emis; vec4 tc = texture2D(BaseTex, uv); emission_factor *= 0.5*pow(tc.r+0.8*tc.g+0.2*tc.b, 2) -0.2; - ambient_light += (emission_factor * vec4(0.75, 0.59, 0.05, 0.0)); + ambient_light += (emission_factor * vec4(night_color, 0.0)); vec4 finalColor = texture2D(BaseTex, uv) * ambient_light;