Detach old-world spatial ownership atomically, prioritize destination retirement dependencies, and reveal the viewport at the retail transition edge. Give private paperdoll views independent mesh ownership and retain dormant ACE entities so portal revisits preserve server objects without extending active GPU lifetimes.
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
using AcDream.App.Streaming;
|
|
|
|
namespace AcDream.App.Rendering;
|
|
|
|
/// <summary>
|
|
/// Applies one reveal generation to every render-resource participant and
|
|
/// restores their ordinary profile only when that exact generation ends.
|
|
/// Replacing an active generation keeps priority continuously enabled.
|
|
/// </summary>
|
|
internal sealed class WorldRevealRenderResourceScheduler
|
|
: IWorldRevealRenderResourceScheduler
|
|
{
|
|
private readonly Action<bool>[] _participants;
|
|
private long _activeGeneration;
|
|
|
|
public WorldRevealRenderResourceScheduler(
|
|
params Action<bool>[] participants)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(participants);
|
|
if (participants.Length == 0)
|
|
throw new ArgumentException(
|
|
"At least one reveal upload participant is required.",
|
|
nameof(participants));
|
|
if (participants.Any(static participant => participant is null))
|
|
throw new ArgumentException(
|
|
"Reveal upload participants cannot contain null.",
|
|
nameof(participants));
|
|
|
|
_participants = [.. participants];
|
|
}
|
|
|
|
public void BeginDestinationReveal(long revealGeneration)
|
|
{
|
|
if (revealGeneration <= 0)
|
|
throw new ArgumentOutOfRangeException(nameof(revealGeneration));
|
|
|
|
_activeGeneration = revealGeneration;
|
|
for (int i = 0; i < _participants.Length; i++)
|
|
_participants[i](true);
|
|
}
|
|
|
|
public void EndDestinationReveal(long revealGeneration)
|
|
{
|
|
if (revealGeneration <= 0)
|
|
throw new ArgumentOutOfRangeException(nameof(revealGeneration));
|
|
if (_activeGeneration != revealGeneration)
|
|
return;
|
|
|
|
for (int i = 0; i < _participants.Length; i++)
|
|
_participants[i](false);
|
|
_activeGeneration = 0;
|
|
}
|
|
}
|