mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Read the street traffic viewport through the camera and query ports
The traffic layer's camera altitude, view bounds and fetch centre come from the renderer's camera port (its pose and view rectangle), and the reticle footprint samples the ground with the query port's ellipsoid picks and rays instead of the camera's own. The footprint's nadir is the pose position in geodetic radians, as the camera's own cartographic position was. A pixel the renderer has no ray for (a canvas of no size) samples no direction, as the unset scratch ray did. The lifecycle part loads the default renderer's camera factory, so a viewer of a caller's own gets both ports. Footprint and viewport leave the allow-list.
This commit is contained in:
1 parent
10db177251
commit
a8cf63999b
8 files changed
+204
-75
No files matched your search
@@ -239,6 +239,23 @@ test('traffic timing pairs real ordering to the scheduling change and guards re-
|
||||
},
|
||||
};
|
||||
|
||||
// The layer reads the camera through the renderer's camera port.
|
||||
const { bindRenderer } = await server.ssrLoadModule('/src/render/rendererOf.js');
|
||||
const degrees = (radians) => radians * 180 / Math.PI;
|
||||
bindRenderer(viewer, {
|
||||
camera: {
|
||||
pose: () => ({
|
||||
lon: degrees(camera.positionCartographic.longitude),
|
||||
lat: degrees(camera.positionCartographic.latitude),
|
||||
height: camera.positionCartographic.height,
|
||||
}),
|
||||
viewRectangle() {
|
||||
const r = camera.computeViewRectangle();
|
||||
return { west: degrees(r.west), south: degrees(r.south), east: degrees(r.east), north: degrees(r.north) };
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
performance.clearMarks();
|
||||
performance.clearMeasures();
|
||||
trafficLayer.init(viewer);
|
||||
|
||||
Reference in new issue
Block a user