1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-07 10:52:23 +00:00

singletype patterns now can be remapped to irregular grids

This commit is contained in:
Zeno Rogue
2018-08-02 22:26:07 +02:00
parent bd59b4e23a
commit 7e1344a863
4 changed files with 36 additions and 6 deletions

View File

@@ -277,7 +277,9 @@ int getTriangleID(cell *c, patterns::patterninfo& si, hyperpoint h) {
}
int goldbergcode(cell *c, const patterns::patterninfo& si) {
if(!gp::on) return 0;
if(irr::on)
return irr::cellindex[c] << 8;
else if(!gp::on) 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);
}
@@ -300,6 +302,17 @@ void mapTexture(cell *c, textureinfo& mi, patterns::patterninfo &si, const trans
}
}
else if(irr::on) {
mi.M = T;
mi.triangles.clear();
auto& vs = irr::cells[irr::cellindex[c]];
for(int i=0; i<c->type; i++) {
hyperpoint h1 = vs.vertices[i];
hyperpoint h2 = vs.vertices[(i+1)%c->type];
mi.triangles.emplace_back(make_array(C0, h1, h2), make_array(mi.M*C0, mi.M*h1, mi.M*h2));
}
}
else {
mi.M = T * applyPatterndir(c, si);
@@ -348,7 +361,7 @@ bool texture_config::apply(cell *c, const transmatrix &V, int col) {
set_floor(shFullFloor);
qfi.tinf = &mi;
qfi.spin = gp::on ? Id : applyPatterndir(c, si);
qfi.spin = (gp::on || irr::on) ? Id : applyPatterndir(c, si);
if(grid_color) {
draw_floorshape(c, V, shFullFloor, 0, PPR_FLOOR);