// IndoorDrawPlan.cs // // Pure (GL-free) port of the membership half of retail PView::DrawCells (0x5a4840): // the reverse cell_draw_list iterated per portal_view slice. EVERY visible cell with a // non-empty view is included — there is NO "drawable" filter. Dropping cells without a // clip-slot was the grey-walls bug (the cell's sealed shell never drew → clear color showed). using System.Collections.Generic; namespace AcDream.App.Rendering; public readonly record struct CellDrawEntry(uint CellId, IReadOnlyList Slices); public static class IndoorDrawPlan { /// Reverse OrderedVisibleCells (far→near), each visible cell with its view /// slices. Mirrors DrawCells' shell/object loops. Cells whose view is empty are skipped /// (they are not actually visible); no other cell is ever dropped. public static List ShellPass(PortalVisibilityFrame frame) { var result = new List(frame.OrderedVisibleCells.Count); for (int i = frame.OrderedVisibleCells.Count - 1; i >= 0; i--) { uint cellId = frame.OrderedVisibleCells[i]; if (!frame.CellViews.TryGetValue(cellId, out var view) || view.IsEmpty) continue; result.Add(new CellDrawEntry(cellId, view.Polygons)); } return result; } }