From a3b3dbf3ced35ae4c0aca148d89509a12f785062 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 18 Nov 2010 19:21:57 +0000 Subject: Corrected default light and flare radius. Suppoort for entity, engine and color keys in fx_particles and particle scripts. Have light, fx_flare and fx_particles color override engine color if the engine spawnflag is set. --- src/render/draw.cc | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'src/render/draw.cc') diff --git a/src/render/draw.cc b/src/render/draw.cc index 9ebe2cc..4cf5571 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -939,21 +939,27 @@ void draw_pass_model_fx(float elapsed) continue; // next light } } - - // default alpha is 0.8 - a = 0.8f; + + // entity color overrides light color + // light color overrides engine color if (light->entity()) { color.assign(entity->color()); + } else if (light->has_color()) { + color.assign(light->color()); } else if (light->engine()) { color.assign(entity->model()->enginecolor()); - a *= thrust; } else { color.assign(light->color()); } + + // default alpha is 0.8, engine flag alters alpha + a = 0.8f; + if (light->engine()) { + a *= thrust; + } color.a = a; - location.assign(entity->location() + (entity->axis() * light->location()) * modelscale); - + location.assign(entity->location() + (entity->axis() * light->location()) * modelscale); light_size = light->radius() * modelscale; // track OpenGL state changes @@ -1010,24 +1016,31 @@ void draw_pass_model_fx(float elapsed) // calulcate viewing angle factor flare_axis.assign(entity->axis() * flare->axis()); a = math::absf(dotproduct(flare_axis.forward(), Camera::axis().forward())); - if (a < 0.01f) { + if (a < 0.001f) { continue; // next flare } - // alpha decreases with viewing angle - a *= 0.8f; + // entity color overrides light color + // light color overrides engine color if (flare->entity()) { color.assign(entity->color()); + } else if (flare->has_color()) { + color.assign(flare->color()); } else if (flare->engine()) { color.assign(entity->model()->enginecolor()); - a *= thrust; } else { color.assign(flare->color()); } + + // default alpha is 0.8, engine flag alters alpha + // alpha decreases with viewing angle + a *= 0.8f; + if (flare->engine()) { + a *= thrust; + } color.a = a; location.assign(entity->location() + (entity->axis() * flare->location()) * modelscale ); - light_size = flare->radius() * modelscale; // track OpenGL state changes -- cgit v1.2.3