diff options
author | Julian T <julian@jtle.dk> | 2021-02-06 23:43:06 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-02-06 23:43:06 +0100 |
commit | b64c7e972c52b7d015d661866f0cf902370343e5 (patch) | |
tree | 8d3dc9a8ae6b491b9f8f639f2d0bad6387d59069 /src/camera/film.rs | |
parent | 0d5e6bd9363d5ed5c4f28174819fc0f5fd9aa586 (diff) |
Implement pathtracing
Diffstat (limited to 'src/camera/film.rs')
-rw-r--r-- | src/camera/film.rs | 5 |
1 files changed, 3 insertions, 2 deletions
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, |