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:
parent
486dc3288d
commit
3af226cb06
4 changed files with 29 additions and 51 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue