mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Move radio navigation and viewport queries onto the camera port
Radio's camera state, globe recenter plan and viewport anchor now read the camera pose instead of the Cesium camera. The anchor intersects the view ray with the ellipsoid through a shared rayEllipsoid helper, moved into geo/ellipsoid from the stub renderer and checked against Cesium. Scratch vectors are plain objects. navigation, queries and state leave the Cesium allow-list; rendering and lifecycle stay, since they rely on entity clustering, which the draw port does not offer yet.
This commit is contained in:
1 parent
8c6fa6258b
commit
96d860854f
9 files changed
+127
-80
No files matched your search
@@ -20,6 +20,7 @@ import {
|
||||
dot,
|
||||
magnitude,
|
||||
normalize,
|
||||
rayEllipsoid,
|
||||
scale,
|
||||
sub,
|
||||
toCartographicRadians,
|
||||
@@ -502,28 +503,6 @@ export function createStubRenderer(options = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
/** Nearest hit of a ray on the ellipsoid. */
|
||||
function rayEllipsoid(ray) {
|
||||
const r = WGS84.oneOverRadii;
|
||||
const q = vec(ray.origin.x * r.x, ray.origin.y * r.y, ray.origin.z * r.z);
|
||||
const w = vec(
|
||||
ray.direction.x * r.x,
|
||||
ray.direction.y * r.y,
|
||||
ray.direction.z * r.z,
|
||||
);
|
||||
const a = dot(w, w);
|
||||
const b = 2 * dot(q, w);
|
||||
const c = dot(q, q) - 1;
|
||||
const disc = b * b - 4 * a * c;
|
||||
if (disc < 0) return null;
|
||||
const sq = Math.sqrt(disc);
|
||||
const t0 = (-b - sq) / (2 * a);
|
||||
const t1 = (-b + sq) / (2 * a);
|
||||
const t = t0 >= 0 ? t0 : t1 >= 0 ? t1 : null;
|
||||
if (t === null) return null;
|
||||
return add(ray.origin, scale(ray.direction, t));
|
||||
}
|
||||
|
||||
function isOccluded(position) {
|
||||
const e = eye();
|
||||
const r = WGS84.oneOverRadii;
|
||||
|
||||
Reference in new issue
Block a user