mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 07:27:07 +00:00
hemisphere works nicely in Euclidean and spherical
This commit is contained in:
parent
f9d65a2e37
commit
69e121bd16
16
hypgraph.cpp
16
hypgraph.cpp
@ -610,17 +610,18 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
|||||||
|
|
||||||
case mdHemisphere: {
|
case mdHemisphere: {
|
||||||
|
|
||||||
|
#if CAP_VR
|
||||||
|
ld dir = vrhr::state == 2 ? -1:1;
|
||||||
|
#else
|
||||||
|
constexpr ld dir = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch(cgclass) {
|
switch(cgclass) {
|
||||||
case gcHyperbolic: {
|
case gcHyperbolic: {
|
||||||
ld zl = zlevel(H);
|
ld zl = zlevel(H);
|
||||||
ret = H / H[2];
|
ret = H / H[2];
|
||||||
ret[2] = sqrt(1 - sqhypot_d(2, ret));
|
ret[2] = sqrt(1 - sqhypot_d(2, ret));
|
||||||
// need to reverse in VR
|
// need to reverse in VR
|
||||||
#if CAP_VR
|
|
||||||
ld dir = vrhr::state == 2 ? -1:1;
|
|
||||||
#else
|
|
||||||
constexpr ld dir = 1;
|
|
||||||
#endif
|
|
||||||
ret = ret * (1 + (zl - 1) * ret[2] * pconf.depth_scaling * dir);
|
ret = ret * (1 + (zl - 1) * ret[2] * pconf.depth_scaling * dir);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -634,7 +635,8 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
|||||||
ld y = x / hd;
|
ld y = x / hd;
|
||||||
ret = H * x / hd / pconf.euclid_to_sphere;
|
ret = H * x / hd / pconf.euclid_to_sphere;
|
||||||
ret[2] = (1 - y);
|
ret[2] = (1 - y);
|
||||||
ret = ret * (1 + (H[2]-1) * y * pconf.depth_scaling / pconf.euclid_to_sphere);
|
ret[2] *= dir;
|
||||||
|
ret = ret * (1 + (H[2]-1) * y * pconf.depth_scaling * dir / pconf.euclid_to_sphere);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -643,7 +645,7 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
|||||||
ret = H;
|
ret = H;
|
||||||
if(pconf.depth_scaling != 1) {
|
if(pconf.depth_scaling != 1) {
|
||||||
ld v = intval(H, Hypc);
|
ld v = intval(H, Hypc);
|
||||||
ret *= pow(v, (pconf.depth_scaling-1) / 2);
|
ret *= pow(v, (dir * pconf.depth_scaling-1) / 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user