fix a potential issue in bre.cpp where some photons are not considered during AABB construction

metadata
Wenzel Jakob 2013-06-03 12:10:10 +02:00
parent 3345af6c90
commit d406309b03
1 changed files with 7 additions and 8 deletions

View File

@ -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;