fix: perlin

This commit is contained in:
klemek committed 2026-11-10 01:44:27 +01:00
1 parent 1c6cadd4c6
commit ba13569696
1 file changed
+7 -1
+7 -1
View File
@@ -180,13 +180,19 @@ float noise_f(vec2 n, int f)
vec2 perlin_gradient(vec2 p, int seed) vec2 perlin_gradient(vec2 p, int seed)
{ {
return normalize( vec2 v = normalize(
vec2( vec2(
rand(p.x * 12.34 + p.y * 56.78 + seed) * 2.0 - 1.0, 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 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) float perlin(vec2 p, int seed)