diff --git a/VoxelEngine.Tests/ChunkMesherTests.cs b/VoxelEngine.Tests/ChunkMesherTests.cs index aa61d52..eefbfde 100644 --- a/VoxelEngine.Tests/ChunkMesherTests.cs +++ b/VoxelEngine.Tests/ChunkMesherTests.cs @@ -5,7 +5,9 @@ namespace VoxelEngine.Tests; public class ChunkMesherTests { - private const int FloatsPerFace = 36; // 6 verts * 6 floats + private const int FloatsPerVertex = 6; // pos.xyz, uv, shade + private const int VerticesPerFace = 6; // quad = 2 triangles + private const int FloatsPerFace = FloatsPerVertex * VerticesPerFace; // 36 private static int FaceCount(float[] mesh) => mesh.Length / FloatsPerFace; @@ -43,13 +45,15 @@ public class ChunkMesherTests } [Fact] - public void EveryVertexHasSixFloats() + public void SingleBlock_EmitsExactInterleavedFloatCount() { var chunk = new Chunk(); - chunk[0, 0, 0] = 1; + chunk[0, 0, 0] = 1; // corner block: all 6 neighbors are air/out-of-bounds -> 6 faces var mesh = new ChunkMesher().Build(chunk, new BlockRegistry()); - Assert.Equal(0, mesh.Length % 6); + // Pins the layout: 6 faces * 6 vertices/face * 6 floats/vertex. + Assert.Equal(6 * VerticesPerFace * FloatsPerVertex, mesh.Length); + Assert.Equal(0, mesh.Length % FloatsPerVertex); } }