From 78357b8852626b510527f3b8d770a7dd8956fcc7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 16 Jul 2021 08:38:43 -0700 Subject: . --- html/linux/apps/raytracing/ray.mu.html | 86 ++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 html/linux/apps/raytracing/ray.mu.html (limited to 'html/linux/apps/raytracing/ray.mu.html') diff --git a/html/linux/apps/raytracing/ray.mu.html b/html/linux/apps/raytracing/ray.mu.html new file mode 100644 index 00000000..5400c1f2 --- /dev/null +++ b/html/linux/apps/raytracing/ray.mu.html @@ -0,0 +1,86 @@ + + + + +Mu - linux/apps/raytracing/ray.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/linux/apps/raytracing/ray.mu +
+ 1 type ray {
+ 2   orig: vec3  # point
+ 3   dir: vec3
+ 4 }
+ 5 
+ 6 # A little different from the constructor at https://raytracing.github.io/books/RayTracingInOneWeekend.html
+ 7 # We immediately normalize the direction vector so we don't have to keep doing
+ 8 # so.
+ 9 fn initialize-ray _self: (addr ray), o: (addr vec3), d: (addr vec3) {
+10   var self/esi: (addr ray) <- copy _self
+11   var dest/eax: (addr vec3) <- get self, orig
+12   copy-object o, dest
+13   dest <- get self, dir
+14   vec3-unit d, dest
+15 }
+16 
+17 fn ray-at _self: (addr ray), t: float, out: (addr vec3) {
+18   var self/esi: (addr ray) <- copy _self
+19   var src/eax: (addr vec3) <- get self, dir
+20   copy-object src, out
+21   vec3-scale-up out, t
+22   src <- get self, orig
+23   vec3-add-to out, src
+24 }
+
+ + + -- cgit 1.4.1-2-gfad0