mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Stack sprite layers by draw order, flights on top
Each sprite layer's icon or dot set is now made at a draw order taken from SPRITE_LAYER_ORDER through the renderer's per-set drawOrder: flights over military, vessels, directions, transit, bikeshare, FIRMS and CCTV, whichever layer was turned on first. Picks name the topmost first. The orders are negative, so selection highlights, route endpoints, the tracked plane and every other set at the default order still draw over all sprite layers, as they did before. The raise-to-top restorer, the sprite registry and the primitive-name lookups are gone, which takes spriteOrder.js off the viewer-access list. Before, the restorer raised the layers to the bottom of the scene in the order they were enabled, so flights usually ended up under the others.
This commit is contained in:
1 parent
657ef94f77
commit
c073064507
40 files changed
+271
-562
No files matched your search
@@ -4,7 +4,7 @@ import { createHorizonCull } from './view.js';
|
||||
import { fromDegrees } from '../../geo/ellipsoid.js';
|
||||
import { drawOf } from '../../render/rendererOf.js';
|
||||
|
||||
const SPRITE_ID = 'street-level:marker';
|
||||
const SET_ID = 'street-level:marker';
|
||||
|
||||
/** Draw-set ids of the markers made so far, so every layer instance has its own. */
|
||||
let markerSets = 0;
|
||||
@@ -45,7 +45,7 @@ function markerIcon(position, bearing, look) {
|
||||
|
||||
/** On-globe marker for the open image, clamped to the ground. */
|
||||
export function createMarker({ state }) {
|
||||
const { render, sprites } = state.services;
|
||||
const { render } = state.services;
|
||||
|
||||
function requestRender() {
|
||||
render?.governorRequestRender?.('street-level-marker');
|
||||
@@ -69,13 +69,11 @@ export function createMarker({ state }) {
|
||||
function ensure(viewer) {
|
||||
if (state.marker.set) return;
|
||||
state.marker.set = drawOf(viewer).icons({
|
||||
id: `${SPRITE_ID}:${++markerSets}`,
|
||||
id: `${SET_ID}:${++markerSets}`,
|
||||
});
|
||||
// Drawn from now, empty: the marker keeps its place under the cones
|
||||
// (made after it), whichever is first given something to draw.
|
||||
// Drawn from now, empty: the marker keeps its place by when it was made
|
||||
// (before the cones), whichever is first given something to draw.
|
||||
state.marker.set.set([]);
|
||||
state.marker.sprite =
|
||||
sprites?.registerSpriteSet?.(SPRITE_ID, state.marker.set.id) ?? null;
|
||||
}
|
||||
|
||||
/** Move (or create) the marker; null removes it. `style`: the provider's `marker`. */
|
||||
@@ -112,10 +110,8 @@ export function createMarker({ state }) {
|
||||
horizon.stop();
|
||||
const markers = state.marker.set;
|
||||
if (!markers) return;
|
||||
sprites?.unregisterSpriteCollection?.(SPRITE_ID, state.marker.sprite);
|
||||
markers.dispose();
|
||||
state.marker.set = null;
|
||||
state.marker.sprite = null;
|
||||
state.marker.placed = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user