1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-31 19:36:16 +00:00

faster bt grid rendering, and also works correctly in embedded_plane

This commit is contained in:
Zeno Rogue 2022-12-16 01:05:18 +01:00
parent a525de9759
commit 4f0d16f9ed

View File

@ -907,6 +907,7 @@ void celldrawer::draw_grid() {
#if CAP_BT
else if(bt::in() && WDIM == 2) {
for(int t=0; t<c->type; t++) {
if(!c->move(t)|| c->move(t) < c) continue;
auto h0 = bt::get_corner_horo_coordinates(c, t);
auto h1 = bt::get_corner_horo_coordinates(c, t+1);
int steps = 12 * abs(h0[1] - h1[1]);
@ -917,8 +918,13 @@ void celldrawer::draw_grid() {
if(vid.linequality > 0) steps <<= vid.linequality;
if(vid.linequality < 0) steps >>= -vid.linequality;
auto step = (h1 - h0) / steps;
for(int i=0; i<=steps; i++) curvepoint(bt::get_horopoint(h0 + i * step));
queuecurve(V, gridcolor(c, c->move(t)), 0, PPR::LINE);
if(GDIM == 3) {
for(int i=0; i<=steps; i++) gridline(V, bt::get_horopoint(h0 + i * step), V, bt::get_horopoint(h0 + (i+1) * step), gridcolor(c, c->move(t)), prec-2);
}
else {
for(int i=0; i<=steps; i++) curvepoint(bt::get_horopoint(h0 + i * step));
queuecurve(V, gridcolor(c, c->move(t)), 0, PPR::LINE);
}
}
}
}