mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
Fixed lerp() duplicate when compiling for C++20 (#851)
This commit is contained in:
parent
140e5a1495
commit
78798d4641
@ -300,7 +300,7 @@ static float fade(float t)
|
||||
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);
|
||||
}
|
||||
@ -342,10 +342,10 @@ static float perlin(float x, float y, float z)
|
||||
int ba = p[b] + zi;
|
||||
int bb = p[b + 1] + zi;
|
||||
|
||||
return 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))),
|
||||
lerp(v, 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))));
|
||||
return math_lerp(w,
|
||||
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))),
|
||||
math_lerp(v, math_lerp(u, grad(p[aa + 1], xf, yf, zf - 1), grad(p[ba + 1], xf - 1, yf, 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)
|
||||
|
Loading…
Reference in New Issue
Block a user