diff options
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r-- | src/render/draw.cc | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 7bbb89c..1b1262f 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -112,32 +112,21 @@ void pass_prepare(float seconds) } } - entity->state()->state_visible = false; - entity->state()->state_detailvisible = false; - entity->state()->state_targetable = false; - - entity->state()->state_distance = math::distance(Camera::eye(), entity->state()->location()); + entity->state()->state_visible = entity->visible(); - // calculate visibility for entities with models - if (entity->model()) { - - float r = entity->model()->radius(); - math::clamp(r, 1.0f, farplane / drawfxdistance); - if (entity->state()->distance() < drawfxdistance * r) { - // entites within detail range - entity->state()->state_visible = true; - entity->state()->state_detailvisible = true; - } else if (entity->state()->distance() < drawdistance * r && entity->state()->distance() < core::range::max) { - // entities within drawing distance, outside detail range - entity->state()->state_visible = true; - entity->state()->state_detailvisible = false; + if ((entity->type() == core::Entity::Controlable)) { + if (static_cast<core::EntityDynamic *>(entity)->eventstate() == core::Entity::Docked) { + entity->state()->state_visible = false; } + } - } else { - entity->state()->state_visible = true; + entity->state()->state_detailvisible = false; + entity->state()->state_targetable = false; + entity->state()->state_distance = math::distance(Camera::eye(), entity->state()->location()); - if (entity->type() == core::Entity::Globe) { - + if (entity->state()->visible()) { + // globes + if (entity->type() == core::Entity::Globe) { core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity); // add the globe to the globes list @@ -174,8 +163,26 @@ void pass_prepare(float seconds) gl::enable(GL_LIGHT1); has_zone_light = true; } - } - } + + } else if (entity->model()) { + + float r = entity->model()->radius(); + math::clamp(r, 1.0f, farplane / drawfxdistance); + if (entity->state()->distance() < drawfxdistance * r) { + // entites within detail range + entity->state()->state_visible = true; + entity->state()->state_detailvisible = true; + } else if (entity->state()->distance() < drawdistance * r && entity->state()->distance() < core::range::max) { + // entities within drawing distance, outside detail range + entity->state()->state_visible = true; + entity->state()->state_detailvisible = false; + } else { + // out of range + entity->state()->state_visible = false; + entity->state()->state_detailvisible = false; + } + } + } } } @@ -1076,7 +1083,10 @@ void draw(float seconds) gl::depthmask(GL_FALSE); // disable depth buffer writing draw_pass_spacegrid(); // draw the blue spacegrid - Dust::draw(zone_color); // draw spacedust + + if (!core::localplayer()->view()) { + Dust::draw(zone_color); // draw spacedust + } draw_pass_model_fx(seconds); // draw entity lights and engines |