From b64c7e972c52b7d015d661866f0cf902370343e5 Mon Sep 17 00:00:00 2001 From: Julian T Date: Sat, 6 Feb 2021 23:43:06 +0100 Subject: Implement pathtracing --- src/camera/film.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/camera') diff --git a/src/camera/film.rs b/src/camera/film.rs index 7193e1d..2ff7239 100644 --- a/src/camera/film.rs +++ b/src/camera/film.rs @@ -40,12 +40,13 @@ impl Pixel { } fn add(&mut self, c: &Spectrum, weight: Float) { - self.rgb += &(c * weight); + self.rgb += &(*c * weight); self.samples += 1; } fn finalize_rgb(&self) -> [u8; 3] { - let (r, g, b) = (&self.rgb / (self.samples as Float)).to_rgb(255.0); + let spc = (self.rgb / (self.samples as Float)).gamma_correct(); + let (r, g, b) = spc.to_rgb(255.0); [ r as u8, g as u8, -- cgit v1.2.3