mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Keep the camera layer's Cesium picks, entities and projection in its rendering part
The camera layer's lifecycle, cards, geometry, hover and selection parts had left the Cesium allow-list but still drove the scene: Cesium camera move events, scene picks and pick objects, entity removal, the activation ray probe and the cards' canvas projection. The move events now come from the camera port and card render requests go through the frame port; the rest moves into the rendering part, which stays listed. The move listeners are attached and released in one place, with a test.
This commit is contained in:
1 parent
f6c5e6ba10
commit
a8f41d30fc
9 files changed
+348
-161
No files matched your search
@@ -540,8 +540,7 @@ export function createGeometry({ state: layerState, services, parts, source }) {
|
||||
|
||||
function runActivationObstructionProbe(record) {
|
||||
record.probeClampRangeM = null;
|
||||
const scene = layerState._viewer?.scene;
|
||||
if (!scene || typeof scene.pickFromRay !== 'function') return;
|
||||
if (!parts.rendering.canPickFromRay()) return;
|
||||
const camera = record.camera;
|
||||
const rangeScale = parts.calibration.normalizeCalibration(
|
||||
camera.calibration,
|
||||
@@ -551,14 +550,8 @@ export function createGeometry({ state: layerState, services, parts, source }) {
|
||||
const mountAlt = parts.ground.groundAltFor(record) + camera.mountHeightM;
|
||||
const mountPos = fromDegrees(camera.lon, camera.lat, mountAlt);
|
||||
const { dir } = frustumFrameEcef(camera, mountPos);
|
||||
// Exclude everything the layer itself draws so the probe can only hit the
|
||||
// world (3D tiles), not our own polylines/planes. Icons never draw into
|
||||
// ray picks.
|
||||
const exclude = [...layerState._coverageEntities];
|
||||
for (const runtime of layerState._projectionEntities) {
|
||||
if (runtime?.planeEntity) exclude.push(runtime.planeEntity);
|
||||
}
|
||||
const hit = parts.rendering.pickFromRay(mountPos, dir, exclude);
|
||||
// The rendering part sees through everything the layer draws.
|
||||
const hit = parts.rendering.obstructionHit(mountPos, dir);
|
||||
if (!hit?.position) return;
|
||||
const dist = distance(mountPos, hit.position);
|
||||
record.probeClampRangeM = activationProbeClampRange(camera.rangeM, dist);
|
||||
@@ -666,9 +659,7 @@ export function createGeometry({ state: layerState, services, parts, source }) {
|
||||
|
||||
function destroyCoverageEntities() {
|
||||
if (!layerState._viewer) return;
|
||||
for (const entity of layerState._coverageEntities) {
|
||||
layerState._viewer.entities.remove(entity);
|
||||
}
|
||||
parts.rendering.removeCoverageEntities();
|
||||
layerState._coverageEntities = [];
|
||||
|
||||
for (const record of layerState._records) {
|
||||
|
||||
Reference in new issue
Block a user