mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-24 07:56:59 +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) {
|
||||
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) {
|
||||
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 void enqueue_by_matrix(heptagon *h, const transmatrix& T) {
|
||||
if(!h) return;
|
||||
if(sl2 && T[3][3] < 0) { enqueue_by_matrix(h, centralsym * T); return; }
|
||||
int b = bucketer(tC0(T));
|
||||
if(visited_by_matrix.count(b)) { return; }
|
||||
visited_by_matrix.insert(b);
|
||||
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 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); }); }
|
||||
|
||||
void draw() override {
|
||||
set<cell*> visited;
|
||||
|
||||
cell* start = centerover;
|
||||
vector<pair<cell*, transmatrix>> dq;
|
||||
|
||||
visited.insert(start);
|
||||
dq.emplace_back(start, cview());
|
||||
product::cwall_mask = -1;
|
||||
dq::visited_by_matrix.clear();
|
||||
dq::enqueue_by_matrix_c(start, cview());
|
||||
|
||||
for(int i=0; i<isize(dq); i++) {
|
||||
cell *c = dq[i].first;
|
||||
transmatrix V = dq[i].second;
|
||||
while(!dq::drawqueue_c.empty()) {
|
||||
auto& p = dq::drawqueue_c.front();
|
||||
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;
|
||||
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;
|
||||
|
||||
for(int i=0; i<c->type; i++) {
|
||||
cell *c1 = c->cmove(i);
|
||||
if(visited.count(c1)) continue;
|
||||
visited.insert(c1);
|
||||
dq.emplace_back(c1, V * adj(c, i));
|
||||
dq::enqueue_by_matrix_c(c1, V * adj(c, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user