feat(render): the Cesium renderer can run an application's camera controller

createCesiumRendererPlugin({cameraController}) (render/cesium/plugin) puts
the camera port on the shared camera controller over a native camera on
Cesium's (controlledCamera.js): poses written exactly, out of any lookAt
transform, the vertical field of view as Cesium's wide-side fov and kept
on a resize. Cesium's own controls hold their input off and their
collision off while it drives; the controller runs before and after the
preUpdate listeners, and what it throws is reported. A followed item's
position is where its GPU icon set draws it (drawnPosition), and the
input port's camera holds are the controller's.

The conformance harness, given a controller, steps a virtual clock 1/60 s
a frame for ticks and pointer events, so flights and pointer scripts are
compared frame by frame.
This commit is contained in:
Sameh Khamis committed 2026-11-12 11:41:54 -08:00
1 parent 1a7ef7fc7a
commit aa58886e40
11 files changed
+826 -36

No files matched your search

+19 -7
View File
@@ -63,11 +63,16 @@ export class ReadonlySet extends Set {
}
/**
* The Cesium plugin over a viewer factory; tests pass a fake one.
* @param {{createViewer?: typeof createApplicationViewer}} [options]
* The Cesium plugin over a viewer factory; tests pass a fake one. With
* `cameraController` (the shared camera controller's factory), its camera
* port is that controller's over Cesium's camera, which takes the user's
* input in place of Cesium's own controls (`controlledCamera.js`).
* @param {{createViewer?: typeof createApplicationViewer,
* cameraController?: Function}} [options]
*/
export function createCesiumRendererPlugin({
createViewer = createApplicationViewer,
cameraController,
} = {}) {
return Object.freeze({
id: 'cesium',
@@ -101,16 +106,23 @@ export function createCesiumRendererPlugin({
ports = createCesiumPorts(viewer, {
capabilities,
credentials: { googleApiKey, googleTokens, worldDataToken },
...(cameraController ? { cameraController } : {}),
});
input = createCesiumInput(viewer, {
query: ports.query,
report: ports.report,
...(ports.suspendCamera
? { suspendCamera: ports.suspendCamera }
: {}),
});
// Free look is limited to low heights from the start.
releaseFreeLook = installFreeLookHeightLimit(
viewer,
FREE_LOOK_MAX_HEIGHT_METERS,
);
ports.attachInput?.(input.port);
// Free look is limited to low heights from the start, on Cesium's
// own controls (the controller keeps its own limits).
if (!cameraController)
releaseFreeLook = installFreeLookHeightLimit(
viewer,
FREE_LOOK_MAX_HEIGHT_METERS,
);
configureCreditKeyboardAccess(document);
offLocale = onLocaleChange(() =>
configureCreditKeyboardAccess(document),