mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge main through #1641 into the renderer seam
Takes main's per-point mesh floor readings (#1642) onto the seam's port-based sampler: a spot refused only while the cell's DEM prior was cold is probed again, each spot is recorded once, a cell keeps at most sixteen readings, and grounded flights read the floor at the contact held inside its sticky cell.
This commit is contained in:
commit
077576ed99
79 files changed
+2721
-230
No files matched your search
@@ -433,6 +433,11 @@ export function createGroundFloor({ terrain, signal }) {
|
||||
/** @constant {number} Readings closer than this (degrees, about 5 m) are
|
||||
* one spot: the lower one is kept there. */
|
||||
const MESH_READING_SAME_SPOT_DEG = 0.00005;
|
||||
/** @constant {number} Readings kept per cell. The sampler probes a cell at
|
||||
* most eight times, but ground snaps report at each aircraft's position;
|
||||
* past this many, a reading away from the others is not kept, so a busy
|
||||
* apron cell stays a short list to scan. */
|
||||
const MESH_READINGS_PER_CELL = 16;
|
||||
/** @type {boolean} Whether mesh cells apply — true only in the google-3d
|
||||
* regime (photoreal stack). On globe stacks the rendered surface IS the
|
||||
* terrain provider (Re:Earth on keyless), so the DEM is already correct
|
||||
@@ -483,7 +488,8 @@ export function createGroundFloor({ terrain, signal }) {
|
||||
* Callers must not bypass this with raw `reportMeshFloorCell`: a coarse-LOD
|
||||
* or aircraft hit would otherwise poison every floor consumer in the cell.
|
||||
* The reading is kept at the point it was taken; a second reading at the
|
||||
* same spot (within about 5 m) keeps the lower of the two.
|
||||
* same spot (within about 5 m) keeps the lower of the two. A cell keeps at
|
||||
* most MESH_READINGS_PER_CELL readings.
|
||||
* @returns {boolean} Whether the sample passed and was reported.
|
||||
*/
|
||||
function reportValidatedMeshFloorCell(lat, lon, heightM) {
|
||||
@@ -502,11 +508,26 @@ export function createGroundFloor({ terrain, signal }) {
|
||||
Math.abs(r.lat - lat) < MESH_READING_SAME_SPOT_DEG &&
|
||||
Math.abs(r.lon - lon) < MESH_READING_SAME_SPOT_DEG,
|
||||
);
|
||||
if (!same) readings.push({ lat, lon, h: heightM });
|
||||
else if (heightM < same.h) same.h = heightM;
|
||||
if (same) {
|
||||
if (heightM < same.h) same.h = heightM;
|
||||
} else if (readings.length < MESH_READINGS_PER_CELL) {
|
||||
readings.push({ lat, lon, h: heightM });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cell holding the point has the real DEM prior that
|
||||
* `reportValidatedMeshFloorCell` judges a reading against.
|
||||
* @param {number} lat @param {number} lon
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function meshFloorPriorReady(lat, lon) {
|
||||
if (!Number.isFinite(lat) || !Number.isFinite(lon)) return false;
|
||||
const c = coarseFloorCoord(lat, lon);
|
||||
return cachedRealEllipsoidalGround(c.lat, c.lon) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronous mesh-cell read — the cell's reading nearest the point, or
|
||||
* null when the cell is unsampled OR the google-3d regime is inactive (globe
|
||||
@@ -697,6 +718,7 @@ export function createGroundFloor({ terrain, signal }) {
|
||||
reportMeshFloorCell,
|
||||
meshFloorSampleWithinPrior,
|
||||
reportValidatedMeshFloorCell,
|
||||
meshFloorPriorReady,
|
||||
cachedMeshFloor,
|
||||
_clearMeshFloorCellsForTest,
|
||||
cachedGroundFloor,
|
||||
|
||||
@@ -104,7 +104,7 @@ const HELD_SNAP_MAX_DRIFT_M = 250;
|
||||
* alone, and the asymmetry is not tidiness:
|
||||
*
|
||||
* - A cell reading LOW against a real sample is the EXPECTED error here, not a
|
||||
* contradiction. Cells are a one-shot first-write latch over ~111 m, the
|
||||
* contradiction. Cells hold a few point readings over ~111 m, the
|
||||
* borrowed-neighbour path leans to the LOWEST on purpose (`neighborFloorM`),
|
||||
* and `displayFloorHeightM` only ever RAISES — the whole floor chain is
|
||||
* built to under-read rather than to invent. Releasing on that sign would
|
||||
|
||||
@@ -12,6 +12,7 @@ export function createMeshFloorSampler({
|
||||
coarseFloorCoord,
|
||||
cachedMeshFloor,
|
||||
reportValidatedMeshFloorCell,
|
||||
meshFloorPriorReady,
|
||||
setMeshFloorPreferred,
|
||||
meshFloorPreferred,
|
||||
cachedGroundFloor,
|
||||
@@ -144,9 +145,9 @@ export function createMeshFloorSampler({
|
||||
const cell = coarseFloorCoord(p.lat, p.lon);
|
||||
const key = `${cell.lat},${cell.lon}`;
|
||||
if (attempted.has(key)) continue;
|
||||
// A latched cell is probed again only at a point well apart from the
|
||||
// ones already probed, a few times at most, so the cell's readings
|
||||
// follow where its vehicles actually are.
|
||||
// A cell with a reading is probed again only at a point well apart
|
||||
// from the ones already probed, a few times at most, so the cell's
|
||||
// readings follow where its vehicles actually are.
|
||||
const probes = _probedPoints.get(key);
|
||||
if (
|
||||
cachedMeshFloor(cell.lat, cell.lon) != null &&
|
||||
@@ -176,8 +177,6 @@ export function createMeshFloorSampler({
|
||||
// gate a probe only throws mid-teardown, when every later cell would too.
|
||||
sampled += 1;
|
||||
if (height === null) continue; // tiles not loaded yet — no negative latch
|
||||
if (probes) probes.push({ lat: p.lat, lon: p.lon });
|
||||
else _probedPoints.set(key, [{ lat: p.lat, lon: p.lon }]);
|
||||
// Round 5: a REAL Re:Earth prior is REQUIRED before any sample latches.
|
||||
// - A geoid-fallback prior (cached while the proxy was failing) is a
|
||||
// sea-level poison that rejected legitimate samples at elevated
|
||||
@@ -206,7 +205,23 @@ export function createMeshFloorSampler({
|
||||
// feasible and deliberately deferred — see the P2 in
|
||||
// the project roadmap, which bundles it with the fly_route probe so
|
||||
// one post-launch pass settles rendered-mesh sampling everywhere.
|
||||
reportValidatedMeshFloorCell(p.lat, p.lon, height);
|
||||
const accepted = reportValidatedMeshFloorCell(p.lat, p.lon, height);
|
||||
// A spot counts as probed once the gate has judged it against a real
|
||||
// prior: accepted, or refused with the cell's DEM warm. A spot refused
|
||||
// only because the DEM was still cold is tried again later. Each spot is
|
||||
// recorded once, so a cell retried while it has no reading does not fill
|
||||
// its probe allowance with the same spot.
|
||||
if (!accepted && !meshFloorPriorReady(cell.lat, cell.lon)) continue;
|
||||
if (!probes) _probedPoints.set(key, [{ lat: p.lat, lon: p.lon }]);
|
||||
else if (
|
||||
probes.length < MAX_PROBES_PER_CELL &&
|
||||
!probes.some(
|
||||
(q) =>
|
||||
Math.abs(q.lat - p.lat) < PROBE_APART_DEG &&
|
||||
Math.abs(q.lon - p.lon) < PROBE_APART_DEG,
|
||||
)
|
||||
)
|
||||
probes.push({ lat: p.lat, lon: p.lon });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user