fixed blending

Implementing noise blending
This commit is contained in:
2024-07-07 00:00:34 -04:00
parent 97f2497940
commit 8e92df8008
6 changed files with 85 additions and 41 deletions

View File

@@ -64,6 +64,22 @@ impl BiomePainter {
return biome;
}
pub fn sample_biome_index(&self, data: &BiomeData) -> usize {
assert!(self.biomes.length() != 0, "There are no biomes");
let mut biome = 0;
let mut dist = f32::INFINITY;
for i in 0..self.biomes.len() {
let d = self.biomes[i].distance(data.into());
if d < dist {
biome = i;
dist = d;
}
}
return biome;
}
}
create_asset_loader!(