From d09a1be33a647aedc12ce5ddcb7ea4ee23a75c8c Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 30 Jul 2008 16:00:49 +0000 Subject: various minor issues: ESC closing chat, g_autolevel --- src/render/draw.cc | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'src/render/draw.cc') diff --git a/src/render/draw.cc b/src/render/draw.cc index ee42bb6..4399c60 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -285,6 +285,11 @@ void draw_model_fragments(core::Entity *entity) bool use_color_array = true; // glEnableClientState(GL_COLOR_ARRAY) is set bool use_light = true; // gl::disable(GL_LIGHTING) is set + float thrust = 0; + if (entity->type() == core::Entity::Controlable) { + thrust = static_cast(entity)->thrust(); + } + for (Model::Fragments::iterator fit = model->fragments().begin(); fit != model->fragments().end(); fit++) { Fragment *fragment = (*fit); @@ -292,7 +297,16 @@ void draw_model_fragments(core::Entity *entity) if (fragment->material() != material) { material = fragment->material(); - if (material & Material::Tertiary) { + if (material & Material::Engine) { + + if (use_color_array) { + glDisableClientState(GL_COLOR_ARRAY); + use_color_array = false; + } + + gl::color(thrust, 0.0f, 0.0f); + + } else if (material & Material::Tertiary) { if (use_color_array) { use_color_array = false; glDisableClientState(GL_COLOR_ARRAY); @@ -328,6 +342,11 @@ void draw_model_fragments(core::Entity *entity) gl::disable(GL_LIGHTING); use_light = false; } + } else if (material & Material::Engine) { + if (use_light) { + gl::disable(GL_LIGHTING); + use_light = false; + } } else { if (!use_light) { gl::enable(GL_LIGHTING); @@ -616,7 +635,10 @@ void draw_pass_model_fx(float elapsed) float trail_size = 0.0f; math::Vector3f quad[4]; + math::Vector3f location; + math::Vector3f offset; math::Color color; + size_t circle_texture = Textures::load("bitmaps/fx/circle00"); size_t flare_texture = Textures::bind("bitmaps/fx/flare00"); @@ -638,8 +660,8 @@ void draw_pass_model_fx(float elapsed) if (light->strobe()) t = (core::application()->time() + entity->state()->fuzz() - light->offset()) * light->frequency(); - if (!light->strobe() || (( t - floorf(t)) <= light->time())) { - math::Vector3f location = entity->state()->location() + (entity->state()->axis() * light->location()); + if ((!light->strobe()) || (( t - floorf(t)) <= light->time())) { + location.assign(entity->state()->location() + (entity->state()->axis() * light->location())); light_size = 0.0625 * light->radius(); if (flare_texture != light->texture()) { @@ -681,12 +703,12 @@ void draw_pass_model_fx(float elapsed) if (flare->strobe()) t = (core::application()->time() + entity->state()->fuzz() - flare->offset()) * flare->frequency(); - if (!flare->strobe() || (( t - floorf(t)) <= flare->time())) { + if ((!flare->strobe()) || (( t - floorf(t)) <= flare->time())) { math::Axis flare_axis(entity->state()->axis()); if (flare->angle()) flare_axis.change_direction(flare->angle()); - math::Vector3f location = entity->state()->location() + (entity->state()->axis() * flare->location()); + location.assign(entity->state()->location() + (entity->state()->axis() * flare->location())); light_size = 0.0625 * flare->radius(); if (flare_texture != flare->texture()) { @@ -740,9 +762,9 @@ void draw_pass_model_fx(float elapsed) model::Engine *engine = (*eit); - math::Vector3f location = entity->state()->location() + (entity->state()->axis() * engine->location()); + location.assign(entity->state()->location() + (entity->state()->axis() * engine->location())); engine_size = 0.0625 * engine->radius(); - math::Color color(engine->color()); + color.assign(engine->color()); color.a = 0.9f * u; if (flare_texture != engine->texture() ) { @@ -774,7 +796,7 @@ void draw_pass_model_fx(float elapsed) gl::begin(gl::Quads); } color.assign(1.0f, 1.0f); - math::Vector3f offset = entity->state()->axis().forward() * engine_size; + offset.assign(entity->state()->axis().forward() * engine_size); if (t) location -= offset * t; -- cgit v1.2.3