diff options
author | Evan Goers <mega@osirion.org> | 2012-01-08 11:16:35 +0000 |
---|---|---|
committer | Evan Goers <mega@osirion.org> | 2012-01-08 11:16:35 +0000 |
commit | a8a92cee21e1e5fba3d312bf3043b4e1b96d5576 (patch) | |
tree | b3a4d28ff4b988eb64d58536fae4b54bdf22b47e /src/render | |
parent | 848310a1521d81fd0500628daf33d2cc84b67e62 (diff) |
Implemented zone ambient color usage in renderer.
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 8 | ||||
-rw-r--r-- | src/render/state.cc | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index c25a84a..f9076cc 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -87,6 +87,14 @@ void pass_prepare(float seconds) // clear current list of globes globes_list.clear(); + // zone ambient light + GLfloat zone_ambient[4]; + for (size_t i = 0; i < 3; i++) { + zone_ambient[i] = core::localplayer()->zone()->ambient_color()[i] * r_ambient->value(); + } + zone_ambient[3] = 1.0f; + glLightModelfv(GL_LIGHT_MODEL_AMBIENT, zone_ambient); + for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) { core::Entity *entity = (*it); diff --git a/src/render/state.cc b/src/render/state.cc index ab5eec4..f5cbb8d 100644 --- a/src/render/state.cc +++ b/src/render/state.cc @@ -137,8 +137,6 @@ void State::clear() //gl::shademodel(GL_FLAT); // lighting model - GLfloat global_ambient[] = { 0.1f, 0.1f, 0.1f, 1.0f }; - glLightModelfv(GL_LIGHT_MODEL_AMBIENT, global_ambient); glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); // color tracking @@ -291,7 +289,8 @@ void State::use_material(const model::Material * material) { gl::enable(GL_TEXTURE_GEN_S); gl::enable(GL_TEXTURE_GEN_T); gl::enable(GL_TEXTURE_GEN_R); - } + } + //FIXME provide a fallback for zones without a skybox } } |