https://github.com/akkartik/mu/blob/master/apps/raytracing/vec.mu
1 type vec3 {
2 x: float
3 y: float
4 z: float
5 }
6
7 fn vec3-negate _v: (addr vec3) {
8 }
9
10 fn vec3-add-to _v1: (addr vec3), _v2: (addr vec3) {
11 }
12
13 fn vec3-mul-by _v1: (addr vec3), _v2: (addr vec3) {
14 }
15
16 fn vec3-scale-up _v: (addr vec3), f: float {
17 }
18
19 fn vec3-scale-down _v: (addr vec3), f: float {
20 }
21
22 fn vec3-length v: (addr vec3) -> result/xmm0: float {
23 }
24
25 fn vec3-length-squared _v: (addr vec3) -> result/xmm0: float {
26 }
27
28 fn vec3-dot _v1: (addr vec3), _v2: (addr vec3) -> result/xmm0: float {
29 }
30
31 fn vec3-cross _v1: (addr vec3), _v2: (addr vec3), out: (addr vec3) {
32 }
33
34 fn vec3-unit in: (addr vec3), out: (addr vec3) {
35 }
36
37 fn print-vec3 screen: (addr screen), _v: (addr vec3) {
38 var v/esi: (addr vec3) <- copy _v
39 print-string screen, "("
40 var tmp/eax: (addr float) <- get v, x
41 print-float screen, *tmp
42 print-string screen, ", "
43 tmp <- get v, y
44 print-float screen, *tmp
45 print-string screen, ", "
46 tmp <- get v, z
47 print-float screen, *tmp
48 print-string screen, ")"
49 }