feat(envcell): CellHasTransparent predicate (shell-batching prep)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-23 15:50:31 +02:00
parent e27923b4b5
commit f72f7ce1f4

View file

@ -1053,6 +1053,29 @@ public sealed unsafe class EnvCellRenderer : IDisposable
}
}
/// <summary>
/// True if the cell's prepared snapshot has any transparent render batch.
/// The pview shell pass uses this to skip the (heavy per-frame) transparent
/// <see cref="Render"/> call for opaque-only cells — most cell geometry is
/// opaque walls/floors/ceilings, so this removes the bulk of the per-cell
/// transparent draws. Read-only; mirrors the [shell] probe's batch scan.
/// </summary>
public bool CellHasTransparent(uint cellId)
{
var snapshot = _activeSnapshot;
if (snapshot is null || !snapshot.BatchedByCell.TryGetValue(cellId, out var gfxDict))
return false;
foreach (var (gfxObjId, transforms) in gfxDict)
{
if (transforms.Count == 0) continue;
var rd = _meshManager.TryGetRenderData(gfxObjId);
if (rd is null) continue;
foreach (var b in rd.Batches)
if (b.IsTransparent) return true;
}
return false;
}
// ---------------------------------------------------------------------------
// GetCellLightSet (A7 Fix D D-2 helper)
// Per-cell up-to-8 point lights, cached per frame. Camera-independent, like