use fastnoise_lite::{FastNoiseLite, FractalType}; use glam::IVec2; use crate::{content::materials::MaterialId, proc_gen::Biome, sim::cell::Cell}; const ROUGHNESS: f32 = 0.375; pub struct MinesBiome { pub edge_roughness: FastNoiseLite, } impl MinesBiome { pub fn new() -> Self { let mut edge_roughness = FastNoiseLite::new(); edge_roughness.octaves = 2; edge_roughness.fractal_type = FractalType::Ridged; MinesBiome { edge_roughness } } } impl Biome for MinesBiome { fn cell(&self, solidity: f32, world: IVec2) -> Cell { let world = world.as_vec2(); let displacement = ROUGHNESS * self.edge_roughness.get_noise_2d(world.x, world.y); if solidity + displacement <= 0.0 { return Cell::void(); } Cell::from_material(MaterialId::Dirt) } }