26 lines
345 B
Rust
26 lines
345 B
Rust
use crate::vec3::Vec3;
|
|
|
|
pub struct Hit {
|
|
t: f32,
|
|
p: Vec3,
|
|
n: Vec3,
|
|
}
|
|
|
|
impl Hit {
|
|
pub fn new(t: f32, p: Vec3, n: Vec3) -> Hit {
|
|
Hit { t: t, p: p, n: n }
|
|
}
|
|
|
|
pub fn t(&self) -> &f32 {
|
|
&self.t
|
|
}
|
|
|
|
pub fn p(&self) -> &Vec3 {
|
|
&self.p
|
|
}
|
|
|
|
pub fn n(&self) -> &Vec3 {
|
|
&self.n
|
|
}
|
|
}
|