Scene whose BVH the BVH leaf queries.
Optionalrenderer: WebGLRendererOptional renderer for the GPU leaf. May be passed
in pre-attach — the strategy waits for onViewerAttached /
onRendererStarted to flip its internal readiness flag. When
omitted, the strategy is BVH-only forever (snap requests
silently degrade).
True when GPU snap is currently available. Reads the live flag.
Monotonic counter that bumps every time the strategy's internal state changes in a way that invalidates cached results — for example, when a RoutingPickStrategy's renderer becomes available, or its WebGL context is lost. A future memoising decorator compares this against the epoch stamped on cached results to know when to drop them.
Strategies whose state never changes (e.g. BVHPickStrategy)
may always return 0.
Tear down renderer event subscriptions. Idempotent.
Run one pick. Sync — even when the GPU backend is involved,
gl.readPixels blocks until the result is in. See
PickResult for what's populated.
The default PickStrategy for general-purpose use — composes a BVHPickStrategy and (optionally) a RendererPickStrategy and routes each call to whichever backend can answer it.
Routing rule
GPU unavailable (no renderer attached, context lost, renderer not yet started) ⇒ snap requests fall through silently to BVH and the result's PickResult.snap stays
null. The caller's PickResult.strategyUsed tells them what actually ran.Renderer observability
Constructor accepts a renderer that is not yet attached. The strategy subscribes to renderer lifecycle / context-loss events and flips an internal
gpuReadyflag as those transitions happen. Each transition bumps stateEpoch so memoising decorators can invalidate cached results that became stale across a state change (a result computed via BVH while the renderer was unavailable should not be served once GPU snap becomes available, for example).Lifecycle
dispose unwinds all subscriptions. Idempotent.