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
@@ -205,3 +205,24 @@ function near(actual, expected, tolerance, label) {
|
||||
`${label}: ${actual} is not within ${tolerance} of ${expected}`,
|
||||
);
|
||||
}
|
||||
|
||||
test('isDestroyed follows destroy', () => {
|
||||
const { engine } = setup();
|
||||
assert.equal(engine.isDestroyed(), false);
|
||||
engine.destroy();
|
||||
assert.equal(engine.isDestroyed(), true);
|
||||
});
|
||||
|
||||
test('pickGlobe meets the terrain along the pick ray, or the ellipsoid', () => {
|
||||
const { engine, view } = setup();
|
||||
const centre = cartesian2.create(640, 400);
|
||||
const bare = engine.picker.pickGlobe(centre);
|
||||
const ellipsoid = engine.camera.pickEllipsoid(centre);
|
||||
near(cartesian3.distance(bare, ellipsoid), 0, 1e-6, 'no terrain: ellipsoid');
|
||||
view.sampleTerrainHeight = () => 2000;
|
||||
const raised = engine.picker.pickGlobe(centre);
|
||||
const place = geo.cartographic.fromCartesian(raised);
|
||||
near(place.height, 2000, 0.5, 'terrain height (m)');
|
||||
near(math.toDegrees(place.longitude), 0, 1e-6, 'longitude');
|
||||
assert.equal(engine.picker.pickGlobe(cartesian2.create(640, -1e7)), undefined);
|
||||
});
|
||||
Reference in new issue
Block a user