Fix refactoring errors

This commit is contained in:
max.nuding 2022-06-30 10:39:15 +02:00
parent a86dbb516c
commit 89a2333644
Failed to extract signature
2 changed files with 3 additions and 2 deletions

View File

@ -116,7 +116,8 @@ impl Scatterable for Dielectric {
let scattered = Ray::new(hit_record.point, reflected);
Some((Some(scattered), color))
} else {
let direction = unit_direction.refract_orig(&hit_record.normal, refraction_ratio);
//let direction = unit_direction.refract(&hit_record.normal, refraction_ratio);
let direction = unit_direction.refract_sort_of_works(&hit_record.normal, refraction_ratio);
let scattered = Ray::new(hit_record.point, direction);
Some((Some(scattered), color))
}

View File

@ -81,7 +81,7 @@ impl Vec3 {
let inner = 1.0 - out_perp.length_squared();
let abs = inner.abs();
let r = -(abs.sqrt());
out_parallel = r * (*normal);
let out_parallel = r * (*normal);
out_perp + out_parallel
}
pub fn refract_sort_of_works(&self, normal: &Vec3, etai_over_etat: f64) -> Vec3 {