feat(app): Phase A.1 — TerrainRenderer.RemoveLandblock for streaming unloads

TerrainRenderer's internal landblock collection is now a Dictionary
keyed by landblock id so the streaming system can release GPU
resources per-landblock as the visible window moves. AddLandblock
takes the id as its first parameter; if the same id is added twice,
the old buffers are freed before the new ones land (defensive but
cheap). RemoveLandblock is a no-op for unknown ids and deletes
VBO/EBO/VAO for known ones.

Single existing caller in GameWindow.cs updated to pass the id.

Build green. No unit tests — direct-to-GL methods need a live context.
Tasks 5-7 will validate end-to-end.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-11 22:22:49 +02:00
parent c5e207a51f
commit 495f87a4ad
2 changed files with 32 additions and 6 deletions

View file

@ -245,7 +245,7 @@ public sealed class GameWindow : IDisposable
((int)lbY - centerY) * 192f,
0f);
_terrain.AddLandblock(meshData, origin);
_terrain.AddLandblock(lb.LandblockId, meshData, origin);
}
Console.WriteLine($"terrain: {surfaceCache.Count} unique palette codes across {worldView.Landblocks.Count} landblocks");