wip: parallelization

This commit is contained in:
2026-05-03 14:58:56 +02:00
parent eb90c36ae8
commit 10f9c0984d
23 changed files with 294 additions and 211 deletions

View File

@@ -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()
}
}