Keep CCTV playback and calibration while replacing globe projection surfaces

This commit is contained in:
German Khokhlov committed 2026-11-03 04:25:02 +04:00
1 parent 24190a3e35
commit 133ca14119
9 files changed
+378 -135

No files matched your search

+15 -4
View File
@@ -103,7 +103,7 @@ export function createProjection({
function setPlaneVisible(runtime, visible) {
if (!runtime) return;
runtime.planeVisible = !!visible;
parts.renderer.setPlaneVisible(runtime, !!visible);
if (runtime.planeEntity) parts.renderer?.setPlaneVisible(runtime, !!visible);
if (visible && runtime.overlayEntry && runtime.cameraId) {
if (layerState._projectionOverlayOwnerId !== runtime.cameraId) {
layerState._cctvOverlayHost.setEntries(
@@ -256,7 +256,7 @@ export function createProjection({
runtime.imageLoading = false;
runtime.imageReady = false;
};
parts.renderer.setPlaneImage(runtime, runtime.canvas);
if (runtime.planeMaterial) parts.renderer?.setPlaneImage(runtime, runtime.canvas);
parts.frames.refreshProjectionImage(record, true);
parts.presentation.notifyListeners();
},
@@ -311,8 +311,19 @@ export function createProjection({
function ensureProjectionRuntime(record) {
if (!record) return null;
if (record.projection && !record.projection.disposed)
return record.projection;
if (record.projection && !record.projection.disposed) {
const runtime = record.projection;
if (runtime.needsPlane && parts.renderer?.ready) {
const geometry = record.frustumGeometry || parts.geometry.computeFrustumGeometry(record.camera, parts.ground.groundAltFor(record), record.probeClampRangeM);
const positions = record.frustumPositions || parts.geometry.frustumCartesians(geometry);
runtime.planeMaterial = parts.renderer.createPlaneMaterial(runtime.canvas);
createProjectionPlane(record, runtime, geometry, positions);
if (runtime.video?.videoWidth) parts.renderer.setPlaneImage(runtime, runtime.video);
runtime.needsPlane = false;
runtime.lastSwappedCanvasStamp = -1;
}
return runtime;
}
const runtime = createProjectionRuntime(record);
record.projection = runtime;
if (runtime) {