@displayxr/inline3d 1.27.0 → 1.29.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/splat.d.ts CHANGED
@@ -271,6 +271,25 @@ export interface SplatVideoOptions {
271
271
  muted?: boolean;
272
272
  /** Default true for a URL (the SDK's own element), false for an element you pass. */
273
273
  autoplay?: boolean;
274
+ /**
275
+ * `'cut'` (default) or `'crossfade'`: a GPU dissolve from the video already on the plane (its
276
+ * last frame, frozen) to this one. From the splat, and on `setVideo(null)`, it is always a cut.
277
+ * The same vocabulary as `./player`'s `setSource`; `./splat`'s gaussian transitions throw here.
278
+ */
279
+ transition?: 'cut' | 'crossfade';
280
+ /** Crossfade length. Default 600 (the player's). 0 = a cut. */
281
+ durationMs?: number;
282
+ /** A named easing ({@link SplatEasing}) or `(x) => y` on [0, 1]. Default `'easeInOutSine'`. */
283
+ easing?: SplatEasing | ((x: number) => number);
284
+ /** Only `'frozen'`: the outgoing video dissolves from its last frame. */
285
+ outgoing?: 'frozen';
286
+ /**
287
+ * A letterbox slot: the picture is fitted into a centred band of this aspect inside the tile
288
+ * (`2.39` or `'2.39:1'` for a scope band in a 16:9 tile), the rest of the element left clear —
289
+ * `./player`'s `band`, on the plane. `fit: 'cover'` fills the band and crops the eye image about
290
+ * its centre.
291
+ */
292
+ band?: number | string | null;
274
293
  }
275
294
 
276
295
  /** What `handle.setVideo(src)` resolves to. */
@@ -279,6 +298,18 @@ export interface SplatVideo {
279
298
  readonly video: HTMLVideoElement;
280
299
  readonly format: 'sbs' | 'tb' | 'mono';
281
300
  readonly fit: 'contain' | 'cover';
301
+ /** The band's aspect, or null. */
302
+ readonly band: number | null;
303
+ /**
304
+ * Where the picture is on screen, in CSS px from the canvas's top-left, clipped to the canvas;
305
+ * the letterbox bars are the canvas minus this. Null before the first drawn frame and once
306
+ * another `setVideo` replaced this one. Place controls against the picture with it.
307
+ */
308
+ readonly rect: { readonly x: number; readonly y: number; readonly width: number; readonly height: number } | null;
309
+ /** `cb(rect)` whenever the rect changes (a resize, a new size, a band): a microtask right after the draw, same frame, before paint. Returns an unsubscribe. */
310
+ onRectChange(cb: (rect: { x: number; y: number; width: number; height: number }) => void): () => void;
311
+ /** What the swap did: `'crossfade'` only when it replaced a video on screen and asked to. Resolved at the swap, before the fade ends. */
312
+ readonly transition: 'cut' | 'crossfade';
282
313
  /** `handle.setVideo(null)`, or a no-op if another setVideo has replaced this one. */
283
314
  remove(): Promise<null>;
284
315
  /** Frames drawn with the plane up, and texture uploads (new video frames). */
@@ -379,7 +410,11 @@ export interface SplatOptions {
379
410
  * so a long subject still fits once the turntable turns it (default true).
380
411
  */
381
412
  fitSweep?: boolean;
382
- /** Per-eye buffer scale; 0.5–0.7 is usually free (default 1). */
413
+ /**
414
+ * Per-eye buffer scale; 0.5–0.7 is usually free (default 1). Clamped to the device's GL limits: the whole store (2 × eye wide in 3D) is kept within
415
+ * min(MAX_TEXTURE_SIZE, MAX_RENDERBUFFER_SIZE, MAX_VIEWPORT_DIMS), both axes shrunk by one factor,
416
+ * with a one-time console warning. The handle's `renderScale` reports the value in force.
417
+ */
383
418
  renderScale?: number;
384
419
  feather?: number;
385
420
  /**
@@ -1008,11 +1043,25 @@ export interface SplatHandle {
1008
1043
  /**
1009
1044
  * `engine: 'playcanvas'` only. Change the per-eye buffer scale live (the `renderScale` option),
1010
1045
  * in (0, 4]; the backing store is resized on the next animation frame. Throws a RangeError
1011
- * otherwise.
1046
+ * otherwise. The request is kept as given (`renderScaleRequested`); the store is still clamped
1047
+ * to the device's GL limits, and `renderScale` reports what is in force.
1012
1048
  */
1013
1049
  setRenderScale(scale: number): SplatHandle;
1014
- /** `engine: 'playcanvas'` only. The current per-eye buffer scale. */
1050
+ /**
1051
+ * The per-eye buffer scale IN FORCE: the request times the device-limit clamp. E.g. 0.8 for a
1052
+ * request of 1 on a device whose MAX_TEXTURE_SIZE (4096) cannot hold a 5120-wide SBS store.
1053
+ * Both engines.
1054
+ */
1015
1055
  readonly renderScale: number;
1056
+ /** The per-eye buffer scale as requested (the option, or the last `setRenderScale`). Both engines. */
1057
+ readonly renderScaleRequested: number;
1058
+ /**
1059
+ * `engine: 'playcanvas'` only. The `<video>` `setVideo`'s plane is showing now, or null (none, or
1060
+ * one still waiting for its first frame). Read-only; no event reports it changing.
1061
+ */
1062
+ readonly videoElement?: HTMLVideoElement | null;
1063
+ /** `engine: 'playcanvas'` only. The tile's canvas (page chrome sits beside it). */
1064
+ readonly canvas?: HTMLCanvasElement;
1016
1065
  /**
1017
1066
  * `engine: 'playcanvas'` only. The 2D tier's EYE offset — a head-parallax analogue for a flat
1018
1067
  * screen with no tracked eyes (e.g. a phone's tilt). `{x, y}` is normalised in the mono camera's
package/viewer.d.ts CHANGED
@@ -29,7 +29,11 @@ export interface SceneViewerOptions {
29
29
  orbit?: boolean;
30
30
  /** Degrees/second of turntable once idle. Ignored under prefers-reduced-motion. */
31
31
  idleSpin?: number;
32
- /** Per-eye buffer scale; 0.5–0.7 is usually free after the interlace (default 1). */
32
+ /**
33
+ * Per-eye buffer scale; 0.5–0.7 is usually free after the interlace (default 1). Clamped to the device's GL limits: the whole store (2 × eye wide in 3D) is kept within
34
+ * min(MAX_TEXTURE_SIZE, MAX_RENDERBUFFER_SIZE, MAX_VIEWPORT_DIMS), both axes shrunk by one factor,
35
+ * with a one-time console warning. `effectiveRenderScale` reports the value in force.
36
+ */
33
37
  renderScale?: number;
34
38
  /** Edge fade in buffer px (needs EdgeFeather from ./three). */
35
39
  feather?: number;
@@ -96,6 +100,13 @@ export declare class SceneViewer {
96
100
  readonly monoCamera: object;
97
101
  /** True while the side-by-side backing store is in use. */
98
102
  readonly is3D: boolean;
103
+ /** The requested per-eye buffer scale (the `renderScale` option). */
104
+ renderScale: number;
105
+ /**
106
+ * The per-eye buffer scale in force: `renderScale` times the device-limit clamp the last resize
107
+ * applied (1 where the store fits the device's MAX_TEXTURE_SIZE & co.).
108
+ */
109
+ readonly effectiveRenderScale: number;
99
110
 
100
111
  /** Centre the subject on the zero-disparity plane and scale it to the tile. */
101
112
  fitTo(