wip: parallelization

This commit is contained in:
djaidjai committed 2026-05-03 14:58:56 +02:00
1 parent eb90c36ae8
commit 10f9c0984d
23 files changed
+294 -211

No files matched your search

+3 -4
View File
@@ -16,9 +16,7 @@ pub struct Dielectric {
impl Dielectric {
pub fn new(refraction_index: f32) -> Self {
Self {
refraction_index,
}
Self { refraction_index }
}
fn reflectance(cos: f32, refraction_index: f32) -> f32 {
@@ -46,7 +44,8 @@ impl Material for Dielectric {
let cannot_refract = ri * sin_theta > 1.;
let mut rng = rand::rng();
let dir = if cannot_refract || Dielectric::reflectance(cos_theta, ri) > rng.random::<f32>() {
let dir = if cannot_refract || Dielectric::reflectance(cos_theta, ri) > rng.random::<f32>()
{
unit.reflect(hit.n())
} else {
unit.refract(hit.n(), ri)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.