From 859141a0ce38fbd606d95ae7a2f0999acf2fbe84 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 12 Mar 2017 13:26:09 +0000 Subject: 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. --- src/cavegen.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/cavegen.h') diff --git a/src/cavegen.h b/src/cavegen.h index 2bf503d47..e322c181c 100644 --- a/src/cavegen.h +++ b/src/cavegen.h @@ -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 -- cgit v1.2.3