fix(globe): Cesium picks fall through filtered results; no picks behind the horizon

Review of Task 4:
- a Cesium pick whose top result is filtered (a pickable: false set, the
  follow camera's proxy entity) took nothing; it now drills and answers the
  first result under it with an id (an object), else the first kept one
  (map tiles);
- billboards and points drawn without a depth test reach Cesium's GPU pick
  through the globe: mover instances behind the horizon (projector
  horizonVisible on the instance position) are left out of picks and
  drills, as Navara's CPU drill already did;
- the follow proxy entity (1 px point, cesium/follow.js) carries
  gevFollowProxy and is never a pick (review item 6).
This commit is contained in:
German Khokhlov committed 2026-10-16 20:59:10 +04:00
1 parent 4e195dac6b
commit a4e753d550
6 files changed
+148 -11

No files matched your search

+54 -1
View File
@@ -149,9 +149,62 @@ test('picks of a mover set made with pickable: false are dropped', () => {
? { owner: 'quiet', instance: 0, pickable: false }
: null,
});
assert.equal(picker.pick({ x: 1, y: 2 }), undefined);
// The pick falls through to what is under the quiet set.
assert.equal(picker.pick({ x: 1, y: 2 }).id, 'other');
assert.deepEqual(
picker.drillPick({ x: 1, y: 2 }, 5).map(({ id }) => id),
['other'],
);
});
test('a filtered top pick falls through to the first pick under it with an id', () => {
const viewer = createFakeViewer();
const quiet = { primitive: 'quiet-billboard', id: 'q' };
const proxy = { primitive: 'proxy-point', id: { gevFollowProxy: true } };
const tile = { primitive: 'tileset', content: {} };
const flight = { primitive: 'flight-billboard', id: 'ae01ce' };
const { picker } = createCesiumPicker(viewer, {
identify: (picked) =>
picked === quiet
? { owner: 'quiet', instance: 0, pickable: false }
: picked === flight
? { owner: 'flights', instance: 3, pickable: true }
: null,
});
viewer.scene.pick = () => quiet;
viewer.scene.drillPick = () => [quiet, proxy, tile, flight];
const picked = picker.pick(geo.cartesian2.create(1, 1));
assert.equal(picked.id, 'ae01ce');
assert.equal(picked.owner, 'flights');
assert.deepEqual(
picker.drillPick(geo.cartesian2.create(1, 1)).map((p) => p.primitive),
['tileset', 'flight-billboard'],
'the follow proxy and pickable: false sets are never picked',
);
// Nothing under it with an id: the first kept result (a tile).
viewer.scene.drillPick = () => [quiet, tile];
assert.equal(picker.pick(geo.cartesian2.create(1, 1)).primitive, 'tileset');
viewer.scene.pick = () => proxy;
viewer.scene.drillPick = () => [proxy];
assert.equal(picker.pick(geo.cartesian2.create(1, 1)), undefined);
});
test('drills leave out mover instances behind the horizon', () => {
const viewer = createFakeViewer();
const near = { primitive: 'near', id: 'n' };
const far = { primitive: 'far', id: 'f' };
const { picker } = createCesiumPicker(viewer, {
identify: (picked) => ({
owner: 'flights',
instance: picked === near ? 0 : 1,
}),
visible: (known) => known.instance === 0,
});
viewer.scene.drillPick = () => [far, near];
assert.deepEqual(
picker.drillPick(geo.cartesian2.create(1, 1)).map((p) => p.id),
['n'],
);
viewer.scene.pick = () => far;
assert.equal(picker.pick(geo.cartesian2.create(1, 1)).id, 'n');
});