mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(globe): picks on input payloads
input.on('click'|'doubleClick'|'move', fn, { pick, drill }) delivers
{ …event, picked, drilled }: PickResult { id, owner, instance, primitive
(Cesium) } names the mover set (and instance) or line hit. One pick (and
one drill, as deep as the deepest listener) per event, shared by its
listeners; moves with picks are coalesced to one delivery per frame with
the latest position (src/globe/pickDelivery.js). Option checks in the
contract (normalizeInputOptions).
- Cesium: scene.pick / drillPick, and the picker names the owner: movers
map billboards, points and models to their set and instance, lines
their primitives to the line.
- Navara: a click with pick takes Navara's GPU pick of the same gesture
(featureClick; its pick helper answers on the same pointerup, usually
before the engine's click, so a fresh answer waits for it; otherwise
the click waits up to 250 ms, then the CPU pick). Navara 0.2.1 answers
clicks in quick succession with the first click's pick: a GPU answer
whose instance is not drawn near the click is stale and the CPU pick
answers. Hover, drill and the synchronous picker.pick/drillPick are CPU
picks (src/globe/cpuPicks.js) of pickable mover sets and pickable lines
(within half the width + 3 px), behind the globe excluded, nearest
first; lines are picked on the CPU after an empty GPU answer.
picker.clickStats() (Navara only) counts the answers and latencies.
- The fake engine picks its own movers and lines on the CPU unless
scripted.
- The contract suite clicks with real pointer events (puppeteer) on both
engines: a sprite is picked with its owner and instance, the map picks
nothing, two sprites in one place drill both, a line is picked, a
hover picks the sprite under it. Navara, 20 clicks: payload p50 2.8 ms,
p95 4.1 ms after the click (puppeteer dispatch included), 20/20 GPU
answers. The Cesium harness keeps the first-run card closed.
This commit is contained in:
1 parent
86aa0bc9ba
commit
b0cb8ce881
26 files changed
+1267
-68
No files matched your search
@@ -47,16 +47,24 @@ export function createNavaraLines(view) {
|
||||
registered.add(view);
|
||||
}
|
||||
const request = () => view.forceUpdate();
|
||||
// What CPU picks need of each line: its drawn positions and matrix.
|
||||
const drawn = new Map();
|
||||
const registry = createLineRegistry((options) => {
|
||||
const line = createLineMesh(options);
|
||||
const state = {
|
||||
options,
|
||||
flat: new Float64Array(0),
|
||||
modelMatrix: options.modelMatrix,
|
||||
shown: true,
|
||||
};
|
||||
drawn.set(options.id, state);
|
||||
const canvas = view.canvas;
|
||||
if (canvas) line.update(canvas.clientWidth || 1, canvas.clientHeight || 1);
|
||||
const handle = view.addMesh({ lit: false, [DESC_NAME]: { line } });
|
||||
return {
|
||||
setPositions(flat) {
|
||||
line.setPositions(
|
||||
options.arc === 'geodesic' ? densifyGeodesic(flat) : flat,
|
||||
);
|
||||
state.flat = options.arc === 'geodesic' ? densifyGeodesic(flat) : flat;
|
||||
line.setPositions(state.flat);
|
||||
request();
|
||||
},
|
||||
setColor(rgba) {
|
||||
@@ -64,18 +72,29 @@ export function createNavaraLines(view) {
|
||||
request();
|
||||
},
|
||||
setModelMatrix(matrix) {
|
||||
state.modelMatrix = matrix;
|
||||
line.setModelMatrix(matrix);
|
||||
request();
|
||||
},
|
||||
show(visible) {
|
||||
state.shown = visible;
|
||||
line.show(visible);
|
||||
request();
|
||||
},
|
||||
destroy() {
|
||||
drawn.delete(options.id);
|
||||
handle.delete();
|
||||
request();
|
||||
},
|
||||
};
|
||||
});
|
||||
return { lines: registry.lines, destroy: () => registry.destroyAll() };
|
||||
return {
|
||||
lines: registry.lines,
|
||||
/** Shown lines with a pickId: options, drawn positions, matrix. */
|
||||
pickables: () =>
|
||||
[...drawn.values()].filter(
|
||||
(state) => state.shown && state.options.pickId !== undefined,
|
||||
),
|
||||
destroy: () => registry.destroyAll(),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user