feat(globe): mover sets report ready(); Navara scales by distance as Cesium

Task 10b foundation.
- MoverSet.ready(): whether what the set draws has loaded (Navara: the
  model set's glTF, a URL atlas; Cesium: every instance's Model, the cropped
  atlas; parts without it draw at once). The aircraft renderer keeps the 2D
  glyph until a model set is ready, as the Cesium path waits on Model.ready.
  Contract suite: a drawn model set is ready() (both engines); unit test of
  the neutral store.
- Navara sprites and points interpolate scaleByDistance as Cesium's
  NearFarScalar (over the squared camera distance, eased by ^0.2) instead
  of linearly in distance, so aircraft glyphs have Cesium's size at every
  range; the CPU pick radius follows (distanceScale, tested equal to
  focusDeemphasis' port of czm_nearFarScalar). The contract text says so.
This commit is contained in:
German Khokhlov committed 2026-10-17 01:16:59 +04:00
1 parent d81ebf1268
commit 4dfcba8989
10 files changed
+103 -14

No files matched your search

+29
View File
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
import test from 'node:test';
import {
MOVER_KINDS,
createMoverRegistry,
createMoverSet,
createMoverStore,
normalizeMoverSetOptions,
@@ -207,3 +208,31 @@ test('a destroyed set releases its instance arrays', () => {
assert.equal(set.positionsView().length, 0);
assert.equal(store.dirty(), null);
});
test('a set is ready() once what it draws has loaded, never once destroyed', () => {
let loaded = false;
const registry = createMoverRegistry(() => ({
commit() {},
destroy() {},
ready: () => loaded,
}));
const set = registry.movers.createSet({
id: 'r',
kind: 'point',
capacity: 1,
point: { sizePx: 4 },
});
assert.equal(set.ready(), false);
loaded = true;
assert.equal(set.ready(), true);
set.destroy();
assert.equal(set.ready(), false);
const plain = createMoverRegistry(() => ({ commit() {}, destroy() {} }));
assert.equal(
plain.movers
.createSet({ id: 'p', kind: 'point', capacity: 1, point: { sizePx: 4 } })
.ready(),
true,
'an engine part without ready() draws at once',
);
});