Merge branch 'master' into merge

This commit is contained in:
Andy Friesen 2023-03-10 11:20:20 -08:00
commit cfee765dc7

View file

@ -300,7 +300,7 @@ static float fade(float t)
return t * t * t * (t * (t * 6 - 15) + 10); return t * t * t * (t * (t * 6 - 15) + 10);
} }
static float lerp(float t, float a, float b) static float math_lerp(float t, float a, float b)
{ {
return a + t * (b - a); return a + t * (b - a);
} }
@ -342,10 +342,10 @@ static float perlin(float x, float y, float z)
int ba = p[b] + zi; int ba = p[b] + zi;
int bb = p[b + 1] + zi; int bb = p[b + 1] + zi;
return lerp(w, return math_lerp(w,
lerp(v, lerp(u, grad(p[aa], xf, yf, zf), grad(p[ba], xf - 1, yf, zf)), lerp(u, grad(p[ab], xf, yf - 1, zf), grad(p[bb], xf - 1, yf - 1, zf))), math_lerp(v, math_lerp(u, grad(p[aa], xf, yf, zf), grad(p[ba], xf - 1, yf, zf)), math_lerp(u, grad(p[ab], xf, yf - 1, zf), grad(p[bb], xf - 1, yf - 1, zf))),
lerp(v, lerp(u, grad(p[aa + 1], xf, yf, zf - 1), grad(p[ba + 1], xf - 1, yf, zf - 1)), math_lerp(v, math_lerp(u, grad(p[aa + 1], xf, yf, zf - 1), grad(p[ba + 1], xf - 1, yf, zf - 1)),
lerp(u, grad(p[ab + 1], xf, yf - 1, zf - 1), grad(p[bb + 1], xf - 1, yf - 1, zf - 1)))); math_lerp(u, grad(p[ab + 1], xf, yf - 1, zf - 1), grad(p[bb + 1], xf - 1, yf - 1, zf - 1))));
} }
static int math_noise(lua_State* L) static int math_noise(lua_State* L)