mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-13 14:52:19 +00:00
Fix the trail and decoded-weather probes on both engines
Both probes called waitForEngine without the engine kind, which can never match and timed out after 120 s; waitForEngine now rejects a missing kind. The trail probe passed no result vectors to the geo helpers, and drew its trail below the ground, where only the dimmed occluded pass showed it; it now draws halfway down to the ground and both engines count the same pixels.
This commit is contained in:
1 parent
1856477e0a
commit
2d0aa25e35
3 files changed
+25
-7
No files matched your search
@@ -747,6 +747,8 @@ export async function pickEngine(
|
|||||||
|
|
||||||
/** Wait until `kind` runs, its picker is idle and its view is restored. */
|
/** Wait until `kind` runs, its picker is idle and its view is restored. */
|
||||||
export async function waitForEngine(page, kind, { timeout = 120000 } = {}) {
|
export async function waitForEngine(page, kind, { timeout = 120000 } = {}) {
|
||||||
|
if (kind !== 'cesium' && kind !== 'navara')
|
||||||
|
throw new TypeError(`waitForEngine needs the engine kind, got ${kind}`);
|
||||||
const started = Date.now();
|
const started = Date.now();
|
||||||
await page.waitForFunction(
|
await page.waitForFunction(
|
||||||
(expected) =>
|
(expected) =>
|
||||||
|
|||||||
@@ -20,24 +20,40 @@ try {
|
|||||||
await page.setViewport({ width: 960, height: 640 });
|
await page.setViewport({ width: 960, height: 640 });
|
||||||
await blockPaidQaMaps(page);
|
await blockPaidQaMaps(page);
|
||||||
await page.goto(url, { waitUntil: 'domcontentloaded' });
|
await page.goto(url, { waitUntil: 'domcontentloaded' });
|
||||||
await waitForEngine(page);
|
await waitForEngine(
|
||||||
|
page,
|
||||||
|
new URL(url).searchParams.get('engine') ?? 'navara',
|
||||||
|
);
|
||||||
const result = await evaluateWithGeo(page, async (geo) => {
|
const result = await evaluateWithGeo(page, async (geo) => {
|
||||||
const { createTrail, CHUNK_POINTS } =
|
const { createTrail, CHUNK_POINTS } =
|
||||||
await import('/src/data/trailRenderer.js');
|
await import('/src/data/trailRenderer.js');
|
||||||
const { engine } = window.__godsEyeView;
|
const { engine } = window.__godsEyeView;
|
||||||
engine.camera.cancelFlight();
|
engine.camera.cancelFlight();
|
||||||
const camera = engine.camera.pose();
|
const camera = engine.camera.pose();
|
||||||
|
const offset = (direction, metres) =>
|
||||||
|
geo.cartesian3.multiplyByScalar(
|
||||||
|
direction,
|
||||||
|
metres,
|
||||||
|
geo.cartesian3.create(),
|
||||||
|
);
|
||||||
|
// Halfway down to the ground along the view, so the trail is drawn in
|
||||||
|
// front of the surface on both engines rather than through it.
|
||||||
|
const below = geo.cartographic.fromCartesian(camera.position);
|
||||||
|
const clearance = below.height - (engine.surface.terrainHeight(below) ?? 0);
|
||||||
|
const distance = Math.min(
|
||||||
|
3000,
|
||||||
|
(0.5 * clearance) / Math.max(Math.sin(-camera.pitch), 0.05),
|
||||||
|
);
|
||||||
const ahead = geo.cartesian3.add(
|
const ahead = geo.cartesian3.add(
|
||||||
camera.position,
|
camera.position,
|
||||||
geo.cartesian3.multiplyByScalar(camera.direction, 3000),
|
offset(camera.direction, distance),
|
||||||
|
geo.cartesian3.create(),
|
||||||
);
|
);
|
||||||
const points = Array.from({ length: CHUNK_POINTS + 1 }, (_, index) =>
|
const points = Array.from({ length: CHUNK_POINTS + 1 }, (_, index) =>
|
||||||
geo.cartesian3.add(
|
geo.cartesian3.add(
|
||||||
ahead,
|
ahead,
|
||||||
geo.cartesian3.multiplyByScalar(
|
offset(camera.right, distance * (-0.4 + (0.8 * index) / CHUNK_POINTS)),
|
||||||
camera.right,
|
geo.cartesian3.create(),
|
||||||
-1200 + (2400 * index) / CHUNK_POINTS,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const gl =
|
const gl =
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ try {
|
|||||||
const url = new URL(base);
|
const url = new URL(base);
|
||||||
url.search = `?engine=${kind}&welcome=0`;
|
url.search = `?engine=${kind}&welcome=0`;
|
||||||
await page.goto(url.href, { waitUntil: 'domcontentloaded' });
|
await page.goto(url.href, { waitUntil: 'domcontentloaded' });
|
||||||
await waitForEngine(page);
|
await waitForEngine(page, kind);
|
||||||
await evaluateWithGeo(page, (geo) => {
|
await evaluateWithGeo(page, (geo) => {
|
||||||
window.__godsEyeView.engine.camera.setView({
|
window.__godsEyeView.engine.camera.setView({
|
||||||
destination: geo.cartesian3.fromDegrees(-79.38, 43.65, 500000),
|
destination: geo.cartesian3.fromDegrees(-79.38, 43.65, 500000),
|
||||||
|
|||||||
Reference in new issue
Block a user