Mercurial > games > semicongine
view old_tests/test_noise.nim @ 1258:5442d0e9d8ff
did: improve testing lighting, try new glb model (need to add jpeg support first)
author | sam <sam@basx.dev> |
---|---|
date | Sun, 28 Jul 2024 20:42:51 +0700 |
parents | 6360c8d17ce0 |
children |
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