@playcanvas/supersplat-viewer 1.43.3 → 1.44.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/dist/index.d.ts CHANGED
@@ -32,9 +32,94 @@ type ViewerAssets = {
32
32
  */
33
33
  zstdDecoderUrl?: string;
34
34
  };
35
+ /** Per-instance switches. Every one is optional and off unless stated. */
36
+ type ViewerFlags = {
37
+ /**
38
+ * Requested renderer; the engine falls back to WebGL when WebGPU is unavailable. Default
39
+ * `webgpu`.
40
+ */
41
+ renderer?: 'webgl' | 'webgpu';
42
+ /**
43
+ * Build the viewer's ui: the controls, panels, poster, loading bar, annotation hotspots
44
+ * and their navigator. Defaults to `true`. `false` is the headless level: the canvas and
45
+ * the api, with no overlay markup. Core camera input, browser integration and preference
46
+ * persistence remain active. The host renders controls against the public handle;
47
+ * `setMoveInput` supports a replacement joystick. Note that the touch joystick and the AR/VR
48
+ * fallback prompt live in that ui, so a headless host owns those affordances too.
49
+ */
50
+ ui?: boolean;
51
+ /** Show the centre reticle in desktop fly/walk mode with gaming controls. Defaults to `false`. */
52
+ reticle?: boolean;
53
+ /** Start with the camera animation paused. */
54
+ noanim?: boolean;
55
+ /** Disable post effects. */
56
+ nofx?: boolean;
57
+ /** Override the settings' `highPrecisionRendering`. */
58
+ hpr?: boolean;
59
+ /** Show the engine's MiniStats panel. */
60
+ ministats?: boolean;
61
+ /** Render with LOD colorisation. */
62
+ colorize?: boolean;
63
+ /** Load all streaming LOD data before the first frame. */
64
+ fullload?: boolean;
65
+ /**
66
+ * Offer VR at once: where VR can start, a prompt shows over the viewer while it loads, and a
67
+ * tap on it starts a VR session as soon as the scene is placed, the rest of the scene streaming
68
+ * in during the session; a tap elsewhere dismisses it. A session needs a tap: browsers start
69
+ * none without one. The camera animation starts paused, as with `noanim`. Needs the ui.
70
+ * Defaults to `false`.
71
+ */
72
+ vr?: boolean;
73
+ /**
74
+ * Override the anti-aliasing compensation that splats trained with anti-aliasing need: `true`
75
+ * renders every splat with it, `false` without. When not set, the engine follows the training
76
+ * mode each splat file records (PlayCanvas Engine 2.24 and later).
77
+ */
78
+ aa?: boolean;
79
+ /**
80
+ * Developer override of the Performance Mode setting: `true` forces the stochastic splat
81
+ * renderer (unsorted, depth-tested splats whose depth buffer also serves picking) in its
82
+ * per-pixel mode, `'mobile'` in its interleaved-pixel-sets mode, and `'off'` keeps the
83
+ * engine's sorted renderer; each hides the setting. Without it the user's Performance Mode
84
+ * toggle decides, and the device class picks the mode. WebGPU only; ignored on WebGL. The
85
+ * renderer draws WebGPU XR sessions too, one view per eye (Safari on Apple Vision Pro); where
86
+ * only WebGL could host a session, the viewer offers a reload into WebGL.
87
+ */
88
+ stochastic?: boolean | 'mobile' | 'off';
89
+ /**
90
+ * Developer knob for the stochastic renderer: the data path that feeds it. Default
91
+ * `direct`, the resident files read in place; `workbuffer` reads the engine's work buffer.
92
+ */
93
+ splatSource?: 'workbuffer' | 'direct';
94
+ /**
95
+ * Developer knob for the stochastic renderer: comma-separated `key:value` experiment
96
+ * switches applied over the chosen mode's, e.g. `coverage:interleaved,jitter:2`.
97
+ */
98
+ variant?: string;
99
+ /** Splat budget in millions, overriding the Quality slider's ladder (every position then gives it). */
100
+ budget?: number;
101
+ /**
102
+ * Developer knob: while the viewer renders on demand, the most rendered frames the gpu may
103
+ * have unfinished before the next continuous render (the camera moving, the stochastic
104
+ * renderer accumulating) waits for one to finish; `0` lets them queue. Defaults to `2`.
105
+ */
106
+ framesInFlight?: number;
107
+ /** Render the collision heatmap debug overlay (WebGPU only). */
108
+ heatmap?: boolean;
109
+ /** Open the developer debug panel on load; Ctrl+Shift+D toggles it either way. */
110
+ debug?: boolean;
111
+ /** Ui language. Default: detected from the browser. */
112
+ lang?: string;
113
+ /**
114
+ * Publish `window.app`, `scrubTo`, `captureFrame`, `animationDuration` and the debug panel's
115
+ * camera-state hooks. The standalone document turns this on for the thumbnail pipeline; an
116
+ * embedded instance leaves it off, since two viewers would overwrite each other's.
117
+ */
118
+ exposeGlobals?: boolean;
119
+ };
35
120
 
36
121
  /**
37
- * Asset urls and settings the embedder supplies to the viewer. The asset urls are the same
122
+ * Asset urls, settings and flag defaults the embedder supplies to the viewer. The asset urls are the same
38
123
  * fields `createViewer` takes in a page ({@link ViewerAssets}); here every one is optional,
39
124
  * because the document has a default for each.
40
125
  *
@@ -51,6 +136,13 @@ type ViewerBootstrap = Partial<ViewerAssets> & {
51
136
  settings?: unknown;
52
137
  /** Where to fetch settings from. Defaults to `./settings.json`. */
53
138
  settingsUrl?: string;
139
+ /**
140
+ * Defaults for the viewer's flags in this document, the same switches `createViewer` takes.
141
+ * A url param on the served page still wins: a switch param such as `?noanim` can turn its
142
+ * flag on but not off, while `?hpr` and `?aa` take a value either way. `exposeGlobals` is
143
+ * not among them, as the document always publishes the `window.*` hooks.
144
+ */
145
+ flags?: Omit<ViewerFlags, 'exposeGlobals'>;
54
146
  };
55
147
  /** Options for {@link renderViewerHtml}. */
56
148
  type RenderViewerHtmlOptions = {
@@ -58,6 +150,8 @@ type RenderViewerHtmlOptions = {
58
150
  bootstrap?: ViewerBootstrap;
59
151
  /** Value for the document's `<base href>`, for a viewer served from a sub-path. */
60
152
  baseHref?: string;
153
+ /** Text for the document's `<title>`, shown in the browser tab. Defaults to `SuperSplat Viewer`. */
154
+ title?: string;
61
155
  /**
62
156
  * Page background, applied before the first frame renders to avoid a flash. Components
63
157
  * are normalized 0..1, not 0..255, matching `background.color` in the settings format —
@@ -106,4 +200,4 @@ declare const css: string;
106
200
  declare const js: string;
107
201
 
108
202
  export { css, html, js, renderViewerHtml };
109
- export type { RenderViewerHtmlOptions, ViewerAssets, ViewerBootstrap };
203
+ export type { RenderViewerHtmlOptions, ViewerAssets, ViewerBootstrap, ViewerFlags };