Keep points and icons past the horizon hidden when they move in place

An in-place update now applies the horizon cull at once, so a set moved
by a frame listener that runs after the draw port's own cull no longer
shows items through the globe until the next frame.
This commit is contained in:
Sameh Khamis committed 2026-11-07 06:04:12 -08:00
1 parent 9de93b8d31
commit 84e6f13725
2 files changed
+60 -18

No files matched your search

+28
View File
@@ -926,14 +926,42 @@ test('a point moved in place is horizon culled where it now is', () => {
assert.equal(point.show, true, 'under the eye');
set.upsert([dot(180)]);
assert.equal(scene.added[0].get(0), point, 'the same point');
assert.equal(
point.show,
false,
'hidden at once, as a frame listener moving it after the cull needs',
);
frame();
assert.equal(point.show, false, 'past the horizon');
set.upsert([dot(1)]);
assert.equal(point.show, true, 'shown at once');
frame();
assert.equal(point.show, true, 'back in view');
set.dispose();
});
test('an icon moved in place past the horizon is hidden at once', () => {
const { scene, draw, frame } = drawOver();
const set = draw.icons({ id: 'culled-icons', horizonCull: true });
const icon = (lon) => ({
id: 'a',
pos: { lon, lat: 0, height: 10 },
image: { svg: '<svg xmlns="http://www.w3.org/2000/svg"/>' },
size: [8, 8],
});
// The eye is over lon 0.
set.set([icon(0)]);
frame();
const billboard = scene.added[0].get(0);
assert.equal(billboard.show, true, 'under the eye');
set.upsert([icon(180)]);
assert.equal(scene.added[0].get(0), billboard, 'the same billboard');
assert.equal(billboard.show, false, 'past the horizon, before a frame');
set.upsert([icon(1)]);
assert.equal(billboard.show, true);
set.dispose();
});
test('points show only within their display range', () => {
const { scene, draw } = drawOver();
const set = draw.points({ id: 'ranged' });