From c8d22d3a9df34a5783bed868539de5752b216ef4 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Wed, 28 Aug 2013 17:07:09 +0200 Subject: [PATCH] edge.cpp: Don't allow creating edges with length=0 --- src/libbidir/edge.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libbidir/edge.cpp b/src/libbidir/edge.cpp index 6ad50fb1..4e867899 100644 --- a/src/libbidir/edge.cpp +++ b/src/libbidir/edge.cpp @@ -48,6 +48,9 @@ bool PathEdge::sampleNext(const Scene *scene, Sampler *sampler, return false; } + if (length == 0) + return false; + if (!medium) { weight[ERadiance] = weight[EImportance] = Spectrum(1.0f); pdf[ERadiance] = pdf[EImportance] = 1.0f; @@ -103,6 +106,9 @@ bool PathEdge::perturbDirection(const Scene *scene, } d = ray.d; + if (length == 0) + return false; + if (!medium) { weight[ERadiance] = weight[EImportance] = Spectrum(1.0f); pdf[ERadiance] = pdf[EImportance] = 1.0f;