feat: add WorldConstants, SurfacePalette and IBiome contract
This commit is contained in:
17
World/WorldGen/IBiome.cs
Normal file
17
World/WorldGen/IBiome.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using VoxelEngine.World.Blocks;
|
||||
|
||||
namespace VoxelEngine.World.WorldGen;
|
||||
|
||||
public interface IBiome
|
||||
{
|
||||
string Name { get; }
|
||||
|
||||
// Absolute target surface height at the column (continuous, pre-rounding).
|
||||
float SampleHeight(NoiseSource noise, float worldX, float worldZ);
|
||||
|
||||
SurfacePalette Surface { get; }
|
||||
|
||||
// Surface block for a given height; lets biomes vary the top by altitude
|
||||
// (e.g. Mountains use Snow above the snow line). Defaults to Surface.Top.
|
||||
IBlock TopBlock(int worldY);
|
||||
}
|
||||
7
World/WorldGen/SurfacePalette.cs
Normal file
7
World/WorldGen/SurfacePalette.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using VoxelEngine.World.Blocks;
|
||||
|
||||
namespace VoxelEngine.World.WorldGen;
|
||||
|
||||
// Surface block layering for a biome: the top block, the filler band below it,
|
||||
// and the deep "under" block (stone). Filler depth is fixed at 3 blocks.
|
||||
public readonly record struct SurfacePalette(IBlock Top, IBlock Filler, IBlock Under);
|
||||
10
World/WorldGen/WorldConstants.cs
Normal file
10
World/WorldGen/WorldConstants.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using VoxelChunk = VoxelEngine.World.Chunk.Chunk;
|
||||
|
||||
namespace VoxelEngine.World.WorldGen;
|
||||
|
||||
public static class WorldConstants
|
||||
{
|
||||
public const int WorldHeightChunks = 8;
|
||||
public const int WorldHeight = WorldConstants.WorldHeightChunks * VoxelChunk.Size; // 128
|
||||
public const int SeaLevel = 64;
|
||||
}
|
||||
Reference in New Issue
Block a user