bg2e-js 2.3.13 → 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 +234 -221
- package/dist/bg2e-js.js.map +1 -1
- package/package.json +1 -1
- package/src/base/PolyList.ts +14 -1
- package/src/manipulation/SelectionHighlight.ts +0 -1
- package/src/manipulation/SelectionIdAssignVisitor.ts +10 -3
- package/src/manipulation/SelectionManager.ts +17 -3
- package/src/scene/Drawable.ts +4 -0
package/dist/bg2e-js.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var gt = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.X = 1] = "X", t[t.Y = 2] = "Y", t[t.Z = 3] = "Z", t[t.W = 4] = "W", t))(gt || {});
|
|
2
2
|
((t) => {
|
|
3
3
|
function e(r) {
|
|
4
4
|
switch (r) {
|
|
@@ -17,11 +17,11 @@ var ct = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.X = 1] = "X", t[t.
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
t.name = e;
|
|
20
|
-
})(
|
|
21
|
-
const _r = 3.141592653589793, $r = 0.01745329251994, ei = 57.29577951308233, qn = 1.5707963267948966, _n = 0.785398163397448, $n = 0.392699081698724, es = 6.283185307179586,
|
|
20
|
+
})(gt || (gt = {}));
|
|
21
|
+
const _r = 3.141592653589793, $r = 0.01745329251994, ei = 57.29577951308233, qn = 1.5707963267948966, _n = 0.785398163397448, $n = 0.392699081698724, es = 6.283185307179586, ut = 1e-7, Le = Float32Array, ts = Float64Array, rs = 3402823e32, Ge = (t, e) => t.length >= e;
|
|
22
22
|
let Ft = Date.now();
|
|
23
|
-
const is = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, le = (t) => t > -
|
|
24
|
-
Axis:
|
|
23
|
+
const is = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, le = (t) => t > -ut && t < ut ? 0 : t, b = (t) => le(t) === 0, E = (t, e) => Math.abs(t - e) < ut, We = (t) => Math.fround(le(t * $r)), ti = (t) => Math.fround(le(t * ei)), ns = (t) => Math.fround(le(Math.sin(t))), ss = (t) => Math.fround(le(Math.cos(t))), ri = (t) => Math.fround(le(Math.tan(t))), os = (t) => Math.fround(le(1 / ri(t))), as = (t) => Math.fround(le(Math.atan(t))), hs = (t, e) => Math.fround(le(Math.atan2(t, e))), As = () => Math.random(), fs = () => (Ft = (Ft * 9301 + 49297) % 233280, 0 + Ft / 233280 * 1), ls = (t, e) => Math.fround(Math.max(t, e)), cs = (t, e) => Math.fround(Math.min(t, e)), gs = (t) => Math.fround(Math.abs(t)), us = (t) => Math.fround(Math.sqrt(t)), J = (t, e, r) => (r = r > 1 ? 1 : r, Math.fround((1 - r) * t + r * e)), ds = (t) => Math.fround(t * t), Z = (t, e, r) => Math.fround(Math.max(e, Math.min(t, r))), ws = {
|
|
24
|
+
Axis: gt,
|
|
25
25
|
PI: _r,
|
|
26
26
|
DEG_TO_RAD: $r,
|
|
27
27
|
RAD_TO_DEG: ei,
|
|
@@ -29,7 +29,7 @@ const is = (t) => typeof t != "number" ? !1 : t !== 0 && (t & t - 1) === 0, le =
|
|
|
29
29
|
PI_4: _n,
|
|
30
30
|
PI_8: $n,
|
|
31
31
|
TWO_PI: es,
|
|
32
|
-
EPSILON:
|
|
32
|
+
EPSILON: ut,
|
|
33
33
|
NumericArray: Le,
|
|
34
34
|
NumericArrayHighP: ts,
|
|
35
35
|
FLOAT_MAX: rs,
|
|
@@ -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);
|
|
@@ -1447,7 +1447,7 @@ const Cs = (t) => {
|
|
|
1447
1447
|
return "Browser";
|
|
1448
1448
|
}
|
|
1449
1449
|
}, ar = () => 0, ps = () => ar() === 0, Ds = () => ar() === 1, bs = async (t) => new Uint8Array(atob(t).split("").map((e) => e.charCodeAt(0)));
|
|
1450
|
-
class
|
|
1450
|
+
class qe {
|
|
1451
1451
|
set writeStrategy(e) {
|
|
1452
1452
|
this._writeStrategy = e;
|
|
1453
1453
|
}
|
|
@@ -1494,7 +1494,7 @@ const Gt = (t) => {
|
|
|
1494
1494
|
Gt(s.target), i(new Error(`Image load aborted '${t}'.`));
|
|
1495
1495
|
}), n.src = t + (e ? `?${Pt()}` : "");
|
|
1496
1496
|
});
|
|
1497
|
-
class ai extends
|
|
1497
|
+
class ai extends qe {
|
|
1498
1498
|
async load(e) {
|
|
1499
1499
|
return await Es(e, !1);
|
|
1500
1500
|
}
|
|
@@ -1513,7 +1513,7 @@ const Ut = (t) => {
|
|
|
1513
1513
|
Ut(n.target), r(new Error(`Video load aborted '${t}'`));
|
|
1514
1514
|
}), i.src = t;
|
|
1515
1515
|
});
|
|
1516
|
-
class hi extends
|
|
1516
|
+
class hi extends qe {
|
|
1517
1517
|
async load(e) {
|
|
1518
1518
|
return await xs(e);
|
|
1519
1519
|
}
|
|
@@ -1521,7 +1521,7 @@ class hi extends Ze {
|
|
|
1521
1521
|
throw new Error("VideoResourceProvider.write(): not supported");
|
|
1522
1522
|
}
|
|
1523
1523
|
}
|
|
1524
|
-
class Ai extends
|
|
1524
|
+
class Ai extends qe {
|
|
1525
1525
|
async load(e) {
|
|
1526
1526
|
const r = await fetch(e);
|
|
1527
1527
|
if (r.ok)
|
|
@@ -1529,7 +1529,7 @@ class Ai extends Ze {
|
|
|
1529
1529
|
throw new Error(`Resource not found at '${e}'`);
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
|
-
class fi extends
|
|
1532
|
+
class fi extends qe {
|
|
1533
1533
|
async load(e) {
|
|
1534
1534
|
const r = await fetch(e);
|
|
1535
1535
|
if (r.ok) {
|
|
@@ -1581,7 +1581,7 @@ const Qs = (t) => {
|
|
|
1581
1581
|
], di = (t) => Bt(t, cr), zs = (t) => {
|
|
1582
1582
|
Ct(t, cr);
|
|
1583
1583
|
}, Ls = () => cr;
|
|
1584
|
-
class
|
|
1584
|
+
class _e {
|
|
1585
1585
|
constructor({
|
|
1586
1586
|
imageProvider: e = null,
|
|
1587
1587
|
videoProvider: r = null,
|
|
@@ -1622,7 +1622,7 @@ const Is = {
|
|
|
1622
1622
|
isBigEndian: ms,
|
|
1623
1623
|
isLittleEndian: Ps,
|
|
1624
1624
|
UserAgent: Bs,
|
|
1625
|
-
Resource:
|
|
1625
|
+
Resource: _e,
|
|
1626
1626
|
isFormat: Bt,
|
|
1627
1627
|
addFormats: Ct,
|
|
1628
1628
|
isValidImage: gi,
|
|
@@ -1634,7 +1634,7 @@ const Is = {
|
|
|
1634
1634
|
isValidBinary: di,
|
|
1635
1635
|
addBinaryFormats: zs,
|
|
1636
1636
|
getValidBinaryFormats: Ls,
|
|
1637
|
-
ResourceProvider:
|
|
1637
|
+
ResourceProvider: qe,
|
|
1638
1638
|
ImageResourceProvider: ai,
|
|
1639
1639
|
VideoResourceProvider: hi,
|
|
1640
1640
|
BinaryResourceProvider: Ai,
|
|
@@ -1804,7 +1804,7 @@ class p extends h {
|
|
|
1804
1804
|
}
|
|
1805
1805
|
var wi = /* @__PURE__ */ ((t) => (t[t.VERTEX = 1] = "VERTEX", t[t.NORMAL = 2] = "NORMAL", t[t.TEX_COORD_0 = 4] = "TEX_COORD_0", t[t.TEX_COORD_1 = 8] = "TEX_COORD_1", t[t.TEX_COORD_2 = 16] = "TEX_COORD_2", t[t.COLOR = 32] = "COLOR", t[t.TANGENT = 64] = "TANGENT", t[t.INDEX = 128] = "INDEX", t))(wi || {}), ae = /* @__PURE__ */ ((t) => (t[t.POINTS = 0] = "POINTS", t[t.TRIANGLES = 1] = "TRIANGLES", t[t.TRIANGLE_FAN = 2] = "TRIANGLE_FAN", t[t.TRIANGLE_STRIP = 3] = "TRIANGLE_STRIP", t[t.LINES = 4] = "LINES", t[t.LINE_STRIP = 5] = "LINE_STRIP", t))(ae || {}), k = /* @__PURE__ */ ((t) => (t[t.LAYER_0 = 1] = "LAYER_0", t[t.OPAQUE_DEFAULT = 1] = "OPAQUE_DEFAULT", t[t.LAYER_1 = 2] = "LAYER_1", t[t.LAYER_2 = 4] = "LAYER_2", t[t.LAYER_3 = 8] = "LAYER_3", t[t.LAYER_4 = 16] = "LAYER_4", t[t.LAYER_5 = 32] = "LAYER_5", t[t.LAYER_6 = 64] = "LAYER_6", t[t.LAYER_7 = 128] = "LAYER_7", t[t.LAYER_8 = 256] = "LAYER_8", t[t.LAYER_9 = 512] = "LAYER_9", t[t.LAYER_10 = 1024] = "LAYER_10", t[t.LAYER_11 = 2048] = "LAYER_11", t[t.LAYER_12 = 4096] = "LAYER_12", t[t.LAYER_13 = 8192] = "LAYER_13", t[t.LAYER_14 = 16384] = "LAYER_14", t[t.LAYER_15 = 32768] = "LAYER_15", t[t.TRANSPARENT_DEFAULT = 32768] = "TRANSPARENT_DEFAULT", t[t.LAYER_16 = 65536] = "LAYER_16", t[t.LAYER_17 = 131072] = "LAYER_17", t[t.LAYER_18 = 262144] = "LAYER_18", t[t.LAYER_19 = 524288] = "LAYER_19", t[t.LAYER_20 = 1048576] = "LAYER_20", t[t.LAYER_21 = 2097152] = "LAYER_21", t[t.LAYER_22 = 4194304] = "LAYER_22", t[t.LAYER_23 = 8388608] = "LAYER_23", t[t.LAYER_24 = 16777216] = "LAYER_24", t[t.LAYER_25 = 33554432] = "LAYER_25", t[t.LAYER_26 = 67108864] = "LAYER_26", t[t.LAYER_27 = 134217728] = "LAYER_27", t[t.LAYER_28 = 268435456] = "LAYER_28", t[t.LAYER_29 = 536870912] = "LAYER_29", t[t.LAYER_30 = 1073741824] = "LAYER_30", t[t.LAYER_31 = -2147483648] = "LAYER_31", t[t.SELECTION_DEFAULT = -2147483648] = "SELECTION_DEFAULT", t[t.ALL = 4294967295] = "ALL", t[t.AUTO = 0] = "AUTO", t))(k || {});
|
|
1806
1806
|
const vi = (t, e) => t.renderLayers === 0 ? (e.isTransparent ? 32768 : 1) | -2147483648 : t.renderLayers;
|
|
1807
|
-
var
|
|
1807
|
+
var dt = /* @__PURE__ */ ((t) => (t[t.CW = 0] = "CW", t[t.CCW = 1] = "CCW", t))(dt || {}), De = /* @__PURE__ */ ((t) => (t[t.FRONT = 0] = "FRONT", t[t.BACK = 1] = "BACK", t[t.FRONT_AND_BACK = 2] = "FRONT_AND_BACK", t))(De || {});
|
|
1808
1808
|
function yr(t) {
|
|
1809
1809
|
const e = [], r = (s) => ({
|
|
1810
1810
|
pos: new h(t.vertex[s] * 3, t.vertex[s + 1] * 3, t.vertex[s + 2] * 3),
|
|
@@ -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,
|
|
@@ -1967,6 +1967,15 @@ class de {
|
|
|
1967
1967
|
set selectable(e) {
|
|
1968
1968
|
this._selectable = e;
|
|
1969
1969
|
}
|
|
1970
|
+
// The mainDrawable is a reference to the las Drawable object that contains this polyList. Note that
|
|
1971
|
+
// in some circunstances a polyList can be shared by several Drawable objects, but the mainDrawable
|
|
1972
|
+
// will be the last one that was assigned.
|
|
1973
|
+
get mainDrawable() {
|
|
1974
|
+
return this._mainDrawable;
|
|
1975
|
+
}
|
|
1976
|
+
set mainDrawable(e) {
|
|
1977
|
+
this._mainDrawable = e;
|
|
1978
|
+
}
|
|
1970
1979
|
// The this._renderer variable is initialized by the polyListRenderer factory
|
|
1971
1980
|
get renderer() {
|
|
1972
1981
|
return this._renderer;
|
|
@@ -2022,15 +2031,15 @@ const Ss = (t, e = "image/jpeg") => {
|
|
|
2022
2031
|
radiusY: n.radiusY
|
|
2023
2032
|
}));
|
|
2024
2033
|
};
|
|
2025
|
-
let
|
|
2026
|
-
class
|
|
2034
|
+
let it = null;
|
|
2035
|
+
class $e {
|
|
2027
2036
|
static FirstCanvas() {
|
|
2028
|
-
if (!
|
|
2037
|
+
if (!it)
|
|
2029
2038
|
throw new Error("No Canvas instance has been created yet.");
|
|
2030
|
-
return
|
|
2039
|
+
return it;
|
|
2031
2040
|
}
|
|
2032
2041
|
constructor(e, r) {
|
|
2033
|
-
this._renderer = r, this._domElement = e, this._domElement._bg2e_id = Pt(),
|
|
2042
|
+
this._renderer = r, this._domElement = e, this._domElement._bg2e_id = Pt(), it = it || this, this._mainLoop = null;
|
|
2034
2043
|
}
|
|
2035
2044
|
get id() {
|
|
2036
2045
|
return this._domElement._bg2e_id;
|
|
@@ -2128,25 +2137,25 @@ const Ci = Object.freeze({
|
|
|
2128
2137
|
2: "G",
|
|
2129
2138
|
3: "B",
|
|
2130
2139
|
4: "A"
|
|
2131
|
-
}),
|
|
2140
|
+
}), nt = {};
|
|
2132
2141
|
let Xt = null;
|
|
2133
|
-
const kt = {}, Rs = async (t) => (Xt || (Xt = new
|
|
2142
|
+
const kt = {}, Rs = async (t) => (Xt || (Xt = new _e()), kt[t] ? console.log(`Image already loaded or loading: ${t}`) : (console.log(`Loading image: ${t}`), kt[t] = new Promise(async (e, r) => {
|
|
2134
2143
|
const i = await Xt?.load(t), n = document.createElement("canvas");
|
|
2135
2144
|
n.width = i.naturalWidth, n.height = i.naturalHeight;
|
|
2136
2145
|
const s = n.getContext("2d");
|
|
2137
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);
|
|
2138
2147
|
const o = new Image();
|
|
2139
|
-
await new Promise((
|
|
2148
|
+
await new Promise((A) => {
|
|
2140
2149
|
o.onload = () => {
|
|
2141
|
-
o._hash = mi(o),
|
|
2150
|
+
o._hash = mi(o), A();
|
|
2142
2151
|
}, o.src = n.toDataURL();
|
|
2143
2152
|
}), e(o);
|
|
2144
2153
|
})), kt[t]), Mr = async (t) => {
|
|
2145
2154
|
const r = await new Promise((a) => {
|
|
2146
|
-
const
|
|
2147
|
-
|
|
2148
|
-
a(
|
|
2149
|
-
},
|
|
2155
|
+
const A = new Image();
|
|
2156
|
+
A.onload = () => {
|
|
2157
|
+
a(A);
|
|
2158
|
+
}, A.src = t;
|
|
2150
2159
|
}), i = document.createElement("canvas");
|
|
2151
2160
|
i.width = r.naturalWidth, i.height = r.naturalHeight;
|
|
2152
2161
|
const n = i.getContext("2d");
|
|
@@ -2184,7 +2193,7 @@ function ks(t) {
|
|
|
2184
2193
|
}
|
|
2185
2194
|
class x {
|
|
2186
2195
|
constructor(e = null) {
|
|
2187
|
-
const r = e ||
|
|
2196
|
+
const r = e || $e.FirstCanvas();
|
|
2188
2197
|
if (!r)
|
|
2189
2198
|
throw new Error("Error creating Texture: no Canvas available.");
|
|
2190
2199
|
this._canvas = r, this._dirty = !0, this._dataType = 0, this._wrapModeX = 0, this._wrapModeY = 0, this._magFilter = 5, this._minFilter = 5, this._target = 0, this._size = new h(64, 64), this._fileName = "", this._proceduralFunction = 0, this._proceduralParameters = {}, this._renderTargetAttachment = 0, this._componentFormat = 0, this._imageData = null, this._references = 0, this._name = "";
|
|
@@ -2325,9 +2334,9 @@ class x {
|
|
|
2325
2334
|
}
|
|
2326
2335
|
async loadImageData(e = !1) {
|
|
2327
2336
|
if (this.fileName) {
|
|
2328
|
-
|
|
2329
|
-
let r =
|
|
2330
|
-
r ? console.debug(`Texture: loadImageData(): image already loaded or is loading: ${this.fileName}`) : (r = Rs(this.fileName),
|
|
2337
|
+
nt[this.fileName] && e && delete nt[this.fileName];
|
|
2338
|
+
let r = nt[this.fileName];
|
|
2339
|
+
r ? console.debug(`Texture: loadImageData(): image already loaded or is loading: ${this.fileName}`) : (r = Rs(this.fileName), nt[this.fileName] = r), this._imageData = await r, this._size = new h(this._imageData.width, this._imageData.height), this._dirty = !0;
|
|
2331
2340
|
} else if (this.dataType === 7)
|
|
2332
2341
|
this._imageData = {
|
|
2333
2342
|
currentSize: new h(this.size)
|
|
@@ -2367,9 +2376,9 @@ class x {
|
|
|
2367
2376
|
}
|
|
2368
2377
|
}
|
|
2369
2378
|
const ye = {};
|
|
2370
|
-
class
|
|
2379
|
+
class wt {
|
|
2371
2380
|
static Get(e = null) {
|
|
2372
|
-
return e = e ||
|
|
2381
|
+
return e = e || $e.FirstCanvas(), !e && !ye.__no_canvas__ && console.warn("TextureCache.Get() No canvas available. If your application uses a canvas, ensure that it has been created before using TexturCache. If your application does not use a canvas, you may disregard this message."), e && !ye[e.id] ? ye[e.id] = new wt(e) : !e && !ye.__no_canvas__ && (ye.__no_canvas__ = new wt(null)), ye[e ? e.id : "__no_canvas__"];
|
|
2373
2382
|
}
|
|
2374
2383
|
constructor(e) {
|
|
2375
2384
|
this._canvas = e, this._cache = {};
|
|
@@ -2405,7 +2414,7 @@ const Ce = {
|
|
|
2405
2414
|
if (t === "ambientOcclussion" && typeof e == "number")
|
|
2406
2415
|
return null;
|
|
2407
2416
|
if (typeof e == "string") {
|
|
2408
|
-
const n = r + e, s =
|
|
2417
|
+
const n = r + e, s = wt.Get(i);
|
|
2409
2418
|
if (s.findTexture(n))
|
|
2410
2419
|
return console.debug(`Texture '${n}' already loaded. Reusing texture.`), s.getTexture(n);
|
|
2411
2420
|
{
|
|
@@ -2417,7 +2426,7 @@ const Ce = {
|
|
|
2417
2426
|
throw new Error("Invalid parameter found in material deserialization. The required parameter type is string (file path)");
|
|
2418
2427
|
} else return null;
|
|
2419
2428
|
}
|
|
2420
|
-
},
|
|
2429
|
+
}, st = {
|
|
2421
2430
|
serialize: (t, e) => {
|
|
2422
2431
|
if (!e)
|
|
2423
2432
|
return null;
|
|
@@ -2456,11 +2465,11 @@ const Ce = {
|
|
|
2456
2465
|
}, S = {
|
|
2457
2466
|
serialize: (t, e) => e || null,
|
|
2458
2467
|
deserialize: (t, e) => e
|
|
2459
|
-
},
|
|
2468
|
+
}, ot = {
|
|
2460
2469
|
type: { loader: S },
|
|
2461
2470
|
alphaCutoff: { loader: S },
|
|
2462
2471
|
isTransparent: { loader: S },
|
|
2463
|
-
albedo: { loader:
|
|
2472
|
+
albedo: { loader: st },
|
|
2464
2473
|
albedoTexture: { loader: Ce },
|
|
2465
2474
|
albedoScale: { loader: Me },
|
|
2466
2475
|
albedoUV: { loader: S },
|
|
@@ -2477,10 +2486,10 @@ const Ce = {
|
|
|
2477
2486
|
roughnessChannel: { loader: S },
|
|
2478
2487
|
roughnessScale: { loader: Me },
|
|
2479
2488
|
roughnessUV: { loader: S },
|
|
2480
|
-
fresnelTint: { loader:
|
|
2489
|
+
fresnelTint: { loader: st },
|
|
2481
2490
|
sheenIntensity: { loader: S },
|
|
2482
|
-
sheenColor: { loader:
|
|
2483
|
-
lightEmission: { loader:
|
|
2491
|
+
sheenColor: { loader: st },
|
|
2492
|
+
lightEmission: { loader: st },
|
|
2484
2493
|
lightEmissionTexture: { loader: Ce },
|
|
2485
2494
|
lightEmissionChannel: { loader: S },
|
|
2486
2495
|
lightEmissionScale: { loader: Me },
|
|
@@ -2511,7 +2520,7 @@ class ne {
|
|
|
2511
2520
|
return await n.deserialize(e, r, i), n;
|
|
2512
2521
|
}
|
|
2513
2522
|
constructor(e = null) {
|
|
2514
|
-
this._canvas = e ||
|
|
2523
|
+
this._canvas = e || $e.FirstCanvas(), this._type = "pbr", this._renderer = null, this._alphaCutoff = 0.5, this._isTransparent = !1, this._albedo = p.White(), this._albedoTexture = null, this._albedoScale = new h(1, 1), this._albedoUV = 0, this._normalTexture = null, this._normalScale = new h(1, 1), this._normalUV = 0, this._normalChannel = 0, this._metalness = 0, this._metalnessTexture = null, this._metalnessChannel = 0, this._metalnessScale = new h(1, 1), this._metalnessUV = 0, this._roughness = 1, this._roughnessTexture = null, this._roughnessChannel = 0, this._roughnessScale = new h(1, 1), this._roughnessUV = 0, this._fresnelTint = p.White(), this._sheenIntensity = 0, this._sheenColor = p.White(), this._lightEmission = 0, this._lightEmissionTexture = null, this._lightEmissionChannel = 0, this._lightEmissionScale = new h(1, 1), this._lightEmissionUV = 0, this._ambientOcclussion = null, this._ambientOcclussionChannel = 0, this._ambientOcclussionUV = 1, this._heightTexture = null, this._heightChannel = 0, this._heightScale = new h(1, 1), this._heightUV = 0, this._heightIntensity = 1, this._castShadows = !0, this._unlit = !1, this._dirty = !0;
|
|
2515
2524
|
}
|
|
2516
2525
|
get canvas() {
|
|
2517
2526
|
return this._canvas;
|
|
@@ -2767,16 +2776,16 @@ class ne {
|
|
|
2767
2776
|
this._unlit = e, this._dirty = !0;
|
|
2768
2777
|
}
|
|
2769
2778
|
async serialize(e) {
|
|
2770
|
-
for (const r in
|
|
2771
|
-
const i =
|
|
2779
|
+
for (const r in ot) {
|
|
2780
|
+
const i = ot[r].loader.serialize(r, this[r]);
|
|
2772
2781
|
i && (e[r] = i);
|
|
2773
2782
|
}
|
|
2774
2783
|
}
|
|
2775
2784
|
async deserialize(e, r, i) {
|
|
2776
2785
|
const n = [];
|
|
2777
2786
|
this.type = e.type || "pbr", this.alphaCutoff = e.alphaCutoff || 0.5, this.isTransparent = e.isTransparent || !1;
|
|
2778
|
-
for (const s in
|
|
2779
|
-
const o =
|
|
2787
|
+
for (const s in ot) {
|
|
2788
|
+
const o = ot[s]?.loader;
|
|
2780
2789
|
if (o) {
|
|
2781
2790
|
const a = o.deserialize(s, e[s], r, this.canvas);
|
|
2782
2791
|
a instanceof x && n.push(a.loadImageData()), a != null && (this[s] = a);
|
|
@@ -2995,9 +3004,9 @@ ${e.getProgramInfoLog(this._program)}`);
|
|
|
2995
3004
|
tex1: s = null,
|
|
2996
3005
|
tex2: o = null,
|
|
2997
3006
|
color: a = null,
|
|
2998
|
-
tangent:
|
|
3007
|
+
tangent: A = null
|
|
2999
3008
|
}) {
|
|
3000
|
-
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));
|
|
3001
3010
|
}
|
|
3002
3011
|
bindMatrix(e, r) {
|
|
3003
3012
|
r instanceof w ? this.uniformMatrix4fv(e, !1, r) : r instanceof te && this.uniformMatrix3fv(e, !1, r);
|
|
@@ -3100,8 +3109,8 @@ class yi extends V {
|
|
|
3100
3109
|
throw new Error("IrradianceMapCubeShader: shader program is not loaded");
|
|
3101
3110
|
const o = this.renderer, { gl: a } = o;
|
|
3102
3111
|
o.state.shaderProgram = this._program;
|
|
3103
|
-
const
|
|
3104
|
-
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);
|
|
3105
3114
|
const c = r.getTextureRenderer("albedoTexture").getApiObject();
|
|
3106
3115
|
a.bindTexture(a.TEXTURE_CUBE_MAP, c), this._program.positionAttribPointer(e.positionAttribParams("vertPosition"));
|
|
3107
3116
|
}
|
|
@@ -3216,12 +3225,12 @@ class Mi extends V {
|
|
|
3216
3225
|
setup(e, r, i, n, s) {
|
|
3217
3226
|
if (!this._program)
|
|
3218
3227
|
throw new Error("SpecularMapCubeShader: Shader program is not loaded.");
|
|
3219
|
-
const { material: o } = r, a = this.renderer, { gl:
|
|
3228
|
+
const { material: o } = r, a = this.renderer, { gl: A } = a;
|
|
3220
3229
|
a.state.shaderProgram = this._program;
|
|
3221
3230
|
const c = w.Mult(s, n);
|
|
3222
|
-
this._program.uniformMatrix4fv("uMVP", !1, c),
|
|
3231
|
+
this._program.uniformMatrix4fv("uMVP", !1, c), A.activeTexture(A.TEXTURE0), this._program.uniform1i("uCubemap", 0);
|
|
3223
3232
|
const d = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
3224
|
-
|
|
3233
|
+
A.bindTexture(A.TEXTURE_CUBE_MAP, d), this._program.positionAttribPointer(e.positionAttribParams("vertPosition"));
|
|
3225
3234
|
}
|
|
3226
3235
|
destroy() {
|
|
3227
3236
|
this._program && (T.Delete(this._program), this._program = null);
|
|
@@ -3253,8 +3262,8 @@ function Js(t) {
|
|
|
3253
3262
|
for (; e < r; ) {
|
|
3254
3263
|
let i = e, n = e + 1, s = e + 2;
|
|
3255
3264
|
s == r ? s = 0 : n == r && (n = 0, s = 2);
|
|
3256
|
-
let o = t[i], a = t[n],
|
|
3257
|
-
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;
|
|
3258
3267
|
}
|
|
3259
3268
|
}
|
|
3260
3269
|
function Zs(t) {
|
|
@@ -3267,9 +3276,9 @@ function Zs(t) {
|
|
|
3267
3276
|
for (; e = i.exec(r); ) {
|
|
3268
3277
|
let s = Number(e[1]), o = e[3] ? Number(e[3]) : null, a = e[2] ? Number(e[2]) : null;
|
|
3269
3278
|
s = s < 0 ? this._vertexArray.length + s : s - 1;
|
|
3270
|
-
let
|
|
3279
|
+
let A = this._vertexArray[s], c = null, d = null;
|
|
3271
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({
|
|
3272
|
-
vertex:
|
|
3281
|
+
vertex: A,
|
|
3273
3282
|
normal: c,
|
|
3274
3283
|
tex: d
|
|
3275
3284
|
});
|
|
@@ -3281,7 +3290,7 @@ function qs(t) {
|
|
|
3281
3290
|
let e = /s\s+(.*)/.exec(t);
|
|
3282
3291
|
e && this._currentPlist?.name == "" && (this._currentPlist.name = e[1]);
|
|
3283
3292
|
}
|
|
3284
|
-
function
|
|
3293
|
+
function at() {
|
|
3285
3294
|
this._addPlist && (this._currentPlist && this._plistArray.push(this._currentPlist), this._currentPlist = new de(), this._addPlist = !1);
|
|
3286
3295
|
}
|
|
3287
3296
|
function _s() {
|
|
@@ -3306,13 +3315,13 @@ function _s() {
|
|
|
3306
3315
|
) : console.warn("Error parsing line " + r);
|
|
3307
3316
|
break;
|
|
3308
3317
|
case "m":
|
|
3309
|
-
|
|
3318
|
+
at.apply(this), js.apply(this, [r]);
|
|
3310
3319
|
break;
|
|
3311
3320
|
case "g":
|
|
3312
|
-
|
|
3321
|
+
at.apply(this), Vs.apply(this, [r]);
|
|
3313
3322
|
break;
|
|
3314
3323
|
case "u":
|
|
3315
|
-
|
|
3324
|
+
at.apply(this), Ks.apply(this, [r]);
|
|
3316
3325
|
break;
|
|
3317
3326
|
case "s":
|
|
3318
3327
|
Ws.apply(this, [r]);
|
|
@@ -3321,7 +3330,7 @@ function _s() {
|
|
|
3321
3330
|
Zs.apply(this, [r]);
|
|
3322
3331
|
break;
|
|
3323
3332
|
case "o":
|
|
3324
|
-
|
|
3333
|
+
at.apply(this), qs.apply(this, [r]);
|
|
3325
3334
|
break;
|
|
3326
3335
|
}
|
|
3327
3336
|
}), this._currentPlist && this._addPlist && this._plistArray.push(this._currentPlist);
|
|
@@ -4576,7 +4585,7 @@ function ao(t, e) {
|
|
|
4576
4585
|
function ho(t, e = 0.3, r = new h(0, 0, 1), i = new h(0, 1, 0)) {
|
|
4577
4586
|
const n = new de();
|
|
4578
4587
|
r.normalize(), n.drawMode = ae.LINES;
|
|
4579
|
-
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));
|
|
4580
4589
|
return n.vertex = [
|
|
4581
4590
|
0,
|
|
4582
4591
|
0,
|
|
@@ -4593,9 +4602,9 @@ function ho(t, e = 0.3, r = new h(0, 0, 1), i = new h(0, 1, 0)) {
|
|
|
4593
4602
|
o.x * t,
|
|
4594
4603
|
o.y * t,
|
|
4595
4604
|
o.z * t,
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4605
|
+
A.x * t,
|
|
4606
|
+
A.y * t,
|
|
4607
|
+
A.z * t
|
|
4599
4608
|
], n.normal = [
|
|
4600
4609
|
0,
|
|
4601
4610
|
0,
|
|
@@ -4688,10 +4697,10 @@ class zi extends V {
|
|
|
4688
4697
|
const { material: o } = r;
|
|
4689
4698
|
if (!o.albedoTexture)
|
|
4690
4699
|
throw new Error("SkySphereShader: material does not have an albedo texture");
|
|
4691
|
-
const a = this.renderer, { gl:
|
|
4692
|
-
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);
|
|
4693
4702
|
const c = r.getTextureRenderer("albedoTexture")?.getApiObject(), d = Be[o.albedoTexture.target];
|
|
4694
|
-
|
|
4703
|
+
A.bindTexture(A[d], c), this._program.positionAttribPointer(e.positionAttribParams("vertPosition")), this._program.texCoordAttribPointer(e.texCoord0AttribParams("t0Position"));
|
|
4695
4704
|
}
|
|
4696
4705
|
destroy() {
|
|
4697
4706
|
this._program && (T.Delete(this._program), this._program = null);
|
|
@@ -4929,10 +4938,10 @@ const Ir = {
|
|
|
4929
4938
|
gl_FragColor = result;
|
|
4930
4939
|
}`
|
|
4931
4940
|
}
|
|
4932
|
-
},
|
|
4941
|
+
}, ht = {};
|
|
4933
4942
|
class bt extends V {
|
|
4934
4943
|
static GetUnique(e) {
|
|
4935
|
-
return
|
|
4944
|
+
return ht[e.uniqueId] || (ht[e.uniqueId] = new bt(e), ht[e.uniqueId].load()), ht[e.uniqueId];
|
|
4936
4945
|
}
|
|
4937
4946
|
constructor(e) {
|
|
4938
4947
|
if (super(e), e.typeId !== "WebGL")
|
|
@@ -4965,8 +4974,8 @@ class bt extends V {
|
|
|
4965
4974
|
throw new Error("TextureMergerShader: B texture is not set");
|
|
4966
4975
|
if (!this._textures[y.A])
|
|
4967
4976
|
throw new Error("TextureMergerShader: A texture is not set");
|
|
4968
|
-
const a = this.renderer.factory.texture(this._textures[y.R]),
|
|
4969
|
-
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"));
|
|
4970
4979
|
}
|
|
4971
4980
|
}
|
|
4972
4981
|
class Ii {
|
|
@@ -5038,9 +5047,9 @@ class Si extends V {
|
|
|
5038
5047
|
throw new Error("PresentTextureShader: shader program is not loaded");
|
|
5039
5048
|
const o = this.renderer, { gl: a } = o;
|
|
5040
5049
|
o.state.shaderProgram = this._program, a.activeTexture(a.TEXTURE0), this._program.uniform1i("uTexture", 0);
|
|
5041
|
-
const
|
|
5042
|
-
if (c &&
|
|
5043
|
-
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];
|
|
5044
5053
|
a.bindTexture(a[d], c);
|
|
5045
5054
|
} else
|
|
5046
5055
|
throw new Error("PresentTextureShader: invalid material setup. The albedoTexture material attribute must to be a texture");
|
|
@@ -5648,9 +5657,9 @@ class Ui extends pt {
|
|
|
5648
5657
|
throw new Error(`VitscnjLoaderPlugin.load() unexpected resource type received: ${r}`);
|
|
5649
5658
|
const n = i.currentPath;
|
|
5650
5659
|
i.currentPath = li(e);
|
|
5651
|
-
const s = new
|
|
5652
|
-
for (const
|
|
5653
|
-
const c = await Gi(
|
|
5660
|
+
const s = new _e(), o = new fe("Scene Root"), { scene: a } = await s.load(e);
|
|
5661
|
+
for (const A of a) {
|
|
5662
|
+
const c = await Gi(A, i);
|
|
5654
5663
|
o.addChild(c);
|
|
5655
5664
|
}
|
|
5656
5665
|
return i.currentPath = n, o;
|
|
@@ -5695,10 +5704,10 @@ class Oe extends se {
|
|
|
5695
5704
|
throw new Error("Error adding polyList to drawable object: material is not an instance of Material");
|
|
5696
5705
|
if (!(i instanceof w))
|
|
5697
5706
|
throw new Error("Error adding polyList to drawable object: transform is not an instance of Mat4");
|
|
5698
|
-
this._items.push({ polyList: e, material: r, transform: i });
|
|
5707
|
+
this._items.push({ polyList: e, material: r, transform: i }), e.mainDrawable = this;
|
|
5699
5708
|
}
|
|
5700
5709
|
removePolyList(e) {
|
|
5701
|
-
this._items = this._items.filter((r) => r.polyList != e);
|
|
5710
|
+
this._items = this._items.filter((r) => r.polyList != e), e.mainDrawable === this && (e.mainDrawable = void 0);
|
|
5702
5711
|
}
|
|
5703
5712
|
destroy() {
|
|
5704
5713
|
}
|
|
@@ -5721,7 +5730,7 @@ class Oe extends se {
|
|
|
5721
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");
|
|
5722
5731
|
if (!s)
|
|
5723
5732
|
throw new Error(`Drawable.deserialize(): could not load drawable with name ${e.name}`);
|
|
5724
|
-
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;
|
|
5725
5734
|
}
|
|
5726
5735
|
async serialize(e, r) {
|
|
5727
5736
|
throw await super.serialize(e, r), new Error("Drawable.serialice() not implemented");
|
|
@@ -5762,13 +5771,13 @@ class wo {
|
|
|
5762
5771
|
}
|
|
5763
5772
|
loadBg2FileAsJson(e) {
|
|
5764
5773
|
const r = this.loadBg2File(e), i = this.getBg2FileHeader(r), n = this.getComponentData(r), s = this.getMaterialsData(r), o = this.getJointData(r), a = [];
|
|
5765
|
-
for (let
|
|
5766
|
-
a.push(this.getPolyList(r,
|
|
5774
|
+
for (let A = 0; A < i.numberOfPlist; ++A)
|
|
5775
|
+
a.push(this.getPolyList(r, A));
|
|
5767
5776
|
return this.freeBg2File(r), { header: i, components: n, materials: s, joints: o, polyLists: a };
|
|
5768
5777
|
}
|
|
5769
5778
|
getBg2BufferFromJson(e) {
|
|
5770
5779
|
const { header: r, materials: i, joints: n, polyLists: s, components: o } = e, a = this.instance._createBg2File(this._debug ? 1 : 0);
|
|
5771
|
-
let
|
|
5780
|
+
let A = null;
|
|
5772
5781
|
if (a) {
|
|
5773
5782
|
this.instance._setFileHeader(
|
|
5774
5783
|
a,
|
|
@@ -5785,11 +5794,11 @@ class wo {
|
|
|
5785
5794
|
const c = this.instance._createBufferWithBg2File(a, this._debug ? 1 : 0);
|
|
5786
5795
|
if (c) {
|
|
5787
5796
|
const d = new Int32Array(this.instance.HEAPU8.buffer, c, 1)[0], P = new Uint32Array(this.instance.HEAPU8.buffer, c + 4, 1)[0];
|
|
5788
|
-
|
|
5797
|
+
A = new Uint8Array(this.instance.HEAPU8.buffer, P, d).slice(), this.instance._freeBufferWrapper(c, this._debug ? 1 : 0);
|
|
5789
5798
|
}
|
|
5790
5799
|
this.instance._freeBg2File(a, this._debug ? 1 : 0);
|
|
5791
5800
|
}
|
|
5792
|
-
return
|
|
5801
|
+
return A;
|
|
5793
5802
|
}
|
|
5794
5803
|
getBg2FileHeader(e) {
|
|
5795
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];
|
|
@@ -5830,12 +5839,12 @@ class wo {
|
|
|
5830
5839
|
getPolyList(e, r) {
|
|
5831
5840
|
const i = this._instance._getPolyList(e, r, this._debug ? 1 : 0);
|
|
5832
5841
|
if (i) {
|
|
5833
|
-
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];
|
|
5834
5843
|
return {
|
|
5835
5844
|
name: this.getStringFromCStr(s),
|
|
5836
5845
|
matName: this.getStringFromCStr(o),
|
|
5837
5846
|
groupName: this.getStringFromCStr(a),
|
|
5838
|
-
visible:
|
|
5847
|
+
visible: A === 1,
|
|
5839
5848
|
vertex: this.getFloatArray(d, c),
|
|
5840
5849
|
normal: this.getFloatArray(C, P),
|
|
5841
5850
|
texCoord0: this.getFloatArray(D, v),
|
|
@@ -5905,11 +5914,11 @@ var mo = async ({ debug: t = !1, wasmPath: e = "" } = {}) => {
|
|
|
5905
5914
|
const r = await Bg2ioModule();
|
|
5906
5915
|
return new wo({ instance: r, debug: t });
|
|
5907
5916
|
};
|
|
5908
|
-
let
|
|
5917
|
+
let At = null;
|
|
5909
5918
|
const Po = async (t) => {
|
|
5910
|
-
if (
|
|
5919
|
+
if (At === null && (At = await mo(t ? { wasmPath: t } : {}), !At))
|
|
5911
5920
|
throw new Error("Bg2LoaderPlugin: unable to initialize bg2io library");
|
|
5912
|
-
return
|
|
5921
|
+
return At;
|
|
5913
5922
|
}, Xi = (t, e) => t.polyLists.map((i) => {
|
|
5914
5923
|
const n = new de(), s = t.materials.find((o) => o.name === i.matName);
|
|
5915
5924
|
return n.name = i.name, n.visible = i.visible, s && (n.groupName = s.groupName || "", n.enableCullFace = s.cullFace), n.vertex = i.vertex, n.normal = i.normal, n.texCoord0 = i.texCoord0, n.texCoord1 = i.texCoord1, n.texCoord2 = i.texCoord2, n.index = i.index, { plist: n, materialData: s };
|
|
@@ -5937,7 +5946,7 @@ class Yi extends pt {
|
|
|
5937
5946
|
bg2ioPath: e = null,
|
|
5938
5947
|
materialImportCallback: r
|
|
5939
5948
|
} = {}) {
|
|
5940
|
-
super(), this._bg2ioPath = e, this._materialImportCallback = r, this._resource = new
|
|
5949
|
+
super(), this._bg2ioPath = e, this._materialImportCallback = r, this._resource = new _e();
|
|
5941
5950
|
}
|
|
5942
5951
|
get supportedExtensions() {
|
|
5943
5952
|
return ["bg2", "vwglb"];
|
|
@@ -5971,7 +5980,7 @@ const vr = {
|
|
|
5971
5980
|
}, mr = (t) => ({
|
|
5972
5981
|
operationType: t,
|
|
5973
5982
|
plugins: {}
|
|
5974
|
-
}),
|
|
5983
|
+
}), vt = (t, e) => {
|
|
5975
5984
|
t.resourceTypes.forEach((r) => {
|
|
5976
5985
|
e.plugins[r] = e.plugins[r] || [], e.plugins[r].push(t);
|
|
5977
5986
|
});
|
|
@@ -5979,13 +5988,13 @@ const vr = {
|
|
|
5979
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];
|
|
5980
5989
|
if (o) {
|
|
5981
5990
|
for (const a of o)
|
|
5982
|
-
if (a.supportedExtensions.find((
|
|
5991
|
+
if (a.supportedExtensions.find((A) => n.test(A)))
|
|
5983
5992
|
return a;
|
|
5984
5993
|
throw new Error(s);
|
|
5985
5994
|
} else
|
|
5986
5995
|
throw new Error(s);
|
|
5987
5996
|
}, ir = mr(vr.Read), Co = (t) => {
|
|
5988
|
-
t.dependencies.forEach((e) =>
|
|
5997
|
+
t.dependencies.forEach((e) => vt(e, ir)), vt(t, ir);
|
|
5989
5998
|
}, nr = (t, e) => Pr(t, e, ir), Or = () => ({
|
|
5990
5999
|
[M.PolyList]: {},
|
|
5991
6000
|
[M.Drawable]: {},
|
|
@@ -5995,7 +6004,7 @@ const vr = {
|
|
|
5995
6004
|
});
|
|
5996
6005
|
class po {
|
|
5997
6006
|
constructor(e) {
|
|
5998
|
-
this._canvas = e ||
|
|
6007
|
+
this._canvas = e || $e.FirstCanvas(), this._cache = Or(), this._currentPath = "";
|
|
5999
6008
|
}
|
|
6000
6009
|
get canvas() {
|
|
6001
6010
|
return this._canvas;
|
|
@@ -6052,7 +6061,7 @@ const bo = (t, e, r) => {
|
|
|
6052
6061
|
};
|
|
6053
6062
|
class Eo extends pt {
|
|
6054
6063
|
constructor() {
|
|
6055
|
-
super(), this._resource = new
|
|
6064
|
+
super(), this._resource = new _e();
|
|
6056
6065
|
}
|
|
6057
6066
|
get supportedExtensions() {
|
|
6058
6067
|
return ["obj"];
|
|
@@ -6104,7 +6113,7 @@ class xo extends ji {
|
|
|
6104
6113
|
}
|
|
6105
6114
|
}
|
|
6106
6115
|
const Vi = mr(vr.Write), Qo = (t) => {
|
|
6107
|
-
|
|
6116
|
+
vt(t, Vi);
|
|
6108
6117
|
}, Ki = (t, e) => Pr(t, e, Vi);
|
|
6109
6118
|
class To {
|
|
6110
6119
|
constructor() {
|
|
@@ -6132,7 +6141,7 @@ const yo = {
|
|
|
6132
6141
|
Bg2LoaderPlugin: Yi,
|
|
6133
6142
|
PluginOperationType: vr,
|
|
6134
6143
|
createPluginDatabase: mr,
|
|
6135
|
-
registerPluginInDatabase:
|
|
6144
|
+
registerPluginInDatabase: vt,
|
|
6136
6145
|
getPluginFromDatabase: Pr,
|
|
6137
6146
|
Loader: po,
|
|
6138
6147
|
registerLoaderPlugin: Co,
|
|
@@ -6395,7 +6404,7 @@ const Mo = {
|
|
|
6395
6404
|
DrawMode: ae,
|
|
6396
6405
|
RenderLayer: k,
|
|
6397
6406
|
getLayers: vi,
|
|
6398
|
-
PolyListFrontFace:
|
|
6407
|
+
PolyListFrontFace: dt,
|
|
6399
6408
|
PolyListCullFace: De,
|
|
6400
6409
|
Texture: x,
|
|
6401
6410
|
TextureDataType: Qe,
|
|
@@ -6489,8 +6498,8 @@ class Qt extends se {
|
|
|
6489
6498
|
if (this.node) {
|
|
6490
6499
|
const i = w.MakeIdentity();
|
|
6491
6500
|
this.node.children.forEach((n, s) => {
|
|
6492
|
-
const o = n.transform, a = n.component("InputChainJoint"),
|
|
6493
|
-
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);
|
|
6494
6503
|
});
|
|
6495
6504
|
}
|
|
6496
6505
|
}
|
|
@@ -6725,14 +6734,14 @@ class he extends se {
|
|
|
6725
6734
|
position: s,
|
|
6726
6735
|
color: o,
|
|
6727
6736
|
spotCutoff: a,
|
|
6728
|
-
spotExponent:
|
|
6737
|
+
spotExponent: A,
|
|
6729
6738
|
shadowStrength: c,
|
|
6730
6739
|
castShadows: d,
|
|
6731
6740
|
shadowBias: P,
|
|
6732
6741
|
intensity: C,
|
|
6733
6742
|
projection: v
|
|
6734
6743
|
}) {
|
|
6735
|
-
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);
|
|
6736
6745
|
}
|
|
6737
6746
|
async deserialize(e, r) {
|
|
6738
6747
|
await this._light.deserialize(e);
|
|
@@ -6744,7 +6753,7 @@ class he extends se {
|
|
|
6744
6753
|
e.addLight(this.light, r);
|
|
6745
6754
|
}
|
|
6746
6755
|
}
|
|
6747
|
-
class
|
|
6756
|
+
class et extends ii {
|
|
6748
6757
|
static Factory(e) {
|
|
6749
6758
|
if (!e)
|
|
6750
6759
|
return null;
|
|
@@ -6796,7 +6805,7 @@ class $e extends ii {
|
|
|
6796
6805
|
this.near = e.near ?? this.near, this.far = e.far ?? this.far, Array.isArray(e.viewport) ? this.viewport = new h(e.viewport) : e.viewport instanceof h && (this.viewport = new h(e.viewport));
|
|
6797
6806
|
}
|
|
6798
6807
|
}
|
|
6799
|
-
class Mt extends
|
|
6808
|
+
class Mt extends et {
|
|
6800
6809
|
constructor(e = null) {
|
|
6801
6810
|
super(e), this._fov = 60;
|
|
6802
6811
|
}
|
|
@@ -6823,7 +6832,7 @@ class Mt extends $e {
|
|
|
6823
6832
|
super.deserialize(e), this.fov = e.fov ?? this.fov;
|
|
6824
6833
|
}
|
|
6825
6834
|
}
|
|
6826
|
-
class Nt extends
|
|
6835
|
+
class Nt extends et {
|
|
6827
6836
|
constructor(e = null) {
|
|
6828
6837
|
super(e), this._focalLength = 50, this._frameSize = 35;
|
|
6829
6838
|
}
|
|
@@ -6862,7 +6871,7 @@ class Nt extends $e {
|
|
|
6862
6871
|
super.deserialize(e), this.frameSize = e.frameSize ?? this.frameSize, this.focalLength = e.focalLength ?? this.focalLength;
|
|
6863
6872
|
}
|
|
6864
6873
|
}
|
|
6865
|
-
class Ie extends
|
|
6874
|
+
class Ie extends et {
|
|
6866
6875
|
constructor(e = null) {
|
|
6867
6876
|
super(e), this._viewWidth = 100;
|
|
6868
6877
|
}
|
|
@@ -6987,7 +6996,7 @@ class j extends se {
|
|
|
6987
6996
|
}
|
|
6988
6997
|
async deserialize(e = {}, r) {
|
|
6989
6998
|
if (await super.deserialize(e, r), this.focusDistance = e.focusDistance ?? this._focusDistance, e.projectionMethod) {
|
|
6990
|
-
const i =
|
|
6999
|
+
const i = et.Factory(e.projectionMethod);
|
|
6991
7000
|
i && (this.projectionStrategy = i);
|
|
6992
7001
|
}
|
|
6993
7002
|
}
|
|
@@ -7026,7 +7035,7 @@ class zt extends Ht {
|
|
|
7026
7035
|
}
|
|
7027
7036
|
}
|
|
7028
7037
|
var Fe = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.UP = 1] = "UP", t[t.DOWN = 2] = "DOWN", t))(Fe || {});
|
|
7029
|
-
const
|
|
7038
|
+
const tt = (t, e, r) => {
|
|
7030
7039
|
if (e.mouseStatus.pos = Pi(t, e.canvas), r !== 0) {
|
|
7031
7040
|
const i = r === 2;
|
|
7032
7041
|
t.button === 0 ? e.mouseStatus.leftButton = i : t.button === 1 ? e.mouseStatus.middleButton = i : t.button === 2 && (e.mouseStatus.rightButton = i);
|
|
@@ -7069,12 +7078,12 @@ function Oo(t) {
|
|
|
7069
7078
|
return Ee.ZOOM;
|
|
7070
7079
|
}
|
|
7071
7080
|
}
|
|
7072
|
-
class
|
|
7081
|
+
class rt extends se {
|
|
7073
7082
|
constructor(e = null) {
|
|
7074
7083
|
super(e ?? "OrbitCameraController"), this._rotateButtons = { left: !0, middle: !1, right: !1 }, this._panButtons = { left: !1, middle: !1, right: !0 }, this._zoomButtons = { left: !1, middle: !0, right: !1 }, this._rotation = new h([0, 0]), this._distance = 5, this._center = new h([0, 0, 0]), this._rotationSpeed = 0.2, this._forward = 0, this._left = 0, this._wheelSpeed = 1, this._minFocus = 2, this._minPitch = -85, this._maxPitch = 85, this._minDistance = 0.4, this._maxDistance = 24, this._maxX = 45, this._minX = -45, this._minY = -45, this._maxY = 45, this._maxZ = 45, this._minZ = -45, this._displacementSpeed = 0.1, this._enabled = !0, this._keys = {}, this._lastTouch = [];
|
|
7075
7084
|
}
|
|
7076
7085
|
clone() {
|
|
7077
|
-
const e = new
|
|
7086
|
+
const e = new rt();
|
|
7078
7087
|
return e.assign(this), e;
|
|
7079
7088
|
}
|
|
7080
7089
|
assign(e) {
|
|
@@ -7278,8 +7287,8 @@ class tt extends se {
|
|
|
7278
7287
|
e.touches.forEach((P) => {
|
|
7279
7288
|
P.identifier === r.identifier ? n = P : P.identifier === i.identifier && (s = P);
|
|
7280
7289
|
});
|
|
7281
|
-
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))),
|
|
7282
|
-
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;
|
|
7283
7292
|
}
|
|
7284
7293
|
e.stopPropagation();
|
|
7285
7294
|
}
|
|
@@ -7292,7 +7301,7 @@ class tt extends se {
|
|
|
7292
7301
|
this.enabled && (this._keys[e.key] = !1);
|
|
7293
7302
|
}
|
|
7294
7303
|
}
|
|
7295
|
-
class Lt extends
|
|
7304
|
+
class Lt extends rt {
|
|
7296
7305
|
constructor() {
|
|
7297
7306
|
super("SmoothOrbitCameraController"), this._smoothFactor = 9e-3, this._action = Ee.NONE;
|
|
7298
7307
|
}
|
|
@@ -7391,7 +7400,7 @@ class It extends se {
|
|
|
7391
7400
|
}
|
|
7392
7401
|
}
|
|
7393
7402
|
const $i = () => {
|
|
7394
|
-
_("Drawable", Oe), _("Transform", oe), _("Light", he), _("LightComponent", he), _("Chain", Qt), _("InputChainJoint", Tt), _("OutputChainJoint", yt), _("Camera", j), _("OrbitCameraController",
|
|
7403
|
+
_("Drawable", Oe), _("Transform", oe), _("Light", he), _("LightComponent", he), _("Chain", Qt), _("InputChainJoint", Tt), _("OutputChainJoint", yt), _("Camera", j), _("OrbitCameraController", rt), _("SmoothOrbitCameraController", Lt), _("Environment", It);
|
|
7395
7404
|
}, Fo = {
|
|
7396
7405
|
Component: se,
|
|
7397
7406
|
DrawableComponent: Oe,
|
|
@@ -7403,8 +7412,8 @@ const $i = () => {
|
|
|
7403
7412
|
CameraComponent: j,
|
|
7404
7413
|
OpticalProjectionStrategy: Nt,
|
|
7405
7414
|
PerspectiveProjectionStrategy: Mt,
|
|
7406
|
-
ProjectionStrategy:
|
|
7407
|
-
OrbitCameraControllerComponent:
|
|
7415
|
+
ProjectionStrategy: et,
|
|
7416
|
+
OrbitCameraControllerComponent: rt,
|
|
7408
7417
|
SmoothOrbitCameraControllerComponent: Lt,
|
|
7409
7418
|
EnvironmentComponent: It,
|
|
7410
7419
|
registerComponents: $i,
|
|
@@ -7555,26 +7564,26 @@ async function ko(t, e) {
|
|
|
7555
7564
|
t.redisplay && (t.updateMode === 0 ? t._redisplayFrames = 1 : t._redisplayFrames--, (t._redisplayFrames > 0 || !t._firstFrameRendered) && (await t.appController.frame(e), t.appController.display(), t._firstFrameRendered = !0));
|
|
7556
7565
|
}
|
|
7557
7566
|
function Yo(t, e) {
|
|
7558
|
-
const r =
|
|
7567
|
+
const r = tt(t, e, Fe.DOWN);
|
|
7559
7568
|
return qi(r, !0), e.appController.mouseDown(r), r;
|
|
7560
7569
|
}
|
|
7561
7570
|
function sn(t, e) {
|
|
7562
|
-
const r =
|
|
7571
|
+
const r = tt(t, e, Fe.NONE);
|
|
7563
7572
|
return e.appController.mouseMove(r), e.mouseStatus.anyButton && e.appController.mouseDrag(r), r;
|
|
7564
7573
|
}
|
|
7565
7574
|
function jo(t, e) {
|
|
7566
|
-
const r =
|
|
7575
|
+
const r = tt(t, e, Fe.NONE);
|
|
7567
7576
|
return Ro(), e.appController.mouseOut(r), r;
|
|
7568
7577
|
}
|
|
7569
7578
|
function Vo(t, e) {
|
|
7570
7579
|
return sn(t, e);
|
|
7571
7580
|
}
|
|
7572
7581
|
function Ko(t, e) {
|
|
7573
|
-
const r =
|
|
7582
|
+
const r = tt(t, e, Fe.UP);
|
|
7574
7583
|
return qi(r, !1), e.appController.mouseUp(r), r;
|
|
7575
7584
|
}
|
|
7576
7585
|
function Wo(t, e) {
|
|
7577
|
-
const r =
|
|
7586
|
+
const r = tt(t, e, Fe.NONE);
|
|
7578
7587
|
return r.delta = t.wheelDelta ? t.wheelDelta * -1 : t.detail * 10, e.appController.mouseWheel(r), r;
|
|
7579
7588
|
}
|
|
7580
7589
|
function Jo(t, e) {
|
|
@@ -7600,7 +7609,7 @@ function $o(t, e) {
|
|
|
7600
7609
|
const e0 = {
|
|
7601
7610
|
AppController: en,
|
|
7602
7611
|
FrameUpdate: rn,
|
|
7603
|
-
Canvas:
|
|
7612
|
+
Canvas: $e,
|
|
7604
7613
|
getMouseEventOffset: Pi,
|
|
7605
7614
|
getEventTouches: Bi,
|
|
7606
7615
|
EventBase: Ht,
|
|
@@ -7732,7 +7741,7 @@ const fn = {
|
|
|
7732
7741
|
1: "TEXTURE",
|
|
7733
7742
|
2: "CUBE_MAP"
|
|
7734
7743
|
};
|
|
7735
|
-
var
|
|
7744
|
+
var mt = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.POSITIVE_X = 1] = "POSITIVE_X", t[t.NEGATIVE_X = 2] = "NEGATIVE_X", t[t.POSITIVE_Y = 3] = "POSITIVE_Y", t[t.NEGATIVE_Y = 4] = "NEGATIVE_Y", t[t.POSITIVE_Z = 5] = "POSITIVE_Z", t[t.NEGATIVE_Z = 6] = "NEGATIVE_Z", t))(mt || {});
|
|
7736
7745
|
function Fr(t) {
|
|
7737
7746
|
if (t.target === ee.TEXTURE_2D)
|
|
7738
7747
|
return 1;
|
|
@@ -7898,8 +7907,8 @@ class St {
|
|
|
7898
7907
|
o.setBlendState(c), a.setBlendState(c);
|
|
7899
7908
|
}
|
|
7900
7909
|
o.create(), a.cullFace = !1, a.create();
|
|
7901
|
-
const
|
|
7902
|
-
|
|
7910
|
+
const A = this.getQueue(e);
|
|
7911
|
+
A ? A.enabled = !0 : this._queues.push({
|
|
7903
7912
|
layer: e,
|
|
7904
7913
|
shader: r,
|
|
7905
7914
|
beginOperation: i,
|
|
@@ -7924,11 +7933,11 @@ class St {
|
|
|
7924
7933
|
}
|
|
7925
7934
|
addPolyList(e, r, i) {
|
|
7926
7935
|
const n = vi(e.polyList, r.material);
|
|
7927
|
-
this._queues.forEach(({ layer: s, shader: o, queue: a, pipelines:
|
|
7936
|
+
this._queues.forEach(({ layer: s, shader: o, queue: a, pipelines: A }) => {
|
|
7928
7937
|
if (n & s) {
|
|
7929
7938
|
const { polyList: c } = e;
|
|
7930
7939
|
let d = null;
|
|
7931
|
-
c.enableCullFace ? d =
|
|
7940
|
+
c.enableCullFace ? d = A.cullBackFace : d = A.cullFaceDisabled, a.push(new Dt({
|
|
7932
7941
|
shader: o,
|
|
7933
7942
|
polyListRenderer: e,
|
|
7934
7943
|
materialRenderer: r,
|
|
@@ -8622,8 +8631,8 @@ class Cn extends V {
|
|
|
8622
8631
|
setup(e, r, i, n, s) {
|
|
8623
8632
|
if (!this._program)
|
|
8624
8633
|
throw new Error("SelectionHighlightShader: shader program is not loaded");
|
|
8625
|
-
const o = this.renderer, { gl: a, viewport:
|
|
8626
|
-
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);
|
|
8627
8636
|
const c = r.material, d = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
8628
8637
|
if (d && c.albedoTexture) {
|
|
8629
8638
|
const P = Be[c.albedoTexture.target];
|
|
@@ -8689,20 +8698,20 @@ class d0 {
|
|
|
8689
8698
|
return;
|
|
8690
8699
|
const a = w.GetInverted(oe.GetWorldMatrix(r.node));
|
|
8691
8700
|
this._renderQueue.viewMatrix = a, this._renderQueue.projectionMatrix = r.projectionMatrix, this._renderQueue.newFrame(), this._frameVisitor.modelMatrix.identity(), e.accept(this._frameVisitor);
|
|
8692
|
-
let
|
|
8701
|
+
let A = null;
|
|
8693
8702
|
return this._renderBuffer.update(() => {
|
|
8694
|
-
this._renderBuffer?.frameBuffer.clear(), this._renderQueue?.draw(k.SELECTION_DEFAULT),
|
|
8695
|
-
}),
|
|
8703
|
+
this._renderBuffer?.frameBuffer.clear(), this._renderQueue?.draw(k.SELECTION_DEFAULT), A = this._renderBuffer?.readPixels(i, n, s, o);
|
|
8704
|
+
}), A;
|
|
8696
8705
|
}
|
|
8697
8706
|
destroy() {
|
|
8698
8707
|
this._renderBuffer?.destroy(), this._targetTexture?.destroy(), this._renderBuffer = null, this._targetTexture = null;
|
|
8699
8708
|
}
|
|
8700
8709
|
}
|
|
8701
|
-
var
|
|
8702
|
-
const
|
|
8710
|
+
var Ze = /* @__PURE__ */ ((t) => (t[t.OBJECT = 0] = "OBJECT", t[t.POLY_LIST = 1] = "POLY_LIST", t))(Ze || {});
|
|
8711
|
+
const ft = (t) => "" + t[0] + t[1] + t[2];
|
|
8703
8712
|
class w0 extends ce {
|
|
8704
8713
|
constructor() {
|
|
8705
|
-
super(), this._r = 0, this._g = 0, this._b = 0, this._selectionMode =
|
|
8714
|
+
super(), this._r = 0, this._g = 0, this._b = 0, this._selectionMode = Ze.POLY_LIST, this._elements = {};
|
|
8706
8715
|
}
|
|
8707
8716
|
set selectionMode(e) {
|
|
8708
8717
|
this._selectionMode = e, this.clear();
|
|
@@ -8719,9 +8728,9 @@ class w0 extends ce {
|
|
|
8719
8728
|
Math.round(Math.random() * 255),
|
|
8720
8729
|
Math.round(Math.random() * 255)
|
|
8721
8730
|
];
|
|
8722
|
-
let r = e(), i =
|
|
8731
|
+
let r = e(), i = ft(r);
|
|
8723
8732
|
for (; this._elements[i]; )
|
|
8724
|
-
r = e(), i =
|
|
8733
|
+
r = e(), i = ft(r);
|
|
8725
8734
|
return this._r = r[0], this._g = r[1], this._b = r[2], new p([r[0] / 255, r[1] / 255, r[2] / 255, 1]);
|
|
8726
8735
|
}
|
|
8727
8736
|
findElement(e) {
|
|
@@ -8732,7 +8741,7 @@ class w0 extends ce {
|
|
|
8732
8741
|
e[1],
|
|
8733
8742
|
e[2]
|
|
8734
8743
|
];
|
|
8735
|
-
return this._elements[
|
|
8744
|
+
return this._elements[ft(r)] || null;
|
|
8736
8745
|
}
|
|
8737
8746
|
visit(e) {
|
|
8738
8747
|
const { drawable: r } = e;
|
|
@@ -8741,21 +8750,21 @@ class w0 extends ce {
|
|
|
8741
8750
|
r.items.forEach(({ polyList: n }, s, o) => {
|
|
8742
8751
|
if (n.isSelectable) {
|
|
8743
8752
|
n.colorCode = i, n.selected = !1;
|
|
8744
|
-
const a =
|
|
8753
|
+
const a = ft([
|
|
8745
8754
|
Math.round(i[0] * 255),
|
|
8746
8755
|
Math.round(i[1] * 255),
|
|
8747
8756
|
Math.round(i[2] * 255)
|
|
8748
8757
|
]);
|
|
8749
8758
|
this._elements[a] = { polyList: n, drawable: r };
|
|
8750
8759
|
}
|
|
8751
|
-
s < o.length - 1 && this._selectionMode ==
|
|
8760
|
+
s < o.length - 1 && this._selectionMode == Ze.POLY_LIST && (i = this.getNextColor());
|
|
8752
8761
|
});
|
|
8753
8762
|
}
|
|
8754
8763
|
}
|
|
8755
8764
|
}
|
|
8756
8765
|
class v0 {
|
|
8757
8766
|
constructor(e) {
|
|
8758
|
-
this._selectionBuffer = null, this._selectionIdVisitor = null, this._downPosition = new h(), this._viewportSize = [1, 1], this._enabled = !0, this._renderer = e, this._sceneRoot = null, this._camera = null, this._selectionMode =
|
|
8767
|
+
this._selectionBuffer = null, this._selectionIdVisitor = null, this._downPosition = new h(), this._viewportSize = [1, 1], this._enabled = !0, this._renderer = e, this._sceneRoot = null, this._camera = null, this._selectionMode = Ze.POLY_LIST, this._multiSelect = !1, this._selection = [], this._selectionChangedCallbacks = {};
|
|
8759
8768
|
}
|
|
8760
8769
|
async init() {
|
|
8761
8770
|
this._selectionBuffer = new d0(this._renderer), await this._selectionBuffer.init(), this._selectionIdVisitor = new w0();
|
|
@@ -8779,7 +8788,9 @@ class v0 {
|
|
|
8779
8788
|
this._enabled = e, this._enabled || this.clearSelection();
|
|
8780
8789
|
}
|
|
8781
8790
|
clearSelection() {
|
|
8782
|
-
this._selection.forEach((e) =>
|
|
8791
|
+
this._selection.forEach((e) => {
|
|
8792
|
+
e.drawable.items.forEach((r) => r.polyList.selected = !1);
|
|
8793
|
+
}), this._selection = [], this.triggerSelectionChanged();
|
|
8783
8794
|
}
|
|
8784
8795
|
set sceneRoot(e) {
|
|
8785
8796
|
this._sceneRoot = e, this.clearSelection();
|
|
@@ -8826,8 +8837,10 @@ class v0 {
|
|
|
8826
8837
|
this._selectionIdVisitor && this.sceneRoot && (this._selectionIdVisitor.selectionMode = this.selectionMode, this.sceneRoot.accept(this._selectionIdVisitor));
|
|
8827
8838
|
const i = window.devicePixelRatio || 1;
|
|
8828
8839
|
this._selectionBuffer?.reshape(this._viewportSize[0], this._viewportSize[1]);
|
|
8829
|
-
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) => a.polyList === s.polyList && a.drawable === s.drawable);
|
|
8830
|
-
s && this._multiSelect && !o() ? (this._selection.push(s), this.triggerSelectionChanged()) : s && !o() ? (this._selection = [s], this.triggerSelectionChanged()) :
|
|
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);
|
|
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);
|
|
8831
8844
|
}
|
|
8832
8845
|
}
|
|
8833
8846
|
mouseDown(e) {
|
|
@@ -8950,9 +8963,9 @@ class Dn extends V {
|
|
|
8950
8963
|
throw new Error("PresentDebugFramebufferShader: shader program is not loaded");
|
|
8951
8964
|
const o = this.renderer, { gl: a } = o;
|
|
8952
8965
|
o.state.shaderProgram = this._program, a.activeTexture(a.TEXTURE0), this._program.uniform1i("uTexture", 0);
|
|
8953
|
-
const
|
|
8954
|
-
if (c &&
|
|
8955
|
-
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];
|
|
8956
8969
|
a.bindTexture(a[d], c);
|
|
8957
8970
|
} else
|
|
8958
8971
|
throw new Error("PresentDebugFramebufferShader: invalid material setup. The albedoTexture material attribute must to be a texture");
|
|
@@ -9003,11 +9016,11 @@ class xe {
|
|
|
9003
9016
|
const i = w.GetInverted(oe.GetWorldMatrix(e.node)), n = e.projectionMatrix;
|
|
9004
9017
|
this._renderBuffer.update(() => {
|
|
9005
9018
|
this._renderBuffer.frameBuffer.clear(), this._objects.forEach((o) => {
|
|
9006
|
-
const
|
|
9019
|
+
const A = w.MakeScale(o.scale, o.scale, o.scale).mult(o.transformMatrix);
|
|
9007
9020
|
this._materialRenderer.material.albedo = o.color, o.renderer.bindBuffers(), this._shader.setup(
|
|
9008
9021
|
o.renderer,
|
|
9009
9022
|
this._materialRenderer,
|
|
9010
|
-
|
|
9023
|
+
A,
|
|
9011
9024
|
i,
|
|
9012
9025
|
n
|
|
9013
9026
|
), o.renderer.draw();
|
|
@@ -9590,7 +9603,7 @@ class Nn {
|
|
|
9590
9603
|
let o = null;
|
|
9591
9604
|
if (r instanceof he ? (o = r.node, s = r) : r instanceof fe && (o = r, s = r.lightComponent || null), !o || !s)
|
|
9592
9605
|
throw Error("ShadowRenderer.getLightPosition(): invalid light. Light must be a Node or a LightComponent");
|
|
9593
|
-
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;
|
|
9594
9607
|
P.scale(this._shadowMapRenderDistance);
|
|
9595
9608
|
const C = h.Add(c, P);
|
|
9596
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;
|
|
@@ -9653,8 +9666,8 @@ class Hn extends V {
|
|
|
9653
9666
|
throw new Error("SkyCubeShader: shader program is not loaded");
|
|
9654
9667
|
const o = this.renderer, { gl: a } = o;
|
|
9655
9668
|
o.state.shaderProgram = this._program;
|
|
9656
|
-
const
|
|
9657
|
-
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);
|
|
9658
9671
|
const c = r.getTextureRenderer("albedoTexture")?.getApiObject();
|
|
9659
9672
|
a.bindTexture(a.TEXTURE_CUBE_MAP, c), this._program.positionAttribPointer(e.positionAttribParams("vertPosition"));
|
|
9660
9673
|
}
|
|
@@ -9823,7 +9836,7 @@ const y0 = (t, e) => {
|
|
|
9823
9836
|
return t.FUNC_REVERSE_SUBTRACT;
|
|
9824
9837
|
}
|
|
9825
9838
|
throw new Error(`Invalid blend equation specified in WebGLPipeline: ${e}`);
|
|
9826
|
-
},
|
|
9839
|
+
}, lt = (t, e) => {
|
|
9827
9840
|
switch (e) {
|
|
9828
9841
|
case R.NULL:
|
|
9829
9842
|
return null;
|
|
@@ -9853,7 +9866,7 @@ const y0 = (t, e) => {
|
|
|
9853
9866
|
class On extends hn {
|
|
9854
9867
|
create() {
|
|
9855
9868
|
const { gl: e } = this.renderer;
|
|
9856
|
-
if (this._blendEquation = y0(e, this.blendState.blendEquation), this._blendFuncSrcColor =
|
|
9869
|
+
if (this._blendEquation = y0(e, this.blendState.blendEquation), this._blendFuncSrcColor = lt(e, this.blendState.blendFuncSrc), this._blendFuncSrcAlpha = lt(e, this.blendState.blendFuncSrcAlpha), this._blendFuncDstColor = lt(e, this.blendState.blendFuncDst), this._blendFuncDstAlpha = lt(e, this.blendState.blendFuncDstAlpha), this._blendFuncDstAlpha === null && this._blendFuncSrcAlpha !== null || this._blendFuncDstAlpha !== null && this._blendFuncSrcAlpha === null)
|
|
9857
9870
|
throw new Error("WebGLPipeline.create(): Invalid values of blendFuncDstAlpha and blendFuncSrcAlpha");
|
|
9858
9871
|
this._blendFunc = this._blendFuncDstAlpha !== null ? (r, i) => e.blendFunc(r, i) : (r, i, n, s) => e.blendFuncSeparate(r, i, n, s);
|
|
9859
9872
|
}
|
|
@@ -9951,8 +9964,8 @@ class Gn extends An {
|
|
|
9951
9964
|
}
|
|
9952
9965
|
this._stride = 3;
|
|
9953
9966
|
const s = 0, o = 3;
|
|
9954
|
-
let a = 3,
|
|
9955
|
-
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));
|
|
9956
9969
|
const C = this.polyList.index.length < 65535 ? new Uint16Array(this.polyList.index) : new Uint32Array(this.polyList.index);
|
|
9957
9970
|
this._indexBuffer = Ae.CreateElementArrayBuffer(e, C), this._indexArrayFormat = C instanceof Uint16Array ? e.UNSIGNED_SHORT : e.UNSIGNED_INT;
|
|
9958
9971
|
}
|
|
@@ -10001,10 +10014,10 @@ class Gn extends An {
|
|
|
10001
10014
|
draw() {
|
|
10002
10015
|
const { gl: e, state: r } = this.renderer;
|
|
10003
10016
|
switch (r.cullFaceEnabled = this.polyList.enableCullFace, this.polyList.frontFace) {
|
|
10004
|
-
case
|
|
10017
|
+
case dt.CCW:
|
|
10005
10018
|
r.frontFace = r.CCW;
|
|
10006
10019
|
break;
|
|
10007
|
-
case
|
|
10020
|
+
case dt.CW:
|
|
10008
10021
|
r.frontFace = r.CW;
|
|
10009
10022
|
break;
|
|
10010
10023
|
}
|
|
@@ -10082,7 +10095,7 @@ class Un extends ln {
|
|
|
10082
10095
|
const { gl: e } = this.renderer;
|
|
10083
10096
|
e.bindBuffer(e.ARRAY_BUFFER, this._prevArrayBufferBinding), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, this._prevElementBufferBinding);
|
|
10084
10097
|
}
|
|
10085
|
-
beginUpdate(e =
|
|
10098
|
+
beginUpdate(e = mt.NONE) {
|
|
10086
10099
|
if (this.type === ve.TEXTURE)
|
|
10087
10100
|
this.beginUpdateTexture();
|
|
10088
10101
|
else if (this.type === ve.CUBE_MAP)
|
|
@@ -10090,7 +10103,7 @@ class Un extends ln {
|
|
|
10090
10103
|
else
|
|
10091
10104
|
throw new Error("The render buffer is not initialized");
|
|
10092
10105
|
}
|
|
10093
|
-
endUpdate(e =
|
|
10106
|
+
endUpdate(e = mt.NONE) {
|
|
10094
10107
|
if (this.type === ve.TEXTURE)
|
|
10095
10108
|
this.endUpdateTexture();
|
|
10096
10109
|
else if (this.type === ve.CUBE_MAP)
|
|
@@ -10105,8 +10118,8 @@ class Un extends ln {
|
|
|
10105
10118
|
readPixels(e, r, i, n) {
|
|
10106
10119
|
const o = this.attachments[0]?.texture;
|
|
10107
10120
|
if (o) {
|
|
10108
|
-
const { gl: a } = this.renderer,
|
|
10109
|
-
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;
|
|
10110
10123
|
}
|
|
10111
10124
|
}
|
|
10112
10125
|
beginUpdateTexture() {
|
|
@@ -10133,12 +10146,12 @@ class Un extends ln {
|
|
|
10133
10146
|
if (Object.keys(this.attachments).length !== 1)
|
|
10134
10147
|
throw new Error("Unexpected number of texture attachments rendering cube map. The cube map renderer supports only one color attachment.");
|
|
10135
10148
|
this.destroy(), this._framebuffers = [], this._depthBuffers = [];
|
|
10136
|
-
const { width: a, height:
|
|
10149
|
+
const { width: a, height: A } = s.size;
|
|
10137
10150
|
for (let c = 0; c < 6; ++c) {
|
|
10138
10151
|
const d = r.createFramebuffer();
|
|
10139
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);
|
|
10140
10153
|
const P = r.createRenderbuffer();
|
|
10141
|
-
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) {
|
|
10142
10155
|
const C = r.checkFramebufferStatus(r.FRAMEBUFFER);
|
|
10143
10156
|
throw new Error(`Cubemap frame buffer not complete in cube side #${c}: ${M0(r, C)}`);
|
|
10144
10157
|
}
|
|
@@ -10429,8 +10442,8 @@ class Xn extends V {
|
|
|
10429
10442
|
throw new Error("BasicPBRLightShader: lights array not specified");
|
|
10430
10443
|
const a = r.material;
|
|
10431
10444
|
r.mergeTextures(), o.state.shaderProgram = this._program;
|
|
10432
|
-
const
|
|
10433
|
-
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)
|
|
10434
10447
|
throw new Error("PBRLightIBLShader: Environment maps not set.");
|
|
10435
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);
|
|
10436
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);
|
|
@@ -10626,7 +10639,7 @@ const L0 = (t, e) => {
|
|
|
10626
10639
|
default:
|
|
10627
10640
|
throw new Error("Error creating WebGL Texture: invalid target");
|
|
10628
10641
|
}
|
|
10629
|
-
},
|
|
10642
|
+
}, ct = (t, e) => {
|
|
10630
10643
|
if (e === 1)
|
|
10631
10644
|
return t.CLAMP_TO_EDGE;
|
|
10632
10645
|
{
|
|
@@ -10658,16 +10671,16 @@ const L0 = (t, e) => {
|
|
|
10658
10671
|
const r = L0(t, e), i = I0(t, e);
|
|
10659
10672
|
if (t.bindTexture(r, e._apiObject), e.dataType === Qe.RENDER_TARGET) {
|
|
10660
10673
|
const { width: n, height: s } = e.size, o = e.renderTargetAttachment === Y.DEPTH_ATTACHMENT, a = o ? t.DEPTH_COMPONENT : t.RGBA;
|
|
10661
|
-
let
|
|
10674
|
+
let A = o ? t.DEPTH_COMPONENT : t.RGBA;
|
|
10662
10675
|
const c = o ? t.UNSIGNED_SHORT : i;
|
|
10663
|
-
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,
|
|
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)
|
|
10664
10677
|
for (let d = 0; d < 6; ++d)
|
|
10665
|
-
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);
|
|
10666
10679
|
else
|
|
10667
|
-
t.texImage2D(r, 0, a, n, s, 0,
|
|
10680
|
+
t.texImage2D(r, 0, a, n, s, 0, A, c, null);
|
|
10668
10681
|
e.imageData.currentSize = new h(e.size);
|
|
10669
10682
|
} else
|
|
10670
|
-
t.texImage2D(r, 0, t.RGBA, t.RGBA, i, e._imageData), t.texParameteri(r, t.TEXTURE_WRAP_S,
|
|
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);
|
|
10671
10684
|
};
|
|
10672
10685
|
class Jn extends Ln {
|
|
10673
10686
|
static ListTextures(e) {
|
|
@@ -10749,19 +10762,19 @@ class Zn extends Et {
|
|
|
10749
10762
|
await super.init(e), this._canvas = e, this._gl = e.domElement.getContext("webgl", { preserveDrawingBuffer: !0 }), this._gl._bg2e_object = this;
|
|
10750
10763
|
const r = new URLSearchParams(location.search).get("debug") == "true";
|
|
10751
10764
|
if (this._debugMode = r, window.WebGLDebugUtils && r) {
|
|
10752
|
-
let i = function(a,
|
|
10753
|
-
throw window.WebGLDebugUtils.glEnumToString(a) + " was caused by call to: " +
|
|
10754
|
-
}, n = function(a,
|
|
10755
|
-
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)) {
|
|
10756
10769
|
const c = Ae.CurrentBuffer(s, Se.ELEMENT_ARRAY_BUFFER), d = Ae.CurrentBuffer(s, Se.ARRAY_BUFFER);
|
|
10757
10770
|
o(c?.id, "ELEMENT_ARRAY_BUFFER"), o(d?.id, "ARRAY_BUFFER");
|
|
10758
|
-
} 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_}`);
|
|
10759
10772
|
};
|
|
10760
10773
|
const s = this._gl;
|
|
10761
10774
|
console.warn("Using WebGLDebugUtils: this must cause an impact in performance");
|
|
10762
|
-
const o = (a,
|
|
10763
|
-
const c = s.getBufferParameter(s[
|
|
10764
|
-
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}`);
|
|
10765
10778
|
};
|
|
10766
10779
|
this._gl = window.WebGLDebugUtils.makeDebugContext(this._gl, i, n);
|
|
10767
10780
|
}
|
|
@@ -10846,7 +10859,7 @@ const U0 = {
|
|
|
10846
10859
|
RenderBuffer: ln,
|
|
10847
10860
|
RenderBufferType: ve,
|
|
10848
10861
|
RenderBufferTypeName: fn,
|
|
10849
|
-
CubeMapFace:
|
|
10862
|
+
CubeMapFace: mt,
|
|
10850
10863
|
Renderer: Et,
|
|
10851
10864
|
EngineFeatures: Ve,
|
|
10852
10865
|
RenderQueue: St,
|
|
@@ -10910,8 +10923,8 @@ class X0 extends V {
|
|
|
10910
10923
|
throw new Error("BasicDiffuseColorShader: shader program is not loaded");
|
|
10911
10924
|
const { material: o } = r, a = this.renderer;
|
|
10912
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);
|
|
10913
|
-
let
|
|
10914
|
-
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"));
|
|
10915
10928
|
}
|
|
10916
10929
|
destroy() {
|
|
10917
10930
|
this._program && (T.Delete(this._program), this._program = null);
|
|
@@ -11058,8 +11071,8 @@ class Y0 extends V {
|
|
|
11058
11071
|
throw new Error("BasicPBRLightShader: lights array not specified");
|
|
11059
11072
|
const o = r.material, a = this.renderer;
|
|
11060
11073
|
a.state.shaderProgram = this._program;
|
|
11061
|
-
const
|
|
11062
|
-
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) => {
|
|
11063
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]);
|
|
11064
11077
|
}), this._program.bindAttribs(e, {
|
|
11065
11078
|
position: "inPosition",
|
|
@@ -11118,10 +11131,10 @@ class V0 {
|
|
|
11118
11131
|
r.bindFramebuffer(r.FRAMEBUFFER, o), r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, i._apiObject, 0);
|
|
11119
11132
|
let a = new Uint8Array(e.size.width * e.size.height * 4);
|
|
11120
11133
|
r.readPixels(0, 0, e.size[0], e.size[1], r.RGBA, r.UNSIGNED_BYTE, a);
|
|
11121
|
-
const
|
|
11134
|
+
const A = new ImageData(new Uint8ClampedArray(a), e.size.width, e.size.height), c = A.width, d = A.height, P = A.data;
|
|
11122
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));
|
|
11123
11136
|
const C = this._context;
|
|
11124
|
-
C && C.putImageData(
|
|
11137
|
+
C && C.putImageData(A, 0, 0), r.bindTexture(r.TEXTURE_2D, n), r.bindFramebuffer(r.FRAMEBUFFER, s);
|
|
11125
11138
|
}
|
|
11126
11139
|
}
|
|
11127
11140
|
const K0 = {
|