mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Orbit, move, look and zoom through the camera port
The Cesium camera port gains move, look, rotateAround and zoom, and the browser conformance run now checks them, the lookAt-frame commands, the changed thresholds and moveEnd (timed by the clock, not a frame count). Orbit, the Bhote Koshi focus and cinematic, the launch zoom anchor and replay chase, the camera verbs' motion tick and roll levelling, and voice zoom write through the port.
This commit is contained in:
1 parent
c722593791
commit
21d23034ec
19 files changed
+174
-112
No files matched your search
@@ -316,20 +316,30 @@ export function cameraChecks() {
|
||||
r.camera.on('moveStart', () => events.push(['start', h.now(r)]));
|
||||
r.camera.on('moveEnd', () => events.push(['end', h.now(r)]));
|
||||
await h.frame(r);
|
||||
const movingAt = h.now(r);
|
||||
r.camera.move('forward', 1000);
|
||||
await h.frame(r);
|
||||
equal(events[0]?.[0], 'start', 'moveStart after the move');
|
||||
const movedAt = h.now(r);
|
||||
for (let i = 0; i < 45; i++) await h.frame(r);
|
||||
// By the clock, not a frame count: a page's frames come at the
|
||||
// display's rate.
|
||||
// The event comes on the first frame past 500 ms, so the slack is
|
||||
// two of the longest frames seen, never less than two at 60 Hz.
|
||||
let longestFrame = 1000 / 60;
|
||||
for (let i = 0; i < 600 && h.now(r) - movedAt < 750; i++) {
|
||||
const before = h.now(r);
|
||||
await h.frame(r);
|
||||
longestFrame = Math.max(longestFrame, h.now(r) - before);
|
||||
}
|
||||
const end = events.find(([kind]) => kind === 'end');
|
||||
ok(end, 'moveEnd fired');
|
||||
ok(
|
||||
end[1] - movedAt >= 500 - 1e-6,
|
||||
`moveEnd waited 500 ms (${end[1] - movedAt})`,
|
||||
end[1] - movingAt >= 500 - 1e-6,
|
||||
`moveEnd waited 500 ms (${end[1] - movingAt})`,
|
||||
);
|
||||
ok(
|
||||
end[1] - movedAt < 500 + 2 * (1000 / 60) + 1e-6,
|
||||
'moveEnd came within two frames of 500 ms',
|
||||
end[1] - movedAt < 500 + 2 * longestFrame + 1e-6,
|
||||
`moveEnd came within two frames of 500 ms (${end[1] - movedAt})`,
|
||||
);
|
||||
r.destroy();
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user