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

+17 -3
View File
@@ -34,14 +34,20 @@ const feeds = new WeakMap();
export const pointerFeedOf = (renderer) => feeds.get(renderer) ?? null;
/**
* @param {{container: HTMLElement, msaa?: number, capabilities?: Iterable<string>}} options
* `capabilities` limits the renderer to those it lists.
* @param {{container: HTMLElement, msaa?: number, capabilities?: Iterable<string>,
* cameraController?: Function, now?: () => number}} options
* `capabilities` limits the renderer to those it lists; `cameraController`
* puts the camera port on that controller (`controlledCamera.js`); `now`
* is the clock its ticks and pointer events read (`performance.now` by
* default).
* @returns {Promise<object>} A renderer with the members listed above.
*/
export async function createCesiumSceneRenderer({
container,
msaa = 4,
capabilities: only,
cameraController,
now,
}) {
const credits = document.createElement('div');
const widget = new Cesium.CesiumWidget(container, {
@@ -72,11 +78,19 @@ export async function createCesiumSceneRenderer({
const capabilities = new Set(cesiumCapabilities(scene, only));
const ports = createCesiumPorts(widget, { capabilities });
const ports = createCesiumPorts(widget, {
capabilities,
...(cameraController ? { cameraController } : {}),
...(now ? { now } : {}),
});
const input = createCesiumInput(widget, {
query: ports.query,
report: ports.report,
...(ports.suspendCamera ? { suspendCamera: ports.suspendCamera } : {}),
// Its events' times on the ticks' clock.
...(now ? { now } : {}),
});
ports.attachInput?.(input.port);
// --- Renderer --------------------------------------------------------------