mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
d81ebf1268
commit
4dfcba8989
10 files changed
+103
-14
No files matched your search
@@ -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',
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user