From 89a2333644a82f2645e4ad554eadf7d4f142f2c0 Mon Sep 17 00:00:00 2001 From: "max.nuding" Date: Thu, 30 Jun 2022 10:39:15 +0200 Subject: [PATCH] Fix refactoring errors --- src/material.rs | 3 ++- src/vec3.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/material.rs b/src/material.rs index 2d6ccaa..20354ba 100644 --- a/src/material.rs +++ b/src/material.rs @@ -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)) } diff --git a/src/vec3.rs b/src/vec3.rs index e62f8d2..7072ea7 100644 --- a/src/vec3.rs +++ b/src/vec3.rs @@ -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 {