From a320e55dc1a17cef3923643277f1112f74251d70 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 13 Aug 2009 12:49:49 +0000 Subject: documentation updates, win32 build fix, megatog's enginelight patch --- src/render/draw.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/render/draw.cc') diff --git a/src/render/draw.cc b/src/render/draw.cc index da8c8d3..150356c 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -904,6 +904,17 @@ void draw_pass_model_fx(float elapsed) for (model::Model::Lights::iterator lit = entity->model()->lights().begin(); lit != entity->model()->lights().end(); lit++) { light = (*lit); + // engine flares + thrust = 1.0f; + if (light->engine() && ( entity->type() == core::Entity::Controlable)) { + core::EntityControlable *ec = static_cast(entity); + if ((ec->state() == core::Entity::ImpulseInitiate) || (ec->state() == core::Entity::Impulse)) { + thrust = 1.0f; + } else { + thrust = ec->thrust(); + } + } + // strobe frequency t = 1.0f; if (light->strobe()) @@ -919,12 +930,17 @@ void draw_pass_model_fx(float elapsed) gl::begin(gl::Quads); } + // default alpha is 0.8 + a = 0.8f; if (light->entity()) { color.assign(entity->color()); + } else if (light->engine()) { + color.assign(entity->model()->enginecolor()); + a *= thrust; } else { color.assign(light->color()); } - color.a = 0.8; + color.a = a; gl::color(color); glTexCoord2f(0,1); @@ -995,6 +1011,8 @@ void draw_pass_model_fx(float elapsed) a = math::absf( dotproduct(flare_axis.forward(), Camera::axis().forward())); if (a > 0.1f) { + + // alpha decreases as the viewing angle increases a = a - 0.1f; if (flare->entity()) { color.assign(entity->color()); -- cgit v1.2.3