perf(streaming): cursor publication across frame budgets
This commit is contained in:
parent
bb16f74fd4
commit
98f1ac8934
32 changed files with 2215 additions and 823 deletions
45
src/AcDream.App/Rendering/Wb/EnvCellLandblockPublication.cs
Normal file
45
src/AcDream.App/Rendering/Wb/EnvCellLandblockPublication.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System.Numerics;
|
||||
|
||||
namespace AcDream.App.Rendering.Wb;
|
||||
|
||||
/// <summary>
|
||||
/// Narrow update-thread publication seam used by streaming. Preparation builds
|
||||
/// one private shell at a time; commit publishes the completed immutable
|
||||
/// landblock snapshot with one owner dictionary replacement.
|
||||
/// </summary>
|
||||
public interface IEnvCellLandblockPublisher
|
||||
{
|
||||
EnvCellLandblockPublication PreparePublication(
|
||||
EnvCellLandblockBuild build);
|
||||
|
||||
bool AdvancePreparationOne(EnvCellLandblockPublication publication);
|
||||
|
||||
void CommitPublication(EnvCellLandblockPublication publication);
|
||||
}
|
||||
|
||||
public sealed class EnvCellLandblockPublication
|
||||
{
|
||||
internal EnvCellLandblockPublication(
|
||||
object owner,
|
||||
EnvCellLandblockBuild build)
|
||||
{
|
||||
Owner = owner;
|
||||
Build = build;
|
||||
Replacement = new EnvCellLandblock
|
||||
{
|
||||
GridX = (int)((build.LandblockId >> 24) & 0xFFu),
|
||||
GridY = (int)((build.LandblockId >> 16) & 0xFFu),
|
||||
};
|
||||
TotalBounds = new WbBoundingBox(
|
||||
new Vector3(float.MaxValue),
|
||||
new Vector3(float.MinValue));
|
||||
}
|
||||
|
||||
internal object Owner { get; }
|
||||
internal EnvCellLandblockBuild Build { get; }
|
||||
internal EnvCellLandblock Replacement { get; }
|
||||
internal WbBoundingBox TotalBounds { get; set; }
|
||||
internal int ShellCursor { get; set; }
|
||||
internal bool PreparationCommitted { get; set; }
|
||||
internal bool PublicationCommitted { get; set; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue