@playcanvas/supersplat-viewer 1.26.2 → 1.26.3

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.2",
3
+ "version": "1.26.3",
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",
@@ -45,20 +45,20 @@
45
45
  "@rollup/plugin-json": "6.1.0",
46
46
  "@rollup/plugin-node-resolve": "16.0.3",
47
47
  "@rollup/plugin-typescript": "12.3.0",
48
- "@typescript-eslint/eslint-plugin": "8.60.1",
49
- "@typescript-eslint/parser": "8.60.1",
48
+ "@typescript-eslint/eslint-plugin": "8.61.1",
49
+ "@typescript-eslint/parser": "8.61.1",
50
50
  "autoprefixer": "10.5.0",
51
51
  "concurrently": "9.2.1",
52
52
  "eslint": "9.39.4",
53
53
  "globals": "17.6.0",
54
- "playcanvas": "2.19.2",
54
+ "playcanvas": "2.19.7",
55
55
  "postcss": "8.5.15",
56
56
  "publint": "0.3.21",
57
- "rollup": "4.61.0",
57
+ "rollup": "4.62.0",
58
58
  "rollup-plugin-copy": "3.5.0",
59
59
  "rollup-plugin-scss": "4.0.1",
60
60
  "rollup-plugin-string": "3.0.0",
61
- "sass": "1.100.0",
61
+ "sass": "1.101.0",
62
62
  "serve": "14.2.6",
63
63
  "typescript": "5.9.3"
64
64
  },
package/public/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const TRACEID_GPU_TIMINGS = "GpuTimings";
2
2
 
3
- const version$1 = "2.19.2";
4
- const revision = "3f52bb8";
3
+ const version$1 = "2.19.7";
4
+ const revision = "c25d1b7";
5
5
  function extend(target, ex) {
6
6
  for (const prop in ex) {
7
7
  const copy = ex[prop];
@@ -11431,6 +11431,9 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
11431
11431
  xrCompatible: !!this.initOptions.xrCompatible
11432
11432
  };
11433
11433
  this.gpuAdapter = await window.navigator.gpu.requestAdapter(adapterOptions);
11434
+ if (this.gpuAdapter?.info?.vendor === "img-tec") {
11435
+ return null;
11436
+ }
11434
11437
  const featureLevel = this.initOptions.featureLevel;
11435
11438
  const bare = featureLevel === "bare";
11436
11439
  const requiredFeatures = [];
@@ -17622,13 +17625,10 @@ class ShaderUtils {
17622
17625
  library.unregister(libraryModuleName);
17623
17626
  return variant;
17624
17627
  }
17625
- static addScreenDepthChunkDefines(device, cameraShaderParams, defines) {
17628
+ static addScreenDepthChunkDefines(cameraShaderParams, defines) {
17626
17629
  if (cameraShaderParams.sceneDepthMapLinear) {
17627
17630
  defines.set("SCENE_DEPTHMAP_LINEAR", "");
17628
17631
  }
17629
- if (device.textureFloatRenderable) {
17630
- defines.set("SCENE_DEPTHMAP_FLOAT", "");
17631
- }
17632
17632
  }
17633
17633
  }
17634
17634
 
@@ -37808,8 +37808,138 @@ class I18n extends EventHandler {
37808
37808
  }
37809
37809
  }
37810
37810
 
37811
+ const SCRIPT_INITIALIZE = "initialize";
37812
+ const SCRIPT_POST_INITIALIZE = "postInitialize";
37813
+ const SCRIPT_UPDATE = "update";
37814
+ const SCRIPT_POST_UPDATE = "postUpdate";
37815
+ const SCRIPT_SWAP = "swap";
37816
+ const reservedScriptNames = /* @__PURE__ */ new Set([
37817
+ "system",
37818
+ "entity",
37819
+ "create",
37820
+ "destroy",
37821
+ "swap",
37822
+ "move",
37823
+ "data",
37824
+ "scripts",
37825
+ "_scripts",
37826
+ "_scriptsIndex",
37827
+ "_scriptsData",
37828
+ "enabled",
37829
+ "_oldState",
37830
+ "onEnable",
37831
+ "onDisable",
37832
+ "onPostStateChange",
37833
+ "_onSetEnabled",
37834
+ "_checkState",
37835
+ "_onBeforeRemove",
37836
+ "_onInitializeAttributes",
37837
+ "_onInitialize",
37838
+ "_onPostInitialize",
37839
+ "_onUpdate",
37840
+ "_onPostUpdate",
37841
+ "_callbacks",
37842
+ "_callbackActive",
37843
+ "has",
37844
+ "get",
37845
+ "on",
37846
+ "off",
37847
+ "fire",
37848
+ "once",
37849
+ "hasEvent",
37850
+ // 'worker' is reserved to prevent users from overwriting the native Worker constructor
37851
+ "worker"
37852
+ ]);
37853
+
37854
+ class Script extends EventHandler {
37855
+ static EVENT_ENABLE = "enable";
37856
+ static EVENT_DISABLE = "disable";
37857
+ static EVENT_STATE = "state";
37858
+ static EVENT_DESTROY = "destroy";
37859
+ static EVENT_ATTR = "attr";
37860
+ static EVENT_ERROR = "error";
37861
+ app;
37862
+ entity;
37863
+ _enabled;
37864
+ _enabledOld;
37865
+ _initialized;
37866
+ _postInitialized;
37867
+ __destroyed;
37868
+ __scriptType;
37869
+ __executionOrder;
37870
+ constructor(args) {
37871
+ super();
37872
+ this.initScript(args);
37873
+ }
37874
+ set enabled(value) {
37875
+ this._enabled = !!value;
37876
+ if (this.enabled === this._enabledOld) return;
37877
+ this._enabledOld = this.enabled;
37878
+ this.fire(this.enabled ? "enable" : "disable");
37879
+ this.fire("state", this.enabled);
37880
+ if (!this._initialized && this.enabled) {
37881
+ this._initialized = true;
37882
+ this.fire("preInitialize");
37883
+ if (this.initialize) {
37884
+ this.entity.script._scriptMethod(this, SCRIPT_INITIALIZE);
37885
+ }
37886
+ }
37887
+ if (this._initialized && !this._postInitialized && this.enabled && !this.entity.script._beingEnabled) {
37888
+ this._postInitialized = true;
37889
+ if (this.postInitialize) {
37890
+ this.entity.script._scriptMethod(this, SCRIPT_POST_INITIALIZE);
37891
+ }
37892
+ }
37893
+ }
37894
+ get enabled() {
37895
+ return this._enabled && !this._destroyed && this.entity.script.enabled && this.entity.enabled;
37896
+ }
37897
+ initScript(args) {
37898
+ const script = this.constructor;
37899
+ this.app = args.app;
37900
+ this.entity = args.entity;
37901
+ this._enabled = typeof args.enabled === "boolean" ? args.enabled : true;
37902
+ this._enabledOld = this.enabled;
37903
+ this.__destroyed = false;
37904
+ this.__scriptType = script;
37905
+ this.__executionOrder = -1;
37906
+ }
37907
+ static __name = null;
37908
+ // Will be assigned when calling createScript or registerScript.
37909
+ static __getScriptName = getScriptName;
37910
+ static set scriptName(value) {
37911
+ this.__name = value;
37912
+ }
37913
+ static get scriptName() {
37914
+ return this.__name;
37915
+ }
37916
+ }
37917
+ const funcNameRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s\/]*)\s*/;
37918
+ const toLowerCamelCase = (str) => str ? str[0].toLowerCase() + str.substring(1) : str;
37919
+ function getScriptName(constructorFn) {
37920
+ if (typeof constructorFn !== "function") return void 0;
37921
+ if (Object.prototype.hasOwnProperty.call(constructorFn, "scriptName") && constructorFn.scriptName) {
37922
+ return constructorFn.scriptName;
37923
+ }
37924
+ if ("name" in Function.prototype) return constructorFn.name;
37925
+ if (constructorFn === Function || constructorFn === Function.prototype.constructor) return "Function";
37926
+ const match = `${constructorFn}`.match(funcNameRegex);
37927
+ return match ? match[1] : void 0;
37928
+ }
37929
+ function getScriptRegistryName(constructorFn) {
37930
+ if (typeof constructorFn !== "function") return void 0;
37931
+ if (Object.prototype.hasOwnProperty.call(constructorFn, "__name") && constructorFn.__name) {
37932
+ return constructorFn.__name;
37933
+ }
37934
+ if (Object.prototype.hasOwnProperty.call(constructorFn, "scriptName") && constructorFn.scriptName) {
37935
+ return constructorFn.scriptName;
37936
+ }
37937
+ const name = getScriptName(constructorFn);
37938
+ return name ? toLowerCamelCase(name) : void 0;
37939
+ }
37940
+
37811
37941
  class ScriptRegistry extends EventHandler {
37812
- _scripts = {};
37942
+ _scripts = /* @__PURE__ */ new Map();
37813
37943
  _list = [];
37814
37944
  _scriptSchemas = /* @__PURE__ */ new Map();
37815
37945
  constructor(app) {
@@ -37828,14 +37958,21 @@ class ScriptRegistry extends EventHandler {
37828
37958
  return this._scriptSchemas.get(id);
37829
37959
  }
37830
37960
  add(script) {
37831
- const scriptName = script.__name;
37832
- if (this._scripts.hasOwnProperty(scriptName)) {
37961
+ const scriptName = getScriptRegistryName(script);
37962
+ if (!scriptName) {
37963
+ return false;
37964
+ }
37965
+ if (reservedScriptNames.has(scriptName)) {
37966
+ return false;
37967
+ }
37968
+ script.__name = scriptName;
37969
+ if (this._scripts.has(scriptName)) {
37833
37970
  setTimeout(() => {
37834
37971
  if (script.prototype.swap) {
37835
- const old = this._scripts[scriptName];
37972
+ const old = this._scripts.get(scriptName);
37836
37973
  const ind = this._list.indexOf(old);
37837
37974
  this._list[ind] = script;
37838
- this._scripts[scriptName] = script;
37975
+ this._scripts.set(scriptName, script);
37839
37976
  this.fire("swap", scriptName, script);
37840
37977
  this.fire(`swap:${scriptName}`, script);
37841
37978
  } else {
@@ -37844,12 +37981,12 @@ class ScriptRegistry extends EventHandler {
37844
37981
  });
37845
37982
  return false;
37846
37983
  }
37847
- this._scripts[scriptName] = script;
37984
+ this._scripts.set(scriptName, script);
37848
37985
  this._list.push(script);
37849
37986
  this.fire("add", scriptName, script);
37850
37987
  this.fire(`add:${scriptName}`, script);
37851
37988
  setTimeout(() => {
37852
- if (!this._scripts.hasOwnProperty(scriptName)) {
37989
+ if (!this._scripts.has(scriptName)) {
37853
37990
  return;
37854
37991
  }
37855
37992
  if (!this.app || !this.app.systems || !this.app.systems.script) {
@@ -37910,7 +38047,7 @@ class ScriptRegistry extends EventHandler {
37910
38047
  if (this.get(scriptName) !== scriptType) {
37911
38048
  return false;
37912
38049
  }
37913
- delete this._scripts[scriptName];
38050
+ this._scripts.delete(scriptName);
37914
38051
  const ind = this._list.indexOf(scriptType);
37915
38052
  this._list.splice(ind, 1);
37916
38053
  this.fire("remove", scriptName, scriptType);
@@ -37918,15 +38055,15 @@ class ScriptRegistry extends EventHandler {
37918
38055
  return true;
37919
38056
  }
37920
38057
  get(name) {
37921
- return this._scripts[name] || null;
38058
+ return this._scripts.get(name) || null;
37922
38059
  }
37923
38060
  has(nameOrType) {
37924
38061
  if (typeof nameOrType === "string") {
37925
- return this._scripts.hasOwnProperty(nameOrType);
38062
+ return this._scripts.has(nameOrType);
37926
38063
  }
37927
38064
  if (!nameOrType) return false;
37928
38065
  const scriptName = nameOrType.__name;
37929
- return this._scripts[scriptName] === nameOrType;
38066
+ return this._scripts.get(scriptName) === nameOrType;
37930
38067
  }
37931
38068
  list() {
37932
38069
  return this._list;
@@ -42480,7 +42617,7 @@ float delinearizeDepth(float linearDepth) {
42480
42617
  }
42481
42618
  float getLinearScreenDepth(vec2 uv) {
42482
42619
  #ifdef SCENE_DEPTHMAP_LINEAR
42483
- #ifdef SCENE_DEPTHMAP_FLOAT
42620
+ #ifdef CAPS_TEXTURE_FLOAT_RENDERABLE
42484
42621
  return texture2D(uSceneDepthMap, uv).r;
42485
42622
  #else
42486
42623
  ivec2 textureSize = textureSize(uSceneDepthMap, 0);
@@ -54751,85 +54888,6 @@ class ScriptAttributes {
54751
54888
  }
54752
54889
  }
54753
54890
 
54754
- const SCRIPT_INITIALIZE = "initialize";
54755
- const SCRIPT_POST_INITIALIZE = "postInitialize";
54756
- const SCRIPT_UPDATE = "update";
54757
- const SCRIPT_POST_UPDATE = "postUpdate";
54758
- const SCRIPT_SWAP = "swap";
54759
-
54760
- class Script extends EventHandler {
54761
- static EVENT_ENABLE = "enable";
54762
- static EVENT_DISABLE = "disable";
54763
- static EVENT_STATE = "state";
54764
- static EVENT_DESTROY = "destroy";
54765
- static EVENT_ATTR = "attr";
54766
- static EVENT_ERROR = "error";
54767
- app;
54768
- entity;
54769
- _enabled;
54770
- _enabledOld;
54771
- _initialized;
54772
- _postInitialized;
54773
- __destroyed;
54774
- __scriptType;
54775
- __executionOrder;
54776
- constructor(args) {
54777
- super();
54778
- this.initScript(args);
54779
- }
54780
- set enabled(value) {
54781
- this._enabled = !!value;
54782
- if (this.enabled === this._enabledOld) return;
54783
- this._enabledOld = this.enabled;
54784
- this.fire(this.enabled ? "enable" : "disable");
54785
- this.fire("state", this.enabled);
54786
- if (!this._initialized && this.enabled) {
54787
- this._initialized = true;
54788
- this.fire("preInitialize");
54789
- if (this.initialize) {
54790
- this.entity.script._scriptMethod(this, SCRIPT_INITIALIZE);
54791
- }
54792
- }
54793
- if (this._initialized && !this._postInitialized && this.enabled && !this.entity.script._beingEnabled) {
54794
- this._postInitialized = true;
54795
- if (this.postInitialize) {
54796
- this.entity.script._scriptMethod(this, SCRIPT_POST_INITIALIZE);
54797
- }
54798
- }
54799
- }
54800
- get enabled() {
54801
- return this._enabled && !this._destroyed && this.entity.script.enabled && this.entity.enabled;
54802
- }
54803
- initScript(args) {
54804
- const script = this.constructor;
54805
- this.app = args.app;
54806
- this.entity = args.entity;
54807
- this._enabled = typeof args.enabled === "boolean" ? args.enabled : true;
54808
- this._enabledOld = this.enabled;
54809
- this.__destroyed = false;
54810
- this.__scriptType = script;
54811
- this.__executionOrder = -1;
54812
- }
54813
- static __name = null;
54814
- // Will be assigned when calling createScript or registerScript.
54815
- static __getScriptName = getScriptName;
54816
- static set scriptName(value) {
54817
- this.__name = value;
54818
- }
54819
- static get scriptName() {
54820
- return this.__name;
54821
- }
54822
- }
54823
- const funcNameRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s\/]*)\s*/;
54824
- function getScriptName(constructorFn) {
54825
- if (typeof constructorFn !== "function") return void 0;
54826
- if (constructorFn.scriptName) return constructorFn.scriptName;
54827
- if ("name" in Function.prototype) return constructorFn.name;
54828
- if (constructorFn === Function || constructorFn === Function.prototype.constructor) return "Function";
54829
- const match = `${constructorFn}`.match(funcNameRegex);
54830
- return match ? match[1] : void 0;
54831
- }
54832
-
54833
54891
  class ScriptType extends Script {
54834
54892
  __attributes;
54835
54893
  __attributesRaw;
@@ -54876,7 +54934,6 @@ class ScriptType extends Script {
54876
54934
  }
54877
54935
  }
54878
54936
 
54879
- const toLowerCamelCase = (str) => str[0].toLowerCase() + str.substring(1);
54880
54937
  class ScriptComponent extends Component {
54881
54938
  _attributeDataMap = /* @__PURE__ */ new Map();
54882
54939
  static EVENT_CREATE = "create";
@@ -55194,11 +55251,16 @@ class ScriptComponent extends Component {
55194
55251
  if (typeof scriptType === "string") {
55195
55252
  scriptType = this.system.app.scripts.get(scriptType);
55196
55253
  } else if (scriptType) {
55197
- const inferredScriptName = getScriptName(scriptType);
55198
- const lowerInferredScriptName = toLowerCamelCase(inferredScriptName);
55199
- if (!(scriptType.prototype instanceof ScriptType) && !scriptType.scriptName) ;
55200
- scriptType.__name ?? (scriptType.__name = scriptType.scriptName ?? lowerInferredScriptName);
55254
+ getScriptName(scriptType);
55255
+ const ownScriptName = Object.prototype.hasOwnProperty.call(scriptType, "scriptName") && scriptType.scriptName;
55256
+ if (!(scriptType.prototype instanceof ScriptType) && !ownScriptName) ;
55257
+ if (!Object.prototype.hasOwnProperty.call(scriptType, "__name")) {
55258
+ scriptType.__name = getScriptRegistryName(scriptType);
55259
+ }
55201
55260
  scriptName = scriptType.__name;
55261
+ if (!scriptName) {
55262
+ return null;
55263
+ }
55202
55264
  }
55203
55265
  if (scriptType) {
55204
55266
  if (!this._scriptsIndex[scriptName] || !this._scriptsIndex[scriptName].instance) {
@@ -60833,6 +60895,7 @@ class GSplatOctreeResource {
60833
60895
  aabb = new BoundingBox();
60834
60896
  centersVersion = 0;
60835
60897
  octree;
60898
+ _numSplats = null;
60836
60899
  data;
60837
60900
  constructor(assetFileUrl, data, assetLoader) {
60838
60901
  this.octree = new GSplatOctree(assetFileUrl, data);
@@ -60841,6 +60904,17 @@ class GSplatOctreeResource {
60841
60904
  this.data = data;
60842
60905
  this.data.tree = null;
60843
60906
  }
60907
+ get numSplats() {
60908
+ if (this._numSplats === null) {
60909
+ let total = 0;
60910
+ const nodes = this.octree?.nodes ?? [];
60911
+ for (let i = 0; i < nodes.length; i++) {
60912
+ total += nodes[i].lods[0]?.count ?? 0;
60913
+ }
60914
+ this._numSplats = total;
60915
+ }
60916
+ return this._numSplats;
60917
+ }
60844
60918
  destroy() {
60845
60919
  this.octree?.destroy();
60846
60920
  this.octree = null;
@@ -61160,8 +61234,12 @@ struct ScatterUniforms {
61160
61234
  @group(0) @binding(2) var<storage, read> prefixSumBuffer: array<u32>;
61161
61235
  @group(0) @binding(3) var<storage, read_write> compactedOutput: array<u32>;
61162
61236
  @compute @workgroup_size({WORKGROUP_SIZE})
61163
- fn main(@builtin(workgroup_id) wgId: vec3u, @builtin(local_invocation_id) lid: vec3u) {
61164
- let intervalIdx = wgId.x;
61237
+ fn main(
61238
+ @builtin(workgroup_id) wgId: vec3u,
61239
+ @builtin(num_workgroups) numWorkgroups: vec3u,
61240
+ @builtin(local_invocation_id) lid: vec3u
61241
+ ) {
61242
+ let intervalIdx = wgId.y * numWorkgroups.x + wgId.x;
61165
61243
  if (intervalIdx >= uniforms.numIntervals) { return; }
61166
61244
  let outputOffset = prefixSumBuffer[intervalIdx];
61167
61245
  let nextOffset = prefixSumBuffer[intervalIdx + 1u];
@@ -61234,6 +61312,7 @@ class GSplatIntervalCompaction {
61234
61312
  _cullComputePerspective = null;
61235
61313
  _cullComputeFisheye = null;
61236
61314
  _scatterCompute = null;
61315
+ _scatterDispatchSize = new Vec2(1, 1);
61237
61316
  _writeIndirectArgsCompute = null;
61238
61317
  _cullBindGroupFormatPerspective = null;
61239
61318
  _cullBindGroupFormatFisheye = null;
@@ -61476,7 +61555,8 @@ class GSplatIntervalCompaction {
61476
61555
  scatterCompute.setParameter("pad0", 0);
61477
61556
  scatterCompute.setParameter("pad1", 0);
61478
61557
  scatterCompute.setParameter("pad2", 0);
61479
- scatterCompute.setupDispatch(numIntervals);
61558
+ Compute.calcDispatchSize(numIntervals, this._scatterDispatchSize, this.device.limits.maxComputeWorkgroupsPerDimension || 65535);
61559
+ scatterCompute.setupDispatch(this._scatterDispatchSize.x, this._scatterDispatchSize.y, 1);
61480
61560
  this.device.computeDispatch([scatterCompute], "GSplatIntervalScatter");
61481
61561
  }
61482
61562
  writeIndirectArgs(drawSlot, dispatchSlotBase, numIntervals, sortIndirectInfo) {
@@ -77115,7 +77195,7 @@ class RenderPassTAA extends RenderPassShaderQuad {
77115
77195
  ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("taaResolvePS", taaResolve_default);
77116
77196
  const defines = /* @__PURE__ */ new Map();
77117
77197
  defines.set("QUALITY_HIGH", true);
77118
- ShaderUtils.addScreenDepthChunkDefines(device, cameraComponent.shaderParams, defines);
77198
+ ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
77119
77199
  this.shader = ShaderUtils.createShader(device, {
77120
77200
  uniqueName: "TaaResolveShader",
77121
77201
  attributes: { aPosition: SEMANTIC_POSITION },
@@ -77243,7 +77323,7 @@ class RenderPassCoC extends RenderPassShaderQuad {
77243
77323
  ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("cocPS", coc_default);
77244
77324
  const defines = /* @__PURE__ */ new Map();
77245
77325
  if (nearBlur) defines.set("NEAR_BLUR", "");
77246
- ShaderUtils.addScreenDepthChunkDefines(device, cameraComponent.shaderParams, defines);
77326
+ ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
77247
77327
  this.shader = ShaderUtils.createShader(device, {
77248
77328
  uniqueName: `CocShader-${nearBlur}`,
77249
77329
  attributes: { aPosition: SEMANTIC_POSITION },
@@ -77286,8 +77366,8 @@ var dofBlur_default$1 = `
77286
77366
  #if defined(NEAR_BLUR)
77287
77367
  float cocNear = coc.g;
77288
77368
  if (cocNear > 0.0001) {
77289
- ivec2 nearTextureSize = textureSize(nearTexture, 0);
77290
- vec2 step = cocNear * blurRadiusNear / vec2(nearTextureSize);
77369
+ vec2 nearTextureSize = vec2(textureSize(nearTexture, 0));
77370
+ vec2 step = cocNear * blurRadiusNear * vec2(nearTextureSize.y / nearTextureSize.x, 1.0);
77291
77371
  for (int i = 0; i < {KERNEL_COUNT}; i++) {
77292
77372
  vec2 uv = uv0 + step * kernel[i];
77293
77373
  vec3 tap = texture2DLod(nearTexture, uv, 0.0).rgb;
@@ -77298,8 +77378,8 @@ var dofBlur_default$1 = `
77298
77378
  #endif
77299
77379
 
77300
77380
  if (cocFar > 0.0001) {
77301
- ivec2 farTextureSize = textureSize(farTexture, 0);
77302
- vec2 step = cocFar * blurRadiusFar / vec2(farTextureSize);
77381
+ vec2 farTextureSize = vec2(textureSize(farTexture, 0));
77382
+ vec2 step = cocFar * blurRadiusFar * vec2(farTextureSize.y / farTextureSize.x, 1.0);
77303
77383
  float sumCoC = 0.0;
77304
77384
  for (int i = 0; i < {KERNEL_COUNT}; i++) {
77305
77385
  vec2 uv = uv0 + step * kernel[i];
@@ -77340,7 +77420,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
77340
77420
  let cocNear: f32 = coc.g;
77341
77421
  if (cocNear > 0.0001) {
77342
77422
  let nearTextureSize: vec2f = vec2f(textureDimensions(nearTexture, 0));
77343
- let step: vec2f = cocNear * uniform.blurRadiusNear / nearTextureSize;
77423
+ let step: vec2f = cocNear * uniform.blurRadiusNear * vec2f(nearTextureSize.y / nearTextureSize.x, 1.0);
77344
77424
  for (var i: i32 = 0; i < {KERNEL_COUNT}; i = i + 1) {
77345
77425
  let uv: vec2f = uv0 + step * uniform.kernel[i].element;
77346
77426
  let tap: vec3f = textureSampleLevel(nearTexture, nearTextureSampler, uv, 0.0).rgb;
@@ -77351,7 +77431,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
77351
77431
  #endif
77352
77432
  if (cocFar > 0.0001) {
77353
77433
  let farTextureSize: vec2f = vec2f(textureDimensions(farTexture, 0));
77354
- let step: vec2f = cocFar * uniform.blurRadiusFar / farTextureSize;
77434
+ let step: vec2f = cocFar * uniform.blurRadiusFar * vec2f(farTextureSize.y / farTextureSize.x, 1.0);
77355
77435
  var sumCoC: f32 = 0.0;
77356
77436
  for (var i: i32 = 0; i < {KERNEL_COUNT}; i = i + 1) {
77357
77437
  let uv: vec2f = uv0 + step * uniform.kernel[i].element;
@@ -77376,6 +77456,7 @@ class RenderPassDofBlur extends RenderPassShaderQuad {
77376
77456
  blurRadiusFar = 1;
77377
77457
  _blurRings = 3;
77378
77458
  _blurRingPoints = 3;
77459
+ referenceHeight = 540;
77379
77460
  constructor(device, nearTexture, farTexture, cocTexture) {
77380
77461
  super(device);
77381
77462
  this.nearTexture = nearTexture;
@@ -77435,8 +77516,10 @@ class RenderPassDofBlur extends RenderPassShaderQuad {
77435
77516
  this.cocTextureId.setValue(this.cocTexture);
77436
77517
  this.kernelId.setValue(this.kernel);
77437
77518
  this.kernelCountId.setValue(this.kernel.length >> 1);
77438
- this.blurRadiusNearId.setValue(this.blurRadiusNear);
77439
- this.blurRadiusFarId.setValue(this.blurRadiusFar);
77519
+ const referenceHeight = this.referenceHeight > 0 ? this.referenceHeight : 540;
77520
+ const invReferenceHeight = 1 / referenceHeight;
77521
+ this.blurRadiusNearId.setValue(this.blurRadiusNear * invReferenceHeight);
77522
+ this.blurRadiusFarId.setValue(this.blurRadiusFar * invReferenceHeight);
77440
77523
  super.execute();
77441
77524
  }
77442
77525
  }
@@ -77553,7 +77636,7 @@ class FramePassDof extends FramePass {
77553
77636
  this.cocPass.focusDistance = this.focusDistance;
77554
77637
  this.cocPass.focusRange = this.focusRange;
77555
77638
  this.blurPass.blurRadiusNear = this.blurRadius;
77556
- this.blurPass.blurRadiusFar = this.blurRadius * (this.highQuality ? 1 : 0.5);
77639
+ this.blurPass.blurRadiusFar = this.blurRadius;
77557
77640
  this.blurPass.blurRings = this.blurRings;
77558
77641
  this.blurPass.blurRingPoints = this.blurRingPoints;
77559
77642
  }
@@ -77744,7 +77827,7 @@ class RenderPassDepthAwareBlur extends RenderPassShaderQuad {
77744
77827
  ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("depthAwareBlurPS", depthAwareBlur_default);
77745
77828
  const defines = /* @__PURE__ */ new Map();
77746
77829
  if (horizontal) defines.set("HORIZONTAL", "");
77747
- ShaderUtils.addScreenDepthChunkDefines(device, cameraComponent.shaderParams, defines);
77830
+ ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
77748
77831
  this.shader = ShaderUtils.createShader(device, {
77749
77832
  uniqueName: `DepthAware${horizontal ? "Horizontal" : "Vertical"}BlurShader`,
77750
77833
  attributes: { aPosition: SEMANTIC_POSITION },
@@ -78015,7 +78098,7 @@ class RenderPassSsao extends RenderPassShaderQuad {
78015
78098
  ShaderChunks.get(device, SHADERLANGUAGE_GLSL).set("ssaoPS", ssao_default$1);
78016
78099
  ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("ssaoPS", ssao_default);
78017
78100
  const defines = /* @__PURE__ */ new Map();
78018
- ShaderUtils.addScreenDepthChunkDefines(device, cameraComponent.shaderParams, defines);
78101
+ ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
78019
78102
  this.shader = ShaderUtils.createShader(device, {
78020
78103
  uniqueName: "SsaoShader",
78021
78104
  attributes: { aPosition: SEMANTIC_POSITION },
@@ -81736,7 +81819,7 @@ const importSettings = (settings) => {
81736
81819
  return result;
81737
81820
  };
81738
81821
 
81739
- var version = "1.26.2";
81822
+ var version = "1.26.3";
81740
81823
 
81741
81824
  class Tooltip {
81742
81825
  register;
@@ -89596,8 +89679,9 @@ class XrNavigation extends Script {
89596
89679
  if (!this.cameraEntity) return;
89597
89680
 
89598
89681
  for (const inputSource of this.inputSources) {
89599
- // Only process controllers with gamepads
89600
- if (!inputSource.gamepad) continue;
89682
+ // Require a gamepad with thumbstick axes (axes[2]/[3]). Hand-tracking sources
89683
+ // (e.g. Apple Vision Pro) report a gamepad with no axes, which would read as NaN.
89684
+ if (!inputSource.gamepad || inputSource.gamepad.axes.length < 4) continue;
89601
89685
 
89602
89686
  // Left controller - movement
89603
89687
  if (inputSource.handedness === 'left') {
@@ -89696,7 +89780,8 @@ class XrNavigation extends Script {
89696
89780
  let rightController = null;
89697
89781
 
89698
89782
  for (const inputSource of this.inputSources) {
89699
- if (!inputSource.gamepad) continue;
89783
+ // Require a gamepad with thumbstick axes — see handleSmoothLocomotion.
89784
+ if (!inputSource.gamepad || inputSource.gamepad.axes.length < 4) continue;
89700
89785
  if (inputSource.handedness === 'right') {
89701
89786
  rightController = inputSource;
89702
89787
  break;