feat(world-gen): add CaveCarver skeleton (no-op Carve)

This commit is contained in:
2026-06-01 15:23:05 +02:00
parent 013d524544
commit 093b3deabf
2 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using OpenTK.Mathematics;
using VoxelEngine.Core;
using VoxelEngine.World.Blocks;
using VoxelEngine.World.Chunk;
using VoxelEngine.World.WorldGen;
using Xunit;
namespace VoxelEngine.Tests.WorldGen;
public class CaveCarverTests
{
private static readonly BlockRegistry Blocks = new();
private static readonly Configuration Cfg = new();
private static Chunk MakeStoneChunk()
{
Chunk c = new();
for (int x = 0; x < Chunk.Size; x++)
for (int y = 0; y < Chunk.Size; y++)
for (int z = 0; z < Chunk.Size; z++)
c[x, y, z] = Blocks.Stone.Id;
return c;
}
[Fact]
public void Carve_IsNoOpOnAirChunk()
{
var carver = new CaveCarver(seed: 42, Blocks, Cfg);
Chunk c = new(); // all-air by default
carver.Carve(c, new Vector3i(0, 4, 0));
for (int x = 0; x < Chunk.Size; x++)
for (int y = 0; y < Chunk.Size; y++)
for (int z = 0; z < Chunk.Size; z++)
Assert.Equal(Blocks.Air.Id, c[x, y, z]);
}
}