feat(overhaul): port S5 particle cell visibility

Publish the exact completed walk landscape set as the typed retained particle-view product. Apply retail CLandCell membership versus constant-true non-null CEnvCell eligibility while preserving the x87 distance and AP-116 behavior.

Delete the null-root terrain visibility reconstruction and the dead drawable-cell point-light feedback chain. Retire AP-117, correct AP-85 and AD-21, and keep directional shadows, building degrade, AP-232, probes, RHI, shaders, and DAT outside this chunk.

Automated return: Release 0 warnings/0 errors; Core VFX 111/111; App particle/frame/renderer/terrain 146/146; warmed production allocation 1/1 at 0 B. First official hermetic artifact s5-c1-hermetic-20260904 is preserved at 16759/16760 with only the stale 162-row assertion; after the bounded 161 correction, exact pin 1/1 and fresh s5-c1-hermetic-corrected-20260904 16760/16760. InstalledDat 385 pass, 10 documented failures, 1 documented skip, no new identity.

Mutation 1: making EnvCell eligibility set-dependent first failed ParticleSystemTests.cs:553 Assert.True, expected true actual false. Mutation 2: making outdoor eligibility constant true first failed ParticleSystemTests.cs:559 Assert.False, expected false actual true.

Mutation 3: feeding the diagnostic union first failed WorldSceneRendererTests.cs:279 HashSet equality, expected [16842755], actual [16843008, 16842755]. Mutation 4: restoring CollectVisibleCells first failed TerrainParticleCellVisibilityTests.cs:37 and named TerrainModernRenderer.cs.

Mutation 5: restoring ObserveDrawableCells first failed TerrainParticleCellVisibilityTests.cs:37 and named WorldRenderFrameBuilder.cs. Mutation 6: changing the inclusive boundary from <= to < first failed ParticleSystemTests.cs:519 Assert.True, expected true actual false.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-09-04 16:27:46 +02:00
parent efb0756190
commit 94a6b5ef39
18 changed files with 352 additions and 269 deletions

View file

@ -1,58 +1,42 @@
using System.Numerics;
using AcDream.App.Rendering;
using AcDream.App.Tests.Rendering.Walk;
namespace AcDream.App.Tests.Rendering;
/// <summary>
/// S3 landing hygiene (H2): <see cref="TerrainModernRenderer.CollectVisibleCells"/>
/// is frustum-only now — its clip-plane-list and NDC-AABB scissor
/// parameters and the CPU/GPU clip-region equivalence check they fed had
/// exactly one production caller (<see cref="TerrainModernRenderer.Draw"/>),
/// and that caller never actually passed either (grep). The doorway-clip/scissor
/// rejection cases this file used to pin (<c>RejectsCellsOutsideDoorwayClipPlanes</c>,
/// <c>RejectsCellsOutsideDoorwayScissorAabb</c>, <c>UnionsCellsFromEveryLandscapeSlice</c>)
/// pinned a mechanism nothing in production ever fed — deleted with the
/// parameters. What remains still pins the one thing this method's callers
/// actually rely on: it publishes the visible terrain cell set per landblock,
/// respecting an explicit frustum when one is given.
/// Campaign OVERHAUL S5-c1: the null-root terrain path remains a safety draw,
/// but it may not reconstruct or publish a competing cell-visibility answer.
/// The same architecture pin protects the deleted point-light feedback seam.
/// </summary>
public sealed class TerrainParticleCellVisibilityTests
{
[Fact]
public void CollectVisibleCells_PublishesLandscapeCellsWithoutEntitySurvivors()
public void ProductionRetainsNoReconstructedVisibilityOrLightFeedbackSymbols()
{
var cells = new HashSet<uint>();
string sourceRoot = Path.Combine(WalkOracleTraceRepoRoot.Find(), "src");
string[] production = Directory.GetFiles(
sourceRoot,
"*.cs",
SearchOption.AllDirectories);
string[] forbidden =
[
"CollectVisibleCells",
"TerrainVisibleCellIds",
"ObserveDrawableCells",
"ClearDrawableCells",
];
TerrainModernRenderer.CollectVisibleCells(
cells,
0xA9B4FFFFu,
Vector3.Zero,
zMin: 0f,
zMax: 20f,
frustum: null);
Assert.Equal(64, cells.Count);
Assert.Contains(0xA9B40001u, cells);
Assert.Contains(0xA9B40040u, cells);
}
[Fact]
public void CollectVisibleCells_ForceDrawnParentStillUsesCellFrustum()
{
var cells = new HashSet<uint>();
FrustumPlanes frustum = FrustumPlanes.FromViewProjection(Matrix4x4.Identity);
// The parent landblock may have entered TerrainModernRenderer's draw
// list through neverCullLandblockId. The cell collector deliberately
// receives no such bypass and still rejects its off-frustum cells.
TerrainModernRenderer.CollectVisibleCells(
cells,
0xA9B4FFFFu,
new Vector3(100f, 100f, 100f),
zMin: 100f,
zMax: 120f,
frustum);
Assert.Empty(cells);
foreach (string symbol in forbidden)
{
string[] owners = production
.Where(path => File.ReadAllText(path).Contains(
symbol,
StringComparison.Ordinal))
.Select(path => Path.GetRelativePath(sourceRoot, path))
.OrderBy(path => path, StringComparer.Ordinal)
.ToArray();
Assert.True(
owners.Length == 0,
$"Production symbol {symbol} remains in: {string.Join(", ", owners)}");
}
}
}