mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-26 01:50:36 +00:00
floor tiles are now constructed based on logical coordinates
This commit is contained in:
parent
1e6e75c7d4
commit
31a5a9e5c7
@ -288,20 +288,23 @@ void geometry_information::bshape_regular(floorshape &fsh, int id, int sides, ld
|
|||||||
if(bt::in()) {
|
if(bt::in()) {
|
||||||
|
|
||||||
const int STEP = vid.texture_step;
|
const int STEP = vid.texture_step;
|
||||||
|
|
||||||
for(int t=0; t<2; t++) {
|
for(int t=0; t<2; t++) {
|
||||||
|
|
||||||
if(t == 0)
|
if(t == 0)
|
||||||
bshape(fsh.b[id], fsh.prio);
|
bshape(fsh.b[id], fsh.prio);
|
||||||
if(t == 1)
|
if(t == 1)
|
||||||
bshape(fsh.shadow[id], fsh.prio);
|
bshape(fsh.shadow[id], fsh.prio);
|
||||||
|
|
||||||
|
int STEP1 = STEP;
|
||||||
|
if((embedded_plane || geom3::flipped) && t == 0) STEP1 = 1;
|
||||||
|
|
||||||
for(int i=0; i<sides; i++) {
|
for(int i=0; i<sides; i++) {
|
||||||
hyperpoint h0 = bt::get_corner_horo_coordinates(c, i) * size;
|
hyperpoint h0 = bt::get_corner_horo_coordinates(c, i) * size;
|
||||||
hyperpoint h1 = bt::get_corner_horo_coordinates(c, i+1) * size;
|
hyperpoint h1 = bt::get_corner_horo_coordinates(c, i+1) * size;
|
||||||
if(t) h0 *= SHADMUL, h1 *= SHADMUL;
|
if(t) h0 *= SHADMUL, h1 *= SHADMUL;
|
||||||
hyperpoint hd = (h1 - h0) / STEP;
|
hyperpoint hd = (h1 - h0) / STEP1;
|
||||||
for(int j=0; j<STEP; j++) {
|
for(int j=0; j<STEP1; j++) {
|
||||||
hpcpush(bt::get_horopoint(h0 + hd * j));
|
hpcpush(bt::get_horopoint(h0 + hd * j));
|
||||||
if(geometry == gBinary4 && among(i, 2, 4)) break;
|
if(geometry == gBinary4 && among(i, 2, 4)) break;
|
||||||
if(geometry == gBinaryTiling && among(i, 0, 4)) break;
|
if(geometry == gBinaryTiling && among(i, 0, 4)) break;
|
||||||
@ -679,38 +682,32 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
|
|||||||
last->tinf = &floor_texture_vertices[fsh.id];
|
last->tinf = &floor_texture_vertices[fsh.id];
|
||||||
last->texture_offset = 0;
|
last->texture_offset = 0;
|
||||||
|
|
||||||
#if CAP_BT
|
|
||||||
if(bt::in())
|
|
||||||
for(int t=0; t<c->type; t++)
|
|
||||||
texture_order([&] (ld x, ld y) {
|
|
||||||
hyperpoint left = bt::get_corner_horo_coordinates(c, t);
|
|
||||||
hyperpoint right = bt::get_corner_horo_coordinates(c, t+1);
|
|
||||||
hpcpush(orthogonal_move(bt::get_horopoint(left * x + right * y), dfloor_table[k]));
|
|
||||||
});
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if(1) {
|
if(1) {
|
||||||
int s = fsh.b[id].s;
|
int s = fsh.b[id].s;
|
||||||
int e = fsh.b[id].e-1;
|
int e = fsh.b[id].e-1;
|
||||||
hyperpoint ctr = Hypc;
|
if(vid.pseudohedral) {
|
||||||
for(int t=0; t<e-s; t++)
|
hyperpoint ctr = Hypc;
|
||||||
ctr += orthogonal_move(may_kleinize(hpc[s+t]), dfloor_table[k]);
|
for(int t=0; t<e-s; t++)
|
||||||
ctr = normalize(ctr);
|
ctr += kleinize(cgi.emb->orthogonal_move(hpc[s+t], dfloor_table[k]));
|
||||||
if(vid.pseudohedral) for(int t=0; t<e-s; t++) {
|
ctr = normalize(ctr);
|
||||||
hyperpoint v1 = orthogonal_move(may_kleinize(hpc[s+t]), dfloor_table[k]) - ctr;
|
|
||||||
hyperpoint v2 = orthogonal_move(may_kleinize(hpc[s+t+1]), dfloor_table[k]) - ctr;
|
for(int t=0; t<e-s; t++) {
|
||||||
texture_order([&] (ld x, ld y) {
|
hyperpoint v1 = kleinize(cgi.emb->orthogonal_move(hpc[s+t], dfloor_table[k])) - ctr;
|
||||||
hpcpush(normalize(ctr + v1 * x + v2 * y));
|
hyperpoint v2 = kleinize(cgi.emb->orthogonal_move(hpc[s+t+1], dfloor_table[k])) - ctr;
|
||||||
});
|
texture_order([&] (ld x, ld y) {
|
||||||
|
hpcpush(normalize(ctr + v1 * x + v2 * y));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!vid.pseudohedral) for(int t=0; t<e-s; t++) {
|
if(!vid.pseudohedral) for(int t=0; t<e-s; t++) {
|
||||||
hyperpoint fctr = may_kleinize(tile_center());
|
|
||||||
hyperpoint v1 = may_kleinize(hpc[s+t]) - fctr;
|
hyperpoint v1 = cgi.emb->actual_to_logical(hpc[s+t]);
|
||||||
hyperpoint v2 = may_kleinize(hpc[s+t+1]) - fctr;
|
hyperpoint v2 = cgi.emb->actual_to_logical(hpc[s+t+1]);
|
||||||
|
|
||||||
texture_order([&] (ld x, ld y) {
|
texture_order([&] (ld x, ld y) {
|
||||||
hyperpoint a = fctr + v1 * x + v2 * y;
|
hyperpoint a = v1 * x + v2 * y;
|
||||||
hyperpoint b = cgi.emb->normalize_flat(a);
|
a[2] = dfloor_table[k];
|
||||||
hyperpoint c = orthogonal_move(b, dfloor_table[k]);
|
auto c = cgi.emb->logical_to_actual(a);
|
||||||
cgi.hpcpush(c);
|
cgi.hpcpush(c);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -728,24 +725,16 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
|
|||||||
last->texture_offset = 0;
|
last->texture_offset = 0;
|
||||||
ld h = (FLOOR - WALL) / (co+1);
|
ld h = (FLOOR - WALL) / (co+1);
|
||||||
ld top = co ? (FLOOR + WALL) / 2 : WALL;
|
ld top = co ? (FLOOR + WALL) / 2 : WALL;
|
||||||
#if CAP_BT
|
|
||||||
if(bt::in())
|
|
||||||
for(int t=0; t<c->type; t++)
|
|
||||||
texture_order([&] (ld x, ld y) {
|
|
||||||
hyperpoint left = bt::get_corner_horo_coordinates(c, t);
|
|
||||||
hyperpoint right = bt::get_corner_horo_coordinates(c, t+1);
|
|
||||||
hpcpush(orthogonal_move(bt::get_horopoint(left * x + right * y), top + h * (x+y)));
|
|
||||||
});
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if(1) {
|
if(1) {
|
||||||
int s = fsh.b[id].s;
|
int s = fsh.b[id].s;
|
||||||
int e = fsh.b[id].e-1;
|
int e = fsh.b[id].e-1;
|
||||||
for(int t=0; t<e-s; t++) {
|
for(int t=0; t<e-s; t++) {
|
||||||
auto TC0 = tile_center();
|
hyperpoint v1 = cgi.emb->actual_to_logical(hpc[s+t]);
|
||||||
hyperpoint v1 = may_kleinize(hpc[s+t]) - TC0;
|
hyperpoint v2 = cgi.emb->actual_to_logical(hpc[s+t+1]);
|
||||||
hyperpoint v2 = may_kleinize(hpc[s+t+1]) - TC0;
|
texture_order([&] (ld x, ld y) {
|
||||||
texture_order([&] (ld x, ld y) { hpcpush(orthogonal_move(cgi.emb->normalize_flat(TC0 + v1 * x + v2 * y), top + h * (x+y))); });
|
hyperpoint a = v1 * x + v2 * y; a[2] = top + h * (x+y);
|
||||||
|
hpcpush(cgi.emb->logical_to_actual(a));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user