fix: perlin

This commit is contained in:
2026-11-10 01:44:27 +01:00
parent 1c6cadd4c6
commit ba13569696
+7 -1
View File
@@ -180,13 +180,19 @@ float noise_f(vec2 n, int f)
vec2 perlin_gradient(vec2 p, int seed)
{
return normalize(
vec2 v = normalize(
vec2(
rand(p.x * 12.34 + p.y * 56.78 + seed) * 2.0 - 1.0,
rand(p.x * 56.78 + p.y * 12.34 + seed) * 2.0 - 1.0
)
);
if (length(v) == 0.) {
return vec2(1, 0);
}
return v;
}
float perlin(vec2 p, int seed)