1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Cavegen/Mgv5/Mgv7: Add optional giant caverns

Add to MapgenBasic for use by multiple mapgens.
Add to mgv5 and mgv7, enabled by default.

Similar to mgvalleys caverns but half the scale.
Parameters for upper y limit, distance caverns taper to full size, and
noise threshold (full cavern size).
As with mgvalleys caverns are generated first and classic caves are
disabled in any mapchunk containing a cavern, to avoid excessive
spreading volumes of liquids.
This also avoids floating blobs of liquid where a large classic cave
has overgenerated out into a neighbouring previously-generated mapchunk.
This commit is contained in:
paramat 2017-03-12 13:26:09 +00:00
parent 86b1542181
commit 859141a0ce
10 changed files with 303 additions and 54 deletions

View file

@ -62,6 +62,36 @@ private:
Noise *noise_cave2;
};
/*
CavernsNoise is a cave digging algorithm
*/
class CavernsNoise {
public:
CavernsNoise(INodeDefManager *nodedef, v3s16 chunksize, NoiseParams *np_cavern,
s32 seed, float cavern_limit, float cavern_taper, float cavern_threshold);
~CavernsNoise();
bool generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax);
private:
INodeDefManager *m_ndef;
// configurable parameters
v3s16 m_csize;
float m_cavern_limit;
float m_cavern_taper;
float m_cavern_threshold;
// intermediate state variables
u16 m_ystride;
u16 m_zstride_1d;
Noise *noise_cavern;
content_t c_water_source;
content_t c_lava_source;
};
/*
CavesRandomWalk is an implementation of a cave-digging algorithm that
operates on the principle of a "random walk" to approximate the stochiastic