Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Goers <mega@osirion.org>2012-03-21 14:01:06 +0000
committerEvan Goers <mega@osirion.org>2012-03-21 14:01:06 +0000
commit2bb4648c0a92244d98a3dd0995e912eba80c4450 (patch)
treebf4b6d5fa05e32fddf7d96b9e8db78bf02aee847 /src/render
parent980b47266c5fba9a7e7fabfa7a6d77167a47cb60 (diff)
Changed create_light() to add_light().
De-duplicated some magic numbers.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/draw.cc14
-rw-r--r--src/render/draw.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 3b7acad..71b8631 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -54,6 +54,10 @@ bool draw_particles = true;
bool draw_lights = true;
size_t max_lights = 8;
+float ambient_light_intensity = 0.1f;
+float diffuse_light_intensity = 0.75f;
+float specular_light_intensity = 0.75f;
+
GLenum zone_gllight = GL_LIGHT0;
typedef std::map<float, core::EntityGlobe *> Globes;
@@ -69,7 +73,7 @@ void pass_reset_lights()
}
// Lights
-int create_light(float* location, float attenuation, math::Color color)
+int add_light(float* location, float attenuation, math::Color color)
{
int gllight;
@@ -93,9 +97,9 @@ int create_light(float* location, float attenuation, math::Color color)
for (size_t i = 0; i < 3; i++) {
gllight_location[i] = location[i];
- ambient_light[i] = color[i] * 0.1;
- diffuse_light[i] = color[i] * 0.75;
- specular_light[i] = color[i] * 0.75;
+ ambient_light[i] = color[i] * ambient_light_intensity;
+ diffuse_light[i] = color[i] * diffuse_light_intensity;
+ specular_light[i] = color[i] * specular_light_intensity;
}
gllight_location[3] = 1.0f;
ambient_light[3] = 1.0f;
@@ -169,7 +173,7 @@ void pass_prepare(float seconds)
zone_light[i] = globe->location()[i];
zone_color[i] = globe->color()[i];
}
- GLenum zone_gllight = create_light(zone_light, 0.00025f, globe->color());
+ GLenum zone_gllight = add_light(zone_light, 0.00025f, globe->color());
gl::enable(zone_gllight);
has_zone_light = true;
}
diff --git a/src/render/draw.h b/src/render/draw.h
index e35c7c5..59a5b4a 100644
--- a/src/render/draw.h
+++ b/src/render/draw.h
@@ -27,7 +27,7 @@ void draw_target(const core::Entity *entity);
void reset();
/// create light
-int create_light(float* location, float attenuation, math::Color color);
+int add_light(float* location, float attenuation, math::Color color);
/// draw a sphere
void draw_sphere(math::Color const & color, float radius);