mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Keep shape radii, rim gradients, depth-fail looks, sweep cadence and step camera moves out of the renderer contract
Shapes take their radii in metres; the world annotation ring follows the camera height itself (ringRadiusAt), resizing on preRender. The radial rim preset and depthBias go: the launch pad zone draws a canvas image fill made by the layer. Solid and dashed lines take one depthFail look (solid or dash) in place of depthFailColor and depthFailDash. sonarCadenceHz goes from the quality settings: nothing set it, and the sweep moves every 80 ms. Camera move, look, rotateAround and zoom leave the camera port: the app's pans, in-place turns, globe turns and zooms are setView views summed over the pose (geo/eyeMoves), and the Cesium port places a view by direction and up exactly rather than through heading, pitch and roll. The conformance driver runs those script steps through setView; the lookAt script turns in place where it turned about the frame-local axis, and its reference is recorded again.
This commit is contained in:
1 parent
7a376ebefc
commit
c8346c9fda
44 files changed
+810
-799
No files matched your search
@@ -607,48 +607,6 @@ export function createStubCamera({
|
||||
finishFlight('cancelled');
|
||||
}
|
||||
|
||||
function move(dir, metres) {
|
||||
const axis = {
|
||||
forward: direction,
|
||||
back: negate(direction),
|
||||
right,
|
||||
left: negate(right),
|
||||
up,
|
||||
down: negate(up),
|
||||
}[dir];
|
||||
position = add(position, scale(axis, metres));
|
||||
requestRender('camera');
|
||||
}
|
||||
|
||||
function look(dir, radians) {
|
||||
const [axis, sign] = {
|
||||
left: [up, -1],
|
||||
right: [up, 1],
|
||||
up: [right, -1],
|
||||
down: [right, 1],
|
||||
}[dir];
|
||||
const a = clone(axis);
|
||||
const angle = -(sign * radians);
|
||||
direction = rotate(direction, a, angle);
|
||||
up = rotate(up, a, angle);
|
||||
right = rotate(right, a, angle);
|
||||
requestRender('camera');
|
||||
}
|
||||
|
||||
function rotateAround(axis, radians) {
|
||||
const a = normalize(axis);
|
||||
position = rotate(position, a, -radians);
|
||||
direction = rotate(direction, a, -radians);
|
||||
up = rotate(up, a, -radians);
|
||||
right = cross(direction, up);
|
||||
up = cross(right, direction);
|
||||
requestRender('camera');
|
||||
}
|
||||
|
||||
function zoom(metres) {
|
||||
move('forward', metres);
|
||||
}
|
||||
|
||||
// --- Follow ----------------------------------------------------------------
|
||||
|
||||
/** Where the target is drawn, for a drawn item; otherwise its own answer. */
|
||||
@@ -797,10 +755,6 @@ export function createStubCamera({
|
||||
},
|
||||
lookAt,
|
||||
release,
|
||||
move,
|
||||
look,
|
||||
rotateAround,
|
||||
zoom,
|
||||
follow,
|
||||
get followed() {
|
||||
return followed;
|
||||
|
||||
@@ -707,23 +707,11 @@ export function createStubRenderer(options = {}) {
|
||||
);
|
||||
}
|
||||
|
||||
/** The eye's height above the ellipsoid, for radii by camera height. */
|
||||
const eyeHeight = () => toCartographicRadians(eye().position)?.height ?? 0;
|
||||
|
||||
/**
|
||||
* Whether `lon`, `lat` (degrees) is in an ellipse geometry, its radii by
|
||||
* camera height at the eye's height, measured in the plane tangent at its
|
||||
* centre.
|
||||
* Whether `lon`, `lat` (degrees) is in an ellipse geometry, measured in
|
||||
* the plane tangent at its centre.
|
||||
*/
|
||||
function inEllipse(g, lon, lat) {
|
||||
const height = eyeHeight();
|
||||
const radius = (r) =>
|
||||
typeof r === 'number'
|
||||
? r
|
||||
: Math.max(
|
||||
r.byCameraHeight.min,
|
||||
Math.min(r.byCameraHeight.max, height * r.byCameraHeight.factor),
|
||||
);
|
||||
const centre = toCartographicRadians(toEcef(g.center));
|
||||
const metresPerRadian = 6378137;
|
||||
const east =
|
||||
@@ -735,11 +723,7 @@ export function createStubRenderer(options = {}) {
|
||||
const turn = g.rotation ?? 0;
|
||||
const along = north * Math.cos(turn) - east * Math.sin(turn);
|
||||
const across = north * Math.sin(turn) + east * Math.cos(turn);
|
||||
return (
|
||||
(along / radius(g.semiMajor)) ** 2 +
|
||||
(across / radius(g.semiMinor)) ** 2 <=
|
||||
1
|
||||
);
|
||||
return (along / g.semiMajor) ** 2 + (across / g.semiMinor) ** 2 <= 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user