Mercurial > games > semicongine
comparison tests/test_vector.nim @ 60:c57285d292b6
did: deep refactoring of handling vertrex attribute and buffer updates, don't ask ;(
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 22 Jan 2023 22:46:53 +0700 |
parents | 547f3a374271 |
children | 77755701bf49 |
comparison
equal
deleted
inserted
replaced
59:d7d9420ba675 | 60:c57285d292b6 |
---|---|
24 echo v1, " x ", v2, " = ", v1.cross(v2) | 24 echo v1, " x ", v2, " = ", v1.cross(v2) |
25 | 25 |
26 proc randVec2I(): auto = newVec2(rand(1 .. 10), rand(1 .. 10)) | 26 proc randVec2I(): auto = newVec2(rand(1 .. 10), rand(1 .. 10)) |
27 proc randVec2F(): auto = newVec2(rand(10'f) + 0.01, rand(10'f) + 0.01) | 27 proc randVec2F(): auto = newVec2(rand(10'f) + 0.01, rand(10'f) + 0.01) |
28 proc randVec3I(): auto = newVec3(rand(1 .. 10), rand(1 .. 10), rand(1 .. 10)) | 28 proc randVec3I(): auto = newVec3(rand(1 .. 10), rand(1 .. 10), rand(1 .. 10)) |
29 proc randVec3F(): auto = newVec3(rand(10'f) + 0.01, rand(10'f) + 0.01, rand(10'f) + 0.01) | 29 proc randVec3F(): auto = newVec3(rand(10'f) + 0.01, rand(10'f) + 0.01, rand( |
30 proc randVec4I(): auto = newVec4(rand(1 .. 10), rand(1 .. 10), rand(1 .. 10), rand(1 .. 10)) | 30 10'f) + 0.01) |
31 proc randVec4F(): auto = newVec4(rand(10'f) + 0.01, rand(10'f) + 0.01, rand(10'f) + 0.01, rand(10'f) + 0.01) | 31 proc randVec4I(): auto = newVec4(rand(1 .. 10), rand(1 .. 10), rand(1 .. 10), |
32 rand(1 .. 10)) | |
33 proc randVec4F(): auto = newVec4(rand(10'f) + 0.01, rand(10'f) + 0.01, rand( | |
34 10'f) + 0.01, rand(10'f) + 0.01) | |
32 | 35 |
33 | 36 |
34 proc testVector() = | 37 proc testVector() = |
35 echoInfo(randVec2I()) | 38 echoInfo(randVec2I()) |
36 echoInfo(randVec2F()) | 39 echoInfo(randVec2F()) |
132 echo "float2int ", to[int](randVec3F()) | 135 echo "float2int ", to[int](randVec3F()) |
133 echo "int2float ", to[float](randVec3I()) | 136 echo "int2float ", to[float](randVec3I()) |
134 echo "float2int ", to[int](randVec3F()) | 137 echo "float2int ", to[int](randVec3F()) |
135 echo "int2float ", to[float](randVec3I()) | 138 echo "int2float ", to[float](randVec3I()) |
136 | 139 |
140 echo "V3I.x: ", randVec3I().x | |
141 echo "V3I.y: ", randVec3I().y | |
142 echo "V3F.z: ", randVec3F().z | |
143 echo "V3I.r: ", randVec3I().r | |
144 echo "V3I.g: ", randVec3I().g | |
145 echo "V3F.b: ", randVec3F().b | |
146 | |
137 echo "V2I.xx: ", randVec2I().xx | 147 echo "V2I.xx: ", randVec2I().xx |
138 echo "V2I.yx: ", randVec2I().xy | 148 echo "V2I.yx: ", randVec2I().xy |
139 echo "V2F.xx: ", randVec2F().xx | 149 echo "V2F.xx: ", randVec2F().xx |
140 echo "V2F.yx: ", randVec2F().yx | 150 echo "V2F.yx: ", randVec2F().yx |
141 echo "V2I.rr: ", randVec2I().rr | 151 echo "V2I.rr: ", randVec2I().rr |