Merge origin/main into byrdit/cctv-visible-only-fetch

# Conflicts:
#	src/layers/cctv/frames.test.mjs
This commit is contained in:
German Khokhlov committed 2026-11-20 17:33:48 +04:00
commit 20647f6549
391 files changed
+32429 -1796

No files matched your search

+42
View File
@@ -10,6 +10,7 @@
* loop on a virtual clock, one frame at a time, in the contract's order.
*/
import { horizonFrom } from '../../geo/horizon.js';
import { headingPitchRollFrame } from '../../geo/quaternion.js';
import { alongLength } from '../../geo/polyline.js';
import { clusterScreenPoints } from '../../geo/screenCluster.js';
import { createInputRouter } from '../input/router.js';
@@ -810,6 +811,7 @@ export function createStubRenderer(options = {}) {
function itemPosition(set, item, aheadMs = 0) {
if (!item.pos) return null;
const base = toEcef(item.pos);
if (set.kind === 'models') return posedModelPosition(item, base);
const p =
set.kind === 'icons' && item.motion && capabilities.has('motionSegments')
? motionPosition(item.motion, base, motionTime(set) + aheadMs)
@@ -823,6 +825,46 @@ export function createStubRenderer(options = {}) {
: p;
}
/**
* Where the stub draws a model. A stub model is one node, named after its
* file (`/models/c172.glb` is `c172`, `stub:model.glb` is `model`): with
* `modelNodes`, an item's
* `nodes` entry for that name moves it by the matrix's translation, on the
* model's axes and at its scale; any other name is one the model lacks.
*/
function posedModelPosition(item, base) {
if (!capabilities.has('modelNodes') || !item.nodes) return base;
const file = String(item.url ?? '')
.split(/[?#]/)[0]
.split(/[/:]/)
.pop();
const name = file.replace(/\.[^.]*$/, '');
const m = name ? item.nodes[name] : null;
if (!m || m.length < 16) return base;
const k = item.scale ?? 1;
const frame = headingPitchRollFrame(base, {
heading: item.orientation?.heading ?? 0,
pitch: item.orientation?.pitch ?? 0,
roll: item.orientation?.roll ?? 0,
});
const along = (axis, t) => ({
x: axis.x * t * k,
y: axis.y * t * k,
z: axis.z * t * k,
});
let p = base;
for (const [axis, t] of [
[frame.x, m[12]],
[frame.y, m[13]],
[frame.z, m[14]],
])
if (t) {
const d = along(axis, t);
p = { x: p.x + d.x, y: p.y + d.y, z: p.z + d.z };
}
return p;
}
/**
* The shown models as the stub draws them: a square as wide as a pick
* takes (at most `maxPixelSize`, at least `minPixelSize`), far