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.
22 lines
557 B
C#
22 lines
557 B
C#
namespace VoxelEngine.World.Blocks;
|
|
|
|
public interface IBlock
|
|
{
|
|
ushort Id { get; }
|
|
string Name { get; }
|
|
|
|
// Drives face culling: a face is emitted only if its neighbor is not opaque.
|
|
bool IsOpaque { get; }
|
|
|
|
// Reserved for future collision (not used in the baseline).
|
|
bool IsSolid { get; }
|
|
|
|
// Atlas tile index for the given face.
|
|
int GetTextureIndex(BlockFace face);
|
|
|
|
// Interaction hooks — capability present now, system built post-baseline.
|
|
void OnInteract() { }
|
|
void OnPlaced() { }
|
|
void OnBroken() { }
|
|
}
|