diff options
author | Stijn Buys <ingar@osirion.org> | 2008-07-30 19:50:51 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-07-30 19:50:51 +0000 |
commit | cf0f21b73e53b4371c42c95e1132b1d3ce69ade5 (patch) | |
tree | f5efa4f20c581ab6a2672666d4b2df4ee9ce2b44 /src/render/draw.cc | |
parent | 04050c1685855a0640c7c0d5147299fadbd2ebe8 (diff) |
minimize opengl transformation matrix by doing eye-location in software
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r-- | src/render/draw.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 4399c60..13f9ee6 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -527,7 +527,7 @@ void draw_pass_default() // draw entities without model if (!entity->model()) { gl::push(); - gl::translate(entity->state()->location()); + gl::translate(entity->state()->location() - Camera::eye()); gl::multmatrix(entity->state()->axis()); if (flag_is_set(entity->flags(), core::Entity::Bright)) { @@ -568,7 +568,7 @@ void draw_pass_default() gl::color(entity->color()); gl::push(); - gl::translate(entity->state()->location()); + gl::translate(entity->state()->location() - Camera::eye()); gl::multmatrix(entity->state()->axis()); // top @@ -612,7 +612,7 @@ void draw_pass_model_fragments() if (entity->model() && entity->state()->visible()) { gl::push(); - gl::translate(entity->state()->location()); + gl::translate(entity->state()->location() - Camera::eye()); gl::multmatrix(entity->state()->axis()); draw_model_fragments(entity); @@ -661,7 +661,7 @@ void draw_pass_model_fx(float elapsed) t = (core::application()->time() + entity->state()->fuzz() - light->offset()) * light->frequency(); if ((!light->strobe()) || (( t - floorf(t)) <= light->time())) { - location.assign(entity->state()->location() + (entity->state()->axis() * light->location())); + location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * light->location())); light_size = 0.0625 * light->radius(); if (flare_texture != light->texture()) { @@ -708,7 +708,7 @@ void draw_pass_model_fx(float elapsed) if (flare->angle()) flare_axis.change_direction(flare->angle()); - location.assign(entity->state()->location() + (entity->state()->axis() * flare->location())); + location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * flare->location())); light_size = 0.0625 * flare->radius(); if (flare_texture != flare->texture()) { @@ -762,7 +762,7 @@ void draw_pass_model_fx(float elapsed) model::Engine *engine = (*eit); - location.assign(entity->state()->location() + (entity->state()->axis() * engine->location())); + location.assign(entity->state()->location() - Camera::eye() + (entity->state()->axis() * engine->location())); engine_size = 0.0625 * engine->radius(); color.assign(engine->color()); color.a = 0.9f * u; @@ -849,7 +849,7 @@ void draw_pass_model_corona() if (entity->model() && entity->state()->visible()) { gl::push(); - gl::translate(entity->state()->location()); + gl::translate(entity->state()->location() - Camera::eye()); math::Color color = entity->color(); color.a = 0.25f; draw_sphere(color, entity->model()->radius()); @@ -883,7 +883,7 @@ void draw_pass_sky() gl::enable(GL_TEXTURE_2D); gl::push(); - gl::translate(Camera::eye()); + //gl::translate(Camera::eye()); draw_sphere_inside(math::Color(), 128); gl::pop(); @@ -903,7 +903,7 @@ void draw_pass_spacegrid() float dy = Camera::target().y - floorf(Camera::target().y); gl::push(); - gl::translate(Camera::target()); + gl::translate(Camera::target() - Camera::eye()); gl::color(0,0, 1.0f); gl::normal(0, 0, 1.0f); |