mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Listen to the camera through the camera port in the transit layer
Transit lowered the one camera-change threshold every listener shared to 0.05, through a claim ledger. The camera port measures each listener against its own threshold, so Transit now asks for 0.05 on its own port listener, nobody else's trigger changes, and the ledger goes. A new listener measures from the view at the next tick, so the layer looks at the view once more after that tick, and a move made in between is not missed. Disable always removes both subscriptions. The billboards, the occluder and frustum checks and the frame probe still drive Cesium, so the renderer stays on the Cesium list.
This commit is contained in:
1 parent
d513034f3d
commit
b5fa86a20a
11 files changed
+115
-213
No files matched your search
@@ -5,8 +5,7 @@ import { TRANSIT_ENABLED_FEEDS } from '../../data/transitFeeds.js';
|
||||
/**
|
||||
* Init / enable / disable / update / destroy for one Transit layer instance.
|
||||
* Everything acquired here is released here — primitives, listeners, the sprite
|
||||
* registration, the pick owner, the render hold, and the camera sensitivity
|
||||
* this layer borrowed.
|
||||
* registration, the pick owner, the render hold, and the camera listener.
|
||||
* @param {object} context
|
||||
* @returns {object}
|
||||
*/
|
||||
@@ -139,7 +138,8 @@ export function createLifecycle({ state, services, parts }) {
|
||||
registerPickOwner('transit', (pickedId) => state._vehicles.has(pickedId));
|
||||
if (!state._cameraChangedAttached) {
|
||||
parts.rendering.watchCamera(viewer, parts.viewport.onCameraChanged);
|
||||
state._cameraChangedAttached = true;
|
||||
// Attached only with a camera to listen to, so a later enable retries.
|
||||
state._cameraChangedAttached = state._cameraChangedOff !== null;
|
||||
}
|
||||
parts.rendering.startFrames(viewer);
|
||||
parts.viewport.runProximityCheck();
|
||||
@@ -169,10 +169,9 @@ export function createLifecycle({ state, services, parts }) {
|
||||
state._overlayHost.setVisible(TRANSIT_SELECTED_OVERLAY_SOURCE_ID, false);
|
||||
parts.selection.removeClickHandler();
|
||||
unregisterPickOwner('transit');
|
||||
if (state._cameraChangedAttached) {
|
||||
parts.rendering.unwatchCamera(viewer, parts.viewport.onCameraChanged);
|
||||
state._cameraChangedAttached = false;
|
||||
}
|
||||
// Unconditional: whatever watching started, none of it outlives this.
|
||||
parts.rendering.unwatchCamera();
|
||||
state._cameraChangedAttached = false;
|
||||
parts.rendering.stopFrames();
|
||||
parts.ingestion.abortAllInFlight();
|
||||
state._activeFeeds.clear();
|
||||
|
||||
Reference in new issue
Block a user