1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 13:07:16 +00:00

split namespace conformal into models and history

This commit is contained in:
Zeno Rogue 2019-08-10 00:58:50 +02:00
parent 6ed530c50c
commit 5ea055b39e
25 changed files with 999 additions and 1630 deletions

View File

@ -193,9 +193,9 @@ void eyewidth_translate(int ed) {
glhr::glmatrix model_orientation_gl() {
glhr::glmatrix s = glhr::id;
for(int a=0; a<DIM; a++)
conformal::apply_orientation(s[a][1], s[a][0]);
models::apply_orientation(s[a][1], s[a][0]);
if(DIM == 3) for(int a=0; a<DIM; a++)
conformal::apply_orientation_yz(s[a][2], s[a][1]);
models::apply_orientation_yz(s[a][2], s[a][1]);
return s;
}
@ -344,8 +344,8 @@ void display_data::set_projection(int ed) {
}
else if(DIM == 3) {
glhr::glmatrix M = glhr::ortho(cd->xsize/current_display->radius/2, -cd->ysize/current_display->radius/2, 1);
using conformal::clip_max;
using conformal::clip_min;
using models::clip_max;
using models::clip_min;
M[2][2] = 2 / (clip_max - clip_min);
M[3][2] = (clip_min + clip_max) / (clip_max - clip_min);
glhr::projection_multiply(M);
@ -382,7 +382,7 @@ void display_data::set_projection(int ed) {
glhr::projection_multiply(model_orientation_gl());
glhr::projection_multiply(glhr::translate(0, 1, 0));
glhr::projection_multiply(glhr::scale(-1, 1, 1));
glhr::projection_multiply(glhr::scale(conformal::halfplane_scale, conformal::halfplane_scale, DIM == 3 ? conformal::halfplane_scale : 1));
glhr::projection_multiply(glhr::scale(models::halfplane_scale, models::halfplane_scale, DIM == 3 ? models::halfplane_scale : 1));
glhr::projection_multiply(glhr::translate(0, 0.5, 0));
}
}

View File

@ -574,7 +574,7 @@ vector<geometryinfo> ginf = {
#define X3(x) x, x, x
const modelinfo models[int(mdPolynomial)+1] = {
const modelinfo mdinf[int(mdPolynomial)+1] = {
{"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal},
{"half-plane", "inversion", "half-plane", mf::conformal},
{"band", "band", "Mercator", mf::band | mf::conformal},

View File

@ -306,6 +306,6 @@ struct modelinfo {
const char* name;
};
extern const modelinfo models[int(mdPolynomial)+1];
extern const modelinfo mdinf[int(mdPolynomial)+1];
}

View File

@ -98,7 +98,8 @@ namespace hr { namespace inv { bool on, activating; } }
#include "racing.cpp"
#endif
#include "conformal.cpp"
#include "models.cpp"
#include "history.cpp"
#include "rug.cpp"
#include "control.cpp"
#include "hud.cpp"

View File

@ -2472,7 +2472,7 @@ namespace dragon {
c = c->move(i); goto findhead;
}
if(cmode & sm::MAP) return c;
if(!conformal::includeHistory) {
if(!history::includeHistory) {
printf("dragon bug #3 (%p -> %p)\n", cor, c);
dragbugs = true;
}
@ -2543,7 +2543,7 @@ namespace dragon {
int maxlen = 1000;
while(maxlen-->0) {
if(!isDragon(c->monst)) {
if(!conformal::includeHistory) printf("dragon bug #4\n");
if(!history::includeHistory) printf("dragon bug #4\n");
return total;
}
total += c->hitpoints;
@ -2583,7 +2583,7 @@ namespace dragon {
if(c->mondir == NODIR) { printf("dragon bug\n"); break; }
c = c->move(c->mondir);
if(!c) {
if(!conformal::includeHistory) printf("dragon bug #2\n");
if(!history::includeHistory) printf("dragon bug #2\n");
break;
}
}

View File

@ -241,9 +241,9 @@ EX void initConfig() {
addsaver(polygonal::SI, "polygon sides");
addsaver(polygonal::STAR, "polygon star factor");
addsaver(polygonal::deg, "polygonal degree");
addsaver(conformal::autobandhistory, "include history"); // check!
addsaver(conformal::lvspeed, "lineview speed");
addsaver(conformal::extra_line_steps, "lineview extension");
addsaver(history::autobandhistory, "include history"); // check!
addsaver(history::lvspeed, "lineview speed");
addsaver(history::extra_line_steps, "lineview extension");
addsaver(polygonal::maxcoef, "polynomial degree");
for(int i=0; i<polygonal::MSI; i++) {
@ -251,22 +251,22 @@ EX void initConfig() {
addsaver(polygonal::coefi[i], "polynomial "+its(i)+".imag");
}
addsaver(conformal::bandhalf, "band width");
addsaver(conformal::bandsegment, "band segment");
addsaver(conformal::rotation, "conformal rotation");
addsaver(conformal::rotation_xz, "conformal rotation_xz");
addsaver(conformal::rotation_xy2, "conformal rotation_2");
addsaver(conformal::do_rotate, "conformal rotation mode", 1);
addsaver(conformal::model_orientation, "model orientation", 0);
addsaver(conformal::model_orientation_yz, "model orientation-yz", 0);
addsaver(conformal::top_z, "topz", 5);
addsaver(conformal::model_transition, "model transition", 1);
addsaver(conformal::halfplane_scale, "halfplane scale", 1);
addsaver(conformal::autoband, "automatic band");
addsaver(conformal::autobandhistory, "automatic band history");
addsaver(conformal::dospiral, "do spiral");
addsaver(conformal::clip_min, "clip-min", -1);
addsaver(conformal::clip_max, "clip-max", +1);
addsaver(history::bandhalf, "band width");
addsaver(history::bandsegment, "band segment");
addsaver(models::rotation, "conformal rotation");
addsaver(models::rotation_xz, "conformal rotation_xz");
addsaver(models::rotation_xy2, "conformal rotation_2");
addsaver(models::do_rotate, "conformal rotation mode", 1);
addsaver(models::model_orientation, "model orientation", 0);
addsaver(models::model_orientation_yz, "model orientation-yz", 0);
addsaver(models::top_z, "topz", 5);
addsaver(models::model_transition, "model transition", 1);
addsaver(models::halfplane_scale, "halfplane scale", 1);
addsaver(history::autoband, "automatic band");
addsaver(history::autobandhistory, "automatic band history");
addsaver(history::dospiral, "do spiral");
addsaver(models::clip_min, "clip-min", -1);
addsaver(models::clip_max, "clip-max", +1);
addsaver(vid.backeffects, "background particle effects", (ISMOBILE || ISPANDORA) ? false : true);
// control
@ -399,9 +399,9 @@ EX void initConfig() {
addsaver(vid.skiprope, "mobius", 0);
addsaver(conformal::formula, "formula");
addsaverenum(conformal::basic_model, "basic model");
addsaver(conformal::use_atan, "use_atan");
addsaver(models::formula, "formula");
addsaverenum(models::basic_model, "basic model");
addsaver(models::use_atan, "use_atan");
for(int i=0; i<isize(ginf); i++) {
if(ginf[i].flags & qELLIPTIC)
@ -1600,7 +1600,7 @@ EX void show3D() {
else if(uni == 'b')
config_camera_rotation();
else if(uni == 'M')
pushScreen(conformal::model_menu);
pushScreen(models::model_menu);
else if(doexiton(sym, uni))
popScreen();
};
@ -1972,7 +1972,7 @@ EX void showSettings() {
dialog::add_action_push(showGraphQuickKeys);
dialog::addItem(XLAT("models & projections"), 'p');
dialog::add_action_push(conformal::model_menu);
dialog::add_action_push(models::model_menu);
dialog::addItem(XLAT("colors & aura"), 'c');
dialog::add_action_push(show_color_dialog);
@ -2239,15 +2239,15 @@ EX unordered_map<string, ld&> params = {
{"rug_model_distance", rug::model_distance},
#endif
{"star", polygonal::STAR},
{"lvspeed", conformal::lvspeed},
{"rotation", conformal::rotation},
{"mori", conformal::model_orientation},
{"mori_yz", conformal::model_orientation_yz},
{"clipmin", conformal::clip_min},
{"clipmax", conformal::clip_max},
{"topz", conformal::top_z},
{"mtrans", conformal::model_transition},
{"hp", conformal::halfplane_scale},
{"lvspeed", history::lvspeed},
{"rotation", models::rotation},
{"mori", models::model_orientation},
{"mori_yz", models::model_orientation_yz},
{"clipmin", models::clip_min},
{"clipmax", models::clip_max},
{"topz", models::top_z},
{"mtrans", models::model_transition},
{"hp", models::halfplane_scale},
{"back", backbrightness},
{"ipd", vid.ipd},
{"lr", vid.lr_eyewidth},
@ -2268,9 +2268,9 @@ EX unordered_map<string, ld&> params = {
{"b", anims::b},
#endif
{"mobius", vid.skiprope},
{"sang", conformal::spiral_angle},
{"spiralx", conformal::spiral_x},
{"spiraly", conformal::spiral_y},
{"sang", models::spiral_angle},
{"spiralx", models::spiral_x},
{"spiraly", models::spiral_y},
#if CAP_CRYSTAL
{"cprob", crystal::compass_probability},
#endif

View File

@ -296,32 +296,32 @@ EX void handlePanning(int sym, int uni) {
View = solmul(cpush(2, +0.2*shiftmul), View), didsomething = true, playermoved = false;
}
if(sym == SDLK_RIGHT) {
if(conformal::on)
conformal::lvspeed += 0.1 * shiftmul;
if(history::on)
history::lvspeed += 0.1 * shiftmul;
else if(DIM == 3)
View = cspin(0, 2, -0.2*shiftmul) * View, didsomething = true;
else
View = xpush(-0.2*shiftmul) * View, playermoved = false, didsomething = true;
}
if(sym == SDLK_LEFT) {
if(conformal::on)
conformal::lvspeed -= 0.1 * shiftmul;
if(history::on)
history::lvspeed -= 0.1 * shiftmul;
else if(DIM == 3)
View = cspin(0, 2, 0.2*shiftmul) * View, didsomething = true;
else
View = xpush(+0.2*shiftmul) * View, playermoved = false, didsomething = true;
}
if(sym == SDLK_UP) {
if(conformal::on)
conformal::lvspeed += 0.1 * shiftmul;
if(history::on)
history::lvspeed += 0.1 * shiftmul;
else if(DIM == 3)
View = cspin(1, 2, 0.2*shiftmul) * View, didsomething = true;
else
View = ypush(+0.2*shiftmul) * View, playermoved = false, didsomething = true;
}
if(sym == SDLK_DOWN) {
if(conformal::on)
conformal::lvspeed -= 0.1 * shiftmul;
if(history::on)
history::lvspeed -= 0.1 * shiftmul;
else if(DIM == 3)
View = cspin(1, 2, -0.2*shiftmul) * View, didsomething = true;
else
@ -329,14 +329,14 @@ EX void handlePanning(int sym, int uni) {
}
#endif
if(sym == SDLK_PAGEUP) {
if(conformal::on)
conformal::rotation++;
if(history::on)
models::rotation++;
else
View = spin(M_PI/cgi.S21/2*shiftmul) * View, didsomething = true;
}
if(sym == SDLK_PAGEDOWN) {
if(conformal::on)
conformal::rotation++;
if(history::on)
models::rotation++;
else
View = spin(-M_PI/cgi.S21/2*shiftmul) * View, didsomething = true;
}
@ -563,7 +563,7 @@ EX void mainloopiter() {
optimizeview();
conformal::configure();
models::configure();
lastt = ticks;
ticks = SDL_GetTicks();
@ -689,14 +689,14 @@ EX void mainloopiter() {
if(keystate[SDLK_DOWN] && DEFAULTNOR(SDLK_DOWN))
View = (DIM == 2 ? ypush(-t) : cspin(1, 2, -t)) * View, didsomething = true, playermoved = playermoved && DIM == 3;
if(keystate[SDLK_PAGEUP] && DEFAULTNOR(SDLK_PAGEUP)) {
if(conformal::on)
conformal::rotation+=t;
if(history::on)
models::rotation+=t;
else
View = spin(t) * View, didsomething = true;
}
if(keystate[SDLK_PAGEDOWN] && DEFAULTNOR(SDLK_PAGEDOWN)) {
if(conformal::on)
conformal::rotation-=t;
if(history::on)
models::rotation-=t;
else
View = spin(-t) * View, didsomething = true;
}

View File

@ -177,7 +177,7 @@ EX bool two_sided_model() {
if(pmodel == mdDisk) return sphere;
if(pmodel == mdHemisphere) return true;
if(pmodel == mdRotatedHyperboles) return true;
if(pmodel == mdSpiral && conformal::spiral_cone < 360) return true;
if(pmodel == mdSpiral && models::spiral_cone < 360) return true;
return false;
}
@ -190,15 +190,15 @@ EX int get_side(const hyperpoint& H) {
if(pmodel == mdRotatedHyperboles)
return H[1] > 0 ? -1 : 1;
if(pmodel == mdHyperboloid && hyperbolic)
return (conformal::sin_ball * H[2] > -conformal::cos_ball * H[1]) ? -1 : 1;
return (models::sin_ball * H[2] > -models::cos_ball * H[1]) ? -1 : 1;
if(pmodel == mdHyperboloid && sphere)
return (conformal::sin_ball * H[2] > conformal::cos_ball * H[1]) ? -1 : 1;
return (models::sin_ball * H[2] > models::cos_ball * H[1]) ? -1 : 1;
if(pmodel == mdHemisphere) {
hyperpoint res;
applymodel(H, res);
return res[2] < 0 ? -1 : 1;
}
if(pmodel == mdSpiral && conformal::spiral_cone < 360) {
if(pmodel == mdSpiral && models::spiral_cone < 360) {
return cone_side(H);
}
return 0;
@ -278,7 +278,7 @@ void addpoint(const hyperpoint& H) {
else {
Hscr[0] *= z;
Hscr[1] *= z * vid.stretch;
Hscr[2] = 1 - 2 * (-Hscr[2] - conformal::clip_min) / (conformal::clip_max - conformal::clip_min);
Hscr[2] = 1 - 2 * (-Hscr[2] - models::clip_min) / (models::clip_max - models::clip_min);
}
add1(Hscr);
}
@ -453,11 +453,11 @@ void glapplymatrix(const transmatrix& V) {
if(vid.stretch != 1) mat[1] *= vid.stretch, mat[5] *= vid.stretch, mat[9] *= vid.stretch, mat[13] *= vid.stretch;
if(conformal::model_has_orientation()) {
if(models::model_has_orientation()) {
if(DIM == 3) for(int a=0; a<4; a++)
conformal::apply_orientation_yz(mat[a*4+1], mat[a*4+2]);
models::apply_orientation_yz(mat[a*4+1], mat[a*4+2]);
for(int a=0; a<4; a++)
conformal::apply_orientation(mat[a*4], mat[a*4+1]);
models::apply_orientation(mat[a*4], mat[a*4+1]);
}
glhr::set_modelview(glhr::as_glmatrix(mat));
@ -633,9 +633,9 @@ void fixMercator(bool tinf) {
else
mercator_period = 2 * current_display->radius;
if(!conformal::model_straight)
if(!models::model_straight)
for(auto& g: glcoords)
conformal::apply_orientation(g[0], g[1]);
models::apply_orientation(g[0], g[1]);
if(pmodel == mdSinusoidal)
for(int i = 0; i<isize(glcoords); i++)
@ -697,9 +697,9 @@ void fixMercator(bool tinf) {
if(pmodel == mdSinusoidal)
for(int i = 0; i<isize(glcoords); i++)
glcoords[i][mercator_coord] *= cos(glcoords[i][1] / current_display->radius / vid.stretch * M_PI);
if(!conformal::model_straight)
if(!models::model_straight)
for(auto& g: glcoords)
conformal::apply_orientation(g[1], g[0]);
models::apply_orientation(g[1], g[0]);
}
else {
if(tinf) {
@ -733,9 +733,9 @@ void fixMercator(bool tinf) {
auto& v = glcoords[isize(glcoords)-u][1-mercator_coord];
v = v < 0 ? dmin : dmax;
}
if(!conformal::model_straight)
if(!models::model_straight)
for(auto& g: glcoords)
conformal::apply_orientation(g[1], g[0]);
models::apply_orientation(g[1], g[0]);
/* printf("cycling %d -> %d\n", base, qglcoords);
for(int a=0; a<qglcoords; a++)
printf("[%3d] %10.5lf %10.5lf\n", a, glcoords[a][0], glcoords[a][1]); */
@ -899,8 +899,8 @@ void dqi_poly::draw() {
hyperpoint h2 = V * glhr::gltopoint((*tab)[offset+(i+1)%cnt]);
hyperpoint ah1 = h1, ah2 = h2;
conformal::apply_orientation(ah1[0], ah1[1]);
conformal::apply_orientation(ah2[0], ah2[1]);
models::apply_orientation(ah1[0], ah1[1]);
models::apply_orientation(ah2[0], ah2[1]);
if(ah1[1] * ah2[1] > 0) continue;
ld c1 = ah1[1], c2 = -ah2[1];
if(c1 < 0) c1 = -c1, c2 = -c2;
@ -1034,11 +1034,11 @@ void dqi_poly::draw() {
for(int i=0; i<isize(glcoords); i++) {
if(pmodel == mdSinusoidal) {
ld y = glcoords[i][1], x = glcoords[i][0];
conformal::apply_orientation(x, y);
models::apply_orientation(x, y);
mercator_period = 2 * current_display->radius * cos(y / current_display->radius / vid.stretch * M_PI);
}
glcoords[i][mercator_coord] += conformal::ocos * mercator_period * (l - lastl);
glcoords[i][1-mercator_coord] += conformal::osin * mercator_period * (l - lastl);
glcoords[i][mercator_coord] += models::ocos * mercator_period * (l - lastl);
glcoords[i][1-mercator_coord] += models::osin * mercator_period * (l - lastl);
}
lastl = l;
}

View File

@ -2144,7 +2144,7 @@ EX void killMonster(cell *c, eMonster who, flagtype deathflags IS(0)) {
#ifdef HASLINEVIEW
if(!isBug(m) && !isAnyIvy(m)) {
conformal::killhistory.push_back(make_pair(c,m));
history::killhistory.push_back(make_pair(c,m));
}
#endif
@ -7289,7 +7289,7 @@ EX bool collectItem(cell *c2, bool telekinesis IS(false)) {
#ifdef HASLINEVIEW
// temporary variable to avoid the "cannot bind bitfield" problem in C++11
eItem dummy = c2->item;
conformal::findhistory.emplace_back(c2, dummy);
history::findhistory.emplace_back(c2, dummy);
#endif
if(c2->item == itBombEgg && c2->land == laMinefield) {
@ -7779,7 +7779,7 @@ EX void monstersTurn() {
#ifdef HASLINEVIEW
for(int i=0; i<numplayers(); i++)
if(multi::playerActive(i))
conformal::movehistory.push_back(playerpos(i));
history::movehistory.push_back(playerpos(i));
#endif
}
@ -8626,7 +8626,7 @@ EX void moveItem (cell *from, cell *to, bool activateYendor) {
}
EX void fixWormBug(cell *c) {
if(conformal::includeHistory) return;
if(history::includeHistory) return;
printf("worm bug!\n");
if(c->monst == moWormtail) c->monst = moWormwait;
if(c->monst == moTentacletail || c->monst == moTentacleGhost) c->monst = moTentacle;

View File

@ -449,7 +449,7 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
string current_proj_name() {
if(pmodel != mdDisk || nonisotropic)
return conformal::get_model_name(pmodel);
return models::get_model_name(pmodel);
else if(hyperbolic && vid.alpha == 1)
return XLAT("Poincaré model");
else if(hyperbolic && vid.alpha == 0)
@ -724,7 +724,7 @@ EX void showEuclideanMenu() {
dialog::add_action_push(show3D);
}
dialog::addSelItem(XLAT("projection"), current_proj_name(), '1');
dialog::add_action_push(conformal::model_menu);
dialog::add_action_push(models::model_menu);
if(nonisotropic)
dialog::addBoolItem_action(XLAT("geodesic movement in Sol/Nil"), nisot::geodesic_movement, 'G');
#if CAP_CRYSTAL && MAXMDIM >= 4

View File

@ -393,7 +393,7 @@ EX void switch_always3() {
if(rug::rugged) rug::close();
if(dual::split(switch_fpp)) return;
check_cgi(); cgi.require_basics();
View = inverse(conformal::rotmatrix()) * View;
View = inverse(models::rotmatrix()) * View;
if(!vid.always3) {
vid.always3 = true;
ld ms = min<ld>(cgi.scalefactor, 1);
@ -425,7 +425,7 @@ EX void switch_always3() {
swapmatrix(View);
callhooks(hooks_swapdim);
}
View = conformal::rotmatrix() * View;
View = models::rotmatrix() * View;
#endif
}

View File

@ -865,7 +865,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int
if(DIM == 3 && c && it != itBabyTortoise) Vit = face_the_player(Vit);
// V * cspin(0, 2, ptick(618, 0));
if(c && conformal::includeHistory && conformal::infindhistory.count(c)) poly_outline = OUTLINE_DEAD;
if(c && history::includeHistory && history::infindhistory.count(c)) poly_outline = OUTLINE_DEAD;
if(!mmitem && it) return true;
@ -2399,7 +2399,7 @@ EX bool dont_face_pc = false;
bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool mirrored, color_t asciicol) {
#if CAP_SHAPES
bool darkhistory = conformal::includeHistory && conformal::inkillhistory.count(c);
bool darkhistory = history::includeHistory && history::inkillhistory.count(c);
if(doHighlight())
poly_outline =
@ -2481,7 +2481,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m
}
else {
if(c->monst == moTentacleGhost) {
hyperpoint V0 = conformal::on ? tC0(Vs) : inverse(cwtV) * tC0(Vs);
hyperpoint V0 = history::on ? tC0(Vs) : inverse(cwtV) * tC0(Vs);
hyperpoint V1 = spintox(V0) * V0;
Vs = cwtV * rspintox(V0) * rpushxto0(V1) * pispin;
drawMonsterType(moGhost, c, Vs, col, footphase, asciicol);
@ -2734,7 +2734,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m
// golems, knights, and hyperbugs don't face the player (mondir-controlled)
// also whatever in the lineview mode, and whatever in the quotient geometry
else if((hasFacing(c) && c->mondir != NODIR) || conformal::on || quotient || euwrap || dont_face_pc) {
else if((hasFacing(c) && c->mondir != NODIR) || history::on || quotient || euwrap || dont_face_pc) {
if(c->monst == moKrakenH) Vs = Vb, nospins = nospinb;
if(!nospins && c->mondir < c->type) Vs = Vs * ddspin(c, c->mondir, M_PI);
if(c->monst == moPair) Vs = Vs * xpush(-.12);
@ -2818,7 +2818,7 @@ array<array<int,4>,AURA+1> aurac;
EX bool haveaura() {
if(!(vid.aurastr>0 && !svg::in && (auraNOGL || vid.usingGL))) return false;
if(sphere && mdAzimuthalEqui()) return true;
if(among(pmodel, mdJoukowsky, mdJoukowskyInverted) && hyperbolic && conformal::model_transition < 1)
if(among(pmodel, mdJoukowsky, mdJoukowskyInverted) && hyperbolic && models::model_transition < 1)
return true;
return pmodel == mdDisk && (!sphere || vid.alpha > 10) && !euclid;
}
@ -2836,7 +2836,7 @@ EX void clearaura() {
}
void apply_joukowsky_aura(hyperpoint& h) {
bool joukowsky = among(pmodel, mdJoukowskyInverted, mdJoukowsky) && hyperbolic && conformal::model_transition < 1;
bool joukowsky = among(pmodel, mdJoukowskyInverted, mdJoukowsky) && hyperbolic && models::model_transition < 1;
if(joukowsky) {
hyperpoint ret;
applymodel(h, ret);
@ -2958,7 +2958,7 @@ void drawaura() {
cmul[1] = cmul[0];
bool inversion = vid.alpha <= -1 || pmodel == mdJoukowsky;
bool joukowsky = among(pmodel, mdJoukowskyInverted, mdJoukowsky) && hyperbolic && conformal::model_transition < 1;
bool joukowsky = among(pmodel, mdJoukowskyInverted, mdJoukowsky) && hyperbolic && models::model_transition < 1;
for(int r=0; r<=AURA; r++) for(int z=0; z<11; z++) {
float rr = (M_PI * 2 * r) / AURA;
@ -2970,11 +2970,11 @@ void drawaura() {
if(joukowsky) {
ld c1 = c, s1 = s;
if(inversion)
conformal::apply_orientation(s1, c1);
models::apply_orientation(s1, c1);
else
conformal::apply_orientation(c1, s1);
models::apply_orientation(c1, s1);
ld& mt = conformal::model_transition;
ld& mt = models::model_transition;
ld mt2 = 1 - mt;
ld m = sqrt(c1*c1 + s1*s1 / mt2 / mt2);
@ -3743,7 +3743,7 @@ void setcolors(cell *c, color_t& wcol, color_t& fcol) {
}
case waFloorA: case waFloorB: // isAlch
if(c->item && !(conformal::includeHistory && conformal::infindhistory.count(c)))
if(c->item && !(history::includeHistory && history::infindhistory.count(c)))
fcol = wcol = iinf[c->item].color;
else
fcol = wcol;
@ -5086,7 +5086,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
viewBuggyCells(c,V);
#endif
if(conformal::on || inHighQual || WDIM == 3 || sightrange_bonus > gamerange_bonus) checkTide(c);
if(history::on || inHighQual || WDIM == 3 || sightrange_bonus > gamerange_bonus) checkTide(c);
// save the player's view center
if(isPlayerOn(c) && !shmup::on) {
@ -5252,7 +5252,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
bool hidden = itemHidden(c);
bool hiddens = itemHiddenFromSight(c);
if(conformal::includeHistory && conformal::infindhistory.count(c)) {
if(history::includeHistory && history::infindhistory.count(c)) {
hidden = true;
hiddens = false;
}
@ -5956,7 +5956,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
queuepoly((*Vdp), cgi.shHeptaMarker, wmblack ? 0x80808080 : 0x00000080);
}
if(conformal::includeHistory && conformal::inmovehistory.count(c))
if(history::includeHistory && history::inmovehistory.count(c))
queuepoly((*Vdp), cgi.shHeptaMarker, 0x000000C0);
char xch = winf[c->wall].glyph;
@ -6620,7 +6620,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
if(0);
#if CAP_BT
else if(binarytiling && conformal::do_rotate >= 2) {
else if(binarytiling && models::do_rotate >= 2) {
if(!straightDownSeek || c->master->distance < straightDownSeek->master->distance) {
usethis = true;
spd = 1;
@ -6631,7 +6631,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
else if(isGravityLand(cwt.at->land) && cwt.at->land != laMountain) {
if(cwt.at->land == laDungeon) side = 2;
if(cwt.at->land == laWestWall) side = 1;
if(conformal::do_rotate >= 1)
if(models::do_rotate >= 1)
if(!straightDownSeek || edgeDepth(c) < edgeDepth(straightDownSeek)) {
usethis = true;
spd = cwt.at->landparam / 10.;
@ -6639,8 +6639,8 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
}
else if(c->master->alt && cwt.at->master->alt &&
((cwt.at->land == laMountain && conformal::do_rotate >= 1)||
(conformal::do_rotate >= 2 &&
((cwt.at->land == laMountain && models::do_rotate >= 1)||
(models::do_rotate >= 2 &&
(cwt.at->land == laTemple || cwt.at->land == laWhirlpool ||
(cheater && (cwt.at->land == laClearing || cwt.at->land == laCaribbean ||
cwt.at->land == laCamelot || cwt.at->land == laPalace)))
@ -6653,7 +6653,7 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
}
}
else if(conformal::do_rotate >= 2 && cwt.at->land == laOcean && cwt.at->landparam < 25) {
else if(models::do_rotate >= 2 && cwt.at->land == laOcean && cwt.at->landparam < 25) {
if(!straightDownSeek || coastval(c, laOcean) < coastval(straightDownSeek, laOcean)) {
usethis = true;
spd = cwt.at->landparam / 10;
@ -7500,9 +7500,9 @@ EX void drawfullmap() {
/*
if(conformal::on) {
if(models::on) {
char ch = 'A';
for(auto& v: conformal::v) {
for(auto& v: history::v) {
queuepoly(ggmatrix(v->base) * v->at, cgi.shTriangle, 0x306090C0);
queuechr(ggmatrix(v->base) * v->at * C0, 10, ch++, 0xFF0000);
}
@ -7587,7 +7587,7 @@ EX void gamescreen(int _darken) {
darken = _darken;
if(conformal::includeHistory) conformal::restore();
if(history::includeHistory) history::restore();
anims::apply();
#if CAP_RUG
@ -7598,7 +7598,7 @@ EX void gamescreen(int _darken) {
wrap_drawfullmap();
anims::rollback();
if(conformal::includeHistory) conformal::restoreBack();
if(history::includeHistory) history::restoreBack();
poly_outline = OUTLINE_DEFAULT;

View File

@ -109,7 +109,7 @@ void ballmodel(hyperpoint& ret, double alpha, double d, double zl) {
ret[1] = ay;
ret[2] = ax * sa;
conformal::apply_ball(ret[2], ret[1]);
models::apply_ball(ret[2], ret[1]);
}
void apply_depth(hyperpoint &f, ld z) {
@ -189,8 +189,8 @@ void move_y_to_z(hyperpoint& H, pair<ld, ld> coef) {
template<class T> void makeband(hyperpoint H, hyperpoint& ret, const T& f) {
ld zlev = find_zlev(H);
conformal::apply_orientation_yz(H[1], H[2]);
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation_yz(H[1], H[2]);
models::apply_orientation(H[0], H[1]);
auto r = move_z_to_y(H);
ld x, y, yf, zf=0;
@ -208,8 +208,8 @@ template<class T> void makeband(hyperpoint H, hyperpoint& ret, const T& f) {
ld yzf = y * zf; y *= yf;
ret = hpxyz(x / M_PI, y / M_PI, 0);
move_y_to_z(ret, r);
conformal::apply_orientation(ret[1], ret[0]);
conformal::apply_orientation_yz(ret[2], ret[1]);
models::apply_orientation(ret[1], ret[0]);
models::apply_orientation_yz(ret[2], ret[1]);
if(zlev != 1 && current_display->stereo_active())
apply_depth(ret, yzf / M_PI);
return;
@ -383,8 +383,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ld zlev = find_zlev(H);
H = space_to_perspective(H);
conformal::apply_orientation_yz(H[1], H[2]);
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation_yz(H[1], H[2]);
models::apply_orientation(H[0], H[1]);
H[1] += 1;
double rad = sqhypot_d(DIM, H);
@ -393,30 +393,30 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
if(DIM == 3) {
// a bit simpler when we do not care about 3D
H *= conformal::halfplane_scale;
H *= models::halfplane_scale;
ret[0] = -H[0];
ret[1] = 1 + H[1];
ret[2] = H[2];
ret[3] = 1;
conformal::apply_orientation(ret[1], ret[0]);
conformal::apply_orientation_yz(ret[2], ret[1]);
models::apply_orientation(ret[1], ret[0]);
models::apply_orientation_yz(ret[2], ret[1]);
break;
}
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation(H[0], H[1]);
H *= conformal::halfplane_scale;
H *= models::halfplane_scale;
ret[0] = -conformal::osin - H[0];
ret[0] = -models::osin - H[0];
if(zlev != 1) {
if(abs(conformal::ocos) > 1e-5)
H[1] = H[1] * pow(zlev, conformal::ocos);
if(abs(conformal::ocos) > 1e-5 && conformal::osin)
H[1] += H[0] * conformal::osin * (pow(zlev, conformal::ocos) - 1) / conformal::ocos;
else if(conformal::osin)
H[1] += H[0] * conformal::osin * log(zlev);
if(abs(models::ocos) > 1e-5)
H[1] = H[1] * pow(zlev, models::ocos);
if(abs(models::ocos) > 1e-5 && models::osin)
H[1] += H[0] * models::osin * (pow(zlev, models::ocos) - 1) / models::ocos;
else if(models::osin)
H[1] += H[0] * models::osin * log(zlev);
}
ret[1] = conformal::ocos + H[1];
ret[1] = models::ocos + H[1];
ret[2] = DIM == 3 ? H[2] : 0;
if(MAXMDIM == 4) ret[3] = 1;
if(zlev != 1 && current_display->stereo_active())
@ -457,7 +457,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
swap(ret[1], ret[2]);
conformal::apply_ball(ret[2], ret[1]);
models::apply_ball(ret[2], ret[1]);
break;
}
@ -466,7 +466,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
case mdHyperboloid: {
if(pmodel == mdHyperboloid) {
ld& topz = conformal::top_z;
ld& topz = models::top_z;
if(H[2] > topz) {
ld scale = sqrt(topz*topz-1) / hypot_d(2, H);
H *= scale;
@ -482,7 +482,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[1] = (1 - H[2]) / 3;
ret[2] = H[1] / 3;
conformal::apply_ball(ret[2], ret[1]);
models::apply_ball(ret[2], ret[1]);
break;
}
@ -496,8 +496,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
}
case mdSimulatedPerspective: {
conformal::apply_orientation_yz(H[1], H[2]);
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation_yz(H[1], H[2]);
models::apply_orientation(H[0], H[1]);
auto yz = move_z_to_y(H);
hyperpoint Hl = xpush(-vid.twopoint_param) * H;
hyperpoint Hr = xpush(+vid.twopoint_param) * H;
@ -514,29 +514,29 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[2] = 0;
move_y_to_z(ret, yz);
conformal::apply_orientation(ret[0], ret[1]);
conformal::apply_orientation_yz(ret[2], ret[1]);
models::apply_orientation(ret[0], ret[1]);
models::apply_orientation_yz(ret[2], ret[1]);
break;
}
case mdTwoHybrid: {
conformal::apply_orientation_yz(H[1], H[2]);
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation_yz(H[1], H[2]);
models::apply_orientation(H[0], H[1]);
auto yz = move_z_to_y(H);
ret = compute_hybrid(H, whateveri[0]);
move_y_to_z(ret, yz);
conformal::apply_orientation(ret[0], ret[1]);
conformal::apply_orientation_yz(ret[2], ret[1]);
models::apply_orientation(ret[0], ret[1]);
models::apply_orientation_yz(ret[2], ret[1]);
break;
}
case mdJoukowsky:
case mdJoukowskyInverted: {
conformal::apply_orientation_yz(H[1], H[2]);
conformal::apply_orientation(H[0], H[1]);
// with equal speed skiprope: conformal::apply_orientation(H[1], H[0]);
models::apply_orientation_yz(H[1], H[2]);
models::apply_orientation(H[0], H[1]);
// with equal speed skiprope: models::apply_orientation(H[1], H[0]);
if(vid.skiprope) {
static ld last_skiprope = 0;
@ -563,7 +563,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ld r = hypot_d(2, H);
ld c = H[0] / r;
ld s = H[1] / r;
ld& mt = conformal::model_transition;
ld& mt = models::model_transition;
ld a = 1 - .5 * mt, b = .5 * mt;
swap(a, b);
@ -579,7 +579,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[0] = ret[0] / r2;
ret[1] = -ret[1] / r2;
move_y_to_z(ret, yz);
conformal::apply_orientation(ret[1], ret[0]);
models::apply_orientation(ret[1], ret[0]);
/*
@ -593,9 +593,9 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
}
else {
move_y_to_z(ret, yz);
conformal::apply_orientation(ret[0], ret[1]);
models::apply_orientation(ret[0], ret[1]);
}
conformal::apply_orientation_yz(ret[2], ret[1]);
models::apply_orientation_yz(ret[2], ret[1]);
break;
}
@ -604,11 +604,11 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
H = space_to_perspective(H);
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation(H[0], H[1]);
pair<long double, long double> p = polygonal::compute(H[0], H[1]);
conformal::apply_orientation(p.second, p.first);
models::apply_orientation(p.second, p.first);
ret[0] = p.first;
ret[1] = p.second;
ret[2] = 0;
@ -616,12 +616,12 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
}
case mdBand:
if(conformal::model_transition != 1) {
ld& mt = conformal::model_transition;
if(models::model_transition != 1) {
ld& mt = models::model_transition;
H = space_to_perspective(H);
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation(H[0], H[1]);
H[0] += 1;
double rad = H[0]*H[0] + H[1]*H[1];
@ -642,7 +642,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[0] /= -(1-mt) * M_PI / 2;
ret[1] /= (1-mt) * M_PI / 2;
conformal::apply_orientation(ret[1], ret[0]);
models::apply_orientation(ret[1], ret[0]);
}
else
makeband(H, ret, band_conformal);
@ -694,7 +694,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
case mdRotatedHyperboles: {
// ld zlev = <- not implemented
find_zlev(H); // + vid.depth;
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation(H[0], H[1]);
ld y = asin_auto(H[1]);
ld x = asin_auto_clamp(H[0] / cos_auto(y));
@ -706,7 +706,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[1] = cosh(x) * factor;
ret[2] = 0;
if(conformal::use_atan) {
if(models::use_atan) {
ret[0] = atan(ret[0]);
ret[1] = atan(ret[1]);
}
@ -715,7 +715,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
}
case mdFormula: {
dynamicval<eModel> m(pmodel, conformal::basic_model);
dynamicval<eModel> m(pmodel, models::basic_model);
applymodel(H, ret);
exp_parser ep;
ep.extra_params["z"] = cld(ret[0], ret[1]);
@ -725,7 +725,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ep.extra_params["ux"] = H[0];
ep.extra_params["uy"] = H[1];
ep.extra_params["uz"] = H[2];
ep.s = conformal::formula;
ep.s = models::formula;
cld res = ep.parse();
ret[0] = real(res);
ret[1] = imag(res);
@ -737,18 +737,18 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
cld z;
if(hyperbolic || sphere) makeband(H, ret, band_conformal);
else ret = H;
z = cld(ret[0], ret[1]) * conformal::spiral_multiplier;
z = cld(ret[0], ret[1]) * models::spiral_multiplier;
if(conformal::spiral_cone < 360) {
ld alpha = imag(z) * 360 / conformal::spiral_cone;
if(models::spiral_cone < 360) {
ld alpha = imag(z) * 360 / models::spiral_cone;
ld r = real(z);
r = exp(r);
ret[0] = -sin(alpha) * r;
ret[1] = cos(alpha) * r;
ret[2] = (r-1) * sqrt( pow(360/conformal::spiral_cone, 2) - 1);
ret[2] = (r-1) * sqrt( pow(360/models::spiral_cone, 2) - 1);
conformal::apply_ball(ret[2], ret[1]);
models::apply_ball(ret[2], ret[1]);
}
else {
z = exp(z);
@ -923,8 +923,8 @@ EX bool in_smart_range(const transmatrix& T) {
if(y > current_display->ytop + current_display->ysize * 2) return false;
if(y < current_display->ytop - current_display->ysize * 1) return false;
if(DIM == 3) {
if(-h1[2] < conformal::clip_min * 2 - conformal::clip_max) return false;
if(-h1[2] > conformal::clip_max * 2 - conformal::clip_min) return false;
if(-h1[2] < models::clip_min * 2 - models::clip_max) return false;
if(-h1[2] > models::clip_max * 2 - models::clip_min) return false;
}
ld epsilon = 0.01;
@ -941,7 +941,7 @@ EX bool in_smart_range(const transmatrix& T) {
}
if(DIM == 3) {
if(-h1[2] + 2 * dz < conformal::clip_min || -h1[2] - 2 * dz > conformal::clip_max) return false;
if(-h1[2] + 2 * dz < models::clip_min || -h1[2] - 2 * dz > models::clip_max) return false;
sort(dh, dh+DIM);
ld scale = sqrt(dh[1] * dh[2]) * cgi.scalefactor * hcrossf7;
if(scale <= (WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3)) return false;
@ -1025,8 +1025,8 @@ bool in_multi = false;
void hrmap_standard::draw() {
if(sphere && pmodel == mdSpiral && !in_multi) {
in_multi = true;
if(conformal::ring_not_spiral) {
int qty = ceil(1. / conformal::sphere_spiral_multiplier);
if(models::ring_not_spiral) {
int qty = ceil(1. / models::sphere_spiral_multiplier);
if(qty > 100) qty = 100;
for(int i=-qty; i < qty; i++) {
band_shift = 2 * M_PI * i;
@ -1205,7 +1205,7 @@ EX void spinEdge(ld aspd) {
aspd = 999999;
if(straightDownSeek) {
if(straightDownPoint[0])
downspin = conformal::rotation * degree - atan2(straightDownPoint[0], straightDownPoint[1]);
downspin = models::rotation * degree - atan2(straightDownPoint[0], straightDownPoint[1]);
}
else {
if(View[0][2])
@ -1215,7 +1215,7 @@ EX void spinEdge(ld aspd) {
else if(straightDownSeek) {
downspin = atan2(straightDownPoint[1], straightDownPoint[0]);
downspin -= M_PI/2;
downspin += conformal::rotation * degree;
downspin += models::rotation * degree;
while(downspin < -M_PI) downspin += 2*M_PI;
while(downspin > +M_PI) downspin -= 2*M_PI;
downspin = downspin * min(straightDownSpeed, (double)1);
@ -1396,7 +1396,7 @@ void ballgeometry() {
EX void resetview() {
DEBBI(DF_GRAPH, ("reset view"));
View = conformal::rotmatrix();
View = models::rotmatrix();
// EUCLIDEAN
if(!masterless)
viewctr.at = cwt.at->master,
@ -1417,7 +1417,7 @@ EX void panning(hyperpoint hf, hyperpoint ht) {
EX int cells_drawn, cells_generated;
EX void fullcenter() {
conformal::path_for_lineanimation.clear();
history::path_for_lineanimation.clear();
if(playerfound && false) centerpc(INF);
else {
bfs();
@ -1506,8 +1506,8 @@ EX void draw_model_elements() {
hyperpoint H = xpush(p * vid.twopoint_param) * ypush0(h);
hyperpoint res = compute_hybrid(H, 2 | mode);
conformal::apply_orientation(res[0], res[1]);
conformal::apply_orientation_yz(res[2], res[1]);
models::apply_orientation(res[0], res[1]);
models::apply_orientation_yz(res[2], res[1]);
curvepoint(res * current_display->radius);
}
queuecurve(ringcolor, 0, PPR::CIRCLE);
@ -1518,7 +1518,7 @@ EX void draw_model_elements() {
}
case mdTwoPoint: case mdSimulatedPerspective: {
ld a = -conformal::model_orientation * degree;
ld a = -models::model_orientation * degree;
queuechr(xspinpush0(a, +vid.twopoint_param), vid.xres / 100, 'X', ringcolor >> 8);
queuechr(xspinpush0(a, -vid.twopoint_param), vid.xres / 100, 'X', ringcolor >> 8);
return;
@ -1537,12 +1537,12 @@ EX void draw_model_elements() {
curvepoint(point3(0,0,-vid.alpha));
queuecurve(ringcolor, 0, PPR::CIRCLE);
ld& tz = conformal::top_z;
ld& tz = models::top_z;
ld z = acosh(tz);
hyperpoint a = xpush0(z);
ld cb = conformal::cos_ball;
ld sb = conformal::sin_ball;
ld cb = models::cos_ball;
ld sb = models::sin_ball;
a[1] = sb * a[2] / -cb;
a[0] = sqrt(-1 + a[2] * a[2] - a[1] * a[1]);
@ -1639,13 +1639,13 @@ EX void draw_boundary(int w) {
ld x = sin(a * vid.twopoint_param * b / 90);
ld y = 0;
ld z = -sqrt(1 - x*x);
conformal::apply_orientation(y, x);
models::apply_orientation(y, x);
hyperpoint h1;
applymodel(hpxyz(x,y,z), h1);
conformal::apply_orientation(h1[0], h1[1]);
models::apply_orientation(h1[0], h1[1]);
h1[1] = abs(h1[1]) * b;
conformal::apply_orientation(h1[1], h1[0]);
models::apply_orientation(h1[1], h1[0]);
curvepoint(h1);
}
@ -1656,9 +1656,9 @@ EX void draw_boundary(int w) {
case mdBand: case mdBandEquidistant: case mdBandEquiarea: case mdSinusoidal: {
if(DIM == 3) return;
if(pmodel == mdBand && conformal::model_transition != 1) return;
if(pmodel == mdBand && models::model_transition != 1) return;
bool bndband = ((pmodel == mdBand) ? hyperbolic : sphere);
transmatrix T = spin(-conformal::model_orientation * degree);
transmatrix T = spin(-models::model_orientation * degree);
ld right = M_PI/2 - 1e-5;
if(bndband)
queuestraight(T * ypush0(hyperbolic ? 10 : right), 2, lc, fc, p);
@ -1682,7 +1682,7 @@ EX void draw_boundary(int w) {
case mdHalfplane:
if(hyperbolic && DIM == 2) {
queuestraight(xspinpush0(-conformal::model_orientation * degree - M_PI/2, fakeinf), 1, lc, fc, p);
queuestraight(xspinpush0(-models::model_orientation * degree - M_PI/2, fakeinf), 1, lc, fc, p);
return;
}
break;
@ -1692,7 +1692,7 @@ EX void draw_boundary(int w) {
queuereset(mdUnchanged, p);
for(int i=0; i<=360; i++) {
ld s = sin(i * degree);
curvepoint(point3(current_display->radius * cos(i * degree), current_display->radius * s * (conformal::cos_ball * s >= 0 - 1e-6 ? 1 : abs(conformal::sin_ball)), 0));
curvepoint(point3(current_display->radius * cos(i * degree), current_display->radius * s * (models::cos_ball * s >= 0 - 1e-6 ? 1 : abs(models::sin_ball)), 0));
}
queuecurve(lc, fc, p);
queuereset(pmodel, p);
@ -1701,7 +1701,7 @@ EX void draw_boundary(int w) {
for(int i=0; i<=360; i++) {
ld s = sin(i * degree);
curvepoint(point3(current_display->radius * cos(i * degree), current_display->radius * s * conformal::sin_ball, 0));
curvepoint(point3(current_display->radius * cos(i * degree), current_display->radius * s * models::sin_ball, 0));
}
queuecurve(lc, fc, p);
queuereset(pmodel, p);
@ -1719,10 +1719,10 @@ EX void draw_boundary(int w) {
case mdHyperboloid: {
if(hyperbolic) {
ld& tz = conformal::top_z;
ld& tz = models::top_z;
ld mz = acosh(tz);
ld cb = conformal::cos_ball;
ld sb = conformal::sin_ball;
ld cb = models::cos_ball;
ld sb = models::sin_ball;
if(abs(sb) <= abs(cb) + 1e-5) {
ld step = .01 / (1 << vid.linequality);
@ -1771,9 +1771,9 @@ EX void draw_boundary(int w) {
case mdSpiral: {
if(euclid) return;
if(conformal::ring_not_spiral) return;
if(models::ring_not_spiral) return;
// if(p == PPR::CIRCLE) p = PPR::OUTCIRCLE;
auto& sm = conformal::spiral_multiplier;
auto& sm = models::spiral_multiplier;
ld u = hypot(1, imag(sm) / real(sm));
if(real(sm)) {
queuereset(mdUnchanged, p);
@ -1806,10 +1806,10 @@ EX void draw_boundary(int w) {
EX ld band_shift = 0;
EX void fix_the_band(transmatrix& T) {
if(((models[pmodel].flags & mf::quasiband) && T[DIM][DIM] > 1e6) || (sphere && pmodel == mdSpiral)) {
if(((mdinf[pmodel].flags & mf::quasiband) && T[DIM][DIM] > 1e6) || (sphere && pmodel == mdSpiral)) {
hyperpoint H = tC0(T);
find_zlev(H);
conformal::apply_orientation(H[0], H[1]);
models::apply_orientation(H[0], H[1]);
ld y = asin_auto(H[1]);
ld x = asin_auto_clamp(H[0] / cos_auto(y));
@ -1907,17 +1907,17 @@ EX bool do_draw(cell *c, const transmatrix& T) {
if(euclid && pmodel == mdSpiral) {
hyperpoint h = tC0(T);
cld z(h[0], h[1]);
z = z * conformal::spiral_multiplier;
z = z * models::spiral_multiplier;
ld iz = imag(z) + 1.14279e-2; // make it never fall exactly on PI
if(iz < -M_PI || iz >= M_PI) return false;
}
if(pmodel == mdSpiral && conformal::ring_not_spiral) {
if(pmodel == mdSpiral && models::ring_not_spiral) {
cld z;
hyperpoint H = tC0(T);
hyperpoint ret;
makeband(H, ret, band_conformal);
z = cld(ret[0], ret[1]) * conformal::spiral_multiplier;
if(imag(z) < -conformal::spiral_cone_rad/2-1e-5 || imag(z) >= conformal::spiral_cone_rad/2-1e-5) return false;
z = cld(ret[0], ret[1]) * models::spiral_multiplier;
if(imag(z) < -models::spiral_cone_rad/2-1e-5 || imag(z) >= models::spiral_cone_rad/2-1e-5) return false;
}
if(cells_drawn > vid.cells_drawn_limit) return false;
bool usr = vid.use_smart_range || quotient || euwrap;
@ -1930,10 +1930,10 @@ EX int cone_side(const hyperpoint H) {
hyperpoint ret;
if(hyperbolic) makeband(H, ret, band_conformal);
else ret = H;
cld z = cld(ret[0], ret[1]) * conformal::spiral_multiplier;
cld z = cld(ret[0], ret[1]) * models::spiral_multiplier;
auto zth = [&] (cld z) {
ld alpha = imag(z) * 360 / conformal::spiral_cone;
ld alpha = imag(z) * 360 / models::spiral_cone;
ld r = real(z);
r = exp(r);
@ -1941,9 +1941,9 @@ EX int cone_side(const hyperpoint H) {
ret[0] = -sin(alpha) * r;
ret[1] = cos(alpha) * r;
ret[2] = (r-1) * sqrt( pow(360/conformal::spiral_cone, 2) - 1);
ret[2] = (r-1) * sqrt( pow(360/models::spiral_cone, 2) - 1);
conformal::apply_ball(ret[2], ret[1]);
models::apply_ball(ret[2], ret[1]);
return ret;
};

View File

@ -328,7 +328,7 @@ void mobile_draw(MOBPAR_FORMAL) {
mousex = vid.xres/2, mousey = vid.yres/2, mouseh = sphereflip * C0;
frames++;
conformal::configure();
models::configure();
if(ticks > lastt) tortoise::updateVals(ticks - lastt);

View File

@ -85,22 +85,22 @@ void loadOldConfig(FILE *f) {
rug::model_distance = 2/rs;
#endif
aa=conformal::autobandhistory;
double ps = polygonal::STAR, lv = conformal::lvspeed;
aa=history::autobandhistory;
double ps = polygonal::STAR, lv = history::lvspeed;
int pmb = pmodel;
err=fscanf(f, "%d%d%lf%d%d%lf",
&pmb, &polygonal::SI, &ps, &polygonal::deg,
&aa, &lv);
pmodel = eModel(pmb);
conformal::autobandhistory = aa; polygonal::STAR = ps; conformal::lvspeed = lv;
history::autobandhistory = aa; polygonal::STAR = ps; history::lvspeed = lv;
aa=conformal::autoband; bb=conformal::autobandhistory; cc=conformal::dospiral;
aa=history::autoband; bb=history::autobandhistory; cc=history::dospiral;
int crot;
err=fscanf(f, "%d%d%d%d%d%d",
&conformal::bandhalf, &conformal::bandsegment, &crot,
&history::bandhalf, &history::bandsegment, &crot,
&aa, &bb, &cc);
conformal::autoband = aa; conformal::autobandhistory = bb; conformal::dospiral = cc;
conformal::rotation = crot * 90;
history::autoband = aa; history::autobandhistory = bb; history::dospiral = cc;
models::rotation = crot * 90;
err=fscanf(f, "%d", &polygonal::maxcoef);
if(polygonal::maxcoef < 0) polygonal::maxcoef = 0;

View File

@ -456,8 +456,8 @@ EX void showCreative() {
dialog::add_action_push(anims::show);
#endif
dialog::addBoolItem(XLAT("history mode"), conformal::on || conformal::includeHistory, 'h');
dialog::add_action_push(conformal::history_menu);
dialog::addBoolItem(XLAT("history mode"), history::on || history::includeHistory, 'h');
dialog::add_action_push(history::history_menu);
#if CAP_TEXTURE
if(DIM == 2) {

File diff suppressed because it is too large Load Diff

View File

@ -147,7 +147,7 @@ hint hints[] = {
dialog::addItem(XLAT("special display modes"), 'z');
},
[]() {
pushScreen(conformal::model_menu);
pushScreen(models::model_menu);
}},
{
@ -212,15 +212,15 @@ hint hints[] = {
popScreen();
auto m = pmodel;
pmodel = mdBand;
int r = conformal::rotation;
bool h = conformal::includeHistory;
conformal::rotation = 0;
conformal::includeHistory = true;
conformal::create_playerpath();
int r = models::rotation;
bool h = history::includeHistory;
models::rotation = 0;
history::includeHistory = true;
history::create_playerpath();
cancel = [m,r,h] () {
conformal::clear(); pmodel = m;
conformal::rotation = r;
conformal::includeHistory = h;
history::clear(); pmodel = m;
models::rotation = r;
history::includeHistory = h;
fullcenter(); };
}
},

View File

@ -771,8 +771,8 @@ void restore_time(int t) {
bool akh(int sym, int uni) {
if(uni == '1') { tstart = ticks; sview = viewctr; }
else if(uni == '2') { tstop = ticks; }
else if(uni == '3') { conformal::model_orientation = 90; pmodel = mdBand; player_relative = false; }
else if(uni == '4') { conformal::model_orientation = 180; pmodel = mdHalfplane; conformal::halfplane_scale = 2; player_relative = false; }
else if(uni == '3') { models::model_orientation = 90; pmodel = mdBand; player_relative = false; }
else if(uni == '4') { models::model_orientation = 180; pmodel = mdHalfplane; models::halfplane_scale = 2; player_relative = false; }
else if(uni == '5') { pmodel = mdDisk; player_relative = true; }
else if(uni == '6') { vid.use_smart_range = true; vid.smart_range_detail = 2; }
else if(uni == '7' && tstart && tstop) {
@ -932,7 +932,7 @@ void race_projection() {
dialog::addBoolItem(XLAT("band"), pmodel == mdBand, '2');
dialog::add_action([] () {
pmodel = mdBand;
conformal::model_orientation = race_angle;
models::model_orientation = race_angle;
race_advance = 1;
vid.yshift = 0;
vid.camera_angle = 0;
@ -946,7 +946,7 @@ void race_projection() {
dialog::addBoolItem(XLAT("half-plane"), pmodel == mdHalfplane, '3');
dialog::add_action([] () {
pmodel = mdHalfplane;
conformal::model_orientation = race_angle + 90;
models::model_orientation = race_angle + 90;
race_advance = 0.5;
vid.yshift = 0;
vid.camera_angle = 0;
@ -988,8 +988,8 @@ void race_projection() {
dialog::addSelItem(XLAT("race angle"), fts(race_angle), 'a');
dialog::add_action([] () {
dialog::editNumber(race_angle, 0, 360, 15, 90, XLAT("race angle"), "");
int q = conformal::model_orientation - race_angle;
dialog::reaction = [q] () { conformal::model_orientation = race_angle + q; };
int q = models::model_orientation - race_angle;
dialog::reaction = [q] () { models::model_orientation = race_angle + q; };
});
}

View File

@ -19,7 +19,7 @@ void rvvideo(const string &fname) {
collatz::lookup(763, 60);
conformal::create_playerpath(), conformal::rotation = 1;
history::create_playerpath(), models::rotation = 1;
// pmodel = mdBand;
#define STORYCOUNT 24
@ -98,8 +98,8 @@ struct storydata { int s; int e; const char *text; } story[] = {
vid.grid = drawnet;
conformal::phase = 1 + (isize(conformal::v)-3) * i * .95 / FRAMECOUNT;
conformal::movetophase();
history::phase = 1 + (isize(history::v)-3) * i * .95 / FRAMECOUNT;
history::movetophase();
char buf[500];
snprintf(buf, 500, fname.c_str(), i);

View File

@ -378,7 +378,7 @@ void buildTorusRug() {
using namespace torusconfig;
calcparam_rug();
conformal::configure();
models::configure();
struct toruspoint {
int x,y;
@ -1281,7 +1281,7 @@ void prepareTexture() {
dynamicval<eStereo> d(vid.stereo_mode, sOFF);
calcparam_rug();
conformal::configure();
models::configure();
glbuf->enable();
glbuf->clear(0);
@ -1788,7 +1788,7 @@ hyperpoint gethyper(ld x, ld y) {
double px = rx1 * TEXTURESIZE, py = (1-ry1) * TEXTURESIZE;
calcparam_rug();
conformal::configure();
models::configure();
hyperpoint h = hr::gethyper(px, py);
calcparam();

View File

@ -321,7 +321,7 @@ void take(string fname, const function<void()>& what) {
vid.xres = shotx * multiplier;
vid.yres = shoty * multiplier;
calcparam();
conformal::configure();
models::configure();
if(make_svg) {
#if CAP_SVG
@ -583,9 +583,9 @@ EX void apply() {
switch(ma) {
case maTranslation:
if(conformal::on) {
conformal::phase = (isize(conformal::v) - 1) * ticks * 1. / period;
conformal::movetophase();
if(history::on) {
history::phase = (isize(history::v) - 1) * ticks * 1. / period;
history::movetophase();
}
else if(centerover.at) {
reflect_view();
@ -681,8 +681,8 @@ EX void apply() {
vid.skiprope += skiprope_rotation * t * 2 * M_PI / period;
if(ballangle_rotation) {
if(conformal::model_has_orientation())
conformal::model_orientation += ballangle_rotation * 360 * t / period;
if(models::model_has_orientation())
models::model_orientation += ballangle_rotation * 360 * t / period;
else
vid.ballangle += ballangle_rotation * 360 * t / period;
}
@ -690,11 +690,11 @@ EX void apply() {
ld t = ticks / period;
t = t - floor(t);
if(pmodel == mdBand) {
conformal::model_transition = t * 4 - 1;
models::model_transition = t * 4 - 1;
}
else {
conformal::model_transition = t / 1.1;
vid.scale = (1 - conformal::model_transition) / 2.;
models::model_transition = t / 1.1;
vid.scale = (1 - models::model_transition) / 2.;
}
}
apply_animated_parameters();
@ -724,13 +724,13 @@ bool record_animation() {
if(playermoved) centerpc(INF), optimizeview();
dynamicval<bool> v2(inHighQual, true);
apply();
conformal::configure();
if(conformal::on) {
ld len = (isize(conformal::v)-1) + 2 * conformal::extra_line_steps;
conformal::phase = len * i / (noframes-1);
if(conformal::lvspeed < 0) conformal::phase = len - conformal::phase;
conformal::phase -= conformal::extra_line_steps;
conformal::movetophase();
models::configure();
if(history::on) {
ld len = (isize(history::v)-1) + 2 * history::extra_line_steps;
history::phase = len * i / (noframes-1);
if(history::lvspeed < 0) history::phase = len - history::phase;
history::phase -= history::extra_line_steps;
history::movetophase();
}
char buf[1000];
@ -874,7 +874,7 @@ EX void show() {
case maTranslation:
case maTranslationRotation:
case maParabolic: {
if(ma == maTranslation && conformal::on)
if(ma == maTranslation && history::on)
dialog::addBreak(300);
else if(ma == maTranslation) {
dialog::addSelItem(XLAT("cycle length"), fts(cycle_length), 'c');
@ -951,7 +951,7 @@ EX void show() {
});
}
#endif
if(conformal::model_has_orientation())
if(models::model_has_orientation())
animator(XLAT("model rotation"), ballangle_rotation, 'I');
else if(among(pmodel, mdHyperboloid, mdHemisphere, mdBall))
animator(XLAT("3D rotation"), ballangle_rotation, '3');
@ -968,8 +968,8 @@ EX void show() {
dialog::extra_options = list_animated_parameters;
});
dialog::addBoolItem(XLAT("history mode"), (conformal::on || conformal::includeHistory), 'h');
dialog::add_action_push(conformal::history_menu);
dialog::addBoolItem(XLAT("history mode"), (history::on || history::includeHistory), 'h');
dialog::add_action_push(history::history_menu);
#if CAP_FILES && CAP_SHOT
dialog::addItem(XLAT("shot settings"), 's');
@ -1081,7 +1081,7 @@ auto animhook = addHook(hooks_frame, 100, display_animation)
;
EX bool any_animation() {
if(conformal::on) return true;
if(history::on) return true;
if(ma) return true;
if(ballangle_rotation || rug_rotation1 || rug_rotation2) return true;
if(ap_changes) return true;
@ -1089,7 +1089,7 @@ EX bool any_animation() {
}
EX bool any_on() {
return any_animation() || conformal::includeHistory;
return any_animation() || history::includeHistory;
}
EX bool center_music() {
@ -1109,19 +1109,19 @@ EX void null_animation() {
void joukowsky() {
dynamicval<eModel> dm(pmodel, mdJoukowskyInverted);
dynamicval<ld> dt(conformal::model_orientation, ticks / 25.);
dynamicval<ld> dt(models::model_orientation, ticks / 25.);
dynamicval<int> dv(vid.use_smart_range, 2);
dynamicval<ld> ds(vid.scale, 1/4.);
conformal::configure();
models::configure();
dynamicval<color_t> dc(ringcolor, 0);
gamescreen(2);
}
void bandspin() {
dynamicval<eModel> dm(pmodel, mdBand);
dynamicval<ld> dt(conformal::model_orientation, ticks / 25.);
dynamicval<ld> dt(models::model_orientation, ticks / 25.);
dynamicval<int> dv(vid.use_smart_range, 2);
conformal::configure();
models::configure();
gamescreen(2);
}

View File

@ -496,7 +496,7 @@ void run_kuen() {
for(auto p: mesh) {
auto px = map_to_surface(p->h, m);
p->surface_point = px;
conformal::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(captions[part]), its(p->dexp_id), its(isize(mesh))));
history::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(captions[part]), its(p->dexp_id), its(isize(mesh))));
}
for(auto p: mesh) {
// make it a bit nicer by including the edges where only one endpoint is valid
@ -568,7 +568,7 @@ void run_other() {
p->surface_point = map_to_surface(h, dp);
p->flat = coord(p->surface_point.params);
conformal::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(shape_name[sh]), its(it), its(isize(rug::points))));
history::progress(XLAT("solving the geodesics on: %1, %2/%3", XLAT(shape_name[sh]), its(it), its(isize(rug::points))));
if(p->surface_point.remaining_distance == 0)
coverage.emplace_back(h, rchar(it) + 256 * 7);
}
@ -597,7 +597,7 @@ EX void run_shape(eShape s) {
rug::init();
// if(!rug::rugged) rug::reopen();
pushScreen(conformal::progress_screen);
pushScreen(history::progress_screen);
if(sh != dsNone) rug::good_shape = true;
switch(sh) {

View File

@ -1060,7 +1060,7 @@ bool texture_config::load() {
if(!data.readtexture(texturename)) return false;
if(!data.loadTextureGL()) return false;
calcparam();
conformal::configure();
models::configure();
drawthemap();
config.tstate = config.tstate_max = tsActive;
string s = move(texture_tuner);
@ -1582,7 +1582,7 @@ EX void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps IS(10)) {
}
void texture_config::true_remap() {
conformal::configure();
models::configure();
drawthemap();
if(DIM == 3) return;
clear_texture_map();
@ -1644,7 +1644,7 @@ void texture_config::remap() {
else if(tstate == tsAdjusting) {
printf("perform_mapping %d/%d\n", config.tstate, config.tstate_max);
calcparam();
conformal::configure();
models::configure();
drawthemap();
perform_mapping();
finish_mapping();

View File

@ -243,7 +243,7 @@ bool handleKeyTour(int sym, int uni) {
return true;
}
if(NUMBERKEY == '8') {
conformal::includeHistory = !conformal::includeHistory;
history::includeHistory = !history::includeHistory;
return true;
}
if(NUMBERKEY == '9') {
@ -588,8 +588,8 @@ slide default_slides[] = {
if(mode == 1)
pmodel = mdHalfplane, smart = vid.use_smart_range, vid.use_smart_range = 2;
if(mode == 2)
conformal::rotation = cwt.at->land == laDungeon ? 0 : 2;
if(mode == 3) pmodel = mdDisk, conformal::rotation = 0, vid.use_smart_range = smart;
models::rotation = cwt.at->land == laDungeon ? 0 : 2;
if(mode == 3) pmodel = mdDisk, models::rotation = 0, vid.use_smart_range = smart;
}
},
{"Curvature", 29, LEGAL_ANY,
@ -737,21 +737,21 @@ slide default_slides[] = {
"memory.",
[] (presmode mode) {
static int smart;
if(mode == 1) pmodel = mdBand, conformal::create_playerpath(), conformal::rotation = 0,
if(mode == 1) pmodel = mdBand, history::create_playerpath(), models::rotation = 0,
smart = vid.use_smart_range, vid.use_smart_range = 2;
if(mode == 3) {
conformal::clear(), pmodel = mdDisk;
history::clear(), pmodel = mdDisk;
resetview();
drawthemap();
centerpc(INF);
conformal::includeHistory = false;
history::includeHistory = false;
vid.use_smart_range = smart;
}
#if CAP_SDL
slidecommand = "render spiral";
if(mode == 4) conformal::createImage(true);
if(mode == 11) conformal::create_playerpath();
if(mode == 13) conformal::clear();
if(mode == 4) history::createImage(true);
if(mode == 11) history::create_playerpath();
if(mode == 13) history::clear();
#endif
}
},