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
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user