mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Keep the draw port's version when icons only change in place
The Cesium draw port's version tells height queries when the pick ids they see through may have changed. Icons changed in place keep their billboards and pick id objects (meta and LOD group are written into them), so only icons added or removed change what queries see through. An in-place icon update, such as the tracked aircraft's icon every frame, no longer bumps the version, so the see-through cache is no longer rebuilt each frame. Re-registering an atlas whose images change in place keeps it too, and still rebuilds a set it cannot patch.
This commit is contained in:
1 parent
6861632b96
commit
333c9b39fe
2 files changed
+52
-18
No files matched your search
@@ -1970,7 +1970,11 @@ test('icon sets change their billboards in place: restyled, moved, re-imaged, ad
|
||||
assert.deepEqual(a.id.meta, { n: 1 }, 'picks read the new meta');
|
||||
const moved = Cesium.Cartographic.fromCartesian(a.position);
|
||||
assert.ok(Math.abs(Cesium.Math.toDegrees(moved.longitude) - 2) < 1e-9);
|
||||
assert.ok(part.version() > version, 'height queries see the change');
|
||||
assert.equal(
|
||||
part.version(),
|
||||
version,
|
||||
'changed in place, the pick ids height queries see through are the same',
|
||||
);
|
||||
|
||||
// Back to the defaults it dropped.
|
||||
set.upsert([icon('a', 2)]);
|
||||
@@ -1980,9 +1984,12 @@ test('icon sets change their billboards in place: restyled, moved, re-imaged, ad
|
||||
set.upsert([icon('c', 3)]);
|
||||
assert.equal(scene.added[0], host, 'a new icon is added to it');
|
||||
assert.equal(host.length, 3);
|
||||
const added = part.version();
|
||||
assert.ok(added > version, 'a new pick id for height queries to see');
|
||||
set.remove(['b']);
|
||||
assert.equal(scene.added[0], host, 'and one removed from it');
|
||||
assert.equal(host.length, 2);
|
||||
assert.ok(part.version() > added, 'and one gone');
|
||||
assert.deepEqual(
|
||||
record.pickIds.map((id) => id.id).sort(),
|
||||
['a', 'c'],
|
||||
@@ -2035,8 +2042,15 @@ test('an icon drawn from an atlas slot takes a re-registered slot in place', ()
|
||||
assert.equal(host.get(0), one, 'the same billboard');
|
||||
assert.equal(one.image, 'next.png');
|
||||
assert.equal(host.get(1).image, 'ring.png', 'the slot that came draws');
|
||||
const version = part.version();
|
||||
part.port.atlas('marks', { dot: 'again.png', ring: 'ring.png' });
|
||||
assert.equal(scene.added[0], host, 'new images only: not rebuilt');
|
||||
assert.equal(host.get(0), one, 'the same billboard');
|
||||
assert.equal(one.image, 'again.png');
|
||||
assert.equal(part.version(), version, 'the same pick ids');
|
||||
part.port.atlas('marks', { ring: 'ring.png' });
|
||||
assert.equal(host.length, 1, 'a slot gone takes its icon down');
|
||||
assert.ok(part.version() > version, 'one pick id fewer');
|
||||
assert.equal(host.get(0).id.id, 'two');
|
||||
// A slot that comes for an icon ahead of one drawn rebuilds, in order.
|
||||
part.port.atlas('marks', { dot: 'dot.png', ring: 'ring.png' });
|
||||
|
||||
Reference in new issue
Block a user