feat(globe): implement the engine on Navara

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.
This commit is contained in:
German Khokhlov committed 2026-10-15 19:03:58 +04:00
1 parent b6ac0e9c99
commit 90c8e7763a
19 files changed
+3311

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {
NAVARA_CONTEXT_ATTRIBUTES,
navaraScenePlan,
navaraViewOptions,
} from './viewOptions.js';
test('the product view renders on demand with MSAA 4 at the native pixel ratio', () => {
const container = { id: 'globe' };
const canvas = { id: 'canvas' };
assert.deepEqual(navaraViewOptions({ container, canvas }), {
container,
canvas,
animation: false,
multisampling: 4,
});
assert.equal(
navaraViewOptions({ container, pixelRatio: 1 }).pixelRatio,
1,
'measurements pin the pixel ratio',
);
});
test('the canvas context keeps its drawing buffer, with the attributes Navara asks for', () => {
assert.deepEqual(NAVARA_CONTEXT_ATTRIBUTES, {
alpha: true,
antialias: true,
depth: true,
stencil: true,
premultipliedAlpha: true,
preserveDrawingBuffer: true,
powerPreference: 'default',
});
});
test('effects=minimal is the default look: sky, stars and sun light, no post effects (S5)', () => {
assert.deepEqual(navaraScenePlan(), {
pluginDefault: false,
meshes: ['sky', 'stars'],
lights: ['skyLightProbe', 'sun'],
effects: [],
});
assert.equal(navaraScenePlan('photoreal').pluginDefault, true);
assert.throws(() => navaraScenePlan('cinematic'), RangeError);
});