1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-17 22:20:41 +00:00

removed ccolor::data jmap from pattern2, moved to rogueviz/noniso-honeycombs

This commit is contained in:
Zeno Rogue 2024-06-16 16:58:54 +02:00
parent a04638af3b
commit 75a82fab1f
2 changed files with 54 additions and 29 deletions

View File

@ -1562,8 +1562,6 @@ EX namespace ccolor {
EX color_t apeirogonal_color = 0xFFFFFFFF; EX color_t apeirogonal_color = 0xFFFFFFFF;
EX int jhole = 0;
EX int jblock = 0;
EX ld rwalls = 50; EX ld rwalls = 50;
EX bool live_canvas; EX bool live_canvas;
@ -1727,18 +1725,6 @@ EX namespace ccolor {
EX data nil_penrose = data("Nil staircase", [] { return nil; }, EX data nil_penrose = data("Nil staircase", [] { return nil; },
CCO { return nilv::colorize(c, '/'); }, {}); CCO { return nilv::colorize(c, '/'); }, {});
EX data jmap = data("rainbow by distance", always_available,
CCO {
if(c == currentmap->gamestart()) return 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 : plain(c);
return hrand(100) < jhole ? plain(c) : cco.ctab[(d+5)/2];
},
{0x100FFFF, 0x100FF00, 0x1FFFF00, 0x1FF8000, 0x1FF0000, 0x1FF00FF}
);
EX data distance = data("distance from origin", always_available, EX data distance = data("distance from origin", always_available,
CCO { CCO {
int d = celldist(c); int d = celldist(c);
@ -1851,7 +1837,7 @@ EX namespace ccolor {
&plain, &random, &sides, &formula, &plain, &random, &sides, &formula,
&shape, &shape_mirror, &shape, &shape_mirror,
&threecolor, &football, &chessboard, &threecolor, &football, &chessboard,
&landscape, &landscape_dark, &seven, &randbw, &jmap, &distance, &landscape, &landscape_dark, &seven, &randbw, &distance,
&crystal_colors, &crystal_cage, &crystal_hyperplanes, &crystal_honeycomb, &crystal_diagonal, &nil_penrose, &crystal_colors, &crystal_cage, &crystal_hyperplanes, &crystal_honeycomb, &crystal_diagonal, &nil_penrose,
&zebra_pattern, &zebra_triangles, &zebra_stripes, &emerald_pattern, &palace_elements, &palace_domains, &zebra_pattern, &zebra_triangles, &zebra_stripes, &emerald_pattern, &palace_elements, &palace_domains,
#if CAP_FIELD #if CAP_FIELD

View File

@ -9,7 +9,46 @@ bool alone = true;
bool in_special = false; bool in_special = false;
#if CAP_RVSLIDES #if CAP_RVSLIDES
auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
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) {
using namespace tour; using namespace tour;
return [=] (presmode mode) { return [=] (presmode mode) {
setWhiteCanvas(mode, [&] { setWhiteCanvas(mode, [&] {
@ -25,10 +64,10 @@ auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
tour::slide_backup<ld>(sightranges[gSol], 7); tour::slide_backup<ld>(sightranges[gSol], 7);
tour::slide_backup<ld>(sightranges[gSpace435], 7); tour::slide_backup<ld>(sightranges[gSpace435], 7);
vid.texture_step = 4; vid.texture_step = 4;
tour::slide_backup(ccolor::jhole, jhole); tour::slide_backup(jhole, _jhole);
tour::slide_backup(ccolor::rwalls, jhole); tour::slide_backup(jblock, _jblock);
tour::slide_backup(ccolor::jblock, jblock); tour::slide_backup(ccolor::rwalls, _jhole);
tour::slide_backup(ccolor::which, ccolor::legacy(canvas)); tour::slide_backup(ccolor::which, canvas);
tour::slide_backup(vid.linewidth, vid.linewidth / 10); tour::slide_backup(vid.linewidth, vid.linewidth / 10);
if(jblock < 0) { if(jblock < 0) {
pmodel = mdDisk; pmodel = mdDisk;
@ -43,7 +82,7 @@ auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
if(in_special && among(mode, pmGeometrySpecial, pmStop)) { if(in_special && among(mode, pmGeometrySpecial, pmStop)) {
in_special = false; in_special = false;
gamestack::pop(); gamestack::pop();
ccolor::which = ccolor::legacy(canvas); ccolor::which = canvas;
vid.grid = false; vid.grid = false;
fat_edges = false; fat_edges = false;
sightranges[gSpace435] = 7; sightranges[gSpace435] = 7;
@ -106,46 +145,46 @@ void honey(string s, vector<tour::slide>& v) {
"show the edges of all cells. In our visualizations, we fill some of the cells. " "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: " "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.)", "our Euclidean brains tend to interpret this visualization incorrectly. (Press '2' to get the traditional visualization.)",
geoslide(gSpace435, 'r', 50, 0) geoslide(gSpace435, &ccolor::random, 50, 0)
}); });
v.emplace_back( v.emplace_back(
slide{cap+"S2xE", 999, LEGAL::NONE, slide{cap+"S2xE", 999, LEGAL::NONE,
"This is the S2xE geometry.", "This is the S2xE geometry.",
geoslide(gSphere, 'r', 10, 0) geoslide(gSphere, &ccolor::random, 10, 0)
}); });
v.emplace_back( v.emplace_back(
slide{cap+"Solv: random", 999, LEGAL::NONE, slide{cap+"Solv: random", 999, LEGAL::NONE,
"Random blocks in Solv geometry.", "Random blocks in Solv geometry.",
geoslide(gSol, 'r', 20, 0) geoslide(gSol, &ccolor::random, 20, 0)
}); });
v.emplace_back( v.emplace_back(
slide{cap+"Solv: Poincaré ball", 999, LEGAL::NONE, slide{cap+"Solv: Poincaré ball", 999, LEGAL::NONE,
"Surfaces of constant 'z' in Solv geometry, displayed in Poincaré ball-like model. " "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).", "Press '5' to change the sight range (this slide is not optimized, so it will be slow).",
geoslide(gSol, 'j', 0, -1) geoslide(gSol, &jmap, 0, -1)
}); });
v.emplace_back( v.emplace_back(
slide{cap+"Solv: horotori", 999, LEGAL::NONE, slide{cap+"Solv: horotori", 999, LEGAL::NONE,
"Solv geometry. Colored torus-like surfaces are surfaces of constant 'z'. " "Solv geometry. Colored torus-like surfaces are surfaces of constant 'z'. "
"Press '5' to enable the raycaster", "Press '5' to enable the raycaster",
geoslide(gSol, 'j', 50, 0) geoslide(gSol, &jmap, 50, 0)
}); });
v.emplace_back( v.emplace_back(
slide{cap+"Solv: difficult region", 999, LEGAL::NONE, slide{cap+"Solv: difficult region", 999, LEGAL::NONE,
"This slide focuses on the area in Solv geometry which is difficult to render using primitives. " "This slide focuses on the area in Solv geometry which is difficult to render using primitives. "
"Press '5' to enable the raycaster.", "Press '5' to enable the raycaster.",
geoslide(gSol, 'J', 0, 10) geoslide(gSol, &jmap2, 0, 10)
}); });
v.emplace_back( v.emplace_back(
slide{cap+"Nil geometry", 999, LEGAL::NONE, slide{cap+"Nil geometry", 999, LEGAL::NONE,
"Nil geometry. Colored surfaces are surfaces of constant 'x'. " "Nil geometry. Colored surfaces are surfaces of constant 'x'. "
"Press '5' to enable the raycaster", "Press '5' to enable the raycaster",
geoslide(gNil, 'j', 10, 10) geoslide(gNil, &jmap, 10, 10)
}); });
v.emplace_back( v.emplace_back(
slide{cap+"SL(2,R) geometry", 999, LEGAL::NONE, slide{cap+"SL(2,R) geometry", 999, LEGAL::NONE,
"SL(2,R) geometry.", "SL(2,R) geometry.",
geoslide(gNormal, 'G', 90, 0) geoslide(gNormal, &random_pseudohept, 90, 0)
}); });
} }