mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
src/globe/navara builds the GlobeEngine on a Navara 0.2.1 ThreeView. The engine keeps the camera pose in src/geo values and pushes it to Navara's setCamera in degrees (Cesium's heading/pitch/roll convention, S4); whatever Navara moves itself (user input, its flyTo arc) is read back from the drawn camera each frame. Projection, picks against the ellipsoid and the view rectangle are geo math on that pose, with Navara's fov kept on Cesium's 60° across the wider side. - flights: Navara flyTo in ms with mapped easings, cancelFlight via an empty setCamera, user input cancels a flight as in Cesium - events: moveStart/moveEnd (500 ms still)/changed from the pose - render: forceUpdate and animation (render on demand, S5) - surface: S2 CPU ray over 3D-tile meshes, Navara terrain fallback - maps: OSM/Esri raster, Re:Earth or ion quantized-mesh terrain, Google 3D tiles with a browser key and Google's logo - input: DOM pointer events with ScreenSpaceEventHandler semantics - the three private Navara members used live in internals.js, pinned to 0.2.1 by a test index.js builds the product view (MSAA 4, native pixel ratio, preserved drawing buffer, effects=minimal) for a dynamic import. The contract QA script gains --engine=navara on a dev-only harness page: 46/46 contract and 4/4 Navara checks; Cesium stays 53/53.
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
// Static credits on Navara's attribution UI (view.attribution, the
|
|
// AttributionPlugin). Navara matches entries by content and drops duplicates,
|
|
// so one HTML string is shown once and counted here, staying until its last
|
|
// holder removes it. Navara has no separate on-screen strip: `onScreen` credits
|
|
// go into the same list; logos that must stay visible (Google) are sources
|
|
// with a `logo`, added by maps.js.
|
|
|
|
/**
|
|
* @param {{ attribution?: { add: Function, remove: Function } }} view
|
|
* @returns {{ credits: object, destroy: () => void }}
|
|
*/
|
|
export function createNavaraCredits(view) {
|
|
const counts = new Map();
|
|
const release = (html) => {
|
|
if (!counts.has(html)) return;
|
|
const count = counts.get(html);
|
|
if (count > 1) return counts.set(html, count - 1);
|
|
counts.delete(html);
|
|
view.attribution?.remove([{ attributionHtml: html }]);
|
|
};
|
|
const credits = {
|
|
addStatic(html) {
|
|
const text = String(html);
|
|
const count = counts.get(text) ?? 0;
|
|
counts.set(text, count + 1);
|
|
if (count === 0) view.attribution?.add([{ attributionHtml: text }]);
|
|
let removed = false;
|
|
return () => {
|
|
if (removed) return;
|
|
removed = true;
|
|
release(text);
|
|
};
|
|
},
|
|
};
|
|
return {
|
|
credits,
|
|
destroy() {
|
|
for (const html of [...counts.keys()]) {
|
|
counts.set(html, 1);
|
|
release(html);
|
|
}
|
|
},
|
|
};
|
|
}
|