forked from Mirrorlandia_minetest/minetest
Mgv7 floatlands: Add exponent parameter
Allows more control over shape of floatland mountain terrain. Terrain shape is unchanged.
This commit is contained in:
parent
f3b9d87076
commit
2aad3be2cb
@ -60,6 +60,7 @@ MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge)
|
||||
large_cave_depth = params->large_cave_depth;
|
||||
lava_depth = params->lava_depth;
|
||||
float_mount_density = params->float_mount_density;
|
||||
float_mount_exponent = params->float_mount_exponent;
|
||||
floatland_level = params->floatland_level;
|
||||
shadow_limit = params->shadow_limit;
|
||||
cavern_limit = params->cavern_limit;
|
||||
@ -155,6 +156,7 @@ void MapgenV7Params::readParams(const Settings *settings)
|
||||
settings->getS16NoEx("mgv7_lava_depth", lava_depth);
|
||||
settings->getFloatNoEx("mgv7_float_mount_density", float_mount_density);
|
||||
settings->getFloatNoEx("mgv7_float_mount_height", float_mount_height);
|
||||
settings->getFloatNoEx("mgv7_float_mount_exponent", float_mount_exponent);
|
||||
settings->getS16NoEx("mgv7_floatland_level", floatland_level);
|
||||
settings->getS16NoEx("mgv7_shadow_limit", shadow_limit);
|
||||
settings->getS16NoEx("mgv7_cavern_limit", cavern_limit);
|
||||
@ -187,6 +189,7 @@ void MapgenV7Params::writeParams(Settings *settings) const
|
||||
settings->setS16("mgv7_lava_depth", lava_depth);
|
||||
settings->setFloat("mgv7_float_mount_density", float_mount_density);
|
||||
settings->setFloat("mgv7_float_mount_height", float_mount_height);
|
||||
settings->setFloat("mgv7_float_mount_exponent", float_mount_exponent);
|
||||
settings->setS16("mgv7_floatland_level", floatland_level);
|
||||
settings->setS16("mgv7_shadow_limit", shadow_limit);
|
||||
settings->setS16("mgv7_cavern_limit", cavern_limit);
|
||||
@ -416,8 +419,10 @@ bool MapgenV7::getFloatlandMountainFromMap(int idx_xyz, int idx_xz, s16 y)
|
||||
{
|
||||
// Make rim 2 nodes thick to match floatland base terrain
|
||||
float density_gradient = (y >= floatland_level) ?
|
||||
-pow((float)(y - floatland_level) / float_mount_height, 0.75f) :
|
||||
-pow((float)(floatland_level - 1 - y) / float_mount_height, 0.75f);
|
||||
-pow((float)(y - floatland_level) / float_mount_height,
|
||||
float_mount_exponent) :
|
||||
-pow((float)(floatland_level - 1 - y) / float_mount_height,
|
||||
float_mount_exponent);
|
||||
|
||||
float floatn = noise_mountain->result[idx_xyz] + float_mount_density;
|
||||
|
||||
|
@ -42,6 +42,7 @@ struct MapgenV7Params : public MapgenParams {
|
||||
s16 lava_depth = -256;
|
||||
float float_mount_density = 0.6f;
|
||||
float float_mount_height = 128.0f;
|
||||
float float_mount_exponent = 0.75f;
|
||||
s16 floatland_level = 1280;
|
||||
s16 shadow_limit = 1024;
|
||||
s16 cavern_limit = -256;
|
||||
@ -95,6 +96,7 @@ private:
|
||||
s16 large_cave_depth;
|
||||
float float_mount_density;
|
||||
float float_mount_height;
|
||||
float float_mount_exponent;
|
||||
s16 floatland_level;
|
||||
s16 shadow_limit;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user