refactor(render): publish the walk visible-cell set
This commit is contained in:
parent
c9fb7e7d4c
commit
877e935ac4
4 changed files with 29 additions and 46 deletions
|
|
@ -442,14 +442,18 @@ public sealed class RetailPViewRenderer
|
|||
int terrainUploadCount = checked(1 + clipAssembly.OutsideViewSlices.Length * 2);
|
||||
passes.PrepareClipFrame(terrainUploadCount);
|
||||
|
||||
// #124: look-in cells need prepared shell batches + their statics routed
|
||||
// into partition.ByCell (consumed ONLY by DrawBuildingLookIns — the main
|
||||
// cell-object pass iterates pvFrame.OrderedVisibleCells, which never
|
||||
// contains them). drawableCells itself stays the MAIN flood: it feeds the
|
||||
// seals, the outside-stage predicate, and the frame result.
|
||||
// Production prepares exactly the walk's visited-cell set. The
|
||||
// legacy builder's main-flood/look-in union survives only for
|
||||
// standalone fake executors until the shell-deletion slice.
|
||||
var prepareCells = drawableCells;
|
||||
_lookInCellIds.Clear();
|
||||
if (_lookInFrames.Count > 0 || walkActive)
|
||||
if (walkActive)
|
||||
{
|
||||
_lookInPrepareScratch.Clear();
|
||||
_lookInPrepareScratch.UnionWith(walkDriver!.VisitedCells);
|
||||
prepareCells = _lookInPrepareScratch;
|
||||
}
|
||||
else if (_lookInFrames.Count > 0)
|
||||
{
|
||||
_lookInPrepareScratch.Clear();
|
||||
_lookInPrepareScratch.UnionWith(drawableCells);
|
||||
|
|
@ -461,13 +465,6 @@ public sealed class RetailPViewRenderer
|
|||
_lookInCellIds.Add(c);
|
||||
}
|
||||
}
|
||||
if (walkActive)
|
||||
{
|
||||
// The walk's own flood/look-in cell set — unioned in (never
|
||||
// aliased with drawableCells, which the outside-stage and seal
|
||||
// predicates below still need scoped to the OLD flood only).
|
||||
_lookInPrepareScratch.UnionWith(walkDriver!.VisitedCells);
|
||||
}
|
||||
prepareCells = _lookInPrepareScratch;
|
||||
}
|
||||
|
||||
|
|
@ -2876,20 +2873,11 @@ public sealed class RetailPViewFrameResult
|
|||
public HashSet<uint> DrawableCells { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Every cell this completed view actually reached: the main flood
|
||||
/// (<see cref="DrawableCells"/>) plus the building look-in cells. This is
|
||||
/// retail's per-cell <c>in_view</c> answer for effect consumers —
|
||||
/// <c>CPhysicsObj::ShouldDrawParticles</c> @0x0050FE60 gates on
|
||||
/// <c>cell->IsInView()</c>, and a cell entered through a building portal
|
||||
/// (<c>PView::ConstructView</c> @0x005A57B0, installed by
|
||||
/// <c>RenderDeviceD3D::DrawBuilding</c> @0x0059F2A0) is drawn by the same
|
||||
/// <c>PView::DrawCells</c> traversal as a flooded cell, so retail marks it
|
||||
/// in view identically. acdream's look-in adaptation keeps those cells out
|
||||
/// of <see cref="DrawableCells"/> (seals / outside-stage predicate stay
|
||||
/// main-flood scoped, #124); particle and light visibility must consume
|
||||
/// THIS set or look-in rooms render with frozen emitters and dark lights.
|
||||
/// The production retail walk's exact visited-cell set. This is the one
|
||||
/// visibility answer consumed by EnvCell preparation, particles, lights,
|
||||
/// and directional-shadow filtering.
|
||||
/// </summary>
|
||||
public HashSet<uint> InViewCells { get; private set; } = null!;
|
||||
public HashSet<uint> VisibleCells { get; private set; } = null!;
|
||||
|
||||
internal RenderFrameDiagnosticCounts DiagnosticCounts { get; private set; }
|
||||
internal RenderProjectionCounts SourceCounts { get; private set; }
|
||||
|
|
@ -2900,7 +2888,7 @@ public sealed class RetailPViewFrameResult
|
|||
PortalVisibilityFrame portalFrame,
|
||||
ClipFrameAssembly clipAssembly,
|
||||
HashSet<uint> drawableCells,
|
||||
HashSet<uint> inViewCells,
|
||||
HashSet<uint> visibleCells,
|
||||
RenderFrameDiagnosticCounts diagnosticCounts,
|
||||
RenderProjectionCounts sourceCounts,
|
||||
InteriorEntityPartition.Result? diagnosticPartition)
|
||||
|
|
@ -2908,7 +2896,7 @@ public sealed class RetailPViewFrameResult
|
|||
PortalFrame = portalFrame;
|
||||
ClipAssembly = clipAssembly;
|
||||
DrawableCells = drawableCells;
|
||||
InViewCells = inViewCells;
|
||||
VisibleCells = visibleCells;
|
||||
DiagnosticCounts = diagnosticCounts;
|
||||
SourceCounts = sourceCounts;
|
||||
DiagnosticPartition = diagnosticPartition;
|
||||
|
|
|
|||
|
|
@ -217,6 +217,8 @@ internal sealed class WorldSceneRenderer : IPreparedWorldSceneFramePhase
|
|||
// this phase only enforces it.
|
||||
_passes.DrawFlatTerrain(in camera, roots.PlayerLandblockId);
|
||||
terrainDrawn = true;
|
||||
if (_passes.TerrainVisibleCellIds is { } flatTerrainCells)
|
||||
_particleVisibility.MarkVisibleCells(flatTerrainCells);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -254,14 +256,11 @@ internal sealed class WorldSceneRenderer : IPreparedWorldSceneFramePhase
|
|||
camera.Camera.View,
|
||||
_diagnostics.CameraCellResolution));
|
||||
|
||||
// Effect visibility consumes InViewCells (main flood ∪ look-in
|
||||
// cells), not the flood-only DrawableCells: retail's
|
||||
// ShouldDrawParticles @0x0050FE60 asks cell->IsInView(), and a
|
||||
// look-in cell drawn via DrawBuilding @0x0059F2A0 is in view
|
||||
// exactly like a flooded cell. Flood-only scoping froze
|
||||
// emitters and darkened lights in visible adjacent rooms.
|
||||
_particleVisibility.MarkVisibleCells(pviewResult.InViewCells);
|
||||
_frames.ObserveDrawableCells(pviewResult.InViewCells);
|
||||
// One visibility answer: the walk's exact visited-cell set
|
||||
// feeds effects and the frame environment (point lights and
|
||||
// directional-shadow filtering).
|
||||
_particleVisibility.MarkVisibleCells(pviewResult.VisibleCells);
|
||||
_frames.ObserveDrawableCells(pviewResult.VisibleCells);
|
||||
_diagnostics.EmitPViewInput(
|
||||
pviewResult.PortalFrame,
|
||||
camera.ViewProjection,
|
||||
|
|
@ -441,8 +440,6 @@ internal sealed class WorldSceneRenderer : IPreparedWorldSceneFramePhase
|
|||
private void CompleteWorldFrame()
|
||||
{
|
||||
_alpha.EndFrame();
|
||||
if (_passes.TerrainVisibleCellIds is { } visibleTerrainCells)
|
||||
_particleVisibility.MarkVisibleCells(visibleTerrainCells);
|
||||
_particleVisibility.CompleteFrame();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue