Merge branch 'main' of ssh://git.djairo.dev:2222/djairoh/raytracing

This commit is contained in:
2026-04-21 23:06:47 +02:00
2 changed files with 4 additions and 2 deletions

View File

@@ -42,7 +42,9 @@ impl Hittable for Sphere {
if d < 0. {
None
} else {
let t = (h - sqrt(d)) / a;
let tl = (h - sqrt(d)) / a;
let tr = (h + sqrt(d)) / a;
let t = if tl > 0.001 { tl } else { tr };
let p = r.at(t);
let out_n = (p - self.center) / self.radius;
Some(Hit::new(

View File

@@ -102,7 +102,7 @@ impl Vec3 {
}
pub fn reflect(&self, n: &Self) -> Self {
*self - 2. * self.dot(n) * n
*self - 2. * (self.dot(n) * n)
}
pub fn refract(&self, n: &Self, etai_over_etat: f32) -> Self {