mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Mgflat, Mgv7: Only create noise objects if needed
This commit is contained in:
parent
58c083f305
commit
57eaf62c69
2 changed files with 30 additions and 18 deletions
|
@ -60,10 +60,12 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *em
|
|||
this->hill_threshold = params->hill_threshold;
|
||||
this->hill_steepness = params->hill_steepness;
|
||||
|
||||
//// 2D noise
|
||||
noise_terrain = new Noise(¶ms->np_terrain, seed, csize.X, csize.Z);
|
||||
// 2D noise
|
||||
noise_filler_depth = new Noise(¶ms->np_filler_depth, seed, csize.X, csize.Z);
|
||||
|
||||
if ((spflags & MGFLAT_LAKES) || (spflags & MGFLAT_HILLS))
|
||||
noise_terrain = new Noise(¶ms->np_terrain, seed, csize.X, csize.Z);
|
||||
// 3D noise
|
||||
MapgenBasic::np_cave1 = params->np_cave1;
|
||||
MapgenBasic::np_cave2 = params->np_cave2;
|
||||
}
|
||||
|
@ -136,7 +138,9 @@ void MapgenFlatParams::writeParams(Settings *settings) const
|
|||
int MapgenFlat::getSpawnLevelAtPoint(v2s16 p)
|
||||
{
|
||||
s16 level_at_point = ground_level;
|
||||
float n_terrain = NoisePerlin2D(&noise_terrain->np, p.X, p.Y, seed);
|
||||
float n_terrain = 0.0f;
|
||||
if ((spflags & MGFLAT_LAKES) || (spflags & MGFLAT_HILLS))
|
||||
n_terrain = NoisePerlin2D(&noise_terrain->np, p.X, p.Y, seed);
|
||||
|
||||
if ((spflags & MGFLAT_LAKES) && n_terrain < lake_threshold) {
|
||||
level_at_point = ground_level -
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue