feat(rendering): frustum-cull chunk draws and log render counts
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using OpenTK.Mathematics;
|
||||
using VoxelEngine.Core;
|
||||
using VoxelEngine.World;
|
||||
@@ -445,4 +446,25 @@ public class ChunkStreamerTests
|
||||
Assert.Null(world.GetChunk(new Vector3i(0, 3, 0))); // air above surface — not loaded
|
||||
Assert.Null(world.GetChunk(new Vector3i(0, 5, 0))); // air above surface — not loaded
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DrawVisible_DrawsOnlyChunksPassingPredicate_AndReturnsCount()
|
||||
{
|
||||
var cfg = new Configuration
|
||||
{
|
||||
RenderDistanceHorizontal = 1,
|
||||
RenderDistanceVertical = 0,
|
||||
MaxGenerateJobsInFlight = 100,
|
||||
MaxMeshUploadsPerFrame = 100,
|
||||
};
|
||||
var (streamer, _, created) = CreateStreamer(cfg);
|
||||
streamer.Tick(new Vector3i(0, 0, 0)); // 9 columns, all chunk Y 0, non-empty meshes
|
||||
|
||||
int drawn = streamer.DrawVisible(
|
||||
pos => pos == new Vector3i(0, 0, 0), // only the centre chunk "visible"
|
||||
(_, r) => r.Draw());
|
||||
|
||||
Assert.Equal(1, drawn);
|
||||
Assert.Equal(1, created.Sum(r => r.DrawCount));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user