Give a viewer with no renderer an effects port, as cameras get

The renderer bridge builds and keeps an effects port over a viewer no
renderer is bound to, with a factory the Cesium effects module provides,
so visual settings on a caller's own viewer draw their styles, bloom
and sharpen as before and give the scene's bloom back when destroyed.
The application shell loads the factory; a test checks every export
that reaches the effects lookup loads it.
This commit is contained in:
Sameh Khamis committed 2026-11-06 16:33:40 -08:00
1 parent 6a7905fc49
commit 94b8b0bd30
8 files changed
+333 -64

No files matched your search

+3
View File
@@ -32,6 +32,9 @@ import {
import * as Cesium from 'cesium';
import { cameraOf } from '../render/cesium/camera.js';
// Loads the effects factory, so visual settings on a viewer with no renderer
// bound still get an effects port.
import '../render/cesium/effects.js';
import { aircraftTrackingTarget } from '../cockpitTracking.js';
+4 -2
View File
@@ -5,7 +5,7 @@ import { useDisplayStore } from './stores/display.js';
import { applicationPinia } from './vueRuntime.js';
import { onLocaleChange, t } from '../i18n/index.js';
import { UiLifetime } from './uiLifetime.js';
import { rendererOf } from '../render/rendererOf.js';
import { findEffects, releaseUnboundEffects } from '../render/rendererOf.js';
import {
VisualEffects,
STYLES,
@@ -196,7 +196,7 @@ export class VisualSettings {
setStyleParameter: (name, value) => this.setStyleParameter(name, value),
});
this._visualEffects = new VisualEffects({
effects: rendererOf(viewer)?.effects ?? null,
effects: findEffects(viewer),
viewer,
requestRender: services.governorRequestRender,
holdRender: services.holdContinuousRender,
@@ -1621,5 +1621,7 @@ export class VisualSettings {
this.stop();
this.releaseIrBoost();
this._visualEffects.destroy();
// On a viewer with no renderer bound, its bloom comes back as it was.
releaseUnboundEffects(this.viewer, this._visualEffects.effects);
}
}