mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(rail, transit): a train or vehicle a first-person view holds draws no 3D model either, since the view's eye is inside it; let go, its model draws again
The fleet models (#1714) draw nearby trains and vehicles under the 3D toggle. A held one now leaves out its model as it does its icon, as the Vessels layer does for its bridge subject: its model item is hidden, and handing the visual back to its icon keeps the icon hidden while held. Tests drive each layer with the real fleet-model layer and a stubbed glTF loader; both fail without the fix.
This commit is contained in:
1 parent
546ac22708
commit
974023510f
12 files changed
+212
-17
No files matched your search
@@ -12,6 +12,24 @@ import { publicRailCatalog } from '../data/railFeeds.js';
|
||||
export const RAIL_HARNESS_T0 = 1_789_000_000_000;
|
||||
export const BOSTON = Object.freeze({ lat: 42.3601, lon: -71.0589 });
|
||||
|
||||
/** A camera's frame looking straight down from `altitude` over `at`. */
|
||||
function lookingDown(at, altitude) {
|
||||
const position = Cesium.Cartesian3.fromDegrees(at.lon, at.lat, altitude);
|
||||
const up = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(
|
||||
position,
|
||||
new Cesium.Cartesian3(),
|
||||
);
|
||||
return {
|
||||
directionWC: Cesium.Cartesian3.negate(up, new Cesium.Cartesian3()),
|
||||
upWC: Cesium.Cartesian3.UNIT_Z,
|
||||
frustum: {
|
||||
computeCullingVolume: () => ({
|
||||
computeVisibility: () => Cesium.Intersect.INSIDE,
|
||||
}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/** A train as the rail proxy sends it. */
|
||||
export function railTrain(id, lat, lon, extra = {}) {
|
||||
return {
|
||||
@@ -64,7 +82,7 @@ const headersOf = (values = {}) => ({
|
||||
* catalog?: object[]|Promise<object[]>|Function|false,
|
||||
* ground?: object,
|
||||
* stops?: object|null, scheduleStops?: boolean,
|
||||
* paths?: Record<string, object>|null}} [options]
|
||||
* paths?: Record<string, object>|null, fleet?: object|null}} [options]
|
||||
* `ground`: a floor service in place of the always-cold stub; `catalog`:
|
||||
* the server's feed catalog (it may list fewer feeds than are bundled; a
|
||||
* promise answers when it settles, a function is called per request and
|
||||
@@ -74,7 +92,9 @@ const headersOf = (values = {}) => ({
|
||||
* layer's own provider, its schedule tier, in its place;
|
||||
* `paths`: feed id → the path pack the proxy serves, or a
|
||||
* failure status it answers with (404 for any other feed; without it the
|
||||
* source has no path route at all).
|
||||
* source has no path route at all); `fleet`: the fleet-model services
|
||||
* (testSupport/fleetModelFakes.mjs), with a camera that looks straight
|
||||
* down for them (none by default: trains stay icons).
|
||||
*/
|
||||
export function railLayerHarness(
|
||||
t,
|
||||
@@ -86,6 +106,7 @@ export function railLayerHarness(
|
||||
stops = null,
|
||||
scheduleStops = false,
|
||||
paths = null,
|
||||
fleet = null,
|
||||
} = {},
|
||||
) {
|
||||
const T0 = RAIL_HARNESS_T0;
|
||||
@@ -179,6 +200,8 @@ export function railLayerHarness(
|
||||
cancelFlight() {
|
||||
this.flightsCancelled += 1;
|
||||
},
|
||||
// What the fleet models' eligibility reads: a camera looking down.
|
||||
...(fleet ? lookingDown(at, altitude) : {}),
|
||||
},
|
||||
scene: {
|
||||
canvas: { addEventListener() {}, removeEventListener() {} },
|
||||
@@ -308,6 +331,7 @@ export function railLayerHarness(
|
||||
cachedGroundFloor: () => null,
|
||||
warmGroundFloor() {},
|
||||
},
|
||||
...(fleet ? { fleet } : {}),
|
||||
camera: {
|
||||
framing: WORLD_FOCUS_FRAMING.train,
|
||||
requestWorldFocus(detail) {
|
||||
|
||||
Reference in new issue
Block a user