mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-05 11:12:49 +00:00
replaced product drawing with the general routine
This commit is contained in:
parent
ac9d18adfb
commit
63c4886722
@ -1546,7 +1546,18 @@ void celldrawer::draw_features_and_walls_3d() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(prod) {
|
else if(prod) {
|
||||||
if(!((product::cwall_mask >> a) & 1)) continue;
|
if(a < c->type-2) {
|
||||||
|
ld d = in_e2xe() ? sqhypot_d(2, tC0(V)) : V[2][2];
|
||||||
|
hyperpoint h = (V * cgi.walltester[ofs + a]);
|
||||||
|
ld d1 = in_e2xe() ? sqhypot_d(2, h) : h[2];
|
||||||
|
if(d1 >= d - 1e-6) continue;
|
||||||
|
}
|
||||||
|
else if(a == c->type-1) {
|
||||||
|
if(zlevel(tC0(V)) >= -cgi.plevel/2) continue;
|
||||||
|
}
|
||||||
|
else if(a == c->type-2) {
|
||||||
|
if(zlevel(tC0(V)) <= +cgi.plevel/2) continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(qfi.fshape && wmescher) {
|
if(qfi.fshape && wmescher) {
|
||||||
auto& poly = queuepoly(V, cgi.shWall3D[ofs + a], darkena(wcol2 - d * get_darkval(c, a), 0, 0xFF));
|
auto& poly = queuepoly(V, cgi.shWall3D[ofs + a], darkena(wcol2 - d * get_darkval(c, a), 0, 0xFF));
|
||||||
|
14
hypgraph.cpp
14
hypgraph.cpp
@ -1895,11 +1895,25 @@ EX namespace dq {
|
|||||||
EX set<int> visited_by_matrix;
|
EX set<int> visited_by_matrix;
|
||||||
EX void enqueue_by_matrix(heptagon *h, const transmatrix& T) {
|
EX void enqueue_by_matrix(heptagon *h, const transmatrix& T) {
|
||||||
if(!h) return;
|
if(!h) return;
|
||||||
|
if(sl2 && T[3][3] < 0) { enqueue_by_matrix(h, centralsym * T); return; }
|
||||||
int b = bucketer(tC0(T));
|
int b = bucketer(tC0(T));
|
||||||
if(visited_by_matrix.count(b)) { return; }
|
if(visited_by_matrix.count(b)) { return; }
|
||||||
visited_by_matrix.insert(b);
|
visited_by_matrix.insert(b);
|
||||||
drawqueue.emplace(h, T, band_shift);
|
drawqueue.emplace(h, T, band_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX queue<tuple<cell*, transmatrix, ld>> drawqueue_c;
|
||||||
|
|
||||||
|
EX void enqueue_by_matrix_c(cell *c, const transmatrix& T) {
|
||||||
|
if(!c) return;
|
||||||
|
if(sl2 && T[3][3] < 0) { enqueue_by_matrix_c(c, centralsym * T); return; }
|
||||||
|
int b = bucketer(tC0(T));
|
||||||
|
if(visited_by_matrix.count(b)) { return; }
|
||||||
|
visited_by_matrix.insert(b);
|
||||||
|
drawqueue_c.emplace(c, T, band_shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EX }
|
EX }
|
||||||
|
|
||||||
EX bool do_draw(cell *c) {
|
EX bool do_draw(cell *c) {
|
||||||
|
@ -1089,36 +1089,25 @@ EX namespace hybrid {
|
|||||||
virtual transmatrix spin_from(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_from(c, d, bonus); }); }
|
virtual transmatrix spin_from(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_from(c, d, bonus); }); }
|
||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
set<cell*> visited;
|
|
||||||
|
|
||||||
cell* start = centerover;
|
cell* start = centerover;
|
||||||
vector<pair<cell*, transmatrix>> dq;
|
|
||||||
|
|
||||||
visited.insert(start);
|
dq::visited_by_matrix.clear();
|
||||||
dq.emplace_back(start, cview());
|
dq::enqueue_by_matrix_c(start, cview());
|
||||||
product::cwall_mask = -1;
|
|
||||||
|
|
||||||
for(int i=0; i<isize(dq); i++) {
|
while(!dq::drawqueue_c.empty()) {
|
||||||
cell *c = dq[i].first;
|
auto& p = dq::drawqueue_c.front();
|
||||||
transmatrix V = dq[i].second;
|
cell *c = get<0>(p);
|
||||||
|
transmatrix V = get<1>(p);
|
||||||
|
dq::drawqueue_c.pop();
|
||||||
|
|
||||||
if(sl2) {
|
|
||||||
if(V[3][3] < 0) V = centralsym * V;
|
|
||||||
if(!do_draw(c, V)) continue;
|
if(!do_draw(c, V)) continue;
|
||||||
drawcell(c, V);
|
drawcell(c, V);
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!in_s2xe() && !do_draw(c, V)) continue;
|
|
||||||
if(prod) product::cwall_offset = hybrid::wall_offset(c);
|
|
||||||
drawcell(c, V);
|
|
||||||
}
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
||||||
|
|
||||||
for(int i=0; i<c->type; i++) {
|
for(int i=0; i<c->type; i++) {
|
||||||
cell *c1 = c->cmove(i);
|
cell *c1 = c->cmove(i);
|
||||||
if(visited.count(c1)) continue;
|
dq::enqueue_by_matrix_c(c1, V * adj(c, i));
|
||||||
visited.insert(c1);
|
|
||||||
dq.emplace_back(c1, V * adj(c, i));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user