Fix refactoring errors
This commit is contained in:
parent
a86dbb516c
commit
89a2333644
@ -116,7 +116,8 @@ impl Scatterable for Dielectric {
|
|||||||
let scattered = Ray::new(hit_record.point, reflected);
|
let scattered = Ray::new(hit_record.point, reflected);
|
||||||
Some((Some(scattered), color))
|
Some((Some(scattered), color))
|
||||||
} else {
|
} 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);
|
let scattered = Ray::new(hit_record.point, direction);
|
||||||
Some((Some(scattered), color))
|
Some((Some(scattered), color))
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ impl Vec3 {
|
|||||||
let inner = 1.0 - out_perp.length_squared();
|
let inner = 1.0 - out_perp.length_squared();
|
||||||
let abs = inner.abs();
|
let abs = inner.abs();
|
||||||
let r = -(abs.sqrt());
|
let r = -(abs.sqrt());
|
||||||
out_parallel = r * (*normal);
|
let out_parallel = r * (*normal);
|
||||||
out_perp + out_parallel
|
out_perp + out_parallel
|
||||||
}
|
}
|
||||||
pub fn refract_sort_of_works(&self, normal: &Vec3, etai_over_etat: f64) -> Vec3 {
|
pub fn refract_sort_of_works(&self, normal: &Vec3, etai_over_etat: f64) -> Vec3 {
|
||||||
|
Loading…
Reference in New Issue
Block a user