@playcanvas/supersplat-viewer 1.8.1 → 1.8.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 +2 -2
- package/package.json +5 -5
- package/public/index.html +1 -6
- package/public/index.js +188 -33
- 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.8.
|
|
3
|
+
"version": "1.8.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",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"@playcanvas/web-components": "0.2.11",
|
|
42
42
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
43
43
|
"@rollup/plugin-typescript": "12.3.0",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
45
|
-
"@typescript-eslint/parser": "8.
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "8.47.0",
|
|
45
|
+
"@typescript-eslint/parser": "8.47.0",
|
|
46
46
|
"autoprefixer": "10.4.22",
|
|
47
47
|
"concurrently": "9.2.1",
|
|
48
48
|
"eslint": "9.39.1",
|
|
49
49
|
"globals": "16.5.0",
|
|
50
|
-
"playcanvas": "2.13.
|
|
50
|
+
"playcanvas": "2.13.2",
|
|
51
51
|
"postcss": "8.5.6",
|
|
52
52
|
"publint": "0.3.15",
|
|
53
53
|
"rollup": "4.53.2",
|
|
54
54
|
"rollup-plugin-copy": "3.5.0",
|
|
55
55
|
"rollup-plugin-scss": "4.0.1",
|
|
56
56
|
"rollup-plugin-string": "3.0.0",
|
|
57
|
-
"sass": "1.94.
|
|
57
|
+
"sass": "1.94.1",
|
|
58
58
|
"serve": "14.2.5",
|
|
59
59
|
"typescript": "5.9.3"
|
|
60
60
|
},
|
package/public/index.html
CHANGED
|
@@ -43,12 +43,7 @@
|
|
|
43
43
|
<pc-scene>
|
|
44
44
|
<!-- Camera (with XR support) -->
|
|
45
45
|
<pc-entity name="camera root">
|
|
46
|
-
<pc-entity name="camera">
|
|
47
|
-
<pc-camera near-clip="0.001" far-clip="5000" horizontal-fov="true" tonemap="none"></pc-camera>
|
|
48
|
-
</pc-entity>
|
|
49
|
-
<!-- XR controllers will be added here -->
|
|
50
|
-
<pc-scripts>
|
|
51
|
-
</pc-scripts>
|
|
46
|
+
<pc-entity name="camera"></pc-entity>
|
|
52
47
|
</pc-entity>
|
|
53
48
|
<!-- Light (for XR controllers) -->
|
|
54
49
|
<pc-entity name="light" rotation="35 45 0">
|
package/public/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const TRACEID_GPU_TIMINGS = 'GpuTimings';
|
|
2
2
|
|
|
3
|
-
const version = '2.13.
|
|
4
|
-
const revision = '
|
|
3
|
+
const version = '2.13.2';
|
|
4
|
+
const revision = '8620544';
|
|
5
5
|
function extend(target, ex) {
|
|
6
6
|
for(const prop in ex){
|
|
7
7
|
const copy = ex[prop];
|
|
@@ -154,6 +154,17 @@ const platform = {
|
|
|
154
154
|
environment: environment,
|
|
155
155
|
browser: environment === 'browser',
|
|
156
156
|
worker: environment === 'worker',
|
|
157
|
+
desktop: [
|
|
158
|
+
'windows',
|
|
159
|
+
'osx',
|
|
160
|
+
'linux',
|
|
161
|
+
'cros'
|
|
162
|
+
].includes(platformName),
|
|
163
|
+
mobile: [
|
|
164
|
+
'android',
|
|
165
|
+
'ios'
|
|
166
|
+
].includes(platformName),
|
|
167
|
+
ios: platformName === 'ios',
|
|
157
168
|
android: platformName === 'android',
|
|
158
169
|
touch: touch,
|
|
159
170
|
passiveEvents: passiveEvents,
|
|
@@ -6555,6 +6566,10 @@ class GraphicsDevice extends EventHandler {
|
|
|
6555
6566
|
if (this.textureFloatFilterable) capsDefines.set('CAPS_TEXTURE_FLOAT_FILTERABLE', '');
|
|
6556
6567
|
if (this.textureFloatRenderable) capsDefines.set('CAPS_TEXTURE_FLOAT_RENDERABLE', '');
|
|
6557
6568
|
if (this.supportsMultiDraw) capsDefines.set('CAPS_MULTI_DRAW', '');
|
|
6569
|
+
if (platform.desktop) capsDefines.set('PLATFORM_DESKTOP', '');
|
|
6570
|
+
if (platform.mobile) capsDefines.set('PLATFORM_MOBILE', '');
|
|
6571
|
+
if (platform.android) capsDefines.set('PLATFORM_ANDROID', '');
|
|
6572
|
+
if (platform.ios) capsDefines.set('PLATFORM_IOS', '');
|
|
6558
6573
|
}
|
|
6559
6574
|
destroy() {
|
|
6560
6575
|
this.fire('destroy');
|
|
@@ -33981,7 +33996,7 @@ var glslGsplatCopyToWorkBufferPS = `
|
|
|
33981
33996
|
#include "gsplatEvalSHVS"
|
|
33982
33997
|
#include "gsplatQuatToMat3VS"
|
|
33983
33998
|
#include "gsplatSourceFormatVS"
|
|
33984
|
-
|
|
33999
|
+
#include "packHalfPS"
|
|
33985
34000
|
uniform int uStartLine;
|
|
33986
34001
|
uniform int uViewportWidth;
|
|
33987
34002
|
#ifdef GSPLAT_LOD
|
|
@@ -34021,7 +34036,7 @@ void main(void) {
|
|
|
34021
34036
|
source.id = uint(originalIndex);
|
|
34022
34037
|
source.uv = ivec2(source.id % srcSize, source.id / srcSize);
|
|
34023
34038
|
vec3 modelCenter = readCenter(source);
|
|
34024
|
-
|
|
34039
|
+
vec3 worldCenter = (matrix_model * vec4(modelCenter, 1.0)).xyz;
|
|
34025
34040
|
SplatCenter center;
|
|
34026
34041
|
initCenter(modelCenter, center);
|
|
34027
34042
|
vec3 covA, covB;
|
|
@@ -34031,7 +34046,7 @@ void main(void) {
|
|
|
34031
34046
|
covA.y, covB.x, covB.y,
|
|
34032
34047
|
covA.z, covB.y, covB.z
|
|
34033
34048
|
);
|
|
34034
|
-
mat3 linear = mat3(
|
|
34049
|
+
mat3 linear = mat3(matrix_model);
|
|
34035
34050
|
mat3 Ct = linear * C * transpose(linear);
|
|
34036
34051
|
covA = Ct[0];
|
|
34037
34052
|
covB = vec3(Ct[1][1], Ct[1][2], Ct[2][2]);
|
|
@@ -34057,8 +34072,8 @@ void main(void) {
|
|
|
34057
34072
|
pcFragColor0 = color;
|
|
34058
34073
|
#endif
|
|
34059
34074
|
#ifndef GSPLAT_COLOR_ONLY
|
|
34060
|
-
pcFragColor1 = uvec4(floatBitsToUint(
|
|
34061
|
-
pcFragColor2 = uvec2(
|
|
34075
|
+
pcFragColor1 = uvec4(floatBitsToUint(worldCenter.x), floatBitsToUint(worldCenter.y), floatBitsToUint(worldCenter.z), packHalf2x16Safe(vec2(covA.z, covB.z)));
|
|
34076
|
+
pcFragColor2 = uvec2(packHalf2x16Safe(covA.xy), packHalf2x16Safe(covB.xy));
|
|
34062
34077
|
#endif
|
|
34063
34078
|
}
|
|
34064
34079
|
}
|
|
@@ -34071,7 +34086,7 @@ var wgslGsplatCopyToWorkBufferPS = `
|
|
|
34071
34086
|
#include "gsplatEvalSHVS"
|
|
34072
34087
|
#include "gsplatQuatToMat3VS"
|
|
34073
34088
|
#include "gsplatSourceFormatVS"
|
|
34074
|
-
|
|
34089
|
+
#include "packHalfPS"
|
|
34075
34090
|
uniform uStartLine: i32;
|
|
34076
34091
|
uniform uViewportWidth: i32;
|
|
34077
34092
|
#ifdef GSPLAT_LOD
|
|
@@ -34112,7 +34127,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
34112
34127
|
source.id = u32(originalIndex);
|
|
34113
34128
|
source.uv = vec2i(i32(source.id % srcSize), i32(source.id / srcSize));
|
|
34114
34129
|
var modelCenter = readCenter(&source);
|
|
34115
|
-
|
|
34130
|
+
let worldCenter = (uniform.matrix_model * vec4f(modelCenter, 1.0)).xyz;
|
|
34116
34131
|
var center: SplatCenter;
|
|
34117
34132
|
initCenter(modelCenter, ¢er);
|
|
34118
34133
|
var covA: vec3f;
|
|
@@ -34123,7 +34138,7 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
34123
34138
|
vec3f(covA.y, covB.x, covB.y),
|
|
34124
34139
|
vec3f(covA.z, covB.y, covB.z)
|
|
34125
34140
|
);
|
|
34126
|
-
let linear = mat3x3f(uniform.
|
|
34141
|
+
let linear = mat3x3f(uniform.matrix_model[0].xyz, uniform.matrix_model[1].xyz, uniform.matrix_model[2].xyz);
|
|
34127
34142
|
let Ct = linear * C * transpose(linear);
|
|
34128
34143
|
covA = Ct[0];
|
|
34129
34144
|
covB = vec3f(Ct[1][1], Ct[1][2], Ct[2][2]);
|
|
@@ -34138,8 +34153,8 @@ fn fragmentMain(input: FragmentInput) -> FragmentOutput {
|
|
|
34138
34153
|
color = vec4f(color.xyz * uniform.uColorMultiply, color.w);
|
|
34139
34154
|
output.color = color;
|
|
34140
34155
|
#ifndef GSPLAT_COLOR_ONLY
|
|
34141
|
-
output.color1 = vec4u(bitcast<u32>(
|
|
34142
|
-
output.color2 = vec2u(
|
|
34156
|
+
output.color1 = vec4u(bitcast<u32>(worldCenter.x), bitcast<u32>(worldCenter.y), bitcast<u32>(worldCenter.z), pack2x16floatSafe(vec2f(covA.z, covB.z)));
|
|
34157
|
+
output.color2 = vec2u(pack2x16floatSafe(covA.xy), pack2x16floatSafe(covB.xy));
|
|
34143
34158
|
#endif
|
|
34144
34159
|
}
|
|
34145
34160
|
|
|
@@ -34195,7 +34210,6 @@ class GSplatWorkBufferRenderPass extends RenderPass {
|
|
|
34195
34210
|
const { intervals, activeSplats, lineStart, viewport, intervalTexture } = splatInfo;
|
|
34196
34211
|
const workBufferRenderInfo = resource.getWorkBufferRenderInfo(intervals.length > 0, this.workBuffer.colorTextureFormat, this.colorOnly);
|
|
34197
34212
|
workBufferRenderInfo.material.setParameters(device);
|
|
34198
|
-
scope.resolve('uTransform').setValue(splatInfo.node.getWorldTransform().data);
|
|
34199
34213
|
if (intervalTexture) {
|
|
34200
34214
|
scope.resolve('uIntervalsTexture').setValue(intervalTexture.texture);
|
|
34201
34215
|
}
|
|
@@ -41973,6 +41987,70 @@ void opacityDither(float alpha, float id) {
|
|
|
41973
41987
|
var outputPS$1 = `
|
|
41974
41988
|
`;
|
|
41975
41989
|
|
|
41990
|
+
var packHalfPS$1 = `
|
|
41991
|
+
#if defined(PLATFORM_ANDROID)
|
|
41992
|
+
uint floatToHalf(float a) {
|
|
41993
|
+
uint u = floatBitsToUint(a);
|
|
41994
|
+
uint sign = (u >> 16u) & 0x8000u;
|
|
41995
|
+
uint absu = u & 0x7FFFFFFFu;
|
|
41996
|
+
uint man = u & 0x007FFFFFu;
|
|
41997
|
+
int e32 = int((u >> 23u) & 0xFFu) - 127;
|
|
41998
|
+
|
|
41999
|
+
if ((absu & 0x7F800000u) == 0x7F800000u) {
|
|
42000
|
+
bool isnan = (man != 0u);
|
|
42001
|
+
return sign | (isnan ? 0x7E00u : 0x7C00u);
|
|
42002
|
+
}
|
|
42003
|
+
|
|
42004
|
+
if (e32 > 15) return sign | 0x7C00u;
|
|
42005
|
+
|
|
42006
|
+
if (e32 >= -14) {
|
|
42007
|
+
uint he = uint(e32 + 15);
|
|
42008
|
+
uint hm = man >> 13u;
|
|
42009
|
+
uint rem = man & 0x1FFFu;
|
|
42010
|
+
uint add = (rem > 0x1000u || (rem == 0x1000u && (hm & 1u) == 1u)) ? 1u : 0u;
|
|
42011
|
+
hm = (hm + add) & 0x3FFu;
|
|
42012
|
+
if ((hm & 0x400u) != 0u) {
|
|
42013
|
+
hm = 0u; he = he + 1u;
|
|
42014
|
+
if (he >= 31u) return sign | 0x7C00u;
|
|
42015
|
+
}
|
|
42016
|
+
return sign | (he << 10u) | hm;
|
|
42017
|
+
}
|
|
42018
|
+
|
|
42019
|
+
if (e32 >= -24) {
|
|
42020
|
+
uint s = uint(-(e32 + 1));
|
|
42021
|
+
uint mnorm = 0x00800000u | man;
|
|
42022
|
+
uint hm = mnorm >> s;
|
|
42023
|
+
uint mask = (1u << s) - 1u;
|
|
42024
|
+
uint rem = mnorm & mask;
|
|
42025
|
+
uint halfBt = 1u << (s - 1u);
|
|
42026
|
+
uint add = (rem > halfBt || (rem == halfBt && (hm & 1u) == 1u)) ? 1u : 0u;
|
|
42027
|
+
hm = hm + add;
|
|
42028
|
+
if (hm >= 0x400u) return sign | (1u << 10u);
|
|
42029
|
+
return sign | hm;
|
|
42030
|
+
}
|
|
42031
|
+
|
|
42032
|
+
return sign;
|
|
42033
|
+
}
|
|
42034
|
+
uint packHalf2x16Safe(vec2 v) {
|
|
42035
|
+
uint u_x = floatBitsToUint(v.x);
|
|
42036
|
+
uint u_y = floatBitsToUint(v.y);
|
|
42037
|
+
|
|
42038
|
+
int e32_x = int((u_x >> 23u) & 0xFFu) - 127;
|
|
42039
|
+
int e32_y = int((u_y >> 23u) & 0xFFu) - 127;
|
|
42040
|
+
|
|
42041
|
+
if (e32_x < -14 || e32_y < -14) {
|
|
42042
|
+
return (floatToHalf(v.y) << 16u) | floatToHalf(v.x);
|
|
42043
|
+
}
|
|
42044
|
+
|
|
42045
|
+
return packHalf2x16(v);
|
|
42046
|
+
}
|
|
42047
|
+
#else
|
|
42048
|
+
uint packHalf2x16Safe(vec2 v) {
|
|
42049
|
+
return packHalf2x16(v);
|
|
42050
|
+
}
|
|
42051
|
+
#endif
|
|
42052
|
+
`;
|
|
42053
|
+
|
|
41976
42054
|
var outputAlphaPS$1 = `
|
|
41977
42055
|
#if LIT_BLEND_TYPE == NORMAL || LIT_BLEND_TYPE == ADDITIVEALPHA || defined(LIT_ALPHA_TO_COVERAGE)
|
|
41978
42056
|
gl_FragColor.a = litArgs_opacity;
|
|
@@ -43968,6 +44046,7 @@ const shaderChunksGLSL = {
|
|
|
43968
44046
|
opacityDitherPS: opacityDitherPS$1,
|
|
43969
44047
|
outputPS: outputPS$1,
|
|
43970
44048
|
outputAlphaPS: outputAlphaPS$1,
|
|
44049
|
+
packHalfPS: packHalfPS$1,
|
|
43971
44050
|
outputTex2DPS: outputTex2DPS$1,
|
|
43972
44051
|
sheenPS: sheenPS$1,
|
|
43973
44052
|
sheenGlossPS: sheenGlossPS$1,
|
|
@@ -47321,6 +47400,70 @@ var outputAlphaPS = `
|
|
|
47321
47400
|
#endif
|
|
47322
47401
|
`;
|
|
47323
47402
|
|
|
47403
|
+
var packHalfPS = `
|
|
47404
|
+
#if defined(PLATFORM_ANDROID)
|
|
47405
|
+
fn floatToHalf(a: f32) -> u32 {
|
|
47406
|
+
let u: u32 = bitcast<u32>(a);
|
|
47407
|
+
let sign: u32 = (u >> 16u) & 0x8000u;
|
|
47408
|
+
let absu: u32 = u & 0x7FFFFFFFu;
|
|
47409
|
+
let man: u32 = u & 0x007FFFFFu;
|
|
47410
|
+
let e32: i32 = i32((u >> 23u) & 0xFFu) - 127;
|
|
47411
|
+
|
|
47412
|
+
if ((absu & 0x7F800000u) == 0x7F800000u) {
|
|
47413
|
+
let isnan = (man != 0u);
|
|
47414
|
+
return sign | select(0x7C00u, 0x7E00u, isnan);
|
|
47415
|
+
}
|
|
47416
|
+
|
|
47417
|
+
if (e32 > 15) { return sign | 0x7C00u; }
|
|
47418
|
+
|
|
47419
|
+
if (e32 >= -14) {
|
|
47420
|
+
var he: u32 = u32(e32 + 15);
|
|
47421
|
+
var hm: u32 = man >> 13u;
|
|
47422
|
+
let rem: u32 = man & 0x1FFFu;
|
|
47423
|
+
let add: u32 = select(0u, 1u, (rem > 0x1000u) || (rem == 0x1000u && (hm & 1u) == 1u));
|
|
47424
|
+
hm = (hm + add) & 0x3FFu;
|
|
47425
|
+
if ((hm & 0x400u) != 0u) {
|
|
47426
|
+
hm = 0u; he = he + 1u;
|
|
47427
|
+
if (he >= 31u) { return sign | 0x7C00u; }
|
|
47428
|
+
}
|
|
47429
|
+
return sign | (he << 10u) | hm;
|
|
47430
|
+
}
|
|
47431
|
+
|
|
47432
|
+
if (e32 >= -24) {
|
|
47433
|
+
let s: u32 = u32(-(e32 + 1));
|
|
47434
|
+
let mnorm: u32 = 0x00800000u | man;
|
|
47435
|
+
var hm: u32 = mnorm >> s;
|
|
47436
|
+
let mask: u32 = (1u << s) - 1u;
|
|
47437
|
+
let rem: u32 = mnorm & mask;
|
|
47438
|
+
let halfBt: u32 = 1u << (s - 1u);
|
|
47439
|
+
let add: u32 = select(0u, 1u, (rem > halfBt) || (rem == halfBt && (hm & 1u) == 1u));
|
|
47440
|
+
hm = hm + add;
|
|
47441
|
+
if (hm >= 0x400u) { return sign | (1u << 10u); }
|
|
47442
|
+
return sign | hm;
|
|
47443
|
+
}
|
|
47444
|
+
|
|
47445
|
+
return sign;
|
|
47446
|
+
}
|
|
47447
|
+
fn pack2x16floatSafe(v: vec2f) -> u32 {
|
|
47448
|
+
let u_x: u32 = bitcast<u32>(v.x);
|
|
47449
|
+
let u_y: u32 = bitcast<u32>(v.y);
|
|
47450
|
+
|
|
47451
|
+
let e32_x: i32 = i32((u_x >> 23u) & 0xFFu) - 127;
|
|
47452
|
+
let e32_y: i32 = i32((u_y >> 23u) & 0xFFu) - 127;
|
|
47453
|
+
|
|
47454
|
+
if (e32_x < -14 || e32_y < -14) {
|
|
47455
|
+
return (floatToHalf(v.y) << 16u) | floatToHalf(v.x);
|
|
47456
|
+
}
|
|
47457
|
+
|
|
47458
|
+
return pack2x16float(v);
|
|
47459
|
+
}
|
|
47460
|
+
#else
|
|
47461
|
+
fn pack2x16floatSafe(v: vec2f) -> u32 {
|
|
47462
|
+
return pack2x16float(v);
|
|
47463
|
+
}
|
|
47464
|
+
#endif
|
|
47465
|
+
`;
|
|
47466
|
+
|
|
47324
47467
|
var outputTex2DPS = `
|
|
47325
47468
|
varying vUv0: vec2f;
|
|
47326
47469
|
var source: texture_2d<f32>;
|
|
@@ -49226,6 +49369,7 @@ const shaderChunksWGSL = {
|
|
|
49226
49369
|
opacityDitherPS,
|
|
49227
49370
|
outputPS,
|
|
49228
49371
|
outputAlphaPS,
|
|
49372
|
+
packHalfPS,
|
|
49229
49373
|
outputTex2DPS,
|
|
49230
49374
|
sheenPS,
|
|
49231
49375
|
sheenGlossPS,
|
|
@@ -76064,6 +76208,9 @@ new BoundingBox();
|
|
|
76064
76208
|
new Color(1, 0, 1)
|
|
76065
76209
|
];
|
|
76066
76210
|
class GSplatOctreeInstance {
|
|
76211
|
+
get hasPendingLoads() {
|
|
76212
|
+
return this.pending.size > 0 || this.prefetchPending.size > 0;
|
|
76213
|
+
}
|
|
76067
76214
|
constructor(octree, placement, assetLoader){
|
|
76068
76215
|
this.activePlacements = new Set();
|
|
76069
76216
|
this.dirtyModifiedPlacements = false;
|
|
@@ -76923,6 +77070,16 @@ class GSplatManager {
|
|
|
76923
77070
|
}
|
|
76924
77071
|
return _cameraDeltas;
|
|
76925
77072
|
}
|
|
77073
|
+
fireFrameReadyEvent() {
|
|
77074
|
+
const ready = this.sortedVersion === this.lastWorldStateVersion;
|
|
77075
|
+
let loading = this.director.assetLoader.isLoading;
|
|
77076
|
+
if (!loading) {
|
|
77077
|
+
for (const [, inst] of this.octreeInstances){
|
|
77078
|
+
loading ||= inst.hasPendingLoads;
|
|
77079
|
+
}
|
|
77080
|
+
}
|
|
77081
|
+
this.director.eventHandler.fire('frame:ready', this.cameraNode.camera, this.renderer.layer, ready, loading);
|
|
77082
|
+
}
|
|
76926
77083
|
update() {
|
|
76927
77084
|
this.sorter.applyPendingSorted();
|
|
76928
77085
|
let fullUpdate = false;
|
|
@@ -77025,6 +77182,7 @@ class GSplatManager {
|
|
|
77025
77182
|
}
|
|
77026
77183
|
tempOctreesTicked.clear();
|
|
77027
77184
|
}
|
|
77185
|
+
this.fireFrameReadyEvent();
|
|
77028
77186
|
const { textureSize } = this.workBuffer;
|
|
77029
77187
|
return textureSize * textureSize;
|
|
77030
77188
|
}
|
|
@@ -77522,6 +77680,9 @@ class GSplatAssetLoaderBase {
|
|
|
77522
77680
|
load(url) {}
|
|
77523
77681
|
unload(url) {}
|
|
77524
77682
|
getResource(url) {}
|
|
77683
|
+
get isLoading() {
|
|
77684
|
+
return false;
|
|
77685
|
+
}
|
|
77525
77686
|
constructor(){
|
|
77526
77687
|
this.cooldownTicks = 100;
|
|
77527
77688
|
}
|
|
@@ -77532,6 +77693,9 @@ class GSplatAssetLoader extends GSplatAssetLoaderBase {
|
|
|
77532
77693
|
super(), this._urlToAsset = new Map(), this.maxConcurrentLoads = 2, this.maxRetries = 2, this._currentlyLoading = new Set(), this._loadQueue = [], this._retryCount = new Map();
|
|
77533
77694
|
this._registry = registry;
|
|
77534
77695
|
}
|
|
77696
|
+
get isLoading() {
|
|
77697
|
+
return this._currentlyLoading.size > 0 || this._loadQueue.length > 0;
|
|
77698
|
+
}
|
|
77535
77699
|
load(url) {
|
|
77536
77700
|
const asset = this._urlToAsset.get(url);
|
|
77537
77701
|
if (asset?.loaded || this._currentlyLoading.has(url)) {
|
|
@@ -77650,6 +77814,8 @@ vec4 readColor(in SplatSource source) {
|
|
|
77650
77814
|
`;
|
|
77651
77815
|
|
|
77652
77816
|
var gsplatCommonVS$1 = `
|
|
77817
|
+
#include "gsplatHelpersVS"
|
|
77818
|
+
#include "gsplatCustomizeVS"
|
|
77653
77819
|
#include "gsplatStructsVS"
|
|
77654
77820
|
#include "gsplatEvalSHVS"
|
|
77655
77821
|
#include "gsplatQuatToMat3VS"
|
|
@@ -77666,6 +77832,7 @@ void clipCorner(inout SplatCorner corner, float alpha) {
|
|
|
77666
77832
|
`;
|
|
77667
77833
|
|
|
77668
77834
|
var gsplatCompressedDataVS$1 = `
|
|
77835
|
+
#include "gsplatPackingPS"
|
|
77669
77836
|
uniform highp usampler2D packedTexture;
|
|
77670
77837
|
uniform highp sampler2D chunkTexture;
|
|
77671
77838
|
vec4 chunkDataA;
|
|
@@ -77681,14 +77848,6 @@ vec3 unpack111011(uint bits) {
|
|
|
77681
77848
|
float(bits & 0x7ffu) / 2047.0
|
|
77682
77849
|
);
|
|
77683
77850
|
}
|
|
77684
|
-
vec4 unpack8888(uint bits) {
|
|
77685
|
-
return vec4(
|
|
77686
|
-
float(bits >> 24u) / 255.0,
|
|
77687
|
-
float((bits >> 16u) & 0xffu) / 255.0,
|
|
77688
|
-
float((bits >> 8u) & 0xffu) / 255.0,
|
|
77689
|
-
float(bits & 0xffu) / 255.0
|
|
77690
|
-
);
|
|
77691
|
-
}
|
|
77692
77851
|
const float norm = sqrt(2.0);
|
|
77693
77852
|
vec4 unpackRotation(uint bits) {
|
|
77694
77853
|
float a = (float((bits >> 20u) & 0x3ffu) / 1023.0 - 0.5) * norm;
|
|
@@ -78227,8 +78386,6 @@ bool initSource(out SplatSource source) {
|
|
|
78227
78386
|
`;
|
|
78228
78387
|
|
|
78229
78388
|
var gsplatVS$1 = `
|
|
78230
|
-
#include "gsplatHelpersVS"
|
|
78231
|
-
#include "gsplatCustomizeVS"
|
|
78232
78389
|
#include "gsplatCommonVS"
|
|
78233
78390
|
varying mediump vec2 gaussianUV;
|
|
78234
78391
|
varying mediump vec4 gaussianColor;
|
|
@@ -78393,6 +78550,8 @@ fn readColor(source: ptr<function, SplatSource>) -> vec4f {
|
|
|
78393
78550
|
`;
|
|
78394
78551
|
|
|
78395
78552
|
var gsplatCommonVS = `
|
|
78553
|
+
#include "gsplatHelpersVS"
|
|
78554
|
+
#include "gsplatCustomizeVS"
|
|
78396
78555
|
#include "gsplatStructsVS"
|
|
78397
78556
|
#include "gsplatEvalSHVS"
|
|
78398
78557
|
#include "gsplatQuatToMat3VS"
|
|
@@ -78409,6 +78568,7 @@ fn clipCorner(corner: ptr<function, SplatCorner>, alpha: f32) {
|
|
|
78409
78568
|
`;
|
|
78410
78569
|
|
|
78411
78570
|
var gsplatCompressedDataVS = `
|
|
78571
|
+
#include "gsplatPackingPS"
|
|
78412
78572
|
var packedTexture: texture_2d<u32>;
|
|
78413
78573
|
var chunkTexture: texture_2d<uff>;
|
|
78414
78574
|
var<private> chunkDataA: vec4f;
|
|
@@ -78420,14 +78580,6 @@ var<private> packedData: vec4u;
|
|
|
78420
78580
|
fn unpack111011(bits: u32) -> vec3f {
|
|
78421
78581
|
return (vec3f((vec3<u32>(bits) >> vec3<u32>(21u, 11u, 0u)) & vec3<u32>(0x7ffu, 0x3ffu, 0x7ffu))) / vec3f(2047.0, 1023.0, 2047.0);
|
|
78422
78582
|
}
|
|
78423
|
-
fn unpack8888(bits: u32) -> vec4f {
|
|
78424
|
-
return vec4f(
|
|
78425
|
-
f32((bits >> 24u) & 0xffu),
|
|
78426
|
-
f32((bits >> 16u) & 0xffu),
|
|
78427
|
-
f32((bits >> 8u) & 0xffu),
|
|
78428
|
-
f32(bits & 0xffu)
|
|
78429
|
-
) / 255.0;
|
|
78430
|
-
}
|
|
78431
78583
|
const norm_const: f32 = sqrt(2.0);
|
|
78432
78584
|
fn unpackRotation(bits: u32) -> vec4f {
|
|
78433
78585
|
let a = (f32((bits >> 20u) & 0x3ffu) / 1023.0 - 0.5) * norm_const;
|
|
@@ -79026,8 +79178,6 @@ fn initSource(source: ptr<function, SplatSource>) -> bool {
|
|
|
79026
79178
|
`;
|
|
79027
79179
|
|
|
79028
79180
|
var gsplatVS = `
|
|
79029
|
-
#include "gsplatHelpersVS"
|
|
79030
|
-
#include "gsplatCustomizeVS"
|
|
79031
79181
|
#include "gsplatCommonVS"
|
|
79032
79182
|
varying gaussianUV: vec2f;
|
|
79033
79183
|
varying gaussianColor: vec4f;
|
|
@@ -79170,6 +79320,9 @@ class GSplatComponentSystem extends ComponentSystem {
|
|
|
79170
79320
|
static{
|
|
79171
79321
|
this.EVENT_MATERIALCREATED = 'material:created';
|
|
79172
79322
|
}
|
|
79323
|
+
static{
|
|
79324
|
+
this.EVENT_FRAMEREADY = 'frame:ready';
|
|
79325
|
+
}
|
|
79173
79326
|
constructor(app){
|
|
79174
79327
|
super(app);
|
|
79175
79328
|
this.id = 'gsplat';
|
|
@@ -102062,6 +102215,7 @@ const initXr = (global) => {
|
|
|
102062
102215
|
const cameraPosition = new Vec3();
|
|
102063
102216
|
const cameraRotation = new Quat();
|
|
102064
102217
|
const angles = new Vec3();
|
|
102218
|
+
parent.addComponent('script');
|
|
102065
102219
|
parent.script.create(XrControllers);
|
|
102066
102220
|
parent.script.create(XrNavigation);
|
|
102067
102221
|
app.xr.on('start', () => {
|
|
@@ -102191,6 +102345,7 @@ const main = (app, camera, settingsJson, config) => {
|
|
|
102191
102345
|
if (config.poster) {
|
|
102192
102346
|
initPoster(events);
|
|
102193
102347
|
}
|
|
102348
|
+
camera.addComponent('camera');
|
|
102194
102349
|
// Initialize XR support
|
|
102195
102350
|
initXr(global);
|
|
102196
102351
|
// Initialize user interface
|