mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Give a viewer of its own a query port, as it has draw and camera ports
The Cesium query port moves out of createCesiumPorts into its own module, unchanged, so it can also be built over a caller's viewer with no renderer bound. findQuery and queryOf find the bound renderer's query port or, for such a viewer, one the Cesium adapter's factory builds, as findDraw and findCamera do. It picks the sets drawn through findDraw on that viewer and its height samples see through them, so a layer can exclude its own sets; it projects, casts rays and picks the ellipsoid as the renderer's does. A renderer bound later answers new callers. The camera factory and the caller's unbound export load it, and the factory walk checks that every public entry reaching a findQuery or queryOf caller loads it, or is a Cesium-free entry whose caller does.
This commit is contained in:
1 parent
ee6b9e49aa
commit
784561a6ae
10 files changed
+654
-308
No files matched your search
@@ -1394,6 +1394,18 @@ export function createCesiumDraw({ scene, report }) {
|
||||
};
|
||||
}
|
||||
|
||||
/** The parts of the draw ports built for viewers with no renderer, by port. */
|
||||
const unboundParts = new WeakMap();
|
||||
|
||||
/**
|
||||
* The draw port part (its sets) behind a port built for a viewer with no
|
||||
* renderer, for that viewer's query port to pick and see through; null for
|
||||
* any other port.
|
||||
* @param {object|null|undefined} port
|
||||
*/
|
||||
export const unboundDrawPart = (port) =>
|
||||
(port && unboundParts.get(port)) ?? null;
|
||||
|
||||
// A Cesium viewer with no renderer bound to it gets a
|
||||
// draw port over its scene when code first asks `findDraw` for one. A
|
||||
// renderer bound later supersedes it: released, its sets keep drawing until
|
||||
@@ -1409,6 +1421,7 @@ provideUnboundDraw((viewer) => {
|
||||
)
|
||||
return null;
|
||||
const part = createCesiumDraw({ scene, report: uncaught });
|
||||
unboundParts.set(part.port, part);
|
||||
const offs = [
|
||||
scene.preRender?.addEventListener?.(() => part.beforeRender()),
|
||||
scene.postRender.addEventListener(() => part.afterRender()),
|
||||
|
||||
Reference in new issue
Block a user