mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-30 07:17:03 +00:00
redone hrmap::draw() function to keep DRY
This commit is contained in:
parent
42446f1925
commit
67595a4ed3
@ -794,27 +794,6 @@ struct hrmap_arbi : hrmap {
|
|||||||
return h1;
|
return h1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
dq::clear_all();
|
|
||||||
dq::enqueue(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
if(do_draw(h->c7, V)) drawcell(h->c7, V);
|
|
||||||
else continue;
|
|
||||||
|
|
||||||
for(int i=0; i<h->type; i++) {
|
|
||||||
shiftmatrix V1 = V * adj(h, i);
|
|
||||||
optimize_shift(V1);
|
|
||||||
dq::enqueue(h->move(i), V1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
|
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override {
|
||||||
return relative_matrix_recursive(h2, h1);
|
return relative_matrix_recursive(h2, h1);
|
||||||
}
|
}
|
||||||
|
@ -676,9 +676,9 @@ struct hrmap_archimedean : hrmap {
|
|||||||
return hnew;
|
return hnew;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw_at(cell *at, const shiftmatrix& where) override {
|
||||||
dq::clear_all();
|
dq::clear_all();
|
||||||
dq::enqueue(centerover->master, cview());
|
dq::enqueue(at->master, where);
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
21
asonov.cpp
21
asonov.cpp
@ -176,27 +176,6 @@ struct hrmap_asonov : hrmap {
|
|||||||
for(int a=0; a<S7; a++) if(h2 == h1->move(a)) return adjmatrix(a);
|
for(int a=0; a<S7; a++) if(h2 == h1->move(a)) return adjmatrix(a);
|
||||||
return coord_to_matrix(coords[h2], coords[h1]);
|
return coord_to_matrix(coords[h2], coords[h1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
dq::clear_all();
|
|
||||||
|
|
||||||
dq::enqueue_by_matrix(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
|
||||||
|
|
||||||
for(int i=0; i<S7; i++)
|
|
||||||
dq::enqueue_by_matrix(h->cmove(i), V * adjmatrix(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EX hrmap *new_map() { return new hrmap_asonov; }
|
EX hrmap *new_map() { return new hrmap_asonov; }
|
||||||
|
@ -417,26 +417,6 @@ EX namespace bt {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
dq::clear_all();
|
|
||||||
dq::enqueue(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
|
|
||||||
for(int i=0; i<h->type; i++)
|
|
||||||
dq::enqueue(h->cmove(i), optimized_shift(V * adj(h, i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int updir_at(heptagon *h) {
|
int updir_at(heptagon *h) {
|
||||||
if(geometry != gBinaryTiling) return updir();
|
if(geometry != gBinaryTiling) return updir();
|
||||||
else if(type_of(h) == 6) return bd_down;
|
else if(type_of(h) == 6) return bd_down;
|
||||||
|
7
cell.cpp
7
cell.cpp
@ -42,9 +42,8 @@ struct hrmap {
|
|||||||
transmatrix iadj(heptagon *h, int d) {
|
transmatrix iadj(heptagon *h, int d) {
|
||||||
heptagon *h1 = h->cmove(d); return adj(h1, h->c.spin(d));
|
heptagon *h1 = h->cmove(d); return adj(h1, h->c.spin(d));
|
||||||
}
|
}
|
||||||
virtual void draw() {
|
virtual void draw_all();
|
||||||
printf("undrawable\n");
|
virtual void draw_at(cell *at, const shiftmatrix& where);
|
||||||
}
|
|
||||||
virtual vector<hyperpoint> get_vertices(cell*);
|
virtual vector<hyperpoint> get_vertices(cell*);
|
||||||
|
|
||||||
virtual void virtualRebase(heptagon*& base, transmatrix& at) {
|
virtual void virtualRebase(heptagon*& base, transmatrix& at) {
|
||||||
@ -67,7 +66,7 @@ struct hrmap {
|
|||||||
* (e.g. Euclidean and Crystal) also inherit from hrmap_standard
|
* (e.g. Euclidean and Crystal) also inherit from hrmap_standard
|
||||||
**/
|
**/
|
||||||
struct hrmap_standard : hrmap {
|
struct hrmap_standard : hrmap {
|
||||||
void draw() override;
|
void draw_at(cell *at, const shiftmatrix& where) override;
|
||||||
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override;
|
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override;
|
||||||
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override;
|
transmatrix relative_matrix(cell *c2, cell *c1, const hyperpoint& hint) override;
|
||||||
heptagon *create_step(heptagon *h, int direction) override;
|
heptagon *create_step(heptagon *h, int direction) override;
|
||||||
|
28
crystal.cpp
28
crystal.cpp
@ -670,31 +670,9 @@ struct hrmap_crystal : hrmap_standard {
|
|||||||
return hrmap_standard::adj(c, d);
|
return hrmap_standard::adj(c, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw_at(cell *at, const shiftmatrix& where) override {
|
||||||
if(!crystal3()) { hrmap_standard::draw(); return; }
|
if(!crystal3()) { hrmap_standard::draw_at(at, where); return; }
|
||||||
sphereflip = Id;
|
else hrmap::draw_at(at, where);
|
||||||
|
|
||||||
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
|
||||||
|
|
||||||
dq::clear_all();
|
|
||||||
dq::enqueue_by_matrix(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
|
||||||
|
|
||||||
for(int d=0; d<S7; d++) {
|
|
||||||
dq::enqueue_by_matrix(h->move(d), optimized_shift(V * adj(h, d)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual transmatrix relative_matrix(cell *h2, cell *h1, const hyperpoint& hint) override {
|
virtual transmatrix relative_matrix(cell *h2, cell *h1, const hyperpoint& hint) override {
|
||||||
|
@ -226,9 +226,9 @@ EX namespace euc {
|
|||||||
else return hrmap_standard::adj(c, i);
|
else return hrmap_standard::adj(c, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw_at(cell *at, const shiftmatrix& where) override {
|
||||||
dq::clear_all();
|
dq::clear_all();
|
||||||
dq::enqueue_by_matrix(centerover->master, cview() * master_relative(centerover, true));
|
dq::enqueue_by_matrix(at->master, where * master_relative(centerover, true));
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
while(!dq::drawqueue.empty()) {
|
||||||
auto& p = dq::drawqueue.front();
|
auto& p = dq::drawqueue.front();
|
||||||
|
6
fake.cpp
6
fake.cpp
@ -182,13 +182,13 @@ EX namespace fake {
|
|||||||
return relative_matrix(h2->c7, h1->c7, hint);
|
return relative_matrix(h2->c7, h1->c7, hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw_at(cell *at, const shiftmatrix& where) override {
|
||||||
sphereflip = Id;
|
sphereflip = Id;
|
||||||
|
|
||||||
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
||||||
|
|
||||||
if(pmodel == mdDisk && WDIM == 2 && recursive_draw) {
|
if(pmodel == mdDisk && WDIM == 2 && recursive_draw) {
|
||||||
draw_recursive(centerover, cview(), -1, -1, nullptr, 0);
|
draw_recursive(at, where, -1, -1, nullptr, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ EX namespace fake {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto enqueue = (multiple && multiple_special_draw ? dq::enqueue_by_matrix_c : dq::enqueue_c);
|
auto enqueue = (multiple && multiple_special_draw ? dq::enqueue_by_matrix_c : dq::enqueue_c);
|
||||||
enqueue(centerover, cview());
|
enqueue(at, where);
|
||||||
|
|
||||||
while(!dq::drawqueue_c.empty()) {
|
while(!dq::drawqueue_c.empty()) {
|
||||||
auto& p = dq::drawqueue_c.front();
|
auto& p = dq::drawqueue_c.front();
|
||||||
|
@ -1225,12 +1225,12 @@ EX namespace gp {
|
|||||||
return T;
|
return T;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw_at(cell *at, const shiftmatrix& where) override {
|
||||||
|
|
||||||
dq::clear_all();
|
dq::clear_all();
|
||||||
|
|
||||||
auto enqueue = (quotient ? dq::enqueue_by_matrix_c : dq::enqueue_c);
|
auto enqueue = (quotient ? dq::enqueue_by_matrix_c : dq::enqueue_c);
|
||||||
enqueue(centerover, cview());
|
enqueue(at, where);
|
||||||
|
|
||||||
while(!dq::drawqueue_c.empty()) {
|
while(!dq::drawqueue_c.empty()) {
|
||||||
auto& p = dq::drawqueue_c.front();
|
auto& p = dq::drawqueue_c.front();
|
||||||
|
@ -4663,7 +4663,7 @@ EX void drawthemap() {
|
|||||||
|
|
||||||
profile_start(1);
|
profile_start(1);
|
||||||
make_actual_view();
|
make_actual_view();
|
||||||
currentmap->draw();
|
currentmap->draw_all();
|
||||||
drawWormSegments();
|
drawWormSegments();
|
||||||
drawBlizzards();
|
drawBlizzards();
|
||||||
drawArrowTraps();
|
drawArrowTraps();
|
||||||
@ -4949,7 +4949,7 @@ EX void gamescreen(int _darken) {
|
|||||||
View = subscreens::player_displays[0].view_matrix;
|
View = subscreens::player_displays[0].view_matrix;
|
||||||
centerover = subscreens::player_displays[0].precise_center;
|
centerover = subscreens::player_displays[0].precise_center;
|
||||||
just_gmatrix = true;
|
just_gmatrix = true;
|
||||||
currentmap->draw();
|
currentmap->draw_all();
|
||||||
just_gmatrix = false;
|
just_gmatrix = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
61
hypgraph.cpp
61
hypgraph.cpp
@ -1232,38 +1232,59 @@ EX bool drawcell_subs(cell *c, const shiftmatrix& V) {
|
|||||||
return draw;
|
return draw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hrmap_standard::draw() {
|
void hrmap::draw_all() {
|
||||||
static ld shift = 0;
|
if(sphere && pmodel == mdSpiral) {
|
||||||
static bool in_multi = false;
|
|
||||||
if(sphere && pmodel == mdSpiral && !in_multi) {
|
|
||||||
/* todo other types? */
|
|
||||||
in_multi = true;
|
|
||||||
if(models::ring_not_spiral) {
|
if(models::ring_not_spiral) {
|
||||||
int qty = ceil(1. / pconf.sphere_spiral_multiplier);
|
int qty = ceil(1. / pconf.sphere_spiral_multiplier);
|
||||||
if(qty > 100) qty = 100;
|
if(qty > 100) qty = 100;
|
||||||
for(int i=-qty; i < qty; i++) {
|
for(int i=-qty; i < qty; i++)
|
||||||
shift = 2 * M_PI * i;
|
draw_at(centerover, cview(2 * M_PI * i));
|
||||||
draw();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
shift = 0;
|
draw_at(centerover, cview());
|
||||||
draw();
|
|
||||||
if(vid.use_smart_range) for(int i=1;; i++) {
|
if(vid.use_smart_range) for(int i=1;; i++) {
|
||||||
int drawn = cells_drawn;
|
int drawn = cells_drawn;
|
||||||
shift = 2 * M_PI * i;
|
draw_at(centerover, cview(2 * M_PI * i));
|
||||||
draw();
|
draw_at(centerover, cview(-2 * M_PI * i));
|
||||||
shift = -2 * M_PI * i;
|
|
||||||
draw();
|
|
||||||
if(drawn == cells_drawn) break;
|
if(drawn == cells_drawn) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in_multi = false;
|
|
||||||
shift = 0;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
draw_at(centerover, cview());
|
||||||
|
}
|
||||||
|
|
||||||
|
void hrmap::draw_at(cell *at, const shiftmatrix& where) {
|
||||||
|
dq::clear_all();
|
||||||
|
auto& enq = confusingGeometry() ? dq::enqueue_by_matrix_c : dq::enqueue_c;
|
||||||
|
|
||||||
|
enq(at, where);
|
||||||
|
|
||||||
|
while(!dq::drawqueue_c.empty()) {
|
||||||
|
auto& p = dq::drawqueue_c.front();
|
||||||
|
cell *c = p.first;
|
||||||
|
shiftmatrix V = p.second;
|
||||||
|
dq::drawqueue_c.pop();
|
||||||
|
|
||||||
|
if(!do_draw(c, V)) continue;
|
||||||
|
drawcell(c, V);
|
||||||
|
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
||||||
|
|
||||||
|
if(reg3::ultra_mirror_in())
|
||||||
|
for(auto& T: cgi.ultra_mirrors)
|
||||||
|
enq(c, optimized_shift(V * T));
|
||||||
|
|
||||||
|
for(int i=0; i<c->type; i++) {
|
||||||
|
// note: need do cmove before c.spin
|
||||||
|
cell *c1 = c->cmove(i);
|
||||||
|
enq(c1, optimized_shift(V * adj(c, i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void hrmap_standard::draw_at(cell *at, const shiftmatrix& where) {
|
||||||
drawn_cells.clear();
|
drawn_cells.clear();
|
||||||
drawn_cells.emplace_back(centerover->master, hsOrigin, cview(shift) * master_relative(centerover, true));
|
drawn_cells.emplace_back(at->master, hsOrigin, where * master_relative(at, true));
|
||||||
for(int i=0; i<isize(drawn_cells); i++) {
|
for(int i=0; i<isize(drawn_cells); i++) {
|
||||||
// prevent reallocation due to insertion
|
// prevent reallocation due to insertion
|
||||||
if(drawn_cells.capacity() < drawn_cells.size() + 16)
|
if(drawn_cells.capacity() < drawn_cells.size() + 16)
|
||||||
|
29
kite.cpp
29
kite.cpp
@ -343,35 +343,6 @@ struct hrmap_kite : hrmap {
|
|||||||
origin = newtile(pKite, 0);
|
origin = newtile(pKite, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
|
|
||||||
dq::clear_all();
|
|
||||||
dq::enqueue(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
|
|
||||||
for(int i=0; i<c->type; i++)
|
|
||||||
dq::enqueue(c->cmove(i)->master, optimized_shift(V * adj(c, i)));
|
|
||||||
/*
|
|
||||||
ld err = hdist(where[h->c7->cmove(i)->master] * C0, where[h] * M * C0);
|
|
||||||
if(err > -.01)
|
|
||||||
println(hlog,
|
|
||||||
" for ", make_tuple(getshape(h), i, getshape(h->c7->cmove(i)->master), h->c7->c.spin(i)),
|
|
||||||
" error = ", format("%f", float(err)),
|
|
||||||
" source = ", s0+source[{h->c7, h->c7->cmove(i)}]
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~hrmap_kite() {
|
~hrmap_kite() {
|
||||||
clearfrom(origin);
|
clearfrom(origin);
|
||||||
}
|
}
|
||||||
|
@ -458,31 +458,6 @@ EX namespace sn {
|
|||||||
while(coords[h1].second != coords[h2].second) front = front * adj(h1, up), back = iadj(h2, up) * back, h1 = h1->cmove(up), h2 = h2->cmove(up);
|
while(coords[h1].second != coords[h2].second) front = front * adj(h1, up), back = iadj(h2, up) * back, h1 = h1->cmove(up), h2 = h2->cmove(up);
|
||||||
return front * back;
|
return front * back;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
dq::clear_all();
|
|
||||||
|
|
||||||
dq::enqueue(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
|
||||||
|
|
||||||
for(int i=0; i<S7; i++) {
|
|
||||||
// note: need do cmove before c.spin
|
|
||||||
heptagon *h1 = h->cmove(i);
|
|
||||||
dq::enqueue(h1, V * adjmatrix(i, h->c.spin(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EX pair<heptagon*,heptagon*> getcoord(heptagon *h) {
|
EX pair<heptagon*,heptagon*> getcoord(heptagon *h) {
|
||||||
@ -937,38 +912,8 @@ EX namespace nilv {
|
|||||||
for(int a=0; a<3; a++) p[a] = szgmod(p[a], nilperiod[a]);
|
for(int a=0; a<3; a++) p[a] = szgmod(p[a], nilperiod[a]);
|
||||||
return nisot::translate(mvec_to_point(p));
|
return nisot::translate(mvec_to_point(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
dq::clear_all();
|
|
||||||
|
|
||||||
dq::enqueue_by_matrix(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
|
||||||
|
|
||||||
if(0) for(int t=0; t<c->type; t++) {
|
|
||||||
if(!c->move(t)) continue;
|
|
||||||
dynamicval<color_t> g(poly_outline, darkena((0x142968*t) & 0xFFFFFF, 0, 255) );
|
|
||||||
queuepoly(V, cgi.shWireframe3D[t], 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i=0; i<S7; i++) {
|
|
||||||
// note: need do cmove before c.spin
|
|
||||||
heptagon *h1 = h->cmove(i);
|
|
||||||
dq::enqueue_by_matrix(h1, V * adjmatrix(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EX mvec get_coord(heptagon *h) { return ((hrmap_nil*)currentmap)->coords[h]; }
|
EX mvec get_coord(heptagon *h) { return ((hrmap_nil*)currentmap)->coords[h]; }
|
||||||
|
|
||||||
EX heptagon *get_heptagon_at(mvec m) { return ((hrmap_nil*)currentmap)->get_at(m); }
|
EX heptagon *get_heptagon_at(mvec m) { return ((hrmap_nil*)currentmap)->get_at(m); }
|
||||||
@ -1278,33 +1223,6 @@ EX namespace hybrid {
|
|||||||
|
|
||||||
virtual transmatrix spin_to(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_to(c, d, bonus); }); }
|
virtual transmatrix spin_to(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_to(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); }); }
|
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 {
|
|
||||||
cell* start = centerover;
|
|
||||||
|
|
||||||
dq::clear_all();
|
|
||||||
dq::enqueue_by_matrix_c(start, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue_c.empty()) {
|
|
||||||
auto& p = dq::drawqueue_c.front();
|
|
||||||
cell *c = get<0>(p);
|
|
||||||
|
|
||||||
shiftmatrix V = get<1>(p);
|
|
||||||
dq::drawqueue_c.pop();
|
|
||||||
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
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);
|
|
||||||
shiftmatrix V1 = V * adj(c, i);
|
|
||||||
optimize_shift(V1);
|
|
||||||
dq::enqueue_by_matrix_c(c1, V1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
hrmap_hybrid* hmap() { return (hrmap_hybrid*) currentmap; }
|
hrmap_hybrid* hmap() { return (hrmap_hybrid*) currentmap; }
|
||||||
@ -2122,7 +2040,7 @@ EX namespace rots {
|
|||||||
|
|
||||||
std::unordered_map<int, transmatrix> saved_matrices;
|
std::unordered_map<int, transmatrix> saved_matrices;
|
||||||
|
|
||||||
transmatrix adj(cell *c1, int i) override {
|
transmatrix adj(cell *c1, int i) override {
|
||||||
if(i == c1->type-2) return uzpush(-cgi.plevel) * spin(-2*cgi.plevel);
|
if(i == c1->type-2) return uzpush(-cgi.plevel) * spin(-2*cgi.plevel);
|
||||||
if(i == c1->type-1) return uzpush(+cgi.plevel) * spin(+2*cgi.plevel);
|
if(i == c1->type-1) return uzpush(+cgi.plevel) * spin(+2*cgi.plevel);
|
||||||
cell *c2 = c1->cmove(i);
|
cell *c2 = c1->cmove(i);
|
||||||
|
86
reg3.cpp
86
reg3.cpp
@ -292,7 +292,6 @@ EX namespace reg3 {
|
|||||||
|
|
||||||
heptagon *getOrigin() override { return allh[0]; }
|
heptagon *getOrigin() override { return allh[0]; }
|
||||||
|
|
||||||
void draw() override;
|
|
||||||
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override;
|
transmatrix relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) override;
|
||||||
|
|
||||||
void initialize(int cell_count);
|
void initialize(int cell_count);
|
||||||
@ -316,34 +315,6 @@ EX namespace reg3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hrmap_quotient3::draw() {
|
|
||||||
sphereflip = Id;
|
|
||||||
|
|
||||||
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
|
||||||
|
|
||||||
dq::clear_all();
|
|
||||||
dq::enqueue_by_matrix(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
|
||||||
|
|
||||||
if(ultra_mirror_in())
|
|
||||||
for(auto& T: cgi.ultra_mirrors)
|
|
||||||
dq::enqueue_by_matrix(h, optimized_shift(V * T));
|
|
||||||
|
|
||||||
for(int d=0; d<S7; d++)
|
|
||||||
dq::enqueue_by_matrix(h->move(d), optimized_shift(V * tmatrices[h->fieldval][d]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transmatrix hrmap_quotient3::relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
|
transmatrix hrmap_quotient3::relative_matrix(heptagon *h2, heptagon *h1, const hyperpoint& hint) {
|
||||||
if(h1 == h2) return Id;
|
if(h1 == h2) return Id;
|
||||||
int d = hr::celldistance(h2->c7, h1->c7);
|
int d = hr::celldistance(h2->c7, h1->c7);
|
||||||
@ -918,37 +889,6 @@ EX namespace reg3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
sphereflip = Id;
|
|
||||||
|
|
||||||
dq::clear_all();
|
|
||||||
auto& enq = (ultra_mirror_in() ? dq::enqueue_by_matrix : dq::enqueue);
|
|
||||||
enq(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
|
||||||
|
|
||||||
if(sightranges[geometry] == 0) return;
|
|
||||||
|
|
||||||
if(ultra_mirror_in())
|
|
||||||
for(auto& T: cgi.ultra_mirrors)
|
|
||||||
dq::enqueue_by_matrix(h, optimized_shift(V * T));
|
|
||||||
|
|
||||||
for(int i=0; i<S7; i++) if(h->move(i)) {
|
|
||||||
enq(h->move(i), optimized_shift(V * adj(h, i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transmatrix adj(heptagon *h, int d) override {
|
transmatrix adj(heptagon *h, int d) override {
|
||||||
#if CAP_FIELD
|
#if CAP_FIELD
|
||||||
if(quotient_map) return quotient_map->adj(h, d);
|
if(quotient_map) return quotient_map->adj(h, d);
|
||||||
@ -1264,32 +1204,6 @@ EX namespace reg3 {
|
|||||||
clearfrom(origin);
|
clearfrom(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
|
||||||
sphereflip = Id;
|
|
||||||
|
|
||||||
// for(int i=0; i<S6; i++) queuepoly(ggmatrix(cwt.at), shWall3D[i], 0xFF0000FF);
|
|
||||||
|
|
||||||
dq::clear_all();
|
|
||||||
dq::enqueue(centerover->master, cview());
|
|
||||||
|
|
||||||
while(!dq::drawqueue.empty()) {
|
|
||||||
auto& p = dq::drawqueue.front();
|
|
||||||
heptagon *h = p.first;
|
|
||||||
shiftmatrix V = p.second;
|
|
||||||
dq::drawqueue.pop();
|
|
||||||
|
|
||||||
|
|
||||||
cell *c = h->c7;
|
|
||||||
if(!do_draw(c, V)) continue;
|
|
||||||
drawcell(c, V);
|
|
||||||
if(in_wallopt() && isWall3(c) && isize(dq::drawqueue) > 1000) continue;
|
|
||||||
|
|
||||||
for(int i=0; i<S7; i++) if(h->move(i)) {
|
|
||||||
dq::enqueue(h->move(i), optimized_shift(V * adj(h, i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transmatrix adj(heptagon *h, int d) override {
|
transmatrix adj(heptagon *h, int d) override {
|
||||||
return quotient_map->adj(h, d);
|
return quotient_map->adj(h, d);
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ struct hrmap_spherical : hrmap_standard {
|
|||||||
swap(gmatrix, gmatrix0);
|
swap(gmatrix, gmatrix0);
|
||||||
just_gmatrix = true;
|
just_gmatrix = true;
|
||||||
dynamicval<cell*> cco(centerover, gamestart());
|
dynamicval<cell*> cco(centerover, gamestart());
|
||||||
draw();
|
draw_all();
|
||||||
just_gmatrix = false;
|
just_gmatrix = false;
|
||||||
swap(gmatrix, gmatrix0);
|
swap(gmatrix, gmatrix0);
|
||||||
#if CAP_GP
|
#if CAP_GP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user