Source composite warmup from the canonical published destination neighborhood, including quiesced static and live projections, instead of rescanning the retained Far-tier world after every membership edge.
This lifecycle correction applies to both draw paths, preserving ef1d263337 as the sole G4 visual rollback.
Co-authored-by: OpenAI Codex <codex@openai.com>
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using AcDream.App.Streaming;
|
|
using AcDream.Core.World;
|
|
|
|
namespace AcDream.App.Rendering.Wb;
|
|
|
|
/// <summary>
|
|
/// Retains the exact published destination-neighborhood snapshot consumed by
|
|
/// composite-texture reveal warmup. The source refreshes only when canonical
|
|
/// spatial membership or its destination scope changes, avoiding a scan of
|
|
/// the retained Far-tier world on every reveal tick.
|
|
/// </summary>
|
|
internal sealed class CompositeWarmupEntitySource
|
|
{
|
|
private readonly GpuWorldState _world;
|
|
private readonly List<WorldEntity> _entities = [];
|
|
private bool _initialized;
|
|
private ulong _worldGeneration;
|
|
private uint _destinationCell;
|
|
private int _radius;
|
|
|
|
public CompositeWarmupEntitySource(GpuWorldState world)
|
|
{
|
|
_world = world ?? throw new ArgumentNullException(nameof(world));
|
|
}
|
|
|
|
public IReadOnlyList<WorldEntity> Entities => _entities;
|
|
public ulong Generation => _worldGeneration;
|
|
|
|
public void Refresh(uint destinationCell, int radius)
|
|
{
|
|
ArgumentOutOfRangeException.ThrowIfNegative(radius);
|
|
ulong worldGeneration = _world.FlatViewGeneration;
|
|
if (_initialized
|
|
&& _worldGeneration == worldGeneration
|
|
&& _destinationCell == destinationCell
|
|
&& _radius == radius)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_world.CopyPublishedEntitiesNearLandblockForReadiness(
|
|
destinationCell,
|
|
radius,
|
|
_entities);
|
|
_worldGeneration = worldGeneration;
|
|
_destinationCell = destinationCell;
|
|
_radius = radius;
|
|
_initialized = true;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
_entities.Clear();
|
|
_initialized = false;
|
|
_worldGeneration = 0;
|
|
_destinationCell = 0;
|
|
_radius = 0;
|
|
}
|
|
}
|