diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-30 16:00:49 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-30 16:00:49 +0000 |
commit | d09a1be33a647aedc12ce5ddcb7ea4ee23a75c8c (patch) | |
tree | 8fe9d8778223e22e8c957b59c51bccabb98d2b94 /src/render | |
parent | ad436de3a520fb2469dafe23afe03dd0afe8d189 (diff) |
various minor issues: ESC closing chat, g_autolevel
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/camera.cc | 33 | ||||
-rw-r--r-- | src/render/camera.h | 5 | ||||
-rw-r--r-- | src/render/draw.cc | 38 |
3 files changed, 66 insertions, 10 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc index 74eb674..283f40f 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -126,7 +126,7 @@ void Camera::set_mode(Mode newmode) { } -void Camera::next_mode() +void Camera::view_next() { if (!core::localcontrol()) { @@ -158,6 +158,37 @@ void Camera::next_mode() } } +void Camera::view_previous() +{ + + if (!core::localcontrol()) { + set_mode(Overview); + return; + } + + switch(camera_mode) { + case Cockpit: + // switch camera to Track mode + set_mode(Track); + core::application()->notify_message(std::string("view: track")); + break; + + case Free: + // switch camera to Cockpit mode + set_mode(Cockpit); + core::application()->notify_message(std::string("view: cockpit")); + break; + + case Track: + // switch camera to Free mode + set_mode(Free); + core::application()->notify_message(std::string("view: free")); + break; + + default: + break; + } +} void Camera::frame(float seconds) { math::Axis target_axis; diff --git a/src/render/camera.h b/src/render/camera.h index 253661f..db2db42 100644 --- a/src/render/camera.h +++ b/src/render/camera.h @@ -56,7 +56,10 @@ public: static void set_pitch(float pitch); /// switch to next camera mode - static void next_mode(); + static void view_next(); + + /// wtich to previous camera mode + static void view_previous(); /// set specified camera mode static void set_mode(Mode newmode); 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<core::EntityControlable *>(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; |