From a22542f273de28d06ecaf2bd6fd741821e98512b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 1 May 2008 16:59:54 +0000 Subject: lights offset and frequency --- src/render/draw.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/draw.cc b/src/render/draw.cc index d125420..741eb3d 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -392,7 +392,7 @@ void draw_pass_model_lights() gl::begin(gl::Quads); - const float light_size = 0.0625; + for (std::map::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { core::Entity *entity = (*it).second; @@ -400,9 +400,15 @@ void draw_pass_model_lights() 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++) { - if (!(*lit)->strobe() || (( core::application()->time() - floorf(core::application()->time()) ) < 0.5f)) { + // strobe frequency + float t = 1.0f; + if ((*lit)->strobe()) + t = (core::application()->time() + entity->fuzz() + (*lit)->offset()) * (*lit)->frequency(); + + if (!(*lit)->strobe() || (( t - floorf(t)) < 0.5f)) { 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()); -- cgit v1.2.3