-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRay.hs
21 lines (16 loc) · 781 Bytes
/
Ray.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Ray where
import Math
data Ray = Ray {
rayOrigin :: !Pt3,
rayDir :: !Vec3, -- ^ *NOT* neccesarily normalised (eg for transformed rays)
rayNear :: !Flt, -- ^ near clipping distance
rayFar :: !Flt, -- ^ far clipping distance
rayDist :: !Flt -- ^ Total distance traversed by the light before it became
-- this ray. Eg if this ray is a reflected
-- ray, the distance here is the distance of
-- the original ray before it reflected and
-- became this ray.
} deriving Show
walk :: Ray -> Flt -> Pt3
walk ray dist = (rayOrigin ray) .+. (rayDir ray) .* dist
-- vim: expandtab smarttab sw=4 ts=4