Read the cockpit clouds' camera point from the camera port's pose

The cloud layer takes latitude, longitude and height from pose() and its
angle conversion from geo/vector, so it no longer reaches Cesium and
leaves the Cesium allow-list.
This commit is contained in:
Sameh Khamis committed 2026-11-08 14:49:24 -08:00
1 parent f9749ac83c
commit 75ad7baf13
2 files changed
+7 -8

No files matched your search

+7 -7
View File
@@ -1,5 +1,6 @@
import { applicationServices } from './services/application.js'; import { applicationServices } from './services/application.js';
import * as Cesium from 'cesium'; import { toRadians } from './geo/vector.js';
import { findCamera } from './render/rendererOf.js';
import { greatCircleMeters } from './geoDistance.js'; import { greatCircleMeters } from './geoDistance.js';
import { import {
deriveWeatherEffectProfile, deriveWeatherEffectProfile,
@@ -327,15 +328,14 @@ class CockpitCloudEffectsController {
} }
cameraPoint() { cameraPoint() {
const cartographic = this.viewer?.camera?.positionCartographic; const pose = this.viewer ? findCamera(this.viewer)?.pose() : null;
if (!cartographic) return null; if (!pose) return null;
const latitude = Cesium.Math.toDegrees(cartographic.latitude); const { lat: latitude, lon: longitude } = pose;
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
if (![latitude, longitude].every(Number.isFinite)) return null; if (![latitude, longitude].every(Number.isFinite)) return null;
return { return {
latitude, latitude,
longitude, longitude,
altitudeM: Math.max(0, Number(cartographic.height) || 0), altitudeM: Math.max(0, Number(pose.height) || 0),
}; };
} }
@@ -528,7 +528,7 @@ class CockpitCloudEffectsController {
render(timeSec) { render(timeSec) {
const gl = this.gl; const gl = this.gl;
if (!gl || !this.program || !this.locations) return; if (!gl || !this.program || !this.locations) return;
const windRadians = Cesium.Math.toRadians(this.windDirectionDeg); const windRadians = toRadians(this.windDirectionDeg);
const windScale = 0.008 + this.windStrength * 0.022; const windScale = 0.008 + this.windStrength * 0.022;
gl.useProgram(this.program); gl.useProgram(this.program);
gl.uniform2f( gl.uniform2f(
-1
View File
@@ -4,7 +4,6 @@
"src/app/embed.js", "src/app/embed.js",
"src/app/scene.js", "src/app/scene.js",
"src/app/viewer.js", "src/app/viewer.js",
"src/cockpitCloudEffects.js",
"src/cyberSonarGpu.js", "src/cyberSonarGpu.js",
"src/cyberSonarScene.js", "src/cyberSonarScene.js",
"src/data/geoImportPins.js", "src/data/geoImportPins.js",