pub fn compute_occlusion(
root: NodeRef,
arena: &Arena<SceneNode>,
) -> HashSet<NodeRef>Expand description
Compute the set of occluded nodes for a given root.
The algorithm flattens the subtree rooted at root into draw order
(back-to-front via pre-order traversal), then iterates front-to-back
(reversed). Fully-opaque rectangular layers contribute their global bounds
(clipped to any ancestor clip region) to an occlusion list. Any subsequent
(i.e. behind) node whose visible bounds are fully contained by an opaque
rect is marked occluded.
Nodes whose bounds fall entirely outside an ancestor’s clip_children
region are also marked occluded since they produce no visible pixels.