wip: parallelization
This commit is contained in:
@@ -2,12 +2,11 @@ use core::f32::math::sqrt;
|
||||
use std::fmt::{self, Debug};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
use crate::Vec3;
|
||||
use crate::objects::hit::Hit;
|
||||
use crate::objects::materials::traits::Material;
|
||||
use crate::objects::traits::Hittable;
|
||||
use crate::ray::Ray;
|
||||
use crate::Vec3;
|
||||
|
||||
pub struct Sphere {
|
||||
center: Vec3,
|
||||
@@ -63,14 +62,10 @@ impl Hittable for Sphere {
|
||||
Some(Hit::new(
|
||||
t,
|
||||
p,
|
||||
self.normal_at(&p),
|
||||
(p - self.center).get_unit(),
|
||||
self.material.clone(),
|
||||
out_n.dot(r.dir()) < 0.,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
fn normal_at(&self, p: &Vec3) -> Vec3 {
|
||||
(*p - self.center).get_unit()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user