Draw live AIS vessels from a GPU icon set

This commit is contained in:
Sameh Khamis committed 2026-11-03 21:16:19 -08:00
1 parent 816002e3b9
commit e0eb771217
20 files changed
+340 -318

No files matched your search

+9 -5
View File
@@ -114,7 +114,8 @@ export function createLifecycle({
state.feed.firstConnectDeadline = null;
state.feed.firstConnectTimer = null;
state.feed.abort = null;
state.billboardCollection = null;
state.icons = null;
state.iconPrimitive = null;
state.records.all = [];
state.records.byMmsi = new Map();
state.records.unkeyed = [];
@@ -187,8 +188,7 @@ export function createLifecycle({
/* grid failed to load — anchors stay at ellipsoid 0 */
});
}
// Pick-ownership (H2): vessel picks carry the record OBJECT as their id;
// the registry resolver reduces it to the record's mmsi (a string key).
// Pick-ownership (H2): a vessel icon's pick id is its row id, the MMSI.
registerPickOwner('ais-live-vessels', (pickedId) =>
state.records.byMmsi.has(pickedId),
);
@@ -233,9 +233,13 @@ export function createLifecycle({
unregisterPickOwner('ais-live-vessels');
components.selection.clearVesselInspection();
components.tracking.destroySelectedVesselTrail();
if (state.billboardCollection && activeViewer?.scene?.primitives) {
activeViewer.scene.primitives.remove(state.billboardCollection);
if (state.iconPrimitive && activeViewer?.scene?.primitives) {
activeViewer.scene.primitives.remove(state.iconPrimitive);
}
// Not in a scene (or no viewer to remove it from): still stop its atlas
// listener and free its GPU resources.
if (state.iconPrimitive && !state.iconPrimitive.isDestroyed())
state.iconPrimitive.destroy();
vesselState._vesselOverlayHost.clearSource(VESSEL_OVERLAY_SOURCE_ID);
vesselState._vesselOverlayHost.setVisible(
VESSEL_OVERLAY_SOURCE_ID,