fixed sky over irregular map

This commit is contained in:
Zeno Rogue 2022-12-16 00:36:44 +01:00
parent 68b7beb753
commit db43ea9de8
2 changed files with 20 additions and 12 deletions

View File

@ -1056,21 +1056,23 @@ EX array<heptagon*, 3> get_masters(cell *c) {
return make_array(s0.at, (s0 + wstep).at, (s0 + 1 + wstep).at);
}
EX void swap_vertices() {
for(auto& c: cells) {
swapmatrix(c.p);
swapmatrix(c.pusher);
swapmatrix(c.rpusher);
for(auto& jp: c.jpoints) swapmatrix(jp);
for(auto& rm: c.relmatrices) swapmatrix(rm.second);
for(auto& v: c.vertices) swapmatrix(v);
}
}
auto hook =
#if CAP_COMMANDLINE
addHook(hooks_args, 100, readArgs) +
#endif
#if MAXMDIM >= 4
addHook(hooks_swapdim, 100, [] {
for(auto& c: cells) {
swapmatrix(c.p);
swapmatrix(c.pusher);
swapmatrix(c.rpusher);
for(auto& jp: c.jpoints) swapmatrix(jp);
for(auto& rm: c.relmatrices) swapmatrix(rm.second);
for(auto& v: c.vertices) swapmatrix(v);
}
}) +
addHook(hooks_swapdim, 100, swap_vertices) +
#endif
addHook(hooks_drawcell, 100, draw_cell_schematics) +
addHook(shmup::hooks_turn, 100, step);

10
sky.cpp
View File

@ -518,6 +518,12 @@ void celldrawer::draw_ceiling() {
EX struct renderbuffer *airbuf;
EX void swap_if_missing(bool missing) {
if(!missing) return;
arb::swap_vertices();
irr::swap_vertices();
}
EX void make_air() {
if(!sky) return;
@ -576,7 +582,7 @@ EX void make_air() {
geom3::apply_always3();
check_cgi();
missing = !(cgi.state & 2);
if(missing) arb::swap_vertices();
swap_if_missing(missing);
cgi.require_shapes();
eGeometry orig = geometry;
@ -625,7 +631,7 @@ EX void make_air() {
GLERR("after draw");
geom3::apply_always3();
if(missing) arb::swap_vertices();
swap_if_missing(missing);
check_cgi();
calcparam();
GLERR("after make_air");