summaryrefslogtreecommitdiff
path: root/fennel-raytracer.fnl
diff options
context:
space:
mode:
Diffstat (limited to 'fennel-raytracer.fnl')
-rw-r--r--fennel-raytracer.fnl4
1 files changed, 2 insertions, 2 deletions
diff --git a/fennel-raytracer.fnl b/fennel-raytracer.fnl
index ca5e400..462ac5a 100644
--- a/fennel-raytracer.fnl
+++ b/fennel-raytracer.fnl
@@ -130,7 +130,7 @@ multiplication."
(fn degrees->radians [d]
"Convert D, a value in degrees, to radians."
- (* d (/ math.pi 360)))
+ (* d (/ math.pi 180)))
(local image-width 1920)
(local image-height 1080)
@@ -144,7 +144,7 @@ multiplication."
(fn coordinate->ray [x y]
"Return the ray corresponding to the point X, Y on the viewport plane."
(let [dist 1.0
- top (* dist (math.tan (degrees->radians camera-fov)))
+ top (* dist (math.tan (/ (degrees->radians camera-fov) 2)))
right (* top image-aspect-ratio)
bottom (- top)
left (- right)