diff options
author | kwolekr <kwolekr@minetest.net> | 2016-05-20 03:37:31 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2016-05-27 23:23:58 -0400 |
commit | 0df5c01a8ce927c33ae9b67f459365505b980c33 (patch) | |
tree | 17d4e39a61afc9a37257c969b23630e99b8c89f1 /src/mapgen_fractal.cpp | |
parent | c5968049bbf73ceff08a2b1d35bb34192fa3f315 (diff) | |
download | hax-minetest-server-0df5c01a8ce927c33ae9b67f459365505b980c33.tar.gz hax-minetest-server-0df5c01a8ce927c33ae9b67f459365505b980c33.zip |
Mapgen: Remove calculateNoise from most mapgens
This commit moves noise calculation to the functions where the noise is
actually required, increasing the separation of concerns and level of
interdependency for each mapgen method. Valleys Mapgen is left unmodified.
Diffstat (limited to 'src/mapgen_fractal.cpp')
-rw-r--r-- | src/mapgen_fractal.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp index dca10d253..f54de6275 100644 --- a/src/mapgen_fractal.cpp +++ b/src/mapgen_fractal.cpp @@ -243,9 +243,6 @@ void MapgenFractal::makeChunk(BlockMakeData *data) blockseed = getBlockSeed2(full_node_min, seed); - // Make some noise - calculateNoise(); - // Generate base terrain, mountains, and ridges with initial heightmaps s16 stone_surface_max_y = generateTerrain(); @@ -328,23 +325,6 @@ void MapgenFractal::makeChunk(BlockMakeData *data) } -void MapgenFractal::calculateNoise() -{ - //TimeTaker t("calculateNoise", NULL, PRECISION_MICRO); - s16 x = node_min.X; - s16 z = node_min.Z; - - noise_seabed->perlinMap2D(x, z); - - // Cave noises are calculated in generateCaves() - // only if solid terrain is present in mapchunk - - noise_filler_depth->perlinMap2D(x, z); - - //printf("calculateNoise: %dus\n", t.stop()); -} - - bool MapgenFractal::getFractalAtPoint(s16 x, s16 y, s16 z) { float cx, cy, cz, cw, ox, oy, oz, ow; @@ -474,6 +454,8 @@ s16 MapgenFractal::generateTerrain() s16 stone_surface_max_y = -MAX_MAP_GENERATION_LIMIT; u32 index2d = 0; + noise_seabed->perlinMap2D(node_min.X, node_min.Z); + for (s16 z = node_min.Z; z <= node_max.Z; z++) { for (s16 y = node_min.Y - 1; y <= node_max.Y + 1; y++) { u32 vi = vm->m_area.index(node_min.X, y, z); |