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
Vendored
+36
-3
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* Full-screen effects: visual styles, bloom, sharpen and screen modulation.
|
||||
* Each style is a plain full-screen pass over the frame's colour, so every
|
||||
* renderer can provide the same set.
|
||||
* Each style is a plain full-screen pass over the frame's colour. The
|
||||
* application owns the styles and defines them on the renderer
|
||||
* renderer runs the same set; a renderer's own styles are extra ones.
|
||||
*/
|
||||
import type { Off } from './common';
|
||||
|
||||
@@ -13,6 +14,32 @@ export interface StyleDescriptor {
|
||||
animated: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* A style's shader. `glsl` is a GLSL ES 3.00 fragment shader with its
|
||||
* `main()`, as GEV's styles are written, without `#version`, `precision`
|
||||
* or an `out` declaration: the renderer declares `out_FragColor`, which it
|
||||
* writes. It declares what it reads of `uniform sampler2D colorTexture`,
|
||||
* `uniform vec2 colorTextureDimensions` (pixels),
|
||||
* `in vec2 v_textureCoordinates`, `uniform float intensity` (0..1),
|
||||
* `uniform float time` (seconds, for an animated style) and one
|
||||
* `uniform float` per parameter under its key. Parameter keys are GLSL
|
||||
* identifiers and never one of those names.
|
||||
* `wgsl` is the same pass in WGSL: a fragment entry
|
||||
* `fs_main` taking `@location(0) uv: vec2f` and returning the colour at
|
||||
* `@location(0)`. Group 0 binds `colorTexture` (`texture_2d<f32>`) at 0,
|
||||
* `colorSampler` at 1 and, at 2, a uniform struct the shader declares as
|
||||
* `params`: `intensity: f32`, `time: f32`, `dimensions: vec2f`, then one
|
||||
* `f32` per parameter in the order `params` lists them.
|
||||
*/
|
||||
export interface StyleShader {
|
||||
glsl: string;
|
||||
wgsl?: string;
|
||||
}
|
||||
|
||||
export interface StyleDefinition extends StyleDescriptor {
|
||||
shader: StyleShader;
|
||||
}
|
||||
|
||||
/** A sweeping sector drawn over the frame (a sonar band), or null. */
|
||||
export interface ModulationSector {
|
||||
/** Centre of the sweep, CSS pixels. */
|
||||
@@ -32,8 +59,14 @@ export interface EffectsDiagnostics {
|
||||
}
|
||||
|
||||
export interface EffectsPort {
|
||||
/** `styles`. */
|
||||
/** `styles`: every style, defined by the application or the renderer's own. */
|
||||
styles(): StyleDescriptor[];
|
||||
/**
|
||||
* `styles`: add a style, replacing one with the same id. Null without
|
||||
* the capability, or when the renderer runs none of the shader's
|
||||
* languages; the Off removes it (turning it off when it is the style).
|
||||
*/
|
||||
defineStyle(definition: StyleDefinition): Off | null;
|
||||
setStyle(id: string | null, params?: Record<string, number>): void;
|
||||
setStyleIntensity(id: string, intensity: number): void;
|
||||
setStyleParams(id: string, params: Record<string, number>): void;
|
||||
|
||||
Reference in new issue
Block a user