Skip to content

Commit

Permalink
(fix) ray: use appropriate function to instantiate ray
Browse files Browse the repository at this point in the history
This commit fixes ray creation which fixes a bit of unexpected behaviour of
object picking. See the `observation` note towards the end of this comment:
#222

The origin library provides a couple of functions to create a ray. Prior to
this, we used a helper function which expected the ray `origin` and `direction`
as parameters while what was actually being passed were the `from` and `to`
coordinates. In this commit we use the more appropriate function which expects
the `from` and `to` coordinates.
  • Loading branch information
Kayomarz Gazder committed Jul 28, 2023
1 parent db8dde9 commit 020d1f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kernel/ray.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

(defun intersect-aabb (ray point-min point-max)
(origin.geometry:raycast-aabb
(origin.geometry.ray:ray :origin (from ray) :direction (to ray))
(origin.geometry.ray:ray-from-points :from (from ray) :to (to ray))
(origin.geometry.aabb:aabb-from-min/max
:min point-min :max point-max)))

(defun intersect-triangle (ray p0 p1 p2)
(intersect/triangle
(origin.geometry.triangle:triangle p0 p1 p2)
(origin.geometry.ray:ray :origin (from ray) :direction (to ray))))
(origin.geometry.ray:ray-from-points :from (from ray) :to (to ray))))

(defun intersect-triangles (ray triangles)
(let ((min-distance nil))
Expand Down

0 comments on commit 020d1f0

Please sign in to comment.