mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-04 18:52:51 +00:00
improvements to sphere flipping
This commit is contained in:
parent
0770a11164
commit
42f96b768c
@ -927,7 +927,7 @@ EX int rhypot(int a, int b) { return (int) sqrt(a*a - b*b); }
|
|||||||
EX ld realradius() {
|
EX ld realradius() {
|
||||||
ld vradius = current_display->radius;
|
ld vradius = current_display->radius;
|
||||||
if(sphere) {
|
if(sphere) {
|
||||||
if(sphereflipped())
|
if(flip_sphere())
|
||||||
vradius /= sqrt(pconf.alpha*pconf.alpha - 1);
|
vradius /= sqrt(pconf.alpha*pconf.alpha - 1);
|
||||||
else
|
else
|
||||||
vradius = 1e12; // use the following
|
vradius = 1e12; // use the following
|
||||||
|
@ -2184,7 +2184,7 @@ EX void quickqueue() {
|
|||||||
|
|
||||||
/* todo */
|
/* todo */
|
||||||
ld xintval(const shiftpoint& h) {
|
ld xintval(const shiftpoint& h) {
|
||||||
if(sphereflipped()) return -h.h[2];
|
if(sphere_flipped) return -h.h[2];
|
||||||
if(hyperbolic) return -h.h[2];
|
if(hyperbolic) return -h.h[2];
|
||||||
return -intval(h.h, C0);
|
return -intval(h.h, C0);
|
||||||
}
|
}
|
||||||
@ -2198,7 +2198,7 @@ int qp[PMAX], qp0[PMAX];
|
|||||||
|
|
||||||
color_t darken_color(color_t& color, bool outline) {
|
color_t darken_color(color_t& color, bool outline) {
|
||||||
int alpha = color & 255;
|
int alpha = color & 255;
|
||||||
if(sphere && pmodel == mdDisk && pconf.alpha <= 1)
|
if(sphere && pmodel == mdDisk && pconf.alpha <= 0.99)
|
||||||
return 0;
|
return 0;
|
||||||
else {
|
else {
|
||||||
if(outline && alpha < 255)
|
if(outline && alpha < 255)
|
||||||
@ -2279,7 +2279,7 @@ EX void draw_backside() {
|
|||||||
ptd->draw();
|
ptd->draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
spherespecial = sphereflipped() ? 1 : -1;
|
spherespecial = sphere_flipped ? 1 : -1;
|
||||||
reset_projection();
|
reset_projection();
|
||||||
|
|
||||||
if(pmodel == mdRotatedHyperboles) {
|
if(pmodel == mdRotatedHyperboles) {
|
||||||
|
@ -5030,7 +5030,8 @@ EX bool nonisotropic_weird_transforms;
|
|||||||
|
|
||||||
EX void make_actual_view() {
|
EX void make_actual_view() {
|
||||||
sphereflip = Id;
|
sphereflip = Id;
|
||||||
if(sphereflipped()) sphereflip[LDIM][LDIM] = -1;
|
sphere_flipped = flip_sphere();
|
||||||
|
if(sphere_flipped) sphereflip[LDIM][LDIM] = -1;
|
||||||
actual_view_transform = sphereflip;
|
actual_view_transform = sphereflip;
|
||||||
if(vid.yshift && WDIM == 2) actual_view_transform = ypush(vid.yshift) * actual_view_transform;
|
if(vid.yshift && WDIM == 2) actual_view_transform = ypush(vid.yshift) * actual_view_transform;
|
||||||
#if MAXMDIM >= 4
|
#if MAXMDIM >= 4
|
||||||
|
@ -11,9 +11,11 @@ namespace hr {
|
|||||||
hyperpoint ghxy, ghgxy;
|
hyperpoint ghxy, ghgxy;
|
||||||
shiftpoint ghpm = shiftless(C02);
|
shiftpoint ghpm = shiftless(C02);
|
||||||
|
|
||||||
#if HDR
|
EX ld flip_limit = 1.1;
|
||||||
inline bool sphereflipped() { return sphere && pconf.alpha > 1.1; }
|
|
||||||
#endif
|
EX bool flip_sphere() { return sphere && pconf.alpha > flip_limit; }
|
||||||
|
|
||||||
|
EX bool sphere_flipped;
|
||||||
|
|
||||||
void ghcheck(hyperpoint &ret, const shiftpoint &H) {
|
void ghcheck(hyperpoint &ret, const shiftpoint &H) {
|
||||||
if(hypot_d(2, ret-ghxy) < hypot_d(2, ghgxy-ghxy)) {
|
if(hypot_d(2, ret-ghxy) < hypot_d(2, ghgxy-ghxy)) {
|
||||||
|
2
vr.cpp
2
vr.cpp
@ -577,7 +577,7 @@ EX hyperpoint model_location(shiftpoint h, bool& bad) {
|
|||||||
h.h = hmd_pre_for[2] * h.h;
|
h.h = hmd_pre_for[2] * h.h;
|
||||||
eModel md = pmodel_3d_version();
|
eModel md = pmodel_3d_version();
|
||||||
apply_other_model(h, hscr, md);
|
apply_other_model(h, hscr, md);
|
||||||
bad = in_vr_sphere && get_side(hscr) == (sphereflipped() ? -1 : 1);
|
bad = in_vr_sphere && get_side(hscr) == (sphere_flipped ? -1 : 1);
|
||||||
|
|
||||||
hscr[3] = 1;
|
hscr[3] = 1;
|
||||||
return hscr;
|
return hscr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user