2020-08-10 16:09:19 +00:00
|
|
|
#include "rogueviz.h"
|
|
|
|
|
|
|
|
namespace rogueviz {
|
|
|
|
|
|
|
|
namespace honey {
|
|
|
|
|
|
|
|
bool alone = true;
|
|
|
|
|
|
|
|
bool in_special = false;
|
|
|
|
|
2023-04-14 23:24:16 +00:00
|
|
|
#if CAP_RVSLIDES
|
2024-06-16 14:58:54 +00:00
|
|
|
|
|
|
|
using ccolor::data;
|
|
|
|
|
|
|
|
#define CCO [] (cell *c, data& cco) -> color_t
|
|
|
|
|
|
|
|
int jhole = 0;
|
|
|
|
int jblock = 0;
|
|
|
|
|
|
|
|
data jmap("rainbow by distance", ccolor::always_available,
|
|
|
|
CCO {
|
|
|
|
if(c == currentmap->gamestart()) return ccolor::plain(c);
|
|
|
|
int d = c->master->distance;
|
|
|
|
if(geometry == gNil) d = c->master->zebraval;
|
|
|
|
if(euc::in()) d = euc::get_ispacemap()[c->master][0];
|
|
|
|
if(d % 2 == 0 || d < -5 || d > 5) return hrand(100) < jblock ? 0xFFFFFFFF : ccolor::plain(c);
|
|
|
|
return hrand(100) < jhole ? ccolor::plain(c) : cco.ctab[(d+5)/2];
|
|
|
|
},
|
|
|
|
{0x100FFFF, 0x100FF00, 0x1FFFF00, 0x1FF8000, 0x1FF0000, 0x1FF00FF}
|
|
|
|
);
|
|
|
|
|
|
|
|
data jmap2("rainbow by distance II", ccolor::always_available,
|
|
|
|
CCO {
|
|
|
|
if(c == currentmap->gamestart()) return ccolor::plain(c);
|
|
|
|
int d = c->master->distance;
|
|
|
|
if(geometry == gNil) d = c->master->zebraval;
|
|
|
|
if(euc::in()) d = euc::get_ispacemap()[c->master][0];
|
|
|
|
if((d&3) != 2) return hrand(100) < jblock ? 0xFFFFFFFF : ccolor::plain(c);
|
|
|
|
return hrand(100) < jhole ? ccolor::plain(c) : cco.ctab[(d+10)/4];
|
|
|
|
},
|
|
|
|
{0x100FFFF, 0x100FF00, 0x1FFFF00, 0x1FF8000, 0x1FF0000, 0x1FF00FF}
|
|
|
|
);
|
|
|
|
|
|
|
|
data random_pseudohept("random_pseudohept", ccolor::always_available,
|
|
|
|
CCO {
|
|
|
|
color_t r = hrand(0xFFFFFF + 1);
|
|
|
|
if(hrand(100) < ccolor::rwalls && pseudohept(c) && c != cwt.at) r |= 0x1000000;
|
|
|
|
return r;
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
auto geoslide(eGeometry g, ccolor::data *canvas, int _jhole, int _jblock) {
|
2020-08-10 16:09:19 +00:00
|
|
|
using namespace tour;
|
|
|
|
return [=] (presmode mode) {
|
2024-06-16 14:16:56 +00:00
|
|
|
setWhiteCanvas(mode, [&] {
|
2020-08-10 16:09:19 +00:00
|
|
|
set_geometry(g);
|
|
|
|
if(g == gSphere) {
|
|
|
|
set_geometry(gProduct);
|
|
|
|
}
|
|
|
|
if(g == gNormal) {
|
|
|
|
set_geometry(gRotSpace);
|
|
|
|
}
|
|
|
|
tour::slide_backup<ld>(sightranges[gProduct], 12);
|
|
|
|
tour::slide_backup<ld>(sightranges[gNil], 7);
|
|
|
|
tour::slide_backup<ld>(sightranges[gSol], 7);
|
|
|
|
tour::slide_backup<ld>(sightranges[gSpace435], 7);
|
|
|
|
vid.texture_step = 4;
|
2024-06-16 14:58:54 +00:00
|
|
|
tour::slide_backup(jhole, _jhole);
|
|
|
|
tour::slide_backup(jblock, _jblock);
|
|
|
|
tour::slide_backup(ccolor::rwalls, _jhole);
|
|
|
|
tour::slide_backup(ccolor::which, canvas);
|
2020-08-10 16:09:19 +00:00
|
|
|
tour::slide_backup(vid.linewidth, vid.linewidth / 10);
|
|
|
|
if(jblock < 0) {
|
|
|
|
pmodel = mdDisk;
|
|
|
|
sightranges[gSol] = 4;
|
|
|
|
}
|
2024-06-16 14:16:56 +00:00
|
|
|
});
|
2022-08-05 18:34:56 +00:00
|
|
|
rogueviz::pres::non_game_slide_scroll(mode);
|
2020-08-10 16:09:19 +00:00
|
|
|
if(mode == pmStop && jblock < 0)
|
|
|
|
pmodel = mdGeodesic;
|
|
|
|
slidecommand = "switch raycaster";
|
|
|
|
|
|
|
|
if(in_special && among(mode, pmGeometrySpecial, pmStop)) {
|
|
|
|
in_special = false;
|
|
|
|
gamestack::pop();
|
2024-06-16 14:58:54 +00:00
|
|
|
ccolor::which = canvas;
|
2020-08-10 16:09:19 +00:00
|
|
|
vid.grid = false;
|
|
|
|
fat_edges = false;
|
|
|
|
sightranges[gSpace435] = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(mode == pmGeometrySpecial && !in_special) {
|
|
|
|
in_special = true;
|
|
|
|
gamestack::push();
|
2024-05-05 18:20:00 +00:00
|
|
|
ccolor::set_plain(0);
|
2020-08-10 16:09:19 +00:00
|
|
|
vid.grid = true;
|
|
|
|
stdgridcolor = 0xFFFF00FF;
|
|
|
|
fat_edges = true;
|
|
|
|
start_game();
|
|
|
|
sightranges[gSpace435] = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(mode == pmKey && jblock < 0) {
|
|
|
|
sightranges[gSol] = 11 - sightranges[gSol];
|
|
|
|
addMessage("Changed the sight range to ", sightranges[gSol]);
|
|
|
|
}
|
|
|
|
else if(mode == pmKey) {
|
|
|
|
if(sl2) {
|
|
|
|
addMessage("Raycaster not implemented here.");
|
|
|
|
}
|
2021-06-25 11:54:17 +00:00
|
|
|
#if CAP_RAY
|
2020-08-10 16:09:19 +00:00
|
|
|
else if(ray::want_use != 2) {
|
|
|
|
ray::want_use = 2;
|
|
|
|
ray::max_cells = 4096;
|
|
|
|
addMessage("Using a raycaster.");
|
|
|
|
}
|
2021-06-25 11:54:17 +00:00
|
|
|
#endif
|
2020-08-10 16:09:19 +00:00
|
|
|
else {
|
2021-06-25 11:54:17 +00:00
|
|
|
#if CAP_RAY
|
2020-08-10 16:09:19 +00:00
|
|
|
ray::want_use = 0;
|
2021-06-25 11:54:17 +00:00
|
|
|
#endif
|
2020-08-10 16:09:19 +00:00
|
|
|
addMessage("Using primitives.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2023-04-14 23:24:16 +00:00
|
|
|
#endif
|
2020-08-10 16:09:19 +00:00
|
|
|
|
2021-03-30 19:48:04 +00:00
|
|
|
string cap = "honeycombs/";
|
2020-08-10 16:09:19 +00:00
|
|
|
|
2023-04-14 23:24:16 +00:00
|
|
|
#if CAP_RVSLIDES
|
2021-03-30 19:48:04 +00:00
|
|
|
void honey(string s, vector<tour::slide>& v) {
|
|
|
|
if(s != "noniso") return;
|
2020-08-10 16:09:19 +00:00
|
|
|
using namespace tour;
|
|
|
|
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"Tessellations in 3D geometries", 999, LEGAL::NONE | QUICKSKIP,
|
|
|
|
"This series of slides presents the honeycombs we use. "
|
|
|
|
"You can compare the output of primitive-based and raycaster-based rendering by pressing '5'.",
|
|
|
|
[] (presmode mode) {}
|
|
|
|
});
|
|
|
|
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"Hyperbolic space", 999, LEGAL::SPECIAL,
|
|
|
|
"Traditional visualizations of non-Euclidean honeycombs "
|
|
|
|
"show the edges of all cells. In our visualizations, we fill some of the cells. "
|
|
|
|
"The disadvantage of the traditional visualization is visible here, on the example of {4,3,5} hyperbolic honeycomb: "
|
|
|
|
"our Euclidean brains tend to interpret this visualization incorrectly. (Press '2' to get the traditional visualization.)",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gSpace435, &ccolor::random, 50, 0)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"S2xE", 999, LEGAL::NONE,
|
|
|
|
"This is the S2xE geometry.",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gSphere, &ccolor::random, 10, 0)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"Solv: random", 999, LEGAL::NONE,
|
|
|
|
"Random blocks in Solv geometry.",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gSol, &ccolor::random, 20, 0)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"Solv: Poincaré ball", 999, LEGAL::NONE,
|
|
|
|
"Surfaces of constant 'z' in Solv geometry, displayed in Poincaré ball-like model. "
|
|
|
|
"Press '5' to change the sight range (this slide is not optimized, so it will be slow).",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gSol, &jmap, 0, -1)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"Solv: horotori", 999, LEGAL::NONE,
|
|
|
|
"Solv geometry. Colored torus-like surfaces are surfaces of constant 'z'. "
|
|
|
|
"Press '5' to enable the raycaster",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gSol, &jmap, 50, 0)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"Solv: difficult region", 999, LEGAL::NONE,
|
|
|
|
"This slide focuses on the area in Solv geometry which is difficult to render using primitives. "
|
|
|
|
"Press '5' to enable the raycaster.",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gSol, &jmap2, 0, 10)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"Nil geometry", 999, LEGAL::NONE,
|
|
|
|
"Nil geometry. Colored surfaces are surfaces of constant 'x'. "
|
|
|
|
"Press '5' to enable the raycaster",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gNil, &jmap, 10, 10)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
v.emplace_back(
|
|
|
|
slide{cap+"SL(2,R) geometry", 999, LEGAL::NONE,
|
|
|
|
"SL(2,R) geometry.",
|
2024-06-16 14:58:54 +00:00
|
|
|
geoslide(gNormal, &random_pseudohept, 90, 0)
|
2020-08-10 16:09:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
}
|
2023-04-14 23:24:16 +00:00
|
|
|
#endif
|
2020-08-10 16:09:19 +00:00
|
|
|
|
2021-06-25 11:53:23 +00:00
|
|
|
#if CAP_RVSLIDES
|
2021-03-30 19:48:04 +00:00
|
|
|
vector<tour::slide> noniso_slides;
|
|
|
|
tour::slide *gen_noniso_demo() {
|
|
|
|
noniso_slides.clear();
|
2020-08-10 18:31:49 +00:00
|
|
|
using namespace tour;
|
2021-03-30 19:48:04 +00:00
|
|
|
noniso_slides.emplace_back(
|
2022-08-12 07:09:38 +00:00
|
|
|
slide{"Non-isotropic geometry demo", 999, LEGAL::NONE | QUICKSKIP | QUICKGEO,
|
2021-03-30 19:48:04 +00:00
|
|
|
"This is a presentation of non-isotropic geometries.",
|
2020-08-10 18:31:49 +00:00
|
|
|
[] (presmode mode) {
|
2021-04-02 22:57:37 +00:00
|
|
|
slide_url(mode, 'p', "paper about non-isotropic geometries", "https://arxiv.org/abs/2002.09533");
|
2024-06-16 14:16:56 +00:00
|
|
|
setCanvas(mode, &ccolor::random, [] {
|
2022-08-12 07:09:38 +00:00
|
|
|
set_geometry(gCubeTiling);
|
2024-06-16 14:16:56 +00:00
|
|
|
});
|
2020-08-10 18:31:49 +00:00
|
|
|
}
|
|
|
|
});
|
2021-03-30 19:48:04 +00:00
|
|
|
|
|
|
|
callhooks(pres::hooks_build_rvtour, "noniso", noniso_slides);
|
|
|
|
pres::add_end(noniso_slides);
|
|
|
|
return &noniso_slides[0];
|
2020-08-10 18:31:49 +00:00
|
|
|
}
|
2021-06-25 11:53:23 +00:00
|
|
|
#endif
|
2020-08-10 18:31:49 +00:00
|
|
|
|
2021-06-25 11:53:23 +00:00
|
|
|
auto hooks = addHook_rvslides(163, honey)
|
|
|
|
+ addHook_slideshows(120, [] (tour::ss::slideshow_callback cb) {
|
2021-03-30 19:48:04 +00:00
|
|
|
|
|
|
|
if(noniso_slides.empty())
|
|
|
|
gen_noniso_demo();
|
|
|
|
|
|
|
|
cb(XLAT("non-isotropic geometries"), &noniso_slides[0], 'n');
|
|
|
|
});
|
2020-08-10 16:09:19 +00:00
|
|
|
|
|
|
|
} }
|