mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Sprites for helicopters, ground vehicles, stations and vessel types; history to live without an empty map; model parts in Cesium
Aircraft icons are one size; helicopters turn a three-frame rotor while airborne or moving; ADS-B ground vehicles share one amber sprite and stations/obstacles one mast; vessels get hull sprites by type and one buoy. Going live keeps contacts until the first live answer and replaces them by id; fast playback holds before the loaded positions end and prefetches ahead. Cesium models move their parts from the optional model part state.
This commit is contained in:
1 parent
624c229bc2
commit
7186f720df
97 files changed
+6586
-343
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { selectModelEligible } from './modelEligibility.js';
|
||||
import { AIRCRAFT_ENVIRONMENT_MAP_OPTIONS } from './aircraftModelLighting.js';
|
||||
import { fleetModelSet } from './fleetModels.js';
|
||||
import { fleetModelSet, fleetPartTable } from './fleetModels.js';
|
||||
import { findCamera, findDraw } from '../render/rendererOf.js';
|
||||
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
|
||||
import { horizonFrom } from '../geo/horizon.js';
|
||||
@@ -115,6 +115,10 @@ let instances = 0;
|
||||
* cap, capAll, addM, addAllM, keepM, keepAllM, intervalMs}`.
|
||||
* @param {(url: string) => string} [options.resolveAsset]
|
||||
* @param {boolean} [options.waterline] Clip each model at its waterline.
|
||||
* @param {(item: object, table: object) => object|undefined} [options.partState]
|
||||
* The moving parts a vehicle's model is posed with (`ModelItem.parts`),
|
||||
* from its item and its model's part table (`modelPartDrivers.js`); asked
|
||||
* only for a model that has a part table.
|
||||
* @param {object} [options.draw] Stands in for the viewer's draw port (tests).
|
||||
* @returns {object}
|
||||
*/
|
||||
@@ -124,6 +128,7 @@ export function createFleetModelLayer({
|
||||
policy,
|
||||
waterline = false,
|
||||
resolveAsset = (url) => url,
|
||||
partState = null,
|
||||
draw,
|
||||
}) {
|
||||
const port = draw ?? findDraw(viewer);
|
||||
@@ -230,8 +235,15 @@ export function createFleetModelLayer({
|
||||
return fromDegrees(at.lon, at.lat, at.height + lift);
|
||||
}
|
||||
|
||||
/** The part state an item's model is posed with, or undefined. */
|
||||
function partsOf(item) {
|
||||
if (!partState) return undefined;
|
||||
const table = fleetPartTable(fleetModelSet(), item.spec?.model);
|
||||
return table ? partState(item, table) : undefined;
|
||||
}
|
||||
|
||||
/** The draw item for an admitted model, as the set draws it, at `at`. */
|
||||
function itemOf(id, record, item, show, boost, at = placement(item)) {
|
||||
function itemOf(id, record, item, show, boost, at, parts) {
|
||||
const mask = item.spec.tinted && !boost ? fleetColor(item.tint) : null;
|
||||
return {
|
||||
id,
|
||||
@@ -260,6 +272,7 @@ export function createFleetModelLayer({
|
||||
: { shading: 'pbr' }),
|
||||
...(mask ? { maskColor: mask } : {}),
|
||||
...(waterline ? { clip: 'belowOrigin' } : {}),
|
||||
...(parts ? { parts } : {}),
|
||||
meta: item.pickId ?? id,
|
||||
show,
|
||||
};
|
||||
@@ -276,6 +289,8 @@ export function createFleetModelLayer({
|
||||
const heading = item.headingDeg || 0;
|
||||
const mask = item.spec.tinted && !boost ? fleetColor(item.tint) : null;
|
||||
const meta = item.pickId ?? id;
|
||||
const parts = partsOf(item);
|
||||
const partsKey = parts ? JSON.stringify(parts) : '';
|
||||
const sent = record.sent;
|
||||
if (
|
||||
sent !== null &&
|
||||
@@ -287,7 +302,8 @@ export function createFleetModelLayer({
|
||||
sameColor(sent.mask, mask) &&
|
||||
sent.boost === boost &&
|
||||
sent.show === show &&
|
||||
sent.meta === meta
|
||||
sent.meta === meta &&
|
||||
sent.partsKey === partsKey
|
||||
)
|
||||
return null;
|
||||
const next = (record.sent ??= {});
|
||||
@@ -301,7 +317,8 @@ export function createFleetModelLayer({
|
||||
next.boost = boost;
|
||||
next.show = show;
|
||||
next.meta = meta;
|
||||
return itemOf(id, record, item, show, boost, at);
|
||||
next.partsKey = partsKey;
|
||||
return itemOf(id, record, item, show, boost, at, parts);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user