mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(render): the Cesium renderer passes every conformance check a page can run
- Cesium's own tweens (its flights) step on the renderer's clock, so the flight traces compare frame by frame; dispose gives the scene its own clock back. - moveStart and moveEnd are measured each tick on that clock, by the shared move detection, a change of the field of view or aspect included; Cesium's own events timed them by the system clock. - A follow of a drawn item tracks where the draw port draws it. - Pick rays are summed from the eye's axes: Cesium's lose about 1e-9 of direction at a near plane of 0.1 m. Ellipsoid picks and the view rectangle use them; a canvas with no size has none, as in Cesium. - The harness always runs the virtual clock and claims 120 checks: 119 pass on the page and query.heights skips. The five pointer traces need a camera controller there, and are recorded from Cesium's own controller in Node. - The package boundaries list the cesium plugin export and the modules its groups now import.
This commit is contained in:
1 parent
720932e1f9
commit
e9085e8df3
13 files changed
+545
-95
No files matched your search
@@ -27,6 +27,7 @@
|
||||
*/
|
||||
import * as Cesium from 'cesium';
|
||||
import { acquireCameraInput } from './cameraInput.js';
|
||||
import { sameEye } from './common.js';
|
||||
|
||||
/**
|
||||
* The input port's events for a controller made before the port: listeners
|
||||
@@ -57,31 +58,6 @@ function inputRelay() {
|
||||
|
||||
const plain = (v) => ({ x: v.x, y: v.y, z: v.z });
|
||||
|
||||
/**
|
||||
* How far Cesium's camera may stand from the eye last written and still be
|
||||
* that eye: its world vectors are derived again in floating point (a unit
|
||||
* vector's component off by 2e-16 now and then), and the controller counts
|
||||
* any difference as a move, which would put off `moveEnd` with nothing
|
||||
* moving. Metres per metre of distance from the Earth's centre, and the
|
||||
* cosine's shortfall from 1 for the unit vectors.
|
||||
*/
|
||||
const ROUNDING = 1e-12;
|
||||
|
||||
/** Whether Cesium's `world` vectors are the `written` eye, up to rounding. */
|
||||
function sameEye(world, written) {
|
||||
const p = world.position;
|
||||
const q = written.position;
|
||||
const scale = Math.max(1, Math.hypot(q.x, q.y, q.z));
|
||||
if (Math.hypot(p.x - q.x, p.y - q.y, p.z - q.z) > ROUNDING * scale)
|
||||
return false;
|
||||
for (const key of ['direction', 'up']) {
|
||||
const a = world[key];
|
||||
const b = written[key];
|
||||
if (a.x * b.x + a.y * b.y + a.z * b.z < 1 - ROUNDING) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* scene: object,
|
||||
|
||||
Reference in new issue
Block a user