feat: add streaming primitives (IChunkRenderer, IJobExecutor, NeighborSnapshots, ChunkJob)

This commit is contained in:
2026-06-01 10:48:56 +02:00
parent 39375b83ea
commit dc74fdadcc
5 changed files with 95 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
using OpenTK.Mathematics;
using VoxelEngine.World.Chunk;
namespace VoxelEngine.World.Streaming;
// Job dispatched to an IJobExecutor. For a fresh load, ExistingChunk is null
// and the worker generates + applies diff + meshes. For a remesh-only job,
// ExistingChunk holds the chunk and the worker only meshes (no generation).
internal sealed record ChunkJob(
Vector3i Pos,
Chunk.Chunk? ExistingChunk,
NeighborSnapshots Neighbors,
IReadOnlyDictionary<int, ushort>? Diff);
// Posted by the worker back to the main thread via a ConcurrentQueue.
internal sealed record ChunkJobResult(
Vector3i Pos,
Chunk.Chunk? Chunk,
float[]? Mesh,
Exception? Error,
bool IsRemeshOnly);