mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 22:39:53 +00:00
product:: works with Euclidean
This commit is contained in:
parent
5add972bdd
commit
f3c97f9342
@ -279,8 +279,12 @@ void set_or_configure_geometry(eGeometry g) {
|
|||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
if(among(g, gProduct, gRotSpace)) {
|
if(among(g, gProduct, gRotSpace)) {
|
||||||
if(WDIM == 3 || euclid) {
|
if(WDIM == 3 || (g == gRotSpace && euclid)) {
|
||||||
addMessage(XLAT("Only works with 2D non-Euclidean geometries"));
|
addMessage(XLAT(
|
||||||
|
g == gRotSpace ?
|
||||||
|
"Only works with 2D non-Euclidean geometries"
|
||||||
|
: "Only works with 2D geometries"
|
||||||
|
));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(g == gRotSpace) {
|
if(g == gRotSpace) {
|
||||||
|
@ -373,6 +373,7 @@ EX ld zlevel(const hyperpoint &h) {
|
|||||||
if(sl2) return sqrt(-intval(h, Hypc));
|
if(sl2) return sqrt(-intval(h, Hypc));
|
||||||
else if(translatable) return h[LDIM];
|
else if(translatable) return h[LDIM];
|
||||||
else if(sphere) return sqrt(intval(h, Hypc));
|
else if(sphere) return sqrt(intval(h, Hypc));
|
||||||
|
else if(in_e2xe()) return log(h[2]);
|
||||||
else if(prod) return log(sqrt(abs(intval(h, Hypc)))); /* abs works with both underlying spherical and hyperbolic */
|
else if(prod) return log(sqrt(abs(intval(h, Hypc)))); /* abs works with both underlying spherical and hyperbolic */
|
||||||
else return (h[LDIM] < 0 ? -1 : 1) * sqrt(-intval(h, Hypc));
|
else return (h[LDIM] < 0 ? -1 : 1) * sqrt(-intval(h, Hypc));
|
||||||
}
|
}
|
||||||
|
@ -1226,15 +1226,17 @@ EX namespace product {
|
|||||||
cell *c = cw.at;
|
cell *c = cw.at;
|
||||||
if(sphere) gmatrix[c] = V; /* some computations need gmatrix0 for underlying geometry */
|
if(sphere) gmatrix[c] = V; /* some computations need gmatrix0 for underlying geometry */
|
||||||
bool s = sphere || pmodel != mdPerspective;
|
bool s = sphere || pmodel != mdPerspective;
|
||||||
|
bool euc = euclid;
|
||||||
hybrid::in_actual([&] {
|
hybrid::in_actual([&] {
|
||||||
cell *c0 = hybrid::get_at(c, z0);
|
cell *c0 = hybrid::get_at(c, z0);
|
||||||
cwall_offset = hybrid::wall_offset(c0);
|
cwall_offset = hybrid::wall_offset(c0);
|
||||||
if(s) cwall_mask = (1<<c->type) - 1;
|
if(s) cwall_mask = (1<<c->type) - 1;
|
||||||
else {
|
else {
|
||||||
cwall_mask = 0;
|
cwall_mask = 0;
|
||||||
ld d = V[2][2];
|
ld d = euc ? sqhypot_d(2, tC0(V)) : V[2][2];
|
||||||
for(int i=0; i<c->type; i++) {
|
for(int i=0; i<c->type; i++) {
|
||||||
ld d1 = (V * cgi.walltester[cwall_offset + i])[2];
|
hyperpoint h = (V * cgi.walltester[cwall_offset + i]);
|
||||||
|
ld d1 = euc ? sqhypot_d(2, h) : h[2];
|
||||||
if(d1 < d - 1e-6) cwall_mask |= (1<<i);
|
if(d1 < d - 1e-6) cwall_mask |= (1<<i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1256,7 +1258,11 @@ EX namespace product {
|
|||||||
res[2] = zlevel(h);
|
res[2] = zlevel(h);
|
||||||
h = zshift(h, -res[2]);
|
h = zshift(h, -res[2]);
|
||||||
ld r = hypot_d(2, h);
|
ld r = hypot_d(2, h);
|
||||||
if(r < 1e-6) {
|
if(hybrid::under_class() == gcEuclid) {
|
||||||
|
res[0] = h[0];
|
||||||
|
res[1] = h[1];
|
||||||
|
}
|
||||||
|
else if(r < 1e-6) {
|
||||||
res[0] = h[0];
|
res[0] = h[0];
|
||||||
res[1] = h[1];
|
res[1] = h[1];
|
||||||
}
|
}
|
||||||
|
@ -209,6 +209,14 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
|
|||||||
distfun = "sqrt(z*z+d*d)";
|
distfun = "sqrt(z*z+d*d)";
|
||||||
treset = true;
|
treset = true;
|
||||||
}
|
}
|
||||||
|
else if(in_e2xe() && pmodel == mdPerspective) {
|
||||||
|
shader_flags |= SF_PERS3 | SF_DIRECT;
|
||||||
|
coordinator +=
|
||||||
|
"t.xy /= t.z;\n"
|
||||||
|
"t.z = log(t.z);\n";
|
||||||
|
distfun = "length(t.xyz)";
|
||||||
|
treset = true;
|
||||||
|
}
|
||||||
else if(in_s2xe() && pmodel == mdPerspective) {
|
else if(in_s2xe() && pmodel == mdPerspective) {
|
||||||
shader_flags |= SF_PERS3 | SF_DIRECT;
|
shader_flags |= SF_PERS3 | SF_DIRECT;
|
||||||
distfun = "length(t.xyz)", treset = true;
|
distfun = "length(t.xyz)", treset = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user