@playcanvas/supersplat-viewer 1.42.0 → 1.42.1
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.js +1 -1
- package/dist/viewer.d.ts +2 -1
- package/dist/viewer.js +20 -3
- package/dist/viewer.js.map +1 -1
- package/package.json +1 -1
- package/public/index.js +20 -3
- package/public/index.js.map +1 -1
package/dist/viewer.d.ts
CHANGED
|
@@ -32,7 +32,8 @@ type ViewerAssets = {
|
|
|
32
32
|
type ViewerFlags = {
|
|
33
33
|
/**
|
|
34
34
|
* Requested renderer; the engine falls back to WebGL when WebGPU is unavailable. Default
|
|
35
|
-
* `webgpu`.
|
|
35
|
+
* `webgpu`. For now the Quest Browser, whose WebGPU cannot host an XR session, gets `webgl`
|
|
36
|
+
* whatever is requested, unless the page url has `?webgpu`. Both are temporary.
|
|
36
37
|
*/
|
|
37
38
|
renderer?: 'webgl' | 'webgpu';
|
|
38
39
|
/**
|
package/dist/viewer.js
CHANGED
|
@@ -10023,7 +10023,7 @@ const importSettings = (settings) => {
|
|
|
10023
10023
|
return result;
|
|
10024
10024
|
};
|
|
10025
10025
|
|
|
10026
|
-
var version = "1.42.
|
|
10026
|
+
var version = "1.42.1";
|
|
10027
10027
|
|
|
10028
10028
|
class Tooltip {
|
|
10029
10029
|
register;
|
|
@@ -23589,7 +23589,11 @@ class Viewer {
|
|
|
23589
23589
|
vec.sub2(sceneBound.center, camera.position);
|
|
23590
23590
|
const dist = vec.dot(cameraEntity.forward);
|
|
23591
23591
|
const far = Math.max(dist + boundRadius, 1e-2);
|
|
23592
|
-
|
|
23592
|
+
// the near plane's floor is capped at the orbit's closest zoom: a few stray splats far
|
|
23593
|
+
// outside a scene stretch its bound, and a floor of far / 16k would then cull the
|
|
23594
|
+
// streamed nodes just in front of the camera, and flatten the stochastic renderer's
|
|
23595
|
+
// depths there
|
|
23596
|
+
const near = Math.max(dist - boundRadius, Math.min(far / (1024 * 16), 0.01));
|
|
23593
23597
|
cameraEntity.camera.farClip = far;
|
|
23594
23598
|
cameraEntity.camera.nearClip = Math.min(1.0, near);
|
|
23595
23599
|
};
|
|
@@ -24311,6 +24315,19 @@ const isPrefetchable = (contentUrl, contentFilename) => contentName(contentUrl,
|
|
|
24311
24315
|
// gsaf is an animated splat sequence, which the viewer decodes and plays itself rather than
|
|
24312
24316
|
// through an engine parser
|
|
24313
24317
|
const isGsaf = (contentUrl, contentFilename) => contentName(contentUrl, contentFilename)?.toLowerCase().endsWith('.gsaf');
|
|
24318
|
+
// TEMPORARY, until a Quest Browser release accepts a WebGPU device for WebXR again: then delete
|
|
24319
|
+
// this and its use in resolveConfig. Quest Browser 156 refuses every WebGPU device for an
|
|
24320
|
+
// immersive session, even one from an adapter requested with xrCompatible (XRGPUBinding throws
|
|
24321
|
+
// "WebGPU device must be created by an XR compatible adapter"), so VR and AR show black. The
|
|
24322
|
+
// headsets already run the sorted renderer (quality.ts keeps the stochastic one off them), so
|
|
24323
|
+
// WebGL costs them only the gpu sort. It overrides even an explicit renderer: 'webgpu', since
|
|
24324
|
+
// hosts pass one by default (superspl.at's viewer-options.ts does). A ?webgpu in the page url
|
|
24325
|
+
// opts back in, to check a new browser release for the fix. It is read here rather than in
|
|
24326
|
+
// index.html, against the rule that only the document reads url params, because hosts parse the
|
|
24327
|
+
// url themselves (superspl.at forwards its scene page's params to the viewer's document but does
|
|
24328
|
+
// not pass this one on)
|
|
24329
|
+
const questBrowser = /OculusBrowser/.test(globalThis.navigator?.userAgent ?? '') &&
|
|
24330
|
+
!new URLSearchParams(globalThis.location?.search ?? '').has('webgpu');
|
|
24314
24331
|
const loadGsplat = async (app, config, progressCallback, cancelled) => {
|
|
24315
24332
|
const { contents, contentUrl, contentFilename } = config;
|
|
24316
24333
|
const c = contents;
|
|
@@ -24499,7 +24516,7 @@ const resolveConfig = (options) => ({
|
|
|
24499
24516
|
poster: options.poster ?? (options.posterUrl ? createImage(options.posterUrl) : undefined),
|
|
24500
24517
|
contents: options.contents ??
|
|
24501
24518
|
(isPrefetchable(options.contentUrl, options.contentFilename) ? fetch(options.contentUrl) : undefined),
|
|
24502
|
-
renderer: options.renderer ?? 'webgpu',
|
|
24519
|
+
renderer: questBrowser ? 'webgl' : (options.renderer ?? 'webgpu'),
|
|
24503
24520
|
ui: options.ui ?? true,
|
|
24504
24521
|
reticle: options.reticle ?? false,
|
|
24505
24522
|
noanim: options.noanim ?? false,
|