# HG changeset patch # User sam # Date 1725724570 -25200 # Node ID 6646270a6032eb20dfaf7b637e5b034592b04a21 # Parent cee8348fe7d7981b264bc51611e2f6b217127080 did: use 64bit seed for perlin diff -r cee8348fe7d7 -r 6646270a6032 semicongine/contrib/algorithms/noise.nim --- a/semicongine/contrib/algorithms/noise.nim Sat Sep 07 21:23:16 2024 +0700 +++ b/semicongine/contrib/algorithms/noise.nim Sat Sep 07 22:56:10 2024 +0700 @@ -3,7 +3,7 @@ import ../../core -proc randomGradient(pos: Vec2f, seed: int32 = 0): Vec2f = +proc randomGradient(pos: Vec2f, seed: uint64 = 0): Vec2f = let randomAngle: float32 = TAU * (float32(int(hash((pos.x, pos.y, seed)))) / float32(high(int))) return vec2(cos(randomAngle), sin(randomAngle)) @@ -12,7 +12,7 @@ # with Smootherstep (b - a) * ((weight * (weight * 6.0 - 15.0) + 10.0) * weight * weight * weight) + a -proc perlin*(pos: Vec2f, seed: int32 = 0): float32 = +proc perlin*(pos: Vec2f, seed: uint64 = 0): float32 = let # grid coordinates around target point topleft = vec2(trunc(pos.x), trunc(pos.y))