@displayxr/inline3d 1.21.1 → 1.23.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
@@ -178,6 +178,47 @@ export interface ResolvedRig {
178
178
  parallaxFactor: number;
179
179
  }
180
180
 
181
+ /**
182
+ * `handle.setLayerRig` options — how ROUND the display-rig layers are, for the whole tile (last
183
+ * call wins). The rounding gain is k = D / (metersToVirtual · viewerDistance): the photo rig's
184
+ * convergence distance over the viewer's. docs/proposals/layer-display-rig.md.
185
+ */
186
+ export interface SplatLayerRigOptions {
187
+ /** Nominal viewer distance in metres (default 0.6, the browser's own nominal). */
188
+ viewerDistance?: number;
189
+ /** An explicit gain k instead (1 = exactly the photo rig; larger = rounder). */
190
+ gain?: number;
191
+ }
192
+
193
+ /** `handle.layerRigState()`. */
194
+ export interface SplatLayerRigState {
195
+ /** The layers on the display rig, as the page named them. */
196
+ display: Array<string | number>;
197
+ /** The `nolayerrig` kill switch is on (requests recorded, never applied). */
198
+ disabled: boolean;
199
+ /** The last drawn frame drew the display layers through rounded views (false in mono). */
200
+ rounded: boolean;
201
+ /** The gain the last frame used (null off a camera rig). */
202
+ gain: number | null;
203
+ }
204
+
205
+ /** `handle.makeSbsMaterial` options. */
206
+ export interface SplatSbsMaterialOptions {
207
+ /** How the texture holds the two eyes. Default `'sbs'` (left half = left eye). */
208
+ format?: 'sbs' | 'tb' | 'mono';
209
+ /** 0–1; below 1 the material alpha-blends. Default 1. */
210
+ opacity?: number;
211
+ /** The texture's row 0 is the image's BOTTOM (flip the sampling). Default false. */
212
+ flipY?: boolean;
213
+ /** Default true. */
214
+ depthTest?: boolean;
215
+ /** Default true. */
216
+ depthWrite?: boolean;
217
+ /** Back-face culling. Default false (both faces). */
218
+ cull?: boolean;
219
+ name?: string;
220
+ }
221
+
181
222
  /** `handle.setVideo` options. */
182
223
  export interface SplatVideoOptions {
183
224
  /** Stereo layout of the frame: `'sbs'` (default, left eye = left half), `'tb'` (left = top), `'mono'` (both eyes the whole frame). */
@@ -219,6 +260,11 @@ export interface SplatOptions {
219
260
  * URL with `engine: 'spark'`.
220
261
  */
221
262
  engine?: 'spark' | 'playcanvas';
263
+ /**
264
+ * `engine: 'playcanvas'` only. Sugar for `handle.setLayerRig(layer, 'display', opts)` on each
265
+ * layer (a name, an id or a `pc.Layer`), applied as soon as the engine boots.
266
+ */
267
+ displayRigLayers?: Array<string | number | { id: number }> | ({ layers: Array<string | number | { id: number }> } & SplatLayerRigOptions);
222
268
  /**
223
269
  * `engine: 'playcanvas'` only: TRANSITION DIAGNOSTICS (#36). Off by default; `true` (or the page
224
270
  * URL's `?dxrdiag=1`) records every woven frame — its interval, whether its eye poses are
@@ -910,6 +956,27 @@ export interface SplatHandle {
910
956
  */
911
957
  setVideo(src: string | HTMLVideoElement, opts?: SplatVideoOptions): Promise<SplatVideo>;
912
958
  setVideo(src: null): Promise<null>;
959
+ /**
960
+ * `engine: 'playcanvas'` only (throws on Spark). Draw `layer` (a name, an id or a `pc.Layer` of
961
+ * `handle.engine.app`) through the DISPLAY rig — round, physical-depth stage objects — while the
962
+ * splat and the view rig declared to the runtime stay on the photo's camera rig; `'camera'` puts
963
+ * it back. One extra camera over the named layers, into the same target, in composition order;
964
+ * the photo's projection matrices are used verbatim and the views are right-multiplied by the
965
+ * shear that fixes the photo's convergence plane (so a z = 0 contact point never moves).
966
+ * Identity in mono / the 2D tier, on a display rig (`setRig('display')`, `setVideo`), and under
967
+ * `?dxrdiag=nolayerrig`. Callable before `ready`. docs/proposals/layer-display-rig.md.
968
+ */
969
+ setLayerRig(layer: string | number | { id: number }, rig: 'display' | 'camera', opts?: SplatLayerRigOptions): SplatHandle;
970
+ /** `engine: 'playcanvas'` only. What `setLayerRig` is doing. */
971
+ layerRigState(): SplatLayerRigState;
972
+ /**
973
+ * `engine: 'playcanvas'` only, after `ready`. An unlit `pc.ShaderMaterial` that shows the left
974
+ * half of `texture` to left-eye views and the right half to right-eye views (`format`), on any
975
+ * mesh — mono / the 2D tier / a 1-view mode: the left half. The eye is picked from the scene-wide
976
+ * uniform `dxr_eye_split` the SDK sets every draw (declare it in your own shader to do the same).
977
+ * Nothing is decoded: the page uploads its one `<video>` into `texture`.
978
+ */
979
+ makeSbsMaterial(texture: unknown, opts?: SplatSbsMaterialOptions): unknown;
913
980
  /**
914
981
  * `engine: 'playcanvas'` only (throws on Spark). Play a transition/pulse/custom effect;
915
982
  * validated at the call, run once the first asset is on screen. Resolves `{ finished }` —
@@ -941,7 +1008,9 @@ export interface SplatHandle {
941
1008
  * What is under a point on the canvas, in the splat's own space — the double-click's pick.
942
1009
  * PlayCanvas: the nearest gaussian CENTRE to the ray over the FULL centre set (haze under 5 %
943
1010
  * opacity skipped); on a Streamed SOG, over the chunks currently resident. Spark: its surface
944
- * raycast, falling back to the nearest centre.
1011
+ * raycast, falling back to the nearest centre. PlayCanvas: a BURST of picks from one view (the
1012
+ * same frame) builds a pick index at the second one, so N picks cost about three full scans, not
1013
+ * N; the answer is the full scan's, exactly.
945
1014
  */
946
1015
  pick(clientX: number, clientY: number): number[] | null;
947
1016
  /**