fix(cctv): cull frames through renderer camera port

This commit is contained in:
brandonabyrd committed 2026-11-18 17:13:06 -06:00
1 parent 147d1f5e4e
commit c0752784d2
6 files changed
+143 -36

No files matched your search

+3
View File
@@ -350,6 +350,9 @@ export function createCesiumCamera({
}
const cameraPort = {
// The ECEF camera pose describes the globe only in 3D. Consumers that
// cannot prove this must avoid globe-only visibility culling.
isWorld3D: () => scene.mode === Cesium.SceneMode.SCENE3D,
on: (event, cb, options) => cameraEvents.on(event, cb, options),
onCommand: (cb) => commandHooks.on(cb),
setView(spec) {
+17
View File
@@ -337,6 +337,23 @@ test('the camera port gives the clock its own tick back as it goes', () => {
}
});
test('camera reports globe mode and fails closed for other modes', () => {
const { scene, camera } = headlessCamera();
scene.postUpdate = new Cesium.Event();
scene.requestRender = () => {};
const { port } = createCesiumCamera({ scene, camera, report: () => {} });
for (const [mode, expected] of [
[Cesium.SceneMode.SCENE3D, true],
[Cesium.SceneMode.SCENE2D, false],
[Cesium.SceneMode.COLUMBUS_VIEW, false],
[Cesium.SceneMode.MORPHING, false],
[undefined, false],
]) {
scene.mode = mode;
assert.equal(port.isWorld3D(), expected);
}
});
test('setFov holds the vertical angle across resizes, and waits for a first one', () => {
const { scene, camera } = headlessCamera();
scene.postUpdate = new Cesium.Event();
+2
View File
@@ -234,6 +234,8 @@ export type CameraEvent =
'changed' | 'moveStart' | 'moveEnd' | 'followChanged' | 'flightEnd';
export interface CameraPort {
/** True only when its pose is an ECEF view of the 3D globe. Missing means unknown. */
isWorld3D?(): boolean;
pose(): CameraPose;
/**
* Place the eye. A position with a `{direction, up}` orientation is placed