1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Refactor "Cavegen y biome check"

This commit is contained in:
sfan5 2024-09-06 11:30:10 +02:00 committed by GitHub
parent 486dc3288d
commit 3af226cb06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 51 deletions

View file

@ -649,8 +649,6 @@ void MapgenBasic::generateBiomes()
noise_filler_depth->perlinMap2D(node_min.X, node_min.Z);
s16 *biome_transitions = biomegen->getBiomeTransitions();
for (s16 z = node_min.Z; z <= node_max.Z; z++)
for (s16 x = node_min.X; x <= node_max.X; x++, index++) {
Biome *biome = NULL;
@ -661,8 +659,7 @@ void MapgenBasic::generateBiomes()
u16 depth_riverbed = 0;
u32 vi = vm->m_area.index(x, node_max.Y, z);
int cur_biome_depth = 0;
s16 biome_y_min = biome_transitions[cur_biome_depth];
s16 biome_y_min = biomegen->getNextTransitionY(node_max.Y);
// Check node at base of mapchunk above, either a node of a previously
// generated mapchunk or if not, a node of overgenerated base terrain.
@ -695,15 +692,7 @@ void MapgenBasic::generateBiomes()
if (!biome || y < biome_y_min) {
// (Re)calculate biome
biome = biomegen->getBiomeAtIndex(index, v3s16(x, y, z));
// Finding the height of the next biome
// On first iteration this may loop a couple times after than it should just run once
while (y < biome_y_min) {
biome_y_min = biome_transitions[++cur_biome_depth];
}
/*if (x == node_min.X && z == node_min.Z)
printf("Map: check @ %i -> %s -> again at %i\n", y, biome->name.c_str(), biome_y_min);*/
biome_y_min = biomegen->getNextTransitionY(y);
}
// Add biome to biomemap at first stone surface detected