@playcanvas/supersplat-viewer 1.15.0 → 1.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcanvas/supersplat-viewer",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
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",
@@ -41,16 +41,16 @@
41
41
  "@rollup/plugin-json": "6.1.0",
42
42
  "@rollup/plugin-node-resolve": "16.0.3",
43
43
  "@rollup/plugin-typescript": "12.3.0",
44
- "@typescript-eslint/eslint-plugin": "8.54.0",
45
- "@typescript-eslint/parser": "8.54.0",
44
+ "@typescript-eslint/eslint-plugin": "8.56.1",
45
+ "@typescript-eslint/parser": "8.56.1",
46
46
  "autoprefixer": "10.4.24",
47
47
  "concurrently": "9.2.1",
48
- "eslint": "9.39.2",
48
+ "eslint": "9.39.3",
49
49
  "globals": "17.3.0",
50
- "playcanvas": "2.16.1",
50
+ "playcanvas": "2.16.2",
51
51
  "postcss": "8.5.6",
52
52
  "publint": "0.3.17",
53
- "rollup": "4.57.1",
53
+ "rollup": "4.59.0",
54
54
  "rollup-plugin-copy": "3.5.0",
55
55
  "rollup-plugin-scss": "4.0.1",
56
56
  "rollup-plugin-string": "3.0.0",
package/public/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const TRACEID_GPU_TIMINGS = 'GpuTimings';
2
2
 
3
- const version$1 = '2.16.1';
4
- const revision = '4486208';
3
+ const version$1 = '2.16.2';
4
+ const revision = '5c8389e';
5
5
  function extend(target, ex) {
6
6
  for(const prop in ex){
7
7
  const copy = ex[prop];
@@ -8725,8 +8725,12 @@ class WebgpuShaderProcessorWGSL {
8725
8725
  }
8726
8726
  static generateFragmentOutputStruct(src, numRenderTargets) {
8727
8727
  let structCode = 'struct FragmentOutput {\n';
8728
+ const colorName = (i)=>`color${i > 0 ? i : ''}`;
8728
8729
  for(let i = 0; i < numRenderTargets; i++){
8729
- structCode += ` @location(${i}) color${i > 0 ? i : ''} : pcOutType${i},\n`;
8730
+ const name = colorName(i);
8731
+ if (src.search(new RegExp(`\\.${name}\\s*=`)) !== -1) {
8732
+ structCode += ` @location(${i}) ${name} : pcOutType${i},\n`;
8733
+ }
8730
8734
  }
8731
8735
  const needsFragDepth = src.search(/\.fragDepth\s*=/) !== -1;
8732
8736
  if (needsFragDepth) {
@@ -14264,7 +14268,8 @@ class WebglGraphicsDevice extends GraphicsDevice {
14264
14268
  });
14265
14269
  const rgbaChannels = getPixelFormatChannelsForRgbaReadback(texture._format);
14266
14270
  const needsRgbaReadback = rgbaChannels > 0;
14267
- const outputData = options.data ?? new (getPixelFormatArrayType(texture._format))(TextureUtils.calcLevelGpuSize(width, height, 1, texture._format));
14271
+ const ArrayType = getPixelFormatArrayType(texture._format);
14272
+ const outputData = options.data ?? new ArrayType(TextureUtils.calcLevelGpuSize(width, height, 1, texture._format) / ArrayType.BYTES_PER_ELEMENT);
14268
14273
  const readBuffer = needsRgbaReadback ? new Uint8Array(width * height * 4) : outputData;
14269
14274
  this.setRenderTarget(renderTarget);
14270
14275
  this.initRenderTarget(renderTarget);
@@ -31623,7 +31628,7 @@ class GSplatResourceBase {
31623
31628
  return this._format;
31624
31629
  }
31625
31630
  getTexture(name) {
31626
- return this.streams.getTexture(name);
31631
+ return this.streams.getTexture(name) ?? null;
31627
31632
  }
31628
31633
  get textureDimensions() {
31629
31634
  return this.streams.textureDimensions;
@@ -32650,8 +32655,20 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
32650
32655
  let sh0 = pack111110(resolve(uniform.sh0Mins.xyz, uniform.sh0Maxs.xyz, sh0Sample.xyz));
32651
32656
  let alpha = sigmoid(mix(uniform.sh0Mins.w, uniform.sh0Maxs.w, sh0Sample.w));
32652
32657
  #else
32653
- let scale = pack101010(resolveCodebook(scalesSample, &uniform.scales_codebook));
32654
- let sh0 = pack111110(resolveCodebook(sh0Sample.xyz, &uniform.sh0_codebook));
32658
+ let scalesIdx = vec3u(scalesSample * 255.0);
32659
+ let scalesV = vec3f(
32660
+ uniform.scales_codebook[scalesIdx.x >> 2u][scalesIdx.x & 3u],
32661
+ uniform.scales_codebook[scalesIdx.y >> 2u][scalesIdx.y & 3u],
32662
+ uniform.scales_codebook[scalesIdx.z >> 2u][scalesIdx.z & 3u]
32663
+ );
32664
+ let scale = pack101010((scalesV - uniform.scales_codebook[0].x) / (uniform.scales_codebook[63].w - uniform.scales_codebook[0].x));
32665
+ let sh0Idx = vec3u(sh0Sample.xyz * 255.0);
32666
+ let sh0V = vec3f(
32667
+ uniform.sh0_codebook[sh0Idx.x >> 2u][sh0Idx.x & 3u],
32668
+ uniform.sh0_codebook[sh0Idx.y >> 2u][sh0Idx.y & 3u],
32669
+ uniform.sh0_codebook[sh0Idx.z >> 2u][sh0Idx.z & 3u]
32670
+ );
32671
+ let sh0 = pack111110((sh0V - uniform.sh0_codebook[0].x) / (uniform.sh0_codebook[63].w - uniform.sh0_codebook[0].x));
32655
32672
  let alpha = sh0Sample.w;
32656
32673
  #endif
32657
32674
  let qmode = u32(quatsSample.w * 255.0) - 252u;
@@ -32726,7 +32743,13 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
32726
32743
  #ifdef REORDER_V1
32727
32744
  output.color = unpack8888(pack111110(shNSample));
32728
32745
  #else
32729
- output.color = unpack8888(pack111110(resolveCodebook(shNSample, &uniform.shN_codebook)));
32746
+ let shNIdx = vec3u(shNSample * 255.0);
32747
+ let shNV = vec3f(
32748
+ uniform.shN_codebook[shNIdx.x >> 2u][shNIdx.x & 3u],
32749
+ uniform.shN_codebook[shNIdx.y >> 2u][shNIdx.y & 3u],
32750
+ uniform.shN_codebook[shNIdx.z >> 2u][shNIdx.z & 3u]
32751
+ );
32752
+ output.color = unpack8888(pack111110((shNV - uniform.shN_codebook[0].x) / (uniform.shN_codebook[63].w - uniform.shN_codebook[0].x)));
32730
32753
  #endif
32731
32754
  return output;
32732
32755
  }
@@ -32753,17 +32776,7 @@ fn unpack101010(v: u32) -> vec3f {
32753
32776
  }
32754
32777
  fn unpack111110(v: u32) -> vec3f {
32755
32778
  return vec3f((vec3u(v) >> vec3u(21u, 10u, 0u)) & vec3u(0x7ffu, 0x7ffu, 0x3ffu)) / vec3f(2047.0, 2047.0, 1023.0);
32756
- }
32757
- fn resolveCodebook(s: vec3f, codebook: ptr<uniform, array<vec4f, 64>>) -> vec3f {
32758
- let idx = vec3u(s * 255.0);
32759
- let v = vec3f(
32760
- codebook[idx.x >> 2u][idx.x & 3u],
32761
- codebook[idx.y >> 2u][idx.y & 3u],
32762
- codebook[idx.z >> 2u][idx.z & 3u]
32763
- );
32764
- return (v - codebook[0].x) / (codebook[63].w - codebook[0].x);
32765
- }
32766
- `;
32779
+ }`;
32767
32780
 
32768
32781
  var glslSogCentersPS = `
32769
32782
  #include "gsplatPackingPS"
@@ -36688,7 +36701,6 @@ uniform ivec3 clusterCellsDot;
36688
36701
  uniform ivec3 clusterCellsMax;
36689
36702
  uniform vec2 shadowAtlasParams;
36690
36703
  struct ClusterLightData {
36691
- uint flags;
36692
36704
  vec3 halfWidth;
36693
36705
  bool isSpot;
36694
36706
  vec3 halfHeight;
@@ -36703,10 +36715,8 @@ struct ClusterLightData {
36703
36715
  float range;
36704
36716
  vec4 cookieChannelMask;
36705
36717
  float biasesData;
36706
- uint colorBFlagsData;
36707
36718
  float shadowBias;
36708
36719
  float shadowNormalBias;
36709
- float anglesData;
36710
36720
  float innerConeAngleCos;
36711
36721
  float outerConeAngleCos;
36712
36722
  float cookieIntensity;
@@ -36714,35 +36724,38 @@ struct ClusterLightData {
36714
36724
  bool isLightmapped;
36715
36725
  };
36716
36726
  mat4 lightProjectionMatrix;
36727
+ uint clusterLightData_flags;
36728
+ float clusterLightData_anglesData;
36729
+ uint clusterLightData_colorBFlagsData;
36717
36730
  vec4 sampleLightTextureF(const ClusterLightData clusterLightData, int index) {
36718
36731
  return texelFetch(lightsTexture, ivec2(index, clusterLightData.lightIndex), 0);
36719
36732
  }
36720
36733
  void decodeClusterLightCore(inout ClusterLightData clusterLightData, int lightIndex) {
36721
36734
  clusterLightData.lightIndex = lightIndex;
36722
36735
  vec4 halfData = sampleLightTextureF(clusterLightData, {CLUSTER_TEXTURE_COLOR_ANGLES_BIAS});
36723
- clusterLightData.anglesData = halfData.z;
36736
+ clusterLightData_anglesData = halfData.z;
36724
36737
  clusterLightData.biasesData = halfData.w;
36725
- clusterLightData.colorBFlagsData = floatBitsToUint(halfData.y);
36738
+ clusterLightData_colorBFlagsData = floatBitsToUint(halfData.y);
36726
36739
  vec2 colorRG = unpackHalf2x16(floatBitsToUint(halfData.x));
36727
- vec2 colorB_flags = unpackHalf2x16(clusterLightData.colorBFlagsData);
36740
+ vec2 colorB_flags = unpackHalf2x16(clusterLightData_colorBFlagsData);
36728
36741
  clusterLightData.color = vec3(colorRG, colorB_flags.x) * {LIGHT_COLOR_DIVIDER};
36729
36742
  vec4 lightPosRange = sampleLightTextureF(clusterLightData, {CLUSTER_TEXTURE_POSITION_RANGE});
36730
36743
  clusterLightData.position = lightPosRange.xyz;
36731
36744
  clusterLightData.range = lightPosRange.w;
36732
36745
  vec4 lightDir_Flags = sampleLightTextureF(clusterLightData, {CLUSTER_TEXTURE_DIRECTION_FLAGS});
36733
36746
  clusterLightData.direction = lightDir_Flags.xyz;
36734
- clusterLightData.flags = floatBitsToUint(lightDir_Flags.w);
36735
- clusterLightData.isSpot = (clusterLightData.flags & (1u << 30u)) != 0u;
36736
- clusterLightData.shape = (clusterLightData.flags >> 28u) & 0x3u;
36737
- clusterLightData.falloffModeLinear = (clusterLightData.flags & (1u << 27u)) == 0u;
36738
- clusterLightData.shadowIntensity = float((clusterLightData.flags >> 0u) & 0xFFu) / 255.0;
36739
- clusterLightData.cookieIntensity = float((clusterLightData.flags >> 8u) & 0xFFu) / 255.0;
36740
- clusterLightData.isDynamic = (clusterLightData.flags & (1u << 22u)) != 0u;
36741
- clusterLightData.isLightmapped = (clusterLightData.flags & (1u << 21u)) != 0u;
36747
+ clusterLightData_flags = floatBitsToUint(lightDir_Flags.w);
36748
+ clusterLightData.isSpot = (clusterLightData_flags & (1u << 30u)) != 0u;
36749
+ clusterLightData.shape = (clusterLightData_flags >> 28u) & 0x3u;
36750
+ clusterLightData.falloffModeLinear = (clusterLightData_flags & (1u << 27u)) == 0u;
36751
+ clusterLightData.shadowIntensity = float((clusterLightData_flags >> 0u) & 0xFFu) / 255.0;
36752
+ clusterLightData.cookieIntensity = float((clusterLightData_flags >> 8u) & 0xFFu) / 255.0;
36753
+ clusterLightData.isDynamic = (clusterLightData_flags & (1u << 22u)) != 0u;
36754
+ clusterLightData.isLightmapped = (clusterLightData_flags & (1u << 21u)) != 0u;
36742
36755
  }
36743
36756
  void decodeClusterLightSpot(inout ClusterLightData clusterLightData) {
36744
- uint angleFlags = (clusterLightData.colorBFlagsData >> 16u) & 0xFFFFu;
36745
- vec2 angleValues = unpackHalf2x16(floatBitsToUint(clusterLightData.anglesData));
36757
+ uint angleFlags = (clusterLightData_colorBFlagsData >> 16u) & 0xFFFFu;
36758
+ vec2 angleValues = unpackHalf2x16(floatBitsToUint(clusterLightData_anglesData));
36746
36759
  float innerVal = angleValues.x;
36747
36760
  float outerVal = angleValues.y;
36748
36761
  float innerIsVersine = float(angleFlags & 1u);
@@ -36772,7 +36785,7 @@ void decodeClusterLightShadowData(inout ClusterLightData clusterLightData) {
36772
36785
  clusterLightData.shadowNormalBias = biases.y;
36773
36786
  }
36774
36787
  void decodeClusterLightCookieData(inout ClusterLightData clusterLightData) {
36775
- uint cookieFlags = (clusterLightData.flags >> 23u) & 0x0Fu;
36788
+ uint cookieFlags = (clusterLightData_flags >> 23u) & 0x0Fu;
36776
36789
  clusterLightData.cookieChannelMask = vec4(uvec4(cookieFlags) & uvec4(1u, 2u, 4u, 8u));
36777
36790
  clusterLightData.cookieChannelMask = step(1.0, clusterLightData.cookieChannelMask);
36778
36791
  }
@@ -54690,9 +54703,9 @@ class GSplatComponent extends Component {
54690
54703
  }
54691
54704
  getInstanceTexture(name) {
54692
54705
  if (!this._placement) {
54693
- return undefined;
54706
+ return null;
54694
54707
  }
54695
- return this._placement.getInstanceTexture(name, this.system.app.graphicsDevice);
54708
+ return this._placement.getInstanceTexture(name, this.system.app.graphicsDevice) ?? null;
54696
54709
  }
54697
54710
  _onGSplatAssetAdded() {
54698
54711
  if (!this._assetReference.asset) {
@@ -72210,21 +72223,21 @@ class VoxelDebugOverlay {
72210
72223
  const nodesByteSize = Math.max(nodesData.byteLength, 4);
72211
72224
  this.nodesBuffer = new StorageBuffer(device, nodesByteSize, BUFFERUSAGE_COPY_DST);
72212
72225
  if (nodesData.byteLength > 0) {
72213
- this.nodesBuffer.write(0, nodesData.buffer, nodesData.byteOffset, nodesData.byteLength);
72226
+ this.nodesBuffer.write(0, nodesData, 0, nodesData.length);
72214
72227
  }
72215
72228
  // Upload leaf data as a read-only storage buffer
72216
72229
  const leafDataArr = collider.leafData;
72217
72230
  const leafByteSize = Math.max(leafDataArr.byteLength, 4);
72218
72231
  this.leafDataBuffer = new StorageBuffer(device, leafByteSize, BUFFERUSAGE_COPY_DST);
72219
72232
  if (leafDataArr.byteLength > 0) {
72220
- this.leafDataBuffer.write(0, leafDataArr.buffer, leafDataArr.byteOffset, leafDataArr.byteLength);
72233
+ this.leafDataBuffer.write(0, leafDataArr, 0, leafDataArr.length);
72221
72234
  }
72222
72235
  // Create the initial storage texture (will be resized on first update)
72223
72236
  this.currentWidth = Math.max(device.width, 1);
72224
72237
  this.currentHeight = Math.max(device.height, 1);
72225
72238
  this.storageTexture = this.createStorageTexture(this.currentWidth, this.currentHeight);
72226
72239
  // Create compute shader
72227
- const shader = new Shader(device, {
72240
+ const shaderDefinition = {
72228
72241
  name: 'VoxelDebugOverlay',
72229
72242
  shaderLanguage: SHADERLANGUAGE_WGSL,
72230
72243
  cshader: voxelOverlayWGSL,
@@ -72253,7 +72266,8 @@ class VoxelDebugOverlay {
72253
72266
  new BindStorageBufferFormat('leafData', SHADERSTAGE_COMPUTE, true),
72254
72267
  new BindStorageTextureFormat('outputTexture', PIXELFORMAT_RGBA8, TEXTUREDIMENSION_2D)
72255
72268
  ])
72256
- });
72269
+ };
72270
+ const shader = new Shader(device, shaderDefinition);
72257
72271
  // Create compute instance
72258
72272
  this.compute = new Compute(device, shader, 'VoxelDebugOverlay');
72259
72273
  // Create overlay material with premultiplied alpha blending and a custom
@@ -74314,7 +74328,7 @@ const initXr = (global) => {
74314
74328
  });
74315
74329
  };
74316
74330
 
74317
- var version = "1.15.0";
74331
+ var version = "1.15.1";
74318
74332
 
74319
74333
  const loadGsplat = async (app, config, progressCallback) => {
74320
74334
  const { contents, contentUrl, unified, aa } = config;