fix a potential issue in bre.cpp where some photons are not considered during AABB construction
parent
3345af6c90
commit
d406309b03
|
@ -116,21 +116,20 @@ void BeamRadianceEstimator::serialize(Stream *stream, InstanceManager *manager)
|
||||||
AABB BeamRadianceEstimator::buildHierarchy(IndexType index) {
|
AABB BeamRadianceEstimator::buildHierarchy(IndexType index) {
|
||||||
BRENode &node = m_nodes[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()) {
|
if (!node.photon.isLeaf()) {
|
||||||
IndexType left = node.photon.getLeftIndex(index);
|
IndexType left = node.photon.getLeftIndex(index);
|
||||||
IndexType right = node.photon.getRightIndex(index);
|
IndexType right = node.photon.getRightIndex(index);
|
||||||
node.aabb.reset();
|
|
||||||
if (left)
|
if (left)
|
||||||
node.aabb.expandBy(buildHierarchy(left));
|
node.aabb.expandBy(buildHierarchy(left));
|
||||||
if (right)
|
if (right)
|
||||||
node.aabb.expandBy(buildHierarchy(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;
|
return node.aabb;
|
||||||
|
|
Loading…
Reference in New Issue