mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 18:52:18 +00:00
perf(globe): lazy hidden tiles by tile extent; floor resample interval
sampleHeight collects hidden tiles only after the shown ones miss, with no per-node allocation, and picks the finest by tile extent (Navara exposes no geometric error), not per-mesh radius. The ground floor resamples on a move only after 100 ms, and reports its own ground and margin (engine.groundFloor, Navara-only diagnostics).
This commit is contained in:
1 parent
6dad3894bd
commit
da6141be4b
6 files changed
+152
-49
No files matched your search
@@ -37,6 +37,11 @@ export const GROUND_FLOOR = Object.freeze({
|
||||
RESAMPLE_METRES: 20,
|
||||
/** Age (ms) after which the ground is sampled again. */
|
||||
RESAMPLE_MS: 250,
|
||||
/**
|
||||
* Age (ms) before a move resamples: a sample of the ground outside the
|
||||
* view costs about 1.6 ms (surface.js), too much for every frame.
|
||||
*/
|
||||
MIN_RESAMPLE_MS: 100,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -81,12 +86,19 @@ export function createGroundFloor({
|
||||
0,
|
||||
WGS84,
|
||||
);
|
||||
if (
|
||||
sample &&
|
||||
at - sample.at < GROUND_FLOOR.RESAMPLE_MS &&
|
||||
cartesian3.distance(point, sample.point) < GROUND_FLOOR.RESAMPLE_METRES
|
||||
)
|
||||
return sample.height;
|
||||
// Again after RESAMPLE_MS, or after a RESAMPLE_METRES move once
|
||||
// MIN_RESAMPLE_MS has passed (a pan does not sample every frame).
|
||||
if (sample) {
|
||||
const age = at - sample.at;
|
||||
const moved =
|
||||
cartesian3.distance(point, sample.point) >=
|
||||
GROUND_FLOOR.RESAMPLE_METRES;
|
||||
if (
|
||||
age < GROUND_FLOOR.RESAMPLE_MS &&
|
||||
!(moved && age >= GROUND_FLOOR.MIN_RESAMPLE_MS)
|
||||
)
|
||||
return sample.height;
|
||||
}
|
||||
const height =
|
||||
surface.sampleHeight(place) ?? surface.terrainHeight?.(place) ?? 0;
|
||||
sample = { point, at, height };
|
||||
|
||||
Reference in new issue
Block a user