annotate tests/test_noise.nim @ 832:388c4b35a6e3

fix: tests, test_materials and test_mesh still needs to be done
author Sam <sam@basx.dev>
date Wed, 22 Nov 2023 23:24:47 +0700
parents 902735626b66
children 71315636ba82
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
831
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
1 import semicongine
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
2
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
3 const w = 500
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
4 const h = 500
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
5
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
6 var o = "P2\n" & $ w & " " & $ h & "\n255\n"
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
7
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
8 for y in 0 ..< h:
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
9 for x in 0 ..< w:
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
10 let v = (
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
11 perlin(newVec2f(float(x) * 0.01, float(y) * 0.01)) * 0.7 +
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
12 perlin(newVec2f(float(x) * 0.05, float(y) * 0.05)) * 0.25 +
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
13 perlin(newVec2f(float(x) * 0.2, float(y) * 0.2)) * 0.05
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
14 )
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
15 o = o & $(int((v * 0.5 + 0.5) * 255)) & " "
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
16 o = o & "\n"
902735626b66 add: missing material module, some functions for noise
Sam <sam@basx.dev>
parents:
diff changeset
17 echo o