Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2012-04-22 19:27:09 +0000
committerStijn Buys <ingar@osirion.org>2012-04-22 19:27:09 +0000
commitcef2128c1ed1fc3c1ed86b332da7ea8cfbf7757e (patch)
treee13bdc5e861f0dbea7573a9186db024883a33695
parent75fd54748dd65b25f25f84a0bbdc25d6b7d4eb67 (diff)
Corrects a lighting bug introduced in r1123.
-rw-r--r--src/render/draw.cc8
1 files 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);
}
}
}