diff options
author | Stijn Buys <ingar@osirion.org> | 2010-11-18 19:21:57 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-11-18 19:21:57 +0000 |
commit | a3b3dbf3ced35ae4c0aca148d89509a12f785062 (patch) | |
tree | 6fc93069f70eb6059d056a00790be818df2c2f9f /src/render/draw.cc | |
parent | 138dbc83d5720c8baa7270ece183ce356f619fce (diff) |
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.
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r-- | src/render/draw.cc | 35 |
1 files changed, 24 insertions, 11 deletions
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 |