1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-06 22:05:06 +00:00

Removed floorshape::side, it will be simpler to always use gpside. The old gpside is now called side.

This commit is contained in:
Zeno Rogue 2025-03-17 00:08:02 +01:00
parent ec57120ae1
commit efd1a18104
5 changed files with 44 additions and 68 deletions

View File

@ -87,7 +87,7 @@ struct dqi_poly : drawqueueitem {
flagtype flags; flagtype flags;
/** \brief Texture data for textured polygons. Requires POLY_TRIANGLES flag */ /** \brief Texture data for textured polygons. Requires POLY_TRIANGLES flag */
struct basic_textureinfo *tinf; struct basic_textureinfo *tinf;
/** \brief used to find the correct side to draw in spherical geometries */ /** \brief used to find the correct side to draw in spherical geometries, and also to sort sidewalls */
hyperpoint intester; hyperpoint intester;
/** \brief temporarily cached data */ /** \brief temporarily cached data */
float cache; float cache;
@ -2618,7 +2618,7 @@ EX void drawqueue() {
if(qp0[pp] == qp[pp]) continue; if(qp0[pp] == qp[pp]) continue;
for(int i=qp0[pp]; i<qp[pp]; i++) { for(int i=qp0[pp]; i<qp[pp]; i++) {
auto& ap = (dqi_poly&) *ptds[i]; auto& ap = (dqi_poly&) *ptds[i];
ap.cache = xintval(ap.V * xpush0(.1)); ap.cache = xintval(ap.V * ap.intester);
} }
sort(&ptds[qp0[pp]], &ptds[qp[pp]], sort(&ptds[qp0[pp]], &ptds[qp[pp]],
[] (const unique_ptr<drawqueueitem>& p1, const unique_ptr<drawqueueitem>& p2) { [] (const unique_ptr<drawqueueitem>& p1, const unique_ptr<drawqueueitem>& p2) {

View File

@ -320,16 +320,14 @@ void geometry_information::bshape_regular(floorshape &fsh, int id, int sides, ld
} }
for(auto p: allsides) { for(auto p: allsides) {
if(isize(fsh.gpside[p]) < c->type)
fsh.gpside[p].resize(c->type);
for(int i=0; i<c->type; i++) { for(int i=0; i<c->type; i++) {
sizeto(fsh.gpside[p][i], id); sizeto(fsh.side[p][i], id);
bshape(fsh.gpside[p][i][id], PPR::FLOOR_SIDE); bshape(fsh.side[p][i][id], PPR::FLOOR_SIDE);
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;
hyperpoint hd = (h1 - h0) / STEP; hyperpoint hd = (h1 - h0) / STEP;
for(int j=0; j<=STEP; j++) for(int j=0; j<=STEP; j++)
hpcpush(iddspin_side(c, i) * bt::get_horopoint(h0 + hd * j)); hpcpush(bt::get_horopoint(h0 + hd * j));
chasmifyPoly(dlow_table[p], dhi_table[p], p); chasmifyPoly(dlow_table[p], dhi_table[p], p);
} }
} }
@ -347,24 +345,16 @@ void geometry_information::bshape_regular(floorshape &fsh, int id, int sides, ld
hpcpush(xspinpush0(t * TAU / sides + shift * S_step, size * SHADMUL)); hpcpush(xspinpush0(t * TAU / sides + shift * S_step, size * SHADMUL));
for(auto p: allsides) { for(auto p: allsides) {
fsh.side[p].resize(2); fsh.side[p].resize(c->type);
bshape(fsh.side[p][id], PPR::FLOOR_SIDE);
hpcpush(xspinpush0(+M_PI/sides, size));
hpcpush(xspinpush0(-M_PI/sides, size));
chasmifyPoly(dlow_table[p], dhi_table[p], p);
if(cgi.emb->is_euc_in_noniso()) {
fsh.gpside[p].resize(c->type);
for(int i=0; i<c->type; i++) { for(int i=0; i<c->type; i++) {
sizeto(fsh.gpside[p][i], id); sizeto(fsh.side[p][i], id);
bshape(fsh.gpside[p][i][id], PPR::FLOOR_SIDE); bshape(fsh.side[p][i][id], PPR::FLOOR_SIDE);
hpcpush(xspinpush0(M_PI - i * TAU / sides + shift * S_step, size)); hpcpush(xspinpush0(- i * TAU / sides + shift * S_step, size));
hpcpush(xspinpush0(M_PI - (i + 1) * TAU / sides + shift * S_step, size)); hpcpush(xspinpush0(- (i+1) * TAU / sides + shift * S_step, size));
chasmifyPoly(dlow_table[p], dhi_table[p], p); chasmifyPoly(dlow_table[p], dhi_table[p], p);
} }
} }
} }
}
#if CAP_IRR #if CAP_IRR
namespace irr { void generate_floorshapes(); } namespace irr { void generate_floorshapes(); }
@ -416,11 +406,11 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
ld hexside = fsh.rad0, heptside = fsh.rad1; ld hexside = fsh.rad0, heptside = fsh.rad1;
for(auto p: allsides) sizeto(fsh.side[p], id);
ld td = (PURE && !(S7&1)) ? S42+S6 : 0; ld td = (PURE && !(S7&1)) ? S42+S6 : 0;
if(&fsh == &shBigHepta) td += S6; if(&fsh == &shBigHepta) td += S6;
if(dont_inverse()) td += S42;
if(S3 >= OINF && !(S7 & 1)) td = S42 * 1. / S7; if(S3 >= OINF && !(S7 & 1)) td = S42 * 1. / S7;
int b = 0; int b = 0;
@ -595,13 +585,13 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
hpcpush(mid_at(hpxy(0,0), cornerlist[i%cor], SHADMUL)); hpcpush(mid_at(hpxy(0,0), cornerlist[i%cor], SHADMUL));
for(auto p: allsides) { for(auto p: allsides) {
if(isize(fsh.gpside[p]) < cor) if(isize(fsh.side[p]) < cor)
fsh.gpside[p].resize(cor); fsh.side[p].resize(cor);
for(int cid=0; cid<cor; cid++) { for(int cid=0; cid<cor; cid++) {
sizeto(fsh.gpside[p][cid], id); sizeto(fsh.side[p][cid], id);
bshape(fsh.gpside[p][cid][id], fsh.prio); bshape(fsh.side[p][cid][id], fsh.prio);
hpcpush(iddspin_side(c, cid) * cornerlist[cid]); hpcpush(cornerlist[cid]);
hpcpush(iddspin_side(c, cid) * cornerlist[(cid+1)%cor]); hpcpush(cornerlist[(cid+1)%cor]);
chasmifyPoly(dlow_table[p], dhi_table[p], p); chasmifyPoly(dlow_table[p], dhi_table[p], p);
} }
} }
@ -791,11 +781,8 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
} }
for(auto p: allsides) { for(auto p: allsides) {
for(auto& li: fsh.side[p]) sizeto(fsh.side[p], c->type);
bind_floor_texture(li, fsh.id); for(auto& gs: fsh.side[p]) {
if(isize(fsh.gpside[p]) < c->type)
fsh.gpside[p].resize(c->type);
for(auto& gs: fsh.gpside[p]) {
for(auto& li: gs) for(auto& li: gs)
bind_floor_texture(li, fsh.id); bind_floor_texture(li, fsh.id);
} }
@ -809,13 +796,10 @@ void geometry_information::generate_floorshapes_for(int id, cell *c, int siid, i
fsh.levels[p] = shFullFloor.levels[p]; fsh.levels[p] = shFullFloor.levels[p];
fsh.shadow = shFullFloor.shadow; fsh.shadow = shFullFloor.shadow;
for(auto& li: fsh.levels[p]) bind_floor_texture(li, fsh.id); for(auto& li: fsh.levels[p]) bind_floor_texture(li, fsh.id);
fsh.side[p] = shFullFloor.side[p]; sizeto(fsh.side[p], c->type);
for(auto& li: fsh.side[p]) bind_floor_texture(li, fsh.id);
if(isize(fsh.gpside[p]) < c->type)
fsh.gpside[p].resize(c->type);
for(int e=0; e<c->type; e++) { for(int e=0; e<c->type; e++) {
fsh.gpside[p][e] = shFullFloor.gpside[p][e]; fsh.side[p][e] = shFullFloor.side[p][e];
for(auto& li: fsh.gpside[p][e]) for(auto& li: fsh.side[p][e])
bind_floor_texture(li, fsh.id); bind_floor_texture(li, fsh.id);
} }
fsh.cone[0] = shFullFloor.cone[0]; fsh.cone[0] = shFullFloor.cone[0];

View File

@ -94,8 +94,8 @@ struct floorshape {
int fstrength; // frame strength in 3D int fstrength; // frame strength in 3D
PPR prio; PPR prio;
vector<hpcshape> b, shadow, cone[2]; vector<hpcshape> b, shadow, cone[2];
sidearray<vector<hpcshape>> side, levels; sidearray<vector<hpcshape>> levels;
sidearray<vector<vector<hpcshape>>> gpside; sidearray<vector<vector<hpcshape>>> side;
floorshape() { prio = PPR::FLOOR; pstrength = fstrength = 10; } floorshape() { prio = PPR::FLOOR; pstrength = fstrength = 10; }
}; };

View File

@ -3934,15 +3934,8 @@ EX bool placeSidewall(cell *c, int i, SIDE sidepar, const shiftmatrix& V, color_
if((col & 255) < 255) prio = PPR::TRANSPARENT_WALL; if((col & 255) < 255) prio = PPR::TRANSPARENT_WALL;
if(cgi.emb->is_in_noniso()) {
draw_shapevec(c, V, qfi.fshape->gpside[sidepar][i], col, prio);
return false;
}
dynamicval<bool> ncor(approx_nearcorner, true); dynamicval<bool> ncor(approx_nearcorner, true);
shiftmatrix V2 = V * ddspin_side(c, i);
if(NONSTDVAR || !standard_tiling()) {
#if CAP_ARCM #if CAP_ARCM
if(arcm::in() && !PURE) if(arcm::in() && !PURE)
i = gmod(i + arcm::parent_index_of(c->master)/DUALMUL, c->type); i = gmod(i + arcm::parent_index_of(c->master)/DUALMUL, c->type);
@ -3954,15 +3947,11 @@ EX bool placeSidewall(cell *c, int i, SIDE sidepar, const shiftmatrix& V, color_
println(hlog, "ERROR: sidepar >= SIDEPARS: ", make_pair(int(sidepar), SIDEPARS)); println(hlog, "ERROR: sidepar >= SIDEPARS: ", make_pair(int(sidepar), SIDEPARS));
return false; return false;
} }
if(i >= isize(qfi.fshape->gpside[sidepar])) { if(i >= isize(qfi.fshape->side[sidepar])) {
println(hlog, "ERROR: i >= gpside[sidepar]", make_tuple(int(sidepar), i, isize(qfi.fshape->gpside[sidepar]))); println(hlog, "ERROR: i >= side[sidepar]", make_tuple(int(sidepar), i, isize(qfi.fshape->side[sidepar])));
return false; return false;
} }
draw_shapevec(c, V2, qfi.fshape->gpside[sidepar][i], col, prio); draw_shapevec(c, V, qfi.fshape->side[sidepar][i], col, prio);
return false;
}
queuepolyat(V2, qfi.fshape->side[sidepar][shvid(c)], col, prio);
return false; return false;
} }
#endif #endif

View File

@ -92,12 +92,15 @@ void geometry_information::hpcpush(hyperpoint h) {
void geometry_information::chasmifyPoly(double fol, double fol2, SIDE p) { void geometry_information::chasmifyPoly(double fol, double fol2, SIDE p) {
if(GDIM == 2) { if(GDIM == 2) {
hyperpoint tester = Hypc;
for(int i=isize(hpc)-1; i >= last->s; i--) { for(int i=isize(hpc)-1; i >= last->s; i--) {
tester += hpc[i];
hpc.push_back(orthogonal_move_fol(hpc[i], fol)); hpc.push_back(orthogonal_move_fol(hpc[i], fol));
hpc[i] = orthogonal_move_fol(hpc[i], fol2); hpc[i] = orthogonal_move_fol(hpc[i], fol2);
} }
hpc.push_back(hpc[last->s]); hpc.push_back(hpc[last->s]);
last->flags |= POLY_ISSIDE; last->flags |= POLY_ISSIDE;
last->intester = normalize(tester);
} }
else { else {
vector<hyperpoint> points; vector<hyperpoint> points;