1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-27 02:20:36 +00:00

fixed in_smart_range for perspective

This commit is contained in:
Zeno Rogue 2022-12-29 21:49:43 +01:00
parent 7068b41d28
commit 7d0235b459

View File

@ -1625,13 +1625,14 @@ EX bool in_smart_range(const shiftmatrix& T) {
ld y = current_display->ycenter + current_display->radius * h1[1] * pconf.stretch; ld y = current_display->ycenter + current_display->radius * h1[1] * pconf.stretch;
bool culling = !geom3::euc_in_hyp(); bool culling = !geom3::euc_in_hyp();
bool inp = in_perspective();
if(culling) { if(culling) {
if(x > current_display->xtop + current_display->xsize * 2) return false; if(x > current_display->xtop + current_display->xsize * 2) return false;
if(x < current_display->xtop - current_display->xsize * 1) return false; if(x < current_display->xtop - current_display->xsize * 1) return false;
if(y > current_display->ytop + current_display->ysize * 2) return false; if(y > current_display->ytop + current_display->ysize * 2) return false;
if(y < current_display->ytop - current_display->ysize * 1) return false; if(y < current_display->ytop - current_display->ysize * 1) return false;
if(GDIM == 3) { if(GDIM == 3 && !inp) {
if(-h1[2] < pconf.clip_min * 2 - pconf.clip_max) return false; if(-h1[2] < pconf.clip_min * 2 - pconf.clip_max) return false;
if(-h1[2] > pconf.clip_max * 2 - pconf.clip_min) return false; if(-h1[2] > pconf.clip_max * 2 - pconf.clip_min) return false;
} }
@ -1662,8 +1663,8 @@ EX bool in_smart_range(const shiftmatrix& T) {
} }
else if(GDIM == 3) { else if(GDIM == 3) {
if(-h1[2] + 2 * dz < pconf.clip_min || -h1[2] - 2 * dz > pconf.clip_max) return false; if(!inp && (-h1[2] + 2 * dz < pconf.clip_min || -h1[2] - 2 * dz > pconf.clip_max)) return false;
sort(dh, dh+GDIM); sort(dh, dh+3);
ld scale = sqrt(dh[1] * dh[2]) * cgi.scalefactor * hcrossf7; ld scale = sqrt(dh[1] * dh[2]) * cgi.scalefactor * hcrossf7;
if(scale <= (WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3)) return false; if(scale <= (WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3)) return false;
} }
@ -2952,7 +2953,7 @@ EX namespace dq {
EX bool do_draw(cell *c) { EX bool do_draw(cell *c) {
// do not display out of range cells, unless on torus // do not display out of range cells, unless on torus
if(c->pathdist == PINFD && !(euclid && quotient) && vid.use_smart_range == 0) if(c->pathdist == PINFD && !(meuclid && quotient) && vid.use_smart_range == 0)
return false; return false;
// do not display not fully generated cells, unless changing range allowed // do not display not fully generated cells, unless changing range allowed
if(c->mpdist > 7 && !allowChangeRange()) return false; if(c->mpdist > 7 && !allowChangeRange()) return false;