float BVH4i::sah (NodeRef& node, const BBox3f& bounds) { float f = bounds.empty() ? 0.0f : area(bounds); if (node.isNode()) { Node* n = node.node(nodePtr()); for (size_t c=0; c<4; c++) f += sah(n->child(c),n->bounds(c)); return f; } else { size_t num; node.leaf(triPtr(),num); return f*num; } }
float BVH4i::sah (NodeRef& node, BBox3fa bounds) { float f = bounds.empty() ? 0.0f : area(bounds); if (node.isNode()) { Node* n = node.node(nodePtr()); for (size_t c=0; c<BVH4i::N; c++) if (n->child(c) != BVH4i::invalidNode) f += sah(n->child(c),n->bounds(c)); return f; } else { unsigned int num; node.leaf(triPtr(),num); return f*num; } }