@playcanvas/supersplat-viewer 1.37.0 → 1.38.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 +3 -3
- package/dist/index.js +3 -3
- package/dist/viewer.css +124 -0
- package/dist/viewer.d.ts +66 -11
- package/dist/viewer.js +16921 -11040
- package/dist/viewer.js.map +1 -1
- package/package.json +8 -8
- package/public/index.css +124 -0
- package/public/index.html +9 -1
- package/public/index.js +19738 -13844
- package/public/index.js.map +1 -1
package/dist/viewer.css
CHANGED
|
@@ -554,6 +554,60 @@
|
|
|
554
554
|
transform: translateX(16px);
|
|
555
555
|
background-color: var(--sse-accent);
|
|
556
556
|
}
|
|
557
|
+
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div.sse-qualityValue {
|
|
558
|
+
min-width: 124px;
|
|
559
|
+
justify-content: flex-end;
|
|
560
|
+
font-size: 12px;
|
|
561
|
+
cursor: default;
|
|
562
|
+
}
|
|
563
|
+
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div.sse-qualityTrack {
|
|
564
|
+
flex-grow: 1;
|
|
565
|
+
position: relative;
|
|
566
|
+
height: 28px;
|
|
567
|
+
padding: 0;
|
|
568
|
+
cursor: pointer;
|
|
569
|
+
touch-action: none;
|
|
570
|
+
}
|
|
571
|
+
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div.sse-qualityTrack .sse-qualityRail {
|
|
572
|
+
position: absolute;
|
|
573
|
+
left: 16px;
|
|
574
|
+
right: 16px;
|
|
575
|
+
top: 0;
|
|
576
|
+
bottom: 0;
|
|
577
|
+
}
|
|
578
|
+
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div.sse-qualityTrack .sse-qualityRail::before {
|
|
579
|
+
content: "";
|
|
580
|
+
position: absolute;
|
|
581
|
+
left: 0;
|
|
582
|
+
right: 0;
|
|
583
|
+
top: 12px;
|
|
584
|
+
height: 4px;
|
|
585
|
+
border-radius: 2px;
|
|
586
|
+
background-color: rgba(255, 255, 255, 0.15);
|
|
587
|
+
}
|
|
588
|
+
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div.sse-qualityTrack .sse-qualityStop {
|
|
589
|
+
position: absolute;
|
|
590
|
+
top: 10px;
|
|
591
|
+
width: 8px;
|
|
592
|
+
height: 8px;
|
|
593
|
+
margin-left: -4px;
|
|
594
|
+
border-radius: 50%;
|
|
595
|
+
background-color: #777;
|
|
596
|
+
}
|
|
597
|
+
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div.sse-qualityTrack .sse-qualityStop.sse-disabled {
|
|
598
|
+
opacity: 0.25;
|
|
599
|
+
}
|
|
600
|
+
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div.sse-qualityTrack .sse-qualityThumb {
|
|
601
|
+
position: absolute;
|
|
602
|
+
top: 6px;
|
|
603
|
+
width: 16px;
|
|
604
|
+
height: 16px;
|
|
605
|
+
margin-left: -8px;
|
|
606
|
+
border-radius: 50%;
|
|
607
|
+
background-color: var(--sse-accent);
|
|
608
|
+
pointer-events: none;
|
|
609
|
+
transition: left 120ms ease;
|
|
610
|
+
}
|
|
557
611
|
.sse-viewer .sse-settingsPanel > .sse-settingsGroup > .sse-settingsRow > div:hover {
|
|
558
612
|
color: var(--sse-text);
|
|
559
613
|
}
|
|
@@ -804,6 +858,76 @@
|
|
|
804
858
|
.sse-viewer .sse-xrModal > .sse-xrModalContent > .sse-xrModalButtons > button.sse-xrModalOk:hover {
|
|
805
859
|
background-color: var(--sse-accent);
|
|
806
860
|
}
|
|
861
|
+
.sse-viewer {
|
|
862
|
+
/* the vr flag's prompt: the whole viewer takes the tap, which enters VR on the pill and dismisses
|
|
863
|
+
the prompt elsewhere. The pill is a button, so visionOS's gaze highlight takes its shape */
|
|
864
|
+
}
|
|
865
|
+
.sse-viewer .sse-vrPrompt {
|
|
866
|
+
position: absolute;
|
|
867
|
+
top: 0;
|
|
868
|
+
left: 0;
|
|
869
|
+
width: 100%;
|
|
870
|
+
height: 100%;
|
|
871
|
+
display: flex;
|
|
872
|
+
align-items: center;
|
|
873
|
+
justify-content: center;
|
|
874
|
+
}
|
|
875
|
+
.sse-viewer .sse-vrPrompt > .sse-vrPromptPill {
|
|
876
|
+
display: flex;
|
|
877
|
+
align-items: center;
|
|
878
|
+
gap: 20px;
|
|
879
|
+
margin: 0;
|
|
880
|
+
padding: 24px 40px 24px 32px;
|
|
881
|
+
border-radius: 32px;
|
|
882
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
883
|
+
cursor: pointer;
|
|
884
|
+
font-family: inherit;
|
|
885
|
+
font-size: 15px;
|
|
886
|
+
color: var(--sse-text-light);
|
|
887
|
+
background-color: color-mix(in srgb, var(--sse-bkg) 50%, transparent);
|
|
888
|
+
backdrop-filter: blur(20px);
|
|
889
|
+
-webkit-backdrop-filter: blur(20px);
|
|
890
|
+
transition: color 250ms ease, opacity 250ms ease;
|
|
891
|
+
}
|
|
892
|
+
.sse-viewer .sse-vrPrompt > .sse-vrPromptPill > svg {
|
|
893
|
+
display: block;
|
|
894
|
+
width: 48px;
|
|
895
|
+
height: 48px;
|
|
896
|
+
}
|
|
897
|
+
.sse-viewer .sse-vrPrompt > .sse-vrPromptPill > svg > g.sse-stroke {
|
|
898
|
+
fill: none;
|
|
899
|
+
stroke: black;
|
|
900
|
+
stroke-width: 2;
|
|
901
|
+
stroke-linejoin: round;
|
|
902
|
+
opacity: 0.4;
|
|
903
|
+
}
|
|
904
|
+
.sse-viewer .sse-vrPrompt > .sse-vrPromptPill > svg > g.sse-fill {
|
|
905
|
+
fill: currentColor;
|
|
906
|
+
stroke: none;
|
|
907
|
+
}
|
|
908
|
+
.sse-viewer .sse-vrPrompt.sse-vrPromptLoading > .sse-vrPromptPill {
|
|
909
|
+
color: var(--sse-text);
|
|
910
|
+
opacity: 0.8;
|
|
911
|
+
}
|
|
912
|
+
.sse-viewer {
|
|
913
|
+
/* what to do about a stalled VR request: low in the viewer, taps passing through */
|
|
914
|
+
}
|
|
915
|
+
.sse-viewer .sse-xrHint {
|
|
916
|
+
position: absolute;
|
|
917
|
+
left: 50%;
|
|
918
|
+
bottom: 96px;
|
|
919
|
+
transform: translateX(-50%);
|
|
920
|
+
padding: 12px 20px;
|
|
921
|
+
border-radius: 20px;
|
|
922
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
923
|
+
pointer-events: none;
|
|
924
|
+
white-space: nowrap;
|
|
925
|
+
font-size: 15px;
|
|
926
|
+
color: var(--sse-text-light);
|
|
927
|
+
background-color: color-mix(in srgb, var(--sse-bkg) 50%, transparent);
|
|
928
|
+
backdrop-filter: blur(20px);
|
|
929
|
+
-webkit-backdrop-filter: blur(20px);
|
|
930
|
+
}
|
|
807
931
|
.sse-viewer .sse-tooltip {
|
|
808
932
|
display: none;
|
|
809
933
|
position: absolute;
|
package/dist/viewer.d.ts
CHANGED
|
@@ -51,26 +51,44 @@ type ViewerFlags = {
|
|
|
51
51
|
colorize?: boolean;
|
|
52
52
|
/** Load all streaming LOD data before the first frame. */
|
|
53
53
|
fullload?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Offer VR at once: where VR can start, a prompt shows over the viewer while it loads, and a
|
|
56
|
+
* tap on it starts a VR session as soon as the scene is placed, the rest of the scene streaming
|
|
57
|
+
* in during the session; a tap elsewhere dismisses it. A session needs a tap: browsers start
|
|
58
|
+
* none without one. The camera animation starts paused, as with `noanim`. Needs the ui.
|
|
59
|
+
* Defaults to `false`.
|
|
60
|
+
*/
|
|
61
|
+
vr?: boolean;
|
|
54
62
|
/** Render with antialiasing. */
|
|
55
63
|
aa?: boolean;
|
|
56
64
|
/**
|
|
57
|
-
*
|
|
58
|
-
* depth buffer also serves picking
|
|
59
|
-
*
|
|
65
|
+
* Developer override of the Stochastic setting: `true` forces the stochastic splat renderer
|
|
66
|
+
* (unsorted, depth-tested splats whose depth buffer also serves picking) in its per-pixel
|
|
67
|
+
* mode, `'mobile'` in its interleaved-pixel-sets mode, and `'off'` hides the setting and keeps
|
|
68
|
+
* the engine's sorted renderer. Without it the user's Stochastic toggle decides, and the
|
|
69
|
+
* device class picks the mode. WebGPU only; ignored on WebGL. The renderer draws WebGPU XR
|
|
70
|
+
* sessions too, one view per eye (Safari on Apple Vision Pro); where only WebGL could host a
|
|
71
|
+
* session, the viewer offers a reload into WebGL.
|
|
60
72
|
*/
|
|
61
|
-
stochastic?: boolean;
|
|
73
|
+
stochastic?: boolean | 'mobile' | 'off';
|
|
62
74
|
/**
|
|
63
75
|
* Developer knob for the stochastic renderer: the data path that feeds it. Default
|
|
64
|
-
* `
|
|
76
|
+
* `direct`, the resident files read in place; `workbuffer` reads the engine's work buffer.
|
|
65
77
|
*/
|
|
66
|
-
splatSource?: 'workbuffer' | 'direct'
|
|
78
|
+
splatSource?: 'workbuffer' | 'direct';
|
|
67
79
|
/**
|
|
68
80
|
* Developer knob for the stochastic renderer: comma-separated `key:value` experiment
|
|
69
|
-
* switches, e.g. `
|
|
81
|
+
* switches applied over the chosen mode's, e.g. `coverage:interleaved,jitter:2`.
|
|
70
82
|
*/
|
|
71
83
|
variant?: string;
|
|
72
|
-
/** Splat budget in millions, overriding the
|
|
84
|
+
/** Splat budget in millions, overriding the Quality slider's ladder (every position then gives it). */
|
|
73
85
|
budget?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Developer knob: while the viewer renders on demand, the most rendered frames the gpu may
|
|
88
|
+
* have unfinished before the next continuous render (the camera moving, the stochastic
|
|
89
|
+
* renderer accumulating) waits for one to finish; `0` lets them queue. Defaults to `2`.
|
|
90
|
+
*/
|
|
91
|
+
framesInFlight?: number;
|
|
74
92
|
/** Render the collision heatmap debug overlay (WebGPU only). */
|
|
75
93
|
heatmap?: boolean;
|
|
76
94
|
/** Open the developer debug panel on load; Ctrl+Shift+D toggles it either way. */
|
|
@@ -132,10 +150,41 @@ type CameraMode = 'orbit' | 'anim' | 'fly' | 'walk';
|
|
|
132
150
|
type InputMode = 'desktop' | 'touch';
|
|
133
151
|
/** Immersive session kind accepted by {@link ViewerHandle.startXR}. */
|
|
134
152
|
type XrMode = 'ar' | 'vr';
|
|
153
|
+
/**
|
|
154
|
+
* A position of the Quality slider, left to right. Each picks the splat budget from the device
|
|
155
|
+
* class's ladder (desktop 2 / 4 / 8 / 16 million, phones and tablets 1 / 2 / 4 / 8), and on the
|
|
156
|
+
* sorted renderer `performance` also renders at half resolution (the stochastic renderer keeps
|
|
157
|
+
* full resolution). Positions the device cannot hold are listed out of
|
|
158
|
+
* {@link ViewerState.qualityAvailable}.
|
|
159
|
+
*/
|
|
160
|
+
type QualityLevel = 'performance' | 'default' | 'high' | 'max';
|
|
135
161
|
type State = {
|
|
136
162
|
/** True once the first complete frame has rendered. */
|
|
137
163
|
loaded: boolean;
|
|
138
|
-
/**
|
|
164
|
+
/**
|
|
165
|
+
* The Quality slider's position: the splat budget, and at `performance` half resolution on the
|
|
166
|
+
* sorted renderer.
|
|
167
|
+
* Persisted in local storage; defaults to `performance` on phones and tablets, `default`
|
|
168
|
+
* elsewhere. A position the device cannot hold falls back to the nearest available below it.
|
|
169
|
+
* An XR session that cannot hold it draws at the nearest it can below, and leaves it unchanged.
|
|
170
|
+
*/
|
|
171
|
+
quality: QualityLevel;
|
|
172
|
+
/**
|
|
173
|
+
* The positions the device can hold, in slider order. Read-only: decided from the gpu's
|
|
174
|
+
* storage-binding limit and a memory estimate per position, for both renderers where the
|
|
175
|
+
* stochastic setting can switch between them, so switching never changes the budget.
|
|
176
|
+
*/
|
|
177
|
+
qualityAvailable: QualityLevel[];
|
|
178
|
+
/**
|
|
179
|
+
* Draw with the stochastic splat renderer (unsorted, depth-tested splats, temporally
|
|
180
|
+
* accumulated) instead of the engine's sorted one. WebGPU only, and not offered in Quest or
|
|
181
|
+
* Pico browsers, where the toggle has no effect. Persisted; off by default. Switches at runtime.
|
|
182
|
+
*/
|
|
183
|
+
stochastic: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* @deprecated An alias of `quality`: true is `performance`, false is `default`. Kept for one
|
|
186
|
+
* release for hosts that set it; use `quality`.
|
|
187
|
+
*/
|
|
139
188
|
performanceMode: boolean;
|
|
140
189
|
/** Content loading progress, 0 to 100. */
|
|
141
190
|
progress: number;
|
|
@@ -179,6 +228,12 @@ type State = {
|
|
|
179
228
|
selectedAnnotation: number | null;
|
|
180
229
|
/** Mouse-look and joystick movement rather than click-to-navigate. Persisted. */
|
|
181
230
|
gamingControls: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* In XR with tracked hands, a left fist held upright for two seconds, the right hand open,
|
|
233
|
+
* puts the scene or object in miniature on top of the fist, like an ice cream in its cone,
|
|
234
|
+
* until the hand opens. Persisted; off by default. The XR menu offers it as Ice Cream.
|
|
235
|
+
*/
|
|
236
|
+
iceCream: boolean;
|
|
182
237
|
/**
|
|
183
238
|
* Gates the inputs the dom cannot route by hit-testing, because their listeners sit on
|
|
184
239
|
* `window`: the keyboard (both the engine's source and the viewer's own shortcuts) and the
|
|
@@ -187,7 +242,7 @@ type State = {
|
|
|
187
242
|
*/
|
|
188
243
|
inputEnabled: boolean;
|
|
189
244
|
};
|
|
190
|
-
type WritableStateKey = 'cameraMode' | 'performanceMode' | 'showAnnotations' | 'gamingControls' | 'animationPaused' | 'collisionOverlayEnabled' | 'controlsHidden' | 'inputEnabled';
|
|
245
|
+
type WritableStateKey = 'cameraMode' | 'quality' | 'stochastic' | 'performanceMode' | 'showAnnotations' | 'gamingControls' | 'iceCream' | 'animationPaused' | 'collisionOverlayEnabled' | 'controlsHidden' | 'inputEnabled';
|
|
191
246
|
/**
|
|
192
247
|
* The viewer's state as a host sees it: one observable object, with the keys the viewer owns
|
|
193
248
|
* marked read-only. Writing a read-only key is ignored, and the viewer overwrites it.
|
|
@@ -287,4 +342,4 @@ type ViewerHandle = {
|
|
|
287
342
|
declare const createViewer: (options: CreateViewerOptions) => Promise<ViewerHandle>;
|
|
288
343
|
|
|
289
344
|
export { createViewer };
|
|
290
|
-
export type { CaptureOptions, CaptureResult, CreateViewerOptions, ViewerAssets, ViewerFlags, ViewerHandle, ViewerState, XrMode };
|
|
345
|
+
export type { CaptureOptions, CaptureResult, CreateViewerOptions, QualityLevel, ViewerAssets, ViewerFlags, ViewerHandle, ViewerState, XrMode };
|