Mercurial > games > semicongine
changeset 1353:93a6d70d845f
fix: make perlin noise 0..1 instead of -1..1
author | sam <sam@basx.dev> |
---|---|
date | Fri, 27 Sep 2024 23:44:37 +0700 |
parents | 7b8a6b5e9a46 |
children | 8ad6e4cfcb2d |
files | semicongine/contrib/algorithms/noise.nim |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/contrib/algorithms/noise.nim Wed Sep 11 23:26:08 2024 +0700 +++ b/semicongine/contrib/algorithms/noise.nim Fri Sep 27 23:44:37 2024 +0700 @@ -27,8 +27,9 @@ xinterpol = pos.x - topleft.x yinterpol = pos.y - topleft.y - return interpolate( - interpolate(topleft_dot, bottomleft_dot, yinterpol), - interpolate(topright_dot, bottomright_dot, yinterpol), - xinterpol, - ) + return + interpolate( + interpolate(topleft_dot, bottomleft_dot, yinterpol), + interpolate(topright_dot, bottomright_dot, yinterpol), + xinterpol, + ) * 0.5 + 0.5