mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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:
1 parent
22ce0925a2
commit
1a9bdd9b63
11 files changed
+618
-48
No files matched your search
@@ -15,7 +15,7 @@
|
||||
* Members it does not have are absent, never stubbed.
|
||||
*/
|
||||
import * as Cesium from 'cesium';
|
||||
import { createCesiumPorts } from './ports.js';
|
||||
import { cesiumCapabilities, createCesiumPorts } from './ports.js';
|
||||
|
||||
export { toCartesian, toColor, toImage } from './ports.js';
|
||||
|
||||
@@ -29,9 +29,6 @@ const SKY_DEFAULTS = Object.freeze({
|
||||
lighting: false,
|
||||
});
|
||||
|
||||
/** What this renderer can do; a caller may ask for fewer. */
|
||||
const CAPABILITIES = ['models'];
|
||||
|
||||
/**
|
||||
* @param {{container: HTMLElement, msaa?: number, capabilities?: Iterable<string>}} options
|
||||
* `capabilities` limits the renderer to those it lists.
|
||||
@@ -68,10 +65,7 @@ export async function createCesiumSceneRenderer({
|
||||
if (scene.moon) scene.moon.show = false;
|
||||
|
||||
const sky = { ...SKY_DEFAULTS };
|
||||
const allowed = only && new Set(only);
|
||||
const capabilities = new Set(
|
||||
CAPABILITIES.filter((c) => !allowed || allowed.has(c)),
|
||||
);
|
||||
const capabilities = new Set(cesiumCapabilities(scene, only));
|
||||
|
||||
function applySky() {
|
||||
scene.globe.enableLighting = sky.lighting;
|
||||
@@ -82,7 +76,7 @@ export async function createCesiumSceneRenderer({
|
||||
scene.requestRender();
|
||||
}
|
||||
|
||||
const ports = createCesiumPorts(widget);
|
||||
const ports = createCesiumPorts(widget, { capabilities });
|
||||
const frame = {
|
||||
...ports.frame,
|
||||
setTime(ms) {
|
||||
@@ -128,13 +122,17 @@ export async function createCesiumSceneRenderer({
|
||||
await ports.nextPostRender();
|
||||
if (models().some((r) => r.host.failed > 0))
|
||||
return { state: 'failed', blockers: ['models'] };
|
||||
const loading = models().some((r) => r.host.loading > 0);
|
||||
const icons = ports.iconState();
|
||||
if (icons === 'failed') return { state: 'failed', blockers: ['icons'] };
|
||||
const loading =
|
||||
models().some((r) => r.host.loading > 0) || icons === 'loading';
|
||||
quiet = scene.globe.tilesLoaded && !loading ? quiet + 1 : 0;
|
||||
if (quiet >= 3) return { state: 'settled', blockers: [] };
|
||||
}
|
||||
const blockers = [];
|
||||
if (!scene.globe.tilesLoaded) blockers.push('globe');
|
||||
if (models().some((r) => r.host.loading > 0)) blockers.push('models');
|
||||
if (ports.iconState() !== 'settled') blockers.push('icons');
|
||||
return { state: 'timeout', blockers };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user