Mercurial > games > semicongine
view tests/test_noise.nim @ 920:c66503386e8b
Merge branch 'main' of github.com:saemideluxe/semicongine
author | Sam <sam@basx.dev> |
---|---|
date | Thu, 21 Mar 2024 15:39:42 +0700 |
parents | fad6490fb728 |
children | 71315636ba82 |
line wrap: on
line source
import semicongine const w = 500 const h = 500 var o = "P2\n" & $ w & " " & $ h & "\n255\n" for y in 0 ..< h: for x in 0 ..< w: let v = ( perlin(newVec2f(float(x) * 0.01, float(y) * 0.01)) * 0.7 + perlin(newVec2f(float(x) * 0.05, float(y) * 0.05)) * 0.25 + perlin(newVec2f(float(x) * 0.2, float(y) * 0.2)) * 0.05 ) o = o & $(int((v * 0.5 + 0.5) * 255)) & " " o = o & "\n" echo o