mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Merge origin/main into the renderer-contract branch: the procedural fleet models drawn through the renderer's model sets
Aircraft, military, local ADS-B, vessel, transit and rail models come from the fleet model set, loaded up front and drawn life size through the draw port's models sets; no layer touches the viewer or Cesium outside src/render/cesium/. The models capability gains glTF bytes (gltf), a per-axis stretch (axisScale), a colour for tinted parts (maskColor) and a cut below the origin (clip: 'belowOrigin'), with conformance checks. Main's rail layer and Data Library are ported to the ports; the CCTV footprint probe keeps the globe-terrain clamp through the query port.
This commit is contained in:
commit
e3865f462f
533 files changed
+55738
-2518
No files matched your search
@@ -0,0 +1,66 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { bindRenderer } from '../render/rendererOf.js';
|
||||
import { flyToLibraryExtent } from './camera.js';
|
||||
|
||||
function flyingViewer(t) {
|
||||
const viewer = {};
|
||||
const flights = [];
|
||||
const unbind = bindRenderer(viewer, {
|
||||
camera: {
|
||||
flyTo(destination, options) {
|
||||
flights.push({ destination, options });
|
||||
return { done: Promise.resolve('complete'), cancel() {} };
|
||||
},
|
||||
},
|
||||
});
|
||||
t.after(unbind);
|
||||
return { viewer, flights };
|
||||
}
|
||||
|
||||
test('Zoom to layer flies to the extent through the camera port', (t) => {
|
||||
const { viewer, flights } = flyingViewer(t);
|
||||
const extent = { west: 10, south: 50, east: 12, north: 51 };
|
||||
assert.equal(
|
||||
flyToLibraryExtent(viewer, extent, { reducedMotion: false }),
|
||||
true,
|
||||
);
|
||||
const [{ destination, options }] = flights;
|
||||
assert.equal(options.durationS, 1.6);
|
||||
// Already wide enough: the box itself.
|
||||
assert.deepEqual(destination, { rect: extent });
|
||||
});
|
||||
|
||||
test('a view-bounded layer lands straight above its sample, below its altitude', (t) => {
|
||||
const { viewer, flights } = flyingViewer(t);
|
||||
flyToLibraryExtent(
|
||||
viewer,
|
||||
{
|
||||
west: -77.04,
|
||||
south: 38.885,
|
||||
east: -77.02,
|
||||
north: 38.9,
|
||||
maxAltitudeM: 4000,
|
||||
},
|
||||
{ reducedMotion: true },
|
||||
);
|
||||
const [{ destination, options }] = flights;
|
||||
assert.equal(options.durationS, 0);
|
||||
assert.ok(Math.abs(destination.lon - -77.03) < 1e-9);
|
||||
assert.ok(Math.abs(destination.lat - 38.8925) < 1e-9);
|
||||
assert.equal(destination.height, 2400);
|
||||
});
|
||||
|
||||
test('a world-scale layer shows the whole globe; no camera, no flight', (t) => {
|
||||
const { viewer, flights } = flyingViewer(t);
|
||||
flyToLibraryExtent(
|
||||
viewer,
|
||||
{ west: -180, south: -85, east: 180, north: 85 },
|
||||
{ reducedMotion: true },
|
||||
);
|
||||
assert.equal(flights[0].destination.height, 20_000_000);
|
||||
assert.equal(
|
||||
flyToLibraryExtent({}, { west: 0, south: 0, east: 1, north: 1 }),
|
||||
false,
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user