summaryrefslogtreecommitdiff
path: root/src/script/common/c_content.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-12-07 21:57:12 -0500
committerkwolekr <kwolekr@minetest.net>2014-12-07 21:59:32 -0500
commit2fd3d5202051e03303ac2b8e76976a7c4c8477f3 (patch)
treec461272b8eef33846cf5773e38c6a8b7716e1d0d /src/script/common/c_content.cpp
parent638f3a8454941d3f561b1834d47fa07a611454a3 (diff)
downloadminetest-2fd3d5202051e03303ac2b8e76976a7c4c8477f3.tar.gz
minetest-2fd3d5202051e03303ac2b8e76976a7c4c8477f3.tar.bz2
minetest-2fd3d5202051e03303ac2b8e76976a7c4c8477f3.zip
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
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r--src/script/common/c_content.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 799251bcf..1c78f139f 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -975,11 +975,11 @@ void luaentity_get(lua_State *L, u16 id)
}
/******************************************************************************/
-NoiseParams *read_noiseparams(lua_State *L, int index)
+NoiseParams *get_noiseparams(lua_State *L, int index)
{
NoiseParams *np = new NoiseParams;
- if (!read_noiseparams_nc(L, index, np)) {
+ if (!read_noiseparams(L, index, np)) {
delete np;
np = NULL;
}
@@ -987,7 +987,7 @@ NoiseParams *read_noiseparams(lua_State *L, int index)
return np;
}
-bool read_noiseparams_nc(lua_State *L, int index, NoiseParams *np)
+bool read_noiseparams(lua_State *L, int index, NoiseParams *np)
{
if (index < 0)
index = lua_gettop(L) + 1 + index;
@@ -995,12 +995,16 @@ bool read_noiseparams_nc(lua_State *L, int index, NoiseParams *np)
if (!lua_istable(L, index))
return false;
- np->offset = getfloatfield_default(L, index, "offset", 0.0);
- np->scale = getfloatfield_default(L, index, "scale", 0.0);
- np->persist = getfloatfield_default(L, index, "persist", 0.0);
- np->seed = getintfield_default(L, index, "seed", 0);
- np->octaves = getintfield_default(L, index, "octaves", 0);
- np->eased = getboolfield_default(L, index, "eased", false);
+ np->offset = getfloatfield_default(L, index, "offset", 0.0);
+ np->scale = getfloatfield_default(L, index, "scale", 0.0);
+ np->persist = getfloatfield_default(L, index, "persist", 0.0);
+ np->lacunarity = getfloatfield_default(L, index, "lacunarity", 2.0);
+ np->seed = getintfield_default(L, index, "seed", 0);
+ np->octaves = getintfield_default(L, index, "octaves", 0);
+
+ u32 flags = 0, flagmask = 0;
+ np->flags = getflagsfield(L, index, "flags", flagdesc_noiseparams,
+ &flags, &flagmask) ? flags : NOISE_FLAG_DEFAULTS;
lua_getfield(L, index, "spread");
np->spread = read_v3f(L, -1);