mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
A live motion clock's new delay restyles nothing on Cesium
Aircraft layers move their display delay a little every frame. Every frame already reads the clock from the set, so a delay-only change now just asks for a frame instead of restyling every row.
This commit is contained in:
1 parent
e3cfdcf44e
commit
72cfea35c4
2 files changed
+32
No files matched your search
@@ -588,6 +588,18 @@ export function createCesiumDraw({
|
|||||||
requestRender();
|
requestRender();
|
||||||
},
|
},
|
||||||
setOptions(options) {
|
setOptions(options) {
|
||||||
|
// A live clock's new delay only: every frame reads the clock from
|
||||||
|
// the spec, so nothing is rebuilt or restyled (a layer moves its
|
||||||
|
// display delay a little every frame).
|
||||||
|
if (
|
||||||
|
Object.keys(options).every((key) => key === 'motionClock') &&
|
||||||
|
options.motionClock?.kind === 'live' &&
|
||||||
|
spec.motionClock?.kind === 'live'
|
||||||
|
) {
|
||||||
|
spec.motionClock = options.motionClock;
|
||||||
|
requestRender();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Refused, changing nothing, where icons on the GPU cannot take it.
|
// Refused, changing nothing, where icons on the GPU cannot take it.
|
||||||
if (record.gpu) gpu.check([], { ...spec, ...options });
|
if (record.gpu) gpu.check([], { ...spec, ...options });
|
||||||
const culled = spec.horizonCull;
|
const culled = spec.horizonCull;
|
||||||
|
|||||||
@@ -172,6 +172,26 @@ test('a set’s motion clock is the frame’s scene time, or wall time less its
|
|||||||
assert.equal(scene.frameState.time instanceof Cesium.JulianDate, true);
|
assert.equal(scene.frameState.time instanceof Cesium.JulianDate, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('a live clock’s new delay is read the next frame with nothing restyled', () => {
|
||||||
|
const { part, draw } = drawOver();
|
||||||
|
const live = draw.icons({
|
||||||
|
id: 'gpu:delay',
|
||||||
|
motionClock: { kind: 'live', delayMs: 2000 },
|
||||||
|
});
|
||||||
|
live.set([icon('a', { motion: { kind: 'hold' } })]);
|
||||||
|
const record = part.sets.get('gpu:delay');
|
||||||
|
let restyles = 0;
|
||||||
|
const restyle = record.gpu.restyle;
|
||||||
|
record.gpu.restyle = () => ((restyles += 1), restyle());
|
||||||
|
live.setOptions({ motionClock: { kind: 'live', delayMs: 5000 } });
|
||||||
|
assert.equal(restyles, 0, 'a delay alone restyles nothing');
|
||||||
|
const lag =
|
||||||
|
Date.now() - Cesium.JulianDate.toDate(record.host.renderTime({})).getTime();
|
||||||
|
assert.ok(Math.abs(lag - 5000) < 50, `lags ${lag} ms`);
|
||||||
|
live.setOptions({ motionClock: { kind: 'scene' } });
|
||||||
|
assert.equal(restyles, 1, 'a clock of another kind still restyles');
|
||||||
|
});
|
||||||
|
|
||||||
test('rows moving on a live clock keep frames coming until their segments end', () => {
|
test('rows moving on a live clock keep frames coming until their segments end', () => {
|
||||||
const { scene, part, draw } = drawOver();
|
const { scene, part, draw } = drawOver();
|
||||||
const set = draw.icons({ id: 'gpu:animate' });
|
const set = draw.icons({ id: 'gpu:animate' });
|
||||||
|
|||||||
Reference in new issue
Block a user