Mercurial > games > semicongine
changeset 1350:6646270a6032
did: use 64bit seed for perlin
author | sam <sam@basx.dev> |
---|---|
date | Sat, 07 Sep 2024 22:56:10 +0700 |
parents | cee8348fe7d7 |
children | 7b8a6b5e9a46 |
files | semicongine/contrib/algorithms/noise.nim |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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))