diff --git a/floorshapes.cpp b/floorshapes.cpp index 0143c071..98da6e4f 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -470,6 +470,9 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) { finishshape(); for(auto pfsh: all_plain_floorshapes) { auto& fsh = *pfsh; + + for(int i=fsh.shadow[id].s; icone[0], darkena(wcol, 0, 0xFF), PPR::WALL); + dynamicval p(poly_outline, OUTLINE_TRANS); + draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW); return; } color_t wcol0 = wcol; @@ -4014,6 +4016,9 @@ void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int c forCellIdEx(c2, i, c) if(!highwall(c2) || conegraph(c2)) placeSidewall(c, i, SIDE_WALL, V, darkena(wcol2, fd, 255)); + + dynamicval p(poly_outline, OUTLINE_TRANS); + draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW); return; } @@ -5555,6 +5560,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(c->land == laOceanWall && wmescher && wmspatial) { if(GDIM == 3 && qfi.fshape) { draw_shapevec(c, V, qfi.fshape->cone[1], darkena(wcol, 0, 0xFF), PPR::WALL); + dynamicval p(poly_outline, OUTLINE_TRANS); + draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW); break; } const int layers = 2 << detaillevel; @@ -5629,6 +5636,8 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { else if(c->wall == waExplosiveBarrel) { if(DIM == 3 && qfi.fshape) { draw_shapevec(c, V, qfi.fshape->cone[1], 0xD00000FF, PPR::REDWALL); + dynamicval p(poly_outline, OUTLINE_TRANS); + draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW); break; } const int layers = 2 << detaillevel; @@ -5641,8 +5650,11 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { else if(isFire(c) || isThumper(c) || c->wall == waBonfireOff) { auto V2 = V; if(hasTimeout(c)) V2 = V2 * spintick(c->land == laPower ? 5000 : 500); - if(GDIM == 3 && qfi.fshape) + if(GDIM == 3 && qfi.fshape) { draw_shapevec(c, V2, qfi.fshape->cone[1], darkena(wcol, 0, 0xF0), PPR::WALL); + dynamicval p(poly_outline, OUTLINE_TRANS); + draw_shapevec(c, V, qfi.fshape->shadow, SHADOW_WALL, PPR::WALLSHADOW); + } else queuepoly(V2, shStar, darkena(wcol, 0, 0xF0)); if(isFire(c) && rand() % 300 < ticks - lastt) drawParticle(c, wcol, 75); diff --git a/polygons.cpp b/polygons.cpp index c597dc90..a6ba77da 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -672,6 +672,7 @@ void dqi_poly::gldraw() { if(flags & POLY_TRIANGLES) { glhr::color2(color); glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE); + glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW); glDrawArrays(GL_TRIANGLES, ioffset, cnt); } else { @@ -687,6 +688,7 @@ void dqi_poly::gldraw() { current_display->set_mask(ed); glhr::color2(color); glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE); + glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW); if(flags & (POLY_INVERSE | POLY_FORCE_INVERTED)) { glStencilOp( GL_ZERO, GL_ZERO, GL_ZERO); diff --git a/shaders.cpp b/shaders.cpp index d879ca89..89b43a28 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -781,5 +781,17 @@ void set_depthtest(bool b) { else glDisable(GL_DEPTH_TEST); } } + + +bool current_depthwrite; + +void set_depthwrite(bool b) { + if(b != current_depthwrite) { + current_depthwrite = b; + if(b) glDepthMask(GL_TRUE); + else glDisable(GL_FALSE); + } + } + } }