blob: e7fe583205b25f3f0685f4fcf187d8a3215836d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
use cgmath::Vector3;
pub struct Ray {
pub orig: Vector3<f64>,
pub dir: Vector3<f64>,
pub time: f64,
}
impl Ray {
pub fn new(orig: Vector3<f64>, dir: Vector3<f64>, time: f64) -> Ray {
Ray { orig, dir, time }
}
pub fn at(&self, t: f64) -> Vector3<f64> {
self.orig + t * self.dir
}
}
pub struct NextRay {
pub attenuation: Vector3<f64>,
pub ray: Ray,
}
impl NextRay {
pub fn new(attenuation: Vector3<f64>, ray: Ray) -> NextRay {
NextRay { attenuation, ray }
}
}
|