diff options
author | Stijn Buys <ingar@osirion.org> | 2012-12-08 23:12:45 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-12-08 23:12:45 +0000 |
commit | a1049d85d66264c790fa212f1c577a71890a03c9 (patch) | |
tree | 2f93045ffe7ab4038ad0f392656340fde6f30bd0 /src/render/draw.cc | |
parent | cd4018f65d4933b48688b6fcd11caff75afae263 (diff) |
Added support for entity secondary color on lights, flares and particles.
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r-- | src/render/draw.cc | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 59f4a59..46d0906 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -782,7 +782,7 @@ void draw_pass_model_fragments() void draw_model_lights(model::Model *model, const float scale, const math::Vector3f & entity_location, const math::Axis & entity_axis, - const math::Color & entity_color, const float thrust, const float fuzz) + const math::Color & entity_color, const math::Color & entity_color_second, const float thrust, const float fuzz) { float t = 0.0f; float a = 0.0f; @@ -823,13 +823,31 @@ void draw_model_lights(model::Model *model, const float scale, // entity color overrides light color // light color overrides engine color if (light->entity()) { - color.assign(entity_color); + if (light->entity_second()) { + // entity tertiary color + for (size_t i = 0; i < 3; i++) { + color[i] = (entity_color[i] + entity_color_second[i]) / 2; + } + } else { + // entity primary color + color.assign(entity_color); + } + + } else if (light->entity_second()) { + // entity secondary color + color.assign(entity_color_second); + } else if (light->has_color()) { + // light color color.assign(light->color()); + } else if (light->engine()) { + // FIXME engine_color or thrust_activated color.assign(model->enginecolor()); + } else { color.assign(light->color()); + } // default alpha is 0.8, engine flag alters alpha @@ -890,16 +908,34 @@ void draw_model_lights(model::Model *model, const float scale, continue; // next flare } - // entity color overrides light color - // light color overrides engine color + // entity color overrides flare color + // flare color overrides engine color if (flare->entity()) { - color.assign(entity_color); + if (flare->entity_second()) { + // entity tertiary color + for (size_t i = 0; i < 3; i++) { + color[i] = (entity_color[i] + entity_color_second[i]) / 2; + } + } else { + // entity primary color + color.assign(entity_color); + } + + } else if (flare->entity_second()) { + // entity secondary color + color.assign(entity_color_second); + } else if (flare->has_color()) { + // flare color color.assign(flare->color()); + } else if (flare->engine()) { + // FIXME engine_color or thrust_activated color.assign(model->enginecolor()); + } else { color.assign(flare->color()); + } // default alpha is 0.8, engine flag alters alpha @@ -979,7 +1015,8 @@ void draw_pass_model_fx(float elapsed) const float modelscale = entity->radius() / entity->model()->radius(); draw_model_lights(entity->model(), modelscale, - entity->location(), entity->axis(), entity->color(), + entity->location(), entity->axis(), + entity->color(), entity->color_second(), ext_render(entity)->thrust(), ext_render(entity)->fuzz() ); } |