mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +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
@@ -339,12 +339,8 @@ const EXPECTED_MISSING = [
|
||||
'camera.followOffset.get',
|
||||
'camera.followOffset.set',
|
||||
'camera.followed',
|
||||
'camera.look',
|
||||
'camera.matrices',
|
||||
'camera.move',
|
||||
'camera.rotateAround',
|
||||
'camera.setFov',
|
||||
'camera.zoom',
|
||||
'draw.atlas',
|
||||
'draw.clampState',
|
||||
'draw.on',
|
||||
|
||||
@@ -26,6 +26,25 @@ export const EASINGS = Object.freeze({
|
||||
sineInOut: Cesium.EasingFunction.SINUSOIDAL_IN_OUT,
|
||||
});
|
||||
|
||||
/**
|
||||
* The contract's moves and looks as Cesium camera method names, called by
|
||||
* name: a caller's camera may come from another copy of Cesium.
|
||||
*/
|
||||
const MOVES = Object.freeze({
|
||||
forward: 'moveForward',
|
||||
back: 'moveBackward',
|
||||
left: 'moveLeft',
|
||||
right: 'moveRight',
|
||||
up: 'moveUp',
|
||||
down: 'moveDown',
|
||||
});
|
||||
const LOOKS = Object.freeze({
|
||||
left: 'lookLeft',
|
||||
right: 'lookRight',
|
||||
up: 'lookUp',
|
||||
down: 'lookDown',
|
||||
});
|
||||
|
||||
/** A contract destination as Cesium's: a Cartesian3, or a Rectangle. */
|
||||
export function toDestination(d) {
|
||||
if ('rect' in d) {
|
||||
@@ -221,6 +240,24 @@ export function createCesiumCamera({ scene, camera, report }) {
|
||||
camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
|
||||
scene.requestRender();
|
||||
},
|
||||
move(direction, metres) {
|
||||
camera[MOVES[direction]](metres);
|
||||
scene.requestRender();
|
||||
},
|
||||
look(direction, radians) {
|
||||
camera[LOOKS[direction]](radians);
|
||||
scene.requestRender();
|
||||
},
|
||||
rotateAround(axis, radians) {
|
||||
camera.rotate(toCartesian(axis), radians);
|
||||
scene.requestRender();
|
||||
},
|
||||
zoom(metres) {
|
||||
// Cesium's zoom, not a move: outside 3D it changes the view's width.
|
||||
if (metres < 0) camera.zoomOut(-metres);
|
||||
else camera.zoomIn(metres);
|
||||
scene.requestRender();
|
||||
},
|
||||
viewRectangle() {
|
||||
const rect = camera.computeViewRectangle(Cesium.Ellipsoid.WGS84);
|
||||
if (!rect) return null;
|
||||
|
||||
@@ -25,7 +25,7 @@ const QUERY_RECORDS = new Set([
|
||||
'occluded',
|
||||
]);
|
||||
/** Commands and records the port does not have yet. */
|
||||
const MISSING = new Set(['move', 'look', 'rotateAround', 'zoom', 'matrices']);
|
||||
const MISSING = new Set(['matrices']);
|
||||
|
||||
const runnable = CAMERA_SCRIPTS.filter((script) =>
|
||||
script.steps.every(
|
||||
|
||||
@@ -19,6 +19,10 @@ export const CESIUM_CHECKS = new Set([
|
||||
'camera.trace.setView angles',
|
||||
'camera.trace.setView keeps the position when only orientation is given',
|
||||
'camera.trace.lookAt sweep and release',
|
||||
'camera.trace.move, look, rotate and zoom',
|
||||
'camera.trace.commands inside a lookAt frame',
|
||||
'camera.trace.changed fires by each listener’s threshold',
|
||||
'camera.moveEnd',
|
||||
'camera.trace.flyTo with a duration of 0 completes inside the call',
|
||||
'camera.trace.flyTo where the camera already is completes inside the call',
|
||||
'camera.viewRectangle',
|
||||
|
||||
Reference in new issue
Block a user