Mercurial > games > semicongine
comparison old_tests/test_noise.nim @ 1203:6360c8d17ce0 compiletime-tests
did: preprations to add rendering tests
author | sam <sam@basx.dev> |
---|---|
date | Mon, 15 Jul 2024 20:06:42 +0700 |
parents | tests/test_noise.nim@114f395b9144 |
children |
comparison
equal
deleted
inserted
replaced
1202:a8864fe6fe6e | 1203:6360c8d17ce0 |
---|---|
1 import semicongine | |
2 | |
3 const w = 500 | |
4 const h = 500 | |
5 | |
6 var o = "P2\n" & $ w & " " & $ h & "\n255\n" | |
7 | |
8 for y in 0 ..< h: | |
9 for x in 0 ..< w: | |
10 let v = ( | |
11 Perlin(NewVec2f(float(x) * 0.01, float(y) * 0.01)) * 0.7 + | |
12 Perlin(NewVec2f(float(x) * 0.05, float(y) * 0.05)) * 0.25 + | |
13 Perlin(NewVec2f(float(x) * 0.2, float(y) * 0.2)) * 0.05 | |
14 ) | |
15 o = o & $(int((v * 0.5 + 0.5) * 255)) & " " | |
16 o = o & "\n" | |
17 echo o |