@playcanvas/supersplat-viewer 1.26.1 → 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/dist/index.js +1 -1
- package/package.json +6 -6
- package/public/index.js +231 -128
- package/public/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcanvas/supersplat-viewer",
|
|
3
|
-
"version": "1.26.
|
|
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.
|
|
49
|
-
"@typescript-eslint/parser": "8.
|
|
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.
|
|
54
|
+
"playcanvas": "2.19.7",
|
|
55
55
|
"postcss": "8.5.15",
|
|
56
56
|
"publint": "0.3.21",
|
|
57
|
-
"rollup": "4.
|
|
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.
|
|
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.
|
|
4
|
-
const revision = "
|
|
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];
|
|
@@ -8899,7 +8899,10 @@ class WebgpuTexture {
|
|
|
8899
8899
|
anyLevelMissing = true;
|
|
8900
8900
|
}
|
|
8901
8901
|
} else {
|
|
8902
|
-
if (
|
|
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;
|
|
@@ -11411,6 +11431,9 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
|
|
|
11411
11431
|
xrCompatible: !!this.initOptions.xrCompatible
|
|
11412
11432
|
};
|
|
11413
11433
|
this.gpuAdapter = await window.navigator.gpu.requestAdapter(adapterOptions);
|
|
11434
|
+
if (this.gpuAdapter?.info?.vendor === "img-tec") {
|
|
11435
|
+
return null;
|
|
11436
|
+
}
|
|
11414
11437
|
const featureLevel = this.initOptions.featureLevel;
|
|
11415
11438
|
const bare = featureLevel === "bare";
|
|
11416
11439
|
const requiredFeatures = [];
|
|
@@ -11464,6 +11487,7 @@ class WebgpuGraphicsDevice extends GraphicsDevice {
|
|
|
11464
11487
|
}
|
|
11465
11488
|
};
|
|
11466
11489
|
this.wgpu = await this.gpuAdapter.requestDevice(deviceDescr);
|
|
11490
|
+
this.supportsHtmlTextures = typeof this.wgpu.queue?.copyElementImageToTexture === "function";
|
|
11467
11491
|
this.wgpu.lost?.then(this.handleDeviceLost.bind(this));
|
|
11468
11492
|
this.wgpu.addEventListener?.("uncapturederror", (ev) => {
|
|
11469
11493
|
ev.error;
|
|
@@ -13030,10 +13054,7 @@ class WebglTexture {
|
|
|
13030
13054
|
const h = Math.floor(rect.height) || texture._height;
|
|
13031
13055
|
gl.texElementImage2D(
|
|
13032
13056
|
gl.TEXTURE_2D,
|
|
13033
|
-
mipLevel,
|
|
13034
13057
|
this._glInternalFormat,
|
|
13035
|
-
this._glFormat,
|
|
13036
|
-
this._glPixelType,
|
|
13037
13058
|
mipObject
|
|
13038
13059
|
);
|
|
13039
13060
|
if (mipLevel === 0) {
|
|
@@ -17604,13 +17625,10 @@ class ShaderUtils {
|
|
|
17604
17625
|
library.unregister(libraryModuleName);
|
|
17605
17626
|
return variant;
|
|
17606
17627
|
}
|
|
17607
|
-
static addScreenDepthChunkDefines(
|
|
17628
|
+
static addScreenDepthChunkDefines(cameraShaderParams, defines) {
|
|
17608
17629
|
if (cameraShaderParams.sceneDepthMapLinear) {
|
|
17609
17630
|
defines.set("SCENE_DEPTHMAP_LINEAR", "");
|
|
17610
17631
|
}
|
|
17611
|
-
if (device.textureFloatRenderable) {
|
|
17612
|
-
defines.set("SCENE_DEPTHMAP_FLOAT", "");
|
|
17613
|
-
}
|
|
17614
17632
|
}
|
|
17615
17633
|
}
|
|
17616
17634
|
|
|
@@ -37790,8 +37808,138 @@ class I18n extends EventHandler {
|
|
|
37790
37808
|
}
|
|
37791
37809
|
}
|
|
37792
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
|
+
|
|
37793
37941
|
class ScriptRegistry extends EventHandler {
|
|
37794
|
-
_scripts =
|
|
37942
|
+
_scripts = /* @__PURE__ */ new Map();
|
|
37795
37943
|
_list = [];
|
|
37796
37944
|
_scriptSchemas = /* @__PURE__ */ new Map();
|
|
37797
37945
|
constructor(app) {
|
|
@@ -37810,14 +37958,21 @@ class ScriptRegistry extends EventHandler {
|
|
|
37810
37958
|
return this._scriptSchemas.get(id);
|
|
37811
37959
|
}
|
|
37812
37960
|
add(script) {
|
|
37813
|
-
const scriptName = script
|
|
37814
|
-
if (
|
|
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)) {
|
|
37815
37970
|
setTimeout(() => {
|
|
37816
37971
|
if (script.prototype.swap) {
|
|
37817
|
-
const old = this._scripts
|
|
37972
|
+
const old = this._scripts.get(scriptName);
|
|
37818
37973
|
const ind = this._list.indexOf(old);
|
|
37819
37974
|
this._list[ind] = script;
|
|
37820
|
-
this._scripts
|
|
37975
|
+
this._scripts.set(scriptName, script);
|
|
37821
37976
|
this.fire("swap", scriptName, script);
|
|
37822
37977
|
this.fire(`swap:${scriptName}`, script);
|
|
37823
37978
|
} else {
|
|
@@ -37826,12 +37981,12 @@ class ScriptRegistry extends EventHandler {
|
|
|
37826
37981
|
});
|
|
37827
37982
|
return false;
|
|
37828
37983
|
}
|
|
37829
|
-
this._scripts
|
|
37984
|
+
this._scripts.set(scriptName, script);
|
|
37830
37985
|
this._list.push(script);
|
|
37831
37986
|
this.fire("add", scriptName, script);
|
|
37832
37987
|
this.fire(`add:${scriptName}`, script);
|
|
37833
37988
|
setTimeout(() => {
|
|
37834
|
-
if (!this._scripts.
|
|
37989
|
+
if (!this._scripts.has(scriptName)) {
|
|
37835
37990
|
return;
|
|
37836
37991
|
}
|
|
37837
37992
|
if (!this.app || !this.app.systems || !this.app.systems.script) {
|
|
@@ -37892,7 +38047,7 @@ class ScriptRegistry extends EventHandler {
|
|
|
37892
38047
|
if (this.get(scriptName) !== scriptType) {
|
|
37893
38048
|
return false;
|
|
37894
38049
|
}
|
|
37895
|
-
|
|
38050
|
+
this._scripts.delete(scriptName);
|
|
37896
38051
|
const ind = this._list.indexOf(scriptType);
|
|
37897
38052
|
this._list.splice(ind, 1);
|
|
37898
38053
|
this.fire("remove", scriptName, scriptType);
|
|
@@ -37900,15 +38055,15 @@ class ScriptRegistry extends EventHandler {
|
|
|
37900
38055
|
return true;
|
|
37901
38056
|
}
|
|
37902
38057
|
get(name) {
|
|
37903
|
-
return this._scripts
|
|
38058
|
+
return this._scripts.get(name) || null;
|
|
37904
38059
|
}
|
|
37905
38060
|
has(nameOrType) {
|
|
37906
38061
|
if (typeof nameOrType === "string") {
|
|
37907
|
-
return this._scripts.
|
|
38062
|
+
return this._scripts.has(nameOrType);
|
|
37908
38063
|
}
|
|
37909
38064
|
if (!nameOrType) return false;
|
|
37910
38065
|
const scriptName = nameOrType.__name;
|
|
37911
|
-
return this._scripts
|
|
38066
|
+
return this._scripts.get(scriptName) === nameOrType;
|
|
37912
38067
|
}
|
|
37913
38068
|
list() {
|
|
37914
38069
|
return this._list;
|
|
@@ -42462,7 +42617,7 @@ float delinearizeDepth(float linearDepth) {
|
|
|
42462
42617
|
}
|
|
42463
42618
|
float getLinearScreenDepth(vec2 uv) {
|
|
42464
42619
|
#ifdef SCENE_DEPTHMAP_LINEAR
|
|
42465
|
-
#ifdef
|
|
42620
|
+
#ifdef CAPS_TEXTURE_FLOAT_RENDERABLE
|
|
42466
42621
|
return texture2D(uSceneDepthMap, uv).r;
|
|
42467
42622
|
#else
|
|
42468
42623
|
ivec2 textureSize = textureSize(uSceneDepthMap, 0);
|
|
@@ -54733,85 +54888,6 @@ class ScriptAttributes {
|
|
|
54733
54888
|
}
|
|
54734
54889
|
}
|
|
54735
54890
|
|
|
54736
|
-
const SCRIPT_INITIALIZE = "initialize";
|
|
54737
|
-
const SCRIPT_POST_INITIALIZE = "postInitialize";
|
|
54738
|
-
const SCRIPT_UPDATE = "update";
|
|
54739
|
-
const SCRIPT_POST_UPDATE = "postUpdate";
|
|
54740
|
-
const SCRIPT_SWAP = "swap";
|
|
54741
|
-
|
|
54742
|
-
class Script extends EventHandler {
|
|
54743
|
-
static EVENT_ENABLE = "enable";
|
|
54744
|
-
static EVENT_DISABLE = "disable";
|
|
54745
|
-
static EVENT_STATE = "state";
|
|
54746
|
-
static EVENT_DESTROY = "destroy";
|
|
54747
|
-
static EVENT_ATTR = "attr";
|
|
54748
|
-
static EVENT_ERROR = "error";
|
|
54749
|
-
app;
|
|
54750
|
-
entity;
|
|
54751
|
-
_enabled;
|
|
54752
|
-
_enabledOld;
|
|
54753
|
-
_initialized;
|
|
54754
|
-
_postInitialized;
|
|
54755
|
-
__destroyed;
|
|
54756
|
-
__scriptType;
|
|
54757
|
-
__executionOrder;
|
|
54758
|
-
constructor(args) {
|
|
54759
|
-
super();
|
|
54760
|
-
this.initScript(args);
|
|
54761
|
-
}
|
|
54762
|
-
set enabled(value) {
|
|
54763
|
-
this._enabled = !!value;
|
|
54764
|
-
if (this.enabled === this._enabledOld) return;
|
|
54765
|
-
this._enabledOld = this.enabled;
|
|
54766
|
-
this.fire(this.enabled ? "enable" : "disable");
|
|
54767
|
-
this.fire("state", this.enabled);
|
|
54768
|
-
if (!this._initialized && this.enabled) {
|
|
54769
|
-
this._initialized = true;
|
|
54770
|
-
this.fire("preInitialize");
|
|
54771
|
-
if (this.initialize) {
|
|
54772
|
-
this.entity.script._scriptMethod(this, SCRIPT_INITIALIZE);
|
|
54773
|
-
}
|
|
54774
|
-
}
|
|
54775
|
-
if (this._initialized && !this._postInitialized && this.enabled && !this.entity.script._beingEnabled) {
|
|
54776
|
-
this._postInitialized = true;
|
|
54777
|
-
if (this.postInitialize) {
|
|
54778
|
-
this.entity.script._scriptMethod(this, SCRIPT_POST_INITIALIZE);
|
|
54779
|
-
}
|
|
54780
|
-
}
|
|
54781
|
-
}
|
|
54782
|
-
get enabled() {
|
|
54783
|
-
return this._enabled && !this._destroyed && this.entity.script.enabled && this.entity.enabled;
|
|
54784
|
-
}
|
|
54785
|
-
initScript(args) {
|
|
54786
|
-
const script = this.constructor;
|
|
54787
|
-
this.app = args.app;
|
|
54788
|
-
this.entity = args.entity;
|
|
54789
|
-
this._enabled = typeof args.enabled === "boolean" ? args.enabled : true;
|
|
54790
|
-
this._enabledOld = this.enabled;
|
|
54791
|
-
this.__destroyed = false;
|
|
54792
|
-
this.__scriptType = script;
|
|
54793
|
-
this.__executionOrder = -1;
|
|
54794
|
-
}
|
|
54795
|
-
static __name = null;
|
|
54796
|
-
// Will be assigned when calling createScript or registerScript.
|
|
54797
|
-
static __getScriptName = getScriptName;
|
|
54798
|
-
static set scriptName(value) {
|
|
54799
|
-
this.__name = value;
|
|
54800
|
-
}
|
|
54801
|
-
static get scriptName() {
|
|
54802
|
-
return this.__name;
|
|
54803
|
-
}
|
|
54804
|
-
}
|
|
54805
|
-
const funcNameRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s\/]*)\s*/;
|
|
54806
|
-
function getScriptName(constructorFn) {
|
|
54807
|
-
if (typeof constructorFn !== "function") return void 0;
|
|
54808
|
-
if (constructorFn.scriptName) return constructorFn.scriptName;
|
|
54809
|
-
if ("name" in Function.prototype) return constructorFn.name;
|
|
54810
|
-
if (constructorFn === Function || constructorFn === Function.prototype.constructor) return "Function";
|
|
54811
|
-
const match = `${constructorFn}`.match(funcNameRegex);
|
|
54812
|
-
return match ? match[1] : void 0;
|
|
54813
|
-
}
|
|
54814
|
-
|
|
54815
54891
|
class ScriptType extends Script {
|
|
54816
54892
|
__attributes;
|
|
54817
54893
|
__attributesRaw;
|
|
@@ -54858,7 +54934,6 @@ class ScriptType extends Script {
|
|
|
54858
54934
|
}
|
|
54859
54935
|
}
|
|
54860
54936
|
|
|
54861
|
-
const toLowerCamelCase = (str) => str[0].toLowerCase() + str.substring(1);
|
|
54862
54937
|
class ScriptComponent extends Component {
|
|
54863
54938
|
_attributeDataMap = /* @__PURE__ */ new Map();
|
|
54864
54939
|
static EVENT_CREATE = "create";
|
|
@@ -55176,11 +55251,16 @@ class ScriptComponent extends Component {
|
|
|
55176
55251
|
if (typeof scriptType === "string") {
|
|
55177
55252
|
scriptType = this.system.app.scripts.get(scriptType);
|
|
55178
55253
|
} else if (scriptType) {
|
|
55179
|
-
|
|
55180
|
-
const
|
|
55181
|
-
if (!(scriptType.prototype instanceof ScriptType) && !
|
|
55182
|
-
|
|
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
|
+
}
|
|
55183
55260
|
scriptName = scriptType.__name;
|
|
55261
|
+
if (!scriptName) {
|
|
55262
|
+
return null;
|
|
55263
|
+
}
|
|
55184
55264
|
}
|
|
55185
55265
|
if (scriptType) {
|
|
55186
55266
|
if (!this._scriptsIndex[scriptName] || !this._scriptsIndex[scriptName].instance) {
|
|
@@ -60815,6 +60895,7 @@ class GSplatOctreeResource {
|
|
|
60815
60895
|
aabb = new BoundingBox();
|
|
60816
60896
|
centersVersion = 0;
|
|
60817
60897
|
octree;
|
|
60898
|
+
_numSplats = null;
|
|
60818
60899
|
data;
|
|
60819
60900
|
constructor(assetFileUrl, data, assetLoader) {
|
|
60820
60901
|
this.octree = new GSplatOctree(assetFileUrl, data);
|
|
@@ -60823,6 +60904,17 @@ class GSplatOctreeResource {
|
|
|
60823
60904
|
this.data = data;
|
|
60824
60905
|
this.data.tree = null;
|
|
60825
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
|
+
}
|
|
60826
60918
|
destroy() {
|
|
60827
60919
|
this.octree?.destroy();
|
|
60828
60920
|
this.octree = null;
|
|
@@ -61142,8 +61234,12 @@ struct ScatterUniforms {
|
|
|
61142
61234
|
@group(0) @binding(2) var<storage, read> prefixSumBuffer: array<u32>;
|
|
61143
61235
|
@group(0) @binding(3) var<storage, read_write> compactedOutput: array<u32>;
|
|
61144
61236
|
@compute @workgroup_size({WORKGROUP_SIZE})
|
|
61145
|
-
fn main(
|
|
61146
|
-
|
|
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;
|
|
61147
61243
|
if (intervalIdx >= uniforms.numIntervals) { return; }
|
|
61148
61244
|
let outputOffset = prefixSumBuffer[intervalIdx];
|
|
61149
61245
|
let nextOffset = prefixSumBuffer[intervalIdx + 1u];
|
|
@@ -61216,6 +61312,7 @@ class GSplatIntervalCompaction {
|
|
|
61216
61312
|
_cullComputePerspective = null;
|
|
61217
61313
|
_cullComputeFisheye = null;
|
|
61218
61314
|
_scatterCompute = null;
|
|
61315
|
+
_scatterDispatchSize = new Vec2(1, 1);
|
|
61219
61316
|
_writeIndirectArgsCompute = null;
|
|
61220
61317
|
_cullBindGroupFormatPerspective = null;
|
|
61221
61318
|
_cullBindGroupFormatFisheye = null;
|
|
@@ -61458,7 +61555,8 @@ class GSplatIntervalCompaction {
|
|
|
61458
61555
|
scatterCompute.setParameter("pad0", 0);
|
|
61459
61556
|
scatterCompute.setParameter("pad1", 0);
|
|
61460
61557
|
scatterCompute.setParameter("pad2", 0);
|
|
61461
|
-
|
|
61558
|
+
Compute.calcDispatchSize(numIntervals, this._scatterDispatchSize, this.device.limits.maxComputeWorkgroupsPerDimension || 65535);
|
|
61559
|
+
scatterCompute.setupDispatch(this._scatterDispatchSize.x, this._scatterDispatchSize.y, 1);
|
|
61462
61560
|
this.device.computeDispatch([scatterCompute], "GSplatIntervalScatter");
|
|
61463
61561
|
}
|
|
61464
61562
|
writeIndirectArgs(drawSlot, dispatchSlotBase, numIntervals, sortIndirectInfo) {
|
|
@@ -62730,8 +62828,6 @@ class GSplatManager {
|
|
|
62730
62828
|
this.sortGpuHybrid(lastState);
|
|
62731
62829
|
gpuSortedThisFrame = true;
|
|
62732
62830
|
}
|
|
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
62831
|
if (sortedState?.sortedBefore) {
|
|
62736
62832
|
this.updateColorCameraTracking();
|
|
62737
62833
|
}
|
|
@@ -62752,6 +62848,8 @@ class GSplatManager {
|
|
|
62752
62848
|
inst.needsLodUpdate = true;
|
|
62753
62849
|
}
|
|
62754
62850
|
}
|
|
62851
|
+
const fogParams = this.scene.gsplat.useFog ? this.cameraNode.camera.fogParams ?? this.scene.fog : null;
|
|
62852
|
+
this.renderer.frameUpdate(this.scene.gsplat, this.scene.exposure, fogParams);
|
|
62755
62853
|
return sortedState ? sortedState.totalActiveSplats : 0;
|
|
62756
62854
|
}
|
|
62757
62855
|
sortGpuHybrid(worldState) {
|
|
@@ -77097,7 +77195,7 @@ class RenderPassTAA extends RenderPassShaderQuad {
|
|
|
77097
77195
|
ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("taaResolvePS", taaResolve_default);
|
|
77098
77196
|
const defines = /* @__PURE__ */ new Map();
|
|
77099
77197
|
defines.set("QUALITY_HIGH", true);
|
|
77100
|
-
ShaderUtils.addScreenDepthChunkDefines(
|
|
77198
|
+
ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
|
|
77101
77199
|
this.shader = ShaderUtils.createShader(device, {
|
|
77102
77200
|
uniqueName: "TaaResolveShader",
|
|
77103
77201
|
attributes: { aPosition: SEMANTIC_POSITION },
|
|
@@ -77225,7 +77323,7 @@ class RenderPassCoC extends RenderPassShaderQuad {
|
|
|
77225
77323
|
ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("cocPS", coc_default);
|
|
77226
77324
|
const defines = /* @__PURE__ */ new Map();
|
|
77227
77325
|
if (nearBlur) defines.set("NEAR_BLUR", "");
|
|
77228
|
-
ShaderUtils.addScreenDepthChunkDefines(
|
|
77326
|
+
ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
|
|
77229
77327
|
this.shader = ShaderUtils.createShader(device, {
|
|
77230
77328
|
uniqueName: `CocShader-${nearBlur}`,
|
|
77231
77329
|
attributes: { aPosition: SEMANTIC_POSITION },
|
|
@@ -77268,8 +77366,8 @@ var dofBlur_default$1 = `
|
|
|
77268
77366
|
#if defined(NEAR_BLUR)
|
|
77269
77367
|
float cocNear = coc.g;
|
|
77270
77368
|
if (cocNear > 0.0001) {
|
|
77271
|
-
|
|
77272
|
-
vec2 step = cocNear * blurRadiusNear
|
|
77369
|
+
vec2 nearTextureSize = vec2(textureSize(nearTexture, 0));
|
|
77370
|
+
vec2 step = cocNear * blurRadiusNear * vec2(nearTextureSize.y / nearTextureSize.x, 1.0);
|
|
77273
77371
|
for (int i = 0; i < {KERNEL_COUNT}; i++) {
|
|
77274
77372
|
vec2 uv = uv0 + step * kernel[i];
|
|
77275
77373
|
vec3 tap = texture2DLod(nearTexture, uv, 0.0).rgb;
|
|
@@ -77280,8 +77378,8 @@ var dofBlur_default$1 = `
|
|
|
77280
77378
|
#endif
|
|
77281
77379
|
|
|
77282
77380
|
if (cocFar > 0.0001) {
|
|
77283
|
-
|
|
77284
|
-
vec2 step = cocFar * blurRadiusFar
|
|
77381
|
+
vec2 farTextureSize = vec2(textureSize(farTexture, 0));
|
|
77382
|
+
vec2 step = cocFar * blurRadiusFar * vec2(farTextureSize.y / farTextureSize.x, 1.0);
|
|
77285
77383
|
float sumCoC = 0.0;
|
|
77286
77384
|
for (int i = 0; i < {KERNEL_COUNT}; i++) {
|
|
77287
77385
|
vec2 uv = uv0 + step * kernel[i];
|
|
@@ -77322,7 +77420,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
77322
77420
|
let cocNear: f32 = coc.g;
|
|
77323
77421
|
if (cocNear > 0.0001) {
|
|
77324
77422
|
let nearTextureSize: vec2f = vec2f(textureDimensions(nearTexture, 0));
|
|
77325
|
-
let step: vec2f = cocNear * uniform.blurRadiusNear / nearTextureSize;
|
|
77423
|
+
let step: vec2f = cocNear * uniform.blurRadiusNear * vec2f(nearTextureSize.y / nearTextureSize.x, 1.0);
|
|
77326
77424
|
for (var i: i32 = 0; i < {KERNEL_COUNT}; i = i + 1) {
|
|
77327
77425
|
let uv: vec2f = uv0 + step * uniform.kernel[i].element;
|
|
77328
77426
|
let tap: vec3f = textureSampleLevel(nearTexture, nearTextureSampler, uv, 0.0).rgb;
|
|
@@ -77333,7 +77431,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
77333
77431
|
#endif
|
|
77334
77432
|
if (cocFar > 0.0001) {
|
|
77335
77433
|
let farTextureSize: vec2f = vec2f(textureDimensions(farTexture, 0));
|
|
77336
|
-
let step: vec2f = cocFar * uniform.blurRadiusFar / farTextureSize;
|
|
77434
|
+
let step: vec2f = cocFar * uniform.blurRadiusFar * vec2f(farTextureSize.y / farTextureSize.x, 1.0);
|
|
77337
77435
|
var sumCoC: f32 = 0.0;
|
|
77338
77436
|
for (var i: i32 = 0; i < {KERNEL_COUNT}; i = i + 1) {
|
|
77339
77437
|
let uv: vec2f = uv0 + step * uniform.kernel[i].element;
|
|
@@ -77358,6 +77456,7 @@ class RenderPassDofBlur extends RenderPassShaderQuad {
|
|
|
77358
77456
|
blurRadiusFar = 1;
|
|
77359
77457
|
_blurRings = 3;
|
|
77360
77458
|
_blurRingPoints = 3;
|
|
77459
|
+
referenceHeight = 540;
|
|
77361
77460
|
constructor(device, nearTexture, farTexture, cocTexture) {
|
|
77362
77461
|
super(device);
|
|
77363
77462
|
this.nearTexture = nearTexture;
|
|
@@ -77417,8 +77516,10 @@ class RenderPassDofBlur extends RenderPassShaderQuad {
|
|
|
77417
77516
|
this.cocTextureId.setValue(this.cocTexture);
|
|
77418
77517
|
this.kernelId.setValue(this.kernel);
|
|
77419
77518
|
this.kernelCountId.setValue(this.kernel.length >> 1);
|
|
77420
|
-
this.
|
|
77421
|
-
|
|
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);
|
|
77422
77523
|
super.execute();
|
|
77423
77524
|
}
|
|
77424
77525
|
}
|
|
@@ -77535,7 +77636,7 @@ class FramePassDof extends FramePass {
|
|
|
77535
77636
|
this.cocPass.focusDistance = this.focusDistance;
|
|
77536
77637
|
this.cocPass.focusRange = this.focusRange;
|
|
77537
77638
|
this.blurPass.blurRadiusNear = this.blurRadius;
|
|
77538
|
-
this.blurPass.blurRadiusFar = this.blurRadius
|
|
77639
|
+
this.blurPass.blurRadiusFar = this.blurRadius;
|
|
77539
77640
|
this.blurPass.blurRings = this.blurRings;
|
|
77540
77641
|
this.blurPass.blurRingPoints = this.blurRingPoints;
|
|
77541
77642
|
}
|
|
@@ -77726,7 +77827,7 @@ class RenderPassDepthAwareBlur extends RenderPassShaderQuad {
|
|
|
77726
77827
|
ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("depthAwareBlurPS", depthAwareBlur_default);
|
|
77727
77828
|
const defines = /* @__PURE__ */ new Map();
|
|
77728
77829
|
if (horizontal) defines.set("HORIZONTAL", "");
|
|
77729
|
-
ShaderUtils.addScreenDepthChunkDefines(
|
|
77830
|
+
ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
|
|
77730
77831
|
this.shader = ShaderUtils.createShader(device, {
|
|
77731
77832
|
uniqueName: `DepthAware${horizontal ? "Horizontal" : "Vertical"}BlurShader`,
|
|
77732
77833
|
attributes: { aPosition: SEMANTIC_POSITION },
|
|
@@ -77997,7 +78098,7 @@ class RenderPassSsao extends RenderPassShaderQuad {
|
|
|
77997
78098
|
ShaderChunks.get(device, SHADERLANGUAGE_GLSL).set("ssaoPS", ssao_default$1);
|
|
77998
78099
|
ShaderChunks.get(device, SHADERLANGUAGE_WGSL).set("ssaoPS", ssao_default);
|
|
77999
78100
|
const defines = /* @__PURE__ */ new Map();
|
|
78000
|
-
ShaderUtils.addScreenDepthChunkDefines(
|
|
78101
|
+
ShaderUtils.addScreenDepthChunkDefines(cameraComponent.shaderParams, defines);
|
|
78001
78102
|
this.shader = ShaderUtils.createShader(device, {
|
|
78002
78103
|
uniqueName: "SsaoShader",
|
|
78003
78104
|
attributes: { aPosition: SEMANTIC_POSITION },
|
|
@@ -81718,7 +81819,7 @@ const importSettings = (settings) => {
|
|
|
81718
81819
|
return result;
|
|
81719
81820
|
};
|
|
81720
81821
|
|
|
81721
|
-
var version = "1.26.
|
|
81822
|
+
var version = "1.26.3";
|
|
81722
81823
|
|
|
81723
81824
|
class Tooltip {
|
|
81724
81825
|
register;
|
|
@@ -89578,8 +89679,9 @@ class XrNavigation extends Script {
|
|
|
89578
89679
|
if (!this.cameraEntity) return;
|
|
89579
89680
|
|
|
89580
89681
|
for (const inputSource of this.inputSources) {
|
|
89581
|
-
//
|
|
89582
|
-
|
|
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;
|
|
89583
89685
|
|
|
89584
89686
|
// Left controller - movement
|
|
89585
89687
|
if (inputSource.handedness === 'left') {
|
|
@@ -89678,7 +89780,8 @@ class XrNavigation extends Script {
|
|
|
89678
89780
|
let rightController = null;
|
|
89679
89781
|
|
|
89680
89782
|
for (const inputSource of this.inputSources) {
|
|
89681
|
-
|
|
89783
|
+
// Require a gamepad with thumbstick axes — see handleSmoothLocomotion.
|
|
89784
|
+
if (!inputSource.gamepad || inputSource.gamepad.axes.length < 4) continue;
|
|
89682
89785
|
if (inputSource.handedness === 'right') {
|
|
89683
89786
|
rightController = inputSource;
|
|
89684
89787
|
break;
|