feat(globe): dynamic lines on both engines

engine.lines.createLine({ id, widthPx, color, depthFailAlpha, dash
({ lengthPx, gapPx } | 'tactical'), arc ('none'|'geodesic'), modelMatrix,
pickId }) → a Line: setPositions (Cartesian3[] or a flat Float64Array),
setColor, setModelMatrix, show, destroy; lines.list() for QA. Options,
flat positions, geodesic densification (great circles of the geodetic
normals, height interpolated, one step per degree) and the registry are
engine-neutral (src/globe/lines.js); the fake engine keeps every line.

- Cesium: a Primitive of a PolylineGeometry (synchronous, rebuilt when
  the positions change) with a PolylineMaterialAppearance in an
  engine-owned collection; depthFailAlpha is depthFailAppearance with the
  alpha scaled; pixel dashes are PolylineDash (16-bit pattern); the
  tactical dash is the launches' selected-orbit shader under its own type
  (launches keep theirs until Task 15a moves them onto engine.lines).
- Navara: a public MeshDesc (transparent pass, unlit) holding a ribbon
  of one quad per segment, widened to CSS pixels in the vertex shader;
  a second copy drawn with GreaterDepth and the alpha scaled is the
  depth-fail part; dashes are cut in the fragment shader (pixels along
  the screen direction, or the tactical pattern over the fraction along
  the line); positions relative to the first point, the model matrix on
  the group. Geodesic arcs are densified on the CPU. Not pickable yet.
- The contract suite draws a three-point line on both engines: magenta
  along both segments, nothing off it, 1° east once turned by its model
  matrix, gone when hidden; a line 30 km under the ground shows only its
  depth-fail copy, dimmer than the line.

Main chunk 2,867,499 bytes (+7,197, +0.25 %: the Cesium lines).
This commit is contained in:
German Khokhlov committed 2026-10-16 17:24:36 +04:00
1 parent 0109097440
commit 86aa0bc9ba
16 files changed
+1380 -2

No files matched your search

+11 -1
View File
@@ -30,6 +30,12 @@ const NO_MOVERS = Object.freeze({
},
list: () => [],
});
const NO_LINES = Object.freeze({
createLine() {
throw new Error("Navara lines need the view's three runtime (lines/)");
},
list: () => [],
});
// Navara's drawn camera (view.camera.raw, a three PerspectiveCamera in
// Earth-fixed metres): matrixWorld columns are right, up, back, position.
@@ -84,7 +90,8 @@ function rayRaisedEllipsoid({ origin, direction }, height) {
* it the engine only keeps the state) and the engine destroys it;
* `appClock` (the engine clock's time) defaults to the page's app clock;
* `movers` is engine.movers on the view's three runtime (movers/index.js;
* without it createSet throws) and the engine destroys it;
* without it createSet throws), `lines` engine.lines (lines/index.js;
* likewise), both destroyed with the engine;
* `fetch` and `clock` (the camera model's timers) are test seams.
* @returns {import('../contract.js').GlobeEngine}
*/
@@ -97,6 +104,7 @@ export function createNavaraEngine(
clock,
appClock,
movers: moversPort = null,
lines: linesPort = null,
sharpen: sharpenPort = null,
} = {},
) {
@@ -246,6 +254,7 @@ export function createNavaraEngine(
maps: maps.maps,
clock: engineClock.clock,
movers: moversPort?.movers ?? NO_MOVERS,
lines: linesPort?.lines ?? NO_LINES,
destroy() {
if (destroyed) return;
destroyed = true;
@@ -257,6 +266,7 @@ export function createNavaraEngine(
maps.destroy();
sharpenPort?.destroy();
moversPort?.destroy();
linesPort?.destroy();
},
isDestroyed: () => destroyed,
// Navara only, not contract: the ground the floor last sampled under