From 6f5984a379b37c1d045b37fb2cf9abce73550def Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Tue, 8 Aug 2017 14:31:31 -0700 Subject: [PATCH] Implemented proper handling of Emit surface closure. --- src/renderer.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/renderer.rs b/src/renderer.rs index d0c4d67..e360959 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -444,6 +444,15 @@ impl LightPath { { // Hit something! Do the stuff + // If it's an emission closure, handle specially: + // - Collect light from the emission. + // - Terminate the path. + use shading::surface_closure::SurfaceClosureUnion; + if let &SurfaceClosureUnion::EmitClosure(ref clsr) = closure { + self.color += clsr.emitted_color().e * self.light_attenuation; + return false; + } + // Prepare light ray let light_n = self.next_lds_samp(); let light_uvw = (