mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(globe): camera.commanded, picker.pickGlobe, pose.aspectRatio and isDestroyed
Shell navigation needs to know when a new owner takes the camera (the arrival ground guard), where the globe surface is under a window position (orientation pivot, view-centred place search), the frustum aspect ratio (landmark framing) and whether the engine is gone. Each member has a contract suite check and is implemented by the Cesium engine, the Navara engine and the fake. On Cesium, commanded hooks the viewer camera's command methods and trackedEntityChanged only while it has listeners, so direct Cesium calls from layers still announce a new owner.
This commit is contained in:
1 parent
840e34a881
commit
a3e929870d
16 files changed
+459
-6
No files matched your search
@@ -92,3 +92,24 @@ test('pick results carry 3D tile content for surface checks', () => {
|
||||
scene.pick = () => ({ id: 'entity', primitive: {} });
|
||||
assert.equal(picker.pick(geo.cartesian2.create(1, 1)).content, undefined);
|
||||
});
|
||||
|
||||
test('pickGlobe asks the globe along the camera pick ray and returns geo', () => {
|
||||
const { viewer, picker, scene } = setup();
|
||||
const hit = picker.pickGlobe(geo.cartesian2.create(3, 4));
|
||||
assert.ok(!(hit instanceof Cesium.Cartesian3));
|
||||
assert.deepEqual([hit.x, hit.y, hit.z], [6378137, 3, 4]);
|
||||
const [screen] = viewer.callsOf('camera.getPickRay')[0].args;
|
||||
assert.ok(screen instanceof Cesium.Cartesian2);
|
||||
assert.equal(screen.toString(), '(3, 4)');
|
||||
const [ray, pickedScene] = viewer.callsOf('globe.pick')[0].args;
|
||||
assert.ok(ray instanceof Cesium.Ray);
|
||||
assert.equal(pickedScene, scene);
|
||||
scene.globe.pick = () => undefined;
|
||||
assert.equal(picker.pickGlobe(geo.cartesian2.create(1, 1)), undefined);
|
||||
scene.globe.pick = () => {
|
||||
throw new Error('no ray');
|
||||
};
|
||||
assert.equal(picker.pickGlobe(geo.cartesian2.create(1, 1)), undefined);
|
||||
scene.globe = undefined;
|
||||
assert.equal(picker.pickGlobe(geo.cartesian2.create(1, 1)), undefined);
|
||||
});
|
||||
Reference in new issue
Block a user