bg2e-js 2.3.14 → 2.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bg2e-js.js +125 -121
- package/dist/bg2e-js.js.map +1 -1
- package/package.json +1 -1
- package/src/manipulation/SelectionManager.ts +15 -5
package/dist/bg2e-js.js
CHANGED
|
@@ -802,12 +802,12 @@ class w extends Le {
|
|
|
802
802
|
return this.frustum(-o, o, -s, s, i, n), this;
|
|
803
803
|
}
|
|
804
804
|
frustum(e, r, i, n, s, o) {
|
|
805
|
-
let a = r - e,
|
|
806
|
-
return this.setRow(0, new h(s * 2 / a, 0, 0, 0)), this.setRow(1, new h(0, s * 2 /
|
|
805
|
+
let a = r - e, A = n - i, c = o - s;
|
|
806
|
+
return this.setRow(0, new h(s * 2 / a, 0, 0, 0)), this.setRow(1, new h(0, s * 2 / A, 0, 0)), this.setRow(2, new h((r + e) / a, (n + i) / A, -(o + s) / c, -1)), this.setRow(3, new h(0, 0, -(o * s * 2) / c, 0)), this;
|
|
807
807
|
}
|
|
808
808
|
ortho(e, r, i, n, s, o) {
|
|
809
|
-
let a = r - e,
|
|
810
|
-
return this[0] = 2 / a, this[1] = 0, this[2] = 0, this[3] = 0, this[4] = 0, this[5] = 2 /
|
|
809
|
+
let a = r - e, A = n - i, c = o - s;
|
|
810
|
+
return this[0] = 2 / a, this[1] = 0, this[2] = 0, this[3] = 0, this[4] = 0, this[5] = 2 / A, this[6] = 0, this[7] = 0, this[8] = 0, this[9] = 0, this[10] = -2 / c, this[11] = 0, this[12] = -(e + r) / a, this[13] = -(n + i) / A, this[14] = -(o + s) / c, this[15] = 1, this;
|
|
811
811
|
}
|
|
812
812
|
lookAt(e, r, i) {
|
|
813
813
|
this.identity();
|
|
@@ -1020,8 +1020,8 @@ class w extends Le {
|
|
|
1020
1020
|
mult(e) {
|
|
1021
1021
|
if (typeof e == "number")
|
|
1022
1022
|
return this[0] *= e, this[1] *= e, this[2] *= e, this[3] *= e, this[4] *= e, this[5] *= e, this[6] *= e, this[7] *= e, this[8] *= e, this[9] *= e, this[10] *= e, this[11] *= e, this[12] *= e, this[13] *= e, this[14] *= e, this[15] *= e, this;
|
|
1023
|
-
const r = this.row(0), i = this.row(1), n = this.row(2), s = this.row(3), o = e.col(0), a = e.col(1),
|
|
1024
|
-
return this[0] = h.Dot(r, o), this[1] = h.Dot(r, a), this[2] = h.Dot(r,
|
|
1023
|
+
const r = this.row(0), i = this.row(1), n = this.row(2), s = this.row(3), o = e.col(0), a = e.col(1), A = e.col(2), c = e.col(3);
|
|
1024
|
+
return this[0] = h.Dot(r, o), this[1] = h.Dot(r, a), this[2] = h.Dot(r, A), this[3] = h.Dot(r, c), this[4] = h.Dot(i, o), this[5] = h.Dot(i, a), this[6] = h.Dot(i, A), this[7] = h.Dot(i, c), this[8] = h.Dot(n, o), this[9] = h.Dot(n, a), this[10] = h.Dot(n, A), this[11] = h.Dot(n, c), this[12] = h.Dot(s, o), this[13] = h.Dot(s, a), this[14] = h.Dot(s, A), this[15] = h.Dot(s, c), this;
|
|
1025
1025
|
}
|
|
1026
1026
|
multVector(e) {
|
|
1027
1027
|
if (e.length < 3)
|
|
@@ -1035,9 +1035,9 @@ class w extends Le {
|
|
|
1035
1035
|
);
|
|
1036
1036
|
}
|
|
1037
1037
|
invert() {
|
|
1038
|
-
const e = this[0], r = this[1], i = this[2], n = this[3], s = this[4], o = this[5], a = this[6],
|
|
1039
|
-
let O = K * W - G * I + H * z + L * m - l *
|
|
1040
|
-
return O ? (O = 1 / O, this[0] = (o * W - a * I +
|
|
1038
|
+
const e = this[0], r = this[1], i = this[2], n = this[3], s = this[4], o = this[5], a = this[6], A = this[7], c = this[8], d = this[9], P = this[10], C = this[11], v = this[12], D = this[13], B = this[14], N = this[15], K = e * o - r * s, G = e * a - i * s, H = e * A - n * s, L = r * a - i * o, l = r * A - n * o, g = i * A - n * a, u = c * D - d * v, f = c * B - P * v, m = c * N - C * v, z = d * B - P * D, I = d * N - C * D, W = P * N - C * B;
|
|
1039
|
+
let O = K * W - G * I + H * z + L * m - l * f + g * u;
|
|
1040
|
+
return O ? (O = 1 / O, this[0] = (o * W - a * I + A * z) * O, this[1] = (i * I - r * W - n * z) * O, this[2] = (D * g - B * l + N * L) * O, this[3] = (P * l - d * g - C * L) * O, this[4] = (a * m - s * W - A * f) * O, this[5] = (e * W - i * m + n * f) * O, this[6] = (B * H - v * g - N * G) * O, this[7] = (c * g - P * H + C * G) * O, this[8] = (s * I - o * m + A * u) * O, this[9] = (r * m - e * I - n * u) * O, this[10] = (v * l - D * H + N * K) * O, this[11] = (d * H - c * l - C * K) * O, this[12] = (o * f - s * z - a * u) * O, this[13] = (e * z - r * f + i * u) * O, this[14] = (D * G - v * L - B * K) * O, this[15] = (c * L - d * G + P * K) * O) : this.zero(), this;
|
|
1041
1041
|
}
|
|
1042
1042
|
traspose() {
|
|
1043
1043
|
const e = new h(this[0], this[4], this[8], this[12]), r = new h(this[1], this[5], this[9], this[13]), i = new h(this[2], this[6], this[10], this[14]), n = new h(this[3], this[7], this[11], this[15]);
|
|
@@ -1077,18 +1077,18 @@ class w extends Le {
|
|
|
1077
1077
|
static MakeRotation(e, r, i, n) {
|
|
1078
1078
|
const s = new h(r, i, n);
|
|
1079
1079
|
s.normalize();
|
|
1080
|
-
var o = Math.cos(e), a = 1 - o,
|
|
1080
|
+
var o = Math.cos(e), a = 1 - o, A = Math.sin(e);
|
|
1081
1081
|
return new w(
|
|
1082
1082
|
s.x * s.x * a + o,
|
|
1083
|
-
s.x * s.y * a + s.z *
|
|
1084
|
-
s.x * s.z * a - s.y *
|
|
1083
|
+
s.x * s.y * a + s.z * A,
|
|
1084
|
+
s.x * s.z * a - s.y * A,
|
|
1085
1085
|
0,
|
|
1086
|
-
s.y * s.x * a - s.z *
|
|
1086
|
+
s.y * s.x * a - s.z * A,
|
|
1087
1087
|
s.y * s.y * a + o,
|
|
1088
|
-
s.y * s.z * a + s.x *
|
|
1088
|
+
s.y * s.z * a + s.x * A,
|
|
1089
1089
|
0,
|
|
1090
|
-
s.z * s.x * a + s.y *
|
|
1091
|
-
s.z * s.y * a - s.x *
|
|
1090
|
+
s.z * s.x * a + s.y * A,
|
|
1091
|
+
s.z * s.y * a - s.x * A,
|
|
1092
1092
|
s.z * s.z * a + o,
|
|
1093
1093
|
0,
|
|
1094
1094
|
0,
|
|
@@ -1141,12 +1141,12 @@ class w extends Le {
|
|
|
1141
1141
|
static Unproject(e, r, i, n, s, o) {
|
|
1142
1142
|
let a = new w(s);
|
|
1143
1143
|
a.mult(n), a.invert();
|
|
1144
|
-
const
|
|
1144
|
+
const A = new h(
|
|
1145
1145
|
(e - o.y) / o.width * 2 - 1,
|
|
1146
1146
|
(r - o.x) / o.height * 2 - 1,
|
|
1147
1147
|
i * 2 - 1,
|
|
1148
1148
|
1
|
|
1149
|
-
), c = a.multVector(
|
|
1149
|
+
), c = a.multVector(A);
|
|
1150
1150
|
return c.z == 0 ? c.setValue(0, 0, 0, 0) : c.setValue(
|
|
1151
1151
|
c.x / c.w,
|
|
1152
1152
|
c.y / c.w,
|
|
@@ -1257,11 +1257,11 @@ class ii {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
(function(t) {
|
|
1259
1259
|
function e(l) {
|
|
1260
|
-
for (var g = "", u = "",
|
|
1260
|
+
for (var g = "", u = "", f = 0, m = 0, z = 0, I = l.length; I > z; z++) {
|
|
1261
1261
|
var W = l.charCodeAt(z);
|
|
1262
|
-
128 > W ? m++ : (u = 2048 > W ? String.fromCharCode(W >> 6 | 192, 63 & W | 128) : String.fromCharCode(W >> 12 | 224, W >> 6 & 63 | 128, 63 & W | 128), m >
|
|
1262
|
+
128 > W ? m++ : (u = 2048 > W ? String.fromCharCode(W >> 6 | 192, 63 & W | 128) : String.fromCharCode(W >> 12 | 224, W >> 6 & 63 | 128, 63 & W | 128), m > f && (g += l.slice(f, m)), g += u, f = m = z + 1);
|
|
1263
1263
|
}
|
|
1264
|
-
return m >
|
|
1264
|
+
return m > f && (g += l.slice(f, I)), g;
|
|
1265
1265
|
}
|
|
1266
1266
|
function r(l) {
|
|
1267
1267
|
var g, u;
|
|
@@ -1280,21 +1280,21 @@ class ii {
|
|
|
1280
1280
|
}
|
|
1281
1281
|
function n(l, g, u) {
|
|
1282
1282
|
r(g ? l : e(l));
|
|
1283
|
-
var
|
|
1284
|
-
return c[1] = v[15 &
|
|
1283
|
+
var f = B[0];
|
|
1284
|
+
return c[1] = v[15 & f], c[0] = v[15 & (f >>= 4)], c[3] = v[15 & (f >>= 4)], c[2] = v[15 & (f >>= 4)], c[5] = v[15 & (f >>= 4)], c[4] = v[15 & (f >>= 4)], c[7] = v[15 & (f >>= 4)], c[6] = v[15 & (f >>= 4)], f = B[1], c[9] = v[15 & f], c[8] = v[15 & (f >>= 4)], c[11] = v[15 & (f >>= 4)], c[10] = v[15 & (f >>= 4)], c[13] = v[15 & (f >>= 4)], c[12] = v[15 & (f >>= 4)], c[15] = v[15 & (f >>= 4)], c[14] = v[15 & (f >>= 4)], f = B[2], c[17] = v[15 & f], c[16] = v[15 & (f >>= 4)], c[19] = v[15 & (f >>= 4)], c[18] = v[15 & (f >>= 4)], c[21] = v[15 & (f >>= 4)], c[20] = v[15 & (f >>= 4)], c[23] = v[15 & (f >>= 4)], c[22] = v[15 & (f >>= 4)], f = B[3], c[25] = v[15 & f], c[24] = v[15 & (f >>= 4)], c[27] = v[15 & (f >>= 4)], c[26] = v[15 & (f >>= 4)], c[29] = v[15 & (f >>= 4)], c[28] = v[15 & (f >>= 4)], c[31] = v[15 & (f >>= 4)], c[30] = v[15 & (f >>= 4)], u ? c : c.join("");
|
|
1285
1285
|
}
|
|
1286
|
-
function s(l, g, u,
|
|
1287
|
-
return g += l +
|
|
1286
|
+
function s(l, g, u, f, m, z, I) {
|
|
1287
|
+
return g += l + f + I, (g << m | g >>> z) + u << 0;
|
|
1288
1288
|
}
|
|
1289
1289
|
function o(l) {
|
|
1290
|
-
|
|
1290
|
+
A(0, 0, 0, 0, l), B[0] = H[0] + 1732584193 << 0, B[1] = H[1] - 271733879 << 0, B[2] = H[2] - 1732584194 << 0, B[3] = H[3] + 271733878 << 0;
|
|
1291
1291
|
}
|
|
1292
1292
|
function a(l) {
|
|
1293
|
-
|
|
1293
|
+
A(B[0], B[1], B[2], B[3], l), B[0] = H[0] + B[0] << 0, B[1] = H[1] + B[1] << 0, B[2] = H[2] + B[2] << 0, B[3] = H[3] + B[3] << 0;
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function A(l, g, u, f, m) {
|
|
1296
1296
|
var z, I;
|
|
1297
|
-
N ? (l = s((u ^
|
|
1297
|
+
N ? (l = s((u ^ f) & g ^ f, l, g, m[0], 7, 25, -680876936), f = s((g ^ u) & l ^ u, f, l, m[1], 12, 20, -389564586), u = s((l ^ g) & f ^ g, u, f, m[2], 17, 15, 606105819), g = s((f ^ l) & u ^ l, g, u, m[3], 22, 10, -1044525330)) : (l = m[0] - 680876937, l = (l << 7 | l >>> 25) - 271733879 << 0, f = m[1] - 117830708 + (2004318071 & l ^ -1732584194), f = (f << 12 | f >>> 20) + l << 0, u = m[2] - 1126478375 + ((-271733879 ^ l) & f ^ -271733879), u = (u << 17 | u >>> 15) + f << 0, g = m[3] - 1316259209 + ((f ^ l) & u ^ l), g = (g << 22 | g >>> 10) + u << 0), l = s((u ^ f) & g ^ f, l, g, m[4], 7, 25, -176418897), f = s((g ^ u) & l ^ u, f, l, m[5], 12, 20, 1200080426), u = s((l ^ g) & f ^ g, u, f, m[6], 17, 15, -1473231341), g = s((f ^ l) & u ^ l, g, u, m[7], 22, 10, -45705983), l = s((u ^ f) & g ^ f, l, g, m[8], 7, 25, 1770035416), f = s((g ^ u) & l ^ u, f, l, m[9], 12, 20, -1958414417), u = s((l ^ g) & f ^ g, u, f, m[10], 17, 15, -42063), g = s((f ^ l) & u ^ l, g, u, m[11], 22, 10, -1990404162), l = s((u ^ f) & g ^ f, l, g, m[12], 7, 25, 1804603682), f = s((g ^ u) & l ^ u, f, l, m[13], 12, 20, -40341101), u = s((l ^ g) & f ^ g, u, f, m[14], 17, 15, -1502002290), g = s((f ^ l) & u ^ l, g, u, m[15], 22, 10, 1236535329), l = s((g ^ u) & f ^ u, l, g, m[1], 5, 27, -165796510), f = s((l ^ g) & u ^ g, f, l, m[6], 9, 23, -1069501632), u = s((f ^ l) & g ^ l, u, f, m[11], 14, 18, 643717713), g = s((u ^ f) & l ^ f, g, u, m[0], 20, 12, -373897302), l = s((g ^ u) & f ^ u, l, g, m[5], 5, 27, -701558691), f = s((l ^ g) & u ^ g, f, l, m[10], 9, 23, 38016083), u = s((f ^ l) & g ^ l, u, f, m[15], 14, 18, -660478335), g = s((u ^ f) & l ^ f, g, u, m[4], 20, 12, -405537848), l = s((g ^ u) & f ^ u, l, g, m[9], 5, 27, 568446438), f = s((l ^ g) & u ^ g, f, l, m[14], 9, 23, -1019803690), u = s((f ^ l) & g ^ l, u, f, m[3], 14, 18, -187363961), g = s((u ^ f) & l ^ f, g, u, m[8], 20, 12, 1163531501), l = s((g ^ u) & f ^ u, l, g, m[13], 5, 27, -1444681467), f = s((l ^ g) & u ^ g, f, l, m[2], 9, 23, -51403784), u = s((f ^ l) & g ^ l, u, f, m[7], 14, 18, 1735328473), g = s((u ^ f) & l ^ f, g, u, m[12], 20, 12, -1926607734), z = g ^ u, l = s(z ^ f, l, g, m[5], 4, 28, -378558), f = s(z ^ l, f, l, m[8], 11, 21, -2022574463), I = f ^ l, u = s(I ^ g, u, f, m[11], 16, 16, 1839030562), g = s(I ^ u, g, u, m[14], 23, 9, -35309556), z = g ^ u, l = s(z ^ f, l, g, m[1], 4, 28, -1530992060), f = s(z ^ l, f, l, m[4], 11, 21, 1272893353), I = f ^ l, u = s(I ^ g, u, f, m[7], 16, 16, -155497632), g = s(I ^ u, g, u, m[10], 23, 9, -1094730640), z = g ^ u, l = s(z ^ f, l, g, m[13], 4, 28, 681279174), f = s(z ^ l, f, l, m[0], 11, 21, -358537222), I = f ^ l, u = s(I ^ g, u, f, m[3], 16, 16, -722521979), g = s(I ^ u, g, u, m[6], 23, 9, 76029189), z = g ^ u, l = s(z ^ f, l, g, m[9], 4, 28, -640364487), f = s(z ^ l, f, l, m[12], 11, 21, -421815835), I = f ^ l, u = s(I ^ g, u, f, m[15], 16, 16, 530742520), g = s(I ^ u, g, u, m[2], 23, 9, -995338651), l = s(u ^ (g | ~f), l, g, m[0], 6, 26, -198630844), f = s(g ^ (l | ~u), f, l, m[7], 10, 22, 1126891415), u = s(l ^ (f | ~g), u, f, m[14], 15, 17, -1416354905), g = s(f ^ (u | ~l), g, u, m[5], 21, 11, -57434055), l = s(u ^ (g | ~f), l, g, m[12], 6, 26, 1700485571), f = s(g ^ (l | ~u), f, l, m[3], 10, 22, -1894986606), u = s(l ^ (f | ~g), u, f, m[10], 15, 17, -1051523), g = s(f ^ (u | ~l), g, u, m[1], 21, 11, -2054922799), l = s(u ^ (g | ~f), l, g, m[8], 6, 26, 1873313359), f = s(g ^ (l | ~u), f, l, m[15], 10, 22, -30611744), u = s(l ^ (f | ~g), u, f, m[6], 15, 17, -1560198380), g = s(f ^ (u | ~l), g, u, m[13], 21, 11, 1309151649), l = s(u ^ (g | ~f), l, g, m[4], 6, 26, -145523070), f = s(g ^ (l | ~u), f, l, m[11], 10, 22, -1120210379), u = s(l ^ (f | ~g), u, f, m[2], 15, 17, 718787259), g = s(f ^ (u | ~l), g, u, m[9], 21, 11, -343485551), H[0] = l, H[1] = g, H[2] = u, H[3] = f;
|
|
1298
1298
|
}
|
|
1299
1299
|
var c = [], d = [], P = [], C = [], v = "0123456789abcdef".split(""), D = [], B = [], N = !1, K = 0, G = 0, H = [];
|
|
1300
1300
|
if (t.Int32Array) d = new Int32Array(16), P = new Int32Array(16), C = new Int32Array(4), D = new Int32Array(4), B = new Int32Array(4), H = new Int32Array(4);
|
|
@@ -1812,8 +1812,8 @@ function yr(t) {
|
|
|
1812
1812
|
}), i = (s, o) => h.Sub(s.uv, o.uv), n = (s, o) => 1 / (s.x * o.y - s.y * o.x);
|
|
1813
1813
|
if (t.index.length % 3 === 0)
|
|
1814
1814
|
for (let s = 0; s < t.index.length - 2; s += 3) {
|
|
1815
|
-
let o = r(t.index[s]), a = r(t.index[s + 1]),
|
|
1816
|
-
isFinite(v) || (o.uv.x = o.uv.x * 1.1, o.uv.y = o.uv.y * 0.94, P = i(a, o), C = i(
|
|
1815
|
+
let o = r(t.index[s]), a = r(t.index[s + 1]), A = r(t.index[s + 2]), c = h.Sub(a.pos, o.pos), d = h.Sub(A.pos, a.pos), P = i(a, o), C = i(A, o), v = n(P, C);
|
|
1816
|
+
isFinite(v) || (o.uv.x = o.uv.x * 1.1, o.uv.y = o.uv.y * 0.94, P = i(a, o), C = i(A, o), v = n(P, C)), isFinite(v) || (A.uv.x = A.uv.x * 1.3, A.uv.y = A.uv.y * 1.82, P = i(a, o), C = i(A, o), v = n(P, C));
|
|
1817
1817
|
const D = new h(
|
|
1818
1818
|
(c.x * C.y - d.x * P.y) * v,
|
|
1819
1819
|
(c.y * C.y - d.y * P.y) * v,
|
|
@@ -2145,17 +2145,17 @@ const kt = {}, Rs = async (t) => (Xt || (Xt = new _e()), kt[t] ? console.log(`Im
|
|
|
2145
2145
|
const s = n.getContext("2d");
|
|
2146
2146
|
s.fillStyle = "#00000000", s.clearRect(0, 0, n.width, n.height), s.fillRect(0, 0, n.width, n.height), s.scale(1, -1), s.drawImage(i, 0, 0, n.width, -n.height);
|
|
2147
2147
|
const o = new Image();
|
|
2148
|
-
await new Promise((
|
|
2148
|
+
await new Promise((A) => {
|
|
2149
2149
|
o.onload = () => {
|
|
2150
|
-
o._hash = mi(o),
|
|
2150
|
+
o._hash = mi(o), A();
|
|
2151
2151
|
}, o.src = n.toDataURL();
|
|
2152
2152
|
}), e(o);
|
|
2153
2153
|
})), kt[t]), Mr = async (t) => {
|
|
2154
2154
|
const r = await new Promise((a) => {
|
|
2155
|
-
const
|
|
2156
|
-
|
|
2157
|
-
a(
|
|
2158
|
-
},
|
|
2155
|
+
const A = new Image();
|
|
2156
|
+
A.onload = () => {
|
|
2157
|
+
a(A);
|
|
2158
|
+
}, A.src = t;
|
|
2159
2159
|
}), i = document.createElement("canvas");
|
|
2160
2160
|
i.width = r.naturalWidth, i.height = r.naturalHeight;
|
|
2161
2161
|
const n = i.getContext("2d");
|
|
@@ -3004,9 +3004,9 @@ ${e.getProgramInfoLog(this._program)}`);
|
|
|
3004
3004
|
tex1: s = null,
|
|
3005
3005
|
tex2: o = null,
|
|
3006
3006
|
color: a = null,
|
|
3007
|
-
tangent:
|
|
3007
|
+
tangent: A = null
|
|
3008
3008
|
}) {
|
|
3009
|
-
this.positionAttribPointer(e.positionAttribParams(r)), i && this.normalAttribPointer(e.normalAttribParams(i)), n && this.texCoordAttribPointer(e.texCoord0AttribParams(n)), s && this.texCoordAttribPointer(e.texCoord1AttribParams(s)), o && this.texCoordAttribPointer(e.texCoord2AttribParams(o)),
|
|
3009
|
+
this.positionAttribPointer(e.positionAttribParams(r)), i && this.normalAttribPointer(e.normalAttribParams(i)), n && this.texCoordAttribPointer(e.texCoord0AttribParams(n)), s && this.texCoordAttribPointer(e.texCoord1AttribParams(s)), o && this.texCoordAttribPointer(e.texCoord2AttribParams(o)), A && this.tangentAttribPointer(e.tangentAttribParams(A)), a && this.colorAttribPointer(e.colorAttribParams(a));
|
|
3010
3010
|
}
|
|
3011
3011
|
bindMatrix(e, r) {
|
|
3012
3012
|
r instanceof w ? this.uniformMatrix4fv(e, !1, r) : r instanceof te && this.uniformMatrix3fv(e, !1, r);
|
|
@@ -3109,8 +3109,8 @@ class yi extends V {
|
|
|
3109
3109
|
throw new Error("IrradianceMapCubeShader: shader program is not loaded");
|
|
3110
3110
|
const o = this.renderer, { gl: a } = o;
|
|
3111
3111
|
o.state.shaderProgram = this._program;
|
|
3112
|
-
const
|
|
3113
|
-
this._program.uniformMatrix4fv("uMVP", !1,
|
|
3112
|
+
const A = w.Mult(s, n);
|
|
3113
|
+
this._program.uniformMatrix4fv("uMVP", !1, A), a.activeTexture(a.TEXTURE0), this._program.uniform1i("uCubemap", 0);
|
|
3114
3114
|
const c = r.getTextureRenderer("albedoTexture").getApiObject();
|
|
3115
3115
|
a.bindTexture(a.TEXTURE_CUBE_MAP, c), this._program.positionAttribPointer(e.positionAttribParams("vertPosition"));
|
|
3116
3116
|
}
|
|
@@ -3225,12 +3225,12 @@ class Mi extends V {
|
|
|
3225
3225
|
setup(e, r, i, n, s) {
|
|
3226
3226
|
if (!this._program)
|
|
3227
3227
|
throw new Error("SpecularMapCubeShader: Shader program is not loaded.");
|
|
3228
|
-
const { material: o } = r, a = this.renderer, { gl:
|
|
3228
|
+
const { material: o } = r, a = this.renderer, { gl: A } = a;
|
|
3229
3229
|
a.state.shaderProgram = this._program;
|
|
3230
3230
|
const c = w.Mult(s, n);
|
|
3231
|
-
this._program.uniformMatrix4fv("uMVP", !1, c),
|
|
3231
|
+
this._program.uniformMatrix4fv("uMVP", !1, c), A.activeTexture(A.TEXTURE0), this._program.uniform1i("uCubemap", 0);
|
|
3232
3232
|
const d = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
3233
|
-
|
|
3233
|
+
A.bindTexture(A.TEXTURE_CUBE_MAP, d), this._program.positionAttribPointer(e.positionAttribParams("vertPosition"));
|
|
3234
3234
|
}
|
|
3235
3235
|
destroy() {
|
|
3236
3236
|
this._program && (T.Delete(this._program), this._program = null);
|
|
@@ -3262,8 +3262,8 @@ function Js(t) {
|
|
|
3262
3262
|
for (; e < r; ) {
|
|
3263
3263
|
let i = e, n = e + 1, s = e + 2;
|
|
3264
3264
|
s == r ? s = 0 : n == r && (n = 0, s = 2);
|
|
3265
|
-
let o = t[i], a = t[n],
|
|
3266
|
-
Vt(o) && Vt(a) && Vt(
|
|
3265
|
+
let o = t[i], a = t[n], A = t[s];
|
|
3266
|
+
Vt(o) && Vt(a) && Vt(A) ? (jt.apply(this, [o]), jt.apply(this, [a]), jt.apply(this, [A])) : console.warn("Invalid point data found loading OBJ file"), e += 3;
|
|
3267
3267
|
}
|
|
3268
3268
|
}
|
|
3269
3269
|
function Zs(t) {
|
|
@@ -3276,9 +3276,9 @@ function Zs(t) {
|
|
|
3276
3276
|
for (; e = i.exec(r); ) {
|
|
3277
3277
|
let s = Number(e[1]), o = e[3] ? Number(e[3]) : null, a = e[2] ? Number(e[2]) : null;
|
|
3278
3278
|
s = s < 0 ? this._vertexArray.length + s : s - 1;
|
|
3279
|
-
let
|
|
3279
|
+
let A = this._vertexArray[s], c = null, d = null;
|
|
3280
3280
|
o !== null && (o = o < 0 ? this._normalArray.length + o : o === null ? null : o - 1, c = o !== null ? this._normalArray[o] : null), a !== null && (a = a < 0 ? this._texCoordArray.length + a : a === null ? null : a - 1, d = a !== null ? this._texCoordArray[a] : null), n.push({
|
|
3281
|
-
vertex:
|
|
3281
|
+
vertex: A,
|
|
3282
3282
|
normal: c,
|
|
3283
3283
|
tex: d
|
|
3284
3284
|
});
|
|
@@ -4585,7 +4585,7 @@ function ao(t, e) {
|
|
|
4585
4585
|
function ho(t, e = 0.3, r = new h(0, 0, 1), i = new h(0, 1, 0)) {
|
|
4586
4586
|
const n = new de();
|
|
4587
4587
|
r.normalize(), n.drawMode = ae.LINES;
|
|
4588
|
-
const s = w.MakeRotationWithDirection(r, i), o = s.multVector(new h(0, 0, -1)), a = s.multVector(new h(e, 0, -1 + e)),
|
|
4588
|
+
const s = w.MakeRotationWithDirection(r, i), o = s.multVector(new h(0, 0, -1)), a = s.multVector(new h(e, 0, -1 + e)), A = s.multVector(new h(-e, 0, -1 + e));
|
|
4589
4589
|
return n.vertex = [
|
|
4590
4590
|
0,
|
|
4591
4591
|
0,
|
|
@@ -4602,9 +4602,9 @@ function ho(t, e = 0.3, r = new h(0, 0, 1), i = new h(0, 1, 0)) {
|
|
|
4602
4602
|
o.x * t,
|
|
4603
4603
|
o.y * t,
|
|
4604
4604
|
o.z * t,
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4605
|
+
A.x * t,
|
|
4606
|
+
A.y * t,
|
|
4607
|
+
A.z * t
|
|
4608
4608
|
], n.normal = [
|
|
4609
4609
|
0,
|
|
4610
4610
|
0,
|
|
@@ -4697,10 +4697,10 @@ class zi extends V {
|
|
|
4697
4697
|
const { material: o } = r;
|
|
4698
4698
|
if (!o.albedoTexture)
|
|
4699
4699
|
throw new Error("SkySphereShader: material does not have an albedo texture");
|
|
4700
|
-
const a = this.renderer, { gl:
|
|
4701
|
-
a.state.shaderProgram = this._program, this._program.uniformMatrix4fv("mView", !1, n), this._program.uniformMatrix4fv("mProj", !1, s),
|
|
4700
|
+
const a = this.renderer, { gl: A } = a;
|
|
4701
|
+
a.state.shaderProgram = this._program, this._program.uniformMatrix4fv("mView", !1, n), this._program.uniformMatrix4fv("mProj", !1, s), A.activeTexture(A.TEXTURE0), this._program.uniform1i("uTexture", 0);
|
|
4702
4702
|
const c = r.getTextureRenderer("albedoTexture")?.getApiObject(), d = Be[o.albedoTexture.target];
|
|
4703
|
-
|
|
4703
|
+
A.bindTexture(A[d], c), this._program.positionAttribPointer(e.positionAttribParams("vertPosition")), this._program.texCoordAttribPointer(e.texCoord0AttribParams("t0Position"));
|
|
4704
4704
|
}
|
|
4705
4705
|
destroy() {
|
|
4706
4706
|
this._program && (T.Delete(this._program), this._program = null);
|
|
@@ -4974,8 +4974,8 @@ class bt extends V {
|
|
|
4974
4974
|
throw new Error("TextureMergerShader: B texture is not set");
|
|
4975
4975
|
if (!this._textures[y.A])
|
|
4976
4976
|
throw new Error("TextureMergerShader: A texture is not set");
|
|
4977
|
-
const a = this.renderer.factory.texture(this._textures[y.R]),
|
|
4978
|
-
this._program.bindTexture("uTextureR", a, 0), this._program.bindTexture("uTextureG",
|
|
4977
|
+
const a = this.renderer.factory.texture(this._textures[y.R]), A = this.renderer.factory.texture(this._textures[y.G]), c = this.renderer.factory.texture(this._textures[y.B]), d = this.renderer.factory.texture(this._textures[y.A]);
|
|
4978
|
+
this._program.bindTexture("uTextureR", a, 0), this._program.bindTexture("uTextureG", A, 1), this._program.bindTexture("uTextureB", c, 2), this._program.bindTexture("uTextureA", d, 3), this._program.uniform1i("uRChannel", this._textureChannels[y.R] || 0), this._program.uniform1i("uGChannel", this._textureChannels[y.G] || 1), this._program.uniform1i("uBChannel", this._textureChannels[y.B] || 2), this._program.uniform1i("uAChannel", this._textureChannels[y.A] || 3), this._program.positionAttribPointer(e.positionAttribParams("position")), this._program.texCoordAttribPointer(e.texCoord0AttribParams("texCoord"));
|
|
4979
4979
|
}
|
|
4980
4980
|
}
|
|
4981
4981
|
class Ii {
|
|
@@ -5047,9 +5047,9 @@ class Si extends V {
|
|
|
5047
5047
|
throw new Error("PresentTextureShader: shader program is not loaded");
|
|
5048
5048
|
const o = this.renderer, { gl: a } = o;
|
|
5049
5049
|
o.state.shaderProgram = this._program, a.activeTexture(a.TEXTURE0), this._program.uniform1i("uTexture", 0);
|
|
5050
|
-
const
|
|
5051
|
-
if (c &&
|
|
5052
|
-
const d = Be[
|
|
5050
|
+
const A = r.material, c = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
5051
|
+
if (c && A.albedoTexture) {
|
|
5052
|
+
const d = Be[A.albedoTexture.target];
|
|
5053
5053
|
a.bindTexture(a[d], c);
|
|
5054
5054
|
} else
|
|
5055
5055
|
throw new Error("PresentTextureShader: invalid material setup. The albedoTexture material attribute must to be a texture");
|
|
@@ -5658,8 +5658,8 @@ class Ui extends pt {
|
|
|
5658
5658
|
const n = i.currentPath;
|
|
5659
5659
|
i.currentPath = li(e);
|
|
5660
5660
|
const s = new _e(), o = new fe("Scene Root"), { scene: a } = await s.load(e);
|
|
5661
|
-
for (const
|
|
5662
|
-
const c = await Gi(
|
|
5661
|
+
for (const A of a) {
|
|
5662
|
+
const c = await Gi(A, i);
|
|
5663
5663
|
o.addChild(c);
|
|
5664
5664
|
}
|
|
5665
5665
|
return i.currentPath = n, o;
|
|
@@ -5730,7 +5730,7 @@ class Oe extends se {
|
|
|
5730
5730
|
}, s = Ui.PreferredDrawableFormat() === wr.BG2 ? await i(e.name + ".bg2") || await i(e.name + ".vwglb") : await i(e.name + ".vwglb") || await i(e.name + ".bg2");
|
|
5731
5731
|
if (!s)
|
|
5732
5732
|
throw new Error(`Drawable.deserialize(): could not load drawable with name ${e.name}`);
|
|
5733
|
-
s.items.forEach(({ polyList: o, material: a, transform:
|
|
5733
|
+
s.items.forEach(({ polyList: o, material: a, transform: A }) => this.addPolyList(o, a, A)), this.name = s.name;
|
|
5734
5734
|
}
|
|
5735
5735
|
async serialize(e, r) {
|
|
5736
5736
|
throw await super.serialize(e, r), new Error("Drawable.serialice() not implemented");
|
|
@@ -5771,13 +5771,13 @@ class wo {
|
|
|
5771
5771
|
}
|
|
5772
5772
|
loadBg2FileAsJson(e) {
|
|
5773
5773
|
const r = this.loadBg2File(e), i = this.getBg2FileHeader(r), n = this.getComponentData(r), s = this.getMaterialsData(r), o = this.getJointData(r), a = [];
|
|
5774
|
-
for (let
|
|
5775
|
-
a.push(this.getPolyList(r,
|
|
5774
|
+
for (let A = 0; A < i.numberOfPlist; ++A)
|
|
5775
|
+
a.push(this.getPolyList(r, A));
|
|
5776
5776
|
return this.freeBg2File(r), { header: i, components: n, materials: s, joints: o, polyLists: a };
|
|
5777
5777
|
}
|
|
5778
5778
|
getBg2BufferFromJson(e) {
|
|
5779
5779
|
const { header: r, materials: i, joints: n, polyLists: s, components: o } = e, a = this.instance._createBg2File(this._debug ? 1 : 0);
|
|
5780
|
-
let
|
|
5780
|
+
let A = null;
|
|
5781
5781
|
if (a) {
|
|
5782
5782
|
this.instance._setFileHeader(
|
|
5783
5783
|
a,
|
|
@@ -5794,11 +5794,11 @@ class wo {
|
|
|
5794
5794
|
const c = this.instance._createBufferWithBg2File(a, this._debug ? 1 : 0);
|
|
5795
5795
|
if (c) {
|
|
5796
5796
|
const d = new Int32Array(this.instance.HEAPU8.buffer, c, 1)[0], P = new Uint32Array(this.instance.HEAPU8.buffer, c + 4, 1)[0];
|
|
5797
|
-
|
|
5797
|
+
A = new Uint8Array(this.instance.HEAPU8.buffer, P, d).slice(), this.instance._freeBufferWrapper(c, this._debug ? 1 : 0);
|
|
5798
5798
|
}
|
|
5799
5799
|
this.instance._freeBg2File(a, this._debug ? 1 : 0);
|
|
5800
5800
|
}
|
|
5801
|
-
return
|
|
5801
|
+
return A;
|
|
5802
5802
|
}
|
|
5803
5803
|
getBg2FileHeader(e) {
|
|
5804
5804
|
const r = this._instance._getBg2FileHeader(e, this._debug ? 1 : 0), i = new Uint8Array(this.instance.HEAPU8.buffer, r, 4), n = new Int32Array(this.instance.HEAP32.buffer, r + 4, 1)[0];
|
|
@@ -5839,12 +5839,12 @@ class wo {
|
|
|
5839
5839
|
getPolyList(e, r) {
|
|
5840
5840
|
const i = this._instance._getPolyList(e, r, this._debug ? 1 : 0);
|
|
5841
5841
|
if (i) {
|
|
5842
|
-
const n = new Int32Array(this.instance.HEAPU8.buffer, i, 16), s = n[0], o = n[1], a = n[2],
|
|
5842
|
+
const n = new Int32Array(this.instance.HEAPU8.buffer, i, 16), s = n[0], o = n[1], a = n[2], A = n[3], c = n[4], d = n[5], P = n[6], C = n[7], v = n[8], D = n[9], B = n[10], N = n[11], K = n[12], G = n[13], H = n[14], L = n[15];
|
|
5843
5843
|
return {
|
|
5844
5844
|
name: this.getStringFromCStr(s),
|
|
5845
5845
|
matName: this.getStringFromCStr(o),
|
|
5846
5846
|
groupName: this.getStringFromCStr(a),
|
|
5847
|
-
visible:
|
|
5847
|
+
visible: A === 1,
|
|
5848
5848
|
vertex: this.getFloatArray(d, c),
|
|
5849
5849
|
normal: this.getFloatArray(C, P),
|
|
5850
5850
|
texCoord0: this.getFloatArray(D, v),
|
|
@@ -5988,7 +5988,7 @@ const vr = {
|
|
|
5988
5988
|
const i = Qs(t), n = new RegExp(i, "i"), s = `Could not find a plugin to ${r.operationType} file '${t}' of type '${e}'.`, o = r.plugins[e];
|
|
5989
5989
|
if (o) {
|
|
5990
5990
|
for (const a of o)
|
|
5991
|
-
if (a.supportedExtensions.find((
|
|
5991
|
+
if (a.supportedExtensions.find((A) => n.test(A)))
|
|
5992
5992
|
return a;
|
|
5993
5993
|
throw new Error(s);
|
|
5994
5994
|
} else
|
|
@@ -6498,8 +6498,8 @@ class Qt extends se {
|
|
|
6498
6498
|
if (this.node) {
|
|
6499
6499
|
const i = w.MakeIdentity();
|
|
6500
6500
|
this.node.children.forEach((n, s) => {
|
|
6501
|
-
const o = n.transform, a = n.component("InputChainJoint"),
|
|
6502
|
-
s > 0 && a ? a.joint.applyTransform(i) : i.identity(), o && o.matrix.assign(i),
|
|
6501
|
+
const o = n.transform, a = n.component("InputChainJoint"), A = n.component("OutputChainJoint");
|
|
6502
|
+
s > 0 && a ? a.joint.applyTransform(i) : i.identity(), o && o.matrix.assign(i), A && A.joint.applyTransform(i);
|
|
6503
6503
|
});
|
|
6504
6504
|
}
|
|
6505
6505
|
}
|
|
@@ -6734,14 +6734,14 @@ class he extends se {
|
|
|
6734
6734
|
position: s,
|
|
6735
6735
|
color: o,
|
|
6736
6736
|
spotCutoff: a,
|
|
6737
|
-
spotExponent:
|
|
6737
|
+
spotExponent: A,
|
|
6738
6738
|
shadowStrength: c,
|
|
6739
6739
|
castShadows: d,
|
|
6740
6740
|
shadowBias: P,
|
|
6741
6741
|
intensity: C,
|
|
6742
6742
|
projection: v
|
|
6743
6743
|
}) {
|
|
6744
|
-
e !== void 0 && (this.light.enabled = e), r !== void 0 && (this.light.type = r), i !== void 0 && (this.light.type = i), n !== void 0 && (this.light.direction = n), s !== void 0 && (this.light.position = s), o !== void 0 && (this.light.color = o), a !== void 0 && (this.light.spotCutoff = a),
|
|
6744
|
+
e !== void 0 && (this.light.enabled = e), r !== void 0 && (this.light.type = r), i !== void 0 && (this.light.type = i), n !== void 0 && (this.light.direction = n), s !== void 0 && (this.light.position = s), o !== void 0 && (this.light.color = o), a !== void 0 && (this.light.spotCutoff = a), A !== void 0 && (this.light.spotExponent = A), c !== void 0 && (this.light.shadowStrength = c), d !== void 0 && (this.light.castShadows = d), P !== void 0 && (this.light.shadowBias = P), C !== void 0 && (this.light.intensity = C), v !== void 0 && (this.light.projection = v);
|
|
6745
6745
|
}
|
|
6746
6746
|
async deserialize(e, r) {
|
|
6747
6747
|
await this._light.deserialize(e);
|
|
@@ -7287,8 +7287,8 @@ class rt extends se {
|
|
|
7287
7287
|
e.touches.forEach((P) => {
|
|
7288
7288
|
P.identifier === r.identifier ? n = P : P.identifier === i.identifier && (s = P);
|
|
7289
7289
|
});
|
|
7290
|
-
const o = h.Magnitude(h.Sub(new h(r.x, r.y), new h(i.x, i.y))), a = h.Magnitude(h.Sub(new h(n.x, n.y), new h(s.x, s.y))),
|
|
7291
|
-
c.scale(
|
|
7290
|
+
const o = h.Magnitude(h.Sub(new h(r.x, r.y), new h(i.x, i.y))), a = h.Magnitude(h.Sub(new h(n.x, n.y), new h(s.x, s.y))), A = new h(r.y - n.y, i.x - s.x), c = this.transform.matrix.upVector, d = this.transform.matrix.leftVector;
|
|
7291
|
+
c.scale(A.x * -1e-3 * this._distance), d.scale(A.y * -1e-3 * this._distance), this._center = h.Add(this._center, h.Add(c, d)), this._distance += (o - a) * 5e-3 * this._distance;
|
|
7292
7292
|
}
|
|
7293
7293
|
e.stopPropagation();
|
|
7294
7294
|
}
|
|
@@ -7907,8 +7907,8 @@ class St {
|
|
|
7907
7907
|
o.setBlendState(c), a.setBlendState(c);
|
|
7908
7908
|
}
|
|
7909
7909
|
o.create(), a.cullFace = !1, a.create();
|
|
7910
|
-
const
|
|
7911
|
-
|
|
7910
|
+
const A = this.getQueue(e);
|
|
7911
|
+
A ? A.enabled = !0 : this._queues.push({
|
|
7912
7912
|
layer: e,
|
|
7913
7913
|
shader: r,
|
|
7914
7914
|
beginOperation: i,
|
|
@@ -7933,11 +7933,11 @@ class St {
|
|
|
7933
7933
|
}
|
|
7934
7934
|
addPolyList(e, r, i) {
|
|
7935
7935
|
const n = vi(e.polyList, r.material);
|
|
7936
|
-
this._queues.forEach(({ layer: s, shader: o, queue: a, pipelines:
|
|
7936
|
+
this._queues.forEach(({ layer: s, shader: o, queue: a, pipelines: A }) => {
|
|
7937
7937
|
if (n & s) {
|
|
7938
7938
|
const { polyList: c } = e;
|
|
7939
7939
|
let d = null;
|
|
7940
|
-
c.enableCullFace ? d =
|
|
7940
|
+
c.enableCullFace ? d = A.cullBackFace : d = A.cullFaceDisabled, a.push(new Dt({
|
|
7941
7941
|
shader: o,
|
|
7942
7942
|
polyListRenderer: e,
|
|
7943
7943
|
materialRenderer: r,
|
|
@@ -8631,8 +8631,8 @@ class Cn extends V {
|
|
|
8631
8631
|
setup(e, r, i, n, s) {
|
|
8632
8632
|
if (!this._program)
|
|
8633
8633
|
throw new Error("SelectionHighlightShader: shader program is not loaded");
|
|
8634
|
-
const o = this.renderer, { gl: a, viewport:
|
|
8635
|
-
o.state.shaderProgram = this._program, a.activeTexture(a.TEXTURE0), this._program.uniform1i("uTexture", 0), this._program.uniform2f("uTexSize",
|
|
8634
|
+
const o = this.renderer, { gl: a, viewport: A } = o;
|
|
8635
|
+
o.state.shaderProgram = this._program, a.activeTexture(a.TEXTURE0), this._program.uniform1i("uTexture", 0), this._program.uniform2f("uTexSize", A[2], A[3]), this._program.uniform1f("uBorderWidth", this._borderWidth), this._program.uniform4fv("uBorderColor", this._borderColor), this._program.uniform1fv("uConvMatrix", this._convMatrix);
|
|
8636
8636
|
const c = r.material, d = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
8637
8637
|
if (d && c.albedoTexture) {
|
|
8638
8638
|
const P = Be[c.albedoTexture.target];
|
|
@@ -8698,10 +8698,10 @@ class d0 {
|
|
|
8698
8698
|
return;
|
|
8699
8699
|
const a = w.GetInverted(oe.GetWorldMatrix(r.node));
|
|
8700
8700
|
this._renderQueue.viewMatrix = a, this._renderQueue.projectionMatrix = r.projectionMatrix, this._renderQueue.newFrame(), this._frameVisitor.modelMatrix.identity(), e.accept(this._frameVisitor);
|
|
8701
|
-
let
|
|
8701
|
+
let A = null;
|
|
8702
8702
|
return this._renderBuffer.update(() => {
|
|
8703
|
-
this._renderBuffer?.frameBuffer.clear(), this._renderQueue?.draw(k.SELECTION_DEFAULT),
|
|
8704
|
-
}),
|
|
8703
|
+
this._renderBuffer?.frameBuffer.clear(), this._renderQueue?.draw(k.SELECTION_DEFAULT), A = this._renderBuffer?.readPixels(i, n, s, o);
|
|
8704
|
+
}), A;
|
|
8705
8705
|
}
|
|
8706
8706
|
destroy() {
|
|
8707
8707
|
this._renderBuffer?.destroy(), this._targetTexture?.destroy(), this._renderBuffer = null, this._targetTexture = null;
|
|
@@ -8788,7 +8788,9 @@ class v0 {
|
|
|
8788
8788
|
this._enabled = e, this._enabled || this.clearSelection();
|
|
8789
8789
|
}
|
|
8790
8790
|
clearSelection() {
|
|
8791
|
-
this._selection.forEach((e) =>
|
|
8791
|
+
this._selection.forEach((e) => {
|
|
8792
|
+
e.drawable.items.forEach((r) => r.polyList.selected = !1);
|
|
8793
|
+
}), this._selection = [], this.triggerSelectionChanged();
|
|
8792
8794
|
}
|
|
8793
8795
|
set sceneRoot(e) {
|
|
8794
8796
|
this._sceneRoot = e, this.clearSelection();
|
|
@@ -8836,7 +8838,9 @@ class v0 {
|
|
|
8836
8838
|
const i = window.devicePixelRatio || 1;
|
|
8837
8839
|
this._selectionBuffer?.reshape(this._viewportSize[0], this._viewportSize[1]);
|
|
8838
8840
|
const n = this._selectionBuffer.draw(this.sceneRoot, this.camera, e.x * i, e.y * i), s = this._selectionIdVisitor.findElement(n), o = () => this._selection.find((a) => s && a.polyList === s.polyList && a.drawable === s.drawable);
|
|
8839
|
-
s && this.
|
|
8841
|
+
s && this._multiSelect && !o() ? (this._selection.push(s), this.triggerSelectionChanged()) : s && !o() ? (this._selection = [s], this.triggerSelectionChanged()) : s && this._multiSelect && o() ? (this._selection = this._selection.filter((a) => a.polyList !== s.polyList), this.triggerSelectionChanged()) : !s && this._selection.length > 0 && (this._selection = [], this.triggerSelectionChanged()), this.selectionMode === Ze.OBJECT && this._selection.forEach((a) => {
|
|
8842
|
+
a.drawable.items.forEach((A) => A.polyList.selected = !0);
|
|
8843
|
+
}), this._selection.forEach((a) => a.polyList.selected = !0);
|
|
8840
8844
|
}
|
|
8841
8845
|
}
|
|
8842
8846
|
mouseDown(e) {
|
|
@@ -8959,9 +8963,9 @@ class Dn extends V {
|
|
|
8959
8963
|
throw new Error("PresentDebugFramebufferShader: shader program is not loaded");
|
|
8960
8964
|
const o = this.renderer, { gl: a } = o;
|
|
8961
8965
|
o.state.shaderProgram = this._program, a.activeTexture(a.TEXTURE0), this._program.uniform1i("uTexture", 0);
|
|
8962
|
-
const
|
|
8963
|
-
if (c &&
|
|
8964
|
-
const d = Be[
|
|
8966
|
+
const A = r.material, c = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
8967
|
+
if (c && A.albedoTexture) {
|
|
8968
|
+
const d = Be[A.albedoTexture.target];
|
|
8965
8969
|
a.bindTexture(a[d], c);
|
|
8966
8970
|
} else
|
|
8967
8971
|
throw new Error("PresentDebugFramebufferShader: invalid material setup. The albedoTexture material attribute must to be a texture");
|
|
@@ -9012,11 +9016,11 @@ class xe {
|
|
|
9012
9016
|
const i = w.GetInverted(oe.GetWorldMatrix(e.node)), n = e.projectionMatrix;
|
|
9013
9017
|
this._renderBuffer.update(() => {
|
|
9014
9018
|
this._renderBuffer.frameBuffer.clear(), this._objects.forEach((o) => {
|
|
9015
|
-
const
|
|
9019
|
+
const A = w.MakeScale(o.scale, o.scale, o.scale).mult(o.transformMatrix);
|
|
9016
9020
|
this._materialRenderer.material.albedo = o.color, o.renderer.bindBuffers(), this._shader.setup(
|
|
9017
9021
|
o.renderer,
|
|
9018
9022
|
this._materialRenderer,
|
|
9019
|
-
|
|
9023
|
+
A,
|
|
9020
9024
|
i,
|
|
9021
9025
|
n
|
|
9022
9026
|
), o.renderer.draw();
|
|
@@ -9599,7 +9603,7 @@ class Nn {
|
|
|
9599
9603
|
let o = null;
|
|
9600
9604
|
if (r instanceof he ? (o = r.node, s = r) : r instanceof fe && (o = r, s = r.lightComponent || null), !o || !s)
|
|
9601
9605
|
throw Error("ShadowRenderer.getLightPosition(): invalid light. Light must be a Node or a LightComponent");
|
|
9602
|
-
const a = n.focusDistance,
|
|
9606
|
+
const a = n.focusDistance, A = oe.GetWorldMatrix(i), c = h.Add(w.GetPosition(A), h.Mult(A.forwardVector, -a)), d = oe.GetWorldMatrix(o), P = w.GetRotation(d).forwardVector;
|
|
9603
9607
|
P.scale(this._shadowMapRenderDistance);
|
|
9604
9608
|
const C = h.Add(c, P);
|
|
9605
9609
|
return d.setPosition(C), this._debug && (xe.Get(this._renderer).drawSphere({ radius: 0.1, color: p.Red(), position: c }), xe.Get(this.renderer).drawSphere({ radius: 0.1, color: p.Blue(), position: C }), xe.Get(this.renderer).drawArrow({ length: 0.8, color: p.Green(), transformMatrix: d })), d;
|
|
@@ -9662,8 +9666,8 @@ class Hn extends V {
|
|
|
9662
9666
|
throw new Error("SkyCubeShader: shader program is not loaded");
|
|
9663
9667
|
const o = this.renderer, { gl: a } = o;
|
|
9664
9668
|
o.state.shaderProgram = this._program;
|
|
9665
|
-
const
|
|
9666
|
-
this._program.uniformMatrix4fv("uMVP", !1,
|
|
9669
|
+
const A = w.Mult(s, n);
|
|
9670
|
+
this._program.uniformMatrix4fv("uMVP", !1, A), a.activeTexture(a.TEXTURE0), this._program.uniform1i("uCubemap", 0);
|
|
9667
9671
|
const c = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
9668
9672
|
a.bindTexture(a.TEXTURE_CUBE_MAP, c), this._program.positionAttribPointer(e.positionAttribParams("vertPosition"));
|
|
9669
9673
|
}
|
|
@@ -9960,8 +9964,8 @@ class Gn extends An {
|
|
|
9960
9964
|
}
|
|
9961
9965
|
this._stride = 3;
|
|
9962
9966
|
const s = 0, o = 3;
|
|
9963
|
-
let a = 3,
|
|
9964
|
-
this.hasNormal && (this._stride += 3, a += 3,
|
|
9967
|
+
let a = 3, A = 3, c = 3, d = 3, P = 3;
|
|
9968
|
+
this.hasNormal && (this._stride += 3, a += 3, A += 3, c += 3, d += 3, P += 3), this.hasTexCoord0 && (this._stride += 2, A += 2, c += 2, d += 2, P += 2), this.hasTexCoord1 && (this._stride += 2, c += 2, d += 2, P += 2), this.hasTexCoord2 && (this._stride += 2, d += 2, P += 2), this.hasColor && (this._stride += 4, P += 4), this.hasTangent && (this._stride += 3), this._offsets = { vertex: s, normal: o, texCoord0: a, texCoord1: A, texCoord2: c, color: d, tangent: P }, this._vertexBuffer = Ae.CreateArrayBuffer(e, new Float32Array(n));
|
|
9965
9969
|
const C = this.polyList.index.length < 65535 ? new Uint16Array(this.polyList.index) : new Uint32Array(this.polyList.index);
|
|
9966
9970
|
this._indexBuffer = Ae.CreateElementArrayBuffer(e, C), this._indexArrayFormat = C instanceof Uint16Array ? e.UNSIGNED_SHORT : e.UNSIGNED_INT;
|
|
9967
9971
|
}
|
|
@@ -10114,8 +10118,8 @@ class Un extends ln {
|
|
|
10114
10118
|
readPixels(e, r, i, n) {
|
|
10115
10119
|
const o = this.attachments[0]?.texture;
|
|
10116
10120
|
if (o) {
|
|
10117
|
-
const { gl: a } = this.renderer,
|
|
10118
|
-
return a.readPixels(e, o.size.height - r, i, n, a.RGBA, a.UNSIGNED_BYTE,
|
|
10121
|
+
const { gl: a } = this.renderer, A = new Uint8Array(i * n * 4);
|
|
10122
|
+
return a.readPixels(e, o.size.height - r, i, n, a.RGBA, a.UNSIGNED_BYTE, A), A;
|
|
10119
10123
|
}
|
|
10120
10124
|
}
|
|
10121
10125
|
beginUpdateTexture() {
|
|
@@ -10142,12 +10146,12 @@ class Un extends ln {
|
|
|
10142
10146
|
if (Object.keys(this.attachments).length !== 1)
|
|
10143
10147
|
throw new Error("Unexpected number of texture attachments rendering cube map. The cube map renderer supports only one color attachment.");
|
|
10144
10148
|
this.destroy(), this._framebuffers = [], this._depthBuffers = [];
|
|
10145
|
-
const { width: a, height:
|
|
10149
|
+
const { width: a, height: A } = s.size;
|
|
10146
10150
|
for (let c = 0; c < 6; ++c) {
|
|
10147
10151
|
const d = r.createFramebuffer();
|
|
10148
10152
|
r.bindFramebuffer(r.FRAMEBUFFER, d), this._framebuffers.push(d), r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_CUBE_MAP_POSITIVE_X + c, n, 0);
|
|
10149
10153
|
const P = r.createRenderbuffer();
|
|
10150
|
-
if (this._depthBuffers.push(P), r.bindRenderbuffer(r.RENDERBUFFER, P), r.renderbufferStorage(r.RENDERBUFFER, r.DEPTH_COMPONENT16, a,
|
|
10154
|
+
if (this._depthBuffers.push(P), r.bindRenderbuffer(r.RENDERBUFFER, P), r.renderbufferStorage(r.RENDERBUFFER, r.DEPTH_COMPONENT16, a, A), r.framebufferRenderbuffer(r.FRAMEBUFFER, r.DEPTH_ATTACHMENT, r.RENDERBUFFER, P), r.checkFramebufferStatus(r.FRAMEBUFFER) != r.FRAMEBUFFER_COMPLETE) {
|
|
10151
10155
|
const C = r.checkFramebufferStatus(r.FRAMEBUFFER);
|
|
10152
10156
|
throw new Error(`Cubemap frame buffer not complete in cube side #${c}: ${M0(r, C)}`);
|
|
10153
10157
|
}
|
|
@@ -10438,8 +10442,8 @@ class Xn extends V {
|
|
|
10438
10442
|
throw new Error("BasicPBRLightShader: lights array not specified");
|
|
10439
10443
|
const a = r.material;
|
|
10440
10444
|
r.mergeTextures(), o.state.shaderProgram = this._program;
|
|
10441
|
-
const
|
|
10442
|
-
if (this._program.bindMatrix("uNormMatrix",
|
|
10445
|
+
const A = w.GetNormalMatrix(i);
|
|
10446
|
+
if (this._program.bindMatrix("uNormMatrix", A), this._program.bindMatrix("uWorld", i), this._program.bindMatrix("uView", n), this._program.bindMatrix("uViewInverse", w.GetInverted(n)), this._program.bindMatrix("uProj", s), this._cameraPosition ? this._program.bindVector("uCameraPos", this._cameraPosition) : (console.warn("Serious performance warning: camera position not set in BasicPBRLightShader. Extracting the camera position from the view matrix involves inverting the matrix."), this._program.bindVector("uCameraPos", w.GetPosition(w.GetInverted(n)))), r.bindTexture(this._program, "albedoTexture", "uAlbedoTexture", 0), r.bindTexture(this._program, "normalTexture", "uNormalTexture", 1, Rn(this.renderer)), r.bindMetalnessRoughnessHeightAOTexture(this._program, "uMetallicRoughnessHeightAOTexture", 2), this._program.uniform1f("uAlphaTresshold", a.alphaCutoff), r.bindColor(this._program, "albedo", "uAlbedo"), r.bindValue(this._program, "metalness", "uMetallic"), r.bindValue(this._program, "roughness", "uRoughness"), r.bindValue(this._program, "lightEmission", "uLightEmission", 0), this._program.uniform1i("uAlbedoMap", a.albedoUV), this._program.uniform1i("uNormalMap", a.normalUV), this._program.uniform1i("uAOMap", a.ambientOcclussionUV), this._program.uniform1i("uMetallicMap", a.metalnessChannel), this._program.uniform1i("uRoughnessMap", a.roughnessChannel), this._program.uniform1i("uLightemissionMap", a.lightEmissionChannel), this._program.bindVector("uAlbedoScale", a.albedoScale), this._program.bindVector("uNormalScale", a.normalScale), this._program.bindVector("uMetallicScale", a.metalnessScale), this._program.bindVector("uRoughnessScale", a.roughnessScale), this._program.bindVector("uLightEmissionScale", a.lightEmissionScale), this._program.bindVector("uFresnelTint", a.fresnelTint), this._program.bindVector("uSheenColor", a.sheenColor), this._program.uniform1f("uSheenIntensity", a.sheenIntensity), !this.irradianceMap || !this.specularMap || !this.environmentMap || !this._brdfIntegrationTexture)
|
|
10443
10447
|
throw new Error("PBRLightIBLShader: Environment maps not set.");
|
|
10444
10448
|
const c = this.renderer.factory.texture(this.irradianceMap), d = this.renderer.factory.texture(this.specularMap), P = this.renderer.factory.texture(this.environmentMap), C = this.renderer.factory.texture(this._brdfIntegrationTexture);
|
|
10445
10449
|
this._program.bindTexture("uIrradianceMap", c, 3), this._program.bindTexture("uSpecularMap", d, 4), this._program.bindTexture("uEnvMap", P, 5), this._program.bindTexture("uBRDFIntegrationMap", C, 6), this._program.uniform1f("uBrightness", this._brightness), this._program.uniform1f("uContrast", this._contrast), this._program.uniform1f("uAmbientIntensity", 1);
|
|
@@ -10667,13 +10671,13 @@ const L0 = (t, e) => {
|
|
|
10667
10671
|
const r = L0(t, e), i = I0(t, e);
|
|
10668
10672
|
if (t.bindTexture(r, e._apiObject), e.dataType === Qe.RENDER_TARGET) {
|
|
10669
10673
|
const { width: n, height: s } = e.size, o = e.renderTargetAttachment === Y.DEPTH_ATTACHMENT, a = o ? t.DEPTH_COMPONENT : t.RGBA;
|
|
10670
|
-
let
|
|
10674
|
+
let A = o ? t.DEPTH_COMPONENT : t.RGBA;
|
|
10671
10675
|
const c = o ? t.UNSIGNED_SHORT : i;
|
|
10672
10676
|
if (t.texParameteri(r, t.TEXTURE_MIN_FILTER, t.LINEAR), t.texParameteri(r, t.TEXTURE_MAG_FILTER, t.LINEAR), t.texParameteri(r, t.TEXTURE_WRAP_S, ct(t, e.wrapModeX)), t.texParameteri(r, t.TEXTURE_WRAP_T, ct(t, e.wrapModeY)), r === t.TEXTURE_CUBE_MAP)
|
|
10673
10677
|
for (let d = 0; d < 6; ++d)
|
|
10674
|
-
t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X + d, 0, a, n, s, 0,
|
|
10678
|
+
t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X + d, 0, a, n, s, 0, A, c, null);
|
|
10675
10679
|
else
|
|
10676
|
-
t.texImage2D(r, 0, a, n, s, 0,
|
|
10680
|
+
t.texImage2D(r, 0, a, n, s, 0, A, c, null);
|
|
10677
10681
|
e.imageData.currentSize = new h(e.size);
|
|
10678
10682
|
} else
|
|
10679
10683
|
t.texImage2D(r, 0, t.RGBA, t.RGBA, i, e._imageData), t.texParameteri(r, t.TEXTURE_WRAP_S, ct(t, e.wrapModeX)), t.texParameteri(r, t.TEXTURE_WRAP_T, ct(t, e.wrapModeY)), t.texParameteri(r, t.TEXTURE_MAG_FILTER, Zr(t, e.magFilter)), t.texParameteri(r, t.TEXTURE_MIN_FILTER, Zr(t, e.minFilter)), e.mipmapRequired && t.generateMipmap(r);
|
|
@@ -10758,19 +10762,19 @@ class Zn extends Et {
|
|
|
10758
10762
|
await super.init(e), this._canvas = e, this._gl = e.domElement.getContext("webgl", { preserveDrawingBuffer: !0 }), this._gl._bg2e_object = this;
|
|
10759
10763
|
const r = new URLSearchParams(location.search).get("debug") == "true";
|
|
10760
10764
|
if (this._debugMode = r, window.WebGLDebugUtils && r) {
|
|
10761
|
-
let i = function(a,
|
|
10762
|
-
throw window.WebGLDebugUtils.glEnumToString(a) + " was caused by call to: " +
|
|
10763
|
-
}, n = function(a,
|
|
10764
|
-
if (console.log("gl." + a + "(" + window.WebGLDebugUtils.glFunctionArgsToString(a,
|
|
10765
|
+
let i = function(a, A, c) {
|
|
10766
|
+
throw window.WebGLDebugUtils.glEnumToString(a) + " was caused by call to: " + A;
|
|
10767
|
+
}, n = function(a, A) {
|
|
10768
|
+
if (console.log("gl." + a + "(" + window.WebGLDebugUtils.glFunctionArgsToString(a, A) + ")"), /drawElements/.test(a)) {
|
|
10765
10769
|
const c = Ae.CurrentBuffer(s, Se.ELEMENT_ARRAY_BUFFER), d = Ae.CurrentBuffer(s, Se.ARRAY_BUFFER);
|
|
10766
10770
|
o(c?.id, "ELEMENT_ARRAY_BUFFER"), o(d?.id, "ARRAY_BUFFER");
|
|
10767
|
-
} else /bindBuffer/.test(a) &&
|
|
10771
|
+
} else /bindBuffer/.test(a) && A[0] === s.ELEMENT_ARRAY_BUFFER ? console.log(` BufferID: ${A[1]._bg2e_id_}`) : /bindBuffer/.test(a) && A[0] === s.ARRAY_BUFFER && console.log(` BufferID: ${A[1]._bg2e_id_}`);
|
|
10768
10772
|
};
|
|
10769
10773
|
const s = this._gl;
|
|
10770
10774
|
console.warn("Using WebGLDebugUtils: this must cause an impact in performance");
|
|
10771
|
-
const o = (a,
|
|
10772
|
-
const c = s.getBufferParameter(s[
|
|
10773
|
-
console.log(` ${
|
|
10775
|
+
const o = (a, A) => {
|
|
10776
|
+
const c = s.getBufferParameter(s[A], s.BUFFER_SIZE);
|
|
10777
|
+
console.log(` ${A} id: ${a}, size: ${c}`);
|
|
10774
10778
|
};
|
|
10775
10779
|
this._gl = window.WebGLDebugUtils.makeDebugContext(this._gl, i, n);
|
|
10776
10780
|
}
|
|
@@ -10919,8 +10923,8 @@ class X0 extends V {
|
|
|
10919
10923
|
throw new Error("BasicDiffuseColorShader: shader program is not loaded");
|
|
10920
10924
|
const { material: o } = r, a = this.renderer;
|
|
10921
10925
|
a.state.shaderProgram = this._program, this._program.uniformMatrix4fv("mWorld", !1, i), this._program.uniformMatrix4fv("mView", !1, n), this._program.uniformMatrix4fv("mProj", !1, s), this._program.uniform1i("uTexture", 0);
|
|
10922
|
-
let
|
|
10923
|
-
this._program.uniform3fv("uFixedColor", o.albedo.rgb),
|
|
10926
|
+
let A = r.getTextureRenderer("albedoTexture") || this._whiteTextureRenderer;
|
|
10927
|
+
this._program.uniform3fv("uFixedColor", o.albedo.rgb), A.activeTexture(0), A.bindTexture(), this._program.positionAttribPointer(e.positionAttribParams("vertPosition")), this._program.texCoordAttribPointer(e.texCoord0AttribParams("t0Position"));
|
|
10924
10928
|
}
|
|
10925
10929
|
destroy() {
|
|
10926
10930
|
this._program && (T.Delete(this._program), this._program = null);
|
|
@@ -11067,8 +11071,8 @@ class Y0 extends V {
|
|
|
11067
11071
|
throw new Error("BasicPBRLightShader: lights array not specified");
|
|
11068
11072
|
const o = r.material, a = this.renderer;
|
|
11069
11073
|
a.state.shaderProgram = this._program;
|
|
11070
|
-
const
|
|
11071
|
-
this._program.bindMatrix("uNormMatrix",
|
|
11074
|
+
const A = w.GetNormalMatrix(i);
|
|
11075
|
+
this._program.bindMatrix("uNormMatrix", A), this._program.bindMatrix("uWorld", i), this._program.bindMatrix("uView", n), this._program.bindMatrix("uProj", s), this._cameraPosition ? this._program.bindVector("uCameraPos", this._cameraPosition) : (console.warn("Serious performance warning: camera position not set in BasicPBRLightShader. Extracting the camera position from the view matrix involves inverting the matrix."), this._program.bindVector("uCameraPos", w.GetPosition(w.GetInverted(n)))), r.bindTexture(this._program, "albedoTexture", "uAlbedoTexture", 0), r.bindTexture(this._program, "normalTexture", "uNormalTexture", 1, Rn(this.renderer)), r.bindTexture(this._program, "metalnessTexture", "uMetallicTexture", 2), r.bindTexture(this._program, "roughnessTexture", "uRoughnessTexture", 3), r.bindColor(this._program, "albedo", "uAlbedo"), r.bindValue(this._program, "metalness", "uMetallic"), r.bindValue(this._program, "roughness", "uRoughness"), this._program.bindVector("uAlbedoScale", o.albedoScale), this._program.bindVector("uNormalScale", o.normalScale), this._program.bindVector("uMetallicScale", o.metalnessScale), this._program.bindVector("uRoughnessScale", o.roughnessScale), this._lights.forEach((c, d) => {
|
|
11072
11076
|
this._program?.uniform1i(`uLightTypes[${d}]`, this._lightTypes[d]), this._program?.bindVector(`uLightPositions[${d}]`, this._lightPositions[d]), this._program?.bindVector(`uLightDirections[${d}]`, this._lightDirections[d]), this._program?.bindVector(`uLightColors[${d}]`, this._lightColors[d].rgb), this._program?.uniform1f(`uLightIntensities[${d}]`, this._lightIntensities[d]);
|
|
11073
11077
|
}), this._program.bindAttribs(e, {
|
|
11074
11078
|
position: "inPosition",
|
|
@@ -11127,10 +11131,10 @@ class V0 {
|
|
|
11127
11131
|
r.bindFramebuffer(r.FRAMEBUFFER, o), r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, i._apiObject, 0);
|
|
11128
11132
|
let a = new Uint8Array(e.size.width * e.size.height * 4);
|
|
11129
11133
|
r.readPixels(0, 0, e.size[0], e.size[1], r.RGBA, r.UNSIGNED_BYTE, a);
|
|
11130
|
-
const
|
|
11134
|
+
const A = new ImageData(new Uint8ClampedArray(a), e.size.width, e.size.height), c = A.width, d = A.height, P = A.data;
|
|
11131
11135
|
Array.from({ length: d }, (v, D) => a.slice(D * c * 4, (D + 1) * c * 4)).forEach((v, D) => P.set(v, (d - D - 1) * c * 4));
|
|
11132
11136
|
const C = this._context;
|
|
11133
|
-
C && C.putImageData(
|
|
11137
|
+
C && C.putImageData(A, 0, 0), r.bindTexture(r.TEXTURE_2D, n), r.bindFramebuffer(r.FRAMEBUFFER, s);
|
|
11134
11138
|
}
|
|
11135
11139
|
}
|
|
11136
11140
|
const K0 = {
|