diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 1a70867e3..632d06c7f 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -3995,17 +3995,21 @@ void polymost_drawsprite(int32_t snum) break; // else, render as flat sprite } - if (r_voxels && (tspr->cstat & 48) != 48 && tiletovox[tspr->picnum] >= 0 && voxmodels[tiletovox[tspr->picnum]]) + if (r_voxels) { - if (polymost_voxdraw(voxmodels[tiletovox[tspr->picnum]], tspr)) return; - break; // else, render as flat sprite + if ((tspr->cstat & 48) != 48 && tiletovox[tspr->picnum] >= 0 && voxmodels[tiletovox[tspr->picnum]]) + { + if (polymost_voxdraw(voxmodels[tiletovox[tspr->picnum]], tspr)) return; + break; // else, render as flat sprite + } + + if ((tspr->cstat & 48) == 48 && voxmodels[tspr->picnum]) + { + polymost_voxdraw(voxmodels[tspr->picnum], tspr); + return; + } } - if ((tspr->cstat & 48) == 48 && voxmodels[tspr->picnum]) - { - polymost_voxdraw(voxmodels[tspr->picnum], tspr); - return; - } break; } diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index 6c8254c40..2f0915a20 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -1091,8 +1091,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, tspriteptr_t const tspr) GLInterface.EnableBlend(true); // else GLInterface.EnableBlend(false); } else pc[3] = 1.f; - GLInterface.SetFadeDisable(true); // disable depth fading. The voxel code is somewhat broken and messes this up. - GLInterface.SetShade(0, numshades); + GLInterface.SetShade(std::max(0, globalshade), numshades); //------------ //transform to Build coords diff --git a/wadsrc/static/demolition/shaders/glsl/polymost.vp b/wadsrc/static/demolition/shaders/glsl/polymost.vp index 18d65d413..6ba731b59 100644 --- a/wadsrc/static/demolition/shaders/glsl/polymost.vp +++ b/wadsrc/static/demolition/shaders/glsl/polymost.vp @@ -35,5 +35,5 @@ void main() v_fogCoord = abs(eyeCoordPosition.z); v_color = i_color; - v_distance = i_vertPos.z; + v_distance = eyeCoordPosition.z; }