Draw CCTV coverage, viewsheds and the monitor plane through the renderer ports and take projection.js off the Cesium list

The frustum wireframes, viewshed volumes and the active camera's monitor
plane are now line, mesh and quad items of the layer's own draw sets
(layers/cctv/drawSets.js), written from plain handles only as they change.
The plane takes its canvas double buffer or its video as a quad source.
Picks of lines and planes are matched by set, item id and the record that
draws them. The activation obstruction probe casts through the query
port's rayCast; its clamp lands a microtask later, rewrites the geometry
and asks again for the footprint ground, and a newer activation, a range
edit, a deactivation or a re-init drops an answer still to come.
This commit is contained in:
Sameh Khamis committed 2026-11-08 08:35:12 -08:00
1 parent bbad02b73e
commit 2a607ec4d8
20 files changed
+918 -492

No files matched your search

+30 -24
View File
@@ -14,6 +14,7 @@ import {
import { isVideoFeedType } from '../../sources/cctvTypes.js';
import * as Cesium from 'cesium';
import { createIconSet } from '../../data/iconSet.js';
import { bindRenderer } from '../../render/rendererOf.js';
const FOCUS_FACTOR = 0.5;
@@ -112,40 +113,45 @@ test('icons leave the scene they were added to, whichever viewer tears down', ()
assert.equal(state._icons, null);
});
test('the obstruction probe sees through the layer and needs a ray pick', () => {
const coverage = [{ id: 'cov' }];
const plane = { id: 'plane' };
test('the obstruction probe casts one ray through the query port', async () => {
const calls = [];
const state = {
_viewer: {
scene: {
pickFromRay(ray, exclude) {
calls.push({ ray, exclude });
return { position: { x: 1, y: 2, z: 3 } };
},
const viewer = {};
const unbind = bindRenderer(viewer, {
query: {
rayCast: async (ray, options) => {
calls.push({ ray, options });
return { x: 1, y: 2, z: 3 };
},
},
_coverageEntities: coverage,
_projectionEntities: [{ planeEntity: plane }, null, {}],
};
});
const state = { _viewer: viewer };
const rendering = createRendering({
state,
services: { focus: {} },
parts: {},
});
assert.equal(rendering.canPickFromRay(), true);
const hit = rendering.obstructionHit(
{ x: 0, y: 0, z: 0 },
{ x: 1, y: 0, z: 0 },
);
assert.deepEqual(hit.position, { x: 1, y: 2, z: 3 });
assert.deepEqual(calls[0].exclude, [...coverage, plane]);
assert.ok(calls[0].ray instanceof Cesium.Ray);
state._viewer = { scene: {} };
try {
assert.equal(rendering.canPickFromRay(), true);
const origin = { x: 0, y: 0, z: 0 };
const direction = { x: 1, y: 0, z: 0 };
assert.deepEqual(await rendering.obstructionHit(origin, direction), {
x: 1,
y: 2,
z: 3,
});
// The layer's own sets are not ground: the cast sees through them
// without naming them.
assert.deepEqual(calls, [
{ ray: { origin, direction }, options: { against: 'surface' } },
]);
} finally {
unbind();
}
state._viewer = {};
assert.equal(rendering.canPickFromRay(), false);
assert.equal(
rendering.obstructionHit({ x: 0, y: 0, z: 0 }, { x: 1, y: 0, z: 0 }),
undefined,
await rendering.obstructionHit({ x: 0, y: 0, z: 0 }, { x: 1, y: 0, z: 0 }),
null,
);
});