From cef2128c1ed1fc3c1ed86b332da7ea8cfbf7757e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 22 Apr 2012 19:27:09 +0000 Subject: Corrects a lighting bug introduced in r1123. --- src/render/draw.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/render/draw.cc b/src/render/draw.cc index 5d960fe..ed9c6a6 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -330,6 +330,7 @@ void draw_pass_globes() // FIXME is this ever reset ? GLfloat globe_specular[] = { 0.25f, 0.25f, 0.25f, 1.0f }; glMaterialfv(GL_FRONT, GL_SPECULAR, globe_specular); + float fake_light_location[4]; // Globes have to be rendered distance sorted, closest last. // Globes behind farplane are rescaled and repositioned. @@ -349,7 +350,6 @@ void draw_pass_globes() if (has_zone_light) { // nudge zone light // FIXME doesn't work correctly with multiple zone lights - float fake_light_location[4]; for (size_t i = 0; i < 3; i++) { fake_light_location[i] = zone_light_location[i] + location[i] - globe->location()[i]; } @@ -401,7 +401,11 @@ void draw_pass_globes() if (has_zone_light) { // restore zone light - glLightfv(zone_gllight, GL_POSITION, zone_light_location.ptr()); + for (size_t i = 0; i < 3; i++) { + fake_light_location[i] = zone_light_location[i]; + } + fake_light_location[3] = 1.0f; + glLightfv(zone_gllight, GL_POSITION, fake_light_location); } } } -- cgit v1.2.3