From d406309b03ac3f8d3592573280f0a97d39f3317e Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 3 Jun 2013 12:10:10 +0200 Subject: [PATCH] fix a potential issue in bre.cpp where some photons are not considered during AABB construction --- src/integrators/photonmapper/bre.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/integrators/photonmapper/bre.cpp b/src/integrators/photonmapper/bre.cpp index dcfc431b..aa0f6e55 100644 --- a/src/integrators/photonmapper/bre.cpp +++ b/src/integrators/photonmapper/bre.cpp @@ -116,21 +116,20 @@ void BeamRadianceEstimator::serialize(Stream *stream, InstanceManager *manager) AABB BeamRadianceEstimator::buildHierarchy(IndexType index) { BRENode &node = m_nodes[index]; + Point center = node.photon.getPosition(); + Float radius = node.radius; + node.aabb = AABB( + center - Vector(radius, radius, radius), + center + Vector(radius, radius, radius) + ); + if (!node.photon.isLeaf()) { IndexType left = node.photon.getLeftIndex(index); IndexType right = node.photon.getRightIndex(index); - node.aabb.reset(); if (left) node.aabb.expandBy(buildHierarchy(left)); if (right) node.aabb.expandBy(buildHierarchy(right)); - } else { - Point center = node.photon.getPosition(); - Float radius = node.radius; - node.aabb = AABB( - center - Vector(radius, radius, radius), - center + Vector(radius, radius, radius) - ); } return node.aabb;