1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-23 15:36:59 +00:00

texture remapping to dual/bitruncated Archimedean

This commit is contained in:
Zeno Rogue 2018-08-30 17:54:04 +02:00
parent 218709b899
commit 2c1b8c3b14
3 changed files with 46 additions and 25 deletions

View File

@ -1008,15 +1008,27 @@ void enable(archimedean_tiling& arct) {
if(!archimedean) set_variation(eVariation::pure);
set_geometry(gArchimedean);
patterns::whichPattern = patterns::PAT_NONE;
#if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpThree)
patterns::whichPattern = patterns::PAT_COLORING;
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpFootball)
patterns::whichPattern = patterns::PAT_TYPES, patterns::subpattern_flags = patterns::SPF_FOOTBALL;
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpChess)
patterns::whichPattern = patterns::PAT_CHESS;
#endif
current = arct;
#if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpThree) {
patterns::whichPattern = patterns::PAT_COLORING;
if(geosupport_threecolor() < 2) {
if(arct.support_threecolor() == 2) set_variation(eVariation::pure);
else if(arct.support_threecolor_bitruncated() == 2) set_variation(eVariation::bitruncated);
}
}
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpFootball) {
patterns::whichPattern = patterns::PAT_TYPES, patterns::subpattern_flags = patterns::SPF_FOOTBALL;
if(geosupport_football() < 2) set_variation(eVariation::bitruncated);
}
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpChess) {
patterns::whichPattern = patterns::PAT_CHESS;
if(!geosupport_chessboard()) {
if(arct.support_chessboard()) set_variation(eVariation::pure);
else if(arct.support_threecolor_bitruncated() == 2) set_variation(eVariation::dual);
}
}
#endif
need_reset_geometry = true;
start_game();
}
@ -1058,13 +1070,6 @@ void show() {
dialog::addBreak(100);
if(edited.errors)
dialog::addInfo(edited.errormsg, 0xFF0000);
#if CAP_TEXTURE
else if(texture::config.tstate == texture::tsActive &&
((texture::cgroup == cpThree && edited.support_threecolor() < 2) ||
(texture::cgroup == cpFootball && edited.support_football() < 2) ||
(texture::cgroup == cpChess && !edited.support_chessboard())))
dialog::addInfo(XLAT("Pattern incompatible."), 0xC0C000);
#endif
else
dialog::addInfo(XLAT("OK"), 0x00FF00);
@ -1091,15 +1096,26 @@ void show() {
int shown = 0;
while(nextpos < isize(tilings) && shown < 10) {
auto &ps = tilings[nextpos++];
bool valid = true;
string suffix = "";
#if CAP_TEXTURE
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpThree && ps.support_threecolor() < 2)
continue;
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpFootball && ps.support_football() < 2)
continue;
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpChess && !ps.support_chessboard())
continue;
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpThree) {
valid = false;
if(ps.support_threecolor() == 2) valid = true, suffix += bitruncnames[int(eVariation::pure)];
if(ps.support_threecolor_bitruncated() == 2) valid = true, suffix += bitruncnames[int(eVariation::bitruncated)];
}
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpFootball) {
if(ps.support_football() == 2) suffix += bitruncnames[int(eVariation::pure)];
suffix += bitruncnames[int(eVariation::bitruncated)];
}
if(texture::config.tstate == texture::tsActive && texture::cgroup == cpChess && !ps.support_chessboard()) {
valid = false;
if(ps.support_chessboard()) valid = true, suffix += bitruncnames[int(eVariation::pure)];
if(ps.support_threecolor_bitruncated() == 2) valid = true, suffix += bitruncnames[int(eVariation::dual)];
}
#endif
dialog::addSelItem(ps.symbol, fts(ps.euclidean_angle_sum * 180) + "°", 'a' + shown);
if(!valid) continue;
dialog::addSelItem(ps.symbol, fts(ps.euclidean_angle_sum * 180) + "°" + suffix, 'a' + shown);
dialog::lastItem().color = ps.coloring;
dialog::add_action([&] () { enable(ps); });
shown++;

View File

@ -1907,7 +1907,7 @@ namespace patterns {
if(IRREGULAR)
return irr::cellindex[c] << 8;
else if(archimedean)
return arcm::id_of(c->master) << 8;
return (arcm::id_of(c->master) << 8) + (arcm::parent_index_of(c->master) << 16);
else if(!GOLDBERG) return 0;
else if(c == c->master->c7) return (fixdir(si.dir, c) << 8);
else return (get_code(gp::get_local_info(c)) << 16) | (fixdir(si.dir, c) << 8);

View File

@ -292,9 +292,14 @@ void mapTexture(cell *c, textureinfo& mi, patterns::patterninfo &si, const trans
mi.M = T * applyPatterndir(c, si);
mi.triangles.clear();
transmatrix iv = inverse(applyPatterndir(c, si));
int sd = si.dir;
if((NONSTDVAR) || binarytiling) sd = 0;
for(int i=0; i<c->type; i++) {
hyperpoint h1 = get_corner_position(c, (i + shift) % c->type);
hyperpoint h2 = get_corner_position(c, (i + shift + 1) % c->type);
hyperpoint h1 = iv * get_corner_position(c, (i + sd + shift) % c->type);
hyperpoint h2 = iv * get_corner_position(c, (i + sd + shift + 1) % c->type);
mi.triangles.emplace_back(make_array(C0, h1, h2), make_array(mi.M*C0, mi.M*h1, mi.M*h2));
}
}