mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Settle leases, styles, credits and controls in the renderer contract
- claimPointer takes a grab filter, asked on each down: a lease takes
only the presses it grabs, and wheel, pinch and every other press stay
with the camera and everyone else. Each event of a press goes where its
down went, per button, so a claim never takes a press under way.
- The app owns the styles: effects.defineStyle passes a GLSL (and optionally
WGSL) full-screen pass, with the shader interface written out.
- Credits are plain data ({ text, href, logoUrl, inline }) that the app
renders; CreateOptions.creditContainer goes.
- controls.coast { drag, zoom } in seconds replaces the inertia trio; the
stub's defaults are the default renderer's, converted.
- The frame order is the default renderer's own: a move made by follow or
in preUpdate reaches changed on the next frame.
This commit is contained in:
1 parent
b7c26351f7
commit
a7aeeb558a
12 files changed
+591
-34
No files matched your search
@@ -111,6 +111,7 @@ export function createStubCamera({
|
||||
let moving = false;
|
||||
let lastMovedAt = 0;
|
||||
|
||||
let coast = Object.freeze({ drag: 0.4, zoom: 0.2 });
|
||||
const controls = {
|
||||
get enabled() {
|
||||
return holds.size === 0;
|
||||
@@ -125,9 +126,18 @@ export function createStubCamera({
|
||||
enableZoom: true,
|
||||
minDistance: 1,
|
||||
maxDistance: Infinity,
|
||||
inertiaSpin: 0.9,
|
||||
inertiaTranslate: 0.9,
|
||||
inertiaZoom: 0.8,
|
||||
// The default renderer's inertia as decay times: its speed falls as
|
||||
// exp(-25 (1 - c) t), so c = 0.9 (spin, which drags and tilts in 3D)
|
||||
// is 0.4 s and c = 0.8 (zoom) 0.2 s. Back: c = coast > 0 ? 1 - 1 / (25 coast) : 1.
|
||||
get coast() {
|
||||
return coast;
|
||||
},
|
||||
set coast(value) {
|
||||
for (const key of ['drag', 'zoom'])
|
||||
if (!(Number.isFinite(value?.[key]) && value[key] >= 0))
|
||||
throw new TypeError(`coast.${key} must be seconds, 0 or more`);
|
||||
coast = Object.freeze({ drag: value.drag, zoom: value.zoom });
|
||||
},
|
||||
collision: 'none',
|
||||
zoomFactor: 5,
|
||||
pitchRange: [-Math.PI / 2, 0],
|
||||
|
||||
Reference in new issue
Block a user