feat(A.5 T7): LandblockStreamResult.Loaded.Tier+MeshData; Promoted variant
Extends the Loaded result record with a LandblockStreamTier discriminator and a LandblockMeshData payload (default! stub — T13 wires the real off-thread mesh build). Adds the Promoted variant for Far→Near upgrades that only need the entity layer, not a mesh rebuild. LandblockStreamer.HandleJob passes Tier.Near + default! MeshData at the existing synchronous load site; StreamingControllerTests updated to match the new positional signature. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1658882439
commit
295bce9bb2
3 changed files with 31 additions and 3 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using AcDream.Core.Terrain;
|
||||||
using AcDream.Core.World;
|
using AcDream.Core.World;
|
||||||
|
|
||||||
namespace AcDream.App.Streaming;
|
namespace AcDream.App.Streaming;
|
||||||
|
|
@ -22,7 +24,29 @@ public abstract record LandblockStreamJob(uint LandblockId)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract record LandblockStreamResult(uint LandblockId)
|
public abstract record LandblockStreamResult(uint LandblockId)
|
||||||
{
|
{
|
||||||
public sealed record Loaded(uint LandblockId, LoadedLandblock Landblock) : LandblockStreamResult(LandblockId);
|
/// <summary>
|
||||||
|
/// A landblock load completed. <see cref="Tier"/> distinguishes Far
|
||||||
|
/// (terrain only) from Near (terrain + entities). <see cref="MeshData"/>
|
||||||
|
/// is built off the render thread on the streaming worker.
|
||||||
|
/// </summary>
|
||||||
|
public sealed record Loaded(
|
||||||
|
uint LandblockId,
|
||||||
|
LandblockStreamTier Tier,
|
||||||
|
LoadedLandblock Landblock,
|
||||||
|
LandblockMeshData MeshData
|
||||||
|
) : LandblockStreamResult(LandblockId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A previously-Far-resident landblock was promoted to Near. Terrain
|
||||||
|
/// mesh is already on the GPU; the result carries the entity layer
|
||||||
|
/// (stabs, buildings, scenery) to merge into the existing GpuWorldState
|
||||||
|
/// entry.
|
||||||
|
/// </summary>
|
||||||
|
public sealed record Promoted(
|
||||||
|
uint LandblockId,
|
||||||
|
IReadOnlyList<WorldEntity> Entities
|
||||||
|
) : LandblockStreamResult(LandblockId);
|
||||||
|
|
||||||
public sealed record Failed(uint LandblockId, string Error) : LandblockStreamResult(LandblockId);
|
public sealed record Failed(uint LandblockId, string Error) : LandblockStreamResult(LandblockId);
|
||||||
public sealed record Unloaded(uint LandblockId) : LandblockStreamResult(LandblockId);
|
public sealed record Unloaded(uint LandblockId) : LandblockStreamResult(LandblockId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,12 @@ public sealed class LandblockStreamer : IDisposable
|
||||||
_outbox.Writer.TryWrite(new LandblockStreamResult.Failed(
|
_outbox.Writer.TryWrite(new LandblockStreamResult.Failed(
|
||||||
load.LandblockId, "LandblockLoader.Load returned null"));
|
load.LandblockId, "LandblockLoader.Load returned null"));
|
||||||
else
|
else
|
||||||
|
// TEMPORARY: passes default! for MeshData — Task 13 wires the real mesh build.
|
||||||
_outbox.Writer.TryWrite(new LandblockStreamResult.Loaded(
|
_outbox.Writer.TryWrite(new LandblockStreamResult.Loaded(
|
||||||
load.LandblockId, lb));
|
load.LandblockId,
|
||||||
|
LandblockStreamTier.Near,
|
||||||
|
lb,
|
||||||
|
MeshData: default! /* TODO(A.5 T13) */));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class StreamingControllerTests
|
||||||
// Entities (positional record). Adjust if the first positional arg
|
// Entities (positional record). Adjust if the first positional arg
|
||||||
// name differs.
|
// name differs.
|
||||||
var lb = new LoadedLandblock(0x32320FFEu, new LandBlock(), System.Array.Empty<WorldEntity>());
|
var lb = new LoadedLandblock(0x32320FFEu, new LandBlock(), System.Array.Empty<WorldEntity>());
|
||||||
fake.Pending.Enqueue(new LandblockStreamResult.Loaded(0x32320FFEu, lb));
|
fake.Pending.Enqueue(new LandblockStreamResult.Loaded(0x32320FFEu, LandblockStreamTier.Near, lb, MeshData: default!));
|
||||||
|
|
||||||
controller.Tick(50, 50);
|
controller.Tick(50, 50);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue