@playcanvas/supersplat-viewer 1.20.0 → 1.20.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/supersplat-viewer",
3
- "version": "1.20.0",
3
+ "version": "1.20.2",
4
4
  "author": "PlayCanvas <support@playcanvas.com>",
5
5
  "homepage": "https://github.com/playcanvas/supersplat-viewer#readme",
6
6
  "description": "Viewer for https://superspl.at",
package/public/index.html CHANGED
@@ -21,11 +21,20 @@
21
21
  const settingsUrl = url.searchParams.has('settings') ? url.searchParams.get('settings') : './settings.json';
22
22
  const contentUrl = url.searchParams.has('content') ? url.searchParams.get('content') : './scene.compressed.ply';
23
23
 
24
+ // ?webgpu picks the best WebGPU renderer for the platform: compute on
25
+ // macOS (where the raster gpu-sort path stalls) and gpu-sort elsewhere.
26
+ // Prefer userAgentData when available, fall back to the deprecated
27
+ // navigator.platform / userAgent. Exclude iPad desktop mode, which
28
+ // reports as Mac but should not take the macOS path.
29
+ const uaPlatform = navigator.userAgentData?.platform || navigator.platform || navigator.userAgent || '';
30
+ const isIPad = navigator.maxTouchPoints > 1 && /Mac/i.test(navigator.platform || '');
31
+ const isMac = !isIPad && /macOS|Mac/i.test(uaPlatform);
24
32
  const renderer =
25
- url.searchParams.has('compute') ? 'compute' :
26
- url.searchParams.has('gpu') ? 'gpu' :
27
- url.searchParams.has('cpu') ? 'cpu' :
28
- 'webgl';
33
+ url.searchParams.has('compute') ? 'compute' :
34
+ url.searchParams.has('gpu-sort') ? 'gpu-sort' :
35
+ url.searchParams.has('cpu-sort') ? 'cpu-sort' :
36
+ url.searchParams.has('webgpu') ? (isMac ? 'compute' : 'gpu-sort') :
37
+ 'webgl';
29
38
 
30
39
  const budgetParam = url.searchParams.get('budget');
31
40
  const budget = budgetParam !== null ? Number(budgetParam) : undefined;
package/public/index.js CHANGED
@@ -22301,7 +22301,7 @@ class FramePassUpdateClustered extends FramePass {
22301
22301
  }
22302
22302
 
22303
22303
  let _skinUpdateIndex = 0;
22304
- const viewProjMat = new Mat4();
22304
+ const viewProjMat$1 = new Mat4();
22305
22305
  const viewInvMat = new Mat4();
22306
22306
  const viewMat = new Mat4();
22307
22307
  const viewMat3 = new Mat3();
@@ -22454,12 +22454,12 @@ class Renderer {
22454
22454
  this.viewId.setValue(viewMat.data);
22455
22455
  viewMat3.setFromMat4(viewMat);
22456
22456
  this.viewId3.setValue(viewMat3.data);
22457
- viewProjMat.mul2(projMat, viewMat);
22458
- this.viewProjId.setValue(viewProjMat.data);
22459
- camera._storeShaderMatrices(viewProjMat, jitterX, jitterY, this.device.renderVersion);
22457
+ viewProjMat$1.mul2(projMat, viewMat);
22458
+ this.viewProjId.setValue(viewProjMat$1.data);
22459
+ camera._storeShaderMatrices(viewProjMat$1, jitterX, jitterY, this.device.renderVersion);
22460
22460
  this.flipYId.setValue(flipY ? -1 : 1);
22461
22461
  this.dispatchViewPos(camera._node.getPosition());
22462
- camera.frustum.setFromMat4(viewProjMat);
22462
+ camera.frustum.setFromMat4(viewProjMat$1);
22463
22463
  }
22464
22464
  this.tbnBasis.setValue(flipY ? -1 : 1);
22465
22465
  this.cameraParamsId.setValue(camera.fillShaderParams(this.cameraParams));
@@ -22511,11 +22511,11 @@ class Renderer {
22511
22511
  updateCameraFrustum(camera) {
22512
22512
  if (camera.xr && camera.xr.views.list.length) {
22513
22513
  const views = camera.xr.views.list;
22514
- viewProjMat.mul2(views[0].projMat, views[0].viewOffMat);
22515
- camera.frustum.setFromMat4(viewProjMat);
22514
+ viewProjMat$1.mul2(views[0].projMat, views[0].viewOffMat);
22515
+ camera.frustum.setFromMat4(viewProjMat$1);
22516
22516
  for(let v = 1; v < views.length; v++){
22517
- viewProjMat.mul2(views[v].projMat, views[v].viewOffMat);
22518
- tempFrustum.setFromMat4(viewProjMat);
22517
+ viewProjMat$1.mul2(views[v].projMat, views[v].viewOffMat);
22518
+ tempFrustum.setFromMat4(viewProjMat$1);
22519
22519
  camera.frustum.add(tempFrustum);
22520
22520
  }
22521
22521
  return;
@@ -22533,8 +22533,8 @@ class Renderer {
22533
22533
  this.viewInvId.setValue(viewInvMat.data);
22534
22534
  }
22535
22535
  viewMat.copy(viewInvMat).invert();
22536
- viewProjMat.mul2(projMat, viewMat);
22537
- camera.frustum.setFromMat4(viewProjMat);
22536
+ viewProjMat$1.mul2(projMat, viewMat);
22537
+ camera.frustum.setFromMat4(viewProjMat$1);
22538
22538
  }
22539
22539
  setBaseConstants(device, material) {
22540
22540
  device.setCullMode(material.cull);
@@ -79021,39 +79021,349 @@ class CameraManager {
79021
79021
  }
79022
79022
  }
79023
79023
 
79024
- const pickerScale = 0.25;
79024
+ /**
79025
+ * Double-click world picking for splat scenes.
79026
+ *
79027
+ * - **Compute renderer (WebGPU tiled-compute)**: uses engine `Picker` with depth enabled — expected
79028
+ * depth is already provided by the tile-composite path.
79029
+ * - **Raster renderers (WebGL, CPU / GPU sort, etc.)**: custom `pickPS` / `gsplatPS` patch plus
79030
+ * `RGBA16F` alpha-weighted depth accumulation, because the stock pick pass encodes splat IDs /
79031
+ * last-fragment depth rather than expected depth.
79032
+ */
79033
+ // Override global picking to pack alpha-weighted splat depth instead of meshInstance id.
79034
+ const pickDepthGlsl = /* glsl */ `
79035
+ vec4 encodePickOutput(uint id) {
79036
+ const vec4 inv = vec4(1.0 / 255.0);
79037
+ const uvec4 shifts = uvec4(16, 8, 0, 24);
79038
+ uvec4 col = (uvec4(id) >> shifts) & uvec4(0xff);
79039
+ return vec4(col) * inv;
79040
+ }
79041
+
79042
+ #ifdef GSPLAT_PICK_DEPTH
79043
+ #ifndef CAMERAPLANES
79044
+ #define CAMERAPLANES
79045
+ uniform vec4 camera_params; // x: 1/far, y: far, z: near, w: isOrtho
79046
+ #endif
79047
+
79048
+ vec4 getPickOutput() {
79049
+ float normalizedDepth;
79050
+ if (camera_params.w > 0.5) {
79051
+ normalizedDepth = gl_FragCoord.z;
79052
+ } else {
79053
+ float linearDepth = 1.0 / gl_FragCoord.w;
79054
+ normalizedDepth = (linearDepth - camera_params.z) / (camera_params.y - camera_params.z);
79055
+ }
79056
+
79057
+ return vec4(gaussianColor.a * normalizedDepth, 0.0, 0.0, gaussianColor.a);
79058
+ }
79059
+ #else
79060
+ #ifndef PICK_CUSTOM_ID
79061
+ uniform uint meshInstanceId;
79062
+
79063
+ vec4 getPickOutput() {
79064
+ return encodePickOutput(meshInstanceId);
79065
+ }
79066
+ #endif
79067
+ #endif
79068
+
79069
+ #ifdef DEPTH_PICK_PASS
79070
+ #include "floatAsUintPS"
79071
+ #ifndef CAMERAPLANES
79072
+ #define CAMERAPLANES
79073
+ uniform vec4 camera_params; // x: 1/far, y: far, z: near, w: isOrtho
79074
+ #endif
79075
+
79076
+ vec4 getPickDepth() {
79077
+ float linearDepth;
79078
+ if (camera_params.w > 0.5) {
79079
+ linearDepth = gl_FragCoord.z;
79080
+ } else {
79081
+ float viewDist = 1.0 / gl_FragCoord.w;
79082
+ linearDepth = (viewDist - camera_params.z) / (camera_params.y - camera_params.z);
79083
+ }
79084
+ return float2uint(linearDepth);
79085
+ }
79086
+ #endif
79087
+ `;
79088
+ const pickDepthWgsl = /* wgsl */ `
79089
+ fn encodePickOutput(id: u32) -> vec4f {
79090
+ let inv: vec4f = vec4f(1.0 / 255.0);
79091
+ let shifts: vec4u = vec4u(16u, 8u, 0u, 24u);
79092
+ let col: vec4u = (vec4u(id) >> shifts) & vec4u(0xffu);
79093
+ return vec4f(col) * inv;
79094
+ }
79095
+
79096
+ #ifdef GSPLAT_PICK_DEPTH
79097
+ #ifndef CAMERAPLANES
79098
+ #define CAMERAPLANES
79099
+ uniform camera_params: vec4f; // x: 1/far, y: far, z: near, w: isOrtho
79100
+ #endif
79101
+
79102
+ fn getPickOutput() -> vec4f {
79103
+ var normalizedDepth: f32;
79104
+ if (uniform.camera_params.w > 0.5) {
79105
+ normalizedDepth = pcPosition.z;
79106
+ } else {
79107
+ let linearDepth = 1.0 / pcPosition.w;
79108
+ normalizedDepth = (linearDepth - uniform.camera_params.z) / (uniform.camera_params.y - uniform.camera_params.z);
79109
+ }
79110
+
79111
+ let a = f32(gaussianColor.a);
79112
+ return vec4f(a * normalizedDepth, 0.0, 0.0, a);
79113
+ }
79114
+ #else
79115
+ #ifndef PICK_CUSTOM_ID
79116
+ uniform meshInstanceId: u32;
79117
+
79118
+ fn getPickOutput() -> vec4f {
79119
+ return encodePickOutput(uniform.meshInstanceId);
79120
+ }
79121
+ #endif
79122
+ #endif
79123
+
79124
+ #ifdef DEPTH_PICK_PASS
79125
+ #include "floatAsUintPS"
79126
+ #ifndef CAMERAPLANES
79127
+ #define CAMERAPLANES
79128
+ uniform camera_params: vec4f; // x: 1/far, y: far, z: near, w: isOrtho
79129
+ #endif
79130
+
79131
+ fn getPickDepth() -> vec4f {
79132
+ var linearDepth: f32;
79133
+ if (uniform.camera_params.w > 0.5) {
79134
+ linearDepth = pcPosition.z;
79135
+ } else {
79136
+ let viewDist = 1.0 / pcPosition.w;
79137
+ linearDepth = (viewDist - uniform.camera_params.z) / (uniform.camera_params.y - uniform.camera_params.z);
79138
+ }
79139
+ return float2uint(linearDepth);
79140
+ }
79141
+ #endif
79142
+ `;
79143
+ const pickPassChunkInjected = [
79144
+ '#ifdef PICK_PASS',
79145
+ ' #define GSPLAT_PICK_DEPTH',
79146
+ ' #include "pickPS"',
79147
+ '#endif'
79148
+ ].join('\n');
79149
+ const safeChunkReplace = (s, find, repl) => {
79150
+ const out = s.replace(find, repl);
79151
+ if (out === s) {
79152
+ throw new Error('picker: engine gsplat/pick chunk patch failed (engine version mismatch?)');
79153
+ }
79154
+ return out;
79155
+ };
79156
+ const patchGsplatPickGlsl = (chunk) => {
79157
+ return safeChunkReplace(safeChunkReplace(chunk, /#ifdef PICK_PASS\s*#include "pickPS"\s*#endif/, pickPassChunkInjected), 'pcFragColor0 = encodePickOutput(vPickId);', 'pcFragColor0 = getPickOutput();');
79158
+ };
79159
+ const patchGsplatPickWgsl = (chunk) => {
79160
+ return safeChunkReplace(safeChunkReplace(chunk, /#ifdef PICK_PASS\s*#include "pickPS"\s*#endif/, pickPassChunkInjected), 'output.color = encodePickOutput(vPickId);', 'output.color = getPickOutput();');
79161
+ };
79162
+ /** Per-device original chunk strings + refcount so we can restore after the last Picker releases. */
79163
+ const pickerShaderPatchState = new WeakMap();
79164
+ const vec4 = new Vec4();
79165
+ const viewProjMat = new Mat4();
79166
+ const clearColor = new Color(0, 0, 0, 1);
79167
+ // Shared buffer for half-to-float conversion
79168
+ const float32 = new Float32Array(1);
79169
+ const uint32 = new Uint32Array(float32.buffer);
79170
+ // Convert 16-bit half-float to 32-bit float using bit manipulation.
79171
+ const half2Float = (h) => {
79172
+ const sign = (h & 0x8000) << 16;
79173
+ const exponent = (h & 0x7C00) >> 10;
79174
+ const mantissa = h & 0x03FF;
79175
+ if (exponent === 0) {
79176
+ if (mantissa === 0) {
79177
+ uint32[0] = sign;
79178
+ }
79179
+ else {
79180
+ let e = -1;
79181
+ let m = mantissa;
79182
+ do {
79183
+ e++;
79184
+ m <<= 1;
79185
+ } while ((m & 0x0400) === 0);
79186
+ uint32[0] = sign | ((127 - 15 - e) << 23) | ((m & 0x03FF) << 13);
79187
+ }
79188
+ }
79189
+ else if (exponent === 31) {
79190
+ uint32[0] = sign | 0x7F800000 | (mantissa << 13);
79191
+ }
79192
+ else {
79193
+ uint32[0] = sign | ((exponent + 127 - 15) << 23) | (mantissa << 13);
79194
+ }
79195
+ return float32[0];
79196
+ };
79197
+ const registerPickerShaderPatches = (app) => {
79198
+ const device = app.graphicsDevice;
79199
+ const existing = pickerShaderPatchState.get(device);
79200
+ if (existing) {
79201
+ existing.refCount++;
79202
+ return;
79203
+ }
79204
+ const glslChunks = ShaderChunks.get(device, 'glsl');
79205
+ const wgslChunks = ShaderChunks.get(device, 'wgsl');
79206
+ const glslPickPS = glslChunks.get('pickPS');
79207
+ const glslGsplatPS = glslChunks.get('gsplatPS');
79208
+ const wgslPickPS = wgslChunks.get('pickPS');
79209
+ const wgslGsplatPS = wgslChunks.get('gsplatPS');
79210
+ // Patch strings before mutating ShaderChunks so engine mismatches leave globals untouched.
79211
+ const patchedGlslGsplatPS = patchGsplatPickGlsl(glslGsplatPS);
79212
+ const patchedWgslGsplatPS = patchGsplatPickWgsl(wgslGsplatPS);
79213
+ const state = {
79214
+ glslPickPS,
79215
+ glslGsplatPS,
79216
+ wgslPickPS,
79217
+ wgslGsplatPS,
79218
+ refCount: 1
79219
+ };
79220
+ pickerShaderPatchState.set(device, state);
79221
+ glslChunks.set('pickPS', pickDepthGlsl);
79222
+ wgslChunks.set('pickPS', pickDepthWgsl);
79223
+ glslChunks.set('gsplatPS', patchedGlslGsplatPS);
79224
+ wgslChunks.set('gsplatPS', patchedWgslGsplatPS);
79225
+ };
79226
+ const unregisterPickerShaderPatches = (app) => {
79227
+ const device = app.graphicsDevice;
79228
+ const state = pickerShaderPatchState.get(device);
79229
+ if (!state) {
79230
+ return;
79231
+ }
79232
+ state.refCount--;
79233
+ if (state.refCount > 0) {
79234
+ return;
79235
+ }
79236
+ const glslChunks = ShaderChunks.get(device, 'glsl');
79237
+ const wgslChunks = ShaderChunks.get(device, 'wgsl');
79238
+ glslChunks.set('pickPS', state.glslPickPS);
79239
+ glslChunks.set('gsplatPS', state.glslGsplatPS);
79240
+ wgslChunks.set('pickPS', state.wgslPickPS);
79241
+ wgslChunks.set('gsplatPS', state.wgslGsplatPS);
79242
+ pickerShaderPatchState.delete(device);
79243
+ };
79244
+ const getWorldPoint = (camera, x, y, width, height, normalizedDepth) => {
79245
+ if (!Number.isFinite(normalizedDepth) || normalizedDepth < 0 || normalizedDepth > 1) {
79246
+ return null;
79247
+ }
79248
+ const cam = camera.camera;
79249
+ const far = cam.farClip;
79250
+ const near = cam.nearClip;
79251
+ const ndcDepth = cam.projection === PROJECTION_ORTHOGRAPHIC ?
79252
+ normalizedDepth :
79253
+ far * normalizedDepth / (normalizedDepth * (far - near) + near);
79254
+ viewProjMat.mul2(cam.projectionMatrix, cam.viewMatrix).invert();
79255
+ vec4.set(x / width * 2 - 1, (1 - y / height) * 2 - 1, ndcDepth * 2 - 1, 1);
79256
+ viewProjMat.transformVec4(vec4, vec4);
79257
+ if (!Number.isFinite(vec4.w) || Math.abs(vec4.w) < 1e-8) {
79258
+ return null;
79259
+ }
79260
+ vec4.mulScalar(1 / vec4.w);
79261
+ if (!Number.isFinite(vec4.x) || !Number.isFinite(vec4.y) || !Number.isFinite(vec4.z)) {
79262
+ return null;
79263
+ }
79264
+ return new Vec3(vec4.x, vec4.y, vec4.z);
79265
+ };
79025
79266
  class Picker {
79026
79267
  pick;
79027
79268
  release;
79028
79269
  constructor(app, camera) {
79029
- const picker = new Picker$1(app, 1, 1, true);
79270
+ const { graphicsDevice } = app;
79271
+ let enginePicker;
79272
+ let accumBuffer;
79273
+ let accumTarget;
79274
+ let accumPass;
79275
+ let chunksPatched = false;
79276
+ const initRasterAccum = (width, height) => {
79277
+ accumBuffer = new Texture(graphicsDevice, {
79278
+ format: PIXELFORMAT_RGBA16F,
79279
+ width,
79280
+ height,
79281
+ mipmaps: false,
79282
+ minFilter: FILTER_NEAREST,
79283
+ magFilter: FILTER_NEAREST,
79284
+ addressU: ADDRESS_CLAMP_TO_EDGE,
79285
+ addressV: ADDRESS_CLAMP_TO_EDGE,
79286
+ name: 'picker-accum'
79287
+ });
79288
+ accumTarget = new RenderTarget({
79289
+ colorBuffer: accumBuffer,
79290
+ depth: false // not needed — gaussians are rendered back to front
79291
+ });
79292
+ accumPass = new RenderPassPicker(graphicsDevice, app.renderer);
79293
+ // RGB: additive depth accumulation. Alpha: multiplicative transmittance.
79294
+ accumPass.blendState = new BlendState(true, BLENDEQUATION_ADD, BLENDMODE_ONE, BLENDMODE_ONE_MINUS_SRC_ALPHA, BLENDEQUATION_ADD, BLENDMODE_ZERO, BLENDMODE_ONE_MINUS_SRC_ALPHA);
79295
+ };
79296
+ const readTexture = (texture, x, y, target) => {
79297
+ const texY = graphicsDevice.isWebGL2 ? target.height - y - 1 : y;
79298
+ return texture.read(x, texY, 1, 1, {
79299
+ renderTarget: target,
79300
+ immediate: true
79301
+ });
79302
+ };
79030
79303
  this.pick = async (x, y) => {
79031
- const width = Math.ceil(app.graphicsDevice.width * pickerScale);
79032
- const height = Math.ceil(app.graphicsDevice.height * pickerScale);
79304
+ const width = Math.floor(graphicsDevice.width);
79305
+ const height = Math.floor(graphicsDevice.height);
79033
79306
  // bail out if the device hasn't been sized yet
79034
79307
  if (width <= 0 || height <= 0) {
79035
79308
  return null;
79036
79309
  }
79037
- // clamp normalized inputs and convert to integer pixel coordinates
79038
- // in [0, width-1] / [0, height-1] so an exact 1.0 doesn't fall off the texture.
79039
- const px = Math.min(width - 1, Math.max(0, Math.floor(x * width)));
79040
- const py = Math.min(height - 1, Math.max(0, Math.floor(y * height)));
79310
+ const screenX = Math.min(width - 1, Math.max(0, Math.floor(x * width)));
79311
+ const screenY = Math.min(height - 1, Math.max(0, Math.floor(y * height)));
79312
+ const worldLayer = app.scene.layers.getLayerByName('World');
79313
+ if (!worldLayer) {
79314
+ return null;
79315
+ }
79041
79316
  // enable gsplat IDs only for the duration of the pick so we don't pay the
79042
79317
  // memory/perf cost between picks (picker instances are typically long-lived).
79043
79318
  const prevEnableIds = app.scene.gsplat.enableIds;
79044
79319
  app.scene.gsplat.enableIds = true;
79045
- picker.resize(width, height);
79046
- const worldLayer = app.scene.layers.getLayerByName('World');
79047
- picker.prepare(camera.camera, app.scene, [worldLayer]);
79048
- const result = await picker.getWorldPointAsync(px, py);
79049
- // pick is only invoked from user dblclick events, so concurrent invocations
79050
- // (which would race on enableIds) aren't a concern in practice.
79051
- // eslint-disable-next-line require-atomic-updates
79052
- app.scene.gsplat.enableIds = prevEnableIds;
79053
- return result;
79320
+ try {
79321
+ if (app.scene.gsplat.currentRenderer === GSPLAT_RENDERER_COMPUTE) {
79322
+ enginePicker ??= new Picker$1(app, 1, 1, true);
79323
+ enginePicker.resize(width, height);
79324
+ enginePicker.prepare(camera.camera, app.scene, [worldLayer]);
79325
+ return await enginePicker.getWorldPointAsync(screenX, screenY);
79326
+ }
79327
+ if (!chunksPatched) {
79328
+ registerPickerShaderPatches(app);
79329
+ chunksPatched = true;
79330
+ }
79331
+ if (!accumPass) {
79332
+ initRasterAccum(width, height);
79333
+ }
79334
+ else {
79335
+ accumTarget.resize(width, height);
79336
+ }
79337
+ accumPass.init(accumTarget);
79338
+ accumPass.setClearColor(clearColor);
79339
+ accumPass.update(camera.camera, app.scene, [worldLayer], new Map(), false);
79340
+ accumPass.render();
79341
+ const pixels = await readTexture(accumBuffer, screenX, screenY, accumTarget);
79342
+ const r = half2Float(pixels[0]);
79343
+ const transmittance = half2Float(pixels[3]);
79344
+ const alpha = 1 - transmittance;
79345
+ if (!Number.isFinite(r) || !Number.isFinite(alpha) || alpha < 1e-6) {
79346
+ return null;
79347
+ }
79348
+ const normalizedDepth = r / alpha;
79349
+ return getWorldPoint(camera, screenX, screenY, width, height, normalizedDepth);
79350
+ }
79351
+ finally {
79352
+ // Pick is only invoked from user dblclick events, so concurrent invocations
79353
+ // (which would race on enableIds) aren't a concern in practice.
79354
+ // eslint-disable-next-line require-atomic-updates
79355
+ app.scene.gsplat.enableIds = prevEnableIds;
79356
+ }
79054
79357
  };
79055
79358
  this.release = () => {
79056
- picker.destroy();
79359
+ if (chunksPatched) {
79360
+ unregisterPickerShaderPatches(app);
79361
+ chunksPatched = false;
79362
+ }
79363
+ enginePicker?.destroy();
79364
+ accumPass?.destroy();
79365
+ accumTarget?.destroy();
79366
+ accumBuffer?.destroy();
79057
79367
  };
79058
79368
  }
79059
79369
  }
@@ -80467,8 +80777,8 @@ fn prepareOutputFromGamma(gammaColor: vec3f, depth: f32) -> vec3f {
80467
80777
  `;
80468
80778
  const rendererTable = {
80469
80779
  'webgl': GSPLAT_RENDERER_RASTER_CPU_SORT,
80470
- 'cpu': GSPLAT_RENDERER_RASTER_CPU_SORT,
80471
- 'gpu': GSPLAT_RENDERER_RASTER_GPU_SORT,
80780
+ 'cpu-sort': GSPLAT_RENDERER_RASTER_CPU_SORT,
80781
+ 'gpu-sort': GSPLAT_RENDERER_RASTER_GPU_SORT,
80472
80782
  'compute': GSPLAT_RENDERER_COMPUTE
80473
80783
  };
80474
80784
  const tonemapTable = {
@@ -81786,7 +82096,7 @@ const initXr = (global) => {
81786
82096
  });
81787
82097
  };
81788
82098
 
81789
- var version = "1.20.0";
82099
+ var version = "1.20.2";
81790
82100
 
81791
82101
  const loadGsplat = async (app, config, progressCallback) => {
81792
82102
  const { contents, contentUrl, aa } = config;
@@ -81856,6 +82166,7 @@ const createApp = async (canvas, config) => {
81856
82166
  xrCompatible: !useWebGPU,
81857
82167
  powerPreference: 'high-performance'
81858
82168
  });
82169
+ console.log(`Renderer: ${device.deviceType}, ${config.renderer === 'webgl' ? 'cpu-sort' : config.renderer}`);
81859
82170
  // Set maxPixelRatio so the XR framebuffer scale factor is computed correctly.
81860
82171
  // Regular rendering bypasses maxPixelRatio via the custom initCanvas sizing.
81861
82172
  device.maxPixelRatio = window.devicePixelRatio;