acdream/src/AcDream.App/Rendering/Wb/EnvCellMeshPreparationScheduler.cs

29 lines
1,023 B
C#

namespace AcDream.App.Rendering.Wb;
/// <summary>
/// Starts CPU mesh extraction after the completed EnvCell build has been
/// published and its geometry ids have acquired render ownership. This order
/// lets ObjectMeshManager cancel queued work as soon as a landblock leaves the
/// current streaming generation; stale portal destinations never keep decoder
/// jobs or surface lists alive.
/// </summary>
public static class EnvCellMeshPreparationScheduler
{
public static void Schedule(
EnvCellLandblockBuild build,
ObjectMeshManager meshManager)
{
var scheduled = new HashSet<ulong>();
foreach (var shell in build.Shells)
{
if (!scheduled.Add(shell.GeometryId))
continue;
_ = meshManager.PrepareEnvCellGeomMeshDataAsync(
shell.GeometryId,
shell.CellId,
shell.EnvironmentId,
shell.CellStructure,
new List<ushort>(shell.Surfaces));
}
}
}