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
@@ -1,5 +1,5 @@
|
||||
import { applicationServices } from './services/application.js';
|
||||
import * as Cesium from 'cesium';
|
||||
import * as geo from './geo/index.js';
|
||||
import {
|
||||
deriveWeatherEffectProfile,
|
||||
weatherAltitudeFactors,
|
||||
@@ -133,10 +133,10 @@ function greatCircleM(a, b) {
|
||||
)
|
||||
)
|
||||
return Infinity;
|
||||
const latitudeA = Cesium.Math.toRadians(a.latitude);
|
||||
const latitudeB = Cesium.Math.toRadians(b.latitude);
|
||||
const latitudeDelta = Cesium.Math.toRadians(b.latitude - a.latitude);
|
||||
const longitudeDelta = Cesium.Math.toRadians(b.longitude - a.longitude);
|
||||
const latitudeA = geo.math.toRadians(a.latitude);
|
||||
const latitudeB = geo.math.toRadians(b.latitude);
|
||||
const latitudeDelta = geo.math.toRadians(b.latitude - a.latitude);
|
||||
const longitudeDelta = geo.math.toRadians(b.longitude - a.longitude);
|
||||
const haversine =
|
||||
Math.sin(latitudeDelta / 2) ** 2 +
|
||||
Math.cos(latitudeA) *
|
||||
@@ -342,8 +342,8 @@ export class CockpitCloudEffectsController {
|
||||
cameraPoint() {
|
||||
const cartographic = this.viewer?.camera?.positionCartographic;
|
||||
if (!cartographic) return null;
|
||||
const latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
||||
const longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
||||
const latitude = geo.math.toDegrees(cartographic.latitude);
|
||||
const longitude = geo.math.toDegrees(cartographic.longitude);
|
||||
if (![latitude, longitude].every(Number.isFinite)) return null;
|
||||
return {
|
||||
latitude,
|
||||
@@ -541,7 +541,7 @@ export class CockpitCloudEffectsController {
|
||||
render(timeSec) {
|
||||
const gl = this.gl;
|
||||
if (!gl || !this.program || !this.locations) return;
|
||||
const windRadians = Cesium.Math.toRadians(this.windDirectionDeg);
|
||||
const windRadians = geo.math.toRadians(this.windDirectionDeg);
|
||||
const windScale = 0.008 + this.windStrength * 0.022;
|
||||
gl.useProgram(this.program);
|
||||
gl.uniform2f(
|
||||
|
||||
Reference in new issue
Block a user