Bound drillPick's work, pick before styles, and put changed thresholds behind a capability

The query contract now says picks answer against the scene as drawn before
effects, and that a drillPick limit bounds the work as well as the answer:
the renderer stops at `limit` hits and looks through at most
max(limit, 16) things under the pointer. The Cesium query port passes that
depth to Cesium's drill (a pick looking under something unpickable stays
unbounded), a click's drill caches one pass per depth, and the stub counts
unpickable items toward the depth.

CameraPose says fovy and aspectRatio describe the nearest centred
perspective frustum, the exact projection being in matrices().

A changed listener's own threshold is now the capability
cameraChangeThreshold; without it every listener fires at 0.5. The Cesium
and stub cameras have it, measured per listener without touching Cesium's
shared percentageChanged.

Conformance: draw.drillPick checks limit 0, never the surface, nothing over
the bare globe, an unpickable cover, nearest first and a bounded prefix;
query.pickBeforeStyles picks an icon under a mirroring style; the threshold
trace is skipped without its capability.
This commit is contained in:
Sameh Khamis committed 2026-11-08 12:37:04 -08:00
1 parent 481df0b093
commit 45302e9fbf
19 files changed
+260 -40

No files matched your search

+7 -4
View File
@@ -28,10 +28,12 @@ const angleDelta = (a, b) => {
/**
* @param {{pose: () => import('../contract/camera').CameraPose,
* report: (error: unknown) => void}} options `pose` is read only while a
* `changed` listener is registered.
* report: (error: unknown) => void, thresholds?: boolean}} options `pose`
* is read only while a `changed` listener is registered; `thresholds`
* false (a renderer without `cameraChangeThreshold`) ignores a listener's
* own threshold, so every listener fires at 0.5.
*/
export function createCameraEvents({ pose, report }) {
export function createCameraEvents({ pose, report, thresholds = true }) {
const listeners = Object.fromEntries(CAMERA_EVENTS.map((e) => [e, []]));
function deliver(entry) {
@@ -56,7 +58,8 @@ export function createCameraEvents({ pose, report }) {
function on(event, cb, options = {}) {
const list = listeners[event];
if (!list) throw new Error(`Unknown camera event: ${event}`);
const entry = { cb, live: true, threshold: options.threshold ?? 0.5 };
const threshold = thresholds ? (options.threshold ?? 0.5) : 0.5;
const entry = { cb, live: true, threshold };
list.push(entry);
return () => {
entry.live = false;