ft (wip): 10: dielectrics

This commit is contained in:
djaidjai committed 2026-04-16 15:38:01 +02:00
1 parent b756cc394a
commit 1920376e34
6 files changed
+71 -7

No files matched your search

+8 -2
View File
@@ -11,15 +11,17 @@ pub struct Hit {
p: Vec3,
n: Vec3,
mat: Arc<dyn Material>,
front_face: bool,
}
impl Hit {
pub fn new(t: f32, p: Vec3, n: Vec3, mat: Arc<dyn Material>) -> Self {
pub fn new(t: f32, p: Vec3, n: Vec3, mat: Arc<dyn Material>, front_face: bool) -> Self {
Self {
t: t,
p: p,
n: n,
n: if front_face { n } else { -n },
mat: mat,
front_face: front_face,
}
}
@@ -39,6 +41,10 @@ impl Hit {
self.mat.clone()
}
pub fn front_face(&self) -> bool {
self.front_face
}
pub fn hit_list<T: Hittable>(hittables: &Vec<T>, r: &Ray) -> Option<Hit> {
let mut closest: Option<Hit> = None;
for hittable in hittables {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.