Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/zone.cc6
-rw-r--r--src/game/intro/intro.cc5
-rw-r--r--src/render/draw.cc8
-rw-r--r--src/render/state.cc5
4 files changed, 17 insertions, 7 deletions
diff --git a/src/core/zone.cc b/src/core/zone.cc
index f33fc60..8050716 100644
--- a/src/core/zone.cc
+++ b/src/core/zone.cc
@@ -118,7 +118,7 @@ void Zone ::clear()
Zone::Zone(std::string const & label) :
Label(label),
- zone_ambient_color(1.0f, 1.0f, 1.0f)
+ zone_ambient_color(0.1f, 0.1f, 0.1f)
{
zone_id = 0;
zone_defaultview = 0;
@@ -138,7 +138,7 @@ Zone::Zone(std::string const & label) :
Zone::Zone(std::istream & is) :
Label(),
- zone_ambient_color(1.0f, 1.0f, 1.0f)
+ zone_ambient_color(0.1f, 0.1f, 0.1f)
{
zone_id = 0;
zone_defaultview = 0;
@@ -276,7 +276,7 @@ void Zone::serialize_server_update(std::ostream & os) const
void Zone::receive_server_update(std::istream &is)
{
unsigned int id = 0;
- float r = 1.0f, g = 1.0f, b = 1.0f;
+ float r = 0.1f, g = 0.1f, b = 0.1f;
std::string n;
char c;
diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc
index 25e4d59..f5f7ab2 100644
--- a/src/game/intro/intro.cc
+++ b/src/game/intro/intro.cc
@@ -93,9 +93,12 @@ bool Intro::load_world()
if (inifile.got_key_string("label", strval)) {
zone->set_label(strval);
- } else if (inifile.got_key_string("sky", strval)) {
+ } else if (inifile.got_key_string("sky", strval)) {
zone->set_sky(strval);
+ } else if (inifile.got_key_color("ambient", color)) {
+ zone->set_ambient_color(color);
+
} else if (inifile.got_key()) {
inifile.unknown_key();
}
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
}
}