Application extras come from the renderer plugin; framing, occlusion and panel drawing are contract ports

A renderer plugin may supply applicationHooks(renderer) for what only its
renderer has (map engine, own credits, stale commands, QA handles). What every
renderer should do moves onto the contract: controls.keepEarthFramed (behind
the keepEarthFramed capability), query.occlusionTest (behind occlusionTest),
and panel drawing, which keepPanelRendering now does through resize and
frame.renderNow through the contract. renderNow throws when the frame fails to draw.

The Cesium port installs its zoom-out guard through keepEarthFramed (a setView
no longer cancels its turn) and answers occlusionTest with the scene's probe;
the stub answers it with a horizon test.
This commit is contained in:
Sameh Khamis committed 2026-11-10 21:17:56 -08:00
1 parent a755f63638
commit 619c19ea67
40 files changed
+737 -323

No files matched your search

+4 -3
View File
@@ -51,7 +51,6 @@ import {
import { detectionBracketOpacity } from './detectionPresentation.js';
import { SurfaceOcclusion } from './detectionOcclusion.js';
import { rendererOf } from '../render/rendererOf.js';
import { applicationHooksOf } from '../render/applicationHooks.js';
import {
createCyberSonarSampler,
cyberSonarFrameDelay,
@@ -287,7 +286,7 @@ const NO_OCCLUSION_PROBE = Object.freeze({
* Hides the bracket and callout of a depth-tested contact (a street vehicle)
* that the scene drew something in front of. `_occlusionProbe` asks the GPU
* about each such contact without waiting for the answer (the renderer's
* `createOcclusionProbe` application hook, `render/applicationHooks.js`);
* `query.occlusionTest()`, where it has the `occlusionTest` capability);
* `_surfaceOcclusion` remembers the answers and decides, every frame, who is
* drawn.
*/
@@ -297,8 +296,10 @@ const _surfaceOcclusion = new SurfaceOcclusion(_occlusionProbe);
/** Use the occlusion probe of `viewer`'s renderer, or none. */
function _useOcclusionProbe(viewer) {
_occlusionProbe.destroy();
const renderer = rendererOf(viewer);
_occlusionProbe =
applicationHooksOf(rendererOf(viewer)).createOcclusionProbe?.() ??
(renderer?.capabilities?.has('occlusionTest') &&
renderer.query.occlusionTest?.()) ||
NO_OCCLUSION_PROBE;
_surfaceOcclusion.clear();
_surfaceOcclusion.probe = _occlusionProbe;
+6 -6
View File
@@ -43,8 +43,7 @@ import {
depthImage,
viewDistanceToDepth,
} from '../render/cesium/fixtures/fakeDepthScene.mjs';
import { createViewerOcclusionProbe } from '../render/cesium/sceneOcclusionProbe.js';
import { provideApplicationHooks } from '../render/applicationHooks.js';
import { createSceneOcclusionTest } from '../render/cesium/sceneOcclusionProbe.js';
import { rendererOf } from '../render/rendererOf.js';
test('detection diagnostics count rendered fading rows instead of absent selected identities', () => {
@@ -1418,10 +1417,11 @@ function installDepthScene(env, surfaceDistance, { webgl2 = true } = {}) {
const image = paint();
const scene = createFakeDepthScene({ gl, ranges: [{ near, far, image }] });
Object.assign(env.viewer.scene, scene, { camera });
// The renderer's occlusion probe, as the Cesium renderer hands it over.
provideApplicationHooks(rendererOf(env.viewer), {
createOcclusionProbe: () => createViewerOcclusionProbe(env.viewer),
});
// The renderer's occlusion test, as the Cesium query port gives it.
const renderer = rendererOf(env.viewer);
renderer.capabilities = new Set(['occlusionTest']);
renderer.query.occlusionTest = () =>
createSceneOcclusionTest(env.viewer.scene);
return {
gl,
/** Draw the next frame's depth. */