From e62a3c0d8e68ba7d04b623345faa88a49330e067 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 6 Aug 2019 21:01:00 +0200 Subject: [PATCH] nilv:: geodesic sightrange --- config.cpp | 6 +++--- hypgraph.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config.cpp b/config.cpp index 6e50811c..4f4fa5fb 100644 --- a/config.cpp +++ b/config.cpp @@ -708,7 +708,7 @@ void edit_sightrange() { } else if(WDIM == 3) { dialog::editNumber(sightranges[geometry], 0, 2 * M_PI, 0.5, M_PI, XLAT("3D sight range"), - pmodel == mdGeodesic ? solhelp() : XLAT( + (pmodel == mdGeodesic && sol) ? solhelp() : XLAT( "Sight range for 3D geometries is specified in the absolute units. This value also affects the fog effect.\n\n" "In spherical geometries, the sight range of 2? will let you see things behind you as if they were in front of you, " "and the sight range of ? (or more) will let you see things on the antipodal point just as if they were close to you.\n\n" @@ -728,7 +728,7 @@ void edit_sightrange() { dialog::bound_up(allowIncreasedSight() ? euclid ? 99 : gp::dist_2() * 5 : 0); } dialog::extra_options = [] () { - if(pmodel == mdGeodesic) { + if(pmodel == mdGeodesic && sol) { dialog::addSelItem(XLAT("fog effect"), fts(sightranges[geometry]), 'R'); dialog::add_action([] { auto xo = dialog::extra_options; @@ -798,7 +798,7 @@ void edit_sightrange() { void menuitem_sightrange(char c) { if(vid.use_smart_range) dialog::addSelItem(XLAT("minimum visible cell in pixels"), fts(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail), c); - else if(pmodel == mdGeodesic) + else if(pmodel == mdGeodesic && sol) dialog::addSelItem(XLAT("3D sight range"), fts(solv::solrange_xy) + "x" + fts(solv::solrange_z), c); else if(WDIM == 3) dialog::addSelItem(XLAT("3D sight range"), fts(sightranges[geometry]), c); diff --git a/hypgraph.cpp b/hypgraph.cpp index 145cd5ec..03555edc 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -910,7 +910,7 @@ bool invalid_point(const hyperpoint h) { bool in_smart_range(const transmatrix& T) { hyperpoint h = tC0(T); if(invalid_point(h)) return false; - if(nil) return cells_drawn < 2000; + if(nil) return true; if(pmodel == mdGeodesic) return solv::in_table_range(h); hyperpoint h1; applymodel(h, h1); @@ -1880,11 +1880,12 @@ bool do_draw(cell *c, const transmatrix& T) { PROD( if(product::pmap) return product::in_actual([&] { return do_draw(product::get_at(c, product::plevel), T); }); ) if(WDIM == 3) { if(cells_drawn > vid.cells_drawn_limit) return false; - if(pmodel == mdGeodesic) { - if(!nisot::in_table_range(tC0(T))) return false; - if(!limited_generation(c)) return false; + if(nil && pmodel == mdGeodesic) { + ld dist = hdist0(nisot::inverse_exp(tC0(T), nisot::iLazy)); + if(dist > sightranges[geometry] + (vid.sloppy_3d ? 0 : 0.9)) return false; + if(dist <= extra_generation_distance && !limited_generation(c)) return false; } - else if(nil) { + else if(pmodel == mdGeodesic && !nil) { if(!nisot::in_table_range(tC0(T))) return false; if(!limited_generation(c)) return false; }