Scene graph · function
visitVisible
Walk a hierarchy, skipping any subtree the frustum rejects.
Explained in Hello world, The scene graph.
function visitVisible(root: SceneNode, frustum: Frustum, visit: (node: SceneNode) => void, out: VisitResult): VisitResultimport { visitVisible } from '@driftengine/core';Parameters
| Parameter | Type | Description |
|---|---|---|
root | SceneNode | |
frustum | Frustum | |
visit | (node: SceneNode) => void | |
out | VisitResult |
In depth
This is the spatial partition, and there is no second structure. A node's world bounds
enclose every descendant's, so rejecting a parent rejects everything under it — which is what a
bounding-volume hierarchy is. The caller builds it by describing its world, and the pruning is
free. IMPROVEMENTS.md recorded a trigger for building a BVH; this retires it rather than
meeting it.
It does not draw. visit is handed a node and the caller decides what verb that is worth,
in whatever order it likes. The render graph work established that draw order carries meaning,
and a traversal that issued draws would be deciding it.
A node with no geometry is not visited, but its children are. A group is scaffolding, and handing one to a visitor gives a caller something with nothing to draw.
Allocates nothing: out is the caller's, and the visitor is called rather than collected.