mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
refactor(camera,data): take vector maths from src/geo
Move the Cartesian3/Cartographic/Matrix/Quaternion/Transforms/Math calls of the first batch (src/data motion, anchor, tracked-camera and icon helpers; the root camera, locations, HUD, share-link, world-focus, ground-guard, orbit and cloud modules; services/groundSnap) to src/geo. Behaviour is unchanged: same argument order, same `result` semantics. Kept on Cesium: out-of-scope classes (JulianDate, Axis, HeadingPitchRange, BoundingSphere, Rectangle, EasingFunction, EllipsoidalOccluder with its WGS84 and seed vector, SceneTransforms) and Matrix4.IDENTITY wherever it is handed straight to a Cesium camera call (locations.test pins its identity). synthesizeForwardKinematicsFix now returns a plain position, so the two snapshot renderers clone it with the static Cesium.Cartesian3.clone instead of the instance method. The package-boundary groups that reach these modules now own the src/geo files.
This commit is contained in:
1 parent
4a92ed8377
commit
d886be68a8
17 files changed
+481
-285
No files matched your search
+4
-3
@@ -1,4 +1,5 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import * as geo from './geo/index.js';
|
||||
import {
|
||||
holdContinuousRender,
|
||||
releaseContinuousRender,
|
||||
@@ -16,7 +17,7 @@ export class OrbitController {
|
||||
this.target = null;
|
||||
this.radius = 500;
|
||||
this.pitch = -30;
|
||||
this.speed = Cesium.Math.toRadians(6); // ~6°/sec → full rotation in ~60s
|
||||
this.speed = geo.math.toRadians(6); // ~6°/sec → full rotation in ~60s
|
||||
this.angle = 0;
|
||||
this._removeListener = null;
|
||||
}
|
||||
@@ -35,7 +36,7 @@ export class OrbitController {
|
||||
this.target = targetCartesian;
|
||||
this.radius = options.radius || this.radius;
|
||||
this.pitch = options.pitch || this.pitch;
|
||||
this.speed = Cesium.Math.toRadians(options.speed || 6);
|
||||
this.speed = geo.math.toRadians(options.speed || 6);
|
||||
this.active = true;
|
||||
// Orbit mutates the camera from preRender — without a hold the loop
|
||||
// starves after its first idle frame. (perf wave 2)
|
||||
@@ -56,7 +57,7 @@ export class OrbitController {
|
||||
|
||||
const hpr = new Cesium.HeadingPitchRange(
|
||||
this.angle,
|
||||
Cesium.Math.toRadians(this.pitch),
|
||||
geo.math.toRadians(this.pitch),
|
||||
this.radius,
|
||||
);
|
||||
this.viewer.camera.lookAt(this.target, hpr);
|
||||
|
||||
Reference in new issue
Block a user