Add a World that stores chunks in a Dictionary keyed by chunk coordinate, with floor-division world<->chunk coordinate mapping (correct for negative coords). The mesher takes an optional neighbor sampler so faces at chunk borders are culled against adjacent chunks instead of always meshing the shell. Render one ChunkRenderer per chunk, placed via the model matrix. Reorganize the World layer into Blocks/ and Chunk/ sub-namespaces.
10 lines
300 B
C#
10 lines
300 B
C#
using VoxelEngine.World.Blocks;
|
|
|
|
namespace VoxelEngine.World.Chunk;
|
|
|
|
public interface IChunkMesher
|
|
{
|
|
// Returns interleaved vertices: [pos.x, pos.y, pos.z, u, v, shade] per vertex.
|
|
float[] Build(Chunk chunk, BlockRegistry registry, Func<int, int, int, bool>? neighborOpaqueOutside = null);
|
|
}
|