feat(render): IndoorDrawPlan.ShellPass — every visible cell, no drawable filter (R1)
Pure port of retail DrawCells membership: reverse cell_draw_list, per-slice. Pins the grey regression — a cell in OrderedVisibleCells is never dropped from the shell pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2ec8f41200
commit
bff1955066
2 changed files with 76 additions and 0 deletions
46
tests/AcDream.App.Tests/Rendering/IndoorDrawPlanTests.cs
Normal file
46
tests/AcDream.App.Tests/Rendering/IndoorDrawPlanTests.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using AcDream.App.Rendering;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering;
|
||||
|
||||
public class IndoorDrawPlanTests
|
||||
{
|
||||
private static ViewPolygon Quad() => new(new[]
|
||||
{ new Vector2(-1, -1), new Vector2(1, -1), new Vector2(1, 1), new Vector2(-1, 1) });
|
||||
|
||||
private static PortalVisibilityFrame FrameWith(params uint[] orderedCells)
|
||||
{
|
||||
var f = new PortalVisibilityFrame();
|
||||
foreach (var id in orderedCells)
|
||||
{
|
||||
f.OrderedVisibleCells.Add(id);
|
||||
var v = new CellView(); v.Add(Quad());
|
||||
f.CellViews[id] = v;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShellPass_IncludesEveryVisibleCell_NoFilter()
|
||||
{
|
||||
// The grey bug: a cell in OrderedVisibleCells must NEVER be dropped from the
|
||||
// shell pass. (Old code dropped cells lacking a ClipFrameAssembler slot.)
|
||||
var f = FrameWith(0x01, 0x02, 0x03);
|
||||
var plan = IndoorDrawPlan.ShellPass(f);
|
||||
Assert.Equal(new uint[] { 0x03, 0x02, 0x01 }, plan.Select(e => e.CellId).ToArray()); // reverse = far→near
|
||||
Assert.All(plan, e => Assert.NotEmpty(e.Slices));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShellPass_ExcludesEmptyViewCells()
|
||||
{
|
||||
var f = FrameWith(0x01);
|
||||
f.OrderedVisibleCells.Add(0x02); // present in the list…
|
||||
f.CellViews[0x02] = new CellView(); // …but empty view → not drawable
|
||||
var plan = IndoorDrawPlan.ShellPass(f);
|
||||
Assert.Equal(new uint[] { 0x01 }, plan.Select(e => e.CellId).ToArray());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue