/** * Gather world AABBs from a live scene subtree for the WASM hit-test grid. * * This mirrors `Scene.findHitRecursively`'s exact traversal (self, then EVERY * child in array order, recursively — `node.children` unconditionally, so * DOM-portal descendants and anything renderNode's rendering-specific * early-returns skip are still covered) so the grid-accelerated path can never * see a different entity set than the JS walk it replaces. * * Indices are assigned in PRE-ORDER (self before children, children in array * order): a node's own index is always lower than every index in its own * subtree, and an earlier sibling's whole subtree is entirely lower than a * later sibling's. Since `findHitRecursively` checks later siblings' subtrees * before earlier ones, and a node's children before the node itself, "highest * index wins" over this numbering is EXACTLY equivalent to that traversal's * topmost-hit priority — the invariant the WASM grid kernel's `idx > best` * comparison (see hit.rs) and the boundless-entity merge below both rely on. * * Entities without `getBounds()` (opted out of culling — "never known bounds") * cannot be spatially indexed at all; they are collected into `boundless` * instead, each tagged with its index, so the caller can still check them and * compare against the grid's best candidate by that same index. */ import type { Entity } from '../tree/Entity'; export interface HitGatherResult { /** Total entities visited (bounded + boundless); the grid's `count`. */ count: number; /** index -> Entity, for bounded entities (grid slot == array index). */ slotEntity: Entity[]; /** Entities with no `getBounds()`, each with its pre-order index, ascending. */ boundless: Array<{ entity: Entity; index: number; }>; /** World AABBs, indexed like `slotEntity` (a boundless index has garbage — * never read, since those entities are only resolved via `boundless`). */ minx: Float64Array; miny: Float64Array; maxx: Float64Array; maxy: Float64Array; } /** Walk `root` and all descendants into a flat, pre-order-indexed AABB set. * `currentFrame` is the scene's frame counter — passed through to * {@link Entity._readWorldCache} so the common case (every entity was * rendered this same frame, which the "gather right after a render" call * site always guarantees) reads six cached scalars per entity instead of * allocating a fresh `{a,b,c,d,e,f}` object via `getWorldTransform()`. */ export declare function gatherHitAABBs(root: Entity, currentFrame: number): HitGatherResult;