mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-27 09:24:53 +00:00
fixed some crashes in embedding+arb
This commit is contained in:
parent
a3c861ec9e
commit
a47dbc5dd5
@ -602,10 +602,10 @@ struct hrmap_hat : hrmap {
|
|||||||
|
|
||||||
bool emb = embedded_plane;
|
bool emb = embedded_plane;
|
||||||
if(emb) {
|
if(emb) {
|
||||||
vl = cgi.emb->actual_to_base(vl); vl[2] = 1;
|
vl = cgi.emb->actual_to_base(vl);
|
||||||
vr = cgi.emb->actual_to_base(vr); vr[2] = 1;
|
vr = cgi.emb->actual_to_base(vr);
|
||||||
xvl = cgi.emb->actual_to_base(xvl); xvl[2] = 1;
|
xvl = cgi.emb->actual_to_base(xvl);
|
||||||
xvr = cgi.emb->actual_to_base(xvr); xvr[2] = 1;
|
xvr = cgi.emb->actual_to_base(xvr);
|
||||||
geom3::light_flip(true);
|
geom3::light_flip(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 vl = sh.vertices[dl];
|
||||||
hyperpoint vr = sh.vertices[dr];
|
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);
|
hyperpoint vm = get_midedge(sh.edges[dl], vl, vr);
|
||||||
|
|
||||||
transmatrix rm = gpushxto0(vm);
|
transmatrix rm = gpushxto0(vm);
|
||||||
|
|
||||||
hyperpoint xvl = xsh.vertices[xdl];
|
|
||||||
hyperpoint xvr = xsh.vertices[xdr];
|
|
||||||
hyperpoint xvm = get_midedge(xsh.edges[xdl], xvl, xvr);
|
hyperpoint xvm = get_midedge(xsh.edges[xdl], xvl, xvr);
|
||||||
|
|
||||||
transmatrix xrm = gpushxto0(xvm);
|
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));
|
println(hlog, hdist(vl, Res * xvr), " # ", hdist(vr, Res * xvl));
|
||||||
throw hr_exception("error in arb::get_adj");
|
throw hr_exception("error in arb::get_adj");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(emb) {
|
||||||
|
Res = cgi.emb->base_to_actual(Res);
|
||||||
|
geom3::light_flip(false);
|
||||||
|
}
|
||||||
|
|
||||||
return Res;
|
return Res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1089,6 +1089,8 @@ auto hook =
|
|||||||
#if MAXMDIM >= 4
|
#if MAXMDIM >= 4
|
||||||
auto hooksw = addHook(hooks_swapdim, 100, [] {
|
auto hooksw = addHook(hooks_swapdim, 100, [] {
|
||||||
|
|
||||||
|
if(!arcm::in()) return;
|
||||||
|
|
||||||
dynamicval<eGeometry> g(geometry, gNormal);
|
dynamicval<eGeometry> g(geometry, gNormal);
|
||||||
dynamicval<eVariation> gv(variation, eVariation::pure);
|
dynamicval<eVariation> gv(variation, eVariation::pure);
|
||||||
dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
|
dynamicval<geometry_information*> gi(cgip, find_alt_cgip());
|
||||||
|
@ -618,7 +618,10 @@ struct emb_euc_in_hyp : emb_actual {
|
|||||||
hyperpoint base_to_actual(hyperpoint h) override {
|
hyperpoint base_to_actual(hyperpoint h) override {
|
||||||
h[3] = h[2]; h[2] = 0; return parabolic13(h[0], h[1]) * C0;
|
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]); }
|
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; }
|
ld anim_center_z() override { return vid.depth; }
|
||||||
};
|
};
|
||||||
|
20
sky.cpp
20
sky.cpp
@ -601,6 +601,8 @@ EX void make_air() {
|
|||||||
|
|
||||||
bool missing = false;
|
bool missing = false;
|
||||||
|
|
||||||
|
auto cgi1 = &cgi;
|
||||||
|
|
||||||
if(1) {
|
if(1) {
|
||||||
//shot::take("airtest.png", drawqueue);
|
//shot::take("airtest.png", drawqueue);
|
||||||
dynamicval<videopar> v(vid, vid);
|
dynamicval<videopar> v(vid, vid);
|
||||||
@ -627,13 +629,18 @@ EX void make_air() {
|
|||||||
pconf.stretch = 1;
|
pconf.stretch = 1;
|
||||||
pmodel = mdDisk;
|
pmodel = mdDisk;
|
||||||
|
|
||||||
auto cgi1 = &cgi;
|
|
||||||
|
|
||||||
vid.always3 = false;
|
vid.always3 = false;
|
||||||
geom3::apply_always3();
|
geom3::apply_always3();
|
||||||
check_cgi();
|
check_cgi();
|
||||||
missing = !(cgi.state & 2);
|
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();
|
cgi.require_shapes();
|
||||||
|
|
||||||
eGeometry orig = geometry;
|
eGeometry orig = geometry;
|
||||||
@ -682,7 +689,12 @@ EX void make_air() {
|
|||||||
|
|
||||||
GLERR("after draw");
|
GLERR("after draw");
|
||||||
geom3::apply_always3();
|
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();
|
check_cgi();
|
||||||
calcparam();
|
calcparam();
|
||||||
GLERR("after make_air");
|
GLERR("after make_air");
|
||||||
|
Loading…
Reference in New Issue
Block a user