fix(render): outdoor-root skips the full-screen depth clear (cellar/buildings no longer draw over the world)

Cutover-flip follow-up (issues 1+2 from the visual gate). After the flip an outdoor-node frame ran DrawInside with a full-screen OutsideView slice (Step A) whose ClearDepthSlice wiped the ENTIRE depth buffer AFTER terrain/exteriors/player drew — so the flooded building interior shells (cellars) drew over everything: the cellar painted in front of the player from outside, and distant building interiors showed through the ground in the open field.

The depth clear is a doorway look-in trick (clear a small door region so the cell seen through it draws over the terrain drawn through it). It is wrong for the full-screen base terrain of the outdoor root. Skip it there (ClearDepthSlice=null when clipRoot is the outdoor node); interiors now depth-test against terrain + exteriors and appear only through real door openings. Interior roots keep the doorway clear unchanged.

App 216/0, build green. Visual gate pending (player must be outdoors to exercise the outdoor root).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-07 20:18:33 +02:00
parent 445e861163
commit 88caa0dc8b

View file

@ -7527,13 +7527,24 @@ public sealed class GameWindow : IDisposable
renderSky,
kf,
environOverrideActive),
ClearDepthSlice = slice =>
{
bool zc = BeginDoorwayScissor(true, slice.NdcAabb);
_gl.Clear(ClearBufferMask.DepthBufferBit);
if (zc)
_gl.Disable(EnableCap.ScissorTest);
},
// The depth clear is a doorway "look-in" trick: clear depth inside a door/window
// region so the cell seen THROUGH it draws over the terrain drawn through that
// region (the indoor root looking out). For the OUTDOOR-node root the only
// OutsideView slice is the FULL-SCREEN base terrain, so clearing its depth wipes the
// entire depth buffer AFTER terrain/exteriors/player drew — the flooded building
// interiors (cellars) would then paint over everything (cellar in front of the
// player; building interiors through the ground). Outdoors the interiors must
// depth-test against terrain+exteriors and appear only through real door openings,
// so issue NO depth clear. Interior roots keep the doorway clear (unchanged).
ClearDepthSlice = ReferenceEquals(clipRoot, _outdoorNode)
? null
: slice =>
{
bool zc = BeginDoorwayScissor(true, slice.NdcAabb);
_gl.Clear(ClearBufferMask.DepthBufferBit);
if (zc)
_gl.Disable(EnableCap.ScissorTest);
},
DrawCellParticles = sliceCtx =>
DrawRetailPViewCellParticles(sliceCtx, camera, camPos),
EmitDiagnostics = result =>