using System.Numerics;
using AcDream.App.Rendering;
namespace AcDream.App.Tests.Rendering;
///
/// S3 landing hygiene (H2):
/// 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 (),
/// and that caller never actually passed either (grep). The doorway-clip/scissor
/// rejection cases this file used to pin (RejectsCellsOutsideDoorwayClipPlanes,
/// RejectsCellsOutsideDoorwayScissorAabb, UnionsCellsFromEveryLandscapeSlice)
/// 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.
///
public sealed class TerrainParticleCellVisibilityTests
{
[Fact]
public void CollectVisibleCells_PublishesLandscapeCellsWithoutEntitySurvivors()
{
var cells = new HashSet();
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();
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);
}
}