feat(render): Phase A8.F — wire-in #3 cross-building via clipped bit-1 (ungate Step 5)
This commit is contained in:
parent
5a012c05f0
commit
e0051e0764
1 changed files with 30 additions and 17 deletions
|
|
@ -11176,20 +11176,31 @@ public sealed class GameWindow : IDisposable
|
||||||
set: AcDream.App.Rendering.Wb.WbDrawDispatcher.EntitySet.OutdoorScenery);
|
set: AcDream.App.Rendering.Wb.WbDrawDispatcher.EntitySet.OutdoorScenery);
|
||||||
_a8PerfLastStaticStats = _wbDrawDispatcher.LastDrawStats;
|
_a8PerfLastStaticStats = _wbDrawDispatcher.LastDrawStats;
|
||||||
|
|
||||||
// Step 5: per-other-building 3-bit stencil pipeline.
|
// Step 5: per-other-building 3-bit stencil pipeline (cross-building
|
||||||
// WB VisibilityManager.cs:157-232
|
// visibility — wire-in #3). WB VisibilityManager.cs:157-232.
|
||||||
//
|
//
|
||||||
// GATED OFF BY DEFAULT. Current acdream does not yet have WB's
|
// Phase A8.F (Task 8, 2026-05-28): UNGATED. Previously gated behind
|
||||||
// portal-manager visibility/occlusion lifecycle; feeding this loop
|
// ACDREAM_A8_STEP5 because bit 1 was the old flat all-exit-portals
|
||||||
// directly from all loaded building registries causes unrelated
|
// mask — feeding the cross-building pass from that over-broad mask let
|
||||||
// buildings' EnvCells to overwrite exterior walls through stale or
|
// unrelated buildings' EnvCells overwrite exterior walls. That risk is
|
||||||
// over-broad portal masks. Keep the apparatus, but require an explicit
|
// gone now: bit 1 is the recursively-CLIPPED OutsideView written by
|
||||||
// opt-in until the portal list is proven equivalent to WB's
|
// MarkAndPunchNdc above (Task 6). Step 5a marks bit 2 only WHERE bit 1
|
||||||
// _visibleBuildingPortals.
|
// is set (StencilFunc Equal,3,0x01), so building B's cells render only
|
||||||
bool step5Enabled = string.Equals(
|
// where B's portals overlap our correctly-clipped opening (stencil==3 =
|
||||||
Environment.GetEnvironmentVariable("ACDREAM_A8_STEP5"), "1",
|
// bit1 AND bit2). In a cellar the stairwell-clipped OutsideView is tiny,
|
||||||
StringComparison.Ordinal);
|
// so stencil==3 is essentially empty and Step 5 does ~nothing → no
|
||||||
if (step5Enabled && didInsideStencil && otherBuildings.Count > 0)
|
// cellar artifacts. Non-overlapping buildings likewise produce empty
|
||||||
|
// stencil==3, so the frustum/radius-culled `otherBuildings` list is safe
|
||||||
|
// either way.
|
||||||
|
//
|
||||||
|
// The builder's CrossBuildingViews field is intentionally UNUSED:
|
||||||
|
// cross-building visibility is exit-portal screen-overlap, handled
|
||||||
|
// entirely by this loop reading the clipped bit 1. (CrossBuildingViews
|
||||||
|
// is dead output, slated for cleanup in a later task.)
|
||||||
|
//
|
||||||
|
// Runs whenever we're inside with a non-empty clipped OutsideView
|
||||||
|
// (didInsideStencil) and there is at least one other visible building.
|
||||||
|
if (didInsideStencil && otherBuildings.Count > 0)
|
||||||
{
|
{
|
||||||
gl.Enable(EnableCap.StencilTest);
|
gl.Enable(EnableCap.StencilTest);
|
||||||
gl.ColorMask(false, false, false, false);
|
gl.ColorMask(false, false, false, false);
|
||||||
|
|
@ -11262,9 +11273,10 @@ public sealed class GameWindow : IDisposable
|
||||||
// anything that relies on alpha-to-coverage writing alpha). Restore
|
// anything that relies on alpha-to-coverage writing alpha). Restore
|
||||||
// full ColorMask before returning to the outer render frame.
|
// full ColorMask before returning to the outer render frame.
|
||||||
//
|
//
|
||||||
// Step 5's iteration loop (when ACDREAM_A8_STEP5=1) leaves
|
// Step 5's iteration loop (now always-on when inside + other
|
||||||
// DepthMask=false / CullFace=disabled / ColorMask=(f,f,f,f) on
|
// buildings overlap) leaves DepthMask=false / CullFace=disabled /
|
||||||
// its last iteration. Restore to acdream-default before returning.
|
// ColorMask=(f,f,f,f) on its last iteration. Restore to
|
||||||
|
// acdream-default before returning.
|
||||||
gl.ColorMask(true, true, true, true);
|
gl.ColorMask(true, true, true, true);
|
||||||
gl.DepthMask(true);
|
gl.DepthMask(true);
|
||||||
gl.DepthFunc(DepthFunction.Less);
|
gl.DepthFunc(DepthFunction.Less);
|
||||||
|
|
@ -11297,7 +11309,8 @@ public sealed class GameWindow : IDisposable
|
||||||
// - [envcells] cells>=1 tris>=1 filterCnt>=1 for at least one indoor frame
|
// - [envcells] cells>=1 tris>=1 filterCnt>=1 for at least one indoor frame
|
||||||
// - [stencil] op=mark verts>0 fires per camera-building
|
// - [stencil] op=mark verts>0 fires per camera-building
|
||||||
// - [draworder] shows steps 1 → 2 → 3 → 4 per indoor frame
|
// - [draworder] shows steps 1 → 2 → 3 → 4 per indoor frame
|
||||||
// (and 5{a,b,c,d} only when ACDREAM_A8_STEP5=1)
|
// (and 5{a,b,c,d} whenever inside + a visible other building's
|
||||||
|
// portals overlap the clipped bit-1 OutsideView)
|
||||||
|
|
||||||
private int _phaseA8DrawOrderFrame = 0;
|
private int _phaseA8DrawOrderFrame = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue