layershift 0.2.2 → 0.4.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.
Files changed (47) hide show
  1. package/README.md +14 -0
  2. package/dist/components/layershift.js +921 -647
  3. package/dist/npm/layershift.es.js +3354 -2266
  4. package/dist/types/components/layershift/global.d.ts +2 -2
  5. package/dist/types/components/layershift/index.d.ts +5 -1
  6. package/dist/types/components/layershift/index.d.ts.map +1 -1
  7. package/dist/types/components/layershift/layershift-element.d.ts +41 -10
  8. package/dist/types/components/layershift/layershift-element.d.ts.map +1 -1
  9. package/dist/types/components/layershift/lifecycle.d.ts +6 -0
  10. package/dist/types/components/layershift/lifecycle.d.ts.map +1 -1
  11. package/dist/types/components/layershift/portal-element.d.ts +13 -4
  12. package/dist/types/components/layershift/portal-element.d.ts.map +1 -1
  13. package/dist/types/components/layershift/types.d.ts +30 -9
  14. package/dist/types/components/layershift/types.d.ts.map +1 -1
  15. package/dist/types/depth-analysis.d.ts +10 -6
  16. package/dist/types/depth-analysis.d.ts.map +1 -1
  17. package/dist/types/depth-effect-renderer.d.ts +186 -0
  18. package/dist/types/depth-effect-renderer.d.ts.map +1 -0
  19. package/dist/types/depth-estimator.d.ts +96 -0
  20. package/dist/types/depth-estimator.d.ts.map +1 -0
  21. package/dist/types/input-handler.d.ts +8 -2
  22. package/dist/types/input-handler.d.ts.map +1 -1
  23. package/dist/types/jfa-distance-field.d.ts +78 -0
  24. package/dist/types/jfa-distance-field.d.ts.map +1 -0
  25. package/dist/types/media-source.d.ts +76 -0
  26. package/dist/types/media-source.d.ts.map +1 -0
  27. package/dist/types/portal-renderer.d.ts +65 -66
  28. package/dist/types/portal-renderer.d.ts.map +1 -1
  29. package/dist/types/precomputed-depth.d.ts +14 -51
  30. package/dist/types/precomputed-depth.d.ts.map +1 -1
  31. package/dist/types/quality.d.ts +95 -0
  32. package/dist/types/quality.d.ts.map +1 -0
  33. package/dist/types/render-pass.d.ts +171 -0
  34. package/dist/types/render-pass.d.ts.map +1 -0
  35. package/dist/types/renderer-base.d.ts +129 -0
  36. package/dist/types/renderer-base.d.ts.map +1 -0
  37. package/dist/types/shared/channel-to-renderer.d.ts +72 -0
  38. package/dist/types/shared/channel-to-renderer.d.ts.map +1 -0
  39. package/dist/types/shared/filter-config.d.ts +184 -0
  40. package/dist/types/shared/filter-config.d.ts.map +1 -0
  41. package/dist/types/video-source.d.ts +0 -1
  42. package/dist/types/video-source.d.ts.map +1 -1
  43. package/dist/types/webgl-utils.d.ts +29 -0
  44. package/dist/types/webgl-utils.d.ts.map +1 -0
  45. package/package.json +31 -5
  46. package/dist/types/parallax-renderer.d.ts +0 -175
  47. package/dist/types/parallax-renderer.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * JSX IntrinsicElements declaration for the <layershift-parallax> custom element.
2
+ * JSX IntrinsicElements declaration for the <layershift-effect> custom element.
3
3
  *
4
4
  * Reference this file in your tsconfig.json to get TypeScript support
5
5
  * for the custom element in React/JSX projects:
@@ -14,7 +14,7 @@ import type { LayershiftProps } from './types';
14
14
  declare global {
15
15
  namespace JSX {
16
16
  interface IntrinsicElements {
17
- 'layershift-parallax': React.DetailedHTMLProps<
17
+ 'layershift-effect': React.DetailedHTMLProps<
18
18
  React.HTMLAttributes<HTMLElement> & {
19
19
  src?: string;
20
20
  'depth-src'?: string;
@@ -2,12 +2,16 @@
2
2
  * Entry point for Layershift Web Components.
3
3
  *
4
4
  * Importing this module registers all effect elements with the browser:
5
- * - <layershift-parallax> — Depth-aware parallax video effect
5
+ * - <layershift-effect> — Depth-aware video effect
6
6
  * - <layershift-portal> — Logo-shaped video portal with depth parallax
7
7
  */
8
8
  import { LayershiftElement } from './layershift-element';
9
9
  import { LayershiftPortalElement } from './portal-element';
10
10
  export { LayershiftElement };
11
+ /**
12
+ * @deprecated Use `LayershiftElement` with a filter-config.json instead.
13
+ * The portal element will be removed in a future major version.
14
+ */
11
15
  export { LayershiftPortalElement };
12
16
  export type { LayershiftProps } from './types';
13
17
  export type { LayershiftEventMap, LayershiftReadyDetail, LayershiftPlayDetail, LayershiftPauseDetail, LayershiftLoopDetail, LayershiftFrameDetail, LayershiftErrorDetail, } from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,YAAY,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B;;;GAGG;AACH,OAAO,EAAE,uBAAuB,EAAE,CAAC;AAEnC,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,YAAY,EACV,wBAAwB,EACxB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,SAAS,CAAC"}
@@ -1,30 +1,38 @@
1
1
  /**
2
- * <layershift-parallax> Web Component
2
+ * <layershift-effect> Web Component
3
3
  *
4
- * A self-contained Custom Element that renders a depth-aware parallax
4
+ * A self-contained Custom Element that renders a depth-aware
5
5
  * video effect. Encapsulates the entire WebGL pipeline inside a
6
6
  * Shadow DOM — consumers just drop in the tag and provide asset URLs.
7
7
  *
8
8
  * Usage:
9
- * <layershift-parallax
9
+ * <layershift-effect
10
10
  * src="video.mp4"
11
11
  * depth-src="depth-data.bin"
12
12
  * depth-meta="depth-meta.json"
13
- * ></layershift-parallax>
13
+ * ></layershift-effect>
14
14
  */
15
+ import type { ChannelLayer } from '../../shared/filter-config';
15
16
  import type { ManagedElement } from './lifecycle';
16
17
  export declare class LayershiftElement extends HTMLElement implements ManagedElement {
17
- static readonly TAG_NAME = "layershift-parallax";
18
+ static readonly TAG_NAME = "layershift-effect";
18
19
  static get observedAttributes(): string[];
19
20
  readonly reinitAttributes: string[];
21
+ canInit(): boolean;
20
22
  private shadow;
21
23
  private container;
22
24
  private renderer;
23
25
  private inputHandler;
24
- private depthWorker;
25
- private video;
26
+ private source;
27
+ private depthEstimator;
26
28
  private loopCount;
27
29
  private readonly lifecycle;
30
+ /**
31
+ * Depth-adaptive fallback values computed once during init from the
32
+ * depth analysis profile. Stored so that updateConfig() can pass them
33
+ * to channelsToRendererConfig() without re-running depth analysis.
34
+ */
35
+ private depthFallback;
28
36
  constructor();
29
37
  private getAttrFloat;
30
38
  private getAttrBool;
@@ -32,12 +40,17 @@ export declare class LayershiftElement extends HTMLElement implements ManagedEle
32
40
  private get parallaxY();
33
41
  private get parallaxMax();
34
42
  private get overscan();
43
+ private get quality();
44
+ /** @deprecated WebGPU backend removed — always uses WebGL2 for render parity with the editor. */
45
+ private get gpuBackend();
46
+ private get sourceType();
47
+ private get depthModel();
35
48
  private get shouldAutoplay();
36
49
  private get shouldLoop();
37
50
  private get shouldMute();
38
51
  /**
39
52
  * Dispatch a namespaced custom event that bubbles through Shadow DOM.
40
- * All events use the `layershift-parallax:` prefix and are `composed`
53
+ * All events use the `layershift-effect:` prefix and are `composed`
41
54
  * so consumers can listen on the host element from the light DOM.
42
55
  */
43
56
  private emit;
@@ -45,13 +58,31 @@ export declare class LayershiftElement extends HTMLElement implements ManagedEle
45
58
  * Attach native video event listeners and re-dispatch them
46
59
  * as namespaced custom events on the host element.
47
60
  */
48
- private attachVideoEventListeners;
61
+ private attachSourceEventListeners;
49
62
  connectedCallback(): void;
50
63
  disconnectedCallback(): void;
51
64
  attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
52
65
  setupShadowDOM(): void;
66
+ /**
67
+ * Fetch and parse a FilterConfig JSON file.
68
+ * Returns null if the attribute is absent or the fetch fails.
69
+ */
70
+ private fetchFilterConfig;
71
+ /**
72
+ * Build renderer config from HTML attributes (legacy parallax-only path).
73
+ */
74
+ private buildLegacyConfig;
53
75
  doInit(signal: AbortSignal): Promise<void>;
54
- private createVideoElement;
76
+ /**
77
+ * Push new channel parameters to the renderer at runtime.
78
+ *
79
+ * This is the primary API for external controls (overlays, drawers,
80
+ * host-page UIs) to drive effect parameters without reinitializing
81
+ * the WebGL pipeline. Safe to call on every slider change.
82
+ *
83
+ * @param channels - The updated ChannelLayer[] from the controls store.
84
+ */
85
+ updateConfig(channels: ChannelLayer[]): void;
55
86
  doDispose(): void;
56
87
  }
57
88
  //# sourceMappingURL=layershift-element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layershift-element.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/layershift-element.ts"],"names":[],"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BlC,iBAAiB,IAAI,IAAI;IAIzB,oBAAoB,IAAI,IAAI;IAI5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM1F,cAAc,IAAI,IAAI;IAkCtB;;;OAGG;YACW,iBAAiB;IA+B/B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA6BnB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA4QhD;;;;;;;;OAQG;IACH,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI;IA0B5C,SAAS,IAAI,IAAI;CAiBlB"}
@@ -50,6 +50,12 @@ export interface ManagedElement {
50
50
  * Does NOT need to handle the abort controller — the manager owns that.
51
51
  */
52
52
  doDispose(): void;
53
+ /**
54
+ * Optional custom readiness check. When provided, replaces the default
55
+ * gate (all reinitAttributes must be present) with element-specific
56
+ * logic — e.g. camera mode doesn't require src/depth-src/depth-meta.
57
+ */
58
+ canInit?(): boolean;
53
59
  }
54
60
  /**
55
61
  * Lifecycle state managed on behalf of the element. Attached as a private
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAEpC,2DAA2D;IAC3D,cAAc,IAAI,IAAI,CAAC;IAEvB;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3C;;;;OAIG;IACH,SAAS,IAAI,IAAI,CAAC;CACnB;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,e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KnB,cAAc,IAAI,IAAI;IAMtB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAepF,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,eAAe,IAAI,IAAI;YAOT,OAAO;IAgCrB,OAAO,CAAC,UAAU;CAKnB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,sBAAsB,GAAG,qBAAqB,GAAG,IAAI,GAAG,IAAI,CAInG"}
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * <layershift-portal> Web Component
3
3
  *
4
+ * @deprecated Use `<layershift-effect>` with a filter-config.json instead.
5
+ * The portal element will be removed in a future major version.
6
+ * See https://layershift.io/docs/migration for details.
7
+ *
4
8
  * A self-contained Custom Element that renders video through a logo-shaped
5
9
  * portal with depth-aware parallax, emissive interior compositing, geometric
6
10
  * chamfer lighting, and dimensional boundary effects. Encapsulates the
@@ -19,12 +23,13 @@ export declare class LayershiftPortalElement extends HTMLElement implements Mana
19
23
  static readonly TAG_NAME = "layershift-portal";
20
24
  static get observedAttributes(): string[];
21
25
  readonly reinitAttributes: string[];
26
+ canInit(): boolean;
22
27
  private shadow;
23
28
  private container;
24
29
  private renderer;
25
30
  private inputHandler;
26
- private depthWorker;
27
- private video;
31
+ private source;
32
+ private depthEstimator;
28
33
  private mesh;
29
34
  private loopCount;
30
35
  private readonly lifecycle;
@@ -33,11 +38,15 @@ export declare class LayershiftPortalElement extends HTMLElement implements Mana
33
38
  private getAttrBool;
34
39
  private getAttrColor;
35
40
  private getAttrVec3;
41
+ private get sourceType();
36
42
  private get parallaxX();
37
43
  private get parallaxY();
38
44
  private get parallaxMax();
39
45
  private get overscan();
40
46
  private get pomSteps();
47
+ private get quality();
48
+ /** @deprecated WebGPU backend removed — always uses WebGL2 for render parity with the editor. */
49
+ private get gpuBackend();
41
50
  private get rimIntensity();
42
51
  private get rimWidth();
43
52
  private get rimColor();
@@ -73,17 +82,17 @@ export declare class LayershiftPortalElement extends HTMLElement implements Mana
73
82
  private get edgeOcclusionWidth();
74
83
  private get edgeOcclusionStrength();
75
84
  private get lightDirection3();
85
+ private get depthModel();
76
86
  private get shouldAutoplay();
77
87
  private get shouldLoop();
78
88
  private get shouldMute();
79
89
  private emit;
80
- private attachVideoEventListeners;
90
+ private attachSourceEventListeners;
81
91
  connectedCallback(): void;
82
92
  disconnectedCallback(): void;
83
93
  attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
84
94
  setupShadowDOM(): void;
85
95
  doInit(signal: AbortSignal): Promise<void>;
86
- private createVideoElement;
87
96
  doDispose(): void;
88
97
  }
89
98
  //# sourceMappingURL=portal-element.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"portal-element.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/portal-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAoBH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmMlD,qBAAa,uBAAwB,SAAQ,WAAY,YAAW,cAAc;IAChF,MAAM,CAAC,QAAQ,CAAC,QAAQ,uBAAuB;IAE/C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAmBxC;IAED,QAAQ,CAAC,gBAAgB,WAAkD;IAE3E,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmB;;IAU7C,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,YAAY;IAKpB,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OAAO,KAAK,YAAY,GAAgF;IACxG,OAAO,KAAK,YAAY,GAAgF;IACxG,OAAO,KAAK,YAAY,GAAkG;IAC1H,OAAO,KAAK,cAAc,GAAoF;IAC9G,OAAO,KAAK,eAAe,GAAsF;IACjH,OAAO,KAAK,gBAAgB,GAAwF;IAEpH,OAAO,KAAK,kBAAkB,GAA6F;IAC3H,OAAO,KAAK,qBAAqB,GAAmG;IACpI,OAAO,KAAK,eAAe,GAAqG;IAChI,OAAO,KAAK,UAAU,GAA8D;IACpF,OAAO,KAAK,cAAc,GAAuE;IACjG,OAAO,KAAK,UAAU,GAA+D;IACrF,OAAO,KAAK,UAAU,GAAiE;IAIvF,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,0BAA0B;IAyBlC,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAI5B,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM1F,cAAc,IAAI,IAAI;IAkChB,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA2NhD,SAAS,IAAI,IAAI;CAiBlB"}
@@ -7,6 +7,10 @@ export interface LayershiftProps {
7
7
  parallaxMax?: number;
8
8
  layers?: number;
9
9
  overscan?: number;
10
+ /** Adaptive quality tier ('auto' | 'high' | 'medium' | 'low'). */
11
+ quality?: 'auto' | 'high' | 'medium' | 'low';
12
+ /** GPU backend preference ('auto' | 'webgpu' | 'webgl2'). Default: 'auto'. */
13
+ gpuBackend?: 'auto' | 'webgpu' | 'webgl2';
10
14
  autoplay?: boolean;
11
15
  loop?: boolean;
12
16
  muted?: boolean;
@@ -21,7 +25,7 @@ export interface LayershiftReadyDetail {
21
25
  /** Depth analysis profile (present when depth data was analyzed). */
22
26
  depthProfile?: import('../../depth-analysis').DepthProfile;
23
27
  /** Parameters derived from depth analysis (present when depth data was analyzed). */
24
- derivedParams?: import('../../depth-analysis').DerivedParallaxParams;
28
+ derivedParams?: import('../../depth-analysis').DerivedEffectParams;
25
29
  }
26
30
  /** Fired when video starts playing. */
27
31
  export interface LayershiftPlayDetail {
@@ -44,23 +48,35 @@ export interface LayershiftFrameDetail {
44
48
  export interface LayershiftErrorDetail {
45
49
  message: string;
46
50
  }
51
+ /** Fired during depth model download with progress updates. */
52
+ export interface LayershiftModelProgressDetail {
53
+ /** Bytes received so far. */
54
+ receivedBytes: number;
55
+ /** Total bytes (from Content-Length header), or null if unknown. */
56
+ totalBytes: number | null;
57
+ /** Download fraction 0–1 (0 if total is unknown). */
58
+ fraction: number;
59
+ /** Human-readable status label (e.g. "Downloading depth model…"). */
60
+ label: string;
61
+ }
47
62
  /**
48
- * Map of all custom events dispatched by `<layershift-parallax>`.
63
+ * Map of all custom events dispatched by `<layershift-effect>`.
49
64
  *
50
65
  * Usage with addEventListener:
51
66
  * ```ts
52
- * el.addEventListener('layershift-parallax:ready', (e) => {
67
+ * el.addEventListener('layershift-effect:ready', (e) => {
53
68
  * console.log(e.detail.videoWidth, e.detail.duration);
54
69
  * });
55
70
  * ```
56
71
  */
57
72
  export interface LayershiftEventMap {
58
- 'layershift-parallax:ready': CustomEvent<LayershiftReadyDetail>;
59
- 'layershift-parallax:play': CustomEvent<LayershiftPlayDetail>;
60
- 'layershift-parallax:pause': CustomEvent<LayershiftPauseDetail>;
61
- 'layershift-parallax:loop': CustomEvent<LayershiftLoopDetail>;
62
- 'layershift-parallax:frame': CustomEvent<LayershiftFrameDetail>;
63
- 'layershift-parallax:error': CustomEvent<LayershiftErrorDetail>;
73
+ 'layershift-effect:ready': CustomEvent<LayershiftReadyDetail>;
74
+ 'layershift-effect:play': CustomEvent<LayershiftPlayDetail>;
75
+ 'layershift-effect:pause': CustomEvent<LayershiftPauseDetail>;
76
+ 'layershift-effect:loop': CustomEvent<LayershiftLoopDetail>;
77
+ 'layershift-effect:frame': CustomEvent<LayershiftFrameDetail>;
78
+ 'layershift-effect:error': CustomEvent<LayershiftErrorDetail>;
79
+ 'layershift-effect:model-progress': CustomEvent<LayershiftModelProgressDetail>;
64
80
  }
65
81
  /** Props for the <layershift-portal> Web Component. */
66
82
  export interface LayershiftPortalProps {
@@ -74,6 +90,10 @@ export interface LayershiftPortalProps {
74
90
  overscan?: number;
75
91
  /** POM ray-march step count for interior displacement. */
76
92
  pomSteps?: number;
93
+ /** Adaptive quality tier ('auto' | 'high' | 'medium' | 'low'). */
94
+ quality?: 'auto' | 'high' | 'medium' | 'low';
95
+ /** GPU backend preference ('auto' | 'webgpu' | 'webgl2'). Default: 'auto'. */
96
+ gpuBackend?: 'auto' | 'webgpu' | 'webgl2';
77
97
  rimIntensity?: number;
78
98
  rimColor?: string;
79
99
  rimWidth?: number;
@@ -191,5 +211,6 @@ export interface LayershiftPortalEventMap {
191
211
  'layershift-portal:loop': CustomEvent<LayershiftPortalLoopDetail>;
192
212
  'layershift-portal:frame': CustomEvent<LayershiftPortalFrameDetail>;
193
213
  'layershift-portal:error': CustomEvent<LayershiftPortalErrorDetail>;
214
+ 'layershift-portal:model-progress': CustomEvent<LayershiftModelProgressDetail>;
194
215
  }
195
216
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,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;AAED,8CAA8C;AAC9C,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,sCAAsC;AACtC,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,mDAAmD;AACnD,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,4CAA4C;AAC5C,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,6CAA6C;AAC7C,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,yBAAyB,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC;IACpE,wBAAwB,EAAE,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAClE,yBAAyB,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC;IACpE,wBAAwB,EAAE,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAClE,yBAAyB,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC;IACpE,yBAAyB,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC;CACrE"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/layershift/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,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WAAW,CAAC,2BAA2B,CAAC,CAAC;IACpE,wBAAwB,EAAE,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAClE,yBAAyB,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC;IACpE,yBAAyB,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC;IACpE,kCAAkC,EAAE,WAAW,CAAC,6BAA6B,CAAC,CAAC;CAChF"}
@@ -6,7 +6,7 @@
6
6
  * 1. `analyzeDepthFrames()` — computes a statistical DepthProfile from
7
7
  * precomputed depth frames (histogram, percentiles, bimodality).
8
8
  *
9
- * 2. `deriveParallaxParams()` — maps a DepthProfile to concrete parallax
9
+ * 2. `deriveEffectParams()` — maps a DepthProfile to concrete effect
10
10
  * renderer parameters using continuous functions with algebraic
11
11
  * calibration guarantees.
12
12
  *
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * Both functions run once at initialization. analyzeDepthFrames samples
22
22
  * up to 5 deterministically-chosen frames (~1.3M pixels at 512×512),
23
- * completing in <5ms. deriveParallaxParams is O(1) arithmetic.
23
+ * completing in <5ms. deriveEffectParams is O(1) arithmetic.
24
24
  *
25
25
  * ## Determinism
26
26
  *
@@ -62,7 +62,7 @@ export interface DepthProfile {
62
62
  * Parallax parameters derived from depth analysis.
63
63
  * All values are clamped to safe bounds.
64
64
  */
65
- export interface DerivedParallaxParams {
65
+ export interface DerivedEffectParams {
66
66
  parallaxStrength: number;
67
67
  contrastLow: number;
68
68
  contrastHigh: number;
@@ -82,7 +82,7 @@ export interface DerivedParallaxParams {
82
82
  * @param width - Frame width in pixels (e.g. 512).
83
83
  * @param height - Frame height in pixels (e.g. 512).
84
84
  * @returns DepthProfile with all statistics. If frames is empty, returns
85
- * a degenerate profile that will trigger rejection in deriveParallaxParams.
85
+ * a degenerate profile that will trigger rejection in deriveEffectParams.
86
86
  */
87
87
  export declare function analyzeDepthFrames(frames: Uint8Array[], width: number, height: number): DepthProfile;
88
88
  /**
@@ -98,7 +98,11 @@ export declare function analyzeDepthFrames(frames: Uint8Array[], width: number,
98
98
  * or stdDev < 0.02), returns the exact calibrated defaults.
99
99
  *
100
100
  * @param profile - DepthProfile from analyzeDepthFrames().
101
- * @returns DerivedParallaxParams with all values clamped to safe bounds.
101
+ * @returns DerivedEffectParams with all values clamped to safe bounds.
102
102
  */
103
- export declare function deriveParallaxParams(profile: DepthProfile): DerivedParallaxParams;
103
+ export declare function deriveEffectParams(profile: DepthProfile): DerivedEffectParams;
104
+ /** @deprecated Use DerivedEffectParams instead. */
105
+ export type DerivedParallaxParams = DerivedEffectParams;
106
+ /** @deprecated Use deriveEffectParams instead. */
107
+ export declare const deriveParallaxParams: typeof deriveEffectParams;
104
108
  //# sourceMappingURL=depth-analysis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"depth-analysis.d.ts","sourceRoot":"","sources":["../../src/depth-analysis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IAEb,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAC;IAEX,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IAEZ,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IAEZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IAEZ,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAC;IAEvB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAA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AAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAyBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAAE,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,YAAY,CAgFd;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,mBAAmB,CAwD7E;AAoKD,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACxD,kDAAkD;AAClD,eAAO,MAAM,oBAAoB,2BAAqB,CAAC"}
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Depth Effect Renderer — GPU-accelerated depth-aware video effects.
3
+ *
4
+ * Renders a single fullscreen quad textured with the source video
5
+ * and a precomputed depth map using pure WebGL 2. A custom fragment
6
+ * shader displaces UV coordinates per-pixel based on the depth value
7
+ * and current mouse/gyro input, creating a continuous parallax effect
8
+ * with no discrete layer banding.
9
+ *
10
+ * ## Multi-pass architecture
11
+ *
12
+ * The renderer uses a pass-based pipeline where each render pass is a
13
+ * self-contained unit with its own shader program and uniform cache,
14
+ * sharing a single fullscreen quad VAO and depth textures:
15
+ *
16
+ * 1. **Bilateral filter pass** — edge-preserving depth smoothing.
17
+ * Reads raw depth (UNIT 2), writes filtered depth (UNIT 1) via FBO.
18
+ * Runs at RVFC rate (~5fps, only when depth data changes).
19
+ *
20
+ * 2. **Effect pass** — per-pixel depth-based displacement, blur, glow, color-shift.
21
+ * Reads video (UNIT 0) + filtered depth (UNIT 1), renders to screen.
22
+ * Runs at RAF rate (60-120fps).
23
+ *
24
+ * Each pass is created by a factory function and conforms to a minimal
25
+ * interface. Adding a new post-processing pass requires only a new
26
+ * factory function and wiring it into the render loop.
27
+ *
28
+ * ## Texture memory
29
+ *
30
+ * 7 textures total: 1 video (RGBA), 1 raw depth (R8), 1 filtered depth (R8),
31
+ * 4 curve LUTs (R8, 256×1 each: displacement, blur, glow, color-shift).
32
+ * The raw depth texture is uploaded from CPU when depth changes (~5fps).
33
+ * The filtered depth texture is rendered via FBO bilateral filter pass.
34
+ * The curve LUT textures are uploaded when the curve editor changes.
35
+ */
36
+ import type { QualityTier } from './quality';
37
+ import { RendererBase } from './renderer-base';
38
+ import type { MediaSource } from './media-source';
39
+ /** Configuration subset relevant to the parallax renderer. */
40
+ export interface DepthEffectConfig {
41
+ parallaxStrength: number;
42
+ pomEnabled: boolean;
43
+ pomSteps: number;
44
+ overscanPadding: number;
45
+ /**
46
+ * Adaptive quality tier. Controls render resolution, depth resolution,
47
+ * sample counts, and bilateral kernel size.
48
+ * - 'auto' — probe device capabilities and classify automatically.
49
+ * - 'high' / 'medium' / 'low' — use the specified tier directly.
50
+ * - undefined — defaults to 'auto'.
51
+ */
52
+ quality?: 'auto' | QualityTier;
53
+ /**
54
+ * Depth-adaptive shader parameters.
55
+ * When omitted, calibrated defaults matching the current hardcoded values
56
+ * are used. When provided, the explicit value overrides the derived value.
57
+ */
58
+ contrastLow?: number;
59
+ contrastHigh?: number;
60
+ verticalReduction?: number;
61
+ dofStart?: number;
62
+ dofStrength?: number;
63
+ /** Maximum blur radius in UV space, from blur channel params. */
64
+ blurRadius?: number;
65
+ /** Glow color [r, g, b] each 0-1. */
66
+ glowColor?: [number, number, number];
67
+ /** Glow spread radius in UV space. */
68
+ glowRadius?: number;
69
+ /** Glow edge softness (0-1). */
70
+ glowSoftness?: number;
71
+ /** Enable tilted focal plane blur (Scheimpflug simulation). */
72
+ tiltEnabled?: boolean;
73
+ /** Precomputed tan(fov/2) for pseudo-world reconstruction. */
74
+ tiltHalfTanFov?: number;
75
+ /** Blur ramp width in pseudo-world-space units. */
76
+ tiltTransitionWidth?: number;
77
+ /** Maximum blur intensity for tilted plane DOF (0-1). */
78
+ tiltPeakIntensity?: number;
79
+ }
80
+ export declare class DepthEffectRenderer extends RendererBase {
81
+ private gl;
82
+ private quadVao;
83
+ private bilateralPass;
84
+ private effectPass;
85
+ private readonly textures;
86
+ private readonly videoSlot;
87
+ private readonly filteredDepthSlot;
88
+ private readonly rawDepthSlot;
89
+ private readonly displacementLutSlot;
90
+ private readonly blurLutSlot;
91
+ private readonly glowLutSlot;
92
+ private readonly colorShiftLutSlot;
93
+ /** Resolved config with all optional shader params filled from defaults. */
94
+ private config;
95
+ /**
96
+ * Create the renderer and attach its canvas to the DOM.
97
+ *
98
+ * @param parent - The container element that the WebGL canvas is
99
+ * appended to. The renderer sizes itself to fill this element.
100
+ * @param config - Effect settings (strength, POM, overscan, glow, color-shift).
101
+ * Optional shader parameters are merged with calibrated defaults.
102
+ */
103
+ constructor(parent: HTMLElement, config: DepthEffectConfig);
104
+ /**
105
+ * Set up the scene: create video texture, depth textures + FBO, and
106
+ * set static shader uniforms.
107
+ *
108
+ * Call this once after the media source and depth data are loaded.
109
+ *
110
+ * @param source - The media source to sample color frames from.
111
+ * Must already have dimensions available (width/height set).
112
+ * @param depthWidth - Width of the precomputed depth map (e.g. 512).
113
+ * @param depthHeight - Height of the precomputed depth map (e.g. 512).
114
+ */
115
+ initialize(source: MediaSource, depthWidth: number, depthHeight: number): void;
116
+ /**
117
+ * Update shader parameters at runtime without re-creating the renderer.
118
+ *
119
+ * Merges the provided partial config into the resolved config and
120
+ * re-uploads only the affected uniforms to the GPU. Safe to call
121
+ * from a store subscription on every slider change — no allocations,
122
+ * just a handful of `gl.uniform*` calls.
123
+ */
124
+ updateConfig(partial: Partial<DepthEffectConfig>): void;
125
+ /**
126
+ * Upload new curve LUT data to the GPU.
127
+ * Call this whenever the curve editor changes.
128
+ */
129
+ updateCurveLUTs(displacementLUT: Uint8Array | null, blurLUT: Uint8Array | null, glowLUT?: Uint8Array | null, colorShiftLUT?: Uint8Array | null, colorShiftParams?: {
130
+ hueShift: number;
131
+ saturation: number;
132
+ brightness: number;
133
+ tintStrength: number;
134
+ tintColor: [number, number, number];
135
+ }): void;
136
+ /**
137
+ * Create render passes and shared fullscreen quad VAO.
138
+ *
139
+ * Each pass is a self-contained unit with its own program and uniform
140
+ * cache. They share a single VAO for the fullscreen quad geometry.
141
+ */
142
+ private initGPUResources;
143
+ /**
144
+ * Upload a 256-entry curve LUT to a texture slot.
145
+ * Creates the texture on first call, updates via texSubImage2D thereafter.
146
+ */
147
+ private uploadLUT;
148
+ /**
149
+ * Main render loop — called every animation frame at display refresh rate.
150
+ *
151
+ * When RVFC is active, this only handles:
152
+ * 1. Uploading the current video frame to the GPU texture.
153
+ * 2. Updating the parallax offset uniform from input (buttery smooth).
154
+ * 3. Rendering the fullscreen quad (single draw call).
155
+ *
156
+ * When RVFC is NOT supported, this falls back to the original behavior:
157
+ * depth update + input update + render all in a single RAF tick.
158
+ */
159
+ protected onRenderFrame(): void;
160
+ /**
161
+ * Upload raw depth data to the GPU and run the bilateral filter pass.
162
+ *
163
+ * Delegates to the bilateral filter pass object, which encapsulates
164
+ * the upload → FBO bind → draw → FBO unbind → viewport restore sequence.
165
+ *
166
+ * The parallax shader reads from filteredDepthTexture (UNIT 1).
167
+ */
168
+ protected onDepthUpdate(timeSec: number): void;
169
+ /**
170
+ * Recalculate the WebGL canvas size and UV transform to match the
171
+ * current container dimensions.
172
+ *
173
+ * Cover-fit + overscan is expressed as a UV-space transform (offset + scale)
174
+ * rather than geometry resize. The fullscreen quad stays fixed at -1 to 1.
175
+ */
176
+ protected recalculateViewportLayout(): void;
177
+ /** Release all GPU resources. */
178
+ protected disposeRenderer(): void;
179
+ /** Rebuild GPU state after context restoration. */
180
+ protected onContextRestored(): void;
181
+ /** Dispose all textures via the registry (video, rawDepth, filteredDepth, LUTs). */
182
+ private disposeTextures;
183
+ /** Dispose render passes and shared VAO. */
184
+ private disposeGPUResources;
185
+ }
186
+ //# sourceMappingURL=depth-effect-renderer.d.ts.map
@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