mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-09-03 11:17:56 +00:00
small_hyperboloid more universal
This commit is contained in:
20
drawing.cpp
20
drawing.cpp
@@ -353,7 +353,8 @@ EX int get_side(const hyperpoint& H) {
|
||||
if(pmodel == mdRotatedHyperboles)
|
||||
return H[1] > 0 ? -1 : 1;
|
||||
if(pmodel == mdHyperboloid) {
|
||||
return det2(pconf.ball() * cspin90(2, 1) * rgpushxto0(H)) > 0 ? 1 : -1;
|
||||
auto H1 = H; if(sphere && pconf.small_hyperboloid) H1 = mid(H, C0);
|
||||
return det2(pconf.ball() * cspin90(2, 1) * rgpushxto0(H1)) > 0 ? 1 : -1;
|
||||
}
|
||||
if(pmodel == mdHyperboloidFlat && sphere)
|
||||
return H[2] >= 0 ? 1 : -1;
|
||||
@@ -364,6 +365,7 @@ EX int get_side(const hyperpoint& H) {
|
||||
}
|
||||
if(pmodel == mdHemisphere && sphere) {
|
||||
auto H1 = H;
|
||||
if(pconf.small_hyperboloid) H1 = mid(H, C0);
|
||||
int s = H1[2] > 0 ? 1 : -1;
|
||||
if(hemi_side && s != hemi_side) return -spherespecial;
|
||||
H1[0] /= H1[2]; H1[1] /= H1[2];
|
||||
@@ -570,6 +572,16 @@ void addpoly(const shiftmatrix& V, const vector<glvertex> &tab, int ofs, int cnt
|
||||
|
||||
for(auto& p: tofix)
|
||||
fixpoint(glcoords[p.first], p.second);
|
||||
|
||||
if(sphere && among(pmodel, mdHemisphere, mdHyperboloid) && pconf.small_hyperboloid) {
|
||||
bool left = false, right = false;
|
||||
for(auto h: glcoords) { hyperpoint h1; applymodel(shiftless(glhr::gltopoint(h)), h1);
|
||||
if(h1[0] < -0) left = true;
|
||||
if(h1[0] > +0) right = true;
|
||||
}
|
||||
if(left && right) poly_flags |= POLY_NIF_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
hyperpoint Hscr;
|
||||
applymodel(goodpoint, Hscr);
|
||||
@@ -2016,6 +2028,8 @@ void dqi_poly::draw() {
|
||||
if(pmodel == mdDisk && hyperbolic && pconf.alpha <= -1) can_have_inverse = true;
|
||||
if(pmodel == mdSpiral && pconf.skiprope) can_have_inverse = true;
|
||||
if(pmodel == mdCentralInversion) can_have_inverse = true;
|
||||
|
||||
if(among(pmodel, mdHemisphere, mdHyperboloid) && sphere && pconf.small_hyperboloid) can_have_inverse = true;
|
||||
|
||||
if(can_have_inverse && !(poly_flags & POLY_ISSIDE)) {
|
||||
|
||||
@@ -2035,6 +2049,8 @@ void dqi_poly::draw() {
|
||||
|
||||
}
|
||||
else poly_flags &=~ POLY_INVERSE;
|
||||
|
||||
if(among(pmodel, mdHemisphere, mdHyperboloid) && sphere && pconf.small_hyperboloid && (poly_flags & POLY_INVERSE)) return;
|
||||
|
||||
if(spherespecial) {
|
||||
if(!(poly_flags & POLY_INFRONT)) return;
|
||||
@@ -2433,7 +2449,7 @@ EX void draw_main() {
|
||||
return;
|
||||
}
|
||||
|
||||
if(pmodel == mdHemisphere && sphere && hemi_side == 0 && !vrhr::rendering()) {
|
||||
if(pmodel == mdHemisphere && sphere && hemi_side == 0 && !vrhr::rendering() && !pconf.small_hyperboloid) {
|
||||
hemi_side = (pconf.ball() * hyperpoint(0,1,0,1)) [2] < 0 ? 1 : -1;
|
||||
draw_main();
|
||||
|
||||
|
Reference in New Issue
Block a user