Complete the Cesium query port

The Cesium renderer now has every QueryPort member: picks and drill
picks, depth and globe picks, rays, projection, occlusion, heights now
and streamed, clamping and ray casts. Capabilities come from what the
scene supports (depth textures for pickPosition, sampleHeight,
finestHeights and rayCast), in both the conformance and app renderers.

- Picks skip unpickable and hidden items, and report each item once. A
  pick under an unpickable item stops at anything that hides the rest.
  drillPick's limit counts after that filtering, so 0 gives none.
- Height queries and ray casts see through sets not drawn with
  includeInHeightQueries, and through the sets a caller excludes, by
  their items' pick ids. The list is built once per change to the sets.
- `tiles` samples and casts run with the globe hidden for the call;
  `terrain` casts use the globe alone. A sample reports whether it came
  from tiles, terrain, the ellipsoid or a set.
- A position clampToSurface cannot read is a miss, not a failed batch.
- Terrain on an ellipsoid is height 0. Before, sampling it threw, for
  want of tile availability.

whenSettled also waits for icon images, and fails when one cannot load.
The conformance checks that pick or query settle first, because a
renderer answers from what it has loaded; the stub settles at once.
The Cesium renderer now passes 14 checks in the browser, and its
visual references are unchanged.
This commit is contained in:
Sameh Khamis committed 2026-11-05 16:22:48 -08:00
1 parent 22ce0925a2
commit 1a9bdd9b63
11 files changed
+618 -48

No files matched your search

+14
View File
@@ -51,6 +51,16 @@ async function overAustin(h, r, height = 2000) {
await h.frame(r);
}
/**
* Waits until what is drawn has loaded (icon images, tiles, models), as a
* query answers from what is loaded. Where the renderer draws synchronously it
* settled at once.
*/
async function settled(r) {
const result = await r.whenSettled({ timeoutMs: 20000 });
equal(result.state, 'settled', `settled (${result.blockers.join(', ')})`);
}
async function drawn(h, r, frames = 2) {
for (let i = 0; i < frames; i++) {
r.frame.requestRender('conformance');
@@ -486,6 +496,7 @@ export function portChecks() {
{ id: 'one', pos, image: DOT, size: [24, 24], meta: { n: 1 } },
]);
await drawn(h, r);
await settled(r);
const s = r.query.project(pos);
ok(s, 'the icon projects');
const hit = r.query.pick(s.x, s.y);
@@ -1162,6 +1173,7 @@ export function portChecks() {
'pickRay starts at the eye; pickEllipsoid lies on its ray; pickGlobe agrees',
async (h, r) => {
await overAustin(h, r, 5000);
await settled(r);
const eye = r.camera.pose().position;
const ray = r.query.pickRay(640, 360);
nearVec(ray.origin, eye, 1e-3, 'ray origin');
@@ -1267,6 +1279,7 @@ export function portChecks() {
async (h, r) => {
await overAustin(h, r);
await drawn(h, r);
await settled(r);
const point = { ...AUSTIN };
const before = await r.query.sampleHeight([point]);
const shapes = r.draw.shapes({ id: 'conf:not-ground' });
@@ -1291,6 +1304,7 @@ export function portChecks() {
},
]);
await drawn(h, r);
await settled(r);
const after = await r.query.sampleHeight([point]);
equal(after[0] === null, before[0] === null, 'answered as before');
if (after[0] && before[0])