mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
feat(alpr): render camera markers on Navara
Separate native scene ownership from shared ALPR source and selection state, and add bounded Navara sprites with the existing direction/card overlay. Preserve marker artwork, picking, floor retries and source attribution. Fix lost post-render wakeups and redundant mobile rail mutations, and keep HUD typewriter dimensions stable so static views settle without extra frames. Add parser-fed dev/preview and legacy evidence, including retained failures. Common W2 terrain and combined performance gates remain open.
This commit is contained in:
1 parent
9d587c1d37
commit
46b3aceafc
23 files changed
+2081
-181
No files matched your search
@@ -0,0 +1,64 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { alprCreditMarkup } from '../model.js';
|
||||
import { createAlprPresentation } from './cesiumPresentation.js';
|
||||
|
||||
/** Native scene resources; shared requests and records never own the viewer. */
|
||||
export function createAlprCesiumRenderer({ state, services, source }) {
|
||||
const native = {
|
||||
viewer: null,
|
||||
dataSource: null,
|
||||
credit: null,
|
||||
creditTimer: null,
|
||||
creditPresented: false,
|
||||
clickHandler: null,
|
||||
};
|
||||
let removeMove = null;
|
||||
let removeFrame = null;
|
||||
const presentation = createAlprPresentation({
|
||||
state,
|
||||
native,
|
||||
services,
|
||||
source,
|
||||
});
|
||||
return {
|
||||
...presentation,
|
||||
get ready() {
|
||||
return Boolean(native.viewer);
|
||||
},
|
||||
count: () => native.dataSource?.entities.values.length || 0,
|
||||
following: () => Boolean(native.viewer?.trackedEntity),
|
||||
init(viewer, { onMove }) {
|
||||
native.viewer = viewer;
|
||||
native.dataSource = new Cesium.CustomDataSource('alpr-cameras');
|
||||
const markup = alprCreditMarkup(source.attribution);
|
||||
native.credit = markup ? new Cesium.Credit(markup, true) : null;
|
||||
viewer.dataSources.add(native.dataSource);
|
||||
removeMove = viewer.camera.moveEnd.addEventListener(onMove);
|
||||
removeFrame = viewer.scene.postRender?.addEventListener(
|
||||
presentation.updateSelectedAnchor,
|
||||
);
|
||||
presentation.initOverlay();
|
||||
presentation.installInteraction(viewer);
|
||||
},
|
||||
setVisible(visible) {
|
||||
if (visible) native.creditPresented = false;
|
||||
if (native.dataSource) native.dataSource.show = visible;
|
||||
},
|
||||
destroy() {
|
||||
presentation.destroyOverlay();
|
||||
removeMove?.();
|
||||
removeMove = null;
|
||||
removeFrame?.();
|
||||
removeFrame = null;
|
||||
native.clickHandler?.destroy();
|
||||
native.clickHandler = null;
|
||||
presentation.clearRendered();
|
||||
if (native.dataSource && native.viewer)
|
||||
native.viewer.dataSources.remove(native.dataSource, true);
|
||||
native.dataSource = null;
|
||||
native.credit = null;
|
||||
native.creditPresented = false;
|
||||
native.viewer = null;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user