mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(vessels, transit, rail): draw fleet models under the 3D toggle
Vessels, Transit and Rail turn nearby icons into fleet models at the aircraft layers' distances. A vessel is drawn at its AIS length and beam (static dimensions now reach vessel rows), standing at the sea surface; a transit vehicle or train stands on its road or rail, raised by its type's elevation, and is painted in its mode or category colour where the model marks it.
This commit is contained in:
1 parent
fcc44d0eaf
commit
7b93045895
18 files changed
+984
-15
No files matched your search
@@ -109,6 +109,8 @@ export function createApplicationCatalog({
|
||||
const vessels = createApplicationVessels({
|
||||
source: sources.vessels,
|
||||
options: vesselOptions,
|
||||
displayParams: () => flights.getParams(),
|
||||
...(resolveAsset ? { resolveAsset } : {}),
|
||||
});
|
||||
const installations = createApplicationInstallations({
|
||||
surface,
|
||||
@@ -167,7 +169,12 @@ export function createApplicationCatalog({
|
||||
createApplicationTraffic({ source: sources.traffic, surface }),
|
||||
createApplicationCctv({ surface, source: sources.cctv }),
|
||||
createApplicationRadio({ surface, source: sources.radio }),
|
||||
createApplicationTransit({ surface, source: sources.transit }),
|
||||
createApplicationTransit({
|
||||
surface,
|
||||
source: sources.transit,
|
||||
displayParams: () => flights.getParams(),
|
||||
...(resolveAsset ? { resolveAsset } : {}),
|
||||
}),
|
||||
createApplicationBikeshare({ source: sources.bikeshare }),
|
||||
createApplicationDirections({ source: sources.directions }),
|
||||
createApplicationRecentImagery({ source: sources['recent-imagery'] }),
|
||||
@@ -200,7 +207,12 @@ export function createApplicationCatalog({
|
||||
...createOsmOverlayLayers(),
|
||||
...createInfrastructureLayers(localGeoJsonServices),
|
||||
createApplicationCables({ source: sources.cables }),
|
||||
createApplicationRail({ surface, source: sources.rail }),
|
||||
createApplicationRail({
|
||||
surface,
|
||||
source: sources.rail,
|
||||
displayParams: () => flights.getParams(),
|
||||
...(resolveAsset ? { resolveAsset } : {}),
|
||||
}),
|
||||
createApplicationFirms({
|
||||
surface,
|
||||
id: 'local-firms',
|
||||
|
||||
@@ -10,9 +10,19 @@ import * as focus from '../../data/focusDeemphasis.js';
|
||||
import * as worldFocus from '../../worldFocus.js';
|
||||
import * as render from '../../renderGovernor.js';
|
||||
import * as readouts from '../../hudReadouts.js';
|
||||
import { fleetModelServices } from './fleetModels.js';
|
||||
|
||||
/** Construct one layer using the application scene owners and a supplied source. */
|
||||
export function createApplicationVessels({ source, options = {} }) {
|
||||
/**
|
||||
* Construct one layer using the application scene owners and a supplied
|
||||
* source. `displayParams` reads the Flights layer's DISPLAY-rail 3D
|
||||
* preference, under which nearby vessels are drawn as fleet models.
|
||||
*/
|
||||
export function createApplicationVessels({
|
||||
source,
|
||||
options = {},
|
||||
displayParams = null,
|
||||
resolveAsset,
|
||||
}) {
|
||||
return createVesselLayer({
|
||||
source,
|
||||
options,
|
||||
@@ -28,6 +38,10 @@ export function createApplicationVessels({ source, options = {} }) {
|
||||
worldFocus,
|
||||
render,
|
||||
readouts,
|
||||
fleet: fleetModelServices({
|
||||
display: displayParams,
|
||||
...(resolveAsset ? { resolveAsset } : {}),
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { FLEET_MODEL_POLICY } from '../../layers/flights/policy.js';
|
||||
|
||||
/**
|
||||
* The fleet-model service the Vessels, Transit and Rail layers draw their 3D
|
||||
* models with: the Flights layer's DISPLAY-rail 3D preference
|
||||
* (`{ models3d, models3dMode }`), the aircraft layers' icon-to-model rules,
|
||||
* and the resolver the fleet set's files are fetched through.
|
||||
* @param {{display?: (() => object|null)|null,
|
||||
* resolveAsset?: (url: string) => string}} [options]
|
||||
* @returns {object|null} Null without a display preference (no models).
|
||||
*/
|
||||
export function fleetModelServices({
|
||||
display = null,
|
||||
resolveAsset = (url) =>
|
||||
`${import.meta.env?.BASE_URL || '/'}${url.replace(/^\//, '')}`,
|
||||
} = {}) {
|
||||
if (!display) return null;
|
||||
return Object.freeze({ display, policy: FLEET_MODEL_POLICY, resolveAsset });
|
||||
}
|
||||
+15
-2
@@ -1,5 +1,6 @@
|
||||
import { createRailLayer } from '../../layers/rail/index.js';
|
||||
import * as render from '../../renderGovernor.js';
|
||||
import { fleetModelServices } from './fleetModels.js';
|
||||
import * as sprites from '../../data/spriteOrder.js';
|
||||
import * as picking from '../../data/pickRegistry.js';
|
||||
import * as overlays from '../../overlays/worldOverlay.js';
|
||||
@@ -13,10 +14,18 @@ import {
|
||||
/**
|
||||
* Construct the Rail layer on the application's scene owners and its shared
|
||||
* ground floor, the same floor Transit and the aircraft stand on.
|
||||
* @param {{surface: object, source?: object}} options
|
||||
* `displayParams` reads the Flights layer's DISPLAY-rail 3D preference, under
|
||||
* which nearby trains are drawn as fleet models.
|
||||
* @param {{surface: object, source?: object,
|
||||
* displayParams?: () => object|null, resolveAsset?: (url: string) => string}} options
|
||||
* @returns {object}
|
||||
*/
|
||||
export function createApplicationRail({ surface, source }) {
|
||||
export function createApplicationRail({
|
||||
surface,
|
||||
source,
|
||||
displayParams = null,
|
||||
resolveAsset,
|
||||
}) {
|
||||
if (!surface?.groundFloor)
|
||||
throw new TypeError('Rail needs the application surface services');
|
||||
const { groundFloor } = surface;
|
||||
@@ -45,6 +54,10 @@ export function createApplicationRail({ surface, source }) {
|
||||
globalThis.document?.body?.classList?.contains('cockpit-mode') ===
|
||||
true,
|
||||
},
|
||||
fleet: fleetModelServices({
|
||||
display: displayParams,
|
||||
...(resolveAsset ? { resolveAsset } : {}),
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createTransitLayer } from '../../layers/transit/index.js';
|
||||
import * as render from '../../renderGovernor.js';
|
||||
import { fleetModelServices } from './fleetModels.js';
|
||||
import * as sprites from '../../data/spriteOrder.js';
|
||||
import * as picking from '../../data/pickRegistry.js';
|
||||
import * as overlays from '../../overlays/worldOverlay.js';
|
||||
@@ -19,10 +20,19 @@ import {
|
||||
* own mesh floors. An earlier cut imported the legacy module-level singleton
|
||||
* instead and could not see either.
|
||||
*
|
||||
* @param {{surface: object}} options
|
||||
* `displayParams` reads the Flights layer's DISPLAY-rail 3D preference, under
|
||||
* which nearby vehicles are drawn as fleet models.
|
||||
*
|
||||
* @param {{surface: object, source?: object,
|
||||
* displayParams?: () => object|null, resolveAsset?: (url: string) => string}} options
|
||||
* @returns {object}
|
||||
*/
|
||||
export function createApplicationTransit({ surface, source }) {
|
||||
export function createApplicationTransit({
|
||||
surface,
|
||||
source,
|
||||
displayParams = null,
|
||||
resolveAsset,
|
||||
}) {
|
||||
if (!surface?.groundFloor || !surface?.meshFloor)
|
||||
throw new TypeError('Transit needs the application surface services');
|
||||
const { groundFloor, meshFloor } = surface;
|
||||
@@ -44,6 +54,10 @@ export function createApplicationTransit({ surface, source }) {
|
||||
allocateCorridorCells: groundFloor.allocateCorridorCells,
|
||||
},
|
||||
mesh: { sampleMeshFloorCells: meshFloor.sampleMeshFloorCells },
|
||||
fleet: fleetModelServices({
|
||||
display: displayParams,
|
||||
...(resolveAsset ? { resolveAsset } : {}),
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user