refactor(app): key live projections by runtime identity

Move materialized live-object sidecars and presentation worksets to exact RuntimeEntityKey ownership. Runtime remains the only GUID/incarnation/local-ID authority while hydration, animation, effects, lights, equipped children, renderer resources, visibility, liveness, and teardown resolve exact projection identities. Preserve synchronous callbacks, local-ID allocation order, and current rendering behavior.
This commit is contained in:
Erik 2026-07-25 21:50:58 +02:00
parent e18df84437
commit 420e5eea70
73 changed files with 2939 additions and 1715 deletions

View file

@ -15,9 +15,7 @@ public sealed class LiveEntityAnimationRuntimeView<TAnimation>
internal LiveEntityAnimationRuntimeView(ILiveEntityRuntimeSource runtime) =>
_runtime = runtime ?? throw new ArgumentNullException(nameof(runtime));
public int Count => _runtime.Current?.SpatialAnimationRuntimes.Count ?? 0;
public IEnumerable<uint> Keys =>
_runtime.Current?.SpatialAnimationRuntimes.Keys ?? Array.Empty<uint>();
public int Count => _runtime.Current?.SpatialAnimationRuntimeCount ?? 0;
public TAnimation this[uint localEntityId]
{
@ -52,6 +50,12 @@ public sealed class LiveEntityAnimationRuntimeView<TAnimation>
&& runtime.ClearAnimationRuntime(guid);
}
internal bool Remove(LiveEntityRecord record)
{
ArgumentNullException.ThrowIfNull(record);
return _runtime.Current?.ClearAnimationRuntime(record) == true;
}
/// <summary>Copies only currently resident local IDs without boxing a
/// dictionary-key enumerator.</summary>
public void CopySpatialIdsTo(HashSet<uint> destination)
@ -110,10 +114,9 @@ public sealed class LiveEntityAnimationRuntimeView<TAnimation>
while (++_index < _snapshot.Count)
{
KeyValuePair<uint, TAnimation> pair = _snapshot[_index];
if (_runtime?.SpatialAnimationRuntimes.TryGetValue(
if (_runtime?.IsCurrentSpatialAnimation(
pair.Key,
out ILiveEntityAnimationRuntime? indexed) == true
&& ReferenceEquals(indexed, pair.Value))
pair.Value) == true)
{
Current = pair;
return true;