using VoxelEngine.Core; using VoxelEngine.World.Blocks; namespace VoxelEngine.World.WorldGen.Biomes; public sealed class PlainsBiome : IBiome { private readonly FastNoiseLite _detail; private readonly Configuration _cfg; public string Name => "Plains"; public SurfacePalette Surface { get; } public PlainsBiome(int seed, BlockRegistry blocks, Configuration cfg) { this._cfg = cfg; this._detail = new FastNoiseLite(seed + 100); this._detail.SetNoiseType(FastNoiseLite.NoiseType.OpenSimplex2); this._detail.SetFrequency(cfg.PlainsDetailFrequency); this.Surface = new SurfacePalette(blocks.Grass, blocks.Dirt, blocks.Stone); } public float SampleHeight(NoiseSource noise, float worldX, float worldZ) => WorldConstants.SeaLevel + this._cfg.PlainsContinentAmplitude * noise.Continent(worldX, worldZ) + this._cfg.PlainsDetailAmplitude * this._detail.GetNoise(worldX, worldZ); public IBlock TopBlock(int worldY) => this.Surface.Top; }