mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Cesium effects port draws screenModulation, the marker sweep
The adapter's effects port now has screenModulation: a contract sector shades points, billboards (labels among them) and icon sets in their own vertex shaders, swapped into this scene's command list as the primitives update, and tints models on the CPU after every owner has written its colour. Geometry and picks are unchanged. It is the sweep the cyber HUD already draws, carried into src/render/cesium/screenModulation.js and driven by a sector instead of document settings; nothing is installed until a sector is set, and disposal gives everything back. The capability is advertised on the Cesium version the command swap is tested against; diagnostics list the pass while it draws, and listeners hear when it starts or stops (a native shader it cannot take stops it). A set asks for a frame unless it changes nothing drawn: the same sector, or only the angle of a sweep while no shaded marker was in view. cyberSonarSector() gives the sector for the cyber sweep; the app switches to the port in the next commit. Conformance: the screenModulation check runs on Cesium; new checks read the pixels (in the band an icon draws, outside it and at radius 0 it dims to the floor, strength 1 draws it in the colour, clearing restores it) and check the member is absent without the capability.
This commit is contained in:
1 parent
ab678443ce
commit
85a04b1367
11 files changed
+1573
-10
No files matched your search
@@ -388,3 +388,47 @@ test('a destroyed scene is let go of without touching it', () => {
|
||||
releaseUnboundEffects(viewer, effects);
|
||||
assert.equal(findEffects(viewer), null);
|
||||
});
|
||||
|
||||
test('screenModulation lists its pass while a sector is set, with change events', () => {
|
||||
const none = fixture();
|
||||
assert.equal(none.effects.screenModulation, undefined, 'not without it');
|
||||
none.dispose();
|
||||
const event = () => ({ addEventListener: () => () => {} });
|
||||
const scene = {
|
||||
postProcessStages: { add() {}, remove() {}, bloom: { uniforms: {} } },
|
||||
primitives: { update() {} },
|
||||
postUpdate: event(),
|
||||
preRender: event(),
|
||||
postRender: event(),
|
||||
};
|
||||
const requests = [];
|
||||
const part = createCesiumEffects(scene, {
|
||||
capabilities: new Set(['screenModulation']),
|
||||
frame: { requestRender: (reason) => requests.push(reason) },
|
||||
report: (error) => {
|
||||
throw error;
|
||||
},
|
||||
});
|
||||
const heard = [];
|
||||
part.port.on('change', (d) => heard.push(d.passes));
|
||||
const sector = {
|
||||
center: { x: 10, y: 10 },
|
||||
angle: 0,
|
||||
width: 0.4,
|
||||
radius: 100,
|
||||
floor: 0.5,
|
||||
strength: 0.5,
|
||||
color: '#fff',
|
||||
};
|
||||
part.port.screenModulation(sector);
|
||||
assert.deepEqual(part.port.diagnostics().passes, ['screenModulation']);
|
||||
part.port.screenModulation({ ...sector, angle: 1 });
|
||||
assert.deepEqual(heard, [['screenModulation']], 'heard once, as it starts');
|
||||
part.port.screenModulation(null);
|
||||
assert.deepEqual(part.port.diagnostics().passes, []);
|
||||
assert.deepEqual(heard, [['screenModulation'], []]);
|
||||
assert.deepEqual(requests, ['effects-modulation', 'effects-modulation']);
|
||||
part.port.screenModulation(sector);
|
||||
part.dispose();
|
||||
assert.equal(scene.primitives.update.name, 'update', 'given back');
|
||||
});
|
||||
Reference in new issue
Block a user