Abstract picking backend.

Implementations:

  • BVHPickStrategy — CPU ray pick via the "../collision".SceneRaycaster. No snap support; snap requests degrade silently.
  • RendererPickStrategy — GPU pick via the "../webGLRenderer".WebGLRenderer. Full snap support.
  • RoutingPickStrategy — composes the two leaves; routes each call to whichever backend can answer it. The default choice for general-purpose picking.

A future MemoisingPickStrategy (decorator) is anticipated in the same module — the interface stays minimal so decorators compose naturally.

Strategies that subscribe to events (renderer attach, context loss) implement dispose to unwind those subscriptions. Pure adapters can leave it unimplemented.

interface PickStrategy {
    stateEpoch: number;
    dispose(): void;
    pick(params: spatial.picking.PickParams): spatial.picking.PickResult;
}

Implemented by

Properties

Methods

Properties

stateEpoch: number

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.

Methods