mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Read the agent world packet's camera through src/geo
The world packet converts the eye position with toLonLatH instead of Cesium's Cartographic, so the agent-world-packet group no longer needs cesium. Degree conversions use precomputed factors, as Cesium.Math does, so results stay bit for bit the same.
This commit is contained in:
1 parent
1d7d454dd6
commit
103ecae1f1
4 files changed
+29
-10
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { toLonLatH } from '../geo/index.js';
|
||||
import {
|
||||
feedProvenanceEnvelope,
|
||||
layerSnapshot,
|
||||
@@ -109,9 +109,7 @@ export function getWorldPacket(options = {}) {
|
||||
if (!dataManager || typeof dataManager.getAll !== 'function')
|
||||
throw new TypeError('World Packet requires a data manager');
|
||||
|
||||
const cartographic = Cesium.Cartographic.fromCartesian(
|
||||
viewer.camera.positionWC,
|
||||
);
|
||||
const eye = toLonLatH(viewer.camera.positionWC);
|
||||
// Read the roster once. Voice must not rewalk disabled layers: preserving the
|
||||
// current enabled-only view keeps the model's context budget bounded.
|
||||
const rows = dataManager.getAll();
|
||||
@@ -126,9 +124,9 @@ export function getWorldPacket(options = {}) {
|
||||
ok: true,
|
||||
action: 'get_current_view_state',
|
||||
camera: {
|
||||
latitude: Cesium.Math.toDegrees(cartographic.latitude),
|
||||
longitude: Cesium.Math.toDegrees(cartographic.longitude),
|
||||
heightM: cartographic.height,
|
||||
latitude: eye.lat,
|
||||
longitude: eye.lon,
|
||||
heightM: eye.height,
|
||||
},
|
||||
style: styleManager?.activeStyle || 'normal',
|
||||
context: contextState
|
||||
|
||||
Reference in new issue
Block a user