@playcanvas/supersplat-viewer 1.26.1 → 1.26.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.26.1",
3
+ "version": "1.26.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",
@@ -51,7 +51,7 @@
51
51
  "concurrently": "9.2.1",
52
52
  "eslint": "9.39.4",
53
53
  "globals": "17.6.0",
54
- "playcanvas": "2.19.1",
54
+ "playcanvas": "2.19.2",
55
55
  "postcss": "8.5.15",
56
56
  "publint": "0.3.21",
57
57
  "rollup": "4.61.0",
package/public/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const TRACEID_GPU_TIMINGS = "GpuTimings";
2
2
 
3
- const version$1 = "2.19.1";
4
- const revision = "9069deb";
3
+ const version$1 = "2.19.2";
4
+ const revision = "3f52bb8";
5
5
  function extend(target, ex) {
6
6
  for (const prop in ex) {
7
7
  const copy = ex[prop];
@@ -8899,7 +8899,10 @@ class WebgpuTexture {
8899
8899
  anyLevelMissing = true;
8900
8900
  }
8901
8901
  } else {
8902
- if (this.isExternalImage(mipObject)) {
8902
+ if (device._isHTMLElementInterface(mipObject) && device.supportsHtmlTextures) {
8903
+ this.uploadElementImage(device, mipObject, mipLevel, 0);
8904
+ anyUploads = true;
8905
+ } else if (this.isExternalImage(mipObject)) {
8903
8906
  this.uploadExternalImage(device, mipObject, mipLevel, 0);
8904
8907
  anyUploads = true;
8905
8908
  } else if (ArrayBuffer.isView(mipObject)) {
@@ -8952,6 +8955,23 @@ class WebgpuTexture {
8952
8955
  dummyUse(image instanceof HTMLCanvasElement && image.getContext("2d"));
8953
8956
  device.wgpu.queue.copyExternalImageToTexture(src, dst, copySize);
8954
8957
  }
8958
+ // upload a generic HTML element via the HTML-in-Canvas API (copyElementImageToTexture)
8959
+ uploadElementImage(device, element, mipLevel, index) {
8960
+ const dst = {
8961
+ texture: this.gpuTexture,
8962
+ mipLevel,
8963
+ origin: [0, 0, index],
8964
+ aspect: "all",
8965
+ // can be: "all", "stencil-only", "depth-only"
8966
+ premultipliedAlpha: this.texture._premultiplyAlpha
8967
+ };
8968
+ const width = TextureUtils.calcLevelDimension(this.texture.width, mipLevel);
8969
+ const height = TextureUtils.calcLevelDimension(this.texture.height, mipLevel);
8970
+ device.submit();
8971
+ const source = { source: element };
8972
+ const destination = { destination: dst, width, height };
8973
+ device.wgpu.queue.copyElementImageToTexture(source, destination);
8974
+ }
8955
8975
  uploadTypedArrayData(device, data, mipLevel, index) {
8956
8976
  const texture = this.texture;
8957
8977
  const wgpu = device.wgpu;
@@ -11464,6 +11484,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
11464
11484
  }
11465
11485
  };
11466
11486
  this.wgpu = await this.gpuAdapter.requestDevice(deviceDescr);
11487
+ this.supportsHtmlTextures = typeof this.wgpu.queue?.copyElementImageToTexture === "function";
11467
11488
  this.wgpu.lost?.then(this.handleDeviceLost.bind(this));
11468
11489
  this.wgpu.addEventListener?.("uncapturederror", (ev) => {
11469
11490
  ev.error;
@@ -13030,10 +13051,7 @@ class WebglTexture {
13030
13051
  const h = Math.floor(rect.height) || texture._height;
13031
13052
  gl.texElementImage2D(
13032
13053
  gl.TEXTURE_2D,
13033
- mipLevel,
13034
13054
  this._glInternalFormat,
13035
- this._glFormat,
13036
- this._glPixelType,
13037
13055
  mipObject
13038
13056
  );
13039
13057
  if (mipLevel === 0) {
@@ -62730,8 +62748,6 @@ class GSplatManager {
62730
62748
  this.sortGpuHybrid(lastState);
62731
62749
  gpuSortedThisFrame = true;
62732
62750
  }
62733
- const fogParams = this.scene.gsplat.useFog ? this.cameraNode.camera.fogParams ?? this.scene.fog : null;
62734
- this.renderer.frameUpdate(this.scene.gsplat, this.scene.exposure, fogParams);
62735
62751
  if (sortedState?.sortedBefore) {
62736
62752
  this.updateColorCameraTracking();
62737
62753
  }
@@ -62752,6 +62768,8 @@ class GSplatManager {
62752
62768
  inst.needsLodUpdate = true;
62753
62769
  }
62754
62770
  }
62771
+ const fogParams = this.scene.gsplat.useFog ? this.cameraNode.camera.fogParams ?? this.scene.fog : null;
62772
+ this.renderer.frameUpdate(this.scene.gsplat, this.scene.exposure, fogParams);
62755
62773
  return sortedState ? sortedState.totalActiveSplats : 0;
62756
62774
  }
62757
62775
  sortGpuHybrid(worldState) {
@@ -81718,7 +81736,7 @@ const importSettings = (settings) => {
81718
81736
  return result;
81719
81737
  };
81720
81738
 
81721
- var version = "1.26.1";
81739
+ var version = "1.26.2";
81722
81740
 
81723
81741
  class Tooltip {
81724
81742
  register;