1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

refactored mdEqui

This commit is contained in:
Zeno Rogue 2017-11-13 11:26:21 +01:00
parent 19f12e3068
commit a19d4d568b
5 changed files with 11 additions and 8 deletions

View File

@ -637,7 +637,7 @@ namespace conformal {
switchagain: {
pmodel = eModel((pmodel + (shiftmul > 0 ? 1 : -1) + MODELCOUNT) % MODELCOUNT);
if(pmodel != mdEquidistant && pmodel != mdDisk && pmodel != mdEquiarea && pmodel != mdPolynomial && pmodel != mdHyperboloid) {
if(!mdEqui() && pmodel != mdDisk && pmodel != mdPolynomial && pmodel != mdHyperboloid) {
if(sphere && pmodel != mdBand)
goto switchagain;
if(euclid && pmodel != mdHalfplane && pmodel != mdBall)

View File

@ -1937,7 +1937,7 @@ int aurac[AURA+1][4];
bool haveaura() {
if(!(vid.aurastr>0 && !svg::in && (auraNOGL || vid.usingGL))) return false;
if(sphere && (pmodel == mdEquidistant || pmodel == mdEquiarea)) return true;
if(sphere && mdEqui()) return true;
return pmodel == mdDisk && (!sphere || vid.alpha > 10) && !euclid;
}
@ -1989,7 +1989,7 @@ void sumaura(int v) {
void drawaura() {
if(!haveaura()) return;
double rad = vid.radius;
if(sphere && pmodel != mdEquidistant && pmodel != mdEquiarea) rad /= sqrt(vid.alphax*vid.alphax - 1);
if(sphere && !mdEqui()) rad /= sqrt(vid.alphax*vid.alphax - 1);
for(int v=0; v<4; v++) sumaura(v);
for(auto& p: auraspecials) {
@ -5054,10 +5054,10 @@ void drawfullmap() {
ptds.clear();
if(!vid.goteyes && !euclid && (pmodel == mdDisk || pmodel == mdBall || (sphere && (pmodel == mdEquidistant || pmodel == mdEquiarea)))) {
if(!vid.goteyes && !euclid && (pmodel == mdDisk || pmodel == mdBall || (sphere && mdEqui()))) {
double rad = vid.radius;
if(sphere) {
if(pmodel == mdEquidistant || pmodel == mdEquiarea)
if(mdEqui())
;
else if(!vid.grid && !elliptic)
rad = 0;

View File

@ -1297,6 +1297,8 @@ void drawShape(pair<ld,ld>* coords, int qty, int color);
extern eModel pmodel;
inline bool mdEqui() { return pmodel == mdEquidistant || pmodel == mdEquiarea; }
int darkena(int c, int lev, int a);
#define SHSIZE 16

View File

@ -150,7 +150,7 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
H = H / zlev;
}
if(pmodel == mdEquidistant || pmodel == mdEquiarea) {
if(mdEqui()) {
ld rad = sqrt(H[0] * H[0] + H[1] * H[1]);
ld d = hdist0(H);
@ -166,6 +166,7 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
if(zlev != 1 && vid.goteyes)
ret[2] = geom3::factor_to_lev(zlev);
ghcheck(ret,H);
return;
}

View File

@ -521,7 +521,7 @@ void drawpolyline(polytodraw& p) {
return; // too large!
}
if((spherespecial > 0 || pmodel == mdEquidistant || pmodel == mdEquiarea) && !(poly_flags & POLY_ISSIDE)) {
if((spherespecial > 0 || (sphere && mdEqui())) && !(poly_flags & POLY_ISSIDE)) {
double rarea = 0;
for(int i=0; i<qglcoords-1; i++)
rarea += glcoords[i][0] * glcoords[i+1][1] - glcoords[i][1] * glcoords[i+1][0];
@ -551,7 +551,7 @@ void drawpolyline(polytodraw& p) {
lastl = l;
}
if((pmodel == mdEquidistant || pmodel == mdEquiarea) && (poly_flags & POLY_INVERSE)) {
if(mdEqui() && (poly_flags & POLY_INVERSE)) {
ld h = atan2(glcoords[0][0], glcoords[0][1]);
for(int i=0; i<=360; i++) {
ld a = i * M_PI / 180 + h;