diff options
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() ); } |