From 3dedab035c98772fd9607480bddc8ffd9d7dc799 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 2 May 2008 13:05:03 +0000 Subject: additional light properties --- src/render/draw.cc | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'src/render') diff --git a/src/render/draw.cc b/src/render/draw.cc index 741eb3d..3fe64a5 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -287,9 +287,6 @@ void draw_pass_default() if (!entity->model()) { gl::push(); gl::translate(entity->location()); - - // FIXME - //gl::rotate(entity->direction(), 0.0f, 0.0f, 1.0f ); gl::multmatrix(entity->axis()); if ((entity->flags() & core::Entity::Bright) == core::Entity::Bright) @@ -392,12 +389,10 @@ void draw_pass_model_lights() gl::begin(gl::Quads); - - for (std::map::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { core::Entity *entity = (*it).second; - if ( test_drawfx_distance(entity) && (entity->model()->model_light.size())) { + if (test_drawfx_distance(entity) && (entity->model()->model_light.size())) { for (std::list::iterator lit = entity->model()->model_light.begin(); lit != entity->model()->model_light.end(); lit++) { // strobe frequency @@ -405,27 +400,26 @@ void draw_pass_model_lights() if ((*lit)->strobe()) t = (core::application()->time() + entity->fuzz() + (*lit)->offset()) * (*lit)->frequency(); - if (!(*lit)->strobe() || (( t - floorf(t)) < 0.5f)) { + if (!(*lit)->strobe() || (( t - floorf(t)) <= (*lit)->time())) { math::Vector3f location = entity->location() + (entity->axis() * (*lit)->location()); - float n = dotproduct(camera_axis.forward(), (camera_eye-location)); float light_size = 0.0625 * (*lit)->radius(); - if (n < 0) { - math::Color color((*lit)->color()); - color.a = fabs(-atanf(n) * 2 / M_PI); - gl::color(color); + + math::Color color((*lit)->color()); + color.a = 0.8; + gl::color(color); + + glTexCoord2f(0,1); + gl::vertex(location + (camera_axis.up() - camera_axis.left()) * light_size); + glTexCoord2f(0,0); + gl::vertex(location + (camera_axis.up() + camera_axis.left()) * light_size); + glTexCoord2f(-1,0); + gl::vertex(location + (camera_axis.up() * -1 + camera_axis.left()) * light_size); + glTexCoord2f(-1,1); + gl::vertex(location + (camera_axis.up() * -1 - camera_axis.left()) * light_size); + + Stats::quads++; - glTexCoord2f(0,1); - gl::vertex(location + (camera_axis.up() - camera_axis.left()) * light_size); - glTexCoord2f(0,0); - gl::vertex(location + (camera_axis.up() + camera_axis.left()) * light_size); - glTexCoord2f(-1,0); - gl::vertex(location + (camera_axis.up() * -1 + camera_axis.left()) * light_size); - glTexCoord2f(-1,1); - gl::vertex(location + (camera_axis.up() * -1 - camera_axis.left()) * light_size); - - Stats::quads++; - } } } } -- cgit v1.2.3