ft: 5,6.1: sphere class + normals
This commit is contained in:
25
src/objects/hit.rs
Normal file
25
src/objects/hit.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user