mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Report model load failures to model sets, and bound the tracked model's retries again
The renderer contract gains an optional event on model draw sets,
`on('loadFailed', (id, message) => ...)`, beside `ready`: a model's url
failed to load, once per failed load. The item stays in the set drawing
what it drew before; removing it and adding it again tries at once. A
renderer that cannot tell a failure may never fire it.
The Cesium draw port fires it once Cesium is done with the frame it
raised the error in, and not for a load that was superseded or whose item
went. The stub fails urls under `stub-fail:`, telling each load once. A
conformance check (`draw.models.loadFailed`) runs on both, with a model
url the dev server does not serve for Cesium.
The flights and military layers use it in place of rewriting every
unloaded model every 5 s. A fleet model whose load failed is removed and
added again 5 s later. The tracked model gets back its per-selection
budget: a failed load is let go and tried again 1.5 s later, and after
three failures the contact stays 2D until another is selected, as
before the models moved onto the draw port. A good load retires the
budget, and a model that loads after all is kept.
This commit is contained in:
1 parent
396e7f0deb
commit
5370feb825
23 files changed
+536
-58
No files matched your search
@@ -74,3 +74,26 @@ test('a throwing listener with no error listener is reported and the frame goes
|
||||
globalThis.reportError = saved;
|
||||
}
|
||||
});
|
||||
|
||||
test('a model load is told once, even when a listener loads it again', () => {
|
||||
const r = createStubRenderer({ capabilities: ['models'] });
|
||||
const set = r.draw.models({ id: 'm' });
|
||||
const told = [];
|
||||
const model = (id, url) => ({
|
||||
id,
|
||||
pos: { lon: 0, lat: 0 },
|
||||
url,
|
||||
orientation: { heading: 0, pitch: 0, roll: 0 },
|
||||
});
|
||||
set.on('ready', (id) => told.push(`ready ${id}`));
|
||||
set.on('loadFailed', (id) => {
|
||||
told.push(`failed ${id}`);
|
||||
// Pointing b at another failing url is a new load, told by its upsert.
|
||||
if (id === 'a') set.upsert([model('b', 'stub-fail:other.glb')]);
|
||||
});
|
||||
set.set([model('a', 'stub-fail:a.glb'), model('b', 'stub-fail:b.glb')]);
|
||||
assert.deepEqual(told, ['failed a', 'failed b']);
|
||||
set.remove(['a']);
|
||||
set.upsert([model('a', 'good.glb')]);
|
||||
assert.deepEqual(told.slice(2), ['ready a']);
|
||||
});
|
||||
Reference in new issue
Block a user