Places meshes (any builder's trees, records) and instances in one
scene. meshes[i] is the tree of instances with meshIndex i.
Instances in the top level (hidden ones and ones whose transform can't be inverted aren't).
The scene's buffers (for createCpuTracer or an upload).
StaticbuildBuilds each mesh with build (tinybvh's buildMeshBvhWithTinyBvh, say) and places the instances.
The instanceIndex of the instance record at a top-level position (what traverse ranges count).
The instanceIndex of every instance whose world box meets box ([minX, minY, minZ, maxX, maxY, maxZ]).
The instanceIndex of every instance whose world box meets the planes
(is not wholly outside any of them), as three's Frustum.intersectsBox
tests a box. Walks the top level, skipping subtrees outside a plane and
taking subtrees inside every plane whole. With mask, only instances it
names (as rays do).
Every hit along the ray (sorted by t), or the closest with firstHitOnly.
New transforms, visibility, masks or materials for the same meshes: rebuilds the top level only.
three-mesh-bvh's ObjectBVH.shapecast(callbacks) over the instances
(PARITY 5.3): traverse, with each entered leaf's (or contained
box's) instances handed to intersectsInstance by instanceIndex.
Boxes come as a BvhBox3 (a scratch object, valid during the
call). intersectsRange, when given, is asked first and a truthy answer
stops the cast; with neither, a cast stops at the first contained box,
as three-mesh-bvh's does. Returns true when a callback stopped it.
shapecast with the caller's box type (an engine adapter passes its own; it needs min and max points).
The top level's walk with three-mesh-bvh's shapecast contract
(CpuMeshBvh.traverse's callbacks, step for step: depth first, the
root's box never asked about, each child scored once by
boundsTraverseOrder and the lower score entered first, a falsy
intersectsBounds skipping the box, BVH_CONTAINED reporting the
box's subtree as one range, a truthy intersectsRange stopping the
walk). Boxes are the instances' world boxes (the ones rays test), ranges
are top-level positions (instanceAt maps them), and nodeIndex
is the child slot (parentNode * 2 + side). One instance per leaf.
Returns true when it was stopped.
The scene's instances, the mesh trees and a CPU walk over them; see the file comment.