@es3d/es3d 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/es3d-stage.min.js +258 -244
- package/docs/SPEC.md +1 -1
- package/package.json +1 -1
- package/src/io/threejs.js +19 -9
- package/src/io/usd.js +30 -6
- package/src/io/x3d.js +6 -4
- package/src/render/frame-builder.js +38 -3
|
@@ -7657,11 +7657,25 @@ function xo(e, t, n) {
|
|
|
7657
7657
|
return Math.sqrt(e * e + t * t + n * n);
|
|
7658
7658
|
}
|
|
7659
7659
|
function So(e, t) {
|
|
7660
|
+
let n = e.aspect || 1, r = Math.tan(e.verticalFov(n) / 2);
|
|
7661
|
+
return {
|
|
7662
|
+
orthographic: e.type === "orthographic",
|
|
7663
|
+
ppuFactor: e.pixelsPerUnit(1, t),
|
|
7664
|
+
view: e.view,
|
|
7665
|
+
cornerStretch: 1 + r * r * (1 + n * n)
|
|
7666
|
+
};
|
|
7667
|
+
}
|
|
7668
|
+
function Co(e, t, n, r, i) {
|
|
7669
|
+
if (e.orthographic) return e.ppuFactor;
|
|
7670
|
+
let a = e.view, o = -(a[2] * t + a[6] * n + a[10] * r + a[14]), s = o > 0 ? Math.min(i * i / (o * o), e.cornerStretch) : e.cornerStretch;
|
|
7671
|
+
return e.ppuFactor * s / Math.max(i, 1e-6);
|
|
7672
|
+
}
|
|
7673
|
+
function wo(e, t) {
|
|
7660
7674
|
for (let n = t + 1; n < e.length; n++) if (e[n]) return n;
|
|
7661
7675
|
for (let n = t - 1; n >= 0; n--) if (e[n]) return n;
|
|
7662
7676
|
return e.length - 1;
|
|
7663
7677
|
}
|
|
7664
|
-
function
|
|
7678
|
+
function To(e, t) {
|
|
7665
7679
|
let n = t * 16, r = 0;
|
|
7666
7680
|
for (let t = 0; t < 3; t++) {
|
|
7667
7681
|
let i = xo(e[n + t * 4], e[n + t * 4 + 1], e[n + t * 4 + 2]);
|
|
@@ -7669,7 +7683,7 @@ function Co(e, t) {
|
|
|
7669
7683
|
}
|
|
7670
7684
|
return r || 1;
|
|
7671
7685
|
}
|
|
7672
|
-
function
|
|
7686
|
+
function Eo(e, t, n, r, i) {
|
|
7673
7687
|
if (!(t > 1) || !e) return 0;
|
|
7674
7688
|
let a = 1 / (i > 0 ? i : 1), o = n * r, s = 0, c = Math.min(t, e.length) - 1;
|
|
7675
7689
|
for (let t = c; t >= 1; t--) if (e[t] * o <= a) {
|
|
@@ -7678,7 +7692,7 @@ function wo(e, t, n, r, i) {
|
|
|
7678
7692
|
}
|
|
7679
7693
|
return s;
|
|
7680
7694
|
}
|
|
7681
|
-
function
|
|
7695
|
+
function Do(e) {
|
|
7682
7696
|
let t = (t) => [
|
|
7683
7697
|
e[t],
|
|
7684
7698
|
e[4 + t],
|
|
@@ -7722,7 +7736,7 @@ function To(e) {
|
|
|
7722
7736
|
}
|
|
7723
7737
|
return o;
|
|
7724
7738
|
}
|
|
7725
|
-
var
|
|
7739
|
+
var Oo = class {
|
|
7726
7740
|
constructor() {
|
|
7727
7741
|
this.instanceData = /* @__PURE__ */ new Float32Array(16384), this.keys = /* @__PURE__ */ new Int32Array(1024), this.lods = /* @__PURE__ */ new Uint8Array(1024), this.last = null, this.lastSignature = "";
|
|
7728
7742
|
}
|
|
@@ -7754,22 +7768,22 @@ var Eo = class {
|
|
|
7754
7768
|
let { scene: t, camera: n, pool: r, meshOf: i, options: a } = e, o = t.count, s = 0;
|
|
7755
7769
|
if (a.selection && a.selection.size) for (let e = 0; e < o; e++) a.selection.has(t.uid[e]) && s++;
|
|
7756
7770
|
this.ensure(o + (a.bbox ? o : 0) + s + 64);
|
|
7757
|
-
let c = n.position, l = this.lodStates(t, c, (e) => Math.hypot(e[0] - c[0], e[1] - c[1], e[2] - c[2])), u = a.culling === !1 ? null :
|
|
7771
|
+
let c = n.position, l = this.lodStates(t, c, (e) => Math.hypot(e[0] - c[0], e[1] - c[1], e[2] - c[2])), u = a.culling === !1 ? null : Do(n.viewProj), d = t.spheres, f = this.keys, p = this.lods, m = /* @__PURE__ */ new Map(), h = [], g = Math.max(1, t.materials.length), _ = [
|
|
7758
7772
|
0,
|
|
7759
7773
|
0,
|
|
7760
7774
|
0,
|
|
7761
7775
|
0
|
|
7762
|
-
], v = 0, y = 0, b = e.viewportHeight, x = a.lodBias || 1, S = a.autoLod === !1 ? a.fixedLod || 0 : -1, C = n
|
|
7776
|
+
], v = 0, y = 0, b = e.viewportHeight, x = a.lodBias || 1, S = a.autoLod === !1 ? a.fixedLod || 0 : -1, C = So(n, b);
|
|
7763
7777
|
for (let e = 0; e < o; e++) {
|
|
7764
7778
|
f[e] = -1;
|
|
7765
|
-
let
|
|
7766
|
-
if (
|
|
7767
|
-
let
|
|
7779
|
+
let n = t.lodNode[e];
|
|
7780
|
+
if (n >= 0 && !(l.visible[n] && l.active[n] === t.lodChild[e])) continue;
|
|
7781
|
+
let r = d[e * 4], i = d[e * 4 + 1], a = d[e * 4 + 2], o = d[e * 4 + 3];
|
|
7768
7782
|
if (u) {
|
|
7769
7783
|
let e = !1;
|
|
7770
7784
|
for (let t = 0; t < 5; t++) {
|
|
7771
7785
|
let n = u[t];
|
|
7772
|
-
if (n[0] *
|
|
7786
|
+
if (n[0] * r + n[1] * i + n[2] * a + n[3] < -o) {
|
|
7773
7787
|
e = !0;
|
|
7774
7788
|
break;
|
|
7775
7789
|
}
|
|
@@ -7779,38 +7793,38 @@ var Eo = class {
|
|
|
7779
7793
|
continue;
|
|
7780
7794
|
}
|
|
7781
7795
|
}
|
|
7782
|
-
let
|
|
7783
|
-
if (
|
|
7784
|
-
if (S >= 0)
|
|
7796
|
+
let s = t.geom[e], b = t.geometries[s], w = 0;
|
|
7797
|
+
if (b.lods > 1) {
|
|
7798
|
+
if (S >= 0) w = Math.min(S, b.lods - 1);
|
|
7785
7799
|
else {
|
|
7786
|
-
let
|
|
7787
|
-
|
|
7800
|
+
let n = Co(C, r, i, a, xo(r - c[0], i - c[1], a - c[2]));
|
|
7801
|
+
w = Eo(b.lodDeviation, b.lods, To(t.matrices, e), n, x);
|
|
7788
7802
|
}
|
|
7789
7803
|
}
|
|
7790
|
-
p[e] =
|
|
7791
|
-
let
|
|
7792
|
-
if (
|
|
7793
|
-
|
|
7794
|
-
let e = t.materials[
|
|
7804
|
+
p[e] = w, _[w]++;
|
|
7805
|
+
let T = t.flags[e] & 1, E = t.mat[e], D = ((s * 4 + w) * g + E) * 2 + T, O = m.get(D);
|
|
7806
|
+
if (O === void 0) {
|
|
7807
|
+
O = h.length, m.set(D, O);
|
|
7808
|
+
let e = t.materials[E];
|
|
7795
7809
|
h.push({
|
|
7796
|
-
gi:
|
|
7797
|
-
entry:
|
|
7798
|
-
lod:
|
|
7799
|
-
mi:
|
|
7810
|
+
gi: s,
|
|
7811
|
+
entry: b,
|
|
7812
|
+
lod: w,
|
|
7813
|
+
mi: E,
|
|
7800
7814
|
material: e,
|
|
7801
|
-
mirrored: !!
|
|
7815
|
+
mirrored: !!T,
|
|
7802
7816
|
count: 0,
|
|
7803
7817
|
firstInstance: 0,
|
|
7804
7818
|
depth: 0,
|
|
7805
7819
|
instances: null
|
|
7806
7820
|
});
|
|
7807
7821
|
}
|
|
7808
|
-
h[
|
|
7822
|
+
h[O].count++, f[e] = O, v++;
|
|
7809
7823
|
}
|
|
7810
7824
|
let w = a.tessellationBudget, T = w >= 0 && w < Infinity, E = T ? performance.now() : 0, D = 0, O = 0, k = 0;
|
|
7811
7825
|
for (let e of h) {
|
|
7812
7826
|
let t = e.lod, n = e.entry.meshes;
|
|
7813
|
-
T && n && !n[t] && (D && performance.now() - E >= w ? (t =
|
|
7827
|
+
T && n && !n[t] && (D && performance.now() - E >= w ? (t = wo(n, t), O++) : D++);
|
|
7814
7828
|
let a = i(e.entry, t);
|
|
7815
7829
|
e.mesh = a, e.kind = a.kind, e.range = r.meshRange(a), e.doubleSided = !!(e.entry.doubleSided || e.material.doubleSided), e.transparent = e.material.transparent, e.kind === "triangles" && (k += e.range.indexCount / 3 * e.count);
|
|
7816
7830
|
}
|
|
@@ -7896,8 +7910,8 @@ var Eo = class {
|
|
|
7896
7910
|
};
|
|
7897
7911
|
return this.last = re, re;
|
|
7898
7912
|
}
|
|
7899
|
-
},
|
|
7900
|
-
function
|
|
7913
|
+
}, ko = 256;
|
|
7914
|
+
function Ao(e) {
|
|
7901
7915
|
return [
|
|
7902
7916
|
Math.round(e[0] * 255),
|
|
7903
7917
|
Math.round(e[1] * 255),
|
|
@@ -7905,20 +7919,20 @@ function Oo(e) {
|
|
|
7905
7919
|
Math.round((e[3] ?? 1) * 255)
|
|
7906
7920
|
];
|
|
7907
7921
|
}
|
|
7908
|
-
function
|
|
7922
|
+
function jo(e, t, n) {
|
|
7909
7923
|
let r = Math.max(0, Math.min(1, (n - e) / (t - e)));
|
|
7910
7924
|
return r * r * (3 - 2 * r);
|
|
7911
7925
|
}
|
|
7912
|
-
function
|
|
7926
|
+
function Mo(e, t, n, r) {
|
|
7913
7927
|
let i = e * n, a = t * n, o = Math.floor(i), s = Math.floor(a), c = i - o, l = a - s, u = c * c * (3 - 2 * c), d = l * l * (3 - 2 * l), f = (e, t) => Ta((e % n + n) % n, (t % n + n) % n, r), p = f(o, s), m = f(o + 1, s), h = f(o, s + 1), g = f(o + 1, s + 1);
|
|
7914
7928
|
return p + (m - p) * u + (h - p) * d + (p - m - h + g) * u * d;
|
|
7915
7929
|
}
|
|
7916
|
-
function
|
|
7930
|
+
function No(e, t, n, r) {
|
|
7917
7931
|
let i = 0, a = .5, o = Math.max(1, Math.round(n)), s = 0;
|
|
7918
|
-
for (let n = 0; n < 5; n++) i +=
|
|
7932
|
+
for (let n = 0; n < 5; n++) i += Mo(e, t, o, r + n * 17) * a, s += a, a *= .5, o *= 2;
|
|
7919
7933
|
return i / s;
|
|
7920
7934
|
}
|
|
7921
|
-
function
|
|
7935
|
+
function Po(e, t) {
|
|
7922
7936
|
let n = new Uint8ClampedArray(e * e * 4);
|
|
7923
7937
|
for (let r = 0; r < e; r++) for (let i = 0; i < e; i++) {
|
|
7924
7938
|
let a = t((i + .5) / e, (r + .5) / e), o = (r * e + i) * 4;
|
|
@@ -7930,7 +7944,7 @@ function Mo(e, t) {
|
|
|
7930
7944
|
data: n
|
|
7931
7945
|
};
|
|
7932
7946
|
}
|
|
7933
|
-
function
|
|
7947
|
+
function Fo(e, t, n) {
|
|
7934
7948
|
return [
|
|
7935
7949
|
e[0] + (t[0] - e[0]) * n,
|
|
7936
7950
|
e[1] + (t[1] - e[1]) * n,
|
|
@@ -7938,44 +7952,44 @@ function No(e, t, n) {
|
|
|
7938
7952
|
e[3] + (t[3] - e[3]) * n
|
|
7939
7953
|
];
|
|
7940
7954
|
}
|
|
7941
|
-
function
|
|
7955
|
+
function Io(e, t = ko) {
|
|
7942
7956
|
let n = e.params;
|
|
7943
7957
|
switch (e.fn) {
|
|
7944
7958
|
case "checker": {
|
|
7945
|
-
let e =
|
|
7946
|
-
return
|
|
7959
|
+
let e = Ao(n.color1), r = Ao(n.color2), i = Math.max(1, Math.round(n.count));
|
|
7960
|
+
return Po(t, (t, n) => (Math.floor(t * i) + Math.floor(n * i)) % 2 == 0 ? e : r);
|
|
7947
7961
|
}
|
|
7948
7962
|
case "stripes": {
|
|
7949
|
-
let e =
|
|
7950
|
-
return
|
|
7963
|
+
let e = Ao(n.color1), r = Ao(n.color2), i = Math.max(1, Math.round(n.count));
|
|
7964
|
+
return Po(t, (t) => Math.floor(t * i * 2) % 2 == 0 ? e : r);
|
|
7951
7965
|
}
|
|
7952
7966
|
case "grid": {
|
|
7953
|
-
let e =
|
|
7954
|
-
return
|
|
7967
|
+
let e = Ao(n.line), r = Ao(n.background), i = Math.max(1, Math.round(n.count)), a = n.width / 2;
|
|
7968
|
+
return Po(t, (t, n) => {
|
|
7955
7969
|
let o = t * i % 1, s = n * i % 1, c = Math.min(o, 1 - o, s, 1 - s);
|
|
7956
|
-
return
|
|
7970
|
+
return Fo(e, r, jo(a * .6, a, c));
|
|
7957
7971
|
});
|
|
7958
7972
|
}
|
|
7959
7973
|
case "noise": {
|
|
7960
|
-
let e =
|
|
7961
|
-
return
|
|
7974
|
+
let e = Ao(n.color1), r = Ao(n.color2);
|
|
7975
|
+
return Po(t, (t, i) => Fo(r, e, No(t, i, n.scale, n.seed)));
|
|
7962
7976
|
}
|
|
7963
7977
|
case "bricks": {
|
|
7964
|
-
let e =
|
|
7965
|
-
return
|
|
7978
|
+
let e = Ao(n.brick), r = Ao(n.mortar), i = Math.max(1, Math.round(n.count));
|
|
7979
|
+
return Po(t, (t, n) => {
|
|
7966
7980
|
let a = Math.floor(n * i), o = (t * i * .5 + a % 2 * .5) % 1, s = n * i % 1, c = Math.min(o, 1 - o, s, 1 - s), l = .88 + .24 * Ta(Math.floor(t * i * .5 + a % 2 * .5), a, 7), u = [
|
|
7967
7981
|
e[0] * l,
|
|
7968
7982
|
e[1] * l,
|
|
7969
7983
|
e[2] * l,
|
|
7970
7984
|
255
|
|
7971
7985
|
];
|
|
7972
|
-
return
|
|
7986
|
+
return Fo(r, u, jo(.03, .06, c));
|
|
7973
7987
|
});
|
|
7974
7988
|
}
|
|
7975
7989
|
default: throw Error(`unknown procedural texture ${e.fn}`);
|
|
7976
7990
|
}
|
|
7977
7991
|
}
|
|
7978
|
-
function
|
|
7992
|
+
function Lo(e) {
|
|
7979
7993
|
let t = e.params;
|
|
7980
7994
|
switch (e.fn) {
|
|
7981
7995
|
case "bumps": {
|
|
@@ -7989,10 +8003,10 @@ function Fo(e) {
|
|
|
7989
8003
|
let e = Math.max(1, Math.round(t.count));
|
|
7990
8004
|
return (n, r) => {
|
|
7991
8005
|
let i = n * e % 1, a = r * e % 1, o = Math.min(i, 1 - i, a, 1 - a);
|
|
7992
|
-
return
|
|
8006
|
+
return jo(t.gap * .5, t.gap * 1.5, o);
|
|
7993
8007
|
};
|
|
7994
8008
|
}
|
|
7995
|
-
case "noise": return (e, n) =>
|
|
8009
|
+
case "noise": return (e, n) => No(e, n, t.scale, t.seed);
|
|
7996
8010
|
case "waves": {
|
|
7997
8011
|
let e = Math.max(1, Math.round(t.count));
|
|
7998
8012
|
return (t) => .5 + .5 * Math.sin(t * e * Math.PI * 2);
|
|
@@ -8001,14 +8015,14 @@ function Fo(e) {
|
|
|
8001
8015
|
let e = Math.max(1, Math.round(t.count));
|
|
8002
8016
|
return (t, n) => {
|
|
8003
8017
|
let r = Math.floor(n * e), i = (t * e * .5 + r % 2 * .5) % 1, a = n * e % 1;
|
|
8004
|
-
return
|
|
8018
|
+
return jo(.02, .07, Math.min(i, 1 - i, a, 1 - a));
|
|
8005
8019
|
};
|
|
8006
8020
|
}
|
|
8007
8021
|
default: throw Error(`unknown procedural normal map ${e.fn}`);
|
|
8008
8022
|
}
|
|
8009
8023
|
}
|
|
8010
|
-
function
|
|
8011
|
-
let n =
|
|
8024
|
+
function Ro(e, t = ko) {
|
|
8025
|
+
let n = Lo(e), r = e.params.strength ?? 1, i = new Float32Array(t * t);
|
|
8012
8026
|
for (let e = 0; e < t; e++) for (let r = 0; r < t; r++) i[e * t + r] = n((r + .5) / t, (e + .5) / t);
|
|
8013
8027
|
let a = new Uint8ClampedArray(t * t * 4), o = r * t * .02;
|
|
8014
8028
|
for (let e = 0; e < t; e++) for (let n = 0; n < t; n++) {
|
|
@@ -8023,7 +8037,7 @@ function Io(e, t = Do) {
|
|
|
8023
8037
|
data: a
|
|
8024
8038
|
};
|
|
8025
8039
|
}
|
|
8026
|
-
function
|
|
8040
|
+
function zo(e) {
|
|
8027
8041
|
let t = [e], n = e;
|
|
8028
8042
|
for (; n.width > 1 || n.height > 1;) {
|
|
8029
8043
|
let e = Math.max(1, n.width >> 1), r = Math.max(1, n.height >> 1), i = new Uint8ClampedArray(e * r * 4);
|
|
@@ -8043,7 +8057,7 @@ function Lo(e) {
|
|
|
8043
8057
|
}
|
|
8044
8058
|
return t;
|
|
8045
8059
|
}
|
|
8046
|
-
async function
|
|
8060
|
+
async function Bo(e) {
|
|
8047
8061
|
let t = await fetch(e);
|
|
8048
8062
|
if (!t.ok) throw Error(`HTTP ${t.status} for ${e}`);
|
|
8049
8063
|
let n = await t.blob(), r = await createImageBitmap(n), i = (e) => Math.min(2048, 2 ** Math.round(Math.log2(Math.max(1, e)))), a = i(r.width), o = i(r.height), s = (typeof OffscreenCanvas < "u" ? new OffscreenCanvas(a, o) : Object.assign(document.createElement("canvas"), {
|
|
@@ -8056,11 +8070,11 @@ async function Ro(e) {
|
|
|
8056
8070
|
data: s.getImageData(0, 0, a, o).data
|
|
8057
8071
|
};
|
|
8058
8072
|
}
|
|
8059
|
-
function
|
|
8060
|
-
return e.kind === "procedural" ? Promise.resolve(t === "normal" ?
|
|
8073
|
+
function Vo(e, t) {
|
|
8074
|
+
return e.kind === "procedural" ? Promise.resolve(t === "normal" ? Ro(e) : Io(e)) : Bo(e.url);
|
|
8061
8075
|
}
|
|
8062
8076
|
// src/render/texture-cache.js
|
|
8063
|
-
var
|
|
8077
|
+
var Ho = class {
|
|
8064
8078
|
constructor() {
|
|
8065
8079
|
this.entries = /* @__PURE__ */ new Map(), this.onReady = null, this.onError = null;
|
|
8066
8080
|
}
|
|
@@ -8074,7 +8088,7 @@ var Bo = class {
|
|
|
8074
8088
|
pixels: null,
|
|
8075
8089
|
error: null,
|
|
8076
8090
|
gpu: null
|
|
8077
|
-
}, this.entries.set(n, r),
|
|
8091
|
+
}, this.entries.set(n, r), Vo(e, t).then((e) => {
|
|
8078
8092
|
r.pixels = e, r.status = "ready", this.onReady && this.onReady(r);
|
|
8079
8093
|
}, (e) => {
|
|
8080
8094
|
r.status = "failed", r.error = e, this.onError && this.onError(r, e);
|
|
@@ -8084,20 +8098,20 @@ var Bo = class {
|
|
|
8084
8098
|
for (let t of this.entries.values()) t.gpu && e && e(t.gpu);
|
|
8085
8099
|
this.entries.clear();
|
|
8086
8100
|
}
|
|
8087
|
-
},
|
|
8101
|
+
}, Uo = 1216, Wo = {
|
|
8088
8102
|
directional: 0,
|
|
8089
8103
|
point: 1,
|
|
8090
8104
|
spot: 2,
|
|
8091
8105
|
ambient: 3,
|
|
8092
8106
|
hemisphere: 4
|
|
8093
|
-
},
|
|
8107
|
+
}, Go = [{
|
|
8094
8108
|
type: "directional",
|
|
8095
8109
|
color: [
|
|
8096
8110
|
1.1,
|
|
8097
8111
|
1.08,
|
|
8098
8112
|
1.04
|
|
8099
8113
|
],
|
|
8100
|
-
direction:
|
|
8114
|
+
direction: Ko([
|
|
8101
8115
|
-.45,
|
|
8102
8116
|
-.85,
|
|
8103
8117
|
-.35
|
|
@@ -8122,7 +8136,7 @@ var Bo = class {
|
|
|
8122
8136
|
.25,
|
|
8123
8137
|
.32
|
|
8124
8138
|
],
|
|
8125
|
-
direction:
|
|
8139
|
+
direction: Ko([
|
|
8126
8140
|
.6,
|
|
8127
8141
|
-.2,
|
|
8128
8142
|
.75
|
|
@@ -8141,7 +8155,7 @@ var Bo = class {
|
|
|
8141
8155
|
0
|
|
8142
8156
|
]
|
|
8143
8157
|
}];
|
|
8144
|
-
function
|
|
8158
|
+
function Ko(e) {
|
|
8145
8159
|
let t = Math.hypot(e[0], e[1], e[2]) || 1;
|
|
8146
8160
|
return [
|
|
8147
8161
|
e[0] / t,
|
|
@@ -8149,15 +8163,15 @@ function Wo(e) {
|
|
|
8149
8163
|
e[2] / t
|
|
8150
8164
|
];
|
|
8151
8165
|
}
|
|
8152
|
-
function
|
|
8166
|
+
function qo(e, { viewProj: t, view: n, cameraPos: r, time: i, environment: a, lights: o, normalLength: s = .1, lineBias: c = .0015, viewportHeight: l = 1 }) {
|
|
8153
8167
|
e.fill(0), e.set(t, 0), e.set(n, 16), e[32] = r[0], e[33] = r[1], e[34] = r[2], e[35] = i || 0;
|
|
8154
8168
|
let u = Te(a.sky), d = Te(a.ground);
|
|
8155
8169
|
e[36] = u[0], e[37] = u[1], e[38] = u[2], e[39] = a.intensity, e[40] = d[0], e[41] = d[1], e[42] = d[2], e[43] = a.exposure;
|
|
8156
|
-
let f = o && o.length ? o :
|
|
8170
|
+
let f = o && o.length ? o : Go, p = Math.min(f.length, 16);
|
|
8157
8171
|
e[44] = p, e[45] = s, e[46] = c, e[47] = l;
|
|
8158
8172
|
for (let t = 0; t < p; t++) {
|
|
8159
8173
|
let n = f[t], r = 48 + t * 4, i = 112 + t * 4, a = 176 + t * 4, o = 240 + t * 4;
|
|
8160
|
-
e[r] = n.position[0], e[r + 1] = n.position[1], e[r + 2] = n.position[2], e[r + 3] =
|
|
8174
|
+
e[r] = n.position[0], e[r + 1] = n.position[1], e[r + 2] = n.position[2], e[r + 3] = Wo[n.type] ?? 0, e[i] = n.direction[0], e[i + 1] = n.direction[1], e[i + 2] = n.direction[2], e[i + 3] = n.range || 0, e[a] = n.color[0], e[a + 1] = n.color[1], e[a + 2] = n.color[2], e[a + 3] = n.outer || 0, e[o] = Math.max(n.inner || 0, (n.outer || 0) + 1e-4), e[o + 1] = n.ground ? n.ground[0] : 0, e[o + 2] = n.ground ? n.ground[1] : 0, e[o + 3] = n.ground ? n.ground[2] : 0;
|
|
8161
8175
|
}
|
|
8162
8176
|
return {
|
|
8163
8177
|
data: e,
|
|
@@ -8166,22 +8180,22 @@ function Go(e, { viewProj: t, view: n, cameraPos: r, time: i, environment: a, li
|
|
|
8166
8180
|
usedDefaults: !(o && o.length)
|
|
8167
8181
|
};
|
|
8168
8182
|
}
|
|
8169
|
-
function
|
|
8183
|
+
function Jo(e) {
|
|
8170
8184
|
let t = Math.round(e[44]), n = "";
|
|
8171
8185
|
for (let r = 0; r < t; r++) n += (r ? "," : "") + Math.round(e[48 + r * 4 + 3]);
|
|
8172
8186
|
return n;
|
|
8173
8187
|
}
|
|
8174
|
-
function
|
|
8188
|
+
function Yo(e, t, { hasMap: n = !1, hasNormalMap: r = !1, hasMrMap: i = !1, hasOcclusionMap: a = !1, hasEmissiveMap: o = !1, doubleSided: s = !1 } = {}) {
|
|
8175
8189
|
return e.fill(0), e[0] = t.baseColor[0], e[1] = t.baseColor[1], e[2] = t.baseColor[2], e[3] = t.alphaMode === "opaque" ? 1 : t.opacity, e[4] = t.emissive[0], e[5] = t.emissive[1], e[6] = t.emissive[2], e[7] = t.normalScale, e[8] = t.metallic, e[9] = t.roughness, e[10] = !!n | (r ? 2 : 0) | (s ? 4 : 0) | (t.unlit ? 8 : 0) | (i ? 32 : 0) | (a ? 64 : 0) | (o ? 128 : 0) | (t.alphaMode === "mask" ? 256 : 0), e[11] = t.alphaCutoff ?? .5, e[12] = t.uvScale[0], e[13] = t.uvScale[1], e[14] = t.occlusionStrength ?? 1, e;
|
|
8176
8190
|
}
|
|
8177
|
-
function
|
|
8191
|
+
function Xo(e, t) {
|
|
8178
8192
|
return e.fill(0), e[16] = t[0], e[17] = t[1], e[18] = t[2], e[19] = t[3], e[10] = 16, e[12] = 1, e[13] = 1, e;
|
|
8179
8193
|
}
|
|
8180
8194
|
// src/render/shaders/glsl.js
|
|
8181
|
-
var
|
|
8195
|
+
var Zo = "\nlayout(std140) uniform Frame {\n mat4 uViewProj;\n mat4 uView;\n vec4 uCameraPos;\n vec4 uSky;\n vec4 uGround;\n vec4 uParams;\n vec4 uLightPos[16];\n vec4 uLightDir[16];\n vec4 uLightColor[16];\n vec4 uLightExtra[16];\n};\n", Qo = "\nlayout(std140) uniform Material {\n vec4 mBaseColor;\n vec4 mEmissive;\n vec4 mParams;\n vec4 mUv;\n vec4 mOverlay;\n};\n", $o = "\nlayout(location = 0) in vec3 aPosition;\nlayout(location = 1) in vec3 aNormal;\nlayout(location = 2) in vec2 aUv;\nlayout(location = 3) in vec4 iM0;\nlayout(location = 4) in vec4 iM1;\nlayout(location = 5) in vec4 iM2;\nlayout(location = 6) in vec4 iM3;\n", es = "\nconst float PI = 3.14159265359;\nvec3 linearToSrgb(vec3 c) {\n c = max(c, vec3(0.0));\n return mix(c * 12.92, 1.055 * pow(c, vec3(1.0 / 2.4)) - 0.055, step(vec3(0.0031308), c));\n}\nvec3 aces(vec3 x) {\n return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), 0.0, 1.0);\n}\n", ts = (e) => `#version 300 es
|
|
8182
8196
|
precision highp float;
|
|
8183
|
-
${Yo}
|
|
8184
8197
|
${Zo}
|
|
8198
|
+
${$o}
|
|
8185
8199
|
out vec3 vWorld;
|
|
8186
8200
|
out vec3 vNormal;
|
|
8187
8201
|
${e ? "out vec2 vUv;" : ""}
|
|
@@ -8198,18 +8212,18 @@ void main() {
|
|
|
8198
8212
|
${e ? "vUv = aUv;" : ""}
|
|
8199
8213
|
gl_Position = uViewProj * wp;
|
|
8200
8214
|
}
|
|
8201
|
-
`,
|
|
8202
|
-
function
|
|
8215
|
+
`, ns = 227;
|
|
8216
|
+
function rs(e, t) {
|
|
8203
8217
|
let n = (t) => (e & t) !== 0, r = n(1), i = n(2), a = n(32), o = n(64), s = n(128), c = r || i || a || o || s, l = n(256), u = (e) => l ? `textureGrad(${e}, uv, duv1, duv2)` : `texture(${e}, uv)`, d = [];
|
|
8204
8218
|
return d.push(`#version 300 es
|
|
8205
8219
|
precision highp float;
|
|
8206
8220
|
precision highp int;
|
|
8207
|
-
${
|
|
8208
|
-
${
|
|
8221
|
+
${Zo}
|
|
8222
|
+
${Qo}`), r && d.push("uniform sampler2D uMap;"), i && d.push("uniform sampler2D uNormalMap;"), a && d.push("uniform sampler2D uMrMap;"), o && d.push("uniform sampler2D uOcclusionMap;"), s && d.push("uniform sampler2D uEmissiveMap;"), d.push(`in vec3 vWorld;
|
|
8209
8223
|
in vec3 vNormal;
|
|
8210
8224
|
${c ? "in vec2 vUv;" : ""}
|
|
8211
8225
|
out vec4 outColor;
|
|
8212
|
-
${
|
|
8226
|
+
${es}`), n(8) || d.push(is), d.push("void main() {"), c && d.push(" vec2 uv = vUv * mUv.xy;"), (c && l || i) && d.push(" vec2 duv1 = dFdx(uv);", " vec2 duv2 = dFdy(uv);"), d.push(" vec4 base = mBaseColor;"), r && d.push(` base *= ${u("uMap")};`), n(256) && d.push(" if (base.a < mParams.w) discard;"), d.push(" vec3 emitted = mEmissive.rgb;"), s && d.push(` emitted *= ${u("uEmissiveMap")}.rgb;`), n(8) ? (d.push(" outColor = vec4(linearToSrgb(base.rgb + emitted), base.a);", "}"), d.join("\n")) : (d.push(" vec3 N = normalize(vNormal);"), n(4) && d.push(" N = gl_FrontFacing ? N : -N;"), i && d.push(` vec3 dp1 = dFdx(vWorld);
|
|
8213
8227
|
vec3 dp2 = dFdy(vWorld);
|
|
8214
8228
|
vec3 dp2perp = cross(dp2, N);
|
|
8215
8229
|
vec3 dp1perp = cross(N, dp1);
|
|
@@ -8220,12 +8234,12 @@ ${Qo}`), n(8) || d.push(ns), d.push("void main() {"), c && d.push(" vec2 uv = v
|
|
|
8220
8234
|
n.xy *= mEmissive.w;
|
|
8221
8235
|
N = normalize(mat3(T * invmax, B * invmax, N) * n);`), d.push(" vec3 V = normalize(uCameraPos.xyz - vWorld);\n float NdotV = max(dot(N, V), 1e-4);\n float rough = clamp(mParams.y, 0.045, 1.0);\n float metal = clamp(mParams.x, 0.0, 1.0);"), a && d.push(` vec4 mr = ${u("uMrMap")};
|
|
8222
8236
|
rough = clamp(rough * mr.g, 0.045, 1.0);
|
|
8223
|
-
metal = clamp(metal * mr.b, 0.0, 1.0);`), d.push(" float a = rough * rough;\n vec3 f0 = mix(vec3(0.04), base.rgb, metal);\n vec3 diffuse = base.rgb * (1.0 - metal);\n vec3 color = vec3(0.0);\n vec3 ambient = vec3(0.0);"), t && t.split(",").forEach((e, t) => d.push(
|
|
8237
|
+
metal = clamp(metal * mr.b, 0.0, 1.0);`), d.push(" float a = rough * rough;\n vec3 f0 = mix(vec3(0.04), base.rgb, metal);\n vec3 diffuse = base.rgb * (1.0 - metal);\n vec3 color = vec3(0.0);\n vec3 ambient = vec3(0.0);"), t && t.split(",").forEach((e, t) => d.push(as(Number(e), t))), d.push(" float envI = uSky.w;\n vec3 hemi = mix(uGround.rgb, uSky.rgb, N.y * 0.5 + 0.5) * envI + ambient;\n vec3 R = reflect(-V, N);\n vec3 envSpec = mix(uGround.rgb, uSky.rgb, smoothstep(-0.25 - rough, 0.25 + rough, R.y)) * envI;\n envSpec = mix(envSpec, hemi, rough * rough);"), o && d.push(` float ao = mix(1.0, ${u("uOcclusionMap")}.r, mUv.z);
|
|
8224
8238
|
hemi *= ao;
|
|
8225
8239
|
envSpec *= ao;`), d.push(" color += diffuse * hemi + envSpec * envBRDF(f0, rough, NdotV);\n color += emitted;\n color *= uGround.w;\n outColor = vec4(linearToSrgb(aces(color)), base.a);\n}"), d.join("\n"));
|
|
8226
8240
|
}
|
|
8227
|
-
var
|
|
8228
|
-
function
|
|
8241
|
+
var is = "\nfloat D_GGX(float NdotH, float a) {\n float a2 = a * a;\n float d = NdotH * NdotH * (a2 - 1.0) + 1.0;\n return a2 / (PI * d * d);\n}\nfloat V_Smith(float NdotV, float NdotL, float a) {\n float a2 = a * a;\n float gv = NdotL * sqrt(NdotV * NdotV * (1.0 - a2) + a2);\n float gl = NdotV * sqrt(NdotL * NdotL * (1.0 - a2) + a2);\n return 0.5 / max(gv + gl, 1e-5);\n}\nvec3 F_Schlick(vec3 f0, float VdotH) {\n return f0 + (vec3(1.0) - f0) * pow(1.0 - VdotH, 5.0);\n}\nvec3 envBRDF(vec3 f0, float roughness, float NdotV) {\n const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;\n vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n return f0 * AB.x + AB.y;\n}\n// one light's contribution, zero when it is behind the surface\nvec3 shade(vec3 N, vec3 V, vec3 L, vec3 radiance, float NdotV, vec3 f0, vec3 diffuse, float a) {\n float NdotL = dot(N, L);\n if (NdotL <= 0.0) return vec3(0.0);\n vec3 H = normalize(V + L);\n float NdotH = max(dot(N, H), 0.0);\n float VdotH = max(dot(V, H), 0.0);\n vec3 F = F_Schlick(f0, VdotH);\n vec3 spec = D_GGX(NdotH, a) * V_Smith(NdotV, NdotL, a) * F;\n vec3 kd = (vec3(1.0) - F) * diffuse / PI;\n return (kd + spec) * radiance * NdotL;\n}\n";
|
|
8242
|
+
function as(e, t) {
|
|
8229
8243
|
return e === 3 ? ` ambient += uLightColor[${t}].rgb;` : e === 4 ? ` ambient += mix(uLightExtra[${t}].yzw, uLightColor[${t}].rgb, N.y * 0.5 + 0.5);` : e === 0 ? ` color += shade(N, V, -uLightDir[${t}].xyz, uLightColor[${t}].rgb * PI, NdotV, f0, diffuse, a);` : ` {
|
|
8230
8244
|
vec3 Lv = uLightPos[${t}].xyz - vWorld;
|
|
8231
8245
|
float d = length(Lv);
|
|
@@ -8240,10 +8254,10 @@ function rs(e, t) {
|
|
|
8240
8254
|
color += shade(N, V, L, uLightColor[${t}].rgb * PI * att, NdotV, f0, diffuse, a);
|
|
8241
8255
|
}`;
|
|
8242
8256
|
}
|
|
8243
|
-
var
|
|
8257
|
+
var os = `#version 300 es
|
|
8244
8258
|
precision highp float;
|
|
8245
|
-
${Yo}
|
|
8246
8259
|
${Zo}
|
|
8260
|
+
${$o}
|
|
8247
8261
|
void main() {
|
|
8248
8262
|
mat4 M = mat4(iM0, iM1, iM2, iM3);
|
|
8249
8263
|
vec4 wp = M * vec4(aPosition, 1.0);
|
|
@@ -8252,10 +8266,10 @@ void main() {
|
|
|
8252
8266
|
wp.xyz = mix(wp.xyz, uCameraPos.xyz, uParams.z);
|
|
8253
8267
|
gl_Position = uViewProj * wp;
|
|
8254
8268
|
}
|
|
8255
|
-
`,
|
|
8269
|
+
`, ss = `#version 300 es
|
|
8256
8270
|
precision highp float;
|
|
8257
|
-
${Yo}
|
|
8258
8271
|
${Zo}
|
|
8272
|
+
${$o}
|
|
8259
8273
|
void main() {
|
|
8260
8274
|
mat4 M = mat4(iM0, iM1, iM2, iM3);
|
|
8261
8275
|
vec4 wp = M * vec4(aPosition, 1.0);
|
|
@@ -8269,13 +8283,13 @@ void main() {
|
|
|
8269
8283
|
wp.xyz = mix(wp.xyz, uCameraPos.xyz, uParams.z);
|
|
8270
8284
|
gl_Position = uViewProj * wp;
|
|
8271
8285
|
}
|
|
8272
|
-
`,
|
|
8286
|
+
`, cs = `#version 300 es
|
|
8273
8287
|
precision highp float;
|
|
8274
8288
|
precision highp int;
|
|
8275
|
-
${
|
|
8276
|
-
${Xo}
|
|
8277
|
-
out vec4 outColor;
|
|
8289
|
+
${Zo}
|
|
8278
8290
|
${Qo}
|
|
8291
|
+
out vec4 outColor;
|
|
8292
|
+
${es}
|
|
8279
8293
|
void main() {
|
|
8280
8294
|
int flags = int(mParams.z + 0.5);
|
|
8281
8295
|
if ((flags & 16) != 0) {
|
|
@@ -8284,8 +8298,8 @@ void main() {
|
|
|
8284
8298
|
}
|
|
8285
8299
|
outColor = vec4(linearToSrgb(mBaseColor.rgb + mEmissive.rgb), mBaseColor.a);
|
|
8286
8300
|
}
|
|
8287
|
-
`,
|
|
8288
|
-
function
|
|
8301
|
+
`, ls = 8;
|
|
8302
|
+
function us(e, t, n, r) {
|
|
8289
8303
|
let i = e.createShader(t);
|
|
8290
8304
|
if (e.shaderSource(i, n), e.compileShader(i), !e.getShaderParameter(i, e.COMPILE_STATUS)) {
|
|
8291
8305
|
let t = e.getShaderInfoLog(i);
|
|
@@ -8293,9 +8307,9 @@ function cs(e, t, n, r) {
|
|
|
8293
8307
|
}
|
|
8294
8308
|
return i;
|
|
8295
8309
|
}
|
|
8296
|
-
function
|
|
8310
|
+
function ds(e, t, n, r) {
|
|
8297
8311
|
let i = e.createProgram();
|
|
8298
|
-
if (e.attachShader(i,
|
|
8312
|
+
if (e.attachShader(i, us(e, e.VERTEX_SHADER, t, r + " vertex")), e.attachShader(i, us(e, e.FRAGMENT_SHADER, n, r + " fragment")), e.linkProgram(i), !e.getProgramParameter(i, e.LINK_STATUS)) throw Error(`WebGL2 ${r} link error: ${e.getProgramInfoLog(i)}`);
|
|
8299
8313
|
let a = e.getUniformBlockIndex(i, "Frame");
|
|
8300
8314
|
a !== e.INVALID_INDEX && e.uniformBlockBinding(i, a, 0);
|
|
8301
8315
|
let o = e.getUniformBlockIndex(i, "Material");
|
|
@@ -8306,7 +8320,7 @@ function ls(e, t, n, r) {
|
|
|
8306
8320
|
};
|
|
8307
8321
|
return s("uMap", 0), s("uNormalMap", 1), s("uMrMap", 2), s("uOcclusionMap", 3), s("uEmissiveMap", 4), i;
|
|
8308
8322
|
}
|
|
8309
|
-
var
|
|
8323
|
+
var fs = class {
|
|
8310
8324
|
constructor(e) {
|
|
8311
8325
|
this.canvas = e, this.kind = "webgl2", this.zeroToOne = !1, this.gl = null, this.vertexCapacity = 0, this.indexCapacity = 0, this.instanceCapacity = 0, this.poolGeneration = -1, this.materialUbos = /* @__PURE__ */ new Map(), this.overlayUbos = /* @__PURE__ */ new Map(), this.gpuBytes = 0, this.lost = !1, this.resourceEpoch = 0, this.info = "";
|
|
8312
8326
|
}
|
|
@@ -8350,7 +8364,7 @@ var us = class {
|
|
|
8350
8364
|
let t = e.getParameter(e.SAMPLES) || 0;
|
|
8351
8365
|
this.direct = t >= 4, this.samples = this.direct ? t : Math.min(4, e.getParameter(e.MAX_SAMPLES) || 0), this.direct ? this.fbo = this.colorRb = this.depthRb = this.resolveFbo = this.resolveRb = null : (this.fbo = e.createFramebuffer(), this.colorRb = e.createRenderbuffer(), this.depthRb = e.createRenderbuffer(), this.resolveFbo = e.createFramebuffer(), this.resolveRb = e.createRenderbuffer()), this.targetSize = [0, 0];
|
|
8352
8366
|
let n = e.getExtension("WEBGL_debug_renderer_info");
|
|
8353
|
-
this.info = n ? e.getParameter(n.UNMASKED_RENDERER_WEBGL) : e.getParameter(e.RENDERER), this.aniso = e.getExtension("EXT_texture_filter_anisotropic"), this.poolGeneration = -1, this.vertexCapacity = 0, this.indexCapacity = 0, this.instanceCapacity = 0, this.materialUbos = /* @__PURE__ */ new Map(), this.overlayUbos = /* @__PURE__ */ new Map(), this.meshPrograms = /* @__PURE__ */ new Map(), this.gpuBytes = 0, this.lineProgram =
|
|
8367
|
+
this.info = n ? e.getParameter(n.UNMASKED_RENDERER_WEBGL) : e.getParameter(e.RENDERER), this.aniso = e.getExtension("EXT_texture_filter_anisotropic"), this.poolGeneration = -1, this.vertexCapacity = 0, this.indexCapacity = 0, this.instanceCapacity = 0, this.materialUbos = /* @__PURE__ */ new Map(), this.overlayUbos = /* @__PURE__ */ new Map(), this.meshPrograms = /* @__PURE__ */ new Map(), this.gpuBytes = 0, this.lineProgram = ds(e, os, cs, "line"), this.normalProgram = ds(e, ss, cs, "normals"), this.vertexBuffer = e.createBuffer(), this.indexBuffer = e.createBuffer(), this.instanceBuffer = e.createBuffer(), this.frameUbo = e.createBuffer(), e.bindBuffer(e.UNIFORM_BUFFER, this.frameUbo), e.bufferData(e.UNIFORM_BUFFER, Uo, e.DYNAMIC_DRAW), this.vao = e.createVertexArray(), e.bindVertexArray(this.vao), e.bindBuffer(e.ARRAY_BUFFER, this.vertexBuffer), e.enableVertexAttribArray(0), e.vertexAttribPointer(0, 3, e.FLOAT, !1, 32, 0), e.enableVertexAttribArray(1), e.vertexAttribPointer(1, 3, e.FLOAT, !1, 32, 12), e.enableVertexAttribArray(2), e.vertexAttribPointer(2, 2, e.FLOAT, !1, 32, 24), e.bindBuffer(e.ARRAY_BUFFER, this.instanceBuffer);
|
|
8354
8368
|
for (let t = 0; t < 4; t++) e.enableVertexAttribArray(3 + t), e.vertexAttribPointer(3 + t, 4, e.FLOAT, !1, 64, t * 16), e.vertexAttribDivisor(3 + t, 1);
|
|
8355
8369
|
e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this.indexBuffer), e.bindVertexArray(null), this.whiteTex = this.createTexture({
|
|
8356
8370
|
width: 1,
|
|
@@ -8374,7 +8388,7 @@ var us = class {
|
|
|
8374
8388
|
}
|
|
8375
8389
|
createTexture(e, t) {
|
|
8376
8390
|
let n = this.gl, r = n.createTexture();
|
|
8377
|
-
return n.bindTexture(n.TEXTURE_2D, r), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !1), n.texImage2D(n.TEXTURE_2D, 0, t ? n.SRGB8_ALPHA8 : n.RGBA8, e.width, e.height, 0, n.RGBA, n.UNSIGNED_BYTE, e.data instanceof Uint8Array ? e.data : new Uint8Array(e.data.buffer, e.data.byteOffset, e.data.byteLength)), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.REPEAT), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.REPEAT), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), e.width > 1 ? (n.generateMipmap(n.TEXTURE_2D), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR_MIPMAP_LINEAR), this.aniso && n.texParameterf(n.TEXTURE_2D, this.aniso.TEXTURE_MAX_ANISOTROPY_EXT,
|
|
8391
|
+
return n.bindTexture(n.TEXTURE_2D, r), n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL, !1), n.texImage2D(n.TEXTURE_2D, 0, t ? n.SRGB8_ALPHA8 : n.RGBA8, e.width, e.height, 0, n.RGBA, n.UNSIGNED_BYTE, e.data instanceof Uint8Array ? e.data : new Uint8Array(e.data.buffer, e.data.byteOffset, e.data.byteLength)), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.REPEAT), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.REPEAT), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), e.width > 1 ? (n.generateMipmap(n.TEXTURE_2D), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR_MIPMAP_LINEAR), this.aniso && n.texParameterf(n.TEXTURE_2D, this.aniso.TEXTURE_MAX_ANISOTROPY_EXT, ls)) : n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), this.gpuBytes += e.width * e.height * 4 * (e.width > 1 ? 1.33 : 1), r;
|
|
8378
8392
|
}
|
|
8379
8393
|
destroyTexture(e) {
|
|
8380
8394
|
this.gl.deleteTexture(e);
|
|
@@ -8409,7 +8423,7 @@ var us = class {
|
|
|
8409
8423
|
key: ""
|
|
8410
8424
|
}, this.materialUbos.set(e, r));
|
|
8411
8425
|
let i = this.readyTexture(e.map ? t.get(e.map, "color") : null, !0), a = this.readyTexture(e.normalMap ? t.get(e.normalMap, "normal") : null, !1), o = this.readyTexture(e.metallicRoughnessMap ? t.get(e.metallicRoughnessMap, "linear") : null, !1), s = this.readyTexture(e.occlusionMap ? t.get(e.occlusionMap, "linear") : null, !1), c = this.readyTexture(e.emissiveMap ? t.get(e.emissiveMap, "color") : null, !0), l = !!i, u = !!a, d = !!o, f = !!s, p = !!c, m = `${l}|${u}|${d}|${f}|${p}`;
|
|
8412
|
-
return r.key !== m && (
|
|
8426
|
+
return r.key !== m && (Yo(this.matData, e, {
|
|
8413
8427
|
hasMap: l,
|
|
8414
8428
|
hasNormalMap: u,
|
|
8415
8429
|
hasMrMap: d,
|
|
@@ -8423,7 +8437,7 @@ var us = class {
|
|
|
8423
8437
|
if (!r || n.dsKey !== i) {
|
|
8424
8438
|
r ||= n.doubleSidedUbo = this.gl.createBuffer();
|
|
8425
8439
|
let t = n.map !== this.whiteTex, a = n.normalMap !== this.flatNormalTex, o = n.mrMap !== this.whiteTex, s = n.occlusionMap !== this.whiteTex, c = n.emissiveMap !== this.whiteTex;
|
|
8426
|
-
|
|
8440
|
+
Yo(this.matData, e, {
|
|
8427
8441
|
hasMap: t,
|
|
8428
8442
|
hasNormalMap: a,
|
|
8429
8443
|
hasMrMap: o,
|
|
@@ -8437,7 +8451,7 @@ var us = class {
|
|
|
8437
8451
|
}
|
|
8438
8452
|
overlayUbo(e, t) {
|
|
8439
8453
|
let n = this.overlayUbos.get(e);
|
|
8440
|
-
return n || (n = this.gl.createBuffer(), this.overlayUbos.set(e, n),
|
|
8454
|
+
return n || (n = this.gl.createBuffer(), this.overlayUbos.set(e, n), Xo(this.matData, t), this.gl.bindBuffer(this.gl.UNIFORM_BUFFER, n), this.gl.bufferData(this.gl.UNIFORM_BUFFER, this.matData, this.gl.STATIC_DRAW)), n;
|
|
8441
8455
|
}
|
|
8442
8456
|
releaseMaterials(e) {
|
|
8443
8457
|
for (let [t, n] of this.materialUbos) e.has(t) || (this.gl.deleteBuffer(n.ubo), n.doubleSidedUbo && this.gl.deleteBuffer(n.doubleSidedUbo), this.materialUbos.delete(t));
|
|
@@ -8455,14 +8469,14 @@ var us = class {
|
|
|
8455
8469
|
let e = this.gl;
|
|
8456
8470
|
return {
|
|
8457
8471
|
msaaSamples: this.samples,
|
|
8458
|
-
anisotropy: this.aniso ? Math.min(
|
|
8472
|
+
anisotropy: this.aniso ? Math.min(ls, e.getParameter(this.aniso.MAX_TEXTURE_MAX_ANISOTROPY_EXT)) : 1,
|
|
8459
8473
|
maxTextureSize: e.getParameter(e.MAX_TEXTURE_SIZE),
|
|
8460
8474
|
colorSpace: e.drawingBufferColorSpace || "srgb"
|
|
8461
8475
|
};
|
|
8462
8476
|
}
|
|
8463
8477
|
meshProgram(e, t) {
|
|
8464
8478
|
let n = `${e}|${t}`, r = this.meshPrograms.get(n);
|
|
8465
|
-
return r || (r =
|
|
8479
|
+
return r || (r = ds(this.gl, ts((e & ns) !== 0), rs(e, t), "mesh"), this.meshPrograms.set(n, r)), r;
|
|
8466
8480
|
}
|
|
8467
8481
|
ensureTarget() {
|
|
8468
8482
|
if (this.direct) return;
|
|
@@ -8481,7 +8495,7 @@ var us = class {
|
|
|
8481
8495
|
if (this.lost) return;
|
|
8482
8496
|
let i = this.canvas.width, a = this.canvas.height;
|
|
8483
8497
|
this.ensureTarget(), r.bindFramebuffer(r.FRAMEBUFFER, this.direct ? null : this.fbo), r.viewport(0, 0, i, a), r.clearColor(n.background[0], n.background[1], n.background[2], 1), r.clearDepth(1), r.depthMask(!0), r.clear(r.COLOR_BUFFER_BIT | r.DEPTH_BUFFER_BIT), r.enable(r.DEPTH_TEST), r.depthFunc(r.LEQUAL), r.disable(r.BLEND), r.bindBuffer(r.UNIFORM_BUFFER, this.frameUbo), r.bufferSubData(r.UNIFORM_BUFFER, 0, t), r.bindBufferBase(r.UNIFORM_BUFFER, 0, this.frameUbo), this.uploadInstances(e.instanceData, e.instanceCount), r.bindVertexArray(this.vao);
|
|
8484
|
-
let o =
|
|
8498
|
+
let o = Jo(t), s = null, c = (e) => {
|
|
8485
8499
|
s !== e && (r.useProgram(e), s = e);
|
|
8486
8500
|
}, l = !1, u = -1, d = null;
|
|
8487
8501
|
r.cullFace(r.BACK);
|
|
@@ -8522,7 +8536,7 @@ var us = class {
|
|
|
8522
8536
|
this.lineProgram && e.deleteProgram(this.lineProgram), this.normalProgram && e.deleteProgram(this.normalProgram), this.whiteTex && e.deleteTexture(this.whiteTex), this.flatNormalTex && e.deleteTexture(this.flatNormalTex), e.deleteVertexArray(this.vao), this.direct || (e.deleteFramebuffer(this.fbo), e.deleteRenderbuffer(this.colorRb), e.deleteRenderbuffer(this.depthRb), e.deleteFramebuffer(this.resolveFbo), e.deleteRenderbuffer(this.resolveRb));
|
|
8523
8537
|
}
|
|
8524
8538
|
}
|
|
8525
|
-
},
|
|
8539
|
+
}, ps = "\nstruct Frame {\n viewProj: mat4x4f,\n view: mat4x4f,\n cameraPos: vec4f,\n sky: vec4f,\n ground: vec4f,\n params: vec4f,\n lightPos: array<vec4f, 16>,\n lightDir: array<vec4f, 16>,\n lightColor: array<vec4f, 16>,\n lightExtra: array<vec4f, 16>,\n};\nstruct Material {\n baseColor: vec4f,\n emissive: vec4f,\n params: vec4f,\n uvScale: vec4f,\n overlay: vec4f,\n};\n@group(0) @binding(0) var<uniform> frame: Frame;\n@group(1) @binding(0) var<uniform> material: Material;\n@group(1) @binding(1) var samp: sampler;\n@group(1) @binding(2) var baseTex: texture_2d<f32>;\n@group(1) @binding(3) var normalTex: texture_2d<f32>;\n@group(1) @binding(4) var mrTex: texture_2d<f32>;\n@group(1) @binding(5) var occlusionTex: texture_2d<f32>;\n@group(1) @binding(6) var emissiveTex: texture_2d<f32>;\n\nstruct VSIn {\n @location(0) position: vec3f,\n @location(1) normal: vec3f,\n @location(2) uv: vec2f,\n @location(3) m0: vec4f,\n @location(4) m1: vec4f,\n @location(5) m2: vec4f,\n @location(6) m3: vec4f,\n};\n\nconst PI = 3.14159265359;\n\nfn linearToSrgb(c0: vec3f) -> vec3f {\n let c = max(c0, vec3f(0.0));\n return select(1.055 * pow(c, vec3f(1.0 / 2.4)) - 0.055, c * 12.92, c <= vec3f(0.0031308));\n}\nfn aces(x: vec3f) -> vec3f {\n return clamp((x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14), vec3f(0.0), vec3f(1.0));\n}\nfn worldNormal(inp: VSIn) -> vec3f {\n let c0 = inp.m0.xyz;\n let c1 = inp.m1.xyz;\n let c2 = inp.m2.xyz;\n let cof = mat3x3f(cross(c1, c2), cross(c2, c0), cross(c0, c1));\n let det = dot(c0, cross(c1, c2));\n return cof * inp.normal * select(1.0, -1.0, det < 0.0);\n}\n", ms = (e) => `
|
|
8526
8540
|
struct VSOut {
|
|
8527
8541
|
@builtin(position) pos: vec4f,
|
|
8528
8542
|
@location(0) world: vec3f,
|
|
@@ -8541,10 +8555,10 @@ fn vs_main(inp: VSIn) -> VSOut {
|
|
|
8541
8555
|
${e ? "out.uv = inp.uv;" : ""}
|
|
8542
8556
|
return out;
|
|
8543
8557
|
}
|
|
8544
|
-
`,
|
|
8545
|
-
function
|
|
8546
|
-
let n = (t) => (e & t) !== 0, r = n(1), i = n(2), a = n(32), o = n(64), s = n(128), c = r || i || a || o || s, l = n(256), u = (e) => l ? `textureSampleGrad(${e}, samp, uv, ddx, ddy)` : `textureSample(${e}, samp, uv)`, d = [
|
|
8547
|
-
return n(8) || d.push(
|
|
8558
|
+
`, hs = "\nfn D_GGX(NdotH: f32, a: f32) -> f32 {\n let a2 = a * a;\n let d = NdotH * NdotH * (a2 - 1.0) + 1.0;\n return a2 / (PI * d * d);\n}\nfn V_Smith(NdotV: f32, NdotL: f32, a: f32) -> f32 {\n let a2 = a * a;\n let gv = NdotL * sqrt(NdotV * NdotV * (1.0 - a2) + a2);\n let gl = NdotV * sqrt(NdotL * NdotL * (1.0 - a2) + a2);\n return 0.5 / max(gv + gl, 1e-5);\n}\nfn F_Schlick(f0: vec3f, VdotH: f32) -> vec3f {\n return f0 + (vec3f(1.0) - f0) * pow(1.0 - VdotH, 5.0);\n}\nfn envBRDF(f0: vec3f, roughness: f32, NdotV: f32) -> vec3f {\n let c0 = vec4f(-1.0, -0.0275, -0.572, 0.022);\n let c1 = vec4f(1.0, 0.0425, 1.04, -0.04);\n let r = roughness * c0 + c1;\n let a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;\n let AB = vec2f(-1.04, 1.04) * a004 + r.zw;\n return f0 * AB.x + AB.y;\n}\n// one light's contribution, zero when it is behind the surface\nfn shade(N: vec3f, V: vec3f, L: vec3f, radiance: vec3f, NdotV: f32, f0: vec3f, diffuse: vec3f, a: f32) -> vec3f {\n let NdotL = dot(N, L);\n if (NdotL <= 0.0) {\n return vec3f(0.0);\n }\n let H = normalize(V + L);\n let NdotH = max(dot(N, H), 0.0);\n let VdotH = max(dot(V, H), 0.0);\n let F = F_Schlick(f0, VdotH);\n let spec = D_GGX(NdotH, a) * V_Smith(NdotV, NdotL, a) * F;\n let kd = (vec3f(1.0) - F) * diffuse / PI;\n return (kd + spec) * radiance * NdotL;\n}\n";
|
|
8559
|
+
function gs(e, t) {
|
|
8560
|
+
let n = (t) => (e & t) !== 0, r = n(1), i = n(2), a = n(32), o = n(64), s = n(128), c = r || i || a || o || s, l = n(256), u = (e) => l ? `textureSampleGrad(${e}, samp, uv, ddx, ddy)` : `textureSample(${e}, samp, uv)`, d = [ps, ms(c)];
|
|
8561
|
+
return n(8) || d.push(hs), d.push("@fragment", "fn fs_main(inp: VSOut, @builtin(front_facing) frontFacing: bool) -> @location(0) vec4f {"), c && d.push(" let uv = inp.uv * material.uvScale.xy;"), (c && l || i) && d.push(" let ddx = dpdx(uv);", " let ddy = dpdy(uv);"), i && d.push(" let dp1 = dpdx(inp.world);", " let dp2 = -dpdy(inp.world);", " let duv1 = ddx;", " let duv2 = -ddy;"), d.push(" var base = material.baseColor;"), r && d.push(` base = base * ${u("baseTex")};`), l && d.push(" if (base.a < material.params.w) {", " discard;", " }"), d.push(" var emitted = material.emissive.rgb;"), s && d.push(` emitted = emitted * ${u("emissiveTex")}.rgb;`), n(8) ? (d.push(" return vec4f(linearToSrgb(base.rgb + emitted), base.a);", "}"), d.join("\n")) : (d.push(" var N = normalize(inp.normal);"), n(4) && d.push(" N = select(-N, N, frontFacing);"), i && d.push(` let dp2perp = cross(dp2, N);
|
|
8548
8562
|
let dp1perp = cross(N, dp1);
|
|
8549
8563
|
let T = dp2perp * duv1.x + dp1perp * duv2.x;
|
|
8550
8564
|
let B = dp2perp * duv1.y + dp1perp * duv2.y;
|
|
@@ -8553,11 +8567,11 @@ function ms(e, t) {
|
|
|
8553
8567
|
let n = vec3f(n0.xy * material.emissive.w, n0.z);
|
|
8554
8568
|
N = normalize(mat3x3f(T * invmax, B * invmax, N) * n);`), d.push(" let V = normalize(frame.cameraPos.xyz - inp.world);\n let NdotV = max(dot(N, V), 1e-4);\n var rough = clamp(material.params.y, 0.045, 1.0);\n var metal = clamp(material.params.x, 0.0, 1.0);"), a && d.push(` let mr = ${u("mrTex")};
|
|
8555
8569
|
rough = clamp(rough * mr.g, 0.045, 1.0);
|
|
8556
|
-
metal = clamp(metal * mr.b, 0.0, 1.0);`), d.push(" let a = rough * rough;\n let f0 = mix(vec3f(0.04), base.rgb, metal);\n let diffuse = base.rgb * (1.0 - metal);\n var color = vec3f(0.0);\n var ambient = vec3f(0.0);"), t && t.split(",").forEach((e, t) => d.push(
|
|
8570
|
+
metal = clamp(metal * mr.b, 0.0, 1.0);`), d.push(" let a = rough * rough;\n let f0 = mix(vec3f(0.04), base.rgb, metal);\n let diffuse = base.rgb * (1.0 - metal);\n var color = vec3f(0.0);\n var ambient = vec3f(0.0);"), t && t.split(",").forEach((e, t) => d.push(_s(Number(e), t))), d.push(" let envI = frame.sky.w;\n var hemi = mix(frame.ground.rgb, frame.sky.rgb, N.y * 0.5 + 0.5) * envI + ambient;\n let R = reflect(-V, N);\n var envSpec = mix(frame.ground.rgb, frame.sky.rgb, smoothstep(-0.25 - rough, 0.25 + rough, R.y)) * envI;\n envSpec = mix(envSpec, hemi, rough * rough);"), o && d.push(` let ao = mix(1.0, ${u("occlusionTex")}.r, material.uvScale.z);
|
|
8557
8571
|
hemi = hemi * ao;
|
|
8558
8572
|
envSpec = envSpec * ao;`), d.push(" color = color + diffuse * hemi + envSpec * envBRDF(f0, rough, NdotV);\n color = color + emitted;\n color = color * frame.ground.w;\n return vec4f(linearToSrgb(aces(color)), base.a);\n}"), d.join("\n"));
|
|
8559
8573
|
}
|
|
8560
|
-
function
|
|
8574
|
+
function _s(e, t) {
|
|
8561
8575
|
return e === 3 ? ` ambient = ambient + frame.lightColor[${t}].rgb;` : e === 4 ? ` ambient = ambient + mix(frame.lightExtra[${t}].yzw, frame.lightColor[${t}].rgb, N.y * 0.5 + 0.5);` : e === 0 ? ` color = color + shade(N, V, -frame.lightDir[${t}].xyz, frame.lightColor[${t}].rgb * PI, NdotV, f0, diffuse, a);` : ` {
|
|
8562
8576
|
let Lv = frame.lightPos[${t}].xyz - inp.world;
|
|
8563
8577
|
let d = length(Lv);
|
|
@@ -8572,8 +8586,8 @@ function hs(e, t) {
|
|
|
8572
8586
|
color = color + shade(N, V, L, frame.lightColor[${t}].rgb * PI * att, NdotV, f0, diffuse, a);
|
|
8573
8587
|
}`;
|
|
8574
8588
|
}
|
|
8575
|
-
var
|
|
8576
|
-
${
|
|
8589
|
+
var vs = `
|
|
8590
|
+
${ps}
|
|
8577
8591
|
@vertex
|
|
8578
8592
|
fn vs_line(inp: VSIn) -> @builtin(position) vec4f {
|
|
8579
8593
|
let M = mat4x4f(inp.m0, inp.m1, inp.m2, inp.m3);
|
|
@@ -8598,7 +8612,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8598
8612
|
}
|
|
8599
8613
|
return vec4f(linearToSrgb(material.baseColor.rgb + material.emissive.rgb), material.baseColor.a);
|
|
8600
8614
|
}
|
|
8601
|
-
`,
|
|
8615
|
+
`, ys = 4, bs = [{
|
|
8602
8616
|
arrayStride: 32,
|
|
8603
8617
|
stepMode: "vertex",
|
|
8604
8618
|
attributes: [
|
|
@@ -8643,11 +8657,11 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8643
8657
|
format: "float32x4"
|
|
8644
8658
|
}
|
|
8645
8659
|
]
|
|
8646
|
-
}],
|
|
8660
|
+
}], xs = (e, t) => {
|
|
8647
8661
|
let n = t;
|
|
8648
8662
|
for (; n < e;) n *= 2;
|
|
8649
8663
|
return n;
|
|
8650
|
-
},
|
|
8664
|
+
}, Ss = class {
|
|
8651
8665
|
constructor(e, t = {}) {
|
|
8652
8666
|
this.canvas = e, this.present = t.present || "canvas", this.kind = "webgpu", this.zeroToOne = !0, this.pipelines = /* @__PURE__ */ new Map(), this.meshModules = /* @__PURE__ */ new Map(), this.materialBindings = /* @__PURE__ */ new Map(), this.overlayBindings = /* @__PURE__ */ new Map(), this.poolGeneration = -1, this.vertexBuffer = null, this.indexBuffer = null, this.instanceBuffer = null, this.gpuBytes = 0, this.lost = !1, this.info = "", this.errors = [];
|
|
8653
8667
|
}
|
|
@@ -8722,7 +8736,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8722
8736
|
texture: { sampleType: "float" }
|
|
8723
8737
|
}
|
|
8724
8738
|
] }), this.pipelineLayout = n.createPipelineLayout({ bindGroupLayouts: [this.frameLayout, this.materialLayout] }), n.pushErrorScope("validation"), this.lineModule = n.createShaderModule({
|
|
8725
|
-
code:
|
|
8739
|
+
code: vs,
|
|
8726
8740
|
label: "es3d lines"
|
|
8727
8741
|
});
|
|
8728
8742
|
for (let [e, t] of [["mesh", this.meshModule(0, "0")], ["lines", this.lineModule]]) {
|
|
@@ -8732,7 +8746,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8732
8746
|
let r = await n.popErrorScope();
|
|
8733
8747
|
if (r) throw Error(`WebGPU initialisation error: ${r.message}`);
|
|
8734
8748
|
this.frameBuffer = n.createBuffer({
|
|
8735
|
-
size:
|
|
8749
|
+
size: Uo,
|
|
8736
8750
|
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
8737
8751
|
}), this.frameBindGroup = n.createBindGroup({
|
|
8738
8752
|
layout: this.frameLayout,
|
|
@@ -8768,7 +8782,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8768
8782
|
}, !1), this.matData = /* @__PURE__ */ new Float32Array(20);
|
|
8769
8783
|
}
|
|
8770
8784
|
createTexture(e, t) {
|
|
8771
|
-
let n = e.width > 1 || e.height > 1 ?
|
|
8785
|
+
let n = e.width > 1 || e.height > 1 ? zo(e) : [e], r = this.device.createTexture({
|
|
8772
8786
|
size: [e.width, e.height],
|
|
8773
8787
|
format: t ? "rgba8unorm-srgb" : "rgba8unorm",
|
|
8774
8788
|
mipLevelCount: n.length,
|
|
@@ -8794,7 +8808,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8794
8808
|
meshModule(e, t) {
|
|
8795
8809
|
let n = `${e}|${t}`, r = this.meshModules.get(n);
|
|
8796
8810
|
return r || (r = this.device.createShaderModule({
|
|
8797
|
-
code:
|
|
8811
|
+
code: gs(e, t),
|
|
8798
8812
|
label: `es3d mesh ${n}`
|
|
8799
8813
|
}), this.meshModules.set(n, r)), r;
|
|
8800
8814
|
}
|
|
@@ -8808,7 +8822,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8808
8822
|
vertex: {
|
|
8809
8823
|
module: d,
|
|
8810
8824
|
entryPoint: f,
|
|
8811
|
-
buffers:
|
|
8825
|
+
buffers: bs
|
|
8812
8826
|
},
|
|
8813
8827
|
fragment: {
|
|
8814
8828
|
module: d,
|
|
@@ -8839,19 +8853,19 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8839
8853
|
depthWriteEnabled: i,
|
|
8840
8854
|
depthCompare: a
|
|
8841
8855
|
},
|
|
8842
|
-
multisample: { count:
|
|
8856
|
+
multisample: { count: ys }
|
|
8843
8857
|
}), this.pipelines.set(l, u), u;
|
|
8844
8858
|
}
|
|
8845
8859
|
ensureTargets() {
|
|
8846
8860
|
let e = this.canvas.width, t = this.canvas.height;
|
|
8847
8861
|
this.targetW === e && this.targetH === t && this.msaa || (this.msaa && this.msaa.destroy(), this.depth && this.depth.destroy(), this.msaa = this.device.createTexture({
|
|
8848
8862
|
size: [e, t],
|
|
8849
|
-
sampleCount:
|
|
8863
|
+
sampleCount: ys,
|
|
8850
8864
|
format: this.format,
|
|
8851
8865
|
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
8852
8866
|
}), this.depth = this.device.createTexture({
|
|
8853
8867
|
size: [e, t],
|
|
8854
|
-
sampleCount:
|
|
8868
|
+
sampleCount: ys,
|
|
8855
8869
|
format: "depth24plus",
|
|
8856
8870
|
usage: GPUTextureUsage.RENDER_ATTACHMENT
|
|
8857
8871
|
}), this.msaaView = this.msaa.createView(), this.depthView = this.depth.createView(), this.present === "readback" && (this.offscreen && this.offscreen.destroy(), this.readBuffer && !this.readPending && this.readBuffer.destroy(), this.offscreen = this.device.createTexture({
|
|
@@ -8885,10 +8899,10 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8885
8899
|
syncPool(e) {
|
|
8886
8900
|
let t = this.device, n = e.vertices.byteLength, r = e.indices.byteLength, i = 0;
|
|
8887
8901
|
(e.generation !== this.poolGeneration || !this.vertexBuffer || this.vertexBuffer.size < n || this.indexBuffer.size < r) && (this.vertexBuffer && this.vertexBuffer.destroy(), this.indexBuffer && this.indexBuffer.destroy(), this.vertexBuffer = t.createBuffer({
|
|
8888
|
-
size:
|
|
8902
|
+
size: xs(n, 65536),
|
|
8889
8903
|
usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
|
|
8890
8904
|
}), this.indexBuffer = t.createBuffer({
|
|
8891
|
-
size:
|
|
8905
|
+
size: xs(r, 65536),
|
|
8892
8906
|
usage: GPUBufferUsage.INDEX | GPUBufferUsage.COPY_DST
|
|
8893
8907
|
}), this.poolGeneration = e.generation, e.uploadedVertices = 0, e.uploadedIndices = 0);
|
|
8894
8908
|
let a = e.pending();
|
|
@@ -8905,7 +8919,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8905
8919
|
uploadInstances(e, t) {
|
|
8906
8920
|
let n = Math.max(64, t * 64);
|
|
8907
8921
|
return (!this.instanceBuffer || this.instanceBuffer.size < n) && (this.instanceBuffer && this.instanceBuffer.destroy(), this.instanceBuffer = this.device.createBuffer({
|
|
8908
|
-
size:
|
|
8922
|
+
size: xs(n, 16384),
|
|
8909
8923
|
usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
|
|
8910
8924
|
})), t && this.device.queue.writeBuffer(this.instanceBuffer, 0, e.buffer, e.byteOffset, t * 64), t * 64;
|
|
8911
8925
|
}
|
|
@@ -8949,7 +8963,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8949
8963
|
i || (i = {}, this.materialBindings.set(e, i));
|
|
8950
8964
|
let a = this.readyTexture(e.map ? t.get(e.map, "color") : null, !0), o = this.readyTexture(e.normalMap ? t.get(e.normalMap, "normal") : null, !1), s = this.readyTexture(e.metallicRoughnessMap ? t.get(e.metallicRoughnessMap, "linear") : null, !1), c = this.readyTexture(e.occlusionMap ? t.get(e.occlusionMap, "linear") : null, !1), l = this.readyTexture(e.emissiveMap ? t.get(e.emissiveMap, "color") : null, !0), u = !!a, d = !!o, f = !!s, p = !!c, m = !!l, h = `${u}|${d}|${f}|${p}|${m}`, g = i[r];
|
|
8951
8965
|
if (!g || g.key !== h) {
|
|
8952
|
-
g && g.buffer.destroy(),
|
|
8966
|
+
g && g.buffer.destroy(), Yo(this.matData, e, {
|
|
8953
8967
|
hasMap: u,
|
|
8954
8968
|
hasNormalMap: d,
|
|
8955
8969
|
hasMrMap: f,
|
|
@@ -8978,7 +8992,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8978
8992
|
overlayBinding(e, t) {
|
|
8979
8993
|
let n = this.overlayBindings.get(e);
|
|
8980
8994
|
if (n) return n;
|
|
8981
|
-
|
|
8995
|
+
Xo(this.matData, t);
|
|
8982
8996
|
let r = this.device.createBuffer({
|
|
8983
8997
|
size: 80,
|
|
8984
8998
|
usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST
|
|
@@ -8996,7 +9010,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
8996
9010
|
}
|
|
8997
9011
|
get caps() {
|
|
8998
9012
|
return {
|
|
8999
|
-
msaaSamples:
|
|
9013
|
+
msaaSamples: ys,
|
|
9000
9014
|
anisotropy: 8,
|
|
9001
9015
|
maxTextureSize: this.device ? this.device.limits.maxTextureDimension2D : 0,
|
|
9002
9016
|
colorSpace: "srgb"
|
|
@@ -9034,7 +9048,7 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
9034
9048
|
e !== o && (a.setPipeline(e), o = e);
|
|
9035
9049
|
};
|
|
9036
9050
|
if (this.vertexBuffer) {
|
|
9037
|
-
let r = null, i =
|
|
9051
|
+
let r = null, i = Jo(t);
|
|
9038
9052
|
for (let t of e.batches) {
|
|
9039
9053
|
let e = t.kind === "lines", o = this.materialBinding(t.material, n.textures, t.doubleSided && !t.material.doubleSided);
|
|
9040
9054
|
s(e ? this.pipeline("lines", {
|
|
@@ -9091,8 +9105,8 @@ fn fs_line() -> @location(0) vec4f {
|
|
|
9091
9105
|
this.msaa && this.msaa.destroy(), this.depth && this.depth.destroy(), this.device.destroy();
|
|
9092
9106
|
}
|
|
9093
9107
|
}
|
|
9094
|
-
},
|
|
9095
|
-
function
|
|
9108
|
+
}, Cs = () => performance.now();
|
|
9109
|
+
function ws() {
|
|
9096
9110
|
let e = [];
|
|
9097
9111
|
for (let t = 0; t < 8; t++) e.push(t & 1 ? .5 : -.5, t & 2 ? .5 : -.5, t & 4 ? .5 : -.5);
|
|
9098
9112
|
return new Y({
|
|
@@ -9126,7 +9140,7 @@ function Ss() {
|
|
|
9126
9140
|
kind: "lines"
|
|
9127
9141
|
});
|
|
9128
9142
|
}
|
|
9129
|
-
var
|
|
9143
|
+
var Ts = {
|
|
9130
9144
|
wireframe: [
|
|
9131
9145
|
.02,
|
|
9132
9146
|
.03,
|
|
@@ -9151,9 +9165,9 @@ var Cs = {
|
|
|
9151
9165
|
.12,
|
|
9152
9166
|
1
|
|
9153
9167
|
]
|
|
9154
|
-
},
|
|
9168
|
+
}, Es = 32 << 20, Ds = class {
|
|
9155
9169
|
constructor(e) {
|
|
9156
|
-
this.backend = e, this.kind = e.kind, this.pool = new bo(), this.frames = new
|
|
9170
|
+
this.backend = e, this.kind = e.kind, this.pool = new bo(), this.frames = new Oo(), this.textures = new Ho(), this.frameData = /* @__PURE__ */ new Float32Array(304), this.options = {
|
|
9157
9171
|
wireframe: !1,
|
|
9158
9172
|
normals: !1,
|
|
9159
9173
|
bbox: !1,
|
|
@@ -9164,7 +9178,7 @@ var Cs = {
|
|
|
9164
9178
|
maxPixelRatio: 2,
|
|
9165
9179
|
lodPixels: "css",
|
|
9166
9180
|
tessellationBudget: Infinity
|
|
9167
|
-
}, this.selection = /* @__PURE__ */ new Set(), this.scene = null, this.meshOf = null, this.cube =
|
|
9181
|
+
}, this.selection = /* @__PURE__ */ new Set(), this.scene = null, this.meshOf = null, this.cube = ws(), this.cubeRange = this.pool.meshRange(this.cube), this.lastDraw = null, this.lightInfo = {
|
|
9168
9182
|
truncated: 0,
|
|
9169
9183
|
usedDefaults: !1
|
|
9170
9184
|
}, this.stats = {
|
|
@@ -9193,10 +9207,10 @@ var Cs = {
|
|
|
9193
9207
|
return Math.min(e || 1, this.options.maxPixelRatio || Infinity);
|
|
9194
9208
|
}
|
|
9195
9209
|
setScene(e, t, { keepGeometry: n = !0 } = {}) {
|
|
9196
|
-
this.scene = e, this.meshOf = t, (!e || !n || this.pool.byteSize >
|
|
9210
|
+
this.scene = e, this.meshOf = t, (!e || !n || this.pool.byteSize > Es) && (this.pool.reset(), this.cubeRange = this.pool.meshRange(this.cube)), this.backend.releaseMaterials(new Set(e ? e.materials : [])), this.stats.totalUploadBytes = 0;
|
|
9197
9211
|
}
|
|
9198
9212
|
render(e, t) {
|
|
9199
|
-
let n =
|
|
9213
|
+
let n = Cs(), r = this.pixelRatio(t.dpr), i = Math.max(1, Math.round(t.width * r)), a = Math.max(1, Math.round(t.height * r));
|
|
9200
9214
|
this.backend.resize(i, a);
|
|
9201
9215
|
let o = this.scene, s = o ? o.bounds : {
|
|
9202
9216
|
min: [
|
|
@@ -9260,7 +9274,7 @@ var Cs = {
|
|
|
9260
9274
|
}
|
|
9261
9275
|
};
|
|
9262
9276
|
let u = Math.hypot(s.max[0] - s.min[0], s.max[1] - s.min[1], s.max[2] - s.min[2]) / 2 || 1;
|
|
9263
|
-
this.lightInfo =
|
|
9277
|
+
this.lightInfo = qo(this.frameData, {
|
|
9264
9278
|
viewProj: e.viewProj,
|
|
9265
9279
|
view: e.view,
|
|
9266
9280
|
cameraPos: e.position,
|
|
@@ -9279,11 +9293,11 @@ var Cs = {
|
|
|
9279
9293
|
this.backend.render(l, this.frameData, {
|
|
9280
9294
|
background: c.background,
|
|
9281
9295
|
textures: this.textures,
|
|
9282
|
-
overlayColors:
|
|
9296
|
+
overlayColors: Ts,
|
|
9283
9297
|
cubeRange: this.cubeRange
|
|
9284
9298
|
}), this.lastDraw = l;
|
|
9285
9299
|
let p = this.stats;
|
|
9286
|
-
return p.cpuMs =
|
|
9300
|
+
return p.cpuMs = Cs() - n, p.uploadBytes = d + l.instanceCount * 64, p.totalUploadBytes += d, p.drawCalls = l.stats.drawCalls, p.triangles = l.stats.triangles, p.visible = l.stats.visible, p.instances = l.stats.instances, p.culled = l.stats.culled, p.batches = l.stats.batches, p.lodHistogram = l.stats.lodHistogram, p.refining = l.stats.refining || 0, p.geometryBytes = this.pool.byteSize, p.instanceBytes = l.instanceCount * 64, p.textureBytes = this.backend.gpuBytes, l;
|
|
9287
9301
|
}
|
|
9288
9302
|
buildFrame(e, t, n, r = this.options.tessellationBudget) {
|
|
9289
9303
|
let i = this.options.lodPixels === "device" ? n : Math.max(1, Math.round(t.height));
|
|
@@ -9314,12 +9328,12 @@ var Cs = {
|
|
|
9314
9328
|
this.textures.clear((e) => this.backend.destroyTexture(e)), this.backend.dispose();
|
|
9315
9329
|
}
|
|
9316
9330
|
};
|
|
9317
|
-
async function
|
|
9331
|
+
async function Os(e, t = {}) {
|
|
9318
9332
|
let n = t.backend || "auto", r = [], i = !1;
|
|
9319
9333
|
if ((n === "auto" || n === "webgpu") && typeof navigator < "u" && navigator.gpu) {
|
|
9320
|
-
let a = new
|
|
9334
|
+
let a = new Ss(e, { present: t.present });
|
|
9321
9335
|
try {
|
|
9322
|
-
return await a.init(), new
|
|
9336
|
+
return await a.init(), new Ds(a);
|
|
9323
9337
|
} catch (e) {
|
|
9324
9338
|
r.push(e.message), i = !!a.canvasUsed;
|
|
9325
9339
|
try {
|
|
@@ -9330,13 +9344,13 @@ async function Es(e, t = {}) {
|
|
|
9330
9344
|
} else if (n === "webgpu") throw Error("WebGPU is not available in this browser.");
|
|
9331
9345
|
let a = e;
|
|
9332
9346
|
i && e.getContext && e.parentNode && (a = e.cloneNode(!1), e.parentNode.replaceChild(a, e));
|
|
9333
|
-
let o = new
|
|
9347
|
+
let o = new fs(a);
|
|
9334
9348
|
await o.init();
|
|
9335
|
-
let s = new
|
|
9349
|
+
let s = new Ds(o);
|
|
9336
9350
|
return s.fallbackReason = r.join("; "), s.canvas = a, s;
|
|
9337
9351
|
}
|
|
9338
9352
|
// src/cache/sha256.js
|
|
9339
|
-
var
|
|
9353
|
+
var ks = new Uint32Array([
|
|
9340
9354
|
1116352408,
|
|
9341
9355
|
1899447441,
|
|
9342
9356
|
3049323471,
|
|
@@ -9401,22 +9415,22 @@ var Ds = new Uint32Array([
|
|
|
9401
9415
|
2756734187,
|
|
9402
9416
|
3204031479,
|
|
9403
9417
|
3329325298
|
|
9404
|
-
]),
|
|
9405
|
-
function
|
|
9406
|
-
let t = typeof e == "string" ?
|
|
9418
|
+
]), As = /* @__PURE__ */ new Uint32Array(64), js = new TextEncoder();
|
|
9419
|
+
function Ms(e) {
|
|
9420
|
+
let t = typeof e == "string" ? js.encode(e) : e instanceof Uint8Array ? e : new Uint8Array(e.buffer || e, e.byteOffset || 0, e.byteLength), n = t.length, r = n + 9 + 63 & -64, i = new Uint8Array(r);
|
|
9407
9421
|
i.set(t), i[n] = 128;
|
|
9408
9422
|
let a = new DataView(i.buffer);
|
|
9409
9423
|
a.setUint32(r - 8, Math.floor(n / 536870912), !1), a.setUint32(r - 4, n << 3 >>> 0, !1);
|
|
9410
9424
|
let o = 1779033703, s = 3144134277, c = 1013904242, l = 2773480762, u = 1359893119, d = 2600822924, f = 528734635, p = 1541459225;
|
|
9411
9425
|
for (let e = 0; e < r; e += 64) {
|
|
9412
|
-
for (let t = 0; t < 16; t++)
|
|
9426
|
+
for (let t = 0; t < 16; t++) As[t] = a.getUint32(e + t * 4, !1);
|
|
9413
9427
|
for (let e = 16; e < 64; e++) {
|
|
9414
|
-
let t =
|
|
9415
|
-
|
|
9428
|
+
let t = As[e - 15], n = As[e - 2], r = (t >>> 7 | t << 25) ^ (t >>> 18 | t << 14) ^ t >>> 3, i = (n >>> 17 | n << 15) ^ (n >>> 19 | n << 13) ^ n >>> 10;
|
|
9429
|
+
As[e] = As[e - 16] + r + As[e - 7] + i | 0;
|
|
9416
9430
|
}
|
|
9417
9431
|
let t = o, n = s, r = c, i = l, m = u, h = d, g = f, _ = p;
|
|
9418
9432
|
for (let e = 0; e < 64; e++) {
|
|
9419
|
-
let a = (m >>> 6 | m << 26) ^ (m >>> 11 | m << 21) ^ (m >>> 25 | m << 7), o = _ + a + (m & h ^ ~m & g) +
|
|
9433
|
+
let a = (m >>> 6 | m << 26) ^ (m >>> 11 | m << 21) ^ (m >>> 25 | m << 7), o = _ + a + (m & h ^ ~m & g) + ks[e] + As[e] | 0, s = ((t >>> 2 | t << 30) ^ (t >>> 13 | t << 19) ^ (t >>> 22 | t << 10)) + (t & n ^ t & r ^ n & r) | 0;
|
|
9420
9434
|
_ = g, g = h, h = m, m = i + o | 0, i = r, r = n, n = t, t = o + s | 0;
|
|
9421
9435
|
}
|
|
9422
9436
|
o = o + t | 0, s = s + n | 0, c = c + r | 0, l = l + i | 0, u = u + m | 0, d = d + h | 0, f = f + g | 0, p = p + _ | 0;
|
|
@@ -9435,8 +9449,8 @@ function As(e) {
|
|
|
9435
9449
|
return m;
|
|
9436
9450
|
}
|
|
9437
9451
|
// src/cache/mesh-bundle.js
|
|
9438
|
-
var
|
|
9439
|
-
function
|
|
9452
|
+
var Ns = 1194545989, Ps = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1, Fs = new TextEncoder(), Is = new TextDecoder(), Ls = (e) => e + 3 & -4;
|
|
9453
|
+
function Rs(e, t) {
|
|
9440
9454
|
let n = [], r = 0, i = {
|
|
9441
9455
|
key: e,
|
|
9442
9456
|
entries: []
|
|
@@ -9461,28 +9475,28 @@ function Is(e, t) {
|
|
|
9461
9475
|
mesh: a,
|
|
9462
9476
|
at: r,
|
|
9463
9477
|
w: c
|
|
9464
|
-
}), r += e * 32 +
|
|
9478
|
+
}), r += e * 32 + Ls(s * c);
|
|
9465
9479
|
}
|
|
9466
9480
|
i.entries.push(t);
|
|
9467
9481
|
}
|
|
9468
|
-
let a =
|
|
9469
|
-
l.setUint32(0,
|
|
9482
|
+
let a = Fs.encode(JSON.stringify(i)), o = 12 + Ls(a.length), s = new ArrayBuffer(o + r), c = new Uint8Array(s), l = new DataView(s);
|
|
9483
|
+
l.setUint32(0, Ns, !0), l.setUint32(4, 1, !0), l.setUint32(8, o - 12, !0), c.set(a, 12), c.fill(32, 12 + a.length, o);
|
|
9470
9484
|
for (let { mesh: e, at: t, w: r } of n) {
|
|
9471
9485
|
let n = e.positions.length / 3, i = o + t;
|
|
9472
9486
|
new Float32Array(s, i, n * 3).set(e.positions), new Float32Array(s, i + n * 12, n * 3).set(e.normals), new Float32Array(s, i + n * 24, n * 2).set(e.uvs), new (r === 2 ? Uint16Array : Uint32Array)(s, i + n * 32, e.indices.length).set(e.indices);
|
|
9473
9487
|
}
|
|
9474
9488
|
return s;
|
|
9475
9489
|
}
|
|
9476
|
-
var
|
|
9477
|
-
function
|
|
9478
|
-
if (!
|
|
9490
|
+
var zs = (e) => Number.isInteger(e) && e >= 0;
|
|
9491
|
+
function Bs(e) {
|
|
9492
|
+
if (!Ps || !(e instanceof ArrayBuffer) || e.byteLength < 12) return null;
|
|
9479
9493
|
let t = new DataView(e);
|
|
9480
|
-
if (t.getUint32(0, !0) !==
|
|
9494
|
+
if (t.getUint32(0, !0) !== Ns || t.getUint32(4, !0) !== 1) return null;
|
|
9481
9495
|
let n = t.getUint32(8, !0);
|
|
9482
9496
|
if (n % 4 || 12 + n > e.byteLength) return null;
|
|
9483
9497
|
let r;
|
|
9484
9498
|
try {
|
|
9485
|
-
r = JSON.parse(
|
|
9499
|
+
r = JSON.parse(Is.decode(new Uint8Array(e, 12, n)));
|
|
9486
9500
|
} catch {
|
|
9487
9501
|
return null;
|
|
9488
9502
|
}
|
|
@@ -9492,7 +9506,7 @@ function Rs(e) {
|
|
|
9492
9506
|
if (!Array.isArray(t)) return null;
|
|
9493
9507
|
let n = [];
|
|
9494
9508
|
for (let r of t) {
|
|
9495
|
-
if (!r || !
|
|
9509
|
+
if (!r || !zs(r.lod) || !zs(r.v) || !zs(r.i) || !zs(r.at) || r.at % 4 || r.kind !== "triangles" && r.kind !== "lines" || r.w !== 2 && r.w !== 4 || r.w === 2 && r.v > 65536 || r.i % (r.kind === "lines" ? 2 : 3)) return null;
|
|
9496
9510
|
let t = i + r.at;
|
|
9497
9511
|
if (t + r.v * 32 + r.i * r.w > e.byteLength) return null;
|
|
9498
9512
|
let a = r.w === 2 ? new Uint32Array(new Uint16Array(e, t + r.v * 32, r.i)) : new Uint32Array(e, t + r.v * 32, r.i), o = new Y({
|
|
@@ -9519,26 +9533,26 @@ function Rs(e) {
|
|
|
9519
9533
|
entries: a
|
|
9520
9534
|
};
|
|
9521
9535
|
}
|
|
9522
|
-
var
|
|
9523
|
-
function
|
|
9524
|
-
if (
|
|
9536
|
+
var Vs = () => typeof performance < "u" ? performance.now() : Date.now(), Hs = null;
|
|
9537
|
+
function Us() {
|
|
9538
|
+
if (Hs) return Hs;
|
|
9525
9539
|
let e = /* @__PURE__ */ new Float64Array(216), t = 0;
|
|
9526
9540
|
for (let n = 0; n < 24; n++) {
|
|
9527
9541
|
let r = (n - 11.5) * .8284271247461902;
|
|
9528
9542
|
e[t++] = Math.sin(r), e[t++] = Math.cos(r), e[t++] = Math.tan(r), e[t++] = Math.atan2(r, 1.7 - n * .11), e[t++] = Math.acos(Math.max(-1, Math.min(1, r / 10))), e[t++] = Math.hypot(r, n * .3), e[t++] = Math.hypot(r, n * .3, 1 / (n + 1)), e[t++] = Math.cbrt(r), e[t++] = Math.sqrt(n + .1);
|
|
9529
9543
|
}
|
|
9530
|
-
return
|
|
9544
|
+
return Hs = new Uint8Array(e.buffer), Hs;
|
|
9531
9545
|
}
|
|
9532
|
-
var
|
|
9533
|
-
async function
|
|
9534
|
-
if (t &&
|
|
9535
|
-
let t = new Uint8Array(await
|
|
9546
|
+
var Ws = typeof crypto < "u" && crypto.subtle && typeof crypto.subtle.digest == "function" ? crypto.subtle : null, Gs = new TextEncoder();
|
|
9547
|
+
async function Ks(e, t) {
|
|
9548
|
+
if (t && Ws) try {
|
|
9549
|
+
let t = new Uint8Array(await Ws.digest("SHA-256", e)), n = "";
|
|
9536
9550
|
for (let e of t) n += (e < 16 ? "0" : "") + e.toString(16);
|
|
9537
9551
|
return n;
|
|
9538
9552
|
} catch {}
|
|
9539
|
-
return
|
|
9553
|
+
return Ms(e);
|
|
9540
9554
|
}
|
|
9541
|
-
async function
|
|
9555
|
+
async function qs(e, t = {}) {
|
|
9542
9556
|
let n = [];
|
|
9543
9557
|
for (let t of e.entries.values()) t.identity && n.push(t);
|
|
9544
9558
|
if (!n.length) return {
|
|
@@ -9546,13 +9560,13 @@ async function Gs(e, t = {}) {
|
|
|
9546
9560
|
entries: n
|
|
9547
9561
|
};
|
|
9548
9562
|
n.sort((e, t) => e.identity < t.identity ? -1 : +(e.identity > t.identity));
|
|
9549
|
-
let r =
|
|
9563
|
+
let r = Gs.encode(`es3d-geometry:1:${e.quality}:${n.length}:${n.map((e) => e.identity).join("")}`), i = Us(), a = new Uint8Array(r.length + i.length);
|
|
9550
9564
|
return a.set(r), a.set(i, r.length), {
|
|
9551
|
-
key: await
|
|
9565
|
+
key: await Ks(a, t.native !== !1),
|
|
9552
9566
|
entries: n
|
|
9553
9567
|
};
|
|
9554
9568
|
}
|
|
9555
|
-
function
|
|
9569
|
+
function Js(e) {
|
|
9556
9570
|
let t = [];
|
|
9557
9571
|
for (let n = 0; n < e.lods; n++) {
|
|
9558
9572
|
let r = e.meshes[n];
|
|
@@ -9564,22 +9578,22 @@ function Ks(e) {
|
|
|
9564
9578
|
}
|
|
9565
9579
|
return t;
|
|
9566
9580
|
}
|
|
9567
|
-
var
|
|
9568
|
-
async function
|
|
9569
|
-
let r =
|
|
9581
|
+
var Ys = (e, t) => t > 0 && t < Infinity ? Promise.race([e, new Promise((e) => setTimeout(() => e(void 0), t))]) : e;
|
|
9582
|
+
async function Xs(e, t, n = {}) {
|
|
9583
|
+
let r = Vs(), i = (e) => ({
|
|
9570
9584
|
hit: !1,
|
|
9571
9585
|
key: null,
|
|
9572
9586
|
levels: 0,
|
|
9573
9587
|
bytes: 0,
|
|
9574
9588
|
...e,
|
|
9575
|
-
ms:
|
|
9576
|
-
}), a = await
|
|
9589
|
+
ms: Vs() - r
|
|
9590
|
+
}), a = await Ys(Promise.resolve(t), n.timeout ?? 250);
|
|
9577
9591
|
if (!a) return i({ reason: a === void 0 ? "store timed out" : "no store" });
|
|
9578
|
-
let { key: o, entries: s } = await
|
|
9592
|
+
let { key: o, entries: s } = await qs(e);
|
|
9579
9593
|
if (!o) return i({ reason: "nothing cacheable" });
|
|
9580
9594
|
let c;
|
|
9581
9595
|
try {
|
|
9582
|
-
c = await
|
|
9596
|
+
c = await Ys(a.get(o), n.timeout ?? 250);
|
|
9583
9597
|
} catch {
|
|
9584
9598
|
c = null;
|
|
9585
9599
|
}
|
|
@@ -9591,7 +9605,7 @@ async function Js(e, t, n = {}) {
|
|
|
9591
9605
|
key: o,
|
|
9592
9606
|
reason: "miss"
|
|
9593
9607
|
});
|
|
9594
|
-
let l =
|
|
9608
|
+
let l = Bs(c);
|
|
9595
9609
|
if (!l || l.key !== o || l.entries.length !== s.length) return Promise.resolve(a.delete(o)).catch(() => {}), i({
|
|
9596
9610
|
key: o,
|
|
9597
9611
|
reason: "invalid record"
|
|
@@ -9607,15 +9621,15 @@ async function Js(e, t, n = {}) {
|
|
|
9607
9621
|
key: o,
|
|
9608
9622
|
levels: u,
|
|
9609
9623
|
bytes: c.byteLength,
|
|
9610
|
-
ms:
|
|
9624
|
+
ms: Vs() - r
|
|
9611
9625
|
};
|
|
9612
9626
|
}
|
|
9613
|
-
function
|
|
9627
|
+
function Zs(e) {
|
|
9614
9628
|
let t = 0;
|
|
9615
|
-
for (let n of e) t +=
|
|
9629
|
+
for (let n of e) t += Js(n).length;
|
|
9616
9630
|
return t;
|
|
9617
9631
|
}
|
|
9618
|
-
async function
|
|
9632
|
+
async function Qs(e, t) {
|
|
9619
9633
|
let n = await t;
|
|
9620
9634
|
if (!n) return {
|
|
9621
9635
|
saved: !1,
|
|
@@ -9623,28 +9637,28 @@ async function Xs(e, t) {
|
|
|
9623
9637
|
bytes: 0,
|
|
9624
9638
|
reason: "no store"
|
|
9625
9639
|
};
|
|
9626
|
-
let { key: r, entries: i } = await
|
|
9640
|
+
let { key: r, entries: i } = await qs(e);
|
|
9627
9641
|
if (!r) return {
|
|
9628
9642
|
saved: !1,
|
|
9629
9643
|
key: null,
|
|
9630
9644
|
bytes: 0,
|
|
9631
9645
|
reason: "nothing cacheable"
|
|
9632
9646
|
};
|
|
9633
|
-
let a = `${r}:${
|
|
9647
|
+
let a = `${r}:${Zs(i)}`;
|
|
9634
9648
|
if (e.persisted === a) return {
|
|
9635
9649
|
saved: !1,
|
|
9636
9650
|
key: r,
|
|
9637
9651
|
bytes: 0,
|
|
9638
9652
|
reason: "up to date"
|
|
9639
9653
|
};
|
|
9640
|
-
let o = i.map(
|
|
9654
|
+
let o = i.map(Js);
|
|
9641
9655
|
if (!o.some((e) => e.length)) return {
|
|
9642
9656
|
saved: !1,
|
|
9643
9657
|
key: r,
|
|
9644
9658
|
bytes: 0,
|
|
9645
9659
|
reason: "nothing generated"
|
|
9646
9660
|
};
|
|
9647
|
-
let s =
|
|
9661
|
+
let s = Rs(r, o);
|
|
9648
9662
|
if (n.maxBytes && s.byteLength > n.maxBytes / 4) return {
|
|
9649
9663
|
saved: !1,
|
|
9650
9664
|
key: r,
|
|
@@ -9667,40 +9681,40 @@ async function Xs(e, t) {
|
|
|
9667
9681
|
bytes: s.byteLength
|
|
9668
9682
|
};
|
|
9669
9683
|
}
|
|
9670
|
-
function
|
|
9684
|
+
function $s(e, t = {}) {
|
|
9671
9685
|
let n = t.delay ?? 1500, r = typeof requestIdleCallback == "function" ? (e) => requestIdleCallback(e, { timeout: 5e3 }) : (e) => setTimeout(e, 0), i = 0, a = null, o = -1;
|
|
9672
9686
|
return {
|
|
9673
9687
|
store: e,
|
|
9674
9688
|
restore(t, n) {
|
|
9675
|
-
return e ?
|
|
9689
|
+
return e ? Xs(t, e, n) : Promise.resolve(null);
|
|
9676
9690
|
},
|
|
9677
9691
|
changed(t) {
|
|
9678
9692
|
!e || t === a && t.stats.generated === o || (a = t, o = t.stats.generated, clearTimeout(i), i = setTimeout(() => r(() => {
|
|
9679
9693
|
let t = a;
|
|
9680
|
-
a = null, t &&
|
|
9694
|
+
a = null, t && Qs(t, e).catch(() => {});
|
|
9681
9695
|
}), n));
|
|
9682
9696
|
}
|
|
9683
9697
|
};
|
|
9684
9698
|
}
|
|
9685
|
-
var
|
|
9699
|
+
var ec = {
|
|
9686
9700
|
maxBytes: 67108864,
|
|
9687
9701
|
maxRecords: 256
|
|
9688
|
-
},
|
|
9702
|
+
}, tc = (e) => new Promise((t, n) => {
|
|
9689
9703
|
e.onsuccess = () => t(e.result), e.onerror = () => n(e.error);
|
|
9690
|
-
}),
|
|
9704
|
+
}), nc = (e) => new Promise((t, n) => {
|
|
9691
9705
|
e.oncomplete = () => t(), e.onerror = () => n(e.error), e.onabort = () => n(e.error || /* @__PURE__ */ Error("transaction aborted"));
|
|
9692
9706
|
});
|
|
9693
|
-
async function
|
|
9707
|
+
async function rc(e = {}) {
|
|
9694
9708
|
let { name: t, maxBytes: n, maxRecords: r, timeout: i } = {
|
|
9695
9709
|
name: "es3d-geometry",
|
|
9696
9710
|
timeout: 2e3,
|
|
9697
|
-
...
|
|
9711
|
+
...ec,
|
|
9698
9712
|
...e
|
|
9699
9713
|
}, a = typeof indexedDB < "u" ? indexedDB : null;
|
|
9700
9714
|
if (!a) return null;
|
|
9701
9715
|
let o;
|
|
9702
9716
|
try {
|
|
9703
|
-
o = await
|
|
9717
|
+
o = await Ys(new Promise((e, n) => {
|
|
9704
9718
|
let r = a.open(t, 1);
|
|
9705
9719
|
r.onupgradeneeded = () => {
|
|
9706
9720
|
let e = r.result;
|
|
@@ -9727,7 +9741,7 @@ async function tc(e = {}) {
|
|
|
9727
9741
|
kind: "indexeddb",
|
|
9728
9742
|
maxBytes: n,
|
|
9729
9743
|
async get(e) {
|
|
9730
|
-
let t = await
|
|
9744
|
+
let t = await tc(o.transaction("data", "readonly").objectStore("data").get(e));
|
|
9731
9745
|
return t instanceof ArrayBuffer ? ((typeof requestIdleCallback == "function" ? requestIdleCallback : setTimeout)(() => s(e)), t) : null;
|
|
9732
9746
|
},
|
|
9733
9747
|
async put(e, t) {
|
|
@@ -9738,34 +9752,34 @@ async function tc(e = {}) {
|
|
|
9738
9752
|
used: Date.now(),
|
|
9739
9753
|
revision: 1
|
|
9740
9754
|
});
|
|
9741
|
-
let c = await
|
|
9755
|
+
let c = await tc(s.getAll());
|
|
9742
9756
|
c.sort((e, t) => (e.revision === 1) - (t.revision === 1) || e.used - t.used);
|
|
9743
9757
|
let l = c.reduce((e, t) => e + t.bytes, 0), u = c.length;
|
|
9744
9758
|
for (let t of c) if (t.key !== e) {
|
|
9745
9759
|
if (t.revision === 1 && l <= n && u <= r) break;
|
|
9746
9760
|
a.delete(t.key), s.delete(t.key), l -= t.bytes, u--;
|
|
9747
9761
|
}
|
|
9748
|
-
await
|
|
9762
|
+
await nc(i);
|
|
9749
9763
|
},
|
|
9750
9764
|
async delete(e) {
|
|
9751
9765
|
let t = o.transaction(["data", "meta"], "readwrite");
|
|
9752
|
-
t.objectStore("data").delete(e), t.objectStore("meta").delete(e), await
|
|
9766
|
+
t.objectStore("data").delete(e), t.objectStore("meta").delete(e), await nc(t);
|
|
9753
9767
|
},
|
|
9754
9768
|
async clear() {
|
|
9755
9769
|
let e = o.transaction(["data", "meta"], "readwrite");
|
|
9756
|
-
e.objectStore("data").clear(), e.objectStore("meta").clear(), await
|
|
9770
|
+
e.objectStore("data").clear(), e.objectStore("meta").clear(), await nc(e);
|
|
9757
9771
|
},
|
|
9758
9772
|
close() {
|
|
9759
9773
|
o.close();
|
|
9760
9774
|
}
|
|
9761
9775
|
};
|
|
9762
9776
|
}
|
|
9763
|
-
async function
|
|
9764
|
-
let t = await
|
|
9777
|
+
async function ic(e = {}) {
|
|
9778
|
+
let t = await rc(e).catch(() => null);
|
|
9765
9779
|
return t && e.persist && typeof navigator < "u" && navigator.storage && navigator.storage.persist && navigator.storage.persist().catch(() => {}), t;
|
|
9766
9780
|
}
|
|
9767
9781
|
// src/render/camera.js
|
|
9768
|
-
var
|
|
9782
|
+
var ac = class e {
|
|
9769
9783
|
constructor() {
|
|
9770
9784
|
this.type = "perspective", this.position = [
|
|
9771
9785
|
6,
|
|
@@ -9874,8 +9888,8 @@ var rc = class e {
|
|
|
9874
9888
|
let n = this.aspect || 1;
|
|
9875
9889
|
return this.type === "orthographic" ? t / (this.orthoHeight * this.extentScale(n)) : t / (2 * Math.max(e, 1e-6) * Math.tan(this.verticalFov(n) / 2));
|
|
9876
9890
|
}
|
|
9877
|
-
},
|
|
9878
|
-
function
|
|
9891
|
+
}, oc = Math.PI / 180, sc = .001;
|
|
9892
|
+
function cc(e, t) {
|
|
9879
9893
|
if (!t) return;
|
|
9880
9894
|
let n = e.position, r = e.target;
|
|
9881
9895
|
if (t.targetMin && t.targetMax) for (let e = 0; e < 3; e++) {
|
|
@@ -9889,20 +9903,20 @@ function oc(e, t) {
|
|
|
9889
9903
|
], a = Math.hypot(i[0], i[1], i[2]);
|
|
9890
9904
|
if (a < 1e-12) return;
|
|
9891
9905
|
let o = Math.acos(Math.max(-1, Math.min(1, i[1] / a))), s = Math.atan2(i[0], i[2]), c = t.minPolar ?? 0, l = t.maxPolar ?? 180, u = c > 0 || l < 180;
|
|
9892
|
-
u && (o = Math.min(Math.min(l *
|
|
9906
|
+
u && (o = Math.min(Math.min(l * oc, Math.PI - sc), Math.max(Math.max(c * oc, sc), o)));
|
|
9893
9907
|
let d = a;
|
|
9894
9908
|
if (t.minDistance != null && (d = Math.max(d, t.minDistance)), t.maxDistance != null && (d = Math.min(d, t.maxDistance)), !u && d === a) return;
|
|
9895
9909
|
let f = Math.sin(o);
|
|
9896
9910
|
n[0] = r[0] + d * f * Math.sin(s), n[1] = r[1] + d * Math.cos(o), n[2] = r[2] + d * f * Math.cos(s);
|
|
9897
9911
|
}
|
|
9898
|
-
function
|
|
9912
|
+
function lc(e, t) {
|
|
9899
9913
|
let n = t.bounds, r = Math.hypot(n.max[0] - n.min[0], n.max[1] - n.min[1], n.max[2] - n.min[2]) / 2 || 1;
|
|
9900
9914
|
return Math.max((e.currentNear || 0) * 2, r * .01);
|
|
9901
9915
|
}
|
|
9902
|
-
function
|
|
9916
|
+
function uc(e, t, n) {
|
|
9903
9917
|
let { scene: r, meshOf: i } = n;
|
|
9904
9918
|
if (!r || !r.count) return !1;
|
|
9905
|
-
let a = n.margin ??
|
|
9919
|
+
let a = n.margin ?? lc(t, r), o = [
|
|
9906
9920
|
t.target[0] - e.target[0],
|
|
9907
9921
|
t.target[1] - e.target[1],
|
|
9908
9922
|
t.target[2] - e.target[2]
|
|
@@ -9937,11 +9951,11 @@ function cc(e, t, n) {
|
|
|
9937
9951
|
for (let n = 0; n < 3; n++) t.target[n] = e.target[n] + (f ? s[n] - e.position[n] : o[n] * d), t.position[n] = s[n];
|
|
9938
9952
|
return !0;
|
|
9939
9953
|
}
|
|
9940
|
-
function
|
|
9941
|
-
return
|
|
9954
|
+
function dc(e, t, n, r) {
|
|
9955
|
+
return cc(t, n), n && n.collide && r ? uc(e, t, r) : !1;
|
|
9942
9956
|
}
|
|
9943
9957
|
// src/render/orbit-controls.js
|
|
9944
|
-
var
|
|
9958
|
+
var fc = class {
|
|
9945
9959
|
constructor(e, t) {
|
|
9946
9960
|
this.el = e, this.camera = t, this.enabled = !0, this.enableZoom = !0, this.enablePan = !0, this.limits = null, this.world = null, this.rotateSpeed = .006, this.zoomSpeed = .0015, this.onChange = null, this.onClick = null, this.onDoubleClick = null, this.pointers = /* @__PURE__ */ new Map(), this.mode = null, this.moved = 0, this.last = null, this.pinch = null, this._down = (e) => this.pointerDown(e), this._move = (e) => this.pointerMove(e), this._up = (e) => this.pointerUp(e), this._wheel = (e) => this.wheel(e), this._ctx = (e) => e.preventDefault(), this._dbl = (e) => {
|
|
9947
9961
|
if (this.onDoubleClick) {
|
|
@@ -9971,7 +9985,7 @@ var uc = class {
|
|
|
9971
9985
|
constrain(e) {
|
|
9972
9986
|
if (!this.limits) return;
|
|
9973
9987
|
let t = this.limits.collide && this.world ? this.world() : null;
|
|
9974
|
-
|
|
9988
|
+
dc(e, this.camera, this.limits, t);
|
|
9975
9989
|
}
|
|
9976
9990
|
pointerDown(e) {
|
|
9977
9991
|
if (this.enabled) {
|
|
@@ -10102,9 +10116,9 @@ var uc = class {
|
|
|
10102
10116
|
for (let e = 0; e < 3; e++) t.target[e] += r[e], t.position[e] += r[e];
|
|
10103
10117
|
this.constrain(n), this.changed();
|
|
10104
10118
|
}
|
|
10105
|
-
},
|
|
10119
|
+
}, pc = () => typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, mc = class {
|
|
10106
10120
|
constructor(e, t = {}) {
|
|
10107
|
-
this.section = e, this.smoothing = t.smoothing ?? .12, this.reducedMotion = t.reducedMotion ??
|
|
10121
|
+
this.section = e, this.smoothing = t.smoothing ?? .12, this.reducedMotion = t.reducedMotion ?? pc(), this.value = NaN, this.target = 0, this.stale = !0, this.markStale = () => {
|
|
10108
10122
|
this.stale = !0;
|
|
10109
10123
|
}, addEventListener("scroll", this.markStale, {
|
|
10110
10124
|
passive: !0,
|
|
@@ -10147,8 +10161,8 @@ var uc = class {
|
|
|
10147
10161
|
let t = this.target - this.value;
|
|
10148
10162
|
return t !== 0 && (Math.abs(t) < 1e-4 ? this.value = this.target : this.value += t * (1 - Math.exp(-Math.max(e, 0) / this.smoothing)), !0);
|
|
10149
10163
|
}
|
|
10150
|
-
},
|
|
10151
|
-
function
|
|
10164
|
+
}, hc = () => typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, gc = (e) => typeof requestIdleCallback == "function" ? requestIdleCallback(e, { timeout: 500 }) : setTimeout(e, 16);
|
|
10165
|
+
function _c(e = {}, t = !1) {
|
|
10152
10166
|
let n = e.background === !0, r = e.clock === "always" || e.clock == null && n, i = e.autoOrbit === void 0 ? !n : e.autoOrbit !== !1;
|
|
10153
10167
|
return {
|
|
10154
10168
|
clock: r ? "always" : "document",
|
|
@@ -10156,13 +10170,13 @@ function hc(e = {}, t = !1) {
|
|
|
10156
10170
|
auto: i && !t
|
|
10157
10171
|
};
|
|
10158
10172
|
}
|
|
10159
|
-
function
|
|
10173
|
+
function vc(e, t, n) {
|
|
10160
10174
|
return !!(e.playing && !n && (e.clock === "always" || t.animation && t.animation.time));
|
|
10161
10175
|
}
|
|
10162
|
-
function
|
|
10176
|
+
function yc(e, t) {
|
|
10163
10177
|
return !(!e.auto || t);
|
|
10164
10178
|
}
|
|
10165
|
-
function
|
|
10179
|
+
function bc(e, t) {
|
|
10166
10180
|
let n = [], r = e && e.byUid.get(t);
|
|
10167
10181
|
for (; r;) {
|
|
10168
10182
|
let e = r.values && (r.values.name || r.values.id);
|
|
@@ -10170,13 +10184,13 @@ function vc(e, t) {
|
|
|
10170
10184
|
}
|
|
10171
10185
|
return n;
|
|
10172
10186
|
}
|
|
10173
|
-
var
|
|
10174
|
-
async function
|
|
10175
|
-
let n =
|
|
10187
|
+
var xc = 24, Sc = 50;
|
|
10188
|
+
async function Cc(e, t = {}) {
|
|
10189
|
+
let n = $s(t.geometryStore === !1 ? null : t.geometryStore || ic()), r = await Os(e, { backend: t.backend });
|
|
10176
10190
|
r.options.tessellationBudget = 4;
|
|
10177
10191
|
let i = r.canvas || e, a = i.parentElement;
|
|
10178
10192
|
i.style.display = "block";
|
|
10179
|
-
let o = new
|
|
10193
|
+
let o = new ac(), s = new fc(i, o), c = _c(t, hc()), l = {
|
|
10180
10194
|
result: null,
|
|
10181
10195
|
time: 0,
|
|
10182
10196
|
progress: 0,
|
|
@@ -10230,7 +10244,7 @@ async function xc(e, t = {}) {
|
|
|
10230
10244
|
let u = o.ray(e, n, a, s, r.backend.zeroToOne), d = yo(c, h, u.origin, u.dir, g(c));
|
|
10231
10245
|
t.onPick(d ? {
|
|
10232
10246
|
...d,
|
|
10233
|
-
names:
|
|
10247
|
+
names: bc(l.result.doc, d.uid)
|
|
10234
10248
|
} : null);
|
|
10235
10249
|
};
|
|
10236
10250
|
let v = new IntersectionObserver(([e]) => {
|
|
@@ -10249,20 +10263,20 @@ async function xc(e, t = {}) {
|
|
|
10249
10263
|
}), C = () => {
|
|
10250
10264
|
let e = l.generation, t = 0, i = () => {
|
|
10251
10265
|
let a = l.result;
|
|
10252
|
-
if (l.disposed || e !== l.generation || !a || t >
|
|
10253
|
-
if (!l.width || !l.height) return void setTimeout(() =>
|
|
10254
|
-
let s = t /
|
|
10266
|
+
if (l.disposed || e !== l.generation || !a || t > xc) return;
|
|
10267
|
+
if (!l.width || !l.height) return void setTimeout(() => gc(i), 200);
|
|
10268
|
+
let s = t / xc;
|
|
10255
10269
|
t++, ao(a.scene, a.graph, l.time, s);
|
|
10256
|
-
let c = x() ? new
|
|
10257
|
-
r.prepare(c, S()), ao(a.scene, a.graph, l.sceneTime, l.sceneProgress), n.changed(a.cache),
|
|
10270
|
+
let c = x() ? new ac().fromSpec(a.scene.cameras[0]) : o;
|
|
10271
|
+
r.prepare(c, S()), ao(a.scene, a.graph, l.sceneTime, l.sceneProgress), n.changed(a.cache), gc(i);
|
|
10258
10272
|
};
|
|
10259
|
-
|
|
10273
|
+
gc(i);
|
|
10260
10274
|
}, w = () => {
|
|
10261
10275
|
if (!l.result.scene.animation.scroll) l.timeline && l.timeline.dispose(), l.timeline = null;
|
|
10262
10276
|
else {
|
|
10263
10277
|
if (!l.timeline) {
|
|
10264
10278
|
let e = t.scroll || document.scrollingElement || document.documentElement;
|
|
10265
|
-
l.timeline = new
|
|
10279
|
+
l.timeline = new mc(e);
|
|
10266
10280
|
}
|
|
10267
10281
|
l.timeline.update(0), l.progress = l.timeline.value;
|
|
10268
10282
|
}
|
|
@@ -10290,7 +10304,7 @@ async function xc(e, t = {}) {
|
|
|
10290
10304
|
l.playing = !!e;
|
|
10291
10305
|
},
|
|
10292
10306
|
get reducedMotion() {
|
|
10293
|
-
return
|
|
10307
|
+
return hc();
|
|
10294
10308
|
},
|
|
10295
10309
|
setTransforms(e) {
|
|
10296
10310
|
let t = Array.from(e || []), n = l.result, r = n && n.graph, i = r && r.byId, a = t.map((e) => i && i.get(Array.isArray(e) ? e[0] : e && e.id)), o = t.map((e) => Array.isArray(e) ? e[1] : e && e.matrix), s = r && n.scene ? io(n.scene, r, a, o, l.time, l.progress) : t.map(() => !1);
|
|
@@ -10318,7 +10332,7 @@ async function xc(e, t = {}) {
|
|
|
10318
10332
|
let c = a.scene.controls;
|
|
10319
10333
|
s.configure(c, { world: _ }), t.interactive === !1 && (s.enabled = !1), c && c.mode !== "orbit" && (l.auto = !1), (!i.keepCamera || x()) && (a.scene.cameras.length ? o.fromSpec(a.scene.cameras[0]) : o.frame(a.scene.bounds));
|
|
10320
10334
|
let u = l.generation;
|
|
10321
|
-
return l.holdUntil = performance.now() +
|
|
10335
|
+
return l.holdUntil = performance.now() + Sc, n.restore(a.cache).finally(() => {
|
|
10322
10336
|
u === l.generation && (l.holdUntil = 0, l.dirty = !0, a.scene.animation.scroll && C());
|
|
10323
10337
|
}), a;
|
|
10324
10338
|
},
|
|
@@ -10330,8 +10344,8 @@ async function xc(e, t = {}) {
|
|
|
10330
10344
|
requestAnimationFrame(E);
|
|
10331
10345
|
let i = l.last ? Math.min(.05, (e - l.last) / 1e3) : 0;
|
|
10332
10346
|
if (l.last = e, !l.result || !l.onScreen || !l.width || !l.height) return;
|
|
10333
|
-
let a = l.result, c = a.scene, u =
|
|
10334
|
-
if (
|
|
10347
|
+
let a = l.result, c = a.scene, u = hc();
|
|
10348
|
+
if (vc(l, c, u) && (l.time += i), l.timeline && l.timeline.update(i) && (l.progress = l.timeline.value), t.onFrame && t.onFrame(i, T), yc(l, u)) {
|
|
10335
10349
|
let e = s.snapshot(), t = o.position[0] - o.target[0], n = o.position[2] - o.target[2], r = l.orbitSpeed * i, a = Math.cos(r), c = Math.sin(r);
|
|
10336
10350
|
o.position[0] = o.target[0] + t * a - n * c, o.position[2] = o.target[2] + t * c + n * a, s.constrain(e);
|
|
10337
10351
|
}
|
|
@@ -10346,4 +10360,4 @@ async function xc(e, t = {}) {
|
|
|
10346
10360
|
};
|
|
10347
10361
|
return requestAnimationFrame(E), T;
|
|
10348
10362
|
}
|
|
10349
|
-
export {
|
|
10363
|
+
export { bc as ancestorNames, Cc as createStage, et as es3dCos, $e as es3dSin, wa as mulberry32 };
|