Mercurial > games > semicongine
comparison tests/test_noise.nim @ 1139:114f395b9144
did: finish refactoring and updated all tests accordingly
| author | sam <sam@basx.dev> |
|---|---|
| date | Sat, 08 Jun 2024 14:58:25 +0700 |
| parents | 71315636ba82 |
| children |
comparison
equal
deleted
inserted
replaced
| 1138:02e1d2658ff5 | 1139:114f395b9144 |
|---|---|
| 6 var o = "P2\n" & $ w & " " & $ h & "\n255\n" | 6 var o = "P2\n" & $ w & " " & $ h & "\n255\n" |
| 7 | 7 |
| 8 for y in 0 ..< h: | 8 for y in 0 ..< h: |
| 9 for x in 0 ..< w: | 9 for x in 0 ..< w: |
| 10 let v = ( | 10 let v = ( |
| 11 perlin(NewVec2f(float(x) * 0.01, float(y) * 0.01)) * 0.7 + | 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 + | 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 | 13 Perlin(NewVec2f(float(x) * 0.2, float(y) * 0.2)) * 0.05 |
| 14 ) | 14 ) |
| 15 o = o & $(int((v * 0.5 + 0.5) * 255)) & " " | 15 o = o & $(int((v * 0.5 + 0.5) * 255)) & " " |
| 16 o = o & "\n" | 16 o = o & "\n" |
| 17 echo o | 17 echo o |
