layershift 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/components/layershift.js +1783 -654
- package/dist/npm/layershift.es.js +5154 -2569
- package/dist/types/components/layershift/layershift-element.d.ts +2 -1
- package/dist/types/components/layershift/layershift-element.d.ts.map +1 -1
- package/dist/types/components/layershift/portal-element.d.ts +2 -1
- package/dist/types/components/layershift/portal-element.d.ts.map +1 -1
- package/dist/types/components/layershift/types.d.ts +8 -0
- package/dist/types/components/layershift/types.d.ts.map +1 -1
- package/dist/types/gpu-backend.d.ts +37 -0
- package/dist/types/gpu-backend.d.ts.map +1 -0
- package/dist/types/jfa-distance-field.d.ts +78 -0
- package/dist/types/jfa-distance-field.d.ts.map +1 -0
- package/dist/types/parallax-renderer-webgpu.d.ts +103 -0
- package/dist/types/parallax-renderer-webgpu.d.ts.map +1 -0
- package/dist/types/parallax-renderer.d.ts +54 -91
- package/dist/types/parallax-renderer.d.ts.map +1 -1
- package/dist/types/portal-renderer-webgpu.d.ts +199 -0
- package/dist/types/portal-renderer-webgpu.d.ts.map +1 -0
- package/dist/types/portal-renderer.d.ts +63 -65
- package/dist/types/portal-renderer.d.ts.map +1 -1
- package/dist/types/precomputed-depth.d.ts +9 -51
- package/dist/types/precomputed-depth.d.ts.map +1 -1
- package/dist/types/quality.d.ts +95 -0
- package/dist/types/quality.d.ts.map +1 -0
- package/dist/types/render-pass-webgpu.d.ts +76 -0
- package/dist/types/render-pass-webgpu.d.ts.map +1 -0
- package/dist/types/render-pass.d.ts +171 -0
- package/dist/types/render-pass.d.ts.map +1 -0
- package/dist/types/renderer-base.d.ts +124 -0
- package/dist/types/renderer-base.d.ts.map +1 -0
- package/dist/types/webgl-utils.d.ts +29 -0
- package/dist/types/webgl-utils.d.ts.map +1 -0
- package/dist/types/webgpu-utils.d.ts +42 -0
- package/dist/types/webgpu-utils.d.ts.map +1 -0
- package/package.json +24 -4
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGPU Render Pass Framework — pipeline and bind group management.
|
|
3
|
+
*
|
|
4
|
+
* Parallel to `render-pass.ts` (WebGL2) but with idiomatic WebGPU patterns:
|
|
5
|
+
* - Pipeline state objects bake blend/stencil/depth config at creation
|
|
6
|
+
* - Bind groups replace individual uniform calls
|
|
7
|
+
* - No mutable state machine
|
|
8
|
+
*
|
|
9
|
+
* @see render-pass.ts for the WebGL2 counterpart.
|
|
10
|
+
*/
|
|
11
|
+
/** A single WebGPU render pass with its pipeline and bind group layout. */
|
|
12
|
+
export interface WebGPURenderPass {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly pipeline: GPURenderPipeline;
|
|
15
|
+
readonly bindGroupLayout: GPUBindGroupLayout;
|
|
16
|
+
dispose(): void;
|
|
17
|
+
}
|
|
18
|
+
/** A WebGPU render pass that outputs to an offscreen texture. */
|
|
19
|
+
export interface WebGPUFBOPass extends WebGPURenderPass {
|
|
20
|
+
outputTexture: GPUTexture;
|
|
21
|
+
outputView: GPUTextureView;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
resize(device: GPUDevice, w: number, h: number, format?: GPUTextureFormat): void;
|
|
25
|
+
}
|
|
26
|
+
/** Configuration for creating a WebGPU render pass. */
|
|
27
|
+
export interface WebGPURenderPassConfig {
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly vertexShader: string;
|
|
30
|
+
readonly fragmentShader: string;
|
|
31
|
+
readonly vertexBufferLayouts: GPUVertexBufferLayout[];
|
|
32
|
+
readonly colorTargets: GPUColorTargetState[];
|
|
33
|
+
readonly depthStencil?: GPUDepthStencilState;
|
|
34
|
+
readonly primitive?: GPUPrimitiveState;
|
|
35
|
+
/** Explicit bind group layout entries. If omitted, uses auto layout. */
|
|
36
|
+
readonly bindGroupLayoutEntries?: GPUBindGroupLayoutEntry[];
|
|
37
|
+
}
|
|
38
|
+
/** Configuration for creating a WebGPU FBO pass. */
|
|
39
|
+
export interface WebGPUFBOPassConfig extends WebGPURenderPassConfig {
|
|
40
|
+
readonly outputWidth: number;
|
|
41
|
+
readonly outputHeight: number;
|
|
42
|
+
readonly outputFormat?: GPUTextureFormat;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create a WebGPU render pass with explicit bind group layout.
|
|
46
|
+
*/
|
|
47
|
+
export declare function createWebGPUPass(device: GPUDevice, config: WebGPURenderPassConfig): WebGPURenderPass;
|
|
48
|
+
/**
|
|
49
|
+
* Create a WebGPU FBO pass that renders to an offscreen texture.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createWebGPUFBOPass(device: GPUDevice, config: WebGPUFBOPassConfig): WebGPUFBOPass;
|
|
52
|
+
/**
|
|
53
|
+
* Shared texture registry for WebGPU — manages texture unit allocation.
|
|
54
|
+
*
|
|
55
|
+
* Unlike WebGL2, WebGPU doesn't have numbered texture units. Instead,
|
|
56
|
+
* textures are referenced by bind group entries. This registry provides
|
|
57
|
+
* a consistent naming scheme across passes.
|
|
58
|
+
*/
|
|
59
|
+
export declare class WebGPUTextureRegistry {
|
|
60
|
+
private readonly textures;
|
|
61
|
+
register(name: string, texture: GPUTexture): GPUTextureView;
|
|
62
|
+
get(name: string): {
|
|
63
|
+
texture: GPUTexture;
|
|
64
|
+
view: GPUTextureView;
|
|
65
|
+
} | undefined;
|
|
66
|
+
dispose(): void;
|
|
67
|
+
}
|
|
68
|
+
/** Fullscreen quad vertex buffer layout: position (vec2). */
|
|
69
|
+
export declare const FULLSCREEN_QUAD_LAYOUT: GPUVertexBufferLayout;
|
|
70
|
+
/** Mesh vertex buffer layout: position (vec2) only. */
|
|
71
|
+
export declare const MESH_POSITION_LAYOUT: GPUVertexBufferLayout;
|
|
72
|
+
/** Boundary vertex buffer layout: position (vec2) + normal (vec2). */
|
|
73
|
+
export declare const BOUNDARY_VERTEX_LAYOUT: GPUVertexBufferLayout;
|
|
74
|
+
/** Chamfer vertex buffer layout: position (vec2) + normal3 (vec3) + lerpT (float). */
|
|
75
|
+
export declare const CHAMFER_VERTEX_LAYOUT: GPUVertexBufferLayout;
|
|
76
|
+
//# sourceMappingURL=render-pass-webgpu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-pass-webgpu.d.ts","sourceRoot":"","sources":["../../src/render-pass-webgpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,2EAA2E;AAC3E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,eAAe,EAAE,kBAAkB,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,aAAa,EAAE,UAAU,CAAC;IAC1B,UAAU,EAAE,cAAc,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAClF;AAED,uDAAuD;AACvD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,mBAAmB,EAAE,qBAAqB,EAAE,CAAC;IACtD,QAAQ,CAAC,YAAY,EAAE,mBAAmB,EAAE,CAAC;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;IAC7C,QAAQ,CAAC,SAAS,CAAC,EAAE,iBAAiB,CAAC;IACvC,wEAAwE;IACxE,QAAQ,CAAC,sBAAsB,CAAC,EAAE,uBAAuB,EAAE,CAAC;CAC7D;AAED,oDAAoD;AACpD,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,sBAAsB,GAC7B,gBAAgB,CAqClB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,mBAAmB,GAC1B,aAAa,CA4Bf;AAMD;;;;;;GAMG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoE;IAE7F,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,cAAc;IAM3D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,UAAU,CAAC;QAAC,IAAI,EAAE,cAAc,CAAA;KAAE,GAAG,SAAS;IAI5E,OAAO,IAAI,IAAI;CAMhB;AAuBD,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,EAAE,qBAKpC,CAAC;AAEF,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,EAAE,qBAKlC,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,EAAE,qBAMpC,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,qBAAqB,EAAE,qBAOnC,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared render pass framework for compositing and effect stacking.
|
|
3
|
+
*
|
|
4
|
+
* Provides standardized interfaces (`RenderPass`, `FBOPass`) and a
|
|
5
|
+
* `TextureRegistry` for unit allocation. Both the parallax and portal
|
|
6
|
+
* renderers adopt this framework to structure their multi-pass GPU
|
|
7
|
+
* pipelines consistently.
|
|
8
|
+
*
|
|
9
|
+
* ## Design principles
|
|
10
|
+
*
|
|
11
|
+
* - **Geometry-agnostic** — passes may use fullscreen quads, indexed
|
|
12
|
+
* meshes, or any other geometry. The framework doesn't assume.
|
|
13
|
+
* - **No common execute()** — passes have wildly different execute
|
|
14
|
+
* signatures (bilateral needs raw depth data; JFA flood is iterative;
|
|
15
|
+
* parallax just draws). Each renderer calls passes type-safely.
|
|
16
|
+
* - **Zero per-frame overhead** — TextureRegistry allocates at init
|
|
17
|
+
* time. Hot-path code reads slot references directly.
|
|
18
|
+
* - **Pragmatic** — ~250 lines, not a game engine.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* A self-contained render pass: owns its shader program, uniform cache,
|
|
22
|
+
* and knows how to clean itself up.
|
|
23
|
+
*
|
|
24
|
+
* `program` and `uniforms` are exposed directly so the render loop can
|
|
25
|
+
* set per-frame uniforms (e.g., `uOffset`) without method-call overhead.
|
|
26
|
+
*/
|
|
27
|
+
export interface RenderPass {
|
|
28
|
+
/** Display name for debugging (e.g., "bilateral-filter", "jfa-flood"). */
|
|
29
|
+
readonly name: string;
|
|
30
|
+
/** The compiled + linked shader program. */
|
|
31
|
+
readonly program: WebGLProgram;
|
|
32
|
+
/** Cached uniform locations. */
|
|
33
|
+
readonly uniforms: Record<string, WebGLUniformLocation | null>;
|
|
34
|
+
/** Release GPU resources owned by this pass (program, FBOs). */
|
|
35
|
+
dispose(gl: WebGL2RenderingContext): void;
|
|
36
|
+
}
|
|
37
|
+
/** A single FBO color attachment descriptor. */
|
|
38
|
+
export interface FBOAttachment {
|
|
39
|
+
/** The texture backing this attachment. */
|
|
40
|
+
texture: WebGLTexture;
|
|
41
|
+
/** Assigned texture unit (e.g., `gl.TEXTURE2` maps to unit 2). */
|
|
42
|
+
unit: number;
|
|
43
|
+
/** GL color attachment point (e.g., `gl.COLOR_ATTACHMENT0`). */
|
|
44
|
+
attachment: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A render pass that writes to an FBO rather than the default framebuffer.
|
|
48
|
+
*
|
|
49
|
+
* Manages its own framebuffer and output texture(s). Supports both
|
|
50
|
+
* single-output passes (bilateral filter → R8) and MRT passes
|
|
51
|
+
* (portal interior → RGBA8 color + RGBA8 depth).
|
|
52
|
+
*/
|
|
53
|
+
export interface FBOPass extends RenderPass {
|
|
54
|
+
/** The framebuffer object. Null before first `resize()`. */
|
|
55
|
+
fbo: WebGLFramebuffer | null;
|
|
56
|
+
/** Output textures written by this pass. */
|
|
57
|
+
readonly outputs: readonly FBOAttachment[];
|
|
58
|
+
/** Width of the FBO in pixels. */
|
|
59
|
+
width: number;
|
|
60
|
+
/** Height of the FBO in pixels. */
|
|
61
|
+
height: number;
|
|
62
|
+
/**
|
|
63
|
+
* Resize or recreate the FBO and its attachment textures.
|
|
64
|
+
* Called on viewport resize, not per-frame.
|
|
65
|
+
*/
|
|
66
|
+
resize(gl: WebGL2RenderingContext, width: number, height: number): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Ordered list of render passes. Execute in array order.
|
|
70
|
+
*
|
|
71
|
+
* This is intentionally a thin type alias, not a class. The dual-loop
|
|
72
|
+
* architecture (RVFC + RAF) means passes are NOT all executed in one
|
|
73
|
+
* sequence, so orchestration stays in each renderer's render loop.
|
|
74
|
+
*/
|
|
75
|
+
export type RenderPipeline = readonly RenderPass[];
|
|
76
|
+
/** A named texture with its assigned unit. */
|
|
77
|
+
export interface TextureSlot {
|
|
78
|
+
/** Human-readable name (e.g., "video", "filteredDepth"). */
|
|
79
|
+
readonly name: string;
|
|
80
|
+
/** Assigned texture unit number (0, 1, 2, ...). */
|
|
81
|
+
readonly unit: number;
|
|
82
|
+
/** The WebGL texture handle. Null until allocated. */
|
|
83
|
+
texture: WebGLTexture | null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Tracks texture unit assignments for a renderer.
|
|
87
|
+
*
|
|
88
|
+
* All allocation happens at init time via `register()`. The hot-path
|
|
89
|
+
* render loop accesses slots directly by cached reference — no map
|
|
90
|
+
* lookups per frame.
|
|
91
|
+
*
|
|
92
|
+
* Usage:
|
|
93
|
+
* ```ts
|
|
94
|
+
* const textures = new TextureRegistry();
|
|
95
|
+
* const videoSlot = textures.register('video'); // unit 0
|
|
96
|
+
* const depthSlot = textures.register('filteredDepth'); // unit 1
|
|
97
|
+
*
|
|
98
|
+
* // In render loop (hot path) — direct reference, zero lookup:
|
|
99
|
+
* gl.activeTexture(gl.TEXTURE0 + videoSlot.unit);
|
|
100
|
+
* gl.bindTexture(gl.TEXTURE_2D, videoSlot.texture);
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare class TextureRegistry {
|
|
104
|
+
private readonly slots;
|
|
105
|
+
private nextUnit;
|
|
106
|
+
/**
|
|
107
|
+
* Reserve a texture unit for a named texture.
|
|
108
|
+
*
|
|
109
|
+
* @returns The `TextureSlot` — hold a reference for hot-path access.
|
|
110
|
+
* @throws If the name is already registered.
|
|
111
|
+
*/
|
|
112
|
+
register(name: string): TextureSlot;
|
|
113
|
+
/**
|
|
114
|
+
* Get a previously registered slot by name.
|
|
115
|
+
*
|
|
116
|
+
* @throws If the name was not registered.
|
|
117
|
+
*/
|
|
118
|
+
get(name: string): TextureSlot;
|
|
119
|
+
/** Delete all textures and reset slots to null. */
|
|
120
|
+
disposeAll(gl: WebGL2RenderingContext): void;
|
|
121
|
+
/** Number of registered slots. */
|
|
122
|
+
get size(): number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Create a `RenderPass` from vertex/fragment shader source.
|
|
126
|
+
*
|
|
127
|
+
* Compiles shaders, links program, caches uniform locations.
|
|
128
|
+
* The returned pass owns its program and cleans it up on `dispose()`.
|
|
129
|
+
*/
|
|
130
|
+
export declare function createPass(gl: WebGL2RenderingContext, name: string, vertexSource: string, fragmentSource: string, uniformNames: readonly string[]): RenderPass;
|
|
131
|
+
/** Options for creating a single-output FBO pass. */
|
|
132
|
+
export interface FBOPassOptions {
|
|
133
|
+
/** GL internal format (e.g., `gl.R8`, `gl.RGBA8`, `gl.RG16F`). */
|
|
134
|
+
internalFormat: number;
|
|
135
|
+
/** GL format for texImage2D (e.g., `gl.RED`, `gl.RGBA`, `gl.RG`). */
|
|
136
|
+
format: number;
|
|
137
|
+
/** GL type for texImage2D (e.g., `gl.UNSIGNED_BYTE`, `gl.FLOAT`). */
|
|
138
|
+
type: number;
|
|
139
|
+
/** Texture unit to assign to the output texture. */
|
|
140
|
+
textureUnit: number;
|
|
141
|
+
/** Initial FBO width. */
|
|
142
|
+
width: number;
|
|
143
|
+
/** Initial FBO height. */
|
|
144
|
+
height: number;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Create an `FBOPass` with a single color attachment.
|
|
148
|
+
*
|
|
149
|
+
* The FBO and its output texture are created immediately at the given
|
|
150
|
+
* dimensions. Call `resize()` to recreate at a different size.
|
|
151
|
+
*/
|
|
152
|
+
export declare function createFBOPass(gl: WebGL2RenderingContext, name: string, vertexSource: string, fragmentSource: string, uniformNames: readonly string[], options: FBOPassOptions): FBOPass;
|
|
153
|
+
/** Descriptor for one MRT color attachment. */
|
|
154
|
+
export interface MRTAttachment {
|
|
155
|
+
/** GL internal format (e.g., `gl.RGBA8`). */
|
|
156
|
+
internalFormat: number;
|
|
157
|
+
/** GL format (e.g., `gl.RGBA`). */
|
|
158
|
+
format: number;
|
|
159
|
+
/** GL type (e.g., `gl.UNSIGNED_BYTE`). */
|
|
160
|
+
type: number;
|
|
161
|
+
/** Texture unit to assign. */
|
|
162
|
+
textureUnit: number;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Create an `FBOPass` with multiple color attachments (MRT).
|
|
166
|
+
*
|
|
167
|
+
* Used by the portal interior pass which writes both color and depth
|
|
168
|
+
* to separate textures in a single draw call via `gl.drawBuffers()`.
|
|
169
|
+
*/
|
|
170
|
+
export declare function createMRTPass(gl: WebGL2RenderingContext, name: string, vertexSource: string, fragmentSource: string, uniformNames: readonly string[], attachments: readonly MRTAttachment[], width: number, height: number): FBOPass;
|
|
171
|
+
//# sourceMappingURL=render-pass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-pass.d.ts","sourceRoot":"","sources":["../../src/render-pass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAYH;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAE/B,gCAAgC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAE/D,gEAAgE;IAChE,OAAO,CAAC,EAAE,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAC3C;AAED,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,OAAO,EAAE,YAAY,CAAC;IAEtB,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IAEb,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,OAAQ,SAAQ,UAAU;IACzC,4DAA4D;IAC5D,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE7B,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAE3C,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IAEd,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACzE;AAED;;;;;;GAMG;A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B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,OAAO,EAAE,cAAc,GACtB,OAAO,CA4ET;AAED,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,cAAc,EAAE,MAAM,CAAC;IAEvB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IAEf,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IAEb,8BAA8B;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,sBAAsB,EAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,WAAW,EAAE,SAAS,aAAa,EAAE,EACrC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,OAAO,CA4FT"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base class for Layershift renderers.
|
|
3
|
+
*
|
|
4
|
+
* Extracts shared non-GPU logic common to both the parallax and portal
|
|
5
|
+
* renderers (and their future WebGPU counterparts):
|
|
6
|
+
*
|
|
7
|
+
* - Canvas creation + container attachment
|
|
8
|
+
* - Dual-loop animation management (RVFC + RAF)
|
|
9
|
+
* - Resize handling with debounce
|
|
10
|
+
* - Depth dimension clamping + CPU subsampling
|
|
11
|
+
* - Cover-fit UV computation
|
|
12
|
+
* - WebGL context loss handling
|
|
13
|
+
*
|
|
14
|
+
* Subclasses implement the GPU-specific abstract methods:
|
|
15
|
+
* `onRenderFrame()`, `onDepthUpdate()`, `recalculateViewportLayout()`,
|
|
16
|
+
* `disposeRenderer()`, and `onContextRestored()`.
|
|
17
|
+
*/
|
|
18
|
+
import type { ParallaxInput } from './input-handler';
|
|
19
|
+
import type { QualityParams } from './quality';
|
|
20
|
+
export declare abstract class RendererBase {
|
|
21
|
+
protected static readonly RESIZE_DEBOUNCE_MS = 100;
|
|
22
|
+
protected readonly canvas: HTMLCanvasElement;
|
|
23
|
+
protected readonly container: HTMLElement;
|
|
24
|
+
/** GPU texture dimensions (may be clamped by quality tier). */
|
|
25
|
+
protected depthWidth: number;
|
|
26
|
+
protected depthHeight: number;
|
|
27
|
+
/** Original source depth dimensions (from precomputed data). */
|
|
28
|
+
protected sourceDepthWidth: number;
|
|
29
|
+
protected sourceDepthHeight: number;
|
|
30
|
+
/** Reusable buffer for subsampling depth data when GPU dims < source dims. */
|
|
31
|
+
protected depthSubsampleBuffer: Uint8Array | null;
|
|
32
|
+
protected videoAspect: number;
|
|
33
|
+
protected uvOffset: number[];
|
|
34
|
+
protected uvScale: number[];
|
|
35
|
+
protected readDepth: ((timeSec: number) => Uint8Array) | null;
|
|
36
|
+
protected readInput: (() => ParallaxInput) | null;
|
|
37
|
+
protected playbackVideo: HTMLVideoElement | null;
|
|
38
|
+
/**
|
|
39
|
+
* Optional callback invoked on each new video frame (from RVFC).
|
|
40
|
+
* The Web Component uses this to dispatch frame events.
|
|
41
|
+
*/
|
|
42
|
+
protected onVideoFrame: ((currentTime: number, frameNumber: number) => void) | null;
|
|
43
|
+
protected animationFrameHandle: number;
|
|
44
|
+
/** requestVideoFrameCallback handle (0 = inactive). */
|
|
45
|
+
protected rvfcHandle: number;
|
|
46
|
+
/** Whether RVFC is supported on the current video element. */
|
|
47
|
+
protected rvfcSupported: boolean;
|
|
48
|
+
protected resizeObserver: ResizeObserver | null;
|
|
49
|
+
protected resizeTimer: number | null;
|
|
50
|
+
/** Adaptive quality parameters. Set by subclass constructor after GL init. */
|
|
51
|
+
protected qualityParams: QualityParams;
|
|
52
|
+
constructor(parent: HTMLElement);
|
|
53
|
+
/**
|
|
54
|
+
* Begin the render loop.
|
|
55
|
+
*
|
|
56
|
+
* When `requestVideoFrameCallback` is available, two loops run:
|
|
57
|
+
* 1. RVFC loop — fires once per new video frame, handles depth update.
|
|
58
|
+
* 2. RAF loop — fires at display refresh rate, handles input + render.
|
|
59
|
+
*
|
|
60
|
+
* When RVFC is not available, falls back to a single RAF loop.
|
|
61
|
+
*/
|
|
62
|
+
start(video: HTMLVideoElement, readDepth: (timeSec: number) => Uint8Array, readInput: () => ParallaxInput, onVideoFrame?: (currentTime: number, frameNumber: number) => void): void;
|
|
63
|
+
/** Stop both render loops and release callbacks. */
|
|
64
|
+
stop(): void;
|
|
65
|
+
/** Stop rendering and release all GPU resources. */
|
|
66
|
+
dispose(): void;
|
|
67
|
+
/** Check whether requestVideoFrameCallback is available. */
|
|
68
|
+
protected static isRVFCSupported(): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* RAF loop — fires at display refresh rate.
|
|
71
|
+
* Delegates to subclass `onRenderFrame()` for the actual render work.
|
|
72
|
+
*/
|
|
73
|
+
private readonly _rafLoop;
|
|
74
|
+
/**
|
|
75
|
+
* RVFC callback — fires only when the browser presents a new video frame.
|
|
76
|
+
* Delegates to subclass `onDepthUpdate()` for depth texture upload.
|
|
77
|
+
*/
|
|
78
|
+
private readonly _videoFrameLoop;
|
|
79
|
+
private readonly _handleContextLost;
|
|
80
|
+
private readonly _handleContextRestored;
|
|
81
|
+
/**
|
|
82
|
+
* Set up a ResizeObserver on the container element and a fallback
|
|
83
|
+
* window resize listener. Called by subclass after GPU init.
|
|
84
|
+
*/
|
|
85
|
+
protected setupResizeHandling(): void;
|
|
86
|
+
/** Debounce resize events to avoid expensive layout recalculations. */
|
|
87
|
+
protected readonly scheduleResizeRecalculate: () => void;
|
|
88
|
+
/** Read the container's pixel dimensions, with a minimum of 1x1. */
|
|
89
|
+
protected getViewportSize(): {
|
|
90
|
+
width: number;
|
|
91
|
+
height: number;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Clamp depth dimensions to the quality tier's maximum and allocate
|
|
95
|
+
* the subsample buffer if needed. Called during `initialize()`.
|
|
96
|
+
*/
|
|
97
|
+
protected clampDepthDimensions(sourceWidth: number, sourceHeight: number, maxDim: number): void;
|
|
98
|
+
/**
|
|
99
|
+
* CPU nearest-neighbor depth subsampling.
|
|
100
|
+
*
|
|
101
|
+
* Returns the original data if no subsampling is needed, otherwise
|
|
102
|
+
* fills and returns the pre-allocated subsample buffer.
|
|
103
|
+
*/
|
|
104
|
+
protected subsampleDepth(depthData: Uint8Array): Uint8Array;
|
|
105
|
+
/**
|
|
106
|
+
* Compute cover-fit + overscan UV transform.
|
|
107
|
+
*
|
|
108
|
+
* The video fills the viewport (cover-fit), and overscan adds extra
|
|
109
|
+
* visible area so parallax displacement doesn't reveal edges.
|
|
110
|
+
* Updates `this.uvOffset` and `this.uvScale`.
|
|
111
|
+
*/
|
|
112
|
+
protected computeCoverFitUV(parallaxStrength: number, overscanPadding: number): void;
|
|
113
|
+
/** Main render frame logic (called from RAF loop at display refresh rate). */
|
|
114
|
+
protected abstract onRenderFrame(): void;
|
|
115
|
+
/** Depth texture upload + filter (called from RVFC loop at video frame rate). */
|
|
116
|
+
protected abstract onDepthUpdate(timeSec: number): void;
|
|
117
|
+
/** Recalculate canvas size, FBOs, UV transform on resize. */
|
|
118
|
+
protected abstract recalculateViewportLayout(): void;
|
|
119
|
+
/** Release all GPU resources (called from dispose()). */
|
|
120
|
+
protected abstract disposeRenderer(): void;
|
|
121
|
+
/** Rebuild GPU state after context restoration. */
|
|
122
|
+
protected abstract onContextRestored(): void;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=renderer-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-base.d.ts","sourceRoot":"","sources":["../../src/renderer-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAM/C,8BAAs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MAAM,GAAG,IAAI;IAEvD,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,CAAC,yBAAyB,IAAI,IAAI;IAEpD,yDAAyD;IACzD,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,IAAI;IAE1C,mDAAmD;IACnD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,IAAI;CAC7C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared WebGL 2 utilities — compile, link, uniform caching, fullscreen quad.
|
|
3
|
+
*
|
|
4
|
+
* Used by both the parallax renderer and the portal renderer to avoid
|
|
5
|
+
* duplicating boilerplate GL setup code.
|
|
6
|
+
*/
|
|
7
|
+
/** Compile a GLSL shader, throwing on error. */
|
|
8
|
+
export declare function compileShader(gl: WebGL2RenderingContext, type: number, source: string): WebGLShader;
|
|
9
|
+
/** Link a shader program, throwing on error. */
|
|
10
|
+
export declare function linkProgram(gl: WebGL2RenderingContext, vertShader: WebGLShader, fragShader: WebGLShader): WebGLProgram;
|
|
11
|
+
/**
|
|
12
|
+
* Cache uniform locations for a set of uniform names.
|
|
13
|
+
*
|
|
14
|
+
* Returns a record mapping each name to its `WebGLUniformLocation | null`.
|
|
15
|
+
* Avoids repeated `getUniformLocation` calls per frame.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getUniformLocations(gl: WebGL2RenderingContext, program: WebGLProgram, names: readonly string[]): Record<string, WebGLUniformLocation | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a VAO for the standard fullscreen quad.
|
|
20
|
+
*
|
|
21
|
+
* The VAO binds a VBO with 4 clip-space vertices to the `aPosition`
|
|
22
|
+
* attribute (looked up from the given program). Draw with
|
|
23
|
+
* `gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4)`.
|
|
24
|
+
*
|
|
25
|
+
* @param gl - WebGL 2 context
|
|
26
|
+
* @param program - Shader program to look up `aPosition` attribute location
|
|
27
|
+
*/
|
|
28
|
+
export declare function createFullscreenQuadVao(gl: WebGL2RenderingContext, program: WebGLProgram): WebGLVertexArrayObject;
|
|
29
|
+
//# sourceMappingURL=webgl-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-utils.d.ts","sourceRoot":"","sources":["../../src/webgl-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,gDAAgD;AAChD,wBAAgB,aAAa,CAC3B,EAAE,EAAE,sBAAsB,EAC1B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,WAAW,CAWb;AAED,gDAAgD;AAChD,wBAAgB,WAAW,CACzB,EAAE,EAAE,sBAAsB,EAC1B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,WAAW,GACtB,YAAY,CAiBd;AAMD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,sBAAsB,EAC1B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAC,CAM7C;AAiBD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,sBAAsB,EAC1B,OAAO,EAAE,YAAY,GACpB,sBAAsB,CAiBxB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGPU Utilities — shared helpers for WebGPU renderers.
|
|
3
|
+
*
|
|
4
|
+
* Parallel to `webgl-utils.ts` but for the WebGPU backend.
|
|
5
|
+
* Provides buffer creation, sampler factories, and fullscreen quad geometry.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Create a GPU buffer containing a fullscreen quad (triangle strip, 4 vertices).
|
|
9
|
+
*/
|
|
10
|
+
export declare function createFullscreenQuadBuffer(device: GPUDevice): GPUBuffer;
|
|
11
|
+
/**
|
|
12
|
+
* Create a GPU vertex buffer from Float32Array data.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createVertexBuffer(device: GPUDevice, data: Float32Array): GPUBuffer;
|
|
15
|
+
/**
|
|
16
|
+
* Create a GPU index buffer from Uint16Array data.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createIndexBuffer(device: GPUDevice, data: Uint16Array): GPUBuffer;
|
|
19
|
+
/**
|
|
20
|
+
* Create a GPU uniform buffer of the given byte size.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createUniformBuffer(device: GPUDevice, byteSize: number): GPUBuffer;
|
|
23
|
+
/**
|
|
24
|
+
* Create a 2D texture with common defaults for render targets.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createRenderTexture(device: GPUDevice, width: number, height: number, format?: GPUTextureFormat): GPUTexture;
|
|
27
|
+
/**
|
|
28
|
+
* Create a 2D texture for sampling (e.g., video frame, depth data).
|
|
29
|
+
*/
|
|
30
|
+
export declare function createSampleTexture(device: GPUDevice, width: number, height: number, format?: GPUTextureFormat): GPUTexture;
|
|
31
|
+
/** Create a linear-filtering, clamp-to-edge sampler. */
|
|
32
|
+
export declare function createLinearSampler(device: GPUDevice): GPUSampler;
|
|
33
|
+
/** Create a nearest-filtering, clamp-to-edge sampler. */
|
|
34
|
+
export declare function createNearestSampler(device: GPUDevice): GPUSampler;
|
|
35
|
+
/**
|
|
36
|
+
* Import a video frame into a WebGPU texture using `copyExternalImageToTexture`.
|
|
37
|
+
*
|
|
38
|
+
* This is the WebGPU equivalent of `gl.texImage2D(gl.TEXTURE_2D, ..., video)`.
|
|
39
|
+
* On supported browsers, this is a zero-copy operation.
|
|
40
|
+
*/
|
|
41
|
+
export declare function importVideoFrame(device: GPUDevice, texture: GPUTexture, video: HTMLVideoElement, flipY?: boolean): void;
|
|
42
|
+
//# sourceMappingURL=webgpu-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpu-utils.d.ts","sourceRoot":"","sources":["../../src/webgpu-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CASvE;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,GAAG,SAAS,CASnF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,CASjF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAOlF;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,gBAA+B,GACtC,UAAU,CAMZ;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,gBAA+B,GACtC,UAAU,CASZ;AAMD,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAOjE;AAED,yDAAyD;AACzD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAOlE;AAMD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,gBAAgB,EACvB,KAAK,UAAO,GACX,IAAI,CAMN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "layershift",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Embeddable video effects as Web Components. Drop-in parallax, depth-aware motion, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/components/layershift.js",
|
|
@@ -35,10 +35,15 @@
|
|
|
35
35
|
"prepublishOnly": "npm run build:package",
|
|
36
36
|
"package": "npx tsx scripts/package-output.ts",
|
|
37
37
|
"preview": "vite preview",
|
|
38
|
-
"test": "vitest run",
|
|
39
|
-
"test:watch": "vitest",
|
|
38
|
+
"test": "vitest run --project=unit",
|
|
39
|
+
"test:watch": "vitest --project=unit",
|
|
40
|
+
"test:storybook": "vitest run --project=storybook",
|
|
40
41
|
"test:e2e": "playwright test",
|
|
41
|
-
"test:all": "vitest run && playwright test"
|
|
42
|
+
"test:all": "vitest run && playwright test",
|
|
43
|
+
"docs:dev": "vitepress dev docs",
|
|
44
|
+
"build:docs": "vitepress build docs",
|
|
45
|
+
"storybook": "storybook dev -p 6006",
|
|
46
|
+
"build:storybook": "storybook build -o dist/storybook"
|
|
42
47
|
},
|
|
43
48
|
"repository": {
|
|
44
49
|
"type": "git",
|
|
@@ -61,22 +66,37 @@
|
|
|
61
66
|
},
|
|
62
67
|
"homepage": "https://layershift.io",
|
|
63
68
|
"devDependencies": {
|
|
69
|
+
"@chromatic-com/storybook": "^5.0.1",
|
|
64
70
|
"@playwright/test": "^1.58.2",
|
|
71
|
+
"@storybook/addon-a11y": "^10.2.10",
|
|
72
|
+
"@storybook/addon-docs": "^10.2.10",
|
|
73
|
+
"@storybook/addon-vitest": "^10.2.10",
|
|
74
|
+
"@storybook/react-vite": "^10.2.10",
|
|
65
75
|
"@tailwindcss/vite": "^4.2.0",
|
|
76
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
77
|
+
"@testing-library/react": "^16.3.2",
|
|
78
|
+
"@testing-library/user-event": "^14.6.1",
|
|
66
79
|
"@types/jsdom": "^27.0.0",
|
|
67
80
|
"@types/react": "^19.2.14",
|
|
68
81
|
"@types/react-dom": "^19.2.3",
|
|
69
82
|
"@vitejs/plugin-react": "^5.1.4",
|
|
70
83
|
"@vitest/browser": "^4.0.18",
|
|
84
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
85
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
86
|
+
"@webgpu/types": "^0.1.69",
|
|
71
87
|
"@xenova/transformers": "^2.17.2",
|
|
72
88
|
"happy-dom": "^20.6.1",
|
|
73
89
|
"jsdom": "^28.1.0",
|
|
90
|
+
"mermaid": "^11.12.3",
|
|
74
91
|
"playwright": "^1.58.2",
|
|
75
92
|
"sharp": "^0.34.5",
|
|
93
|
+
"storybook": "^10.2.10",
|
|
76
94
|
"tailwindcss": "^4.2.0",
|
|
77
95
|
"tsx": "^4.21.0",
|
|
78
96
|
"typescript": "^5.9.3",
|
|
79
97
|
"vite": "^7.3.1",
|
|
98
|
+
"vitepress": "^1.6.4",
|
|
99
|
+
"vitepress-plugin-mermaid": "^2.0.17",
|
|
80
100
|
"vitest": "^4.0.18"
|
|
81
101
|
},
|
|
82
102
|
"dependencies": {
|