1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add flags and lacunarity as new noise parameters

Add 'absolute value' option to noise map functions
Extend persistence modulation to 3D noise
Extend 'eased' option to noise2d_perlin* functions
Some noise.cpp formatting fixups
This commit is contained in:
kwolekr 2014-12-07 21:57:12 -05:00
parent 638f3a8454
commit 2fd3d52020
16 changed files with 306 additions and 214 deletions

View file

@ -350,10 +350,10 @@ bool Settings::updateConfigFile(const char *filename)
std::ifstream is(filename);
std::ostringstream os(std::ios_base::binary);
bool was_modified = updateConfigObject(is, os, "");
is.close();
if (!was_modified)
return true;
@ -591,6 +591,11 @@ bool Settings::getNoiseParamsFromGroup(const std::string &name,
group->getS32NoEx("seed", np.seed);
group->getU16NoEx("octaves", np.octaves);
group->getFloatNoEx("persistence", np.persist);
group->getFloatNoEx("lacunarity", np.lacunarity);
np.flags = 0;
if (!group->getFlagStrNoEx("flags", np.flags, flagdesc_noiseparams))
np.flags = NOISE_FLAG_DEFAULTS;
return true;
}
@ -896,6 +901,8 @@ void Settings::setNoiseParams(const std::string &name, const NoiseParams &np)
group->setS32("seed", np.seed);
group->setU16("octaves", np.octaves);
group->setFloat("persistence", np.persist);
group->setFloat("lacunarity", np.lacunarity);
group->setFlagStr("flags", np.flags, flagdesc_noiseparams, np.flags);
Settings *old_group;
{