Drive the visual styles, bloom and sharpen through the effects port

VisualEffects defines each preset on the renderer and keeps its own
records of intensities and parameters, written through to the port, so
crossfades, the anime sky fade, bloom and sharpen behave as before. The
renderer animates the animated styles. Sensor picks read the style
records instead of the renderer's stages. The application renderer now
has the effects port and its capabilities.
This commit is contained in:
Sameh Khamis committed 2026-11-06 16:32:49 -08:00
1 parent bbda6dd0a1
commit 6a7905fc49
18 files changed
+375 -186

No files matched your search

+4 -10
View File
@@ -27,16 +27,13 @@ import { cesiumCapabilities, createCesiumPorts } from './ports.js';
* The members a transitional renderer has today.
* @typedef {Pick<import('../contract/renderer').Renderer,
* 'id' | 'contractVersion' | 'capabilities' | 'canvas' | 'frame' | 'draw'
* | 'camera' | 'query' | 'input' | 'capture' | 'credits' | 'on'
* | 'resize' | 'destroy'>}
* | 'camera' | 'query' | 'input' | 'effects' | 'capture' | 'credits'
* | 'on' | 'resize' | 'destroy'>}
* TransitionalRenderer
*/
const viewers = new WeakMap();
/** Capabilities of ports the application renderer does not have yet. */
const NOT_YET = ['styles', 'bloom', 'sharpen'];
/** A Set no one can change once built, so `capabilities` stays true. */
export class ReadonlySet extends Set {
#sealed;
@@ -94,11 +91,7 @@ export function createCesiumRendererPlugin({
let capabilities;
try {
viewer = createViewer({ container, creditContainer });
// Effects are not the application's yet: its styles still run
// through stages of their own.
capabilities = new ReadonlySet(
cesiumCapabilities(viewer.scene).filter((c) => !NOT_YET.includes(c)),
);
capabilities = new ReadonlySet(cesiumCapabilities(viewer.scene));
ports = createCesiumPorts(viewer, { capabilities });
input = createCesiumInput(viewer, {
query: ports.query,
@@ -121,6 +114,7 @@ export function createCesiumRendererPlugin({
camera: ports.camera,
query: ports.query,
input: input.port,
effects: ports.effects,
capture: ports.capture,
credits: ports.credits,
on: ports.on,