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

@ -63,12 +63,24 @@ internal sealed class StaticRenderProjectionJournal :
if (!publication.RequiresActivation)
return;
if (publication.RenderTraversalOrder == 0)
{
throw new InvalidOperationException(
$"Landblock 0x{landblockId:X8} has no render traversal order.");
}
_candidates.Clear();
for (int i = 0; i < publication.Landblock.Entities.Count; i++)
{
WorldEntity entity = publication.Landblock.Entities[i];
if (entity.ServerGuid == 0)
_candidates.Add(ProjectStaticEntity(landblockId, entity));
{
_candidates.Add(ProjectStaticEntity(
landblockId,
entity,
RenderTraversalSortKey.Compose(
publication.RenderTraversalOrder,
i)));
}
}
if (build.EnvCells is { } envCells)
@ -237,6 +249,7 @@ internal sealed class StaticRenderProjectionJournal :
{
PreviousTransform = new PreviousRenderTransform(
tracked.Record.Transform.LocalToWorld),
SortKey = tracked.Record.SortKey,
};
if (tracked.Record.ProjectionClass
!= RenderProjectionClass.ActiveAnimatedStatic)
@ -290,7 +303,8 @@ internal sealed class StaticRenderProjectionJournal :
private RenderProjectionRecord ProjectStaticEntity(
uint landblockId,
WorldEntity entity)
WorldEntity entity,
RenderSortKey sortKey)
{
RenderProjectionId id = StaticEntityId(landblockId, entity.Id);
uint fullCellId = entity.ParentCellId ?? landblockId;
@ -303,7 +317,10 @@ internal sealed class StaticRenderProjectionJournal :
landblockId,
fullCellId,
entity,
spatiallyVisible: true);
spatiallyVisible: true) with
{
SortKey = sortKey,
};
}
private static RenderProjectionRecord ProjectEnvCellShell(