about summary refs log tree commit diff stats
path: root/apps/raytracing/ray.mu
diff options
context:
space:
mode:
Diffstat (limited to 'apps/raytracing/ray.mu')
-rw-r--r--apps/raytracing/ray.mu13
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/raytracing/ray.mu b/apps/raytracing/ray.mu
new file mode 100644
index 00000000..ca2cb475
--- /dev/null
+++ b/apps/raytracing/ray.mu
@@ -0,0 +1,13 @@
+type ray {
+  orig: vec3  # point
+  dir: vec3
+}
+
+fn ray-at _self: (addr ray), t: float, out: (addr vec3) {
+  var self/esi: (addr ray) <- copy _self
+  var src/eax: (addr vec3) <- get self, dir
+  copy-object src, out
+  vec3-mul-by out, t
+  src <- get self, orig
+  vec3-add-to out, src
+}