mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Take the camera layer's policy, state, model and ground off Cesium
The layer's colours are renderer colours; the parts that still draw with Cesium (icons, coverage lines, the monitor plane) turn them into Cesium colours with the adapter's own conversion. The screen and matrix scratches are plain objects, which is all the projections that fill them write. The model part converts angles with geo/vector, reads where the eye is from the camera port's pose, and builds the monitor plane's orientation with geo/quaternion from the same axes; the projection part hands the entity a Cesium quaternion of it. The photoreal tileset readiness check, which looks through the scene's primitives, moves to the geometry part. The ground pass moves a camera icon by writing geo/ellipsoid's position into the record's own position object. The test plane's plain material comes from the projection part, and the selection part only lost an unused import. All give the same numbers as the Cesium calls they replace. Policy, state, selection, testing, model and ground leave the allow-list.
This commit is contained in:
1 parent
2592289612
commit
7d760d32fc
13 files changed
+147
-127
No files matched your search
@@ -7,7 +7,7 @@ import {
|
||||
PROBE_CLEARANCE_M,
|
||||
COVERAGE_NEIGHBOR_RADIUS_KM,
|
||||
COVERAGE_NEIGHBOR_LIMIT,
|
||||
IDLE_COVERAGE_COLOR,
|
||||
IDLE_COVERAGE_COLOR as IDLE_COVERAGE_RGBA,
|
||||
PLANE_FOOTPRINT_LIFT_CAP_M,
|
||||
} from './policy.js';
|
||||
|
||||
@@ -17,6 +17,9 @@ import {
|
||||
requiredPlaneLift,
|
||||
} from '../../data/cctvFootprint.js';
|
||||
import { cctvPicks } from './pickState.js';
|
||||
import { toColor } from '../../render/cesium/draw.js';
|
||||
|
||||
const IDLE_COVERAGE_COLOR = toColor(IDLE_COVERAGE_RGBA);
|
||||
|
||||
export function createGeometry({ state: layerState, services, parts, source }) {
|
||||
const { warmGroundFloor, cachedGroundFloor } = services.ground;
|
||||
@@ -262,6 +265,46 @@ export function createGeometry({ state: layerState, services, parts, source }) {
|
||||
return Math.max(PROBE_MIN_RANGE_M, hitDistance - PROBE_CLEARANCE_M);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports whether the active Google Photorealistic 3D Tileset (if any) has
|
||||
* finished loading the tiles in view. Shared mesh-floor sampling is gated on
|
||||
* this so a one-shot cell never bakes in a miss from still-streaming tiles.
|
||||
* Discovers + caches the tileset lazily from scene
|
||||
* primitives (the CCTV module holds only a `_viewer` reference). When no
|
||||
* tileset is present (OSM fallback) this returns true so ground sampling is
|
||||
* not permanently blocked.
|
||||
*
|
||||
* Task 5 (review correction, spec §2): a HIDDEN tileset (`show === false`,
|
||||
* i.e. a globe stack is active) must NOT report ready — Cesium 1.138's
|
||||
* the shared sampler can only inspect *visible* 3D tilesets, so a sample taken
|
||||
* against the hidden Google tileset would silently miss.
|
||||
*
|
||||
* @returns {boolean} True when tiles are loaded AND visible (or no tileset
|
||||
* exists to wait on).
|
||||
*/
|
||||
|
||||
function projectionTilesReady() {
|
||||
if (
|
||||
!layerState._activeTileset ||
|
||||
layerState._activeTileset.isDestroyed?.()
|
||||
) {
|
||||
layerState._activeTileset = null;
|
||||
const primitives = layerState._viewer?.scene?.primitives;
|
||||
if (primitives && typeof primitives.get === 'function') {
|
||||
for (let i = 0; i < primitives.length; i++) {
|
||||
const p = primitives.get(i);
|
||||
if (p instanceof Cesium.Cesium3DTileset && !p.isDestroyed?.()) {
|
||||
layerState._activeTileset = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!layerState._activeTileset) return true;
|
||||
if (layerState._activeTileset.show === false) return false;
|
||||
return layerState._activeTileset.tilesLoaded === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a computeFrustumGeometry result into the Cartesian3 positions the
|
||||
* entities consume. Fresh objects per call (geometry updates are rare —
|
||||
@@ -836,6 +879,7 @@ export function createGeometry({ state: layerState, services, parts, source }) {
|
||||
activationProbeClampRange,
|
||||
frustumCartesians,
|
||||
frustumFrameEcef,
|
||||
projectionTilesReady,
|
||||
applyFrustumGeometry,
|
||||
updateRecordGeometry,
|
||||
buildCoverageVisibleSet,
|
||||
|
||||
Reference in new issue
Block a user