@roomle/web-sdk 4.2.0-alpha.7 → 4.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ConfiguratorKernel.wasm +0 -0
- package/lib/{GaussianBlurNode-DEczNsyD.mjs → GaussianBlurNode-Bjszve7N.mjs} +15 -15
- package/lib/{GaussianBlurNode-DEczNsyD.mjs.map → GaussianBlurNode-Bjszve7N.mjs.map} +1 -1
- package/lib/RoomleCore.wasm +0 -0
- package/lib/RoomleToolsCore.wasm +0 -0
- package/lib/{api-B6sLiuiL.mjs → api-C0UElaCW.mjs} +2 -2
- package/lib/{api-B6sLiuiL.mjs.map → api-C0UElaCW.mjs.map} +1 -1
- package/lib/asset-loader.worker-eqHzNAwa.mjs.map +1 -1
- package/lib/{banana-for-scale-C-grIlTK.mjs → banana-for-scale-DGYmxeBG.mjs} +3 -3
- package/lib/{banana-for-scale-C-grIlTK.mjs.map → banana-for-scale-DGYmxeBG.mjs.map} +1 -1
- package/lib/budgeteer.sw-BUMElkO1.mjs.map +1 -1
- package/lib/{common-utils-6T8eGlhX.mjs → common-utils-CyQUubmw.mjs} +29 -15
- package/lib/{common-utils-6T8eGlhX.mjs.map → common-utils-CyQUubmw.mjs.map} +1 -1
- package/lib/{component-dimensioning-DJuokZnv.mjs → component-dimensioning--4sX2AgY.mjs} +4 -4
- package/lib/{component-dimensioning-DJuokZnv.mjs.map → component-dimensioning--4sX2AgY.mjs.map} +1 -1
- package/lib/{component-raycast-helper-SZg14d7A.mjs → component-raycast-helper-CskJedpv.mjs} +3 -3
- package/lib/{component-raycast-helper-SZg14d7A.mjs.map → component-raycast-helper-CskJedpv.mjs.map} +1 -1
- package/lib/configurator-CjFo24FH.mjs +2 -0
- package/lib/{configurator-Cbof6AET.mjs → configurator-vxRFxJ-B.mjs} +4 -4
- package/lib/{configurator-Cbof6AET.mjs.map → configurator-vxRFxJ-B.mjs.map} +1 -1
- package/lib/{decorate-CX1ZGuFY.mjs → decorate-CjaqqbUP.mjs} +12 -9
- package/lib/decorate-CjaqqbUP.mjs.map +1 -0
- package/lib/dimensioning-helper-0s61LK9R.mjs +2 -0
- package/lib/{dimensioning-helper-BwvR76_I.mjs → dimensioning-helper-Cgao7A18.mjs} +2 -2
- package/lib/{dimensioning-helper-BwvR76_I.mjs.map → dimensioning-helper-Cgao7A18.mjs.map} +1 -1
- package/lib/{glb-viewer-DmVh1uJg.mjs → glb-viewer-B-r0E1aa.mjs} +6 -6
- package/lib/{glb-viewer-DmVh1uJg.mjs.map → glb-viewer-B-r0E1aa.mjs.map} +1 -1
- package/lib/glb-viewer-BnJkmakv.mjs +2 -0
- package/lib/{highlight-coordinator-Qonmfsu1.mjs → highlight-coordinator-CR5rcFh_.mjs} +2 -2
- package/lib/{highlight-coordinator-Qonmfsu1.mjs.map → highlight-coordinator-CR5rcFh_.mjs.map} +1 -1
- package/lib/{homag-intelligence-CzD_RMQo.mjs → homag-intelligence-DHTCBB64.mjs} +8 -5
- package/lib/{homag-intelligence-CzD_RMQo.mjs.map → homag-intelligence-DHTCBB64.mjs.map} +1 -1
- package/lib/{imos-ix-poc-export-helper-Q6-OXziY.mjs → imos-ix-poc-export-helper-DRQK_p2h.mjs} +2 -2
- package/lib/{imos-ix-poc-export-helper-Q6-OXziY.mjs.map → imos-ix-poc-export-helper-DRQK_p2h.mjs.map} +1 -1
- package/lib/{material-viewer-BkSh-aG7.mjs → material-viewer-ZlNDhA8D.mjs} +6 -6
- package/lib/{material-viewer-BkSh-aG7.mjs.map → material-viewer-ZlNDhA8D.mjs.map} +1 -1
- package/lib/{packages-BGVMQMZK.mjs → packages-C9J0u-cc.mjs} +5 -5
- package/lib/{packages-BGVMQMZK.mjs.map → packages-C9J0u-cc.mjs.map} +1 -1
- package/lib/planner-C-5Mg-Lv.mjs +2 -0
- package/lib/{planner-DFa8uJOF.mjs → planner-ClY-VUWt.mjs} +3 -3
- package/lib/{planner-DFa8uJOF.mjs.map → planner-ClY-VUWt.mjs.map} +1 -1
- package/lib/{plugin-system-CqXT37-v.mjs → plugin-system-vlnG8j2T.mjs} +3 -3
- package/lib/{plugin-system-CqXT37-v.mjs.map → plugin-system-vlnG8j2T.mjs.map} +1 -1
- package/lib/{roomle-headless-setup-7xnQlZl3.mjs → roomle-headless-setup-DbO_rLjK.mjs} +54 -40
- package/lib/roomle-headless-setup-DbO_rLjK.mjs.map +1 -0
- package/lib/roomle-headless.d.ts +125 -115
- package/lib/roomle-headless.js +289 -358
- package/lib/roomle-headless.js.map +1 -1
- package/lib/roomle-renderer-FUqNfNIf.mjs.map +1 -1
- package/lib/{roomle-sdk-B73VmWod.mjs → roomle-sdk-BpCPIwDm.mjs} +2447 -2306
- package/lib/roomle-sdk-BpCPIwDm.mjs.map +1 -0
- package/lib/roomle-sdk.d.ts +79 -4
- package/lib/roomle-sdk.js +7 -7
- package/lib/{roomle-webgpu-renderer-Dzuy_Y39.mjs → roomle-webgpu-renderer-Lt55gNj5.mjs} +370 -303
- package/lib/roomle-webgpu-renderer-Lt55gNj5.mjs.map +1 -0
- package/lib/{scene-renderer-DR7EFd-8.mjs → scene-renderer-CLkhNnnv.mjs} +5 -5
- package/lib/{scene-renderer-DR7EFd-8.mjs.map → scene-renderer-CLkhNnnv.mjs.map} +1 -1
- package/lib/{script-loader-BlsGBrYo.mjs → script-loader-9GrUxzSB.mjs} +3 -3
- package/lib/{script-loader-BlsGBrYo.mjs.map → script-loader-9GrUxzSB.mjs.map} +1 -1
- package/lib/{shading-settings-Bnt9v9xJ.mjs → shading-settings-CRNmMpcn.mjs} +2 -2
- package/lib/{shading-settings-Bnt9v9xJ.mjs.map → shading-settings-CRNmMpcn.mjs.map} +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/package.json +1 -1
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/ConfiguratorKernel.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleCore.wasm +0 -0
- package/lib/static/roomle-core-hsc/node_modules/roomle-core-hsc/wasm_modern/RoomleToolsCore.wasm +0 -0
- package/lib/{stats-helper-vEwFkDIt.mjs → stats-helper-D9l8soWd.mjs} +3 -3
- package/lib/{stats-helper-vEwFkDIt.mjs.map → stats-helper-D9l8soWd.mjs.map} +1 -1
- package/lib/three.tsl-BnL9nfJa.mjs +2 -0
- package/lib/{three.tsl-BElp7_oF.mjs → three.tsl-Dew9p5yF.mjs} +46 -48
- package/lib/{three.tsl-BElp7_oF.mjs.map → three.tsl-Dew9p5yF.mjs.map} +1 -1
- package/lib/{threejs-utils-C9zED_Tu.mjs → threejs-utils-CKV1QNU9.mjs} +4 -3
- package/lib/threejs-utils-CKV1QNU9.mjs.map +1 -0
- package/lib/{tools-core-DKYMilYC.mjs → tools-core-CKaB3WsP.mjs} +3 -3
- package/lib/{tools-core-DKYMilYC.mjs.map → tools-core-CKaB3WsP.mjs.map} +1 -1
- package/lib/{webgpu-BMwlJflc.mjs → webgpu-B0rxiqW-.mjs} +313 -313
- package/lib/{webgpu-BMwlJflc.mjs.map → webgpu-B0rxiqW-.mjs.map} +1 -1
- package/package.json +2 -2
- package/lib/configurator-BFd5022u.mjs +0 -2
- package/lib/decorate-CX1ZGuFY.mjs.map +0 -1
- package/lib/dimensioning-helper-yMfkA1IY.mjs +0 -2
- package/lib/glb-viewer-DlH5_aTU.mjs +0 -2
- package/lib/planner-CSKuhBke.mjs +0 -2
- package/lib/roomle-headless-setup-7xnQlZl3.mjs.map +0 -1
- package/lib/roomle-sdk-B73VmWod.mjs.map +0 -1
- package/lib/roomle-webgpu-renderer-Dzuy_Y39.mjs.map +0 -1
- package/lib/three.tsl-BtDRDR0q.mjs +0 -2
- package/lib/threejs-utils-C9zED_Tu.mjs.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Ar as e, Bt as t, Ci as n, Di as r, E as i, Er as a, Gn as o, Hr as s, Mr as c, On as l, Qr as u, S as d, Si as f, U as p, Ur as m, V as h, Xr as g, Yt as _, Zr as v, ci as y, cn as b, ct as x, f as S, h as C, ht as w, jr as ee, kn as te, kr as ne, ln as re, m as ie, on as ae, qt as T, si as oe, sn as E, ui as D, vi as se, w as ce, wi as le, yn as ue } from "./three.core-0KaTx8dm.mjs";
|
|
2
2
|
import { t as de } from "./Pass-DLiMLT5k.mjs";
|
|
3
3
|
import { C as fe, Dt as pe, Fn as me, Gn as he, H as ge, Hn as O, Rn as k, Vn as _e, X as A, ln as ve, vt as ye } from "./three.webgpu-ylONY593.mjs";
|
|
4
|
-
import { At as be, Ct as
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
4
|
+
import { At as be, Ct as j, Dt as xe, Et as M, I as Se, L as Ce, Pt as we, Rt as Te, Tt as Ee, jt as De, k as Oe, lt as ke, vt as N, w as Ae, wt as je, xt as Me, zt as P } from "./three.tsl-Dew9p5yF.mjs";
|
|
5
|
+
var Ne = 1.25, Pe = 65535;
|
|
6
|
+
Pe << 16;
|
|
7
|
+
var Fe = 2 ** -24, Ie = Symbol("SKIP_GENERATION"), Le = {
|
|
8
8
|
strategy: 0,
|
|
9
9
|
maxDepth: 40,
|
|
10
10
|
targetLeafSize: 10,
|
|
@@ -14,14 +14,14 @@ var Pe = 2 ** -24, Fe = Symbol("SKIP_GENERATION"), Ie = {
|
|
|
14
14
|
indirect: !1,
|
|
15
15
|
verbose: !0,
|
|
16
16
|
range: null,
|
|
17
|
-
[
|
|
17
|
+
[Ie]: !1
|
|
18
18
|
};
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region ../../node_modules/three-mesh-bvh/src/utils/ArrayBoxUtilities.js
|
|
21
|
-
function
|
|
21
|
+
function F(e, t, n) {
|
|
22
22
|
return n.min.x = t[e], n.min.y = t[e + 1], n.min.z = t[e + 2], n.max.x = t[e + 3], n.max.y = t[e + 4], n.max.z = t[e + 5], n;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function Re(e) {
|
|
25
25
|
let t = -1, n = -Infinity;
|
|
26
26
|
for (let r = 0; r < 3; r++) {
|
|
27
27
|
let i = e[r + 3] - e[r];
|
|
@@ -29,52 +29,52 @@ function Le(e) {
|
|
|
29
29
|
}
|
|
30
30
|
return t;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function ze(e, t) {
|
|
33
33
|
t.set(e);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Be(e, t, n) {
|
|
36
36
|
let r, i;
|
|
37
37
|
for (let a = 0; a < 3; a++) {
|
|
38
38
|
let o = a + 3;
|
|
39
39
|
r = e[a], i = t[a], n[a] = r < i ? r : i, r = e[o], i = t[o], n[o] = r > i ? r : i;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Ve(e, t, n) {
|
|
43
43
|
for (let r = 0; r < 3; r++) {
|
|
44
44
|
let i = t[e + 2 * r], a = t[e + 2 * r + 1], o = i - a, s = i + a;
|
|
45
45
|
o < n[r] && (n[r] = o), s > n[r + 3] && (n[r + 3] = s);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function He(e) {
|
|
49
49
|
let t = e[3] - e[0], n = e[4] - e[1], r = e[5] - e[2];
|
|
50
50
|
return 2 * (t * n + n * r + r * t);
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
53
|
//#region ../../node_modules/three-mesh-bvh/src/core/utils/nodeBufferUtils.js
|
|
54
|
-
function
|
|
55
|
-
return t[e + 15] ===
|
|
54
|
+
function I(e, t) {
|
|
55
|
+
return t[e + 15] === Pe;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function L(e, t) {
|
|
58
58
|
return t[e + 6];
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function R(e, t) {
|
|
61
61
|
return t[e + 14];
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function z(e) {
|
|
64
64
|
return e + 8;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function B(e, t) {
|
|
67
67
|
return e + t[e + 6] * 8;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function Ue(e, t) {
|
|
70
70
|
return t[e + 7];
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function V(e) {
|
|
73
73
|
return e;
|
|
74
74
|
}
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region ../../node_modules/three-mesh-bvh/src/core/build/computeBoundsUtils.js
|
|
77
|
-
function
|
|
77
|
+
function We(e, t, n, r, i) {
|
|
78
78
|
let a = Infinity, o = Infinity, s = Infinity, c = -Infinity, l = -Infinity, u = -Infinity, d = Infinity, f = Infinity, p = Infinity, m = -Infinity, h = -Infinity, g = -Infinity, _ = e.offset || 0;
|
|
79
79
|
for (let r = (t - _) * 6, i = (t + n - _) * 6; r < i; r += 6) {
|
|
80
80
|
let t = e[r + 0], n = e[r + 1], i = t - n, _ = t + n;
|
|
@@ -88,23 +88,23 @@ function Ue(e, t, n, r, i) {
|
|
|
88
88
|
}
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region ../../node_modules/three-mesh-bvh/src/core/build/splitUtils.js
|
|
91
|
-
var
|
|
91
|
+
var Ge = 32, Ke = (e, t) => e.candidate - t.candidate, qe = /* @__PURE__ */ Array(Ge).fill().map(() => ({
|
|
92
92
|
count: 0,
|
|
93
93
|
bounds: new Float32Array(6),
|
|
94
94
|
rightCacheBounds: new Float32Array(6),
|
|
95
95
|
leftCacheBounds: new Float32Array(6),
|
|
96
96
|
candidate: 0
|
|
97
|
-
})),
|
|
98
|
-
function
|
|
97
|
+
})), Je = /* @__PURE__ */ new Float32Array(6);
|
|
98
|
+
function Ye(e, t, n, r, i, a) {
|
|
99
99
|
let o = -1, s = 0;
|
|
100
|
-
if (a === 0) o =
|
|
101
|
-
else if (a === 1) o =
|
|
100
|
+
if (a === 0) o = Re(t), o !== -1 && (s = (t[o] + t[o + 3]) / 2);
|
|
101
|
+
else if (a === 1) o = Re(e), o !== -1 && (s = Xe(n, r, i, o));
|
|
102
102
|
else if (a === 2) {
|
|
103
|
-
let a =
|
|
103
|
+
let a = He(e), c = Ne * i, l = n.offset || 0, u = (r - l) * 6, d = (r + i - l) * 6;
|
|
104
104
|
for (let e = 0; e < 3; e++) {
|
|
105
|
-
let r = t[e], l = (t[e + 3] - r) /
|
|
106
|
-
if (i <
|
|
107
|
-
let t = [...
|
|
105
|
+
let r = t[e], l = (t[e + 3] - r) / Ge;
|
|
106
|
+
if (i < Ge / 4) {
|
|
107
|
+
let t = [...qe];
|
|
108
108
|
t.length = i;
|
|
109
109
|
let r = 0;
|
|
110
110
|
for (let i = u; i < d; i += 6, r++) {
|
|
@@ -112,9 +112,9 @@ function Je(e, t, n, r, i, a) {
|
|
|
112
112
|
a.candidate = n[i + 2 * e], a.count = 0;
|
|
113
113
|
let { bounds: o, leftCacheBounds: s, rightCacheBounds: c } = a;
|
|
114
114
|
for (let e = 0; e < 3; e++) c[e] = Infinity, c[e + 3] = -Infinity, s[e] = Infinity, s[e + 3] = -Infinity, o[e] = Infinity, o[e + 3] = -Infinity;
|
|
115
|
-
|
|
115
|
+
Ve(i, n, o);
|
|
116
116
|
}
|
|
117
|
-
t.sort(
|
|
117
|
+
t.sort(Ke);
|
|
118
118
|
let l = i;
|
|
119
119
|
for (let e = 0; e < l; e++) {
|
|
120
120
|
let n = t[e];
|
|
@@ -124,45 +124,45 @@ function Je(e, t, n, r, i, a) {
|
|
|
124
124
|
let i = n[r + 2 * e];
|
|
125
125
|
for (let e = 0; e < l; e++) {
|
|
126
126
|
let a = t[e];
|
|
127
|
-
i >= a.candidate ?
|
|
127
|
+
i >= a.candidate ? Ve(r, n, a.rightCacheBounds) : (Ve(r, n, a.leftCacheBounds), a.count++);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
for (let n = 0; n < l; n++) {
|
|
131
131
|
let r = t[n], l = r.count, u = i - r.count, d = r.leftCacheBounds, f = r.rightCacheBounds, p = 0;
|
|
132
|
-
l !== 0 && (p =
|
|
132
|
+
l !== 0 && (p = He(d) / a);
|
|
133
133
|
let m = 0;
|
|
134
|
-
u !== 0 && (m =
|
|
135
|
-
let h = 1 +
|
|
134
|
+
u !== 0 && (m = He(f) / a);
|
|
135
|
+
let h = 1 + Ne * (p * l + m * u);
|
|
136
136
|
h < c && (o = e, c = h, s = r.candidate);
|
|
137
137
|
}
|
|
138
138
|
} else {
|
|
139
|
-
for (let e = 0; e <
|
|
140
|
-
let t =
|
|
139
|
+
for (let e = 0; e < Ge; e++) {
|
|
140
|
+
let t = qe[e];
|
|
141
141
|
t.count = 0, t.candidate = r + l + e * l;
|
|
142
142
|
let n = t.bounds;
|
|
143
143
|
for (let e = 0; e < 3; e++) n[e] = Infinity, n[e + 3] = -Infinity;
|
|
144
144
|
}
|
|
145
145
|
for (let t = u; t < d; t += 6) {
|
|
146
146
|
let i = ~~((n[t + 2 * e] - r) / l);
|
|
147
|
-
i >=
|
|
148
|
-
let a =
|
|
149
|
-
a.count++,
|
|
147
|
+
i >= Ge && (i = Ge - 1);
|
|
148
|
+
let a = qe[i];
|
|
149
|
+
a.count++, Ve(t, n, a.bounds);
|
|
150
150
|
}
|
|
151
|
-
let t =
|
|
152
|
-
|
|
153
|
-
for (let e =
|
|
154
|
-
let t =
|
|
155
|
-
|
|
151
|
+
let t = qe[Ge - 1];
|
|
152
|
+
ze(t.bounds, t.rightCacheBounds);
|
|
153
|
+
for (let e = Ge - 2; e >= 0; e--) {
|
|
154
|
+
let t = qe[e], n = qe[e + 1];
|
|
155
|
+
Be(t.bounds, n.rightCacheBounds, t.rightCacheBounds);
|
|
156
156
|
}
|
|
157
157
|
let f = 0;
|
|
158
|
-
for (let t = 0; t <
|
|
159
|
-
let n =
|
|
160
|
-
r !== 0 && (f === 0 ?
|
|
158
|
+
for (let t = 0; t < Ge - 1; t++) {
|
|
159
|
+
let n = qe[t], r = n.count, l = n.bounds, u = qe[t + 1].rightCacheBounds;
|
|
160
|
+
r !== 0 && (f === 0 ? ze(l, Je) : Be(l, Je, Je)), f += r;
|
|
161
161
|
let d = 0, p = 0;
|
|
162
|
-
f !== 0 && (d =
|
|
162
|
+
f !== 0 && (d = He(Je) / a);
|
|
163
163
|
let m = i - f;
|
|
164
|
-
m !== 0 && (p =
|
|
165
|
-
let h = 1 +
|
|
164
|
+
m !== 0 && (p = He(u) / a);
|
|
165
|
+
let h = 1 + Ne * (d * f + p * m);
|
|
166
166
|
h < c && (o = e, c = h, s = n.candidate);
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -173,21 +173,21 @@ function Je(e, t, n, r, i, a) {
|
|
|
173
173
|
pos: s
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Xe(e, t, n, r) {
|
|
177
177
|
let i = 0, a = e.offset;
|
|
178
178
|
for (let o = t, s = t + n; o < s; o++) i += e[(o - a) * 6 + r * 2];
|
|
179
179
|
return i / n;
|
|
180
180
|
}
|
|
181
181
|
//#endregion
|
|
182
182
|
//#region ../../node_modules/three-mesh-bvh/src/core/BVHNode.js
|
|
183
|
-
var
|
|
183
|
+
var Ze = class {
|
|
184
184
|
constructor() {
|
|
185
185
|
this.boundingData = new Float32Array(6);
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region ../../node_modules/three-mesh-bvh/src/core/build/sortUtils.js
|
|
190
|
-
function
|
|
190
|
+
function Qe(e, t, n, r, i, a) {
|
|
191
191
|
let o = r, s = r + i - 1, c = a.pos, l = a.axis * 2, u = n.offset || 0;
|
|
192
192
|
for (;;) {
|
|
193
193
|
for (; o <= s && n[(o - u) * 6 + l] < c;) o++;
|
|
@@ -207,28 +207,28 @@ function Ze(e, t, n, r, i, a) {
|
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region ../../node_modules/three-mesh-bvh/src/core/build/buildUtils.js
|
|
210
|
-
var
|
|
211
|
-
function
|
|
212
|
-
return "count" in e ? 1 : 1 +
|
|
210
|
+
var $e, et, tt, nt, rt = 2 ** 32;
|
|
211
|
+
function it(e) {
|
|
212
|
+
return "count" in e ? 1 : 1 + it(e.left) + it(e.right);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
return
|
|
214
|
+
function at(e, t, n) {
|
|
215
|
+
return $e = new Float32Array(n), et = new Uint32Array(n), tt = new Uint16Array(n), nt = new Uint8Array(n), ot(e, t);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function ot(e, t) {
|
|
218
218
|
let n = e / 4, r = e / 2, i = "count" in t, a = t.boundingData;
|
|
219
|
-
for (let e = 0; e < 6; e++)
|
|
220
|
-
if (i) return t.buffer ? (
|
|
219
|
+
for (let e = 0; e < 6; e++) $e[n + e] = a[e];
|
|
220
|
+
if (i) return t.buffer ? (nt.set(new Uint8Array(t.buffer), e), e + t.buffer.byteLength) : (et[n + 6] = t.offset, tt[r + 14] = t.count, tt[r + 15] = Pe, e + 32);
|
|
221
221
|
{
|
|
222
|
-
let { left: r, right: i, splitAxis: a } = t, o =
|
|
223
|
-
if (c >
|
|
224
|
-
return
|
|
222
|
+
let { left: r, right: i, splitAxis: a } = t, o = ot(e + 32, r), s = e / 32, c = o / 32 - s;
|
|
223
|
+
if (c > rt) throw Error("MeshBVH: Cannot store relative child node offset greater than 32 bits.");
|
|
224
|
+
return et[n + 6] = c, et[n + 7] = a, ot(o, i);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
//#endregion
|
|
228
228
|
//#region ../../node_modules/three-mesh-bvh/src/core/build/buildTree.js
|
|
229
|
-
function
|
|
230
|
-
let { maxDepth: o, verbose: s, targetLeafSize: c, _strictLeafSize: l = Infinity, strategy: u, onProgress: d } = i, f = e.primitiveBuffer, p = e.primitiveBufferStride, m = new Float32Array(6), h = !1, g = new
|
|
231
|
-
return
|
|
229
|
+
function st(e, t, n, r, i, a) {
|
|
230
|
+
let { maxDepth: o, verbose: s, targetLeafSize: c, _strictLeafSize: l = Infinity, strategy: u, onProgress: d } = i, f = e.primitiveBuffer, p = e.primitiveBufferStride, m = new Float32Array(6), h = !1, g = new Ze();
|
|
231
|
+
return We(t, n, r, g.boundingData, m), v(g, n, r, m), g;
|
|
232
232
|
function _(e) {
|
|
233
233
|
d && d((e - a.offset) / a.count);
|
|
234
234
|
}
|
|
@@ -236,31 +236,31 @@ function ot(e, t, n, r, i, a) {
|
|
|
236
236
|
!h && a >= o && (h = !0, s && console.warn(`BVH: Max depth of ${o} reached when generating BVH. Consider increasing maxDepth.`));
|
|
237
237
|
let d = r > l;
|
|
238
238
|
if (r <= c && !d || a >= o) return _(n + r), e.offset = n, e.count = r, e;
|
|
239
|
-
let g =
|
|
239
|
+
let g = Ye(e.boundingData, i, t, n, r, u), y = g.axis === -1 ? -1 : Qe(f, p, t, n, r, g);
|
|
240
240
|
if (g.axis === -1 || y === n || y === n + r) {
|
|
241
241
|
if (!d) return _(n + r), e.offset = n, e.count = r, e;
|
|
242
|
-
g.axis = Math.max(0,
|
|
242
|
+
g.axis = Math.max(0, Re(e.boundingData)), y = n + Math.max(1, Math.floor(r / 2));
|
|
243
243
|
}
|
|
244
244
|
e.splitAxis = g.axis;
|
|
245
|
-
let b = new
|
|
246
|
-
e.left = b,
|
|
247
|
-
let C = new
|
|
248
|
-
return e.right = C,
|
|
245
|
+
let b = new Ze(), x = n, S = y - n;
|
|
246
|
+
e.left = b, We(t, x, S, b.boundingData, m), v(b, x, S, m, a + 1);
|
|
247
|
+
let C = new Ze(), w = y, ee = r - S;
|
|
248
|
+
return e.right = C, We(t, w, ee, C.boundingData, m), v(C, w, ee, m, a + 1), e;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function ct(e, t) {
|
|
252
252
|
let n = t.useSharedArrayBuffer ? SharedArrayBuffer : ArrayBuffer, r = e.getRootRanges(t.range), i = r[0], a = r[r.length - 1], o = {
|
|
253
253
|
offset: i.offset,
|
|
254
254
|
count: a.offset + a.count - i.offset
|
|
255
255
|
}, s = new Float32Array(6 * o.count);
|
|
256
256
|
s.offset = o.offset, e.computePrimitiveBounds(o.offset, o.count, s), e._roots = r.map((r) => {
|
|
257
|
-
let i =
|
|
258
|
-
return
|
|
257
|
+
let i = st(e, s, r.offset, r.count, t, o), a = new n(32 * it(i));
|
|
258
|
+
return at(0, i, a), a;
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
262
|
//#region ../../node_modules/three-mesh-bvh/src/utils/PrimitivePool.js
|
|
263
|
-
var
|
|
263
|
+
var lt = class {
|
|
264
264
|
constructor(e) {
|
|
265
265
|
this._getNewPrimitive = e, this._primitives = [];
|
|
266
266
|
}
|
|
@@ -271,7 +271,7 @@ var ct = class {
|
|
|
271
271
|
releasePrimitive(e) {
|
|
272
272
|
this._primitives.push(e);
|
|
273
273
|
}
|
|
274
|
-
},
|
|
274
|
+
}, H = /* @__PURE__ */ new class {
|
|
275
275
|
constructor() {
|
|
276
276
|
this.float32Array = null, this.uint16Array = null, this.uint32Array = null;
|
|
277
277
|
let e = [], t = null;
|
|
@@ -281,103 +281,103 @@ var ct = class {
|
|
|
281
281
|
t = null, this.float32Array = null, this.uint16Array = null, this.uint32Array = null, e.length !== 0 && this.setBuffer(e.pop());
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
-
}(),
|
|
285
|
-
function
|
|
286
|
-
|
|
287
|
-
let o =
|
|
288
|
-
|
|
289
|
-
let s =
|
|
290
|
-
return s > 0 && (
|
|
284
|
+
}(), ut, dt, ft = [], pt = /* @__PURE__ */ new lt(() => new S());
|
|
285
|
+
function mt(e, t, n, r, i, a) {
|
|
286
|
+
ut = pt.getPrimitive(), dt = pt.getPrimitive(), ft.push(ut, dt), H.setBuffer(e._roots[t]);
|
|
287
|
+
let o = ht(0, e.geometry, n, r, i, a);
|
|
288
|
+
H.clearBuffer(), pt.releasePrimitive(ut), pt.releasePrimitive(dt), ft.pop(), ft.pop();
|
|
289
|
+
let s = ft.length;
|
|
290
|
+
return s > 0 && (dt = ft[s - 1], ut = ft[s - 2]), o;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
let { float32Array: s, uint16Array: c, uint32Array: l } =
|
|
294
|
-
if (
|
|
295
|
-
let t =
|
|
296
|
-
return
|
|
292
|
+
function ht(e, t, n, r, i = null, a = 0, o = 0) {
|
|
293
|
+
let { float32Array: s, uint16Array: c, uint32Array: l } = H, u = e * 2;
|
|
294
|
+
if (I(u, c)) {
|
|
295
|
+
let t = L(e, l), n = R(u, c);
|
|
296
|
+
return F(V(e), s, ut), r(t, n, !1, o, a + e / 8, ut);
|
|
297
297
|
} else {
|
|
298
|
-
let u =
|
|
299
|
-
if (i && (g =
|
|
298
|
+
let u = z(e), d = B(e, l), f = u, p = d, m, h, g, _;
|
|
299
|
+
if (i && (g = ut, _ = dt, F(V(f), s, g), F(V(p), s, _), m = i(g), h = i(_), h < m)) {
|
|
300
300
|
f = d, p = u;
|
|
301
301
|
let e = m;
|
|
302
302
|
m = h, h = e, g = _;
|
|
303
303
|
}
|
|
304
|
-
g || (g =
|
|
305
|
-
let v =
|
|
304
|
+
g || (g = ut, F(V(f), s, g));
|
|
305
|
+
let v = I(f * 2, c), y = n(g, v, m, o + 1, a + f / 8), b;
|
|
306
306
|
if (y === 2) {
|
|
307
307
|
let e = w(f);
|
|
308
308
|
b = r(e, ee(f) - e, !0, o + 1, a + f / 8, g);
|
|
309
|
-
} else b = y &&
|
|
309
|
+
} else b = y && ht(f, t, n, r, i, a, o + 1);
|
|
310
310
|
if (b) return !0;
|
|
311
|
-
_ =
|
|
312
|
-
let x =
|
|
311
|
+
_ = dt, F(V(p), s, _);
|
|
312
|
+
let x = I(p * 2, c), S = n(_, x, h, o + 1, a + p / 8), C;
|
|
313
313
|
if (S === 2) {
|
|
314
314
|
let e = w(p);
|
|
315
315
|
C = r(e, ee(p) - e, !0, o + 1, a + p / 8, _);
|
|
316
|
-
} else C = S &&
|
|
316
|
+
} else C = S && ht(p, t, n, r, i, a, o + 1);
|
|
317
317
|
if (C) return !0;
|
|
318
318
|
return !1;
|
|
319
319
|
function w(e) {
|
|
320
|
-
let { uint16Array: t, uint32Array: n } =
|
|
321
|
-
for (; !
|
|
322
|
-
return
|
|
320
|
+
let { uint16Array: t, uint32Array: n } = H, r = e * 2;
|
|
321
|
+
for (; !I(r, t);) e = z(e), r = e * 2;
|
|
322
|
+
return L(e, n);
|
|
323
323
|
}
|
|
324
324
|
function ee(e) {
|
|
325
|
-
let { uint16Array: t, uint32Array: n } =
|
|
326
|
-
for (; !
|
|
327
|
-
return
|
|
325
|
+
let { uint16Array: t, uint32Array: n } = H, r = e * 2;
|
|
326
|
+
for (; !I(r, t);) e = B(e, n), r = e * 2;
|
|
327
|
+
return L(e, n) + R(r, t);
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
//#endregion
|
|
332
332
|
//#region ../../node_modules/three-mesh-bvh/src/core/cast/bvhcast.js
|
|
333
|
-
var
|
|
334
|
-
function
|
|
335
|
-
if (
|
|
336
|
-
|
|
333
|
+
var gt = /* @__PURE__ */ new H.constructor(), _t = /* @__PURE__ */ new H.constructor(), vt = /* @__PURE__ */ new lt(() => new S()), yt = /* @__PURE__ */ new S(), bt = /* @__PURE__ */ new S(), xt = /* @__PURE__ */ new S(), St = /* @__PURE__ */ new S(), Ct = !1;
|
|
334
|
+
function wt(e, t, n, r) {
|
|
335
|
+
if (Ct) throw Error("MeshBVH: Recursive calls to bvhcast not supported.");
|
|
336
|
+
Ct = !0;
|
|
337
337
|
let i = e._roots, a = t._roots, o, s = 0, c = 0, l = new E().copy(n).invert();
|
|
338
338
|
for (let e = 0, t = i.length; e < t; e++) {
|
|
339
|
-
|
|
340
|
-
let t =
|
|
341
|
-
|
|
342
|
-
for (let e = 0, i = a.length; e < i && (
|
|
343
|
-
if (
|
|
339
|
+
gt.setBuffer(i[e]), c = 0;
|
|
340
|
+
let t = vt.getPrimitive();
|
|
341
|
+
F(V(0), gt.float32Array, t), t.applyMatrix4(l);
|
|
342
|
+
for (let e = 0, i = a.length; e < i && (_t.setBuffer(a[e]), o = U(0, 0, n, l, r, s, c, 0, 0, t), _t.clearBuffer(), c += a[e].byteLength / 32, !o); e++);
|
|
343
|
+
if (vt.releasePrimitive(t), gt.clearBuffer(), s += i[e].byteLength / 32, o) break;
|
|
344
344
|
}
|
|
345
|
-
return
|
|
345
|
+
return Ct = !1, o;
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function U(e, t, n, r, i, a = 0, o = 0, s = 0, c = 0, l = null, u = !1) {
|
|
348
348
|
let d, f;
|
|
349
|
-
u ? (d =
|
|
350
|
-
let p = d.float32Array, m = d.uint32Array, h = d.uint16Array, g = f.float32Array, _ = f.uint32Array, v = f.uint16Array, y = e * 2, b = t * 2, x =
|
|
351
|
-
if (S && x) C = u ? i(
|
|
349
|
+
u ? (d = _t, f = gt) : (d = gt, f = _t);
|
|
350
|
+
let p = d.float32Array, m = d.uint32Array, h = d.uint16Array, g = f.float32Array, _ = f.uint32Array, v = f.uint16Array, y = e * 2, b = t * 2, x = I(y, h), S = I(b, v), C = !1;
|
|
351
|
+
if (S && x) C = u ? i(L(t, _), R(t * 2, v), L(e, m), R(e * 2, h), c, o + t / 8, s, a + e / 8) : i(L(e, m), R(e * 2, h), L(t, _), R(t * 2, v), s, a + e / 8, c, o + t / 8);
|
|
352
352
|
else if (S) {
|
|
353
|
-
let l =
|
|
354
|
-
|
|
355
|
-
let d =
|
|
356
|
-
|
|
357
|
-
let h = l.intersectsBox(
|
|
358
|
-
C = h &&
|
|
353
|
+
let l = vt.getPrimitive();
|
|
354
|
+
F(V(t), g, l), l.applyMatrix4(n);
|
|
355
|
+
let d = z(e), f = B(e, m);
|
|
356
|
+
F(V(d), p, yt), F(V(f), p, bt);
|
|
357
|
+
let h = l.intersectsBox(yt), _ = l.intersectsBox(bt);
|
|
358
|
+
C = h && U(t, d, r, n, i, o, a, c, s + 1, l, !u) || _ && U(t, f, r, n, i, o, a, c, s + 1, l, !u), vt.releasePrimitive(l);
|
|
359
359
|
} else {
|
|
360
|
-
let d =
|
|
361
|
-
|
|
362
|
-
let h = l.intersectsBox(
|
|
363
|
-
if (h && v) C =
|
|
364
|
-
else if (h) if (x) C =
|
|
360
|
+
let d = z(t), f = B(t, _);
|
|
361
|
+
F(V(d), g, xt), F(V(f), g, St);
|
|
362
|
+
let h = l.intersectsBox(xt), v = l.intersectsBox(St);
|
|
363
|
+
if (h && v) C = U(e, d, n, r, i, a, o, s, c + 1, l, u) || U(e, f, n, r, i, a, o, s, c + 1, l, u);
|
|
364
|
+
else if (h) if (x) C = U(e, d, n, r, i, a, o, s, c + 1, l, u);
|
|
365
365
|
else {
|
|
366
|
-
let t =
|
|
367
|
-
t.copy(
|
|
368
|
-
let l =
|
|
369
|
-
|
|
370
|
-
let h = t.intersectsBox(
|
|
371
|
-
C = h &&
|
|
366
|
+
let t = vt.getPrimitive();
|
|
367
|
+
t.copy(xt).applyMatrix4(n);
|
|
368
|
+
let l = z(e), f = B(e, m);
|
|
369
|
+
F(V(l), p, yt), F(V(f), p, bt);
|
|
370
|
+
let h = t.intersectsBox(yt), g = t.intersectsBox(bt);
|
|
371
|
+
C = h && U(d, l, r, n, i, o, a, c, s + 1, t, !u) || g && U(d, f, r, n, i, o, a, c, s + 1, t, !u), vt.releasePrimitive(t);
|
|
372
372
|
}
|
|
373
|
-
else if (v) if (x) C =
|
|
373
|
+
else if (v) if (x) C = U(e, f, n, r, i, a, o, s, c + 1, l, u);
|
|
374
374
|
else {
|
|
375
|
-
let t =
|
|
376
|
-
t.copy(
|
|
377
|
-
let l =
|
|
378
|
-
|
|
379
|
-
let h = t.intersectsBox(
|
|
380
|
-
C = h &&
|
|
375
|
+
let t = vt.getPrimitive();
|
|
376
|
+
t.copy(St).applyMatrix4(n);
|
|
377
|
+
let l = z(e), d = B(e, m);
|
|
378
|
+
F(V(l), p, yt), F(V(d), p, bt);
|
|
379
|
+
let h = t.intersectsBox(yt), g = t.intersectsBox(bt);
|
|
380
|
+
C = h && U(f, l, r, n, i, o, a, c, s + 1, t, !u) || g && U(f, d, r, n, i, o, a, c, s + 1, t, !u), vt.releasePrimitive(t);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
return C;
|
|
@@ -394,17 +394,17 @@ var Tt = new class {
|
|
|
394
394
|
this.root = null, this.buffer = e = null, this.uint16Array = n = null, this.uint32Array = t = null;
|
|
395
395
|
}, this.getRangeStart = (e) => {
|
|
396
396
|
let r = e * 2;
|
|
397
|
-
for (; !
|
|
398
|
-
return
|
|
397
|
+
for (; !I(r, n);) e = z(e), r = e * 2;
|
|
398
|
+
return L(e, t);
|
|
399
399
|
}, this.getRangeEnd = (e) => {
|
|
400
400
|
let r = e * 2;
|
|
401
|
-
for (; !
|
|
402
|
-
return
|
|
401
|
+
for (; !I(r, n);) e = B(e, t), r = e * 2;
|
|
402
|
+
return L(e, t) + R(r, n);
|
|
403
403
|
};
|
|
404
404
|
let i = (e, r, a) => {
|
|
405
|
-
let o =
|
|
405
|
+
let o = I(r * 2, n);
|
|
406
406
|
if (!e(a, o, r) && !o) {
|
|
407
|
-
let n =
|
|
407
|
+
let n = z(r), o = B(r, t);
|
|
408
408
|
i(e, n, a + 1), i(e, o, a + 1);
|
|
409
409
|
}
|
|
410
410
|
};
|
|
@@ -422,7 +422,7 @@ var Tt = new class {
|
|
|
422
422
|
let s = o * 2, c = t[o + 6], l = n[s + 14];
|
|
423
423
|
return r(i, a, new Float32Array(e, o * 4, 6), c, l);
|
|
424
424
|
} else {
|
|
425
|
-
let n =
|
|
425
|
+
let n = Ue(o, t);
|
|
426
426
|
return r(i, a, new Float32Array(e, o * 4, 6), n);
|
|
427
427
|
}
|
|
428
428
|
});
|
|
@@ -434,12 +434,12 @@ var Tt = new class {
|
|
|
434
434
|
}
|
|
435
435
|
init(e) {
|
|
436
436
|
e = {
|
|
437
|
-
...
|
|
437
|
+
...Le,
|
|
438
438
|
...e
|
|
439
439
|
}, "maxLeafSize" in e && (console.warn("BVH: \"maxLeafSize\" option has been deprecated. Use \"targetLeafSize\", instead."), e = {
|
|
440
440
|
...e,
|
|
441
441
|
targetLeafSize: e.maxLeafSize
|
|
442
|
-
}),
|
|
442
|
+
}), ct(this, e);
|
|
443
443
|
}
|
|
444
444
|
getRootRanges() {
|
|
445
445
|
throw Error("BVH: getRootRanges() not implemented");
|
|
@@ -461,7 +461,7 @@ var Tt = new class {
|
|
|
461
461
|
for (let i = e, a = e + t; i < a; i++) {
|
|
462
462
|
this.writePrimitiveBounds(i, Dt, 0);
|
|
463
463
|
let [e, t, a, o, s, c] = Dt, l = (e + o) / 2, u = (t + s) / 2, d = (a + c) / 2, f = (o - e) / 2, p = (s - t) / 2, m = (c - a) / 2, h = (i - r) * 6;
|
|
464
|
-
n[h + 0] = l, n[h + 1] = f + (Math.abs(l) + f) *
|
|
464
|
+
n[h + 0] = l, n[h + 1] = f + (Math.abs(l) + f) * Fe, n[h + 2] = u, n[h + 3] = p + (Math.abs(u) + p) * Fe, n[h + 4] = d, n[h + 5] = m + (Math.abs(d) + m) * Fe;
|
|
465
465
|
}
|
|
466
466
|
return n;
|
|
467
467
|
}
|
|
@@ -474,7 +474,7 @@ var Tt = new class {
|
|
|
474
474
|
let r = t[n], i = new Uint32Array(r), a = new Uint16Array(r), o = r.byteLength / 32;
|
|
475
475
|
for (let t = 0; t < o; t++) {
|
|
476
476
|
let n = 8 * t;
|
|
477
|
-
|
|
477
|
+
I(2 * n, a) && (i[n + 6] += e);
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
}
|
|
@@ -488,11 +488,11 @@ var Tt = new class {
|
|
|
488
488
|
let n = e[t], r = new Uint32Array(n), i = new Uint16Array(n), a = new Float32Array(n), o = n.byteLength / 32;
|
|
489
489
|
for (let e = o - 1; e >= 0; e--) {
|
|
490
490
|
let t = e * 8, n = t * 2;
|
|
491
|
-
if (
|
|
492
|
-
let e =
|
|
491
|
+
if (I(n, i)) {
|
|
492
|
+
let e = L(t, r), o = R(n, i);
|
|
493
493
|
this.writePrimitiveRangeBounds(e, o, Dt, 0), a.set(Dt, t);
|
|
494
494
|
} else {
|
|
495
|
-
let e =
|
|
495
|
+
let e = z(t), n = B(t, r);
|
|
496
496
|
for (let r = 0; r < 3; r++) {
|
|
497
497
|
let i = a[e + r], o = a[e + r + 3], s = a[n + r], c = a[n + r + 3];
|
|
498
498
|
a[t + r] = i < s ? i : s, a[t + r + 3] = o > c ? o : c;
|
|
@@ -503,7 +503,7 @@ var Tt = new class {
|
|
|
503
503
|
}
|
|
504
504
|
getBoundingBox(e) {
|
|
505
505
|
return e.makeEmpty(), this._roots.forEach((t) => {
|
|
506
|
-
|
|
506
|
+
F(0, new Float32Array(t), Et), e.union(Et);
|
|
507
507
|
}), e;
|
|
508
508
|
}
|
|
509
509
|
shapecast(e) {
|
|
@@ -515,14 +515,14 @@ var Tt = new class {
|
|
|
515
515
|
let s = !1, c = 0, l = this._roots;
|
|
516
516
|
for (let e = 0, i = l.length; e < i; e++) {
|
|
517
517
|
let i = l[e];
|
|
518
|
-
if (s =
|
|
518
|
+
if (s = mt(this, e, n, r, t, c), s) break;
|
|
519
519
|
c += i.byteLength / 32;
|
|
520
520
|
}
|
|
521
521
|
return s;
|
|
522
522
|
}
|
|
523
523
|
bvhcast(e, t, n) {
|
|
524
524
|
let { intersectsRanges: r } = n;
|
|
525
|
-
return
|
|
525
|
+
return wt(this, e, t, r);
|
|
526
526
|
}
|
|
527
527
|
};
|
|
528
528
|
//#endregion
|
|
@@ -617,9 +617,9 @@ var Rt = class extends Ot {
|
|
|
617
617
|
if (e.index && e.index.isInterleavedBufferAttribute) throw Error("BVH: InterleavedBufferAttribute is not supported for the index attribute.");
|
|
618
618
|
if (t.useSharedArrayBuffer && !kt()) throw Error("BVH: SharedArrayBuffer is not available.");
|
|
619
619
|
super(), this.geometry = e, this.resolvePrimitiveIndex = t.indirect ? (e) => this._indirectBuffer[e] : (e) => e, this.primitiveBuffer = null, this.primitiveBufferStride = null, this._indirectBuffer = null, t = {
|
|
620
|
-
...
|
|
620
|
+
...Le,
|
|
621
621
|
...t
|
|
622
|
-
}, t[
|
|
622
|
+
}, t[Ie] || this.init(t);
|
|
623
623
|
}
|
|
624
624
|
init(e) {
|
|
625
625
|
let { geometry: t, primitiveStride: n } = this;
|
|
@@ -1031,7 +1031,7 @@ K.prototype.update = (function() {
|
|
|
1031
1031
|
return Math.sqrt(p);
|
|
1032
1032
|
};
|
|
1033
1033
|
})();
|
|
1034
|
-
var q = /* @__PURE__ */ new class extends
|
|
1034
|
+
var q = /* @__PURE__ */ new class extends lt {
|
|
1035
1035
|
constructor() {
|
|
1036
1036
|
super(() => new G());
|
|
1037
1037
|
}
|
|
@@ -1155,15 +1155,15 @@ function hn(e, t = null) {
|
|
|
1155
1155
|
for (let e = 0, t = u.length; e < t; e++) a = u[e], o = new Uint32Array(a), s = new Uint16Array(a), c = new Float32Array(a), d(0, l), l += a.byteLength;
|
|
1156
1156
|
function d(e, n, a = !1) {
|
|
1157
1157
|
let l = e * 2;
|
|
1158
|
-
if (
|
|
1159
|
-
let t =
|
|
1158
|
+
if (I(l, s)) {
|
|
1159
|
+
let t = L(e, o), n = R(l, s), a = Infinity, u = Infinity, d = Infinity, f = -Infinity, p = -Infinity, m = -Infinity;
|
|
1160
1160
|
for (let e = 3 * t, o = 3 * (t + n); e < o; e++) {
|
|
1161
1161
|
let t = r[e], n = i.getX(t), o = i.getY(t), s = i.getZ(t);
|
|
1162
1162
|
n < a && (a = n), n > f && (f = n), o < u && (u = o), o > p && (p = o), s < d && (d = s), s > m && (m = s);
|
|
1163
1163
|
}
|
|
1164
1164
|
return c[e + 0] !== a || c[e + 1] !== u || c[e + 2] !== d || c[e + 3] !== f || c[e + 4] !== p || c[e + 5] !== m ? (c[e + 0] = a, c[e + 1] = u, c[e + 2] = d, c[e + 3] = f, c[e + 4] = p, c[e + 5] = m, !0) : !1;
|
|
1165
1165
|
} else {
|
|
1166
|
-
let r =
|
|
1166
|
+
let r = z(e), i = B(e, o), s = a, l = !1, u = !1;
|
|
1167
1167
|
if (t) {
|
|
1168
1168
|
if (!s) {
|
|
1169
1169
|
let e = r / 8 + n / 32, a = i / 8 + n / 32;
|
|
@@ -1214,15 +1214,15 @@ function yn(e, t, n, r, i, a, o) {
|
|
|
1214
1214
|
//#endregion
|
|
1215
1215
|
//#region ../../node_modules/three-mesh-bvh/src/core/cast/raycast.generated.js
|
|
1216
1216
|
function bn(e, t, n, r, i, a, o) {
|
|
1217
|
-
|
|
1217
|
+
H.setBuffer(e._roots[t]), xn(0, e, n, r, i, a, o), H.clearBuffer();
|
|
1218
1218
|
}
|
|
1219
1219
|
function xn(e, t, n, r, i, a, o) {
|
|
1220
|
-
let { float32Array: s, uint16Array: c, uint32Array: l } =
|
|
1221
|
-
if (
|
|
1220
|
+
let { float32Array: s, uint16Array: c, uint32Array: l } = H, u = e * 2;
|
|
1221
|
+
if (I(u, c)) fn(t, n, r, L(e, l), R(u, c), i, a, o);
|
|
1222
1222
|
else {
|
|
1223
|
-
let c =
|
|
1223
|
+
let c = z(e);
|
|
1224
1224
|
gn(c, s, r, a, o) && xn(c, t, n, r, i, a, o);
|
|
1225
|
-
let u =
|
|
1225
|
+
let u = B(e, l);
|
|
1226
1226
|
gn(u, s, r, a, o) && xn(u, t, n, r, i, a, o);
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
@@ -1234,16 +1234,16 @@ var Sn = [
|
|
|
1234
1234
|
"z"
|
|
1235
1235
|
];
|
|
1236
1236
|
function Cn(e, t, n, r, i, a) {
|
|
1237
|
-
|
|
1237
|
+
H.setBuffer(e._roots[t]);
|
|
1238
1238
|
let o = wn(0, e, n, r, i, a);
|
|
1239
|
-
return
|
|
1239
|
+
return H.clearBuffer(), o;
|
|
1240
1240
|
}
|
|
1241
1241
|
function wn(e, t, n, r, i, a) {
|
|
1242
|
-
let { float32Array: o, uint16Array: s, uint32Array: c } =
|
|
1243
|
-
if (
|
|
1242
|
+
let { float32Array: o, uint16Array: s, uint32Array: c } = H, l = e * 2;
|
|
1243
|
+
if (I(l, s)) return pn(t, n, r, L(e, c), R(l, s), i, a);
|
|
1244
1244
|
{
|
|
1245
|
-
let s =
|
|
1246
|
-
u ? (d =
|
|
1245
|
+
let s = Ue(e, c), l = Sn[s], u = r.direction[l] >= 0, d, f;
|
|
1246
|
+
u ? (d = z(e), f = B(e, c)) : (d = B(e, c), f = z(e));
|
|
1247
1247
|
let p = gn(d, o, r, i, a) ? wn(d, t, n, r, i, a) : null;
|
|
1248
1248
|
if (p) {
|
|
1249
1249
|
let e = p.point[l];
|
|
@@ -1257,15 +1257,15 @@ function wn(e, t, n, r, i, a) {
|
|
|
1257
1257
|
//#region ../../node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry.generated.js
|
|
1258
1258
|
var Tn = /* @__PURE__ */ new S(), En = /* @__PURE__ */ new G(), Dn = /* @__PURE__ */ new G(), On = /* @__PURE__ */ new E(), kn = /* @__PURE__ */ new K(), An = /* @__PURE__ */ new K();
|
|
1259
1259
|
function jn(e, t, n, r) {
|
|
1260
|
-
|
|
1260
|
+
H.setBuffer(e._roots[t]);
|
|
1261
1261
|
let i = Mn(0, e, n, r);
|
|
1262
|
-
return
|
|
1262
|
+
return H.clearBuffer(), i;
|
|
1263
1263
|
}
|
|
1264
1264
|
function Mn(e, t, n, r, i = null) {
|
|
1265
|
-
let { float32Array: a, uint16Array: o, uint32Array: s } =
|
|
1266
|
-
if (i === null && (n.boundingBox || n.computeBoundingBox(), kn.set(n.boundingBox.min, n.boundingBox.max, r), i = kn),
|
|
1267
|
-
let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p =
|
|
1268
|
-
if (On.copy(r).invert(), n.boundsTree) return
|
|
1265
|
+
let { float32Array: a, uint16Array: o, uint32Array: s } = H, c = e * 2;
|
|
1266
|
+
if (i === null && (n.boundingBox || n.computeBoundingBox(), kn.set(n.boundingBox.min, n.boundingBox.max, r), i = kn), I(c, o)) {
|
|
1267
|
+
let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p = L(e, s), m = R(c, o);
|
|
1268
|
+
if (On.copy(r).invert(), n.boundsTree) return F(V(e), a, An), An.matrix.copy(On), An.needsUpdate = !0, n.boundsTree.shapecast({
|
|
1269
1269
|
intersectsBounds: (e) => An.intersectsBox(e),
|
|
1270
1270
|
intersectsTriangle: (e) => {
|
|
1271
1271
|
e.a.applyMatrix4(r), e.b.applyMatrix4(r), e.c.applyMatrix4(r), e.needsUpdate = !0;
|
|
@@ -1281,8 +1281,8 @@ function Mn(e, t, n, r, i = null) {
|
|
|
1281
1281
|
}
|
|
1282
1282
|
}
|
|
1283
1283
|
} else {
|
|
1284
|
-
let o =
|
|
1285
|
-
return
|
|
1284
|
+
let o = z(e), c = B(e, s);
|
|
1285
|
+
return F(V(o), a, Tn), !!(i.intersectsBox(Tn) && Mn(o, t, n, r, i) || (F(V(c), a, Tn), i.intersectsBox(Tn) && Mn(c, t, n, r, i)));
|
|
1286
1286
|
}
|
|
1287
1287
|
}
|
|
1288
1288
|
//#endregion
|
|
@@ -1333,8 +1333,8 @@ function Vn(e, t = null) {
|
|
|
1333
1333
|
for (let e = 0, t = u.length; e < t; e++) a = u[e], o = new Uint32Array(a), s = new Uint16Array(a), c = new Float32Array(a), d(0, l), l += a.byteLength;
|
|
1334
1334
|
function d(n, a, l = !1) {
|
|
1335
1335
|
let u = n * 2;
|
|
1336
|
-
if (
|
|
1337
|
-
let t =
|
|
1336
|
+
if (I(u, s)) {
|
|
1337
|
+
let t = L(n, o), a = R(u, s), l = Infinity, d = Infinity, f = Infinity, p = -Infinity, m = -Infinity, h = -Infinity;
|
|
1338
1338
|
for (let n = t, o = t + a; n < o; n++) {
|
|
1339
1339
|
let t = 3 * e.resolveTriangleIndex(n);
|
|
1340
1340
|
for (let e = 0; e < 3; e++) {
|
|
@@ -1346,7 +1346,7 @@ function Vn(e, t = null) {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
return c[n + 0] !== l || c[n + 1] !== d || c[n + 2] !== f || c[n + 3] !== p || c[n + 4] !== m || c[n + 5] !== h ? (c[n + 0] = l, c[n + 1] = d, c[n + 2] = f, c[n + 3] = p, c[n + 4] = m, c[n + 5] = h, !0) : !1;
|
|
1348
1348
|
} else {
|
|
1349
|
-
let e =
|
|
1349
|
+
let e = z(n), r = B(n, o), i = l, s = !1, u = !1;
|
|
1350
1350
|
if (t) {
|
|
1351
1351
|
if (!i) {
|
|
1352
1352
|
let n = e / 8 + a / 32, o = r / 8 + a / 32;
|
|
@@ -1369,15 +1369,15 @@ function Vn(e, t = null) {
|
|
|
1369
1369
|
//#endregion
|
|
1370
1370
|
//#region ../../node_modules/three-mesh-bvh/src/core/cast/raycast_indirect.generated.js
|
|
1371
1371
|
function Hn(e, t, n, r, i, a, o) {
|
|
1372
|
-
|
|
1372
|
+
H.setBuffer(e._roots[t]), Un(0, e, n, r, i, a, o), H.clearBuffer();
|
|
1373
1373
|
}
|
|
1374
1374
|
function Un(e, t, n, r, i, a, o) {
|
|
1375
|
-
let { float32Array: s, uint16Array: c, uint32Array: l } =
|
|
1376
|
-
if (
|
|
1375
|
+
let { float32Array: s, uint16Array: c, uint32Array: l } = H, u = e * 2;
|
|
1376
|
+
if (I(u, c)) _n(t, n, r, L(e, l), R(u, c), i, a, o);
|
|
1377
1377
|
else {
|
|
1378
|
-
let c =
|
|
1378
|
+
let c = z(e);
|
|
1379
1379
|
gn(c, s, r, a, o) && Un(c, t, n, r, i, a, o);
|
|
1380
|
-
let u =
|
|
1380
|
+
let u = B(e, l);
|
|
1381
1381
|
gn(u, s, r, a, o) && Un(u, t, n, r, i, a, o);
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
@@ -1389,16 +1389,16 @@ var Wn = [
|
|
|
1389
1389
|
"z"
|
|
1390
1390
|
];
|
|
1391
1391
|
function Gn(e, t, n, r, i, a) {
|
|
1392
|
-
|
|
1392
|
+
H.setBuffer(e._roots[t]);
|
|
1393
1393
|
let o = Kn(0, e, n, r, i, a);
|
|
1394
|
-
return
|
|
1394
|
+
return H.clearBuffer(), o;
|
|
1395
1395
|
}
|
|
1396
1396
|
function Kn(e, t, n, r, i, a) {
|
|
1397
|
-
let { float32Array: o, uint16Array: s, uint32Array: c } =
|
|
1398
|
-
if (
|
|
1397
|
+
let { float32Array: o, uint16Array: s, uint32Array: c } = H, l = e * 2;
|
|
1398
|
+
if (I(l, s)) return vn(t, n, r, L(e, c), R(l, s), i, a);
|
|
1399
1399
|
{
|
|
1400
|
-
let s =
|
|
1401
|
-
u ? (d =
|
|
1400
|
+
let s = Ue(e, c), l = Wn[s], u = r.direction[l] >= 0, d, f;
|
|
1401
|
+
u ? (d = z(e), f = B(e, c)) : (d = B(e, c), f = z(e));
|
|
1402
1402
|
let p = gn(d, o, r, i, a) ? Kn(d, t, n, r, i, a) : null;
|
|
1403
1403
|
if (p) {
|
|
1404
1404
|
let e = p.point[l];
|
|
@@ -1412,15 +1412,15 @@ function Kn(e, t, n, r, i, a) {
|
|
|
1412
1412
|
//#region ../../node_modules/three-mesh-bvh/src/core/cast/intersectsGeometry_indirect.generated.js
|
|
1413
1413
|
var qn = /* @__PURE__ */ new S(), Jn = /* @__PURE__ */ new G(), Yn = /* @__PURE__ */ new G(), Xn = /* @__PURE__ */ new E(), Zn = /* @__PURE__ */ new K(), Qn = /* @__PURE__ */ new K();
|
|
1414
1414
|
function $n(e, t, n, r) {
|
|
1415
|
-
|
|
1415
|
+
H.setBuffer(e._roots[t]);
|
|
1416
1416
|
let i = er(0, e, n, r);
|
|
1417
|
-
return
|
|
1417
|
+
return H.clearBuffer(), i;
|
|
1418
1418
|
}
|
|
1419
1419
|
function er(e, t, n, r, i = null) {
|
|
1420
|
-
let { float32Array: a, uint16Array: o, uint32Array: s } =
|
|
1421
|
-
if (i === null && (n.boundingBox || n.computeBoundingBox(), Zn.set(n.boundingBox.min, n.boundingBox.max, r), i = Zn),
|
|
1422
|
-
let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p =
|
|
1423
|
-
if (Xn.copy(r).invert(), n.boundsTree) return
|
|
1420
|
+
let { float32Array: a, uint16Array: o, uint32Array: s } = H, c = e * 2;
|
|
1421
|
+
if (i === null && (n.boundingBox || n.computeBoundingBox(), Zn.set(n.boundingBox.min, n.boundingBox.max, r), i = Zn), I(c, o)) {
|
|
1422
|
+
let i = t.geometry, l = i.index, u = i.attributes.position, d = n.index, f = n.attributes.position, p = L(e, s), m = R(c, o);
|
|
1423
|
+
if (Xn.copy(r).invert(), n.boundsTree) return F(V(e), a, Qn), Qn.matrix.copy(Xn), Qn.needsUpdate = !0, n.boundsTree.shapecast({
|
|
1424
1424
|
intersectsBounds: (e) => Qn.intersectsBox(e),
|
|
1425
1425
|
intersectsTriangle: (e) => {
|
|
1426
1426
|
e.a.applyMatrix4(r), e.b.applyMatrix4(r), e.c.applyMatrix4(r), e.needsUpdate = !0;
|
|
@@ -1436,8 +1436,8 @@ function er(e, t, n, r, i = null) {
|
|
|
1436
1436
|
}
|
|
1437
1437
|
}
|
|
1438
1438
|
} else {
|
|
1439
|
-
let o =
|
|
1440
|
-
return
|
|
1439
|
+
let o = z(e), c = B(e, s);
|
|
1440
|
+
return F(V(o), a, qn), !!(i.intersectsBox(qn) && er(o, t, n, r, i) || (F(V(c), a, qn), i.intersectsBox(qn) && er(c, t, n, r, i)));
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
1443
|
//#endregion
|
|
@@ -1517,7 +1517,7 @@ var ur = /* @__PURE__ */ new K(), dr = /* @__PURE__ */ new a(), fr = /* @__PURE_
|
|
|
1517
1517
|
t.version || (console.warn("MeshBVH.deserialize: Serialization format has been changed and will be fixed up. It is recommended to regenerate any stored serialized data."), c(a));
|
|
1518
1518
|
let s = new e(n, {
|
|
1519
1519
|
...r,
|
|
1520
|
-
[
|
|
1520
|
+
[Ie]: !0
|
|
1521
1521
|
});
|
|
1522
1522
|
if (s._roots = a, s._indirectBuffer = o || null, r.setIndex) {
|
|
1523
1523
|
let e = n.getIndex();
|
|
@@ -1532,7 +1532,7 @@ var ur = /* @__PURE__ */ new K(), dr = /* @__PURE__ */ new a(), fr = /* @__PURE_
|
|
|
1532
1532
|
let n = e[t], r = new Uint32Array(n), i = new Uint16Array(n);
|
|
1533
1533
|
for (let e = 0, t = n.byteLength / 32; e < t; e++) {
|
|
1534
1534
|
let t = 8 * e;
|
|
1535
|
-
|
|
1535
|
+
I(2 * t, i) || (r[t + 6] = r[t + 6] / 8 - e);
|
|
1536
1536
|
}
|
|
1537
1537
|
}
|
|
1538
1538
|
}
|
|
@@ -1584,7 +1584,7 @@ var ur = /* @__PURE__ */ new K(), dr = /* @__PURE__ */ new a(), fr = /* @__PURE_
|
|
|
1584
1584
|
let u = r;
|
|
1585
1585
|
i > u && (u = i), o > u && (u = o);
|
|
1586
1586
|
let f = (u - l) / 2, g = e * 2;
|
|
1587
|
-
n[t + g + 0] = l + f, n[t + g + 1] = f + (Math.abs(l) + f) *
|
|
1587
|
+
n[t + g + 0] = l + f, n[t + g + 1] = f + (Math.abs(l) + f) * Fe;
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
1590
|
return n;
|
|
@@ -1850,8 +1850,8 @@ var Ar = /* @__PURE__ */ new n(), jr = /* @__PURE__ */ new n(), Mr = /* @__PURE_
|
|
|
1850
1850
|
if (!e.isMesh) throw Error("SkinnedMeshBVH: First argument must be a Mesh.");
|
|
1851
1851
|
super(e.geometry, {
|
|
1852
1852
|
...t,
|
|
1853
|
-
[
|
|
1854
|
-
}), this.mesh = e, t[
|
|
1853
|
+
[Ie]: !0
|
|
1854
|
+
}), this.mesh = e, t[Ie] || this.init(t);
|
|
1855
1855
|
}
|
|
1856
1856
|
writePrimitiveBounds(e, t, n) {
|
|
1857
1857
|
let { mesh: r, geometry: i } = this, a = this._indirectBuffer, o = i.index ? i.index.array : null, s = (a ? a[e] : e) * 3, c = s + 0, l = s + 1, u = s + 2;
|
|
@@ -2082,7 +2082,7 @@ function ci(e, t, n, r, i, a = !1) {
|
|
|
2082
2082
|
u += e, t += e;
|
|
2083
2083
|
}
|
|
2084
2084
|
o[h + 14] = t;
|
|
2085
|
-
} else s[m + 6] = d[f + 6] + t, o[h + 14] = i[p + 14], o[h + 15] =
|
|
2085
|
+
} else s[m + 6] = d[f + 6] + t, o[h + 14] = i[p + 14], o[h + 15] = Pe;
|
|
2086
2086
|
else s[m + 6] = d[f + 6], s[m + 7] = d[f + 7];
|
|
2087
2087
|
r++;
|
|
2088
2088
|
}
|
|
@@ -2214,7 +2214,7 @@ var yi = class extends ge {
|
|
|
2214
2214
|
for (let t in e) typeof e[t] == "string" && (e[t] = new fi(e[t]));
|
|
2215
2215
|
}
|
|
2216
2216
|
return e.call(...t);
|
|
2217
|
-
}, e), $ = (e, ...t) => xi(new yi(e, t)), Si = (e, ...t) => new bi(e, t), Ci =
|
|
2217
|
+
}, e), $ = (e, ...t) => xi(new yi(e, t)), Si = (e, ...t) => new bi(e, t), Ci = Ee(60);
|
|
2218
2218
|
//#endregion
|
|
2219
2219
|
//#region ../../node_modules/three-gpu-pathtracer/src/webgpu/lib/three-mesh-bvh/shapecastFns/getShapecastFn.js
|
|
2220
2220
|
function wi(e, t) {
|
|
@@ -2604,7 +2604,7 @@ function ki(e) {
|
|
|
2604
2604
|
//#endregion
|
|
2605
2605
|
//#region ../../node_modules/three-gpu-pathtracer/src/webgpu/lib/three-mesh-bvh/shapecastFns/getClosestPointToPointFn.js
|
|
2606
2606
|
function Ai(e) {
|
|
2607
|
-
let { index: t, attributes: n, transforms: r } = e.storage, i =
|
|
2607
|
+
let { index: t, attributes: n, transforms: r } = e.storage, i = Ce().toVar("bvh_toWorldMat");
|
|
2608
2608
|
return e.getShapecastFn({
|
|
2609
2609
|
name: "bvh_ClosestPointToPoint",
|
|
2610
2610
|
shapeStruct: "vec3f",
|
|
@@ -2786,7 +2786,7 @@ var Fi = class {
|
|
|
2786
2786
|
i.forEach((e, t) => {
|
|
2787
2787
|
Mi.copy(n.matrixWorld).invert(), this.writeTransformData(e, Mi, t, g);
|
|
2788
2788
|
});
|
|
2789
|
-
let _ =
|
|
2789
|
+
let _ = N(new me(new Uint32Array(h), 1), Yr).toReadOnly().setName("bvh_nodes"), v = N(new me(new Uint32Array(g), 1), t.transform).toReadOnly().setName("bvh_transforms"), y = N(new me(p, 1), "uint").toReadOnly().setName("bvh_index"), b = N(new me(new Uint32Array(m), l.getLength()), l).toReadOnly().setName("bvh_attributes");
|
|
2790
2790
|
this.storage.transforms = v, this.storage.nodes = _, this.storage.index = y, this.storage.attributes = b, this.structs.attributes = l, this.fns.sampleTrianglePoint = ki(this), this._bvhCache.clear();
|
|
2791
2791
|
}
|
|
2792
2792
|
writeTransformData(e, t, n, r) {
|
|
@@ -2844,7 +2844,7 @@ var Fi = class {
|
|
|
2844
2844
|
}
|
|
2845
2845
|
});
|
|
2846
2846
|
}
|
|
2847
|
-
}, Li =
|
|
2847
|
+
}, Li = P("\n fn sampleTexel( tex: texture_2d<f32>, coord: vec2f ) -> vec4f {\n\n // Manual bilinear filtering using textureLoad to support filterable float32 textures\n // on all devices\n let size = vec2f( textureDimensions( tex, 0 ) );\n let pxCoord = coord * size - 0.5;\n let px = vec2i( floor( pxCoord ) );\n let fr = fract( pxCoord );\n\n // get the four sibling samples\n let s00 = textureLoad( tex, clamp( px, vec2i( 0 ), vec2i( size ) - 1 ), 0 );\n let s10 = textureLoad( tex, clamp( px + vec2i( 1, 0 ), vec2i( 0 ), vec2i( size ) - 1 ), 0 );\n let s01 = textureLoad( tex, clamp( px + vec2i( 0, 1 ), vec2i( 0 ), vec2i( size ) - 1 ), 0 );\n let s11 = textureLoad( tex, clamp( px + vec2i( 1, 1 ), vec2i( 0 ), vec2i( size ) - 1 ), 0 );\n\n // interpolate on the x axis\n let y0 = mix( s00, s10, fr.x );\n let y1 = mix( s01, s11, fr.x );\n\n // then y\n return mix( y0, y1, fr.y );\n\n }\n"), Ri = class extends ye {
|
|
2848
2848
|
get texture() {
|
|
2849
2849
|
return this._texNode.value;
|
|
2850
2850
|
}
|
|
@@ -2877,13 +2877,13 @@ var Fi = class {
|
|
|
2877
2877
|
}
|
|
2878
2878
|
constructor(e) {
|
|
2879
2879
|
super();
|
|
2880
|
-
let t =
|
|
2880
|
+
let t = Me(new k());
|
|
2881
2881
|
this._texNode = t;
|
|
2882
|
-
let n =
|
|
2882
|
+
let n = Me(new k());
|
|
2883
2883
|
this._fromTexNode = n;
|
|
2884
|
-
let r = be(
|
|
2884
|
+
let r = De(be()), i = M(1);
|
|
2885
2885
|
this._transitionUniform = i;
|
|
2886
|
-
let a =
|
|
2886
|
+
let a = je(0, 1, $`
|
|
2887
2887
|
fn fade( uv: vec2f ) -> vec4f {
|
|
2888
2888
|
|
|
2889
2889
|
if ( ${i} <= 0.0 ) {
|
|
@@ -2904,7 +2904,7 @@ var Fi = class {
|
|
|
2904
2904
|
|
|
2905
2905
|
}
|
|
2906
2906
|
`(r));
|
|
2907
|
-
this._toneMapping = a, this.transparent = !0, this.colorNode =
|
|
2907
|
+
this._toneMapping = a, this.transparent = !0, this.colorNode = we(a.rgb, a.a), this.setValues(e);
|
|
2908
2908
|
}
|
|
2909
2909
|
}, zi = class {
|
|
2910
2910
|
get computeNode() {
|
|
@@ -2945,12 +2945,12 @@ var Fi = class {
|
|
|
2945
2945
|
return r.length = 3, r[0] = Math.ceil(e / i), r[1] = Math.ceil(t / a), r[2] = Math.ceil(n / o), r;
|
|
2946
2946
|
}
|
|
2947
2947
|
}, Bi = Te("\n\n struct PcgState {\n s0: vec4u,\n s1: vec4u,\n };\n\n var<private> g_state: PcgState;\n");
|
|
2948
|
-
|
|
2949
|
-
var Vi =
|
|
2950
|
-
|
|
2951
|
-
var Hi =
|
|
2948
|
+
P("\n fn pcgInitialize( pixelIndex: u32, pathIndex: u32, bounceIndex: u32 ) -> void {\n let pixel = vec2( ( pixelIndex >> 16 ) & 0xFF, pixelIndex & 0xFF );\n\n //white noise seed\n g_state.s0 = vec4u( pixel | vec2( bounceIndex << 16 ), pathIndex, pixel.x + pixel.y);\n\n //blue noise seed\n g_state.s1 = vec4u(pathIndex, pathIndex*15843, pathIndex*31 + 4566, pathIndex*2345 + 58585);\n\n }\n", [Bi]);
|
|
2949
|
+
var Vi = P("\n fn pcg4d(v: ptr<private, vec4u>) -> void {\n *v = *v * 1664525u + 1013904223u;\n *v = *v + v.yzxy * v.wxyz;\n *v = *v ^ (*v >> vec4u(16u));\n *v = *v + v.yzxy * v.wxyz;\n }\n");
|
|
2950
|
+
P("\n fn pcgRand( _id: u32 ) -> f32 {\n pcg4d(&g_state.s0);\n return abs( f32( g_state.s0.x ) / f32(0xffffffffu) );\n }\n", [Vi, Bi]), P("\n fn pcgRand2( _id: u32 ) -> vec2f {\n pcg4d(&g_state.s0);\n return abs( vec2f( g_state.s0.xy ) / f32(0xffffffffu) );\n }\n", [Vi, Bi]), P("\n fn pcgRand3( _id: u32 ) -> vec3f {\n pcg4d(&g_state.s0);\n return abs( vec3f( g_state.s0.xyz ) / f32(0xffffffffu) );\n }\n", [Vi, Bi]), P("\n fn pcgRand4( _id: u32 ) -> vec4f {\n pcg4d(&g_state.s0);\n return abs( vec4f( g_state.s0 ) / f32(0xffffffffu) );\n }\n", [Vi, Bi]), P("fn noop() -> void {}");
|
|
2951
|
+
var Hi = Ee(256 * 256), Ui = Ae(1 / 16777216), Wi = Te("\n\n const SOBOL_DIRECTIONS_1 = array<u32, 32>(\n 0x80000000u, 0xc0000000u, 0xa0000000u, 0xf0000000u,\n 0x88000000u, 0xcc000000u, 0xaa000000u, 0xff000000u,\n 0x80800000u, 0xc0c00000u, 0xa0a00000u, 0xf0f00000u,\n 0x88880000u, 0xcccc0000u, 0xaaaa0000u, 0xffff0000u,\n 0x80008000u, 0xc000c000u, 0xa000a000u, 0xf000f000u,\n 0x88008800u, 0xcc00cc00u, 0xaa00aa00u, 0xff00ff00u,\n 0x80808080u, 0xc0c0c0c0u, 0xa0a0a0a0u, 0xf0f0f0f0u,\n 0x88888888u, 0xccccccccu, 0xaaaaaaaau, 0xffffffffu\n );\n\n const SOBOL_DIRECTIONS_2 = array<u32, 32>(\n 0x80000000u, 0xc0000000u, 0x60000000u, 0x90000000u,\n 0xe8000000u, 0x5c000000u, 0x8e000000u, 0xc5000000u,\n 0x68800000u, 0x9cc00000u, 0xee600000u, 0x55900000u,\n 0x80680000u, 0xc09c0000u, 0x60ee0000u, 0x90550000u,\n 0xe8808000u, 0x5cc0c000u, 0x8e606000u, 0xc5909000u,\n 0x6868e800u, 0x9c9c5c00u, 0xeeee8e00u, 0x5555c500u,\n 0x8000e880u, 0xc0005cc0u, 0x60008e60u, 0x9000c590u,\n 0xe8006868u, 0x5c009c9cu, 0x8e00eeeeu, 0xc5005555u\n );\n\n const SOBOL_DIRECTIONS_3 = array<u32, 32>(\n 0x80000000u, 0xc0000000u, 0x20000000u, 0x50000000u,\n 0xf8000000u, 0x74000000u, 0xa2000000u, 0x93000000u,\n 0xd8800000u, 0x25400000u, 0x59e00000u, 0xe6d00000u,\n 0x78080000u, 0xb40c0000u, 0x82020000u, 0xc3050000u,\n 0x208f8000u, 0x51474000u, 0xfbea2000u, 0x75d93000u,\n 0xa0858800u, 0x914e5400u, 0xdbe79e00u, 0x25db6d00u,\n 0x58800080u, 0xe54000c0u, 0x79e00020u, 0xb6d00050u,\n 0x800800f8u, 0xc00c0074u, 0x200200a2u, 0x50050093u\n );\n\n const SOBOL_DIRECTIONS_4 = array<u32, 32>(\n 0x80000000u, 0x40000000u, 0x20000000u, 0xb0000000u,\n 0xf8000000u, 0xdc000000u, 0x7a000000u, 0x9d000000u,\n 0x5a800000u, 0x2fc00000u, 0xa1600000u, 0xf0b00000u,\n 0xda880000u, 0x6fc40000u, 0x81620000u, 0x40bb0000u,\n 0x22878000u, 0xb3c9c000u, 0xfb65a000u, 0xddb2d000u,\n 0x78022800u, 0x9c0b3c00u, 0x5a0fb600u, 0x2d0ddb00u,\n 0xa2878080u, 0xf3c9c040u, 0xdb65a020u, 0x6db2d0b0u,\n 0x800228f8u, 0x400b3cdcu, 0x200fb67au, 0xb00ddb9du\n );\n\n"), Gi = Ee(0).toVar("sobolPixelIndex"), Ki = Ee(0).toVar("sobolPathIndex"), qi = Ee(0).toVar("sobolBounceIndex"), Ji = P("\n\n fn getMaskedSobol( index: u32, directions: array<u32, 32> ) -> u32 {\n\n var X = 0u;\n for ( var bit = 0u; bit < 32u; bit ++ ) {\n\n let mask = ( index >> bit ) & 1u;\n X ^= mask * directions[ bit ];\n\n }\n return X;\n\n }\n\n"), Yi = (e = 1) => {
|
|
2952
2952
|
if (e <= 0) return;
|
|
2953
|
-
let t = e > 1 ? `vec${e}u` : "u32", n =
|
|
2953
|
+
let t = e > 1 ? `vec${e}u` : "u32", n = P(`
|
|
2954
2954
|
|
|
2955
2955
|
fn sobolReverseBits_${t}( in: ${t} ) -> ${t} {
|
|
2956
2956
|
|
|
@@ -2963,7 +2963,7 @@ var Hi = je(256 * 256), Ui = Ae(1 / 16777216), Wi = Te("\n\n const SOBOL_DIRECTI
|
|
|
2963
2963
|
|
|
2964
2964
|
}
|
|
2965
2965
|
|
|
2966
|
-
`), r =
|
|
2966
|
+
`), r = P(`
|
|
2967
2967
|
|
|
2968
2968
|
fn sobolHashCombine_${t}( seed: u32, v: ${t} ) -> ${t} {
|
|
2969
2969
|
|
|
@@ -2971,7 +2971,7 @@ var Hi = je(256 * 256), Ui = Ae(1 / 16777216), Wi = Te("\n\n const SOBOL_DIRECTI
|
|
|
2971
2971
|
|
|
2972
2972
|
}
|
|
2973
2973
|
|
|
2974
|
-
`), i =
|
|
2974
|
+
`), i = P(`
|
|
2975
2975
|
|
|
2976
2976
|
fn sobolLaineKarrasPermutation_${t}( in: ${t}, seed: ${t} ) -> ${t} {
|
|
2977
2977
|
|
|
@@ -3026,7 +3026,7 @@ var Hi = je(256 * 256), Ui = Ae(1 / 16777216), Wi = Te("\n\n const SOBOL_DIRECTI
|
|
|
3026
3026
|
|
|
3027
3027
|
}
|
|
3028
3028
|
|
|
3029
|
-
`, Qi =
|
|
3029
|
+
`, Qi = P("\n\n fn sobolHash( in: u32 ) -> u32 {\n\n var x = in;\n // finalizer from murmurhash3\n x ^= x >> 16;\n x *= 0x85ebca6bu;\n x ^= x >> 13;\n x *= 0xc2b2ae35u;\n x ^= x >> 16;\n return x;\n\n }\n\n"), $i = $`
|
|
3030
3030
|
|
|
3031
3031
|
fn sobolGetSeed( effect: u32 ) -> u32 {
|
|
3032
3032
|
|
|
@@ -3203,7 +3203,7 @@ var ra = $`
|
|
|
3203
3203
|
VdotNc: "float",
|
|
3204
3204
|
LdotNc: "float",
|
|
3205
3205
|
HdotNc: "float"
|
|
3206
|
-
}, "BxDFContext"), fa =
|
|
3206
|
+
}, "BxDFContext"), fa = P("\n\n fn inverse(m: mat3x3f) -> mat3x3f {\n var adj: mat3x3f;\n adj[0][0] = (m[1][1] * m[2][2] - m[2][1] * m[1][2]);\n adj[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);\n adj[2][0] = (m[1][0] * m[2][1] - m[2][0] * m[1][1]);\n adj[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]);\n adj[1][1] = (m[0][0] * m[2][2] - m[2][0] * m[0][2]);\n adj[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]);\n adj[0][2] = (m[0][1] * m[1][2] - m[1][1] * m[0][2]);\n adj[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]);\n adj[2][2] = (m[0][0] * m[1][1] - m[1][0] * m[0][1]);\n\n let det = ( m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])\n - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])\n + m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]));\n\n return adj * ( 1.0 / det );\n }\n\n"), pa = P("\n\n fn getBasisFromNormal( normal: vec3f ) -> mat3x3f {\n\n var other: vec3f;\n if ( abs( normal.x ) > 0.5 ) {\n\n other = vec3f( 0.0, 1.0, 0.0 );\n\n } else {\n\n other = vec3f( 1.0, 0.0, 0.0 );\n\n }\n\n let ortho = normalize( cross( normal, other ) );\n let ortho2 = normalize( cross( normal, ortho ) );\n return mat3x3f( ortho2, ortho, normal );\n\n }\n\n"), ma = P("\n\n fn iorToF0( ior: f32 ) -> f32 {\n return pow( ( 1 - ior ) / ( 1 + ior ), 2 );\n }\n\n"), ha = P("\n\n fn iorToF0General( transmittedIor: f32, incidentIor: f32 ) -> f32 {\n\n return pow( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ), 2 );\n\n }\n\n"), ga = P("\n\n fn iorToF0GeneralVec( transmittedIor: vec3f, incidentIor: vec3f ) -> vec3f {\n\n let v = ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor );\n return v * v;\n\n }\n\n"), _a = P("\n\n fn fresnel0ToIor( f0: vec3f ) -> vec3f {\n\n let sqrtF0 = sqrt( f0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\n }\n\n"), va = P("\n\n fn schlickFresnel( cosine: f32, f0: f32 ) -> f32 {\n\n return f0 + ( 1.0 - f0 ) * pow( 1.0 - cosine, 5.0 );\n\n }\n\n"), ya = P("\n\n fn schlickFresnelVec( cosine: f32, f0: vec3f, f90: vec3f ) -> vec3f {\n\n return f0 + ( f90 - f0 ) * pow( 1.0 - cosine, 5.0 );\n\n }\n\n"), ba = P("\n\n fn evaluateFresnel( cosine: f32, eta: f32, f0: vec3f, f90: vec3f ) -> vec3f {\n\n if ( totalInternalReflection( cosine, eta ) ) {\n\n return f90;\n\n }\n\n return f0 + ( f90 - f0 ) * pow( 1.0 - cosine, 5.0 );\n }\n\n", [P("\n\n fn totalInternalReflection( cosTheta: f32, eta: f32 ) -> bool {\n\n let sinTheta = sqrt( 1.0 - cosTheta * cosTheta );\n return eta * sinTheta > 1.0;\n\n }\n\n")]), xa = P("\n\n fn isTerminatingScatter( scatterRec: ScatterRecord ) -> bool {\n return scatterRec.pdf <= 0;\n }\n\n", [oa]), Sa = P("\n\n fn applyWrap( v: f32, wrapMode: i32 ) -> f32 {\n\n var res = v;\n if ( wrapMode == 1 ) {\n\n // ClampToEdge\n res = clamp( res, 0.0, 1.0 );\n\n } else if ( wrapMode == 2 ) {\n\n // MirroredRepeat\n res = 1.0 - abs( 2.0 * fract( res * 0.5 ) - 1.0 );\n\n } else {\n\n // Repeat\n res = fract( res );\n\n }\n\n return res;\n\n }\n\n"), Ca = (e, t, n) => $`
|
|
3207
3207
|
|
|
3208
3208
|
fn sampleTexel( uv: vec2f, packed: i32, lod: f32 ) -> vec4f {
|
|
3209
3209
|
|
|
@@ -3247,41 +3247,41 @@ var ra = $`
|
|
|
3247
3247
|
}
|
|
3248
3248
|
|
|
3249
3249
|
}
|
|
3250
|
-
`, wa =
|
|
3250
|
+
`, wa = P("\n\n fn diffuseDirection( wo: vec3f, uv: vec2f ) -> vec3f {\n\n var lightDirection = sampleSphere( uv );\n lightDirection.z += 1.0;\n lightDirection = normalize( lightDirection );\n\n return lightDirection;\n\n }\n\n", [P("\n\n fn sampleSphere( uv: vec2f ) -> vec3f {\n\n let u = ( uv.x - 0.5 ) * 2.0;\n let t = uv.y * PI * 2.0;\n let f = sqrt( 1.0 - u * u );\n\n return vec3f( f * cos( t ), f * sin( t ), u );\n\n }\n\n", [aa])]), Ta = P("\n\n fn getLobeWeights(wo: vec3f, woClearcoat: vec3f, wh: vec3f, clearcoatIor: f32, surf: SurfaceRecord) -> LobeWeights {\n\n // TODO: experiment with this; I don't see any usage of normal?\n let metalness = surf.metalness;\n let transmission = surf.transmission;\n let HdotL = dot( wh, wo );\n let fEstimate = evaluateFresnel( HdotL, surf.eta, vec3f( surf.f0 ), vec3f( 1.0 ) ).x;\n\n let transSpecularProb = mix( max( 0.25, fEstimate ), 1.0, metalness );\n let diffSpecularProb = 0.5 + 0.5 * metalness;\n\n var weights: LobeWeights;\n weights.diffuse = ( 1.0 - transmission ) * ( 1.0 - diffSpecularProb );\n weights.specular = transmission * transSpecularProb + ( 1.0 - transmission ) * diffSpecularProb;\n\n let clearcoatF0 = iorToF0( clearcoatIor );\n let clearcoatFresnel = schlickFresnel( saturate( woClearcoat.z ), clearcoatF0 );\n weights.clearcoat = surf.clearcoat * clearcoatFresnel;\n\n weights.transmission = transmission * ( 1.0 - transSpecularProb );\n\n let totalWeight = weights.diffuse + weights.specular;\n if ( totalWeight > 0 ) {\n weights.diffuse = ( weights.diffuse / totalWeight ) * ( 1 - weights.clearcoat );\n weights.specular = ( weights.specular / totalWeight ) * ( 1 - weights.clearcoat );\n }\n // weights.transmission /= totalWeight;\n\n return weights;\n\n }\n\n", [
|
|
3251
3251
|
va,
|
|
3252
3252
|
ma,
|
|
3253
3253
|
ba,
|
|
3254
3254
|
ua,
|
|
3255
3255
|
aa
|
|
3256
|
-
]), Ea =
|
|
3257
|
-
|
|
3258
|
-
|
|
3256
|
+
]), Ea = P("\n\n fn sampleEnvironment(\n envMap: texture_2d<f32>,\n envMapSampler: sampler,\n env: EnvironmentInfo,\n direction: vec3f,\n uv: vec2f,\n ) -> vec4f {\n\n let offsetDir = sampleHemisphere( direction, uv ) * 0.5 * env.blur;\n let sampleDir = normalize( env.rotation * direction + offsetDir );\n let col = sampleEquirectColor( envMap, envMapSampler, sampleDir );\n\n return vec4f( env.intensity * col.rgb, col.a );\n\n }\n\n", [
|
|
3257
|
+
P("\n\n fn sampleEquirectColor( envMap: texture_2d<f32>, envMapSampler: sampler, direction: vec3f ) -> vec4f {\n\n return textureSampleLevel( envMap, envMapSampler, equirectDirectionToUv( direction ), 0 );\n\n }\n\n", [P("\n\n fn equirectDirectionToUv(direction: vec3f) -> vec2f {\n\n // from Spherical.setFromCartesianCoords\n var uv = vec2f( atan2( direction.z, direction.x ), acos( direction.y ) );\n uv /= vec2f( 2.0 * PI, PI );\n\n // apply adjustments to get values in range [0, 1] and y right side up\n uv.x += 0.5;\n uv.y = 1.0 - uv.y;\n return uv;\n\n }\n\n")]),
|
|
3258
|
+
P("\n\n fn sampleHemisphere( n: vec3f, uv: vec2f ) -> vec3f {\n\n // https://www.rorydriscoll.com/2009/01/07/better-sampling/\n // https://graphics.pixar.com/library/OrthonormalB/paper.pdf\n let sign = select( sign( n.z ), 1.0, n.z == 0.0 );\n let a = - 1.0 / ( sign + n.z );\n let b = n.x * n.y * a;\n let b1 = vec3( 1.0 + sign * n.x * n.x * a, sign * b, - sign * n.x );\n let b2 = vec3( b, sign + n.y * n.y * a, - n.y );\n\n let r = sqrt( uv.x );\n let theta = 2.0 * PI * uv.y;\n let x = r * cos( theta );\n let y = r * sin( theta );\n return x * b1 + y * b2 + sqrt( 1.0 - uv.x ) * n;\n\n }\n\n", [aa]),
|
|
3259
3259
|
la
|
|
3260
|
-
]), Da =
|
|
3260
|
+
]), Da = P("\n\n fn weightedAlphaBlend( prevColor: vec4f, newColor: vec4f, weight: f32 ) -> vec4f {\n\n let invWeight = 1.0 - weight;\n let totalAlpha = prevColor.a * invWeight + newColor.a * weight;\n var blendedColor = vec4f( 0 );\n if ( totalAlpha != 0.0 ) {\n\n let prevContrib = prevColor.rgb * invWeight * prevColor.a / totalAlpha;\n let resContrib = newColor.rgb * weight * newColor.a / totalAlpha;\n blendedColor = vec4f( prevContrib + resContrib, totalAlpha );\n\n }\n\n return blendedColor;\n\n }\n\n"), Oa = class extends zi {
|
|
3261
3261
|
constructor() {
|
|
3262
3262
|
let e = {
|
|
3263
3263
|
bvhData: { value: null },
|
|
3264
3264
|
material: { value: null },
|
|
3265
|
-
prevOutputTarget:
|
|
3266
|
-
outputTarget:
|
|
3267
|
-
sampleCountTarget:
|
|
3268
|
-
offset:
|
|
3269
|
-
tileSize:
|
|
3270
|
-
seed:
|
|
3271
|
-
bounces:
|
|
3272
|
-
inverseProjectionMatrix:
|
|
3273
|
-
cameraToModelMatrix:
|
|
3274
|
-
envMap:
|
|
3275
|
-
envMapSampler:
|
|
3276
|
-
envMapRotation:
|
|
3277
|
-
envMapIntensity:
|
|
3278
|
-
background:
|
|
3279
|
-
backgroundSampler:
|
|
3280
|
-
backgroundRotation:
|
|
3281
|
-
backgroundIntensity:
|
|
3282
|
-
backgroundBlurriness:
|
|
3283
|
-
textures:
|
|
3284
|
-
textureSampler:
|
|
3265
|
+
prevOutputTarget: j(new k(1, 1)).toReadOnly(),
|
|
3266
|
+
outputTarget: j(new k(1, 1)).toWriteOnly(),
|
|
3267
|
+
sampleCountTarget: j(new k(1, 1)).toReadWrite(),
|
|
3268
|
+
offset: M(new f()),
|
|
3269
|
+
tileSize: M(new f()),
|
|
3270
|
+
seed: M(0),
|
|
3271
|
+
bounces: M(5),
|
|
3272
|
+
inverseProjectionMatrix: M(new E()),
|
|
3273
|
+
cameraToModelMatrix: M(new E()),
|
|
3274
|
+
envMap: Me(new h()),
|
|
3275
|
+
envMapSampler: ke(new h()),
|
|
3276
|
+
envMapRotation: M(new ae()),
|
|
3277
|
+
envMapIntensity: M(1),
|
|
3278
|
+
background: Me(new h()),
|
|
3279
|
+
backgroundSampler: ke(new h()),
|
|
3280
|
+
backgroundRotation: M(new ae()),
|
|
3281
|
+
backgroundIntensity: M(1),
|
|
3282
|
+
backgroundBlurriness: M(0),
|
|
3283
|
+
textures: Me(new h()),
|
|
3284
|
+
textureSampler: ke(new h()),
|
|
3285
3285
|
globalId: Oe
|
|
3286
3286
|
}, t = ni("bvhData.value.fns.raycastFirstHit.outputType", e), n = ri("bvhData.value.fns.raycastFirstHit", e), r = ri("bvhData.value.fns.sampleTrianglePoint", e), i = ri("bvhData.value.fns.getSurfaceRecord", e), a = ri("material.value.bsdfSample", e), o = $`
|
|
3287
3287
|
|
|
@@ -3533,7 +3533,7 @@ var Na = class {
|
|
|
3533
3533
|
constructor() {
|
|
3534
3534
|
let e = {
|
|
3535
3535
|
globalId: Oe,
|
|
3536
|
-
outputTarget:
|
|
3536
|
+
outputTarget: j(new k(1, 1)).toWriteOnly()
|
|
3537
3537
|
}, t = $`
|
|
3538
3538
|
fn compute( globalId: vec3u ) -> void {
|
|
3539
3539
|
|
|
@@ -3635,14 +3635,14 @@ var Na = class {
|
|
|
3635
3635
|
}, "QueuedHit"), za = class extends zi {
|
|
3636
3636
|
constructor() {
|
|
3637
3637
|
let e = {
|
|
3638
|
-
rayWorkGroupSize:
|
|
3639
|
-
tileSize:
|
|
3640
|
-
tileCount:
|
|
3641
|
-
tileOffset:
|
|
3642
|
-
rayQueue:
|
|
3643
|
-
queueSizes:
|
|
3644
|
-
outputTileIndex:
|
|
3645
|
-
outputDispatch:
|
|
3638
|
+
rayWorkGroupSize: M(new n()),
|
|
3639
|
+
tileSize: M(new f()),
|
|
3640
|
+
tileCount: M(new f()),
|
|
3641
|
+
tileOffset: M(1),
|
|
3642
|
+
rayQueue: N(new A(1, La.getLength()), La).toReadOnly(),
|
|
3643
|
+
queueSizes: N(new A(4, 1), "u32"),
|
|
3644
|
+
outputTileIndex: N(new A(2, 1), "u32").setName("outputTileIndex"),
|
|
3645
|
+
outputDispatch: N(new A(3, 1), "u32").setName("outputDispatch")
|
|
3646
3646
|
}, t = $`
|
|
3647
3647
|
fn compute(
|
|
3648
3648
|
rayWorkGroupSize: vec3u,
|
|
@@ -3710,14 +3710,14 @@ var Na = class {
|
|
|
3710
3710
|
}, Ba = class extends zi {
|
|
3711
3711
|
constructor() {
|
|
3712
3712
|
let e = {
|
|
3713
|
-
cameraToModelMatrix:
|
|
3714
|
-
inverseProjectionMatrix:
|
|
3715
|
-
seed:
|
|
3716
|
-
tileIndexBuffer:
|
|
3717
|
-
tileSize:
|
|
3718
|
-
rayQueue:
|
|
3719
|
-
queueSizes:
|
|
3720
|
-
sampleCountTarget:
|
|
3713
|
+
cameraToModelMatrix: M(new E()),
|
|
3714
|
+
inverseProjectionMatrix: M(new E()),
|
|
3715
|
+
seed: M(0),
|
|
3716
|
+
tileIndexBuffer: N(new A(2, 1), "u32"),
|
|
3717
|
+
tileSize: M(new f()),
|
|
3718
|
+
rayQueue: N(new A(1, La.getLength()), La),
|
|
3719
|
+
queueSizes: N(new A(4, 1), "u32").toAtomic(),
|
|
3720
|
+
sampleCountTarget: j(new k()).toReadWrite(),
|
|
3721
3721
|
globalId: Oe
|
|
3722
3722
|
}, t = $`
|
|
3723
3723
|
fn compute(
|
|
@@ -3798,21 +3798,21 @@ var Na = class {
|
|
|
3798
3798
|
constructor() {
|
|
3799
3799
|
let e = {
|
|
3800
3800
|
bvhData: { value: null },
|
|
3801
|
-
prevOutputTarget:
|
|
3802
|
-
outputTarget:
|
|
3803
|
-
sampleCountTarget:
|
|
3804
|
-
rayQueue:
|
|
3805
|
-
hitQueue:
|
|
3806
|
-
queueSizes:
|
|
3807
|
-
envMap:
|
|
3808
|
-
envMapSampler:
|
|
3809
|
-
envMapRotation:
|
|
3810
|
-
envMapIntensity:
|
|
3811
|
-
background:
|
|
3812
|
-
backgroundSampler:
|
|
3813
|
-
backgroundRotation:
|
|
3814
|
-
backgroundIntensity:
|
|
3815
|
-
backgroundBlurriness:
|
|
3801
|
+
prevOutputTarget: j(new k(1, 1)).toReadOnly(),
|
|
3802
|
+
outputTarget: j(new k(1, 1)).toWriteOnly(),
|
|
3803
|
+
sampleCountTarget: j(new k(1, 1)).toReadWrite(),
|
|
3804
|
+
rayQueue: N(new A(1, La.getLength()), La).toReadOnly(),
|
|
3805
|
+
hitQueue: N(new A(1, Ra.getLength()), Ra),
|
|
3806
|
+
queueSizes: N(new A(4, 1), "u32").toAtomic(),
|
|
3807
|
+
envMap: Me(new h()),
|
|
3808
|
+
envMapSampler: ke(new h()),
|
|
3809
|
+
envMapRotation: M(new ae()),
|
|
3810
|
+
envMapIntensity: M(1),
|
|
3811
|
+
background: Me(new h()),
|
|
3812
|
+
backgroundSampler: ke(new h()),
|
|
3813
|
+
backgroundRotation: M(new ae()),
|
|
3814
|
+
backgroundIntensity: M(1),
|
|
3815
|
+
backgroundBlurriness: M(0),
|
|
3816
3816
|
globalId: Oe
|
|
3817
3817
|
}, t = ni("bvhData.value.fns.raycastFirstHit.outputType", e), n = ni("bvhData.value.fns.raycastFirstHit", e), r = $`
|
|
3818
3818
|
|
|
@@ -3914,8 +3914,8 @@ var Na = class {
|
|
|
3914
3914
|
}, Ha = class extends zi {
|
|
3915
3915
|
constructor() {
|
|
3916
3916
|
let e = {
|
|
3917
|
-
processed:
|
|
3918
|
-
queueSizes:
|
|
3917
|
+
processed: M(0),
|
|
3918
|
+
queueSizes: N(new A(4, 1), "u32")
|
|
3919
3919
|
}, t = $`
|
|
3920
3920
|
fn compute( processed: u32 ) -> void {
|
|
3921
3921
|
|
|
@@ -3939,7 +3939,7 @@ var Na = class {
|
|
|
3939
3939
|
constructor(e = {}) {
|
|
3940
3940
|
let { type: t = "u32" } = e, n = {
|
|
3941
3941
|
globalId: Oe,
|
|
3942
|
-
outputTarget:
|
|
3942
|
+
outputTarget: N(new A(1, 1), t)
|
|
3943
3943
|
}, r = $`
|
|
3944
3944
|
fn compute( globalId: vec3u ) -> void {
|
|
3945
3945
|
|
|
@@ -3954,16 +3954,16 @@ var Na = class {
|
|
|
3954
3954
|
let e = {
|
|
3955
3955
|
bvhData: { value: null },
|
|
3956
3956
|
material: { value: null },
|
|
3957
|
-
prevOutputTarget:
|
|
3958
|
-
outputTarget:
|
|
3959
|
-
sampleCountTarget:
|
|
3960
|
-
smoothNormals:
|
|
3961
|
-
bounces:
|
|
3962
|
-
rayQueue:
|
|
3963
|
-
hitQueue:
|
|
3964
|
-
queueSizes:
|
|
3965
|
-
textures:
|
|
3966
|
-
textureSampler:
|
|
3957
|
+
prevOutputTarget: j(new k(1, 1)).toReadOnly(),
|
|
3958
|
+
outputTarget: j(new k(1, 1)).toWriteOnly(),
|
|
3959
|
+
sampleCountTarget: j(new k(1, 1)).toReadWrite(),
|
|
3960
|
+
smoothNormals: M(1),
|
|
3961
|
+
bounces: M(1),
|
|
3962
|
+
rayQueue: N(new A(1, La.getLength()), La),
|
|
3963
|
+
hitQueue: N(new A(1, Ra.getLength()), Ra),
|
|
3964
|
+
queueSizes: N(new A(4, 1), "u32").toAtomic(),
|
|
3965
|
+
textures: Me(new h()),
|
|
3966
|
+
textureSampler: ke(new h()),
|
|
3967
3967
|
globalId: Oe
|
|
3968
3968
|
}, t = ri("bvhData.value.fns.sampleTrianglePoint", e), n = ri("bvhData.value.fns.getSurfaceRecord", e), r = ri("material.value.bsdfSample", e), i = $`
|
|
3969
3969
|
|
|
@@ -4162,18 +4162,18 @@ function $a(e) {
|
|
|
4162
4162
|
}
|
|
4163
4163
|
//#endregion
|
|
4164
4164
|
//#region ../../node_modules/three-gpu-pathtracer/src/webgpu/nodes/ggx.wgsl.js
|
|
4165
|
-
var eo = j("\n\n fn ggxDirection( incidentDir: vec3f, alpha: vec2f, uv: vec2f ) -> vec3f {\n\n // Implementation from reference [1]\n // stretch view\n let V = normalize( vec3f( alpha * incidentDir.xy, incidentDir.z ) );\n\n // orthonormal basis\n var T1: vec3f;\n if ( V.z < 0.9999 ) {\n T1 = normalize( cross( V, vec3( 0.0, 0.0, 1.0 ) ) );\n } else {\n T1 = vec3( 1.0, 0.0, 0.0 );\n }\n\n let T2 = cross( T1, V );\n\n // sample point with polar coordinates (r, phi)\n let a = 1.0 / ( 1.0 + V.z );\n let r = sqrt( uv.x );\n var phi: f32;\n if ( uv.y < a ) {\n phi = uv.y / a * PI;\n } else {\n phi = PI + ( uv.y - a ) / ( 1.0 - a ) * PI;\n }\n let P1 = r * cos( phi );\n var P2 = r * sin( phi );\n if ( uv.y >= a ) {\n P2 *= V.z;\n }\n\n // compute normal\n var N = P1 * T1 + P2 * T2 + V * sqrt( max( 0.0, 1.0 - P1 * P1 - P2 * P2 ) );\n\n // unstretch\n N = normalize( vec3( alpha * N.xy, max( 0.0, N.z ) ) );\n\n return N;\n\n }\n\n", [aa]), to = j("\n\n fn ggxLamda( theta: f32, alpha: f32 ) -> f32 {\n\n let tanTheta = tan( theta );\n let tanTheta2 = tanTheta * tanTheta;\n let alpha2 = alpha * alpha;\n\n let numerator = - 1.0 + sqrt( 1.0 + alpha2 * tanTheta2 );\n return numerator / 2.0;\n\n }\n\n"), no = j("\n\n fn ggxShadowMaskG1( cosTheta: f32, alpha: f32 ) -> f32 {\n\n let a2 = alpha * alpha;\n let cosTheta2 = cosTheta * cosTheta;\n let denom = cosTheta + sqrt( cosTheta2 * ( 1 - a2 ) + a2 );\n return 2.0 * cosTheta / denom;\n\n }\n\n", [to]), ro = j("\n\n fn ggxSmithVisibility( NdotV: f32, NdotL: f32, alpha: f32 ) -> f32 {\n\n // Original formulation of G_SmithGGX Correlated\n // lambda_v = ( -1 + sqrt ( alphaG2 * (1 - NdotL2 ) / NdotL2 + 1)) * 0.5 f;\n // lambda_l = ( -1 + sqrt ( alphaG2 * (1 - NdotV2 ) / NdotV2 + 1)) * 0.5 f;\n // G_SmithGGXCorrelated = 1 / (1 + lambda_v + lambda_l );\n // V_SmithGGXCorrelated = G_SmithGGXCorrelated / (4.0 f * NdotL * NdotV );\n\n // This is an optimized version\n let alpha2 = alpha * alpha;\n // Caution: the \"NdotL *\" and \"NdotV *\" are explicitely inversed , this is not a mistake.\n let Lambda_GGXV = NdotL * sqrt (( - NdotV * alpha2 + NdotV ) * NdotV + alpha2 );\n let Lambda_GGXL = NdotV * sqrt (( - NdotL * alpha2 + NdotL ) * NdotL + alpha2 );\n\n return 0.5 / ( Lambda_GGXV + Lambda_GGXL );\n\n }\n\n", [to]), io = j("\n fn ggxDistribution( NdotH: f32, alpha: f32 ) -> f32 {\n\n let a2 = max( alpha * alpha, EPSILON );\n let denom = NdotH * NdotH * ( a2 - 1 ) + 1;\n\n return ( a2 / ( PI * denom * denom ) );\n\n }\n"), ao = j("\n fn ggxReflectionAdjustedPDF( NdotV: f32, NdotH: f32, alpha: f32 ) -> f32 {\n\n let D = ggxDistribution( NdotH, alpha );\n let G1 = ggxShadowMaskG1( NdotV, alpha );\n\n return D * G1 / ( 4 * NdotV );\n\n }\n", [io, no]), oo = (e) => j("\n\n fn getSurfaceRecord(\n material: Material,\n vertexData: bvh_GeometryStruct,\n side: f32,\n faceNormal: vec3f,\n ) -> SurfaceRecord {\n let uv = vertexData.uv.xy;\n\n var normal = faceNormal * side;\n if ( material.flatShading == 0 ) {\n\n normal = vertexData.normal.xyz;\n\n }\n normal = normalize( normal );\n let baseNormal = normal;\n\n if ( material.normalMap != -1 ) {\n\n // some provided tangents can be malformed (0, 0, 0) causing the normal to be degenerate\n // resulting in NaNs and slow path tracing.\n if ( length( vertexData.tangent.xyz ) > 0.0 && vertexData.tangent.w != 0.0 ) {\n\n let tangent = normalize( vertexData.tangent.xyz );\n let bitangent = normalize( cross( baseNormal, tangent ) * vertexData.tangent.w );\n let vTBN = mat3x3f( tangent, bitangent, baseNormal );\n\n let uvPrime = material.normalMapTransform * vec3( uv, 1.0 );\n var texNormal = sampleTexel( uvPrime.xy, material.normalMap, 0 ).xyz;\n texNormal = texNormal * 2.0 - 1.0;\n texNormal = texNormal * vec3f( material.normalScale, 1.0 );\n normal = normalize( vTBN * texNormal );\n\n }\n\n }\n\n normal *= side;\n\n var albedo = vec4( material.color, material.opacity );\n\n if ( material.vertexColors == 1 ) {\n\n let vertexColor = vertexData.color.xyz;\n albedo *= vec4f( vertexColor, 1.0 );\n\n }\n\n if ( material.map != -1 ) {\n\n let uvPrime = material.mapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.map, 0 );\n albedo *= vec4f( texColor.rgb, 1.0 );\n\n }\n\n var roughness = material.roughness;\n if ( material.roughnessMap != -1 ) {\n\n let uvPrime = material.roughnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.roughnessMap, 0 );\n roughness *= texColor.g;\n\n }\n\n var metalness = material.metalness;\n if ( material.metalnessMap != -1 ) {\n\n let uvPrime = material.metalnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.metalnessMap, 0 );\n metalness *= texColor.b;\n\n }\n\n var emission = material.emissiveIntensity * material.emissive;\n if ( material.emissiveMap != -1 ) {\n\n let uvPrime = material.emissiveMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.emissiveMap, 0 );\n emission *= texColor.rgb;\n\n }\n\n var transmission = material.transmission;\n if ( material.transmissionMap != -1 ) {\n\n let uvPrime = material.transmissionMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.transmissionMap, 0 );\n transmission *= texColor.r;\n\n }\n\n var clearcoat = material.clearcoat;\n if ( material.clearcoatMap != -1 ) {\n\n let uvPrime = material.clearcoatMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.clearcoatMap, 0 );\n clearcoat *= texColor.r;\n\n }\n\n var clearcoatRoughness = material.clearcoatRoughness;\n if ( material.clearcoatRoughnessMap != -1 ) {\n\n let uvPrime = material.clearcoatRoughnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.clearcoatRoughnessMap, 0 );\n clearcoatRoughness *= texColor.g;\n\n }\n\n var clearcoatNormal = baseNormal;\n if ( material.clearcoatNormalMap != -1 ) {\n\n // some provided tangents can be malformed (0, 0, 0) causing the normal to be degenerate\n // resulting in NaNs and slow path tracing.\n if ( length( vertexData.tangent.xyz ) > 0.0 && vertexData.tangent.w != 0.0 ) {\n\n let tangent = normalize( vertexData.tangent.xyz );\n let bitangent = normalize( cross( baseNormal, tangent ) * vertexData.tangent.w );\n let vTBN = mat3x3f( tangent, bitangent, baseNormal );\n\n let uvPrime = material.clearcoatNormalMapTransform * vec3( uv, 1.0 );\n var texNormal = sampleTexel( uvPrime.xy, material.clearcoatNormalMap, 0 ).xyz;\n texNormal = texNormal * 2.0 - 1.0;\n texNormal = texNormal * vec3f( material.clearcoatNormalScale, 1.0 );\n clearcoatNormal = normalize( vTBN * texNormal );\n\n }\n\n }\n clearcoatNormal *= side;\n\n var sheenColor = material.sheenColor;\n if ( material.sheenColorMap != -1 ) {\n\n let uvPrime = material.sheenColorMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.sheenColorMap, 0 );\n sheenColor *= texColor.rgb;\n\n }\n\n var sheenRoughness = material.sheenRoughness;\n if ( material.sheenRoughnessMap != -1 ) {\n\n let uvPrime = material.sheenRoughnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.sheenRoughnessMap, 0 );\n sheenRoughness *= texColor.r;\n\n }\n\n var iridescence = material.iridescence;\n if ( material.iridescenceMap != -1 ) {\n\n let uvPrime = material.iridescenceMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.iridescenceMap, 0 );\n iridescence *= texColor.r;\n\n }\n\n var iridescenceThickness = material.iridescenceThicknessMaximum;\n if ( material.iridescenceThicknessMap != -1 ) {\n\n let uvPrime = material.iridescenceThicknessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.iridescenceThicknessMap, 0 );\n\n iridescenceThickness = mix(\n material.iridescenceThicknessMinimum,\n material.iridescenceThicknessMaximum,\n texColor.g,\n );\n\n }\n\n var specularColor = material.specularColor;\n if ( material.specularColorMap != -1 ) {\n\n let uvPrime = material.specularColorMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.specularColorMap, 0 );\n specularColor *= texColor.rgb;\n\n }\n\n var specularIntensity = material.specularIntensity;\n if ( material.specularIntensityMap != -1 ) {\n\n let uvPrime = material.specularIntensityMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.specularIntensityMap, 0 );\n specularIntensity *= texColor.r;\n\n }\n\n var surf: SurfaceRecord;\n\n surf.volumeParticle = false;\n surf.faceNormal = faceNormal;\n surf.normal = normal;\n\n surf.metalness = metalness;\n surf.color = albedo.rgb;\n surf.emission = emission;\n\n surf.ior = material.ior;\n surf.transmission = transmission;\n surf.thinFilm = material.thinFilm == 1;\n surf.attenuationColor = material.attenuationColor;\n surf.attenuationDistance = material.attenuationDistance;\n\n surf.clearcoatNormal = clearcoatNormal;\n surf.clearcoat = clearcoat;\n\n surf.iridescence = iridescence;\n surf.iridescenceIor = material.iridescenceIor;\n surf.iridescenceThickness = iridescenceThickness;\n\n surf.specularColor = specularColor;\n surf.specularIntensity = specularIntensity;\n\n surf.roughness = clamp( roughness, MIN_ROUGHNESS, 1.0 );\n surf.clearcoatRoughness = clamp( clearcoatRoughness, MIN_ROUGHNESS, 1.0 );\n surf.sheenRoughness = clamp( sheenRoughness, MIN_ROUGHNESS, 1.0 );\n\n // frontFace is used to determine transmissive properties and PDF. If no transmission is used\n // then we can just always assume this is a front face.\n surf.frontFace = side == 1.0 || transmission == 0.0;\n if ( material.thinFilm == 1 || surf.frontFace ) {\n surf.eta = 1.0 / material.ior;\n } else {\n surf.eta = material.ior;\n }\n surf.f0 = iorToF0( surf.eta );\n\n // get the normal frames\n surf.normalBasis = getBasisFromNormal( surf.normal );\n surf.normalInvBasis = inverse( surf.normalBasis );\n\n surf.clearcoatBasis = getBasisFromNormal( surf.clearcoatNormal );\n surf.clearcoatInvBasis = inverse( surf.clearcoatBasis );\n\n return surf;\n }\n\n", [
|
|
4165
|
+
var eo = P("\n\n fn ggxDirection( incidentDir: vec3f, alpha: vec2f, uv: vec2f ) -> vec3f {\n\n // Implementation from reference [1]\n // stretch view\n let V = normalize( vec3f( alpha * incidentDir.xy, incidentDir.z ) );\n\n // orthonormal basis\n var T1: vec3f;\n if ( V.z < 0.9999 ) {\n T1 = normalize( cross( V, vec3( 0.0, 0.0, 1.0 ) ) );\n } else {\n T1 = vec3( 1.0, 0.0, 0.0 );\n }\n\n let T2 = cross( T1, V );\n\n // sample point with polar coordinates (r, phi)\n let a = 1.0 / ( 1.0 + V.z );\n let r = sqrt( uv.x );\n var phi: f32;\n if ( uv.y < a ) {\n phi = uv.y / a * PI;\n } else {\n phi = PI + ( uv.y - a ) / ( 1.0 - a ) * PI;\n }\n let P1 = r * cos( phi );\n var P2 = r * sin( phi );\n if ( uv.y >= a ) {\n P2 *= V.z;\n }\n\n // compute normal\n var N = P1 * T1 + P2 * T2 + V * sqrt( max( 0.0, 1.0 - P1 * P1 - P2 * P2 ) );\n\n // unstretch\n N = normalize( vec3( alpha * N.xy, max( 0.0, N.z ) ) );\n\n return N;\n\n }\n\n", [aa]), to = P("\n\n fn ggxLamda( theta: f32, alpha: f32 ) -> f32 {\n\n let tanTheta = tan( theta );\n let tanTheta2 = tanTheta * tanTheta;\n let alpha2 = alpha * alpha;\n\n let numerator = - 1.0 + sqrt( 1.0 + alpha2 * tanTheta2 );\n return numerator / 2.0;\n\n }\n\n"), no = P("\n\n fn ggxShadowMaskG1( cosTheta: f32, alpha: f32 ) -> f32 {\n\n let a2 = alpha * alpha;\n let cosTheta2 = cosTheta * cosTheta;\n let denom = cosTheta + sqrt( cosTheta2 * ( 1 - a2 ) + a2 );\n return 2.0 * cosTheta / denom;\n\n }\n\n", [to]), ro = P("\n\n fn ggxSmithVisibility( NdotV: f32, NdotL: f32, alpha: f32 ) -> f32 {\n\n // Original formulation of G_SmithGGX Correlated\n // lambda_v = ( -1 + sqrt ( alphaG2 * (1 - NdotL2 ) / NdotL2 + 1)) * 0.5 f;\n // lambda_l = ( -1 + sqrt ( alphaG2 * (1 - NdotV2 ) / NdotV2 + 1)) * 0.5 f;\n // G_SmithGGXCorrelated = 1 / (1 + lambda_v + lambda_l );\n // V_SmithGGXCorrelated = G_SmithGGXCorrelated / (4.0 f * NdotL * NdotV );\n\n // This is an optimized version\n let alpha2 = alpha * alpha;\n // Caution: the \"NdotL *\" and \"NdotV *\" are explicitely inversed , this is not a mistake.\n let Lambda_GGXV = NdotL * sqrt (( - NdotV * alpha2 + NdotV ) * NdotV + alpha2 );\n let Lambda_GGXL = NdotV * sqrt (( - NdotL * alpha2 + NdotL ) * NdotL + alpha2 );\n\n return 0.5 / ( Lambda_GGXV + Lambda_GGXL );\n\n }\n\n", [to]), io = P("\n fn ggxDistribution( NdotH: f32, alpha: f32 ) -> f32 {\n\n let a2 = max( alpha * alpha, EPSILON );\n let denom = NdotH * NdotH * ( a2 - 1 ) + 1;\n\n return ( a2 / ( PI * denom * denom ) );\n\n }\n"), ao = P("\n fn ggxReflectionAdjustedPDF( NdotV: f32, NdotH: f32, alpha: f32 ) -> f32 {\n\n let D = ggxDistribution( NdotH, alpha );\n let G1 = ggxShadowMaskG1( NdotV, alpha );\n\n return D * G1 / ( 4 * NdotV );\n\n }\n", [io, no]), oo = (e) => P("\n\n fn getSurfaceRecord(\n material: Material,\n vertexData: bvh_GeometryStruct,\n side: f32,\n faceNormal: vec3f,\n ) -> SurfaceRecord {\n let uv = vertexData.uv.xy;\n\n var normal = faceNormal * side;\n if ( material.flatShading == 0 ) {\n\n normal = vertexData.normal.xyz;\n\n }\n normal = normalize( normal );\n let baseNormal = normal;\n\n if ( material.normalMap != -1 ) {\n\n // some provided tangents can be malformed (0, 0, 0) causing the normal to be degenerate\n // resulting in NaNs and slow path tracing.\n if ( length( vertexData.tangent.xyz ) > 0.0 && vertexData.tangent.w != 0.0 ) {\n\n let tangent = normalize( vertexData.tangent.xyz );\n let bitangent = normalize( cross( baseNormal, tangent ) * vertexData.tangent.w );\n let vTBN = mat3x3f( tangent, bitangent, baseNormal );\n\n let uvPrime = material.normalMapTransform * vec3( uv, 1.0 );\n var texNormal = sampleTexel( uvPrime.xy, material.normalMap, 0 ).xyz;\n texNormal = texNormal * 2.0 - 1.0;\n texNormal = texNormal * vec3f( material.normalScale, 1.0 );\n normal = normalize( vTBN * texNormal );\n\n }\n\n }\n\n normal *= side;\n\n var albedo = vec4( material.color, material.opacity );\n\n if ( material.vertexColors == 1 ) {\n\n let vertexColor = vertexData.color.xyz;\n albedo *= vec4f( vertexColor, 1.0 );\n\n }\n\n if ( material.map != -1 ) {\n\n let uvPrime = material.mapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.map, 0 );\n albedo *= vec4f( texColor.rgb, 1.0 );\n\n }\n\n var roughness = material.roughness;\n if ( material.roughnessMap != -1 ) {\n\n let uvPrime = material.roughnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.roughnessMap, 0 );\n roughness *= texColor.g;\n\n }\n\n var metalness = material.metalness;\n if ( material.metalnessMap != -1 ) {\n\n let uvPrime = material.metalnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.metalnessMap, 0 );\n metalness *= texColor.b;\n\n }\n\n var emission = material.emissiveIntensity * material.emissive;\n if ( material.emissiveMap != -1 ) {\n\n let uvPrime = material.emissiveMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.emissiveMap, 0 );\n emission *= texColor.rgb;\n\n }\n\n var transmission = material.transmission;\n if ( material.transmissionMap != -1 ) {\n\n let uvPrime = material.transmissionMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.transmissionMap, 0 );\n transmission *= texColor.r;\n\n }\n\n var clearcoat = material.clearcoat;\n if ( material.clearcoatMap != -1 ) {\n\n let uvPrime = material.clearcoatMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.clearcoatMap, 0 );\n clearcoat *= texColor.r;\n\n }\n\n var clearcoatRoughness = material.clearcoatRoughness;\n if ( material.clearcoatRoughnessMap != -1 ) {\n\n let uvPrime = material.clearcoatRoughnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.clearcoatRoughnessMap, 0 );\n clearcoatRoughness *= texColor.g;\n\n }\n\n var clearcoatNormal = baseNormal;\n if ( material.clearcoatNormalMap != -1 ) {\n\n // some provided tangents can be malformed (0, 0, 0) causing the normal to be degenerate\n // resulting in NaNs and slow path tracing.\n if ( length( vertexData.tangent.xyz ) > 0.0 && vertexData.tangent.w != 0.0 ) {\n\n let tangent = normalize( vertexData.tangent.xyz );\n let bitangent = normalize( cross( baseNormal, tangent ) * vertexData.tangent.w );\n let vTBN = mat3x3f( tangent, bitangent, baseNormal );\n\n let uvPrime = material.clearcoatNormalMapTransform * vec3( uv, 1.0 );\n var texNormal = sampleTexel( uvPrime.xy, material.clearcoatNormalMap, 0 ).xyz;\n texNormal = texNormal * 2.0 - 1.0;\n texNormal = texNormal * vec3f( material.clearcoatNormalScale, 1.0 );\n clearcoatNormal = normalize( vTBN * texNormal );\n\n }\n\n }\n clearcoatNormal *= side;\n\n var sheenColor = material.sheenColor;\n if ( material.sheenColorMap != -1 ) {\n\n let uvPrime = material.sheenColorMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.sheenColorMap, 0 );\n sheenColor *= texColor.rgb;\n\n }\n\n var sheenRoughness = material.sheenRoughness;\n if ( material.sheenRoughnessMap != -1 ) {\n\n let uvPrime = material.sheenRoughnessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.sheenRoughnessMap, 0 );\n sheenRoughness *= texColor.r;\n\n }\n\n var iridescence = material.iridescence;\n if ( material.iridescenceMap != -1 ) {\n\n let uvPrime = material.iridescenceMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.iridescenceMap, 0 );\n iridescence *= texColor.r;\n\n }\n\n var iridescenceThickness = material.iridescenceThicknessMaximum;\n if ( material.iridescenceThicknessMap != -1 ) {\n\n let uvPrime = material.iridescenceThicknessMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.iridescenceThicknessMap, 0 );\n\n iridescenceThickness = mix(\n material.iridescenceThicknessMinimum,\n material.iridescenceThicknessMaximum,\n texColor.g,\n );\n\n }\n\n var specularColor = material.specularColor;\n if ( material.specularColorMap != -1 ) {\n\n let uvPrime = material.specularColorMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.specularColorMap, 0 );\n specularColor *= texColor.rgb;\n\n }\n\n var specularIntensity = material.specularIntensity;\n if ( material.specularIntensityMap != -1 ) {\n\n let uvPrime = material.specularIntensityMapTransform * vec3f( uv, 1 );\n let texColor = sampleTexel( uvPrime.xy, material.specularIntensityMap, 0 );\n specularIntensity *= texColor.r;\n\n }\n\n var surf: SurfaceRecord;\n\n surf.volumeParticle = false;\n surf.faceNormal = faceNormal;\n surf.normal = normal;\n\n surf.metalness = metalness;\n surf.color = albedo.rgb;\n surf.emission = emission;\n\n surf.ior = material.ior;\n surf.transmission = transmission;\n surf.thinFilm = material.thinFilm == 1;\n surf.attenuationColor = material.attenuationColor;\n surf.attenuationDistance = material.attenuationDistance;\n\n surf.clearcoatNormal = clearcoatNormal;\n surf.clearcoat = clearcoat;\n\n surf.iridescence = iridescence;\n surf.iridescenceIor = material.iridescenceIor;\n surf.iridescenceThickness = iridescenceThickness;\n\n surf.specularColor = specularColor;\n surf.specularIntensity = specularIntensity;\n\n surf.roughness = clamp( roughness, MIN_ROUGHNESS, 1.0 );\n surf.clearcoatRoughness = clamp( clearcoatRoughness, MIN_ROUGHNESS, 1.0 );\n surf.sheenRoughness = clamp( sheenRoughness, MIN_ROUGHNESS, 1.0 );\n\n // frontFace is used to determine transmissive properties and PDF. If no transmission is used\n // then we can just always assume this is a front face.\n surf.frontFace = side == 1.0 || transmission == 0.0;\n if ( material.thinFilm == 1 || surf.frontFace ) {\n surf.eta = 1.0 / material.ior;\n } else {\n surf.eta = material.ior;\n }\n surf.f0 = iorToF0( surf.eta );\n\n // get the normal frames\n surf.normalBasis = getBasisFromNormal( surf.normal );\n surf.normalInvBasis = inverse( surf.normalBasis );\n\n surf.clearcoatBasis = getBasisFromNormal( surf.clearcoatNormal );\n surf.clearcoatInvBasis = inverse( surf.clearcoatBasis );\n\n return surf;\n }\n\n", [
|
|
4166
4166
|
fa,
|
|
4167
4167
|
ma,
|
|
4168
4168
|
pa,
|
|
4169
4169
|
e,
|
|
4170
4170
|
ca,
|
|
4171
4171
|
aa
|
|
4172
|
-
]), so =
|
|
4172
|
+
]), so = P("\n\n fn diffuseBrdf( NdotV: f32, NdotL: f32, VdotH: f32, surf: SurfaceRecord ) -> vec3f {\n\n // https://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_notes.pdf\n // See equation (4)\n\n let fl = schlickFresnel( NdotL, 0.0 );\n let fv = schlickFresnel( NdotV, 0.0 );\n\n let alpha = surf.roughness * surf.roughness;\n let bias = mix( 0.0, 0.5, alpha ) - 1;\n let energyFactor = mix( 1.0, 1.0 / 1.51, alpha );\n\n let rr = 2.0 * alpha * VdotH * VdotH;\n let retro = rr * ( fl + fv + fl * fv * ( rr + 2.0 * bias ) );\n let fresnel = ( 1.0 + bias * fl ) * ( 1.0f + bias * fv );\n\n // TODO: subsurface approx?\n\n return energyFactor * ( surf.color / PI ) * ( retro + fresnel );\n\n }\n\n", [
|
|
4173
4173
|
aa,
|
|
4174
4174
|
va,
|
|
4175
4175
|
ca
|
|
4176
|
-
]), co =
|
|
4176
|
+
]), co = P("\n\n fn specularBrdf( NdotL: f32, NdotV: f32, NdotH: f32, alpha: f32 ) -> vec3f {\n\n let Vis = ggxSmithVisibility( NdotV, NdotL, alpha );\n let D = ggxDistribution( NdotH, alpha );\n\n return vec3f( D * Vis );\n\n }\n\n", [ro, io]), lo = P("\n\n fn fresnelMix( VdotH: f32, ior: f32, base: vec3f, layer: vec3f ) -> vec3f {\n\n let f0 = iorToF0( ior );\n let F = schlickFresnel( abs( VdotH ), f0 );\n\n return base + F * layer;\n\n }\n\n", [va, ma]), uo = Se(3.2404542, -.969266, .0556434, -1.5371385, 1.8760108, -.2040259, -.4985314, .041556, 1.0572252), fo = P("\n\n fn iridescentFresnel(\n cosTheta1: f32, baseF0: vec3f, iridescenceIor: f32,\n outsideIor: f32, iridescenceThickness: f32,\n ) -> vec3f {\n\n let sinTheta2Sq = pow( outsideIor / iridescenceIor, 2.0 ) * ( 1.0 - pow( cosTheta1, 2.0 ) );\n let cosTheta2Sq = 1.0 - sinTheta2Sq;\n\n // Handle total internal reflection\n if ( cosTheta2Sq < 0.0 ) {\n\n return vec3( 1.0 );\n\n }\n\n let cosTheta2 = sqrt( cosTheta2Sq );\n\n // First interface: air -> iridescent thin film\n let R0 = iorToF0General( iridescenceIor, outsideIor );\n let R12 = schlickFresnel( cosTheta1, R0 );\n let R21 = R12;\n let T121 = 1.0 - R12;\n let phi12 = select( 0.0, PI, iridescenceIor < outsideIor );\n let phi21 = PI - phi12;\n\n // Second interface: iridescent thin film -> base material\n let baseIor = fresnel0ToIor( baseF0 + 0.0001 ); // guard against 1.0\n let R1 = iorToF0GeneralVec( baseIor, vec3( iridescenceIor ) );\n let R23 = schlickFresnelVec( cosTheta2, R1, vec3( 1.0 ) );\n let phi23 = select( vec3( 0.0 ), vec3( PI ), baseIor < vec3( iridescenceIor ) );\n\n // Phase shift\n let OPD = 2.0 * iridescenceIor * iridescenceThickness * cosTheta2;\n let phi = vec3( phi21 ) + phi23;\n\n // Analytical integration\n // Compound terms\n let R123 = clamp( R12 * R23, vec3( 1e-5 ), vec3( 0.9999 ) );\n let r123 = sqrt( R123 );\n let Rs = T121 * T121 * R23 / ( vec3( 1.0 ) - R123 );\n\n // Reflectance term for m = 0 (DC term amplitude)\n let C0 = R12 + Rs;\n var I = C0;\n\n // Reflectance term for m > 0 (pairs of diracs)\n var Cm = Rs - T121;\n for (var m = 1; m <= 2; m += 1) {\n\n Cm *= r123;\n let Sm = 2.0 * evalSensitivity( f32( m ) * OPD, f32( m ) * phi );\n I += Cm * Sm;\n\n }\n\n return max( I, vec3(0.0) );\n\n }\n\n", [
|
|
4177
4177
|
ha,
|
|
4178
4178
|
ga,
|
|
4179
4179
|
va,
|
|
@@ -4197,11 +4197,11 @@ var eo = j("\n\n fn ggxDirection( incidentDir: vec3f, alpha: vec2f, uv: vec2f )
|
|
|
4197
4197
|
}
|
|
4198
4198
|
|
|
4199
4199
|
`
|
|
4200
|
-
]), po =
|
|
4200
|
+
]), po = P("\n\n fn iridescentDielectricLayer(\n dielectricBase: vec3f, base: vec3f, specular: vec3f, HdotL: f32,\n outsideIor: f32, baseIor: f32, iridescenceIor: f32, thickness: f32, strength: f32,\n ) -> vec3f {\n\n let baseF0 = vec3( iorToF0( baseIor ) );\n\n let iridescentF = iridescentFresnel( HdotL, baseF0, iridescenceIor, outsideIor, thickness );\n\n return mix( dielectricBase, rgbMix( base, specular, iridescentF ), strength );\n\n }\n\n", [
|
|
4201
4201
|
ma,
|
|
4202
4202
|
fo,
|
|
4203
|
-
|
|
4204
|
-
]), mo =
|
|
4203
|
+
P("\n\n fn rgbMix( base: vec3f, specular: vec3f, rgbAlpha: vec3f ) -> vec3f {\n\n let alphaMax = max( max( rgbAlpha.x, rgbAlpha.y ), rgbAlpha.z );\n return ( 1 - alphaMax ) * base + rgbAlpha * specular;\n\n }\n\n")
|
|
4204
|
+
]), mo = P("\n\n fn iridescentConductorLayer(\n metalBase: vec3f, specular: vec3f, baseF0: vec3f, HdotL: f32,\n outsideIor: f32, iridescenceIor: f32, thickness: f32, strength: f32,\n ) -> vec3f {\n\n let iridescenceF = iridescentFresnel( HdotL, baseF0, iridescenceIor, outsideIor, thickness );\n\n return mix( metalBase, specular * iridescenceF, strength );\n\n }\n\n", [fo]), ho = (e) => P("\n\n fn conductorFresnel( NdotV: f32, VdotH: f32, f0: vec3f, bsdf: vec3f, alpha: f32 ) -> vec3f {\n\n let ss = bsdf * schlickFresnelVec( abs( VdotH ), f0, vec3f( 1 ) );\n\n let uv = vec2( NdotV, sqrt( alpha ) );\n let energySs = max( textureSampleLevel( turquinTexture, turquinTexture_sampler, uv, 0 ).r, 1e-5 );\n\n return ss * ( 1.0 + f0 * ( 1.0 - energySs ) / energySs );\n\n }\n\n", [ya, e]), go = P("\n\n fn fresnelCoat( VdotNc: f32, ior: f32, base: vec3f, layer: vec3f, weight: f32 ) -> vec3f {\n\n let f0 = iorToF0( ior );\n let F = schlickFresnel( abs( VdotNc ), f0 );\n\n return mix( base, layer, weight * F );\n\n }\n\n", [ma, va]), _o = $`
|
|
4205
4205
|
|
|
4206
4206
|
fn albedo(
|
|
4207
4207
|
texture: texture_storage_2d<r16float, write>,
|
|
@@ -4421,7 +4421,7 @@ var wo = class {
|
|
|
4421
4421
|
}), this.structs.transform = Eo, this.structs.material = sa, this.storage.materials = null, this.materials = [], this.bvhMap = /* @__PURE__ */ new Map(), this.textureAtlas = new wo();
|
|
4422
4422
|
}
|
|
4423
4423
|
useTransparencyRaycastFn() {
|
|
4424
|
-
let { textureAtlas: e, storage: t, structs: n, fns: r } = this, i = e.texture, a = Ca(
|
|
4424
|
+
let { textureAtlas: e, storage: t, structs: n, fns: r } = this, i = e.texture, a = Ca(xe(e.textureInfo, "uvec4"), Me(i), ke(i));
|
|
4425
4425
|
r.getSurfaceRecord = oo(a);
|
|
4426
4426
|
let o = new _e(n.material).toVar("bvh_material"), s = Ae(1).toVar("bvh_rayScalar"), c = Ae(1).toVar("bvh_baseOpacity");
|
|
4427
4427
|
r.raycastFirstHit = this.getShapecastFn({
|
|
@@ -4606,7 +4606,7 @@ var wo = class {
|
|
|
4606
4606
|
super.update();
|
|
4607
4607
|
let { materials: e, structs: t } = this, { materialData: n, textures: r } = this.writeMaterialsBuffer(e);
|
|
4608
4608
|
this.textures = r;
|
|
4609
|
-
let i =
|
|
4609
|
+
let i = N(new me(n, t.material.getLength()), t.material).toReadOnly().setName("bvh_materials");
|
|
4610
4610
|
this.storage.materials = i, this.bvhMap.clear(), this.materials.length = 0, this.useTransparencyRaycastFn();
|
|
4611
4611
|
}
|
|
4612
4612
|
writeMaterialsBuffer(e) {
|
|
@@ -4723,7 +4723,7 @@ var wo = class {
|
|
|
4723
4723
|
this._layerUniform.value = e;
|
|
4724
4724
|
}
|
|
4725
4725
|
constructor() {
|
|
4726
|
-
super(), this.blending = 0, this._texNode =
|
|
4726
|
+
super(), this.blending = 0, this._texNode = Me(new h()), this._layerUniform = M(0), this.colorNode = P("\n fn atlasDebug( tex: texture_2d_array<f32>, coord: vec2f, layer: f32 ) -> vec4f {\n\n // flip y so texel origin shows at the top-left\n let dims = vec2f( textureDimensions( tex, 0 ).xy );\n let texel = vec2i( vec2f( coord.x, 1.0 - coord.y ) * dims );\n return textureLoad( tex, texel, i32( layer ), 0 );\n\n }\n ")(this._texNode, De(be()), this._layerUniform);
|
|
4727
4727
|
}
|
|
4728
4728
|
};
|
|
4729
4729
|
//#endregion
|
|
@@ -4783,13 +4783,13 @@ var Ao = class {
|
|
|
4783
4783
|
super();
|
|
4784
4784
|
let { specularBrdf: t = co, diffuseBrdf: n = so, fresnelMix: r = lo, conductorFresnel: i = ho, fresnelCoat: a = go, iridescentDielectricLayer: o = po, iridescentConductorLayer: s = mo, calculateTurquinTexture: c = !1 } = e;
|
|
4785
4785
|
c ? (this.turquinTexture = new k(32, 32), this.turquinTexture.type = w) : (this.turquinTexture = Mo, this.turquinTexture.flipY = !1), this.turquinTexture.format = ne, this.turquinTexture.minFilter = T, this.turquinTexture.magFilter = T;
|
|
4786
|
-
let l =
|
|
4786
|
+
let l = Me(this.turquinTexture).setName("turquinTexture");
|
|
4787
4787
|
this.specularBrdf = t, this.diffuseBrdf = n, this.fresnelMix = r, this.conductorFresnel = i(l), this.fresnelCoat = a, this.iridescentDielectricLayer = o, this.iridescentConductorLayer = s, this.calculateTurquinTexture = c;
|
|
4788
4788
|
}
|
|
4789
4789
|
init(e) {
|
|
4790
4790
|
if (!this.calculateTurquinTexture) return;
|
|
4791
4791
|
let t = new zi(_o({
|
|
4792
|
-
texture:
|
|
4792
|
+
texture: j(this.turquinTexture).toWriteOnly(),
|
|
4793
4793
|
globalId: Oe
|
|
4794
4794
|
}), { workgroupSize: [
|
|
4795
4795
|
16,
|
|
@@ -5081,4 +5081,4 @@ function zo(e, t, n) {
|
|
|
5081
5081
|
//#endregion
|
|
5082
5082
|
export { Ro as WebGPUPathTracer };
|
|
5083
5083
|
|
|
5084
|
-
//# sourceMappingURL=webgpu-
|
|
5084
|
+
//# sourceMappingURL=webgpu-B0rxiqW-.mjs.map
|