fix(rendering): preserve exact scene traversal order

This commit is contained in:
Erik 2026-07-25 02:03:58 +02:00
parent 06e7754619
commit e0f36caa70
12 changed files with 500 additions and 77 deletions

View file

@ -178,6 +178,35 @@ internal readonly record struct RenderDegradeState(byte Level, uint Revision);
internal readonly record struct RenderSortKey(ulong Value);
/// <summary>
/// Read-only seam over the spatial owner's exact resident traversal. The
/// render scene consumes this derived order only; it does not acquire spatial
/// or gameplay ownership.
/// </summary>
internal interface IRenderTraversalOrderSource
{
bool TryGetTraversalSortKey(
WorldEntity entity,
out RenderSortKey sortKey);
}
internal static class RenderTraversalSortKey
{
public static RenderSortKey Compose(
uint landblockOrder,
int entityIndex)
{
if (landblockOrder == 0)
throw new ArgumentOutOfRangeException(nameof(landblockOrder));
if (entityIndex < 0)
throw new ArgumentOutOfRangeException(nameof(entityIndex));
return new RenderSortKey(
((ulong)landblockOrder << 32)
| checked((uint)entityIndex));
}
}
/// <summary>
/// Immutable source facts required to compare the derived presentation scene
/// with the accepted current path. These are diagnostics/render inputs only;