1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-17 10:44:48 +00:00

fixed some crashes in embedding+arb

This commit is contained in:
Zeno Rogue 2023-03-26 00:37:08 +01:00
parent a3c861ec9e
commit a47dbc5dd5
5 changed files with 44 additions and 12 deletions

View File

@ -602,10 +602,10 @@ struct hrmap_hat : hrmap {
bool emb = embedded_plane;
if(emb) {
vl = cgi.emb->actual_to_base(vl); vl[2] = 1;
vr = cgi.emb->actual_to_base(vr); vr[2] = 1;
xvl = cgi.emb->actual_to_base(xvl); xvl[2] = 1;
xvr = cgi.emb->actual_to_base(xvr); xvr[2] = 1;
vl = cgi.emb->actual_to_base(vl);
vr = cgi.emb->actual_to_base(vr);
xvl = cgi.emb->actual_to_base(xvl);
xvr = cgi.emb->actual_to_base(xvr);
geom3::light_flip(true);
}

View File

@ -1393,12 +1393,22 @@ EX transmatrix get_adj(arbi_tiling& c, int t, int dl, int t1, int xdl, bool xmir
hyperpoint vl = sh.vertices[dl];
hyperpoint vr = sh.vertices[dr];
hyperpoint xvl = xsh.vertices[xdl];
hyperpoint xvr = xsh.vertices[xdr];
bool emb = embedded_plane;
if(emb) {
vl = cgi.emb->actual_to_base(vl);
vr = cgi.emb->actual_to_base(vr);
xvl = cgi.emb->actual_to_base(xvl);
xvr = cgi.emb->actual_to_base(xvr);
geom3::light_flip(true);
}
hyperpoint vm = get_midedge(sh.edges[dl], vl, vr);
transmatrix rm = gpushxto0(vm);
hyperpoint xvl = xsh.vertices[xdl];
hyperpoint xvr = xsh.vertices[xdr];
hyperpoint xvm = get_midedge(xsh.edges[xdl], xvl, xvr);
transmatrix xrm = gpushxto0(xvm);
@ -1428,7 +1438,12 @@ EX transmatrix get_adj(arbi_tiling& c, int t, int dl, int t1, int xdl, bool xmir
println(hlog, hdist(vl, Res * xvr), " # ", hdist(vr, Res * xvl));
throw hr_exception("error in arb::get_adj");
}
if(emb) {
Res = cgi.emb->base_to_actual(Res);
geom3::light_flip(false);
}
return Res;
}

View File

@ -1089,6 +1089,8 @@ auto hook =
#if MAXMDIM >= 4
auto hooksw = addHook(hooks_swapdim, 100, [] {
if(!arcm::in()) return;
dynamicval<eGeometry> g(geometry, gNormal);
dynamicval<eVariation> gv(variation, eVariation::pure);
dynamicval<geometry_information*> gi(cgip, find_alt_cgip());

View File

@ -618,7 +618,10 @@ struct emb_euc_in_hyp : emb_actual {
hyperpoint base_to_actual(hyperpoint h) override {
h[3] = h[2]; h[2] = 0; return parabolic13(h[0], h[1]) * C0;
}
hyperpoint actual_to_base(hyperpoint h) override { return deparabolic13(h); }
hyperpoint actual_to_base(hyperpoint h) override {
hyperpoint h1 = deparabolic13(h); h1[2] = 1;
return h1;
}
transmatrix actual_to_base(const transmatrix& T) override { hyperpoint h = deparabolic13(T * C0); return eupush(h[0], h[1]); }
ld anim_center_z() override { return vid.depth; }
};

20
sky.cpp
View File

@ -601,6 +601,8 @@ EX void make_air() {
bool missing = false;
auto cgi1 = &cgi;
if(1) {
//shot::take("airtest.png", drawqueue);
dynamicval<videopar> v(vid, vid);
@ -627,13 +629,18 @@ EX void make_air() {
pconf.stretch = 1;
pmodel = mdDisk;
auto cgi1 = &cgi;
vid.always3 = false;
geom3::apply_always3();
check_cgi();
missing = !(cgi.state & 2);
swap_if_missing(missing);
cgi.prepare_basics();
geom3::swap_direction = -1;
if(missing) {
swap(cgi.emb, cgi1->emb);
swap_if_missing(missing);
swap(cgi.emb, cgi1->emb);
}
cgi.require_shapes();
eGeometry orig = geometry;
@ -682,7 +689,12 @@ EX void make_air() {
GLERR("after draw");
geom3::apply_always3();
swap_if_missing(missing);
geom3::swap_direction = +1;
if(missing) {
swap(cgi.emb, cgi1->emb);
swap_if_missing(missing);
swap(cgi.emb, cgi1->emb);
}
check_cgi();
calcparam();
GLERR("after make_air");