forked from sent/waves
21980 lines
1.1 MiB
21980 lines
1.1 MiB
(() => {
|
|
var e = {
|
|
1312: (e, t, n) => {
|
|
var i;
|
|
/**
|
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
*
|
|
* @version 0.11.0
|
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
* @copyright Chen, Yi-Cyuan 2014-2024
|
|
* @license MIT
|
|
*/
|
|
! function() {
|
|
"use strict";
|
|
var t = "input is invalid type",
|
|
r = "object" == typeof window,
|
|
a = r ? window : {};
|
|
a.JS_SHA256_NO_WINDOW && (r = !1);
|
|
var s = !r && "object" == typeof self,
|
|
o = !a.JS_SHA256_NO_NODE_JS && "object" == typeof process && process.versions && process.versions.node;
|
|
o ? a = n.g : s && (a = self);
|
|
var l = !a.JS_SHA256_NO_COMMON_JS && e.exports,
|
|
c = n.amdO,
|
|
h = !a.JS_SHA256_NO_ARRAY_BUFFER && "undefined" != typeof ArrayBuffer,
|
|
u = "0123456789abcdef".split(""),
|
|
d = [-2147483648, 8388608, 32768, 128],
|
|
f = [24, 16, 8, 0],
|
|
p = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298],
|
|
m = ["hex", "array", "digest", "arrayBuffer"],
|
|
g = [];
|
|
!a.JS_SHA256_NO_NODE_JS && Array.isArray || (Array.isArray = function(e) {
|
|
return "[object Array]" === Object.prototype.toString.call(e)
|
|
}), !h || !a.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function(e) {
|
|
return "object" == typeof e && e.buffer && e.buffer.constructor === ArrayBuffer
|
|
});
|
|
var A = function(e, t) {
|
|
return function(n) {
|
|
return new x(t, !0).update(n)[e]()
|
|
}
|
|
},
|
|
_ = function(e) {
|
|
var t = A("hex", e);
|
|
o && (t = v(t, e)), t.create = function() {
|
|
return new x(e)
|
|
}, t.update = function(e) {
|
|
return t.create().update(e)
|
|
};
|
|
for (var n = 0; n < m.length; ++n) {
|
|
var i = m[n];
|
|
t[i] = A(i, e)
|
|
}
|
|
return t
|
|
},
|
|
v = function(e, i) {
|
|
var r, s = n(4394),
|
|
o = n(1903).Buffer,
|
|
l = i ? "sha224" : "sha256";
|
|
r = o.from && !a.JS_SHA256_NO_BUFFER_FROM ? o.from : function(e) {
|
|
return new o(e)
|
|
};
|
|
return function(n) {
|
|
if ("string" == typeof n) return s.createHash(l).update(n, "utf8").digest("hex");
|
|
if (null == n) throw new Error(t);
|
|
return n.constructor === ArrayBuffer && (n = new Uint8Array(n)), Array.isArray(n) || ArrayBuffer.isView(n) || n.constructor === o ? s.createHash(l).update(r(n)).digest("hex") : e(n)
|
|
}
|
|
},
|
|
w = function(e, t) {
|
|
return function(n, i) {
|
|
return new b(n, t, !0).update(i)[e]()
|
|
}
|
|
},
|
|
y = function(e) {
|
|
var t = w("hex", e);
|
|
t.create = function(t) {
|
|
return new b(t, e)
|
|
}, t.update = function(e, n) {
|
|
return t.create(e).update(n)
|
|
};
|
|
for (var n = 0; n < m.length; ++n) {
|
|
var i = m[n];
|
|
t[i] = w(i, e)
|
|
}
|
|
return t
|
|
};
|
|
|
|
function x(e, t) {
|
|
t ? (g[0] = g[16] = g[1] = g[2] = g[3] = g[4] = g[5] = g[6] = g[7] = g[8] = g[9] = g[10] = g[11] = g[12] = g[13] = g[14] = g[15] = 0, this.blocks = g) : this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], e ? (this.h0 = 3238371032, this.h1 = 914150663, this.h2 = 812702999, this.h3 = 4144912697, this.h4 = 4290775857, this.h5 = 1750603025, this.h6 = 1694076839, this.h7 = 3204075428) : (this.h0 = 1779033703, this.h1 = 3144134277, this.h2 = 1013904242, this.h3 = 2773480762, this.h4 = 1359893119, this.h5 = 2600822924, this.h6 = 528734635, this.h7 = 1541459225), this.block = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0, this.is224 = e
|
|
}
|
|
|
|
function b(e, n, i) {
|
|
var r, a = typeof e;
|
|
if ("string" === a) {
|
|
var s, o = [],
|
|
l = e.length,
|
|
c = 0;
|
|
for (r = 0; r < l; ++r)(s = e.charCodeAt(r)) < 128 ? o[c++] = s : s < 2048 ? (o[c++] = 192 | s >>> 6, o[c++] = 128 | 63 & s) : s < 55296 || s >= 57344 ? (o[c++] = 224 | s >>> 12, o[c++] = 128 | s >>> 6 & 63, o[c++] = 128 | 63 & s) : (s = 65536 + ((1023 & s) << 10 | 1023 & e.charCodeAt(++r)), o[c++] = 240 | s >>> 18, o[c++] = 128 | s >>> 12 & 63, o[c++] = 128 | s >>> 6 & 63, o[c++] = 128 | 63 & s);
|
|
e = o
|
|
} else {
|
|
if ("object" !== a) throw new Error(t);
|
|
if (null === e) throw new Error(t);
|
|
if (h && e.constructor === ArrayBuffer) e = new Uint8Array(e);
|
|
else if (!(Array.isArray(e) || h && ArrayBuffer.isView(e))) throw new Error(t)
|
|
}
|
|
e.length > 64 && (e = new x(n, !0).update(e).array());
|
|
var u = [],
|
|
d = [];
|
|
for (r = 0; r < 64; ++r) {
|
|
var f = e[r] || 0;
|
|
u[r] = 92 ^ f, d[r] = 54 ^ f
|
|
}
|
|
x.call(this, n, i), this.update(d), this.oKeyPad = u, this.inner = !0, this.sharedMemory = i
|
|
}
|
|
x.prototype.update = function(e) {
|
|
if (!this.finalized) {
|
|
var n, i = typeof e;
|
|
if ("string" !== i) {
|
|
if ("object" !== i) throw new Error(t);
|
|
if (null === e) throw new Error(t);
|
|
if (h && e.constructor === ArrayBuffer) e = new Uint8Array(e);
|
|
else if (!(Array.isArray(e) || h && ArrayBuffer.isView(e))) throw new Error(t);
|
|
n = !0
|
|
}
|
|
for (var r, a, s = 0, o = e.length, l = this.blocks; s < o;) {
|
|
if (this.hashed && (this.hashed = !1, l[0] = this.block, this.block = l[16] = l[1] = l[2] = l[3] = l[4] = l[5] = l[6] = l[7] = l[8] = l[9] = l[10] = l[11] = l[12] = l[13] = l[14] = l[15] = 0), n)
|
|
for (a = this.start; s < o && a < 64; ++s) l[a >>> 2] |= e[s] << f[3 & a++];
|
|
else
|
|
for (a = this.start; s < o && a < 64; ++s)(r = e.charCodeAt(s)) < 128 ? l[a >>> 2] |= r << f[3 & a++] : r < 2048 ? (l[a >>> 2] |= (192 | r >>> 6) << f[3 & a++], l[a >>> 2] |= (128 | 63 & r) << f[3 & a++]) : r < 55296 || r >= 57344 ? (l[a >>> 2] |= (224 | r >>> 12) << f[3 & a++], l[a >>> 2] |= (128 | r >>> 6 & 63) << f[3 & a++], l[a >>> 2] |= (128 | 63 & r) << f[3 & a++]) : (r = 65536 + ((1023 & r) << 10 | 1023 & e.charCodeAt(++s)), l[a >>> 2] |= (240 | r >>> 18) << f[3 & a++], l[a >>> 2] |= (128 | r >>> 12 & 63) << f[3 & a++], l[a >>> 2] |= (128 | r >>> 6 & 63) << f[3 & a++], l[a >>> 2] |= (128 | 63 & r) << f[3 & a++]);
|
|
this.lastByteIndex = a, this.bytes += a - this.start, a >= 64 ? (this.block = l[16], this.start = a - 64, this.hash(), this.hashed = !0) : this.start = a
|
|
}
|
|
return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 | 0, this.bytes = this.bytes % 4294967296), this
|
|
}
|
|
}, x.prototype.finalize = function() {
|
|
if (!this.finalized) {
|
|
this.finalized = !0;
|
|
var e = this.blocks,
|
|
t = this.lastByteIndex;
|
|
e[16] = this.block, e[t >>> 2] |= d[3 & t], this.block = e[16], t >= 56 && (this.hashed || this.hash(), e[0] = this.block, e[16] = e[1] = e[2] = e[3] = e[4] = e[5] = e[6] = e[7] = e[8] = e[9] = e[10] = e[11] = e[12] = e[13] = e[14] = e[15] = 0), e[14] = this.hBytes << 3 | this.bytes >>> 29, e[15] = this.bytes << 3, this.hash()
|
|
}
|
|
}, x.prototype.hash = function() {
|
|
var e, t, n, i, r, a, s, o, l, c = this.h0,
|
|
h = this.h1,
|
|
u = this.h2,
|
|
d = this.h3,
|
|
f = this.h4,
|
|
m = this.h5,
|
|
g = this.h6,
|
|
A = this.h7,
|
|
_ = this.blocks;
|
|
for (e = 16; e < 64; ++e) t = ((r = _[e - 15]) >>> 7 | r << 25) ^ (r >>> 18 | r << 14) ^ r >>> 3, n = ((r = _[e - 2]) >>> 17 | r << 15) ^ (r >>> 19 | r << 13) ^ r >>> 10, _[e] = _[e - 16] + t + _[e - 7] + n | 0;
|
|
for (l = h & u, e = 0; e < 64; e += 4) this.first ? (this.is224 ? (a = 300032, A = (r = _[0] - 1413257819) - 150054599 | 0, d = r + 24177077 | 0) : (a = 704751109, A = (r = _[0] - 210244248) - 1521486534 | 0, d = r + 143694565 | 0), this.first = !1) : (t = (c >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10), i = (a = c & h) ^ c & u ^ l, A = d + (r = A + (n = (f >>> 6 | f << 26) ^ (f >>> 11 | f << 21) ^ (f >>> 25 | f << 7)) + (f & m ^ ~f & g) + p[e] + _[e]) | 0, d = r + (t + i) | 0), t = (d >>> 2 | d << 30) ^ (d >>> 13 | d << 19) ^ (d >>> 22 | d << 10), i = (s = d & c) ^ d & h ^ a, g = u + (r = g + (n = (A >>> 6 | A << 26) ^ (A >>> 11 | A << 21) ^ (A >>> 25 | A << 7)) + (A & f ^ ~A & m) + p[e + 1] + _[e + 1]) | 0, t = ((u = r + (t + i) | 0) >>> 2 | u << 30) ^ (u >>> 13 | u << 19) ^ (u >>> 22 | u << 10), i = (o = u & d) ^ u & c ^ s, m = h + (r = m + (n = (g >>> 6 | g << 26) ^ (g >>> 11 | g << 21) ^ (g >>> 25 | g << 7)) + (g & A ^ ~g & f) + p[e + 2] + _[e + 2]) | 0, t = ((h = r + (t + i) | 0) >>> 2 | h << 30) ^ (h >>> 13 | h << 19) ^ (h >>> 22 | h << 10), i = (l = h & u) ^ h & d ^ o, f = c + (r = f + (n = (m >>> 6 | m << 26) ^ (m >>> 11 | m << 21) ^ (m >>> 25 | m << 7)) + (m & g ^ ~m & A) + p[e + 3] + _[e + 3]) | 0, c = r + (t + i) | 0, this.chromeBugWorkAround = !0;
|
|
this.h0 = this.h0 + c | 0, this.h1 = this.h1 + h | 0, this.h2 = this.h2 + u | 0, this.h3 = this.h3 + d | 0, this.h4 = this.h4 + f | 0, this.h5 = this.h5 + m | 0, this.h6 = this.h6 + g | 0, this.h7 = this.h7 + A | 0
|
|
}, x.prototype.hex = function() {
|
|
this.finalize();
|
|
var e = this.h0,
|
|
t = this.h1,
|
|
n = this.h2,
|
|
i = this.h3,
|
|
r = this.h4,
|
|
a = this.h5,
|
|
s = this.h6,
|
|
o = this.h7,
|
|
l = u[e >>> 28 & 15] + u[e >>> 24 & 15] + u[e >>> 20 & 15] + u[e >>> 16 & 15] + u[e >>> 12 & 15] + u[e >>> 8 & 15] + u[e >>> 4 & 15] + u[15 & e] + u[t >>> 28 & 15] + u[t >>> 24 & 15] + u[t >>> 20 & 15] + u[t >>> 16 & 15] + u[t >>> 12 & 15] + u[t >>> 8 & 15] + u[t >>> 4 & 15] + u[15 & t] + u[n >>> 28 & 15] + u[n >>> 24 & 15] + u[n >>> 20 & 15] + u[n >>> 16 & 15] + u[n >>> 12 & 15] + u[n >>> 8 & 15] + u[n >>> 4 & 15] + u[15 & n] + u[i >>> 28 & 15] + u[i >>> 24 & 15] + u[i >>> 20 & 15] + u[i >>> 16 & 15] + u[i >>> 12 & 15] + u[i >>> 8 & 15] + u[i >>> 4 & 15] + u[15 & i] + u[r >>> 28 & 15] + u[r >>> 24 & 15] + u[r >>> 20 & 15] + u[r >>> 16 & 15] + u[r >>> 12 & 15] + u[r >>> 8 & 15] + u[r >>> 4 & 15] + u[15 & r] + u[a >>> 28 & 15] + u[a >>> 24 & 15] + u[a >>> 20 & 15] + u[a >>> 16 & 15] + u[a >>> 12 & 15] + u[a >>> 8 & 15] + u[a >>> 4 & 15] + u[15 & a] + u[s >>> 28 & 15] + u[s >>> 24 & 15] + u[s >>> 20 & 15] + u[s >>> 16 & 15] + u[s >>> 12 & 15] + u[s >>> 8 & 15] + u[s >>> 4 & 15] + u[15 & s];
|
|
return this.is224 || (l += u[o >>> 28 & 15] + u[o >>> 24 & 15] + u[o >>> 20 & 15] + u[o >>> 16 & 15] + u[o >>> 12 & 15] + u[o >>> 8 & 15] + u[o >>> 4 & 15] + u[15 & o]), l
|
|
}, x.prototype.toString = x.prototype.hex, x.prototype.digest = function() {
|
|
this.finalize();
|
|
var e = this.h0,
|
|
t = this.h1,
|
|
n = this.h2,
|
|
i = this.h3,
|
|
r = this.h4,
|
|
a = this.h5,
|
|
s = this.h6,
|
|
o = this.h7,
|
|
l = [e >>> 24 & 255, e >>> 16 & 255, e >>> 8 & 255, 255 & e, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r, a >>> 24 & 255, a >>> 16 & 255, a >>> 8 & 255, 255 & a, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s];
|
|
return this.is224 || l.push(o >>> 24 & 255, o >>> 16 & 255, o >>> 8 & 255, 255 & o), l
|
|
}, x.prototype.array = x.prototype.digest, x.prototype.arrayBuffer = function() {
|
|
this.finalize();
|
|
var e = new ArrayBuffer(this.is224 ? 28 : 32),
|
|
t = new DataView(e);
|
|
return t.setUint32(0, this.h0), t.setUint32(4, this.h1), t.setUint32(8, this.h2), t.setUint32(12, this.h3), t.setUint32(16, this.h4), t.setUint32(20, this.h5), t.setUint32(24, this.h6), this.is224 || t.setUint32(28, this.h7), e
|
|
}, b.prototype = new x, b.prototype.finalize = function() {
|
|
if (x.prototype.finalize.call(this), this.inner) {
|
|
this.inner = !1;
|
|
var e = this.array();
|
|
x.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(e), x.prototype.finalize.call(this)
|
|
}
|
|
};
|
|
var E = _();
|
|
E.sha256 = E, E.sha224 = _(!0), E.sha256.hmac = y(), E.sha224.hmac = y(!0), l ? e.exports = E : (a.sha256 = E.sha256, a.sha224 = E.sha224, c && (void 0 === (i = function() {
|
|
return E
|
|
}.call(E, n, E, e)) || (e.exports = i)))
|
|
}()
|
|
},
|
|
1903: () => {},
|
|
4394: () => {},
|
|
6925: () => {
|
|
"use strict";
|
|
|
|
function e(e) {
|
|
throw new Error(e + ": No deterministic implementation")
|
|
}
|
|
const t = new WebAssembly.Instance(new WebAssembly.Module(Uint8Array.from(atob("AGFzbQEAAAABJAZgAXwBfGACfHwBfGACf38AYAJ/fABgBH9/f38Bf2ACfH8BfAMcGwQDAQAAAAAAAAAAAQACBQIBAQAAAAAAAAAAAAUDAQARBgkBfwFBgIDAAAsHVQwGbWVtb3J5AgAEYWNvcwASBGFzaW4AEwRhdGFuABQFYXRhbjIAEANleHAAFQNsb2cAFgNwb3cAEQRzcXJ0ABcDdGFuABgEbG9nMgAZBWxvZzEwABoKsG4bqxsDHH8BfgR8IwBBwARrIgckACAHQQhqQaABEA8gB0GoAWpBoAEQDyAHQcgCakGgARAPIAdB6ANqQdAAEA9BhIDAACgCACIKIAFBf2oiC2ohBSADQX1qQRhtIgRBACAEQQBKGyIPIAtrIQQgD0ECdCABQQJ0a0GUgMAAaiEJQQAhAQNAIAdBCGogAUEDdGogBEEASAR8RAAAAAAAAAAABSAJKAIAtws5AwAgASAFSQRAIAlBBGohCSAEQQFqIQQgASABIAVJaiIBIAVNDQELCyADQWhqIQVBACEEA0AgBCALaiENIAQgCkkhBkQAAAAAAAAAACEhQQAhAQNAAkAgISAAIAFBA3RqKwMAIAdBCGogDSABa0EDdGorAwCioCEhIAEgC08NACABIAEgC0lqIgEgC00NAQsLIAdByAJqIARBA3RqICE5AwAgBCAKSQRAIAQgBmoiBCAKTQ0BCwtEAAAAAAAA8H9EAAAAAAAA4H8gBSAPQWhsIhdqIgZB/g9LIhIbRAAAAAAAAAAARAAAAAAAAGADIAZBuXBJIhMbRAAAAAAAAPA/IAZBgnhIIhQbIAZB/wdKIhUbIAZB/RcgBkH9F0gbQYJwaiAGQYF4aiASGyIYIAZB8GggBkHwaEobQZIPaiAGQckHaiATGyIZIAYgFBsgFRtB/wdqrUI0hr+iISMgB0HkA2oiECAKQQJ0aiENQRcgBmtBH3EhGkEYIAZrQR9xIRYgB0HAAmohGyAGQX9qIRwgCiEEAkADQCAHQcgCaiAEIgVBA3RqKwMAISECQCAFRQ0AIAdB6ANqIQggBSEBA0AgIUQAAAAAAABwPqIiIkQAAAAAAADgwWYhBCAhQQBB/////wcgIplEAAAAAAAA4EFjBH8gIqoFQYCAgIB4C0GAgICAeCAEGyAiRAAAwP///99BZBsgIiAiYhu3IiJEAAAAAAAAcMGioCIhRAAAAAAAAODBZiEEIAhBAEH/////BwJ/ICGZRAAAAAAAAOBBYwRAICGqDAELQYCAgIB4C0GAgICAeCAEGyAhRAAAwP///99BZBsgISAhYhs2AgAgGyABQQN0aisDACAioCEhIAFBAkkiBA0BIAhBBGohCEEBIAFBf2ogBBsiAQ0ACwsCfwJAIBVFBEAgFA0BIAYMAgsgIUQAAAAAAADgf6IiIUQAAAAAAADgf6IgISASGyEhIBgMAQsgIUQAAAAAAABgA6IiIUQAAAAAAABgA6IgISATGyEhIBkLIQECQCAhIAFB/wdqrUI0hr+iIiREAAAAAAAAwD+iIiFEAAAAAAAAAABhDQAgIb0iIEI0iKdB/w9xIgFBsghLDQACQAJAICBCAFkEQCAHICFEAAAAAAAAMEOgRAAAAAAAADDDoCAhoSIiOQO4BCABQf8HTw0BIAcrA7gEGkQAAAAAAAAAACEhDAMLIAcgIUQAAAAAAAAww6BEAAAAAAAAMEOgICGhIiI5A7gEIAFB/wdJDQELICEgIqAiIUQAAAAAAADwv6AgISAiRAAAAAAAAAAAZBshIQwBCyAHKwO4BBpEAAAAAAAA8L8hIQsgJCAhRAAAAAAAACDAoqAiIUQAAAAAAADgwWYhASAhQQBB/////wcCfyAhmUQAAAAAAADgQWMEQCAhqgwBC0GAgICAeAtBgICAgHggARsgIUQAAMD////fQWQbICEgIWIbIg63oSEhAn8CQAJAAkACQAJ/IAZBAEoiHUUEQCAGRQRAIBAgBUECdGooAgBBF3UMAgtBAiEMQQAgIUQAAAAAAADgP2ZFDQYaDAILIBAgBUECdGoiASABKAIAIgEgASAWdSIBIBZ0ayIENgIAIAEgDmohDiAEIBp1CyIMQQFIDQELIAUNAUEAIQgMAgsgDAwCC0EAIRFBACEIIAVBAUcEQCAFQR5xIR4gB0HoA2ohAQNAIAEoAgAhBEH///8HIQkCfwJAIAgNAEGAgIAIIQkgBA0AQQEMAQsgASAJIARrNgIAQQALIQkgAUEEaiIfKAIAIQhB////ByEEAn8CQCAJRQ0AQYCAgAghBCAIDQBBAAwBCyAfIAQgCGs2AgBBAQshCCABQQhqIQEgHiARQQJqIhFHDQALCyAFQQFxRQ0AIAdB6ANqIBFBAnRqIgkoAgAhAUH///8HIQQCQCAIDQBBgICACCEEIAENAEEAIQgMAQsgCSAEIAFrNgIAQQEhCAsCQCAdRQ0AQf///wMhAQJAAkAgHA4CAQACC0H///8BIQELIBAgBUECdGoiBCAEKAIAIAFxNgIACyAOQQFqIQ4gDCAMQQJHDQAaRAAAAAAAAPA/ICGhICNEAAAAAAAAAAAgCBuhISFBAgshDCAhRAAAAAAAAAAAYQRAIA0hASAFIQQCQCAKIAVBf2oiCEsNAEEAIQkDQAJAIAdB6ANqIAhBAnRqKAIAIAlyIQkgCiAITw0AIAogCCAKIAhJayIITQ0BCwsgBSEEIAlFDQAgBUECdCAHakHkA2ohAQNAIAVBf2ohBSAGQWhqIQYgASgCACABQXxqIQFFDQALDAMLA0AgBEEBaiEEIAEoAgAgAUF8aiEBRQ0ACyAFIARPDQEgBUEBaiEJA0AgB0EIaiAJIAtqIgVBA3RqIAkgD2pBAnRBkIDAAGooAgC3OQMAQQAhAUQAAAAAAAAAACEhA0ACQCAhIAAgAUEDdGorAwAgB0EIaiAFIAFrQQN0aisDAKKgISEgASALTw0AIAEgASALSWoiASALTQ0BCwsgB0HIAmogCUEDdGogITkDACAJIARPDQIgCSAESSAJaiIBIQkgASAETQ0ACwwBCwsCQAJAAkBBACAGayIBQf8HTARAIAFBgnhODQMgIUQAAAAAAABgA6IhISABQbhwTQ0BQckHIAZrIQEMAwsgIUQAAAAAAADgf6IhISABQf4PSw0BQYF4IAZrIQEMAgsgIUQAAAAAAABgA6IhISABQfBoIAFB8GhKG0GSD2ohAQwBCyAhRAAAAAAAAOB/oiEhIAFB/RcgAUH9F0gbQYJwaiEBCyAhIAFB/wdqrUI0hr+iIiFEAAAAAAAAcEFmBEAgIUQAAAAAAABwPqIiIkQAAAAAAADgwWYhACAhQQBB/////wcCfyAimUQAAAAAAADgQWMEQCAiqgwBC0GAgICAeAtBgICAgHggABsgIkQAAMD////fQWQbICIgImIbtyIhRAAAAAAAAHDBoqAiIkQAAAAAAADgwWYhACAHQegDaiAFQQJ0akEAQf////8HAn8gIplEAAAAAAAA4EFjBEAgIqoMAQtBgICAgHgLQYCAgIB4IAAbICJEAADA////30FkGyAiICJiGzYCACADIBdqIQYgBUEBaiEFCyAhRAAAAAAAAODBZiEAIAdB6ANqIAVBAnRqQQBB/////wcCfyAhmUQAAAAAAADgQWMEQCAhqgwBC0GAgICAeAtBgICAgHggABsgIUQAAMD////fQWQbICEgIWIbNgIACwJ8AkACQCAGQf8HTARARAAAAAAAAPA/IAZBgnhODQMaIAZBuHBNDQEgBkHJB2ohBkQAAAAAAABgAwwDCyAGQf4PSw0BIAZBgXhqIQZEAAAAAAAA4H8MAgsgBkHwaCAGQfBoShtBkg9qIQZEAAAAAAAAAAAMAQsgBkH9FyAGQf0XSBtBgnBqIQZEAAAAAAAA8H8LIAZB/wdqrUI0hr+iISEgBUEBcQR/IAUFIAdByAJqIAVBA3RqICEgB0HoA2ogBUECdGooAgC3ojkDACAhRAAAAAAAAHA+oiEhIAVBf2oLIQAgBQRAIABBA3QgB2pBwAJqIQEgAEECdCAHakHkA2ohBANAIAEgIUQAAAAAAABwPqIiIiAEKAIAt6I5AwAgAUEIaiAhIARBBGooAgC3ojkDACABQXBqIQEgBEF4aiEEICJEAAAAAAAAcD6iISEgAEEBRyAAQX5qIQANAAsLIAVBAWohBiAHQcgCaiAFQQN0aiEIIAUhAQNAAkAgCiAFIAEiAGsiAyAKIANJGyINRQRAQQAhBEQAAAAAAAAAACEhDAELIA1BAWpBfnEhCUQAAAAAAAAAACEhQQAhAUEAIQQDQCAhIAFBmILAAGorAwAgASAIaiILKwMAoqAgAUGggsAAaisDACALQQhqKwMAoqAhISABQRBqIQEgCSAEQQJqIgRHDQALCyAHQagBaiADQQN0aiANQQFxBHwgIQUgISAEQQN0QZiCwABqKwMAIAdByAJqIAAgBGpBA3RqKwMAoqALOQMAIAhBeGohCCAAQX9qIQEgAA0ACwJAIAZBA3EiAEUEQEQAAAAAAAAAACEhIAUhBAwBCyAHQagBaiAFQQN0aiEBRAAAAAAAAAAAISEgBSEEA0AgBEF/aiEEICEgASsDAKAhISABQXhqIQEgAEF/aiIADQALCyAFQQNPBEAgBEEDdCAHakGQAWohAQNAICEgAUEYaisDAKAgAUEQaisDAKAgAUEIaisDAKAgASsDAKAhISABQWBqIQEgBEEDRyAEQXxqIQQNAAsLIAIgIZogISAMGzkDACAHKwOoASAhoSEhAkAgBUUNAEEBIQEDQCAhIAdBqAFqIAFBA3RqKwMAoCEhIAEgBU8NASABIAEgBUlqIgEgBU0NAAsLIAIgIZogISAMGzkDCCAHQcAEaiQAIA5BB3ELtxIDA38BfgR8IwBBMGsiBCQAAkACQAJAAkACQCABvSIFQiCIpyIDQf////8HcSICQfvUvYAETwRAIAJBvIzxgARPBEAgBEEAQf////8HAn8CQCACQfvD5IkETwRAIAJB//+//wdLDQUgBUL/////////B4NCgICAgICAgLDBAIS/IgFEAAAAAAAA4MFmIQMgAZlEAAAAAAAA4EFjRQ0BIAGqDAILAkAgAkEUdiICIAEgAUSDyMltMF/kP6JEAAAAAAAAOEOgRAAAAAAAADjDoCIGRAAAQFT7Ifm/oqAiASAGRDFjYhphtNA9oiIJoSIIvUI0iKdB/w9xa0ERSA0AIAIgASAGRAAAYBphtNA9oiIIoSIHIAZEc3ADLooZozuiIAEgB6EgCKGhIgmhIgi9QjSIp0H/D3FrQTJIBEAgByEBDAELIAcgBkQAAAAuihmjO6IiCKEiASAGRMFJICWag3s5oiAHIAGhIAihoSIJoSEICyAAIAg5AwAgACABIAihIAmhOQMQIAZEAAAAAAAA4MFmIQMgAEEAQf////8HAn8gBplEAAAAAAAA4EFjBEAgBqoMAQtBgICAgHgLQYCAgIB4IAMbIAZEAADA////30FkGyAGIAZiGzYCCAwIC0GAgICAeAtBgICAgHggAxsgAUQAAMD////fQWQbIAEgAWIbtyIHOQMAIAEgB6FEAAAAAAAAcEGiIgFEAAAAAAAA4MFmIQMgBEEAQf////8HAn8gAZlEAAAAAAAA4EFjBEAgAaoMAQtBgICAgHgLQYCAgIB4IAMbIAFEAADA////30FkGyABIAFiGyIDtyIHOQMIIAQgASAHoUQAAAAAAABwQaIiATkDECAEQShqQgA3AwAgBEEgakIANwMAIARCADcDGCAEQQJBASADG0EDIAFEAAAAAAAAAABhGyAEQRhqIAJBFHZB6ndqEAAhAiAFQn9VBEAgACACNgIIIAAgBCsDIDkDECAAIAQrAxg5AwAMBwsgAEEAIAJrNgIIIAAgBCsDIJo5AxAgACAEKwMYmjkDAAwGCyACQb3714AETwRAIAJB+8PkgARGBEACQCABIAFEg8jJbTBf5D+iRAAAAAAAADhDoEQAAAAAAAA4w6AiBkQAAEBU+yH5v6KgIgEgBkQxY2IaYbTQPaIiCaEiCL1CgICAgICAgPj/AINC/////////4c/Vg0AIAEgBkQAAGAaYbTQPaIiCKEiByAGRHNwAy6KGaM7oiABIAehIAihoSIJoSIIvUKAgICAgICAgP8Ag0L//////////zxWBEAgByEBDAELIAcgBkQAAAAuihmjO6IiCKEiASAGRMFJICWag3s5oiAHIAGhIAihoSIJoSEICyAAIAg5AwAgACABIAihIAmhOQMQIAZEAAAAAAAA4MFmIQMgAEEAQf////8HAn8gBplEAAAAAAAA4EFjBEAgBqoMAQtBgICAgHgLQYCAgIB4IAMbIAZEAADA////30FkGyAGIAZiGzYCCAwHCyAFQgBZBEAgAEEENgIIIAAgAUQAAEBU+yEZwKAiAUQxY2IaYbTwvaAiBzkDACAAIAEgB6FEMWNiGmG08L2gOQMQDAcLIABBfDYCCCAAIAFEAABAVPshGUCgIgFEMWNiGmG08D2gIgc5AwAgACABIAehRDFjYhphtPA9oDkDEAwGCyACQfyyy4AERg0EIAVCAFkEQCAAQQM2AgggACABRAAAMH982RLAoCIBRMqUk6eRDum9oCIHOQMAIAAgASAHoUTKlJOnkQ7pvaA5AxAMBgsgAEF9NgIIIAAgAUQAADB/fNkSQKAiAUTKlJOnkQ7pPaAiBzkDACAAIAEgB6FEypSTp5EO6T2gOQMQDAULIANB//8/cUH7wyRGDQIgAkH9souABE8EQCAFQn9VBEAgAEECNgIIIAAgAUQAAEBU+yEJwKAiAUQxY2IaYbTgvaAiBzkDACAAIAEgB6FEMWNiGmG04L2gOQMQDAYLIABBfjYCCCAAIAFEAABAVPshCUCgIgFEMWNiGmG04D2gIgc5AwAgACABIAehRDFjYhphtOA9oDkDEAwFCyAFQn9VDQEgAEF/NgIIIAAgAUQAAEBU+yH5P6AiAUQxY2IaYbTQPaAiBzkDACAAIAEgB6FEMWNiGmG00D2gOQMQDAQLIABBADYCCCAAIAEgAaEiATkDECAAIAE5AwAMAwsgAEEBNgIIIAAgAUQAAEBU+yH5v6AiAUQxY2IaYbTQvaAiBzkDACAAIAEgB6FEMWNiGmG00L2gOQMQDAILAkAgAkEUdiICIAEgAUSDyMltMF/kP6JEAAAAAAAAOEOgRAAAAAAAADjDoCIGRAAAQFT7Ifm/oqAiASAGRDFjYhphtNA9oiIJoSIIvUI0iKdB/w9xa0ERSA0AIAIgASAGRAAAYBphtNA9oiIIoSIHIAZEc3ADLooZozuiIAEgB6EgCKGhIgmhIgi9QjSIp0H/D3FrQTJIBEAgByEBDAELIAcgBkQAAAAuihmjO6IiCKEiASAGRMFJICWag3s5oiAHIAGhIAihoSIJoSEICyAAIAg5AwAgACABIAihIAmhOQMQIAZEAAAAAAAA4MFmIQMgAEEAQf////8HAn8gBplEAAAAAAAA4EFjBEAgBqoMAQtBgICAgHgLQYCAgIB4IAMbIAZEAADA////30FkGyAGIAZiGzYCCAwBCwJAIAEgAUSDyMltMF/kP6JEAAAAAAAAOEOgRAAAAAAAADjDoCIGRAAAQFT7Ifm/oqAiASAGRDFjYhphtNA9oiIJoSIIvUKAgICAgICA+P8Ag0L/////////hz9WDQAgASAGRAAAYBphtNA9oiIIoSIHIAZEc3ADLooZozuiIAEgB6EgCKGhIgmhIgi9QoCAgICAgICA/wCDQv//////////PFYEQCAHIQEMAQsgByAGRAAAAC6KGaM7oiIIoSIBIAZEwUkgJZqDezmiIAcgAaEgCKGhIgmhIQgLIAAgCDkDACAAIAEgCKEgCaE5AxAgBkQAAAAAAADgwWYhAyAAQQBB/////wcCfyAGmUQAAAAAAADgQWMEQCAGqgwBC0GAgICAeAtBgICAgHggAxsgBkQAAMD////fQWQbIAYgBmIbNgIICyAEQTBqJAALzA8DCX8CfgV8RAAAAAAAAPA/IQ0CQAJAAkACQCABvSILQiCIpyIIQf////8HcSICIAunIgZyRQ0AIAC9IgxCIIinIQQgDKciCUVBACAEQYCAwP8DRhsNAAJAAkACQAJAAkACQCAEQf////8HcSIFQYCAwP8HSw0AAkAgBUGAgMD/B0YEQCAJIAJBgIDA/wdLcg0CDAELIAJBgYDA/wdPDQELIAJBgIDA/wdHDQEgBg0AIAVBgIDAgHxqIAlyRQ0GIAVB//+//wNLDQJEAAAAAAAAAAAgAZogC0J/VRsPCyAAIAGgDwsgDEIAUw0BIAYNAyACQYCAwP8DRw0CDAULIAFEAAAAAAAAAAAgC0J/VRsPC0ECIQMCQAJAIAJB////mQRLDQBBACEDIAJBgIDA/wNJDQAgAkEUdiEHIAJB////iQRNBEAgBg0EIAJBEyAHayIGdiIHIAZ0IAJHDQJBAiAHQQFxayEDDAILIAZBEyAHayIHdiIKIAd0IAZHDQBBAiAKQQFxayEDIAYNAwwBCyAGDQILIAJBgIDA/wNGDQMLIAhBgICA/wNHBEAgCEGAgICABEcNASAAIACiDwsgDEIAUw0AIAAQBA8LIACZIQ0CQAJAIAkNACAEQX9MBEAgBEGAgICAeEYgBEGAgMD/e0ZyDQIgBEGAgEBHDQEMAgsgBEUgBEGAgMD/A0ZyIARBgIDA/wdGcg0BC0QAAAAAAADwPyEPAkAgDEIAWQ0AAkACQCADDgIAAQILIAAgAKEiACAAow8LRAAAAAAAAPC/IQ8LAkAgAkGAgICPBE0EQCANRAAAAAAAAEBDoiIAIA0gBUGAgMAASSICGyENIAC9QiCIpyAFIAIbIgVB//8/cSIDQYCAwP8DciEEIAVBFHVBzHdBgXggAhtqIQVBACECAkAgA0GPsQ5JDQAgA0H67C5JBEBBASECDAELIANBgICA/wNyIQQgBUEBaiEFCyACQQN0IgNBqIPAAGorAwBEAAAAAAAA8D8gA0GYg8AAaisDACIAIA29Qv////8PgyAErUIghoS/IhCgoyINIBAgAKEiDiACQRJ0IARBAXZqQYCAoIACaq1CIIa/IhEgDiANoiIOvUKAgICAcIO/Ig2ioSAQIBEgAKGhIA2ioaIiACANIA2iIhBEAAAAAAAACECgIAAgDiANoKIgDiAOoiIAIACiIAAgACAAIAAgAETvTkVKKH7KP6JEZdvJk0qGzT+gokQBQR2pYHTRP6CiRE0mj1FVVdU/oKJE/6tv27Zt2z+gokQDMzMzMzPjP6CioCIRoL1CgICAgHCDvyIAoiAOIBEgAEQAAAAAAAAIwKAgEKGhoqAiDiAOIA0gAKIiDaC9QoCAgIBwg78iACANoaFE/QM63AnH7j+iIABE9QFbFOAvPr6ioKAiDSADQbiDwABqKwMAIg4gDSAARAAAAOAJx+4/oiINoKAgBbciEKC9QoCAgIBwg78iACAQoSAOoSANoaEhDgwBCwJAAkAgAkGAgMCfBE0EQCAFQf//v/8DSQ0CIAVBgIDA/wNLDQEgDUQAAAAAAADwv6AiAERE3134C65UPqIgACAAokQAAAAAAADgPyAAIABEAAAAAAAA0L+iRFVVVVVVVdU/oKKhokT+gitlRxX3v6KgIg0gDSAARAAAAGBHFfc/oiINoL1CgICAgHCDvyIAIA2hoSEODAMLIAVB//+//wNNBEBEAAAAAAAA8H9EAAAAAAAAAAAgC0IAUxsPC0QAAAAAAADwf0QAAAAAAAAAACAIQQBKGw8LIAhBAEwNBQwGCyALQgBZDQQMBQsgACALQoCAgIBwg78iEKIiDSAOIAGiIAEgEKEgAKKgIgCgIgG9IgunIQICQCALQiCIpyIDQf//v4QETARAIANBgPj//wdxQf+Xw4QETQ0BIANBgOi8+wNqIAJyDQUgACABIA2hZUUNAQwFCyADQYCAwPt7aiACcg0FIABE/oIrZUcVlzygIAEgDaFkRQ0ADAULQQAhAiAPAnwgA0H/////B3FBgICA/wNLBH5BAEGAgMAAIANBFHZBAmp2IANqIgNB//8/cUGAgMAAckETIANBFHYiBGt2IgJrIAIgC0IAUxshAiAAIA1BgIBAIARBAWp1IANxrUIghr+hIg2gvQUgCwtCgICAgHCDvyIBRAAAAABDLuY/oiIOIAAgASANoaFE7zn6/kIu5j+iIAFEOWyoDGFcIL6ioCINoCIAIAAgACAAIACiIgEgASABIAEgAUTQpL5yaTdmPqJE8WvSxUG9u76gokQs3iWvalYRP6CiRJO9vhZswWa/oKJEPlVVVVVVxT+goqEiAaIgAUQAAAAAAAAAwKCjIA0gACAOoaEiASAAIAGioKGhRAAAAAAAAPA/oCIAvSILQiCIpyACQRR0aiIDQYCAwABOBEAgC0L/////D4MgA61CIIaEvwwBCyAAIAIQDguiIQ0MAQtEAAAAAAAA8D8gDaMgDSALQgBTGyENIAxCf1UNACADIAVBgIDAgHxqckUEQCANIA2hIgAgAKMPCyANmiANIANBAUYbDwsgDQ8LIAtCf1UEQCAADwtEAAAAAAAA8D8gAKMPCyAPRFnz+MIfbqUBokRZ8/jCH26lAaIPCyAPRJx1AIg85Dd+okScdQCIPOQ3fqILswcDBH8BfgN8IwBBIGsiAiQAAkACQAJ8AkACQCAAvSIFQiCIp0H/////B3EiAUH8w6T/A08EQCABQf//v/8HTQRAIAJBCGogABABIAIoAhAhAyACKwMYIQggAisDCCIHvSIFQoCAgICA/////wCDQoCAgIDwhOXyP1YiBA0CDAULIAAgAKEhAAwFCyABQYCAgPIDTwRAIAVCgICAgID/////AINCgICAgPCE5fI/ViIBDQIgAAwDCyACIABEAAAAAAAAcDiiIABEAAAAAAAAcEegIAFBgIDAAEkbOQMIIAIrAwgaDAQLRBgtRFT7Iek/IAcgB5ogBUJ/VSIBG6FEB1wUMyamgTwgCCAImiABG6GgIQdEAAAAAAAAAAAhCAwCC0QYLURU+yHpPyAAmiAAIAVCAFMboUQHXBQzJqaBPKALIgcgByAHIAeiIgaiIgBEY1VVVVVV1T+iIAYgACAGIAaiIgAgACAAIAAgAERzU2Dby3XzvqJEppI3oIh+FD+gokQBZfLy2ERDP6CiRCgDVskibW0/oKJEN9YGhPRklj+gokR6/hARERHBP6AgBiAAIAAgACAAIABE1Hq/dHAq+z6iROmn8DIPuBI/oKJEaBCNGvcmMD+gokQVg+D+yNtXP6CiRJOEbunjJoI/oKJE/kGzG7qhqz+goqCiRAAAAAAAAAAAoKJEAAAAAAAAAACgoCIGoCEAIAFFDQFEAAAAAAAA8D8gByAGIAAgAKIgAEQAAAAAAADwP6CjoaAiACAAoKEiAJogACAFQgBTGyEADAELIANBAXEhASAHIAcgByAHoiIGoiIARGNVVVVVVdU/oiAIIAYgCCAAIAYgBqIiACAAIAAgACAARHNTYNvLdfO+okSmkjegiH4UP6CiRAFl8vLYREM/oKJEKANWySJtbT+gokQ31gaE9GSWP6CiRHr+EBEREcE/oCAGIAAgACAAIAAgAETUer90cCr7PqJE6afwMg+4Ej+gokRoEI0a9yYwP6CiRBWD4P7I21c/oKJEk4Ru6eMmgj+gokT+QbMbuqGrP6CioKKgoqCgIgigIQAgBEUEQCABRQ0BRAAAAAAAAPC/IACjIgYgAL1CgICAgHCDvyIAIAa9QoCAgIBwg78iBqJEAAAAAAAA8D+gIAggACAHoaEgBqKgoiAGoCEADAELRAAAAAAAAPA/IAG3IgYgBqChIgYgByAIIAAgAKIgBiAAoKOhoCIAIACgoSIAmiAAIAVCAFMbIQALIAJBIGokACAAC9UEAgl/AX4gAL0iCkIgiKciAUGAgMD/B3FBgIDA/wdGBEAgACAAoiAAoA8LIAqnIQICfwJ/AkACQAJAAkAgAUEATARAIAFB/////wdxIAJyRQ0CIApCf1cNAQsgAUEUdSABQf//P0sNBRpBASEEIAEEQCACIQMMBAsgAiEDA0AgBEFraiEEIAMiAkEVdCEDIAJBgBBJDQALDAILIAAgAKEiACAAoyEACyAADwsgAkELdiIBIAJBAEgNARoLIAFBFCABZ0Efc2siBXQLIQEgAyAFdCECIANBACAFa3YgAXIhASAEIAVrCyABQf//P3FBgIDAAHIhA0GBeGoiCUEBcQRAIANBAXQgAkEfdnIhAyACQQF0IQILIANBAXQgAkEfdnIhBCACQQF0IQNBgICAASEBQQAhAgNAIAIgASACaiIFIAFqIAUgBEoiBhshAiAEQQAgBSAGG2tBAXQgA0EfdnIhBCADQQF0IQNBACABIAYbIAdqIQcgAUEBSyABQQF2IQENAAtBgICAgHghBUEAIQYDQCAEIAJMQQAgAiAERyADIAggBSIBaiIFSXIbRQRAIAQgAmsgAyAFSWshBCACIAVBAEggASAFaiIIQX9KcWohAiABIAZqIQYgAyAFayEDCyAEQQF0IANBH3ZyIQQgAUEBdiEFIANBAXQhAyABQQJPDQALAkAgAyAEckUNACAGQX9GBEAgB0EBaiEHQQAhBgwBCyAGQQFxIAZqIQYLIAdBH3QgBkEBdnKtIAlBE3RBgIBAcSAHQQF1akGAgID/A2qtQiCGhL8LrQUDA38BfgJ8IwBBEGshASAAvSIEQj+IpyECAkACfCAAAn8CQAJAAkACQCAEQiCIp0H/////B3EiA0GrxpiEBE8EQCAAIABiBEAgAA8LIABE7zn6/kIuhkBkDQIgAETSvHrdKyOGwGNFDQEgAUQAAAAAAACgtiAAo7Y4AgQgASoCBBogAERRMC3VEEmHwGNFDQEMBwsgA0HC3Nj+A00EQCADQYCAwPEDTQ0DQQAhASAADAYLIANBscXC/wNNDQMLIABE/oIrZUcV9z+iIAJBA3RBiIPAAGorAwCgIgVEAAAAAAAA4MFmIQJBAEH/////BwJ/IAWZRAAAAAAAAOBBYwRAIAWqDAELQYCAgIB4C0GAgICAeCACGyAFRAAAwP///99BZBsgBSAFYhsMAwsgAEQAAAAAAADgf6IPCyABIABEAAAAAAAA4H+gOQMIIAErAwgaIABEAAAAAAAA8D+gDwsgAkEBcyACawsiAbciBUQAAOD+Qi7mv6KgIgAgBUR2PHk17znqPaIiBqELIQUgACAFIAUgBSAFoiIAIAAgACAAIABE0KS+cmk3Zj6iRPFr0sVBvbu+oKJELN4lr2pWET+gokSTvb4WbMFmv6CiRD5VVVVVVcU/oKKhIgCiRAAAAAAAAABAIAChoyAGoaBEAAAAAAAA8D+gIQUgAUUNAAJAAkACQCABQf8HTARAIAFBgnhODQMgBUQAAAAAAABgA6IhBSABQbhwTQ0BIAFByQdqIQEMAwsgBUQAAAAAAADgf6IhBSABQf4PSw0BIAFBgXhqIQEMAgsgBUQAAAAAAABgA6IhBSABQfBoIAFB8GhKG0GSD2ohAQwBCyAFRAAAAAAAAOB/oiEFIAFB/RcgAUH9F0gbQYJwaiEBCyAFIAFB/wdqrUI0hr+iIQULIAULygUDAX8BfgF8AkAgAL0iAkIgiKdB/////wdxIgFB//+//wNNBEAgAUGAgID/A08EQCACQn9VBEBEAAAAAAAA8D8gAKFEAAAAAAAA4D+iIgAgACAAIAAgACAARAn3/Q3hPQI/okSIsgF14O9JP6CiRDuPaLUogqS/oKJEVUSIDlXByT+gokR9b+sDEtbUv6CiRFVVVVVVVcU/oKIgACAAIAAgAESCki6xxbizP6JEWQGNG2wG5r+gokTIilmc5SoAQKCiREstihwnOgPAoKJEAAAAAAAA8D+goyAAEAQiA6IgACADvUKAgICAcIO/IgAgAKKhIAMgAKCjoCAAoCIAIACgDwtEGC1EVPsh+T8gAEQAAAAAAADwP6BEAAAAAAAA4D+iIgAQBCIDIAMgACAAIAAgACAAIABECff9DeE9Aj+iRIiyAXXg70k/oKJEO49otSiCpL+gokRVRIgOVcHJP6CiRH1v6wMS1tS/oKJEVVVVVVVVxT+goiAAIAAgACAARIKSLrHFuLM/okRZAY0bbAbmv6CiRMiKWZzlKgBAoKJESy2KHCc6A8CgokQAAAAAAADwP6CjokQHXBQzJqaRvKCgoSIAIACgIQMMAgtEGC1EVPsh+T8hAyABQYGAgOMDSQ0BRAdcFDMmppE8IAAgAKIiAyADIAMgAyADIANECff9DeE9Aj+iRIiyAXXg70k/oKJEO49otSiCpL+gokRVRIgOVcHJP6CiRH1v6wMS1tS/oKJEVVVVVVVVxT+goiADIAMgAyADRIKSLrHFuLM/okRZAY0bbAbmv6CiRMiKWZzlKgBAoKJESy2KHCc6A8CgokQAAAAAAADwP6CjIACioSAAoUQYLURU+yH5P6APCyACpyABQYCAwIB8anIEQEQAAAAAAAAAACAAIAChow8LRAAAAAAAAAAARBgtRFT7IQlAIAJCf1UbDwsgAwvJBAMBfwF+A3wgAL0iAkIgiKdB/////wdxIgFB//+//wNNBEACQAJ8AkAgAUGAgID/A08EQEQAAAAAAADwPyAAmaFEAAAAAAAA4D+iIgAgACAAIAAgACAARAn3/Q3hPQI/okSIsgF14O9JP6CiRDuPaLUogqS/oKJEVUSIDlXByT+gokR9b+sDEtbUv6CiRFVVVVVVVcU/oKIgACAAIAAgAESCki6xxbizP6JEWQGNG2wG5r+gokTIilmc5SoAQKCiREstihwnOgPAoKJEAAAAAAAA8D+goyEFIAAQBCEDIAFBsua8/wNLDQFEGC1EVPsh6T8gA71CgICAgHCDvyIEIASgoUQHXBQzJqaRPCAAIAQgBKKhIAMgBKCjIgAgAKChIAUgAyADoKKhoEQYLURU+yHpP6AMAgsgAUGAgEBqQYCAgPIDSQ0CIAAgAKIiAyADIAMgAyADIANECff9DeE9Aj+iRIiyAXXg70k/oKJEO49otSiCpL+gokRVRIgOVcHJP6CiRH1v6wMS1tS/oKJEVVVVVVVVxT+goiADIAMgAyADRIKSLrHFuLM/okRZAY0bbAbmv6CiRMiKWZzlKgBAoKJESy2KHCc6A8CgokQAAAAAAADwP6CjIACiIACgDwtEGC1EVPsh+T8gAyAFIAOioCIAIACgRAdcFDMmppG8oKELIgCaIAAgAkIAUxshAAsgAA8LIAKnIAFBgIDAgHxqcgRARAAAAAAAAAAAIAAgAKGjDwsgAEQYLURU+yH5P6JEAAAAAAAAcDigC48EAwJ/AX4DfCMAQRBrIQICQAJ/AkACQAJAIAC9IgNCIIinQf////8HcSIBQf//v6AETQRAIAFBgIDw/gNJDQEgAJkhACABQYCAzP8DSQ0DIAFBgICOgARJDQJEAAAAAAAA8L8gAKMhAEEDDAQLIAAgAGINBEQYLURU+yH5PyAApg8LQX8gAUGAgIDyA08NAhogAUGAgMAATw0DIAIgALY4AgwgAioCDBogAA8LIABEAAAAAAAA+L+gIABEAAAAAAAA+D+iRAAAAAAAAPA/oKMhAEECDAELIAFBgICY/wNPBEAgAEQAAAAAAADwv6AgAEQAAAAAAADwP6CjIQBBAQwBCyAAIACgRAAAAAAAAPC/oCAARAAAAAAAAABAoKMhAEEACyECIAAgAKIiBSAFoiIEIAQgBCAEIAREL2xqLES0or+iRJr93lIt3q2/oKJEbZp0r/Kws7+gokRxFiP+xnG8v6CiRMTrmJmZmcm/oKIhBiAFIAQgBCAEIAQgBEQR2iLjOq2QP6JE6w12JEt7qT+gokRRPdCgZg2xP6CiRG4gTMXNRbc/oKJE/4MAkiRJwj+gokQNVVVVVVXVP6CiIQQgAUGAgPD+A08EQCACQQN0IgFByIPAAGorAwAgACAGIASgoiABQeiDwABqKwMAoSAAoaEiAJogACADQgBTGw8LIAAgACAGIASgoqEhAAsgAAvnAwMDfwF+BnwCQAJAAkACQCAAvSIEQgBTDQAgBEIgiKciAUGAgMAASQ0AIAFB//+//wdLDQNBgIDA/wMhAkGBeCEDIAFBgIDA/wNHBEAgASECDAILIASnDQFEAAAAAAAAAAAPCyAAvUL///////////8Ag1AEQEQAAAAAAADwvyAAIACiow8LIARCAFMNASAARAAAAAAAAFBDor0iBEIgiKchAkHLdyEDCyACQeK+JWoiAUEUdiADarciB0QAYJ9QE0TTP6IiCCAEQv////8PgyABQf//P3FBnsGa/wNqrUIghoS/RAAAAAAAAPC/oCIAIAAgAEQAAAAAAADgP6KiIgWhvUKAgICAcIO/IgZEAAAgFXvL2z+iIgmgIgogCSAIIAqhoCAAIAahIAWhIAAgAEQAAAAAAAAAQKCjIgAgBSAAIACiIgUgBaIiACAAIABEn8Z40Amawz+iRK94jh3Fccw/oKJEBPqXmZmZ2T+goiAFIAAgACAARERSPt8S8cI/okTeA8uWZEbHP6CiRFmTIpQkSdI/oKJEk1VVVVVV5T+goqCgoqAiAEQAACAVe8vbP6IgB0Q2K/ER8/5ZPaIgACAGoETVrZrKOJS7PaKgoKCgDwsgACAAoUQAAAAAAAAAAKMhAAsgAAvOAwMDfwF+BXwCQAJAAkACQCAAvSIEQgBTDQAgBEIgiKciAUGAgMAASQ0AIAFB//+//wdLDQNBgIDA/wMhAkGBeCEDIAFBgIDA/wNHBEAgASECDAILIASnDQFEAAAAAAAAAAAPCyAAvUL///////////8Ag1AEQEQAAAAAAADwvyAAIACiow8LIARCAFMNASAARAAAAAAAAFBDor0iBEIgiKchAkHLdyEDCyAEQv////8PgyACQeK+JWoiAUH//z9xQZ7Bmv8Daq1CIIaEv0QAAAAAAADwv6AiACAAIABEAAAAAAAA4D+ioiIFob1CgICAgHCDvyIGRAAAIGVHFfc/oiIHIAFBFHYgA2q3IgigIgkgByAIIAmhoCAAIAahIAWhIAAgAEQAAAAAAAAAQKCjIgAgBSAAIACiIgUgBaIiACAAIABEn8Z40Amawz+iRK94jh3Fccw/oKJEBPqXmZmZ2T+goiAFIAAgACAARERSPt8S8cI/okTeA8uWZEbHP6CiRFmTIpQkSdI/oKJEk1VVVVVV5T+goqCgoqAiAEQAACBlRxX3P6IgACAGoEQAou8u/AXnPaKgoKAPCyAAIAChRAAAAAAAAAAAoyEACyAAC6UDAgV/AX4gASABYSAAIABhcUUEQCAAIAGgDwsgAb0iB0IgiKciAkGAgMCAfGogB6ciBXJFBEAgABAIDwsgAkEedkECcSIGIAC9IgdCP4inciEDAkACQAJAIAdCIIinQf////8HcSIEIAenckUEQEQYLURU+yEJwCEBAkACQCADDgMAAAEDCyAADwtEGC1EVPshCUAPCyACQf////8HcSICIAVyRQ0CAkAgAkGAgMD/B0YEQCAEQYCAwP8HRw0BRNIhM3982QLAIQEgA0EDRg0CIANBA3RB2ILAAGorAwAPCyAEQYCAwP8HRiACQYCAgCBqIARJcg0CAnwgBgRARAAAAAAAAAAAIARBgICAIGogAkkNARoLIAAgAaOZEAgLIQECQAJAAkAgAw4DBAECAAsgAUQHXBQzJqahvKBEGC1EVPshCcCgDwsgAZoPC0QYLURU+yEJQCABRAdcFDMmpqG8oKEPC0QYLURU+yEJwCEBIANBA0YNACADQQN0QfCCwABqKwMAIQELIAEPC0QYLURU+yH5PyAApg8LRBgtRFT7Ifk/IACmC54DAwN/AX4CfAJAAkACQAJAIAC9IgRCAFMNACAEQiCIpyIBQYCAwABJDQAgAUH//7//B0sNA0GAgMD/AyECQYF4IQMgAUGAgMD/A0cEQCABIQIMAgsgBKcNAUQAAAAAAAAAAA8LIAC9Qv///////////wCDUARARAAAAAAAAPC/IAAgAKKjDwsgBEIAUw0BIABEAAAAAAAAUEOivSIEQiCIpyECQct3IQMLIAJB4r4laiIBQRR2IANqtyIFRAAA4P5CLuY/oiAEQv////8PgyABQf//P3FBnsGa/wNqrUIghoS/RAAAAAAAAPC/oCIAIAVEdjx5Ne856j2iIAAgAEQAAAAAAAAAQKCjIgUgACAARAAAAAAAAOA/oqIiBiAFIAWiIgUgBaIiACAAIABEn8Z40Amawz+iRK94jh3Fccw/oKJEBPqXmZmZ2T+goiAFIAAgACAARERSPt8S8cI/okTeA8uWZEbHP6CiRFmTIpQkSdI/oKJEk1VVVVVV5T+goqCgoqAgBqGgoA8LIAAgAKFEAAAAAAAAAACjIQALIAALjgEBAn8gAUEQTwRAIABBACAAa0EDcSIDaiECIAMEQANAIABBADoAACAAQQFqIgAgAkkNAAsLIAIgASADayIBQXxxIgNqIQAgA0EBTgRAA0AgAkEANgIAIAJBBGoiAiAASQ0ACwsgAUEDcSEBCyABBEAgACABaiEBA0AgAEEAOgAAIABBAWoiACABSQ0ACwsLrAEAAkACQAJAIAFB/wdMBEAgAUGCeE4NAyAARAAAAAAAAGADoiEAIAFBuHBNDQEgAUHJB2ohAQwDCyAARAAAAAAAAOB/oiEAIAFB/g9LDQEgAUGBeGohAQwCCyAARAAAAAAAAGADoiEAIAFB8GggAUHwaEobQZIPaiEBDAELIABEAAAAAAAA4H+iIQAgAUH9FyABQf0XSBtBgnBqIQELIAAgAUH/B2qtQjSGv6ILCAAgACABEA0LCAAgACABEAsLCAAgACABEAILBgAgABAGCwYAIAAQBwsGACAAEAgLBgAgABAFCwYAIAAQDAsGACAAEAQLBgAgABADCwYAIAAQCgsGACAAEAkLC+YKBQBBgIDAAAvwAgMAAAAEAAAABAAAAAYAAACD+aIARE5uAPwpFQDRVycA3TT1AGLbwAA8mZUAQZBDAGNR/gC73qsAt2HFADpuJADSTUIASQbgAAnqLgAcktEA6x3+ACmxHADoPqcA9TWCAES7LgCc6YQAtCZwAEF+XwDWkTkAU4M5AJz0OQCLX4QAKPm9APgfOwDe/5cAD5gFABEv7wAKWosAbR9tAM9+NgAJyycARk+3AJ5mPwAt6l8Auid1AOXrxwA9e/EA9zkHAJJSigD7a+oAH7FfAAhdjQAwA1YAe/xGAPCrawAgvM8ANvSaAOOpHQBeYZEACBvmAIWZZQCgFF8AjUBoAIDY/wAnc00ABgYxAMpWFQDJqHMAe+JgAGuMwAAAAABA+yH5PwAAAAAtRHQ+AAAAgJhG+DwAAABgUcx4OwAAAICDG/A5AAAAQCAlejgAAACAIoLjNgAAAAAd82k1GC1EVPsh6T8YLURU+yHpv9IhM3982QJAAEH/gsAACymAGC1EVPshCUAAAAAAAADgPwAAAAAAAOC/AAAAAAAA8D8AAAAAAAD4PwBBsIPAAAsIBtDPQ+v9TD4AQcODwAALmQdAA7jiP0+7YQVnrN0/GC1EVPsh6T+b9oHSC3PvPxgtRFT7Ifk/4mUvIn8rejwHXBQzJqaBPL3L8HqIB3A8B1wUMyamkTxMYXp5IGluc3RhbmNlIGhhcyBwcmV2aW91c2x5IGJlZW4gcG9pc29uZWQAAAgCEAAqAAAAQzpcVXNlcnNcSm9uYXRoYW5cLmNhcmdvXHJlZ2lzdHJ5XHNyY1xpbmRleC5jcmF0ZXMuaW8tNmYxN2QyMmJiYTE1MDAxZlxvbmNlX2NlbGwtMS4yMC4yXHNyYy9saWIucnMAADwCEABiAAAACAMAABkAAAByZWVudHJhbnQgaW5pdAAAsAIQAA4AAAA8AhAAYgAAAHoCAAANAAAABAAAAAwAAAAEAAAABQAAAAYAAAAHAAAAL3J1c3QvZGVwcy9kbG1hbGxvYy0wLjIuNi9zcmMvZGxtYWxsb2MucnNhc3NlcnRpb24gZmFpbGVkOiBwc2l6ZSA+PSBzaXplICsgbWluX292ZXJoZWFkAPACEAApAAAAqAQAAAkAAABhc3NlcnRpb24gZmFpbGVkOiBwc2l6ZSA8PSBzaXplICsgbWF4X292ZXJoZWFkAADwAhAAKQAAAK4EAAANAAAAbWVtb3J5IGFsbG9jYXRpb24gb2YgIGJ5dGVzIGZhaWxlZAAAmAMQABUAAACtAxAADQAAAGxpYnJhcnkvc3RkL3NyYy9hbGxvYy5yc8wDEAAYAAAAZAEAAAkAAAAEAAAADAAAAAQAAAAIAAAAAAAAAAgAAAAEAAAACQAAAAAAAAAIAAAABAAAAAoAAAALAAAADAAAAA0AAAAOAAAAEAAAAAQAAAAPAAAAEAAAABEAAAASAAAAY2FwYWNpdHkgb3ZlcmZsb3cAAABMBBAAEQAAAGxpYnJhcnkvYWxsb2Mvc3JjL3Jhd192ZWMucnNoBBAAHAAAABkAAAAFAAAAMDAwMTAyMDMwNDA1MDYwNzA4MDkxMDExMTIxMzE0MTUxNjE3MTgxOTIwMjEyMjIzMjQyNTI2MjcyODI5MzAzMTMyMzMzNDM1MzYzNzM4Mzk0MDQxNDI0MzQ0NDU0NjQ3NDg0OTUwNTE1MjUzNTQ1NTU2NTc1ODU5NjA2MTYyNjM2NDY1NjY2NzY4Njk3MDcxNzI3Mzc0NzU3Njc3Nzg3OTgwODE4MjgzODQ4NTg2ODc4ODg5OTA5MTkyOTM5NDk1OTY5Nzk4OTkAQfSKwAALAQEAfAlwcm9kdWNlcnMCCGxhbmd1YWdlAQRSdXN0AAxwcm9jZXNzZWQtYnkDBXJ1c3RjHTEuODEuMCAoZWViOTBjZGExIDIwMjQtMDktMDQpBndhbHJ1cwYwLjIzLjMMd2FzbS1iaW5kZ2VuEzAuMi4xMDAgKDI0MDVlYzJiNCkALA90YXJnZXRfZmVhdHVyZXMCKw9tdXRhYmxlLWdsb2JhbHMrCHNpZ24tZXh0"), (e => e.charCodeAt(0))))).exports;
|
|
Math = {
|
|
E: 2.718281828459045,
|
|
LN10: 2.302585092994046,
|
|
LN2: .6931471805599453,
|
|
LOG2E: 1.4426950408889634,
|
|
LOG10E: .4342944819032518,
|
|
PI: 3.141592653589793,
|
|
SQRT1_2: .7071067811865476,
|
|
SQRT2: 1.4142135623730951,
|
|
abs: Math.abs,
|
|
acos: t.acos,
|
|
asin: t.asin,
|
|
atan: t.atan,
|
|
atan2: t.atan2,
|
|
ceil: Math.ceil,
|
|
cos: function(e) {
|
|
return Math.sin(e + Math.PI / 2)
|
|
},
|
|
exp: t.exp,
|
|
floor: Math.floor,
|
|
log: t.log,
|
|
max: Math.max,
|
|
min: Math.min,
|
|
pow: t.pow,
|
|
random: Math.random,
|
|
round: Math.round,
|
|
sin: function(e) {
|
|
if (!Number.isFinite(e)) return NaN;
|
|
const t = (e = function(e) {
|
|
return (e %= 2 * Math.PI) < 0 && (e += 2 * Math.PI), e
|
|
}(e)) / (2 * Math.PI) * n.length,
|
|
i = Math.floor(t),
|
|
r = (i + 1) % n.length,
|
|
a = t - i;
|
|
return n[i] * (1 - a) + n[r] * a
|
|
},
|
|
sqrt: t.sqrt,
|
|
tan: t.tan,
|
|
clz32: () => e("clz32"),
|
|
imul: () => e("imul"),
|
|
sign: Math.sign,
|
|
log10: t.log10,
|
|
log2: t.log2,
|
|
log1p: () => e("log1p"),
|
|
expm1: () => e("expm1"),
|
|
cosh: () => e("cosh"),
|
|
sinh: () => e("sinh"),
|
|
tanh: () => e("tanh"),
|
|
acosh: () => e("acosh"),
|
|
asinh: () => e("asinh"),
|
|
atanh: () => e("atanh"),
|
|
hypot: () => e("hypot"),
|
|
trunc: Math.trunc,
|
|
cbrt: () => e("cbrt"),
|
|
fround: Math.fround,
|
|
[Symbol.toStringTag]: "Math"
|
|
};
|
|
const n = [0, .01745240643728351, .03489949670250097, .05233595624294383, .0697564737441253, .08715574274765817, .10452846326765346, .12186934340514748, .13917310096006544, .15643446504023087, .17364817766693033, .1908089953765448, .20791169081775931, .22495105434386498, .24192189559966773, .25881904510252074, .27563735581699916, .2923717047227367, .3090169943749474, .3255681544571567, .3420201433256687, .35836794954530027, .374606593415912, .3907311284892737, .40673664307580015, .42261826174069944, .4383711467890774, .45399049973954675, .4694715627858908, .48480962024633706, .49999999999999994, .5150380749100542, .5299192642332049, .544639035015027, .5591929034707468, .573576436351046, .5877852522924731, .6018150231520483, .6156614753256583, .6293203910498375, .6427876096865393, .6560590289905073, .6691306063588582, .6819983600624985, .6946583704589973, .7071067811865475, .7193398003386511, .7313537016191705, .7431448254773942, .7547095802227719, .766044443118978, .7771459614569708, .7880107536067219, .7986355100472928, .8090169943749475, .8191520442889918, .8290375725550417, .8386705679454239, .848048096156426, .8571673007021122, .8660254037844386, .8746197071393957, .8829475928589269, .8910065241883678, .898794046299167, .9063077870366499, .9135454576426009, .9205048534524404, .9271838545667873, .9335804264972017, .9396926207859083, .9455185755993167, .9510565162951535, .9563047559630354, .9612616959383189, .9659258262890683, .9702957262759965, .9743700647852352, .9781476007338057, .981627183447664, .984807753012208, .9876883405951378, .9902680687415704, .992546151641322, .9945218953682733, .9961946980917455, .9975640502598242, .9986295347545738, .9993908270190958, .9998476951563913, 1, .9998476951563913, .9993908270190958, .9986295347545738, .9975640502598242, .9961946980917455, .9945218953682734, .9925461516413221, .9902680687415704, .9876883405951377, .984807753012208, .981627183447664, .9781476007338057, .9743700647852352, .9702957262759965, .9659258262890683, .9612616959383189, .9563047559630355, .9510565162951536, .9455185755993168, .9396926207859084, .9335804264972017, .9271838545667874, .9205048534524404, .913545457642601, .90630778703665, .8987940462991669, .8910065241883679, .8829475928589271, .8746197071393959, .8660254037844387, .8571673007021123, .8480480961564261, .8386705679454239, .8290375725550417, .819152044288992, .8090169943749475, .7986355100472927, .788010753606722, .777145961456971, .766044443118978, .7547095802227721, .7431448254773945, .7313537016191706, .7193398003386511, .7071067811865476, .6946583704589975, .6819983600624986, .669130606358858, .6560590289905073, .6427876096865395, .6293203910498374, .6156614753256584, .6018150231520486, .5877852522924732, .5735764363510459, .5591929034707469, .5446390350150273, .5299192642332049, .5150380749100544, .49999999999999994, .48480962024633717, .4694715627858907, .45399049973954686, .4383711467890777, .4226182617406995, .40673664307580004, .39073112848927377, .37460659341591224, .35836794954530066, .3420201433256689, .3255681544571566, .3090169943749475, .29237170472273705, .2756373558169992, .258819045102521, .24192189559966773, .2249510543438652, .20791169081775931, .19080899537654497, .1736481776669307, .15643446504023098, .13917310096006533, .12186934340514755, .10452846326765373, .0871557427476582, .06975647374412552, .05233595624294425, .03489949670250114, .01745240643728344, 12246467991473532e-32, -.017452406437283192, -.0348994967025009, -.052335956242943564, -.06975647374412483, -.08715574274765794, -.1045284632676535, -.12186934340514774, -.13917310096006552, -.15643446504023073, -.17364817766693047, -.19080899537654472, -.20791169081775907, -.22495105434386498, -.2419218955996675, -.25881904510252035, -.2756373558169986, -.29237170472273677, -.30901699437494773, -.32556815445715676, -.34202014332566866, -.35836794954530043, -.374606593415912, -.39073112848927355, -.4067366430757998, -.4226182617406993, -.43837114678907707, -.45399049973954625, -.4694715627858905, -.48480962024633734, -.5000000000000001, -.5150380749100542, -.5299192642332048, -.5446390350150271, -.5591929034707467, -.5735764363510458, -.587785252292473, -.601815023152048, -.6156614753256578, -.6293203910498372, -.6427876096865393, -.6560590289905074, -.6691306063588582, -.6819983600624984, -.6946583704589974, -.7071067811865475, -.7193398003386509, -.7313537016191705, -.743144825477394, -.7547095802227717, -.7660444431189779, -.7771459614569711, -.7880107536067221, -.7986355100472928, -.8090169943749473, -.8191520442889916, -.8290375725550414, -.838670567945424, -.848048096156426, -.8571673007021121, -.8660254037844384, -.8746197071393955, -.882947592858927, -.8910065241883678, -.8987940462991668, -.90630778703665, -.913545457642601, -.9205048534524403, -.9271838545667873, -.9335804264972016, -.9396926207859082, -.9455185755993168, -.9510565162951535, -.9563047559630353, -.961261695938319, -.9659258262890683, -.9702957262759965, -.9743700647852351, -.9781476007338056, -.981627183447664, -.984807753012208, -.9876883405951377, -.9902680687415703, -.992546151641322, -.9945218953682733, -.9961946980917455, -.9975640502598242, -.9986295347545739, -.9993908270190958, -.9998476951563913, -1, -.9998476951563913, -.9993908270190958, -.9986295347545739, -.9975640502598243, -.9961946980917455, -.9945218953682733, -.992546151641322, -.9902680687415704, -.9876883405951378, -.9848077530122081, -.9816271834476641, -.9781476007338056, -.9743700647852352, -.9702957262759966, -.9659258262890684, -.961261695938319, -.9563047559630354, -.9510565162951536, -.945518575599317, -.9396926207859083, -.9335804264972017, -.9271838545667874, -.9205048534524405, -.9135454576426011, -.9063077870366503, -.898794046299167, -.8910065241883679, -.8829475928589271, -.8746197071393956, -.8660254037844386, -.8571673007021123, -.8480480961564262, -.8386705679454243, -.8290375725550416, -.8191520442889918, -.8090169943749476, -.798635510047293, -.7880107536067223, -.7771459614569713, -.7660444431189781, -.7547095802227722, -.743144825477394, -.7313537016191703, -.7193398003386512, -.7071067811865477, -.6946583704589976, -.6819983600624989, -.6691306063588588, -.6560590289905074, -.6427876096865396, -.6293203910498372, -.6156614753256582, -.6018150231520483, -.5877852522924734, -.5735764363510465, -.5591929034707473, -.544639035015027, -.529919264233205, -.5150380749100545, -.5000000000000004, -.48480962024633767, -.4694715627858908, -.45399049973954697, -.4383711467890778, -.4226182617406992, -.40673664307580015, -.3907311284892739, -.37460659341591235, -.35836794954530077, -.34202014332566943, -.3255681544571567, -.3090169943749477, -.29237170472273716, -.27563735581699894, -.2588190451025207, -.24192189559966787, -.22495105434386534, -.20791169081775987, -.19080899537654467, -.1736481776669304, -.15643446504023112, -.13917310096006588, -.12186934340514811, -.1045284632676543, -.08715574274765832, -.06975647374412564, -.05233595624294348, -.034899496702500823, -.01745240643728356]
|
|
}
|
|
},
|
|
t = {};
|
|
|
|
function n(i) {
|
|
var r = t[i];
|
|
if (void 0 !== r) return r.exports;
|
|
var a = t[i] = {
|
|
exports: {}
|
|
};
|
|
return e[i](a, a.exports, n), a.exports
|
|
}
|
|
n.amdO = {}, n.g = function() {
|
|
if ("object" == typeof globalThis) return globalThis;
|
|
try {
|
|
return this || new Function("return this")()
|
|
} catch (e) {
|
|
if ("object" == typeof window) return window
|
|
}
|
|
}(), (() => {
|
|
"use strict";
|
|
n(6925);
|
|
/**
|
|
* @license
|
|
* Copyright 2010-2025 Three.js Authors
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
const e = "174",
|
|
t = 0,
|
|
i = 1,
|
|
r = 2,
|
|
a = 100,
|
|
s = 101,
|
|
o = 102,
|
|
l = 200,
|
|
c = 201,
|
|
h = 202,
|
|
u = 203,
|
|
d = 204,
|
|
f = 205,
|
|
p = 206,
|
|
m = 207,
|
|
g = 208,
|
|
A = 209,
|
|
_ = 210,
|
|
v = 211,
|
|
w = 212,
|
|
y = 213,
|
|
x = 214,
|
|
b = 0,
|
|
E = 1,
|
|
S = 2,
|
|
M = 3,
|
|
T = 4,
|
|
C = 5,
|
|
I = 6,
|
|
R = 7,
|
|
P = "attached",
|
|
B = 301,
|
|
D = 302,
|
|
L = 303,
|
|
U = 304,
|
|
k = 306,
|
|
N = 1e3,
|
|
F = 1001,
|
|
O = 1002,
|
|
z = 1003,
|
|
W = 1004,
|
|
H = 1005,
|
|
V = 1006,
|
|
G = 1007,
|
|
Q = 1008,
|
|
X = 1009,
|
|
j = 1010,
|
|
q = 1011,
|
|
Y = 1012,
|
|
K = 1013,
|
|
Z = 1014,
|
|
J = 1015,
|
|
$ = 1016,
|
|
ee = 1017,
|
|
te = 1018,
|
|
ne = 1020,
|
|
ie = 35902,
|
|
re = 1023,
|
|
ae = 1026,
|
|
se = 1027,
|
|
oe = 1028,
|
|
le = 1029,
|
|
ce = 1031,
|
|
he = 1033,
|
|
ue = 33776,
|
|
de = 33777,
|
|
fe = 33778,
|
|
pe = 33779,
|
|
me = 35840,
|
|
ge = 35841,
|
|
Ae = 35842,
|
|
_e = 35843,
|
|
ve = 36196,
|
|
we = 37492,
|
|
ye = 37496,
|
|
xe = 37808,
|
|
be = 37809,
|
|
Ee = 37810,
|
|
Se = 37811,
|
|
Me = 37812,
|
|
Te = 37813,
|
|
Ce = 37814,
|
|
Ie = 37815,
|
|
Re = 37816,
|
|
Pe = 37817,
|
|
Be = 37818,
|
|
De = 37819,
|
|
Le = 37820,
|
|
Ue = 37821,
|
|
ke = 36492,
|
|
Ne = 36494,
|
|
Fe = 36495,
|
|
Oe = 36284,
|
|
ze = 36285,
|
|
We = 36286,
|
|
He = 2300,
|
|
Ve = 2301,
|
|
Ge = 2302,
|
|
Qe = 2400,
|
|
Xe = 2401,
|
|
je = 2402,
|
|
qe = "",
|
|
Ye = "srgb",
|
|
Ke = "srgb-linear",
|
|
Ze = "linear",
|
|
Je = "srgb",
|
|
$e = 7680,
|
|
et = 512,
|
|
tt = 513,
|
|
nt = 514,
|
|
it = 515,
|
|
rt = 516,
|
|
at = 517,
|
|
st = 518,
|
|
ot = 519,
|
|
lt = 35044,
|
|
ct = "300 es",
|
|
ht = 2e3,
|
|
ut = 2001;
|
|
class dt {
|
|
addEventListener(e, t) {
|
|
void 0 === this._listeners && (this._listeners = {});
|
|
const n = this._listeners;
|
|
void 0 === n[e] && (n[e] = []), -1 === n[e].indexOf(t) && n[e].push(t)
|
|
}
|
|
hasEventListener(e, t) {
|
|
const n = this._listeners;
|
|
return void 0 !== n && (void 0 !== n[e] && -1 !== n[e].indexOf(t))
|
|
}
|
|
removeEventListener(e, t) {
|
|
const n = this._listeners;
|
|
if (void 0 === n) return;
|
|
const i = n[e];
|
|
if (void 0 !== i) {
|
|
const e = i.indexOf(t); - 1 !== e && i.splice(e, 1)
|
|
}
|
|
}
|
|
dispatchEvent(e) {
|
|
const t = this._listeners;
|
|
if (void 0 === t) return;
|
|
const n = t[e.type];
|
|
if (void 0 !== n) {
|
|
e.target = this;
|
|
const t = n.slice(0);
|
|
for (let n = 0, i = t.length; n < i; n++) t[n].call(this, e);
|
|
e.target = null
|
|
}
|
|
}
|
|
}
|
|
const ft = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "da", "db", "dc", "dd", "de", "df", "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff"];
|
|
let pt = 1234567;
|
|
const mt = Math.PI / 180,
|
|
gt = 180 / Math.PI;
|
|
|
|
function At() {
|
|
const e = 4294967295 * Math.random() | 0,
|
|
t = 4294967295 * Math.random() | 0,
|
|
n = 4294967295 * Math.random() | 0,
|
|
i = 4294967295 * Math.random() | 0;
|
|
return (ft[255 & e] + ft[e >> 8 & 255] + ft[e >> 16 & 255] + ft[e >> 24 & 255] + "-" + ft[255 & t] + ft[t >> 8 & 255] + "-" + ft[t >> 16 & 15 | 64] + ft[t >> 24 & 255] + "-" + ft[63 & n | 128] + ft[n >> 8 & 255] + "-" + ft[n >> 16 & 255] + ft[n >> 24 & 255] + ft[255 & i] + ft[i >> 8 & 255] + ft[i >> 16 & 255] + ft[i >> 24 & 255]).toLowerCase()
|
|
}
|
|
|
|
function _t(e, t, n) {
|
|
return Math.max(t, Math.min(n, e))
|
|
}
|
|
|
|
function vt(e, t) {
|
|
return (e % t + t) % t
|
|
}
|
|
|
|
function wt(e, t, n) {
|
|
return (1 - n) * e + n * t
|
|
}
|
|
|
|
function yt(e, t) {
|
|
switch (t.constructor) {
|
|
case Float32Array:
|
|
return e;
|
|
case Uint32Array:
|
|
return e / 4294967295;
|
|
case Uint16Array:
|
|
return e / 65535;
|
|
case Uint8Array:
|
|
return e / 255;
|
|
case Int32Array:
|
|
return Math.max(e / 2147483647, -1);
|
|
case Int16Array:
|
|
return Math.max(e / 32767, -1);
|
|
case Int8Array:
|
|
return Math.max(e / 127, -1);
|
|
default:
|
|
throw new Error("Invalid component type.")
|
|
}
|
|
}
|
|
|
|
function xt(e, t) {
|
|
switch (t.constructor) {
|
|
case Float32Array:
|
|
return e;
|
|
case Uint32Array:
|
|
return Math.round(4294967295 * e);
|
|
case Uint16Array:
|
|
return Math.round(65535 * e);
|
|
case Uint8Array:
|
|
return Math.round(255 * e);
|
|
case Int32Array:
|
|
return Math.round(2147483647 * e);
|
|
case Int16Array:
|
|
return Math.round(32767 * e);
|
|
case Int8Array:
|
|
return Math.round(127 * e);
|
|
default:
|
|
throw new Error("Invalid component type.")
|
|
}
|
|
}
|
|
const bt = {
|
|
DEG2RAD: mt,
|
|
RAD2DEG: gt,
|
|
generateUUID: At,
|
|
clamp: _t,
|
|
euclideanModulo: vt,
|
|
mapLinear: function(e, t, n, i, r) {
|
|
return i + (e - t) * (r - i) / (n - t)
|
|
},
|
|
inverseLerp: function(e, t, n) {
|
|
return e !== t ? (n - e) / (t - e) : 0
|
|
},
|
|
lerp: wt,
|
|
damp: function(e, t, n, i) {
|
|
return wt(e, t, 1 - Math.exp(-n * i))
|
|
},
|
|
pingpong: function(e, t = 1) {
|
|
return t - Math.abs(vt(e, 2 * t) - t)
|
|
},
|
|
smoothstep: function(e, t, n) {
|
|
return e <= t ? 0 : e >= n ? 1 : (e = (e - t) / (n - t)) * e * (3 - 2 * e)
|
|
},
|
|
smootherstep: function(e, t, n) {
|
|
return e <= t ? 0 : e >= n ? 1 : (e = (e - t) / (n - t)) * e * e * (e * (6 * e - 15) + 10)
|
|
},
|
|
randInt: function(e, t) {
|
|
return e + Math.floor(Math.random() * (t - e + 1))
|
|
},
|
|
randFloat: function(e, t) {
|
|
return e + Math.random() * (t - e)
|
|
},
|
|
randFloatSpread: function(e) {
|
|
return e * (.5 - Math.random())
|
|
},
|
|
seededRandom: function(e) {
|
|
void 0 !== e && (pt = e);
|
|
let t = pt += 1831565813;
|
|
return t = Math.imul(t ^ t >>> 15, 1 | t), t ^= t + Math.imul(t ^ t >>> 7, 61 | t), ((t ^ t >>> 14) >>> 0) / 4294967296
|
|
},
|
|
degToRad: function(e) {
|
|
return e * mt
|
|
},
|
|
radToDeg: function(e) {
|
|
return e * gt
|
|
},
|
|
isPowerOfTwo: function(e) {
|
|
return !(e & e - 1) && 0 !== e
|
|
},
|
|
ceilPowerOfTwo: function(e) {
|
|
return Math.pow(2, Math.ceil(Math.log(e) / Math.LN2))
|
|
},
|
|
floorPowerOfTwo: function(e) {
|
|
return Math.pow(2, Math.floor(Math.log(e) / Math.LN2))
|
|
},
|
|
setQuaternionFromProperEuler: function(e, t, n, i, r) {
|
|
const a = Math.cos,
|
|
s = Math.sin,
|
|
o = a(n / 2),
|
|
l = s(n / 2),
|
|
c = a((t + i) / 2),
|
|
h = s((t + i) / 2),
|
|
u = a((t - i) / 2),
|
|
d = s((t - i) / 2),
|
|
f = a((i - t) / 2),
|
|
p = s((i - t) / 2);
|
|
switch (r) {
|
|
case "XYX":
|
|
e.set(o * h, l * u, l * d, o * c);
|
|
break;
|
|
case "YZY":
|
|
e.set(l * d, o * h, l * u, o * c);
|
|
break;
|
|
case "ZXZ":
|
|
e.set(l * u, l * d, o * h, o * c);
|
|
break;
|
|
case "XZX":
|
|
e.set(o * h, l * p, l * f, o * c);
|
|
break;
|
|
case "YXY":
|
|
e.set(l * f, o * h, l * p, o * c);
|
|
break;
|
|
case "ZYZ":
|
|
e.set(l * p, l * f, o * h, o * c);
|
|
break;
|
|
default:
|
|
console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: " + r)
|
|
}
|
|
},
|
|
normalize: xt,
|
|
denormalize: yt
|
|
};
|
|
class Et {
|
|
constructor(e = 0, t = 0) {
|
|
Et.prototype.isVector2 = !0, this.x = e, this.y = t
|
|
}
|
|
get width() {
|
|
return this.x
|
|
}
|
|
set width(e) {
|
|
this.x = e
|
|
}
|
|
get height() {
|
|
return this.y
|
|
}
|
|
set height(e) {
|
|
this.y = e
|
|
}
|
|
set(e, t) {
|
|
return this.x = e, this.y = t, this
|
|
}
|
|
setScalar(e) {
|
|
return this.x = e, this.y = e, this
|
|
}
|
|
setX(e) {
|
|
return this.x = e, this
|
|
}
|
|
setY(e) {
|
|
return this.y = e, this
|
|
}
|
|
setComponent(e, t) {
|
|
switch (e) {
|
|
case 0:
|
|
this.x = t;
|
|
break;
|
|
case 1:
|
|
this.y = t;
|
|
break;
|
|
default:
|
|
throw new Error("index is out of range: " + e)
|
|
}
|
|
return this
|
|
}
|
|
getComponent(e) {
|
|
switch (e) {
|
|
case 0:
|
|
return this.x;
|
|
case 1:
|
|
return this.y;
|
|
default:
|
|
throw new Error("index is out of range: " + e)
|
|
}
|
|
}
|
|
clone() {
|
|
return new this.constructor(this.x, this.y)
|
|
}
|
|
copy(e) {
|
|
return this.x = e.x, this.y = e.y, this
|
|
}
|
|
add(e) {
|
|
return this.x += e.x, this.y += e.y, this
|
|
}
|
|
addScalar(e) {
|
|
return this.x += e, this.y += e, this
|
|
}
|
|
addVectors(e, t) {
|
|
return this.x = e.x + t.x, this.y = e.y + t.y, this
|
|
}
|
|
addScaledVector(e, t) {
|
|
return this.x += e.x * t, this.y += e.y * t, this
|
|
}
|
|
sub(e) {
|
|
return this.x -= e.x, this.y -= e.y, this
|
|
}
|
|
subScalar(e) {
|
|
return this.x -= e, this.y -= e, this
|
|
}
|
|
subVectors(e, t) {
|
|
return this.x = e.x - t.x, this.y = e.y - t.y, this
|
|
}
|
|
multiply(e) {
|
|
return this.x *= e.x, this.y *= e.y, this
|
|
}
|
|
multiplyScalar(e) {
|
|
return this.x *= e, this.y *= e, this
|
|
}
|
|
divide(e) {
|
|
return this.x /= e.x, this.y /= e.y, this
|
|
}
|
|
divideScalar(e) {
|
|
return this.multiplyScalar(1 / e)
|
|
}
|
|
applyMatrix3(e) {
|
|
const t = this.x,
|
|
n = this.y,
|
|
i = e.elements;
|
|
return this.x = i[0] * t + i[3] * n + i[6], this.y = i[1] * t + i[4] * n + i[7], this
|
|
}
|
|
min(e) {
|
|
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this
|
|
}
|
|
max(e) {
|
|
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this
|
|
}
|
|
clamp(e, t) {
|
|
return this.x = _t(this.x, e.x, t.x), this.y = _t(this.y, e.y, t.y), this
|
|
}
|
|
clampScalar(e, t) {
|
|
return this.x = _t(this.x, e, t), this.y = _t(this.y, e, t), this
|
|
}
|
|
clampLength(e, t) {
|
|
const n = this.length();
|
|
return this.divideScalar(n || 1).multiplyScalar(_t(n, e, t))
|
|
}
|
|
floor() {
|
|
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this
|
|
}
|
|
ceil() {
|
|
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this
|
|
}
|
|
round() {
|
|
return this.x = Math.round(this.x), this.y = Math.round(this.y), this
|
|
}
|
|
roundToZero() {
|
|
return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this
|
|
}
|
|
negate() {
|
|
return this.x = -this.x, this.y = -this.y, this
|
|
}
|
|
dot(e) {
|
|
return this.x * e.x + this.y * e.y
|
|
}
|
|
cross(e) {
|
|
return this.x * e.y - this.y * e.x
|
|
}
|
|
lengthSq() {
|
|
return this.x * this.x + this.y * this.y
|
|
}
|
|
length() {
|
|
return Math.sqrt(this.x * this.x + this.y * this.y)
|
|
}
|
|
manhattanLength() {
|
|
return Math.abs(this.x) + Math.abs(this.y)
|
|
}
|
|
normalize() {
|
|
return this.divideScalar(this.length() || 1)
|
|
}
|
|
angle() {
|
|
return Math.atan2(-this.y, -this.x) + Math.PI
|
|
}
|
|
angleTo(e) {
|
|
const t = Math.sqrt(this.lengthSq() * e.lengthSq());
|
|
if (0 === t) return Math.PI / 2;
|
|
const n = this.dot(e) / t;
|
|
return Math.acos(_t(n, -1, 1))
|
|
}
|
|
distanceTo(e) {
|
|
return Math.sqrt(this.distanceToSquared(e))
|
|
}
|
|
distanceToSquared(e) {
|
|
const t = this.x - e.x,
|
|
n = this.y - e.y;
|
|
return t * t + n * n
|
|
}
|
|
manhattanDistanceTo(e) {
|
|
return Math.abs(this.x - e.x) + Math.abs(this.y - e.y)
|
|
}
|
|
setLength(e) {
|
|
return this.normalize().multiplyScalar(e)
|
|
}
|
|
lerp(e, t) {
|
|
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this
|
|
}
|
|
lerpVectors(e, t, n) {
|
|
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this
|
|
}
|
|
equals(e) {
|
|
return e.x === this.x && e.y === this.y
|
|
}
|
|
fromArray(e, t = 0) {
|
|
return this.x = e[t], this.y = e[t + 1], this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
return e[t] = this.x, e[t + 1] = this.y, e
|
|
}
|
|
fromBufferAttribute(e, t) {
|
|
return this.x = e.getX(t), this.y = e.getY(t), this
|
|
}
|
|
rotateAround(e, t) {
|
|
const n = Math.cos(t),
|
|
i = Math.sin(t),
|
|
r = this.x - e.x,
|
|
a = this.y - e.y;
|
|
return this.x = r * n - a * i + e.x, this.y = r * i + a * n + e.y, this
|
|
}
|
|
random() {
|
|
return this.x = Math.random(), this.y = Math.random(), this
|
|
}*[Symbol.iterator]() {
|
|
yield this.x, yield this.y
|
|
}
|
|
}
|
|
class St {
|
|
constructor(e, t, n, i, r, a, s, o, l) {
|
|
St.prototype.isMatrix3 = !0, this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], void 0 !== e && this.set(e, t, n, i, r, a, s, o, l)
|
|
}
|
|
set(e, t, n, i, r, a, s, o, l) {
|
|
const c = this.elements;
|
|
return c[0] = e, c[1] = i, c[2] = s, c[3] = t, c[4] = r, c[5] = o, c[6] = n, c[7] = a, c[8] = l, this
|
|
}
|
|
identity() {
|
|
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this
|
|
}
|
|
copy(e) {
|
|
const t = this.elements,
|
|
n = e.elements;
|
|
return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], this
|
|
}
|
|
extractBasis(e, t, n) {
|
|
return e.setFromMatrix3Column(this, 0), t.setFromMatrix3Column(this, 1), n.setFromMatrix3Column(this, 2), this
|
|
}
|
|
setFromMatrix4(e) {
|
|
const t = e.elements;
|
|
return this.set(t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10]), this
|
|
}
|
|
multiply(e) {
|
|
return this.multiplyMatrices(this, e)
|
|
}
|
|
premultiply(e) {
|
|
return this.multiplyMatrices(e, this)
|
|
}
|
|
multiplyMatrices(e, t) {
|
|
const n = e.elements,
|
|
i = t.elements,
|
|
r = this.elements,
|
|
a = n[0],
|
|
s = n[3],
|
|
o = n[6],
|
|
l = n[1],
|
|
c = n[4],
|
|
h = n[7],
|
|
u = n[2],
|
|
d = n[5],
|
|
f = n[8],
|
|
p = i[0],
|
|
m = i[3],
|
|
g = i[6],
|
|
A = i[1],
|
|
_ = i[4],
|
|
v = i[7],
|
|
w = i[2],
|
|
y = i[5],
|
|
x = i[8];
|
|
return r[0] = a * p + s * A + o * w, r[3] = a * m + s * _ + o * y, r[6] = a * g + s * v + o * x, r[1] = l * p + c * A + h * w, r[4] = l * m + c * _ + h * y, r[7] = l * g + c * v + h * x, r[2] = u * p + d * A + f * w, r[5] = u * m + d * _ + f * y, r[8] = u * g + d * v + f * x, this
|
|
}
|
|
multiplyScalar(e) {
|
|
const t = this.elements;
|
|
return t[0] *= e, t[3] *= e, t[6] *= e, t[1] *= e, t[4] *= e, t[7] *= e, t[2] *= e, t[5] *= e, t[8] *= e, this
|
|
}
|
|
determinant() {
|
|
const e = this.elements,
|
|
t = e[0],
|
|
n = e[1],
|
|
i = e[2],
|
|
r = e[3],
|
|
a = e[4],
|
|
s = e[5],
|
|
o = e[6],
|
|
l = e[7],
|
|
c = e[8];
|
|
return t * a * c - t * s * l - n * r * c + n * s * o + i * r * l - i * a * o
|
|
}
|
|
invert() {
|
|
const e = this.elements,
|
|
t = e[0],
|
|
n = e[1],
|
|
i = e[2],
|
|
r = e[3],
|
|
a = e[4],
|
|
s = e[5],
|
|
o = e[6],
|
|
l = e[7],
|
|
c = e[8],
|
|
h = c * a - s * l,
|
|
u = s * o - c * r,
|
|
d = l * r - a * o,
|
|
f = t * h + n * u + i * d;
|
|
if (0 === f) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
const p = 1 / f;
|
|
return e[0] = h * p, e[1] = (i * l - c * n) * p, e[2] = (s * n - i * a) * p, e[3] = u * p, e[4] = (c * t - i * o) * p, e[5] = (i * r - s * t) * p, e[6] = d * p, e[7] = (n * o - l * t) * p, e[8] = (a * t - n * r) * p, this
|
|
}
|
|
transpose() {
|
|
let e;
|
|
const t = this.elements;
|
|
return e = t[1], t[1] = t[3], t[3] = e, e = t[2], t[2] = t[6], t[6] = e, e = t[5], t[5] = t[7], t[7] = e, this
|
|
}
|
|
getNormalMatrix(e) {
|
|
return this.setFromMatrix4(e).invert().transpose()
|
|
}
|
|
transposeIntoArray(e) {
|
|
const t = this.elements;
|
|
return e[0] = t[0], e[1] = t[3], e[2] = t[6], e[3] = t[1], e[4] = t[4], e[5] = t[7], e[6] = t[2], e[7] = t[5], e[8] = t[8], this
|
|
}
|
|
setUvTransform(e, t, n, i, r, a, s) {
|
|
const o = Math.cos(r),
|
|
l = Math.sin(r);
|
|
return this.set(n * o, n * l, -n * (o * a + l * s) + a + e, -i * l, i * o, -i * (-l * a + o * s) + s + t, 0, 0, 1), this
|
|
}
|
|
scale(e, t) {
|
|
return this.premultiply(Mt.makeScale(e, t)), this
|
|
}
|
|
rotate(e) {
|
|
return this.premultiply(Mt.makeRotation(-e)), this
|
|
}
|
|
translate(e, t) {
|
|
return this.premultiply(Mt.makeTranslation(e, t)), this
|
|
}
|
|
makeTranslation(e, t) {
|
|
return e.isVector2 ? this.set(1, 0, e.x, 0, 1, e.y, 0, 0, 1) : this.set(1, 0, e, 0, 1, t, 0, 0, 1), this
|
|
}
|
|
makeRotation(e) {
|
|
const t = Math.cos(e),
|
|
n = Math.sin(e);
|
|
return this.set(t, -n, 0, n, t, 0, 0, 0, 1), this
|
|
}
|
|
makeScale(e, t) {
|
|
return this.set(e, 0, 0, 0, t, 0, 0, 0, 1), this
|
|
}
|
|
equals(e) {
|
|
const t = this.elements,
|
|
n = e.elements;
|
|
for (let e = 0; e < 9; e++)
|
|
if (t[e] !== n[e]) return !1;
|
|
return !0
|
|
}
|
|
fromArray(e, t = 0) {
|
|
for (let n = 0; n < 9; n++) this.elements[n] = e[n + t];
|
|
return this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
const n = this.elements;
|
|
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e
|
|
}
|
|
clone() {
|
|
return (new this.constructor).fromArray(this.elements)
|
|
}
|
|
}
|
|
const Mt = new St;
|
|
|
|
function Tt(e) {
|
|
for (let t = e.length - 1; t >= 0; --t)
|
|
if (e[t] >= 65535) return !0;
|
|
return !1
|
|
}
|
|
Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array;
|
|
|
|
function Ct(e) {
|
|
return document.createElementNS("http://www.w3.org/1999/xhtml", e)
|
|
}
|
|
|
|
function It() {
|
|
const e = Ct("canvas");
|
|
return e.style.display = "block", e
|
|
}
|
|
const Rt = {};
|
|
|
|
function Pt(e) {
|
|
e in Rt || (Rt[e] = !0, console.warn(e))
|
|
}
|
|
const Bt = (new St).set(.4123908, .3575843, .1804808, .212639, .7151687, .0721923, .0193308, .1191948, .9505322),
|
|
Dt = (new St).set(3.2409699, -1.5373832, -.4986108, -.9692436, 1.8759675, .0415551, .0556301, -.203977, 1.0569715);
|
|
|
|
function Lt() {
|
|
const e = {
|
|
enabled: !0,
|
|
workingColorSpace: Ke,
|
|
spaces: {},
|
|
convert: function(e, t, n) {
|
|
return !1 !== this.enabled && t !== n && t && n ? (this.spaces[t].transfer === Je && (e.r = kt(e.r), e.g = kt(e.g), e.b = kt(e.b)), this.spaces[t].primaries !== this.spaces[n].primaries && (e.applyMatrix3(this.spaces[t].toXYZ), e.applyMatrix3(this.spaces[n].fromXYZ)), this.spaces[n].transfer === Je && (e.r = Nt(e.r), e.g = Nt(e.g), e.b = Nt(e.b)), e) : e
|
|
},
|
|
fromWorkingColorSpace: function(e, t) {
|
|
return this.convert(e, this.workingColorSpace, t)
|
|
},
|
|
toWorkingColorSpace: function(e, t) {
|
|
return this.convert(e, t, this.workingColorSpace)
|
|
},
|
|
getPrimaries: function(e) {
|
|
return this.spaces[e].primaries
|
|
},
|
|
getTransfer: function(e) {
|
|
return e === qe ? Ze : this.spaces[e].transfer
|
|
},
|
|
getLuminanceCoefficients: function(e, t = this.workingColorSpace) {
|
|
return e.fromArray(this.spaces[t].luminanceCoefficients)
|
|
},
|
|
define: function(e) {
|
|
Object.assign(this.spaces, e)
|
|
},
|
|
_getMatrix: function(e, t, n) {
|
|
return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)
|
|
},
|
|
_getDrawingBufferColorSpace: function(e) {
|
|
return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace
|
|
},
|
|
_getUnpackColorSpace: function(e = this.workingColorSpace) {
|
|
return this.spaces[e].workingColorSpaceConfig.unpackColorSpace
|
|
}
|
|
},
|
|
t = [.64, .33, .3, .6, .15, .06],
|
|
n = [.2126, .7152, .0722],
|
|
i = [.3127, .329];
|
|
return e.define({
|
|
[Ke]: {
|
|
primaries: t,
|
|
whitePoint: i,
|
|
transfer: Ze,
|
|
toXYZ: Bt,
|
|
fromXYZ: Dt,
|
|
luminanceCoefficients: n,
|
|
workingColorSpaceConfig: {
|
|
unpackColorSpace: Ye
|
|
},
|
|
outputColorSpaceConfig: {
|
|
drawingBufferColorSpace: Ye
|
|
}
|
|
},
|
|
[Ye]: {
|
|
primaries: t,
|
|
whitePoint: i,
|
|
transfer: Je,
|
|
toXYZ: Bt,
|
|
fromXYZ: Dt,
|
|
luminanceCoefficients: n,
|
|
outputColorSpaceConfig: {
|
|
drawingBufferColorSpace: Ye
|
|
}
|
|
}
|
|
}), e
|
|
}
|
|
const Ut = Lt();
|
|
|
|
function kt(e) {
|
|
return e < .04045 ? .0773993808 * e : Math.pow(.9478672986 * e + .0521327014, 2.4)
|
|
}
|
|
|
|
function Nt(e) {
|
|
return e < .0031308 ? 12.92 * e : 1.055 * Math.pow(e, .41666) - .055
|
|
}
|
|
let Ft;
|
|
class Ot {
|
|
static getDataURL(e) {
|
|
if (/^data:/i.test(e.src)) return e.src;
|
|
if ("undefined" == typeof HTMLCanvasElement) return e.src;
|
|
let t;
|
|
if (e instanceof HTMLCanvasElement) t = e;
|
|
else {
|
|
void 0 === Ft && (Ft = Ct("canvas")), Ft.width = e.width, Ft.height = e.height;
|
|
const n = Ft.getContext("2d");
|
|
e instanceof ImageData ? n.putImageData(e, 0, 0) : n.drawImage(e, 0, 0, e.width, e.height), t = Ft
|
|
}
|
|
return t.toDataURL("image/png")
|
|
}
|
|
static sRGBToLinear(e) {
|
|
if ("undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && e instanceof ImageBitmap) {
|
|
const t = Ct("canvas");
|
|
t.width = e.width, t.height = e.height;
|
|
const n = t.getContext("2d");
|
|
n.drawImage(e, 0, 0, e.width, e.height);
|
|
const i = n.getImageData(0, 0, e.width, e.height),
|
|
r = i.data;
|
|
for (let e = 0; e < r.length; e++) r[e] = 255 * kt(r[e] / 255);
|
|
return n.putImageData(i, 0, 0), t
|
|
}
|
|
if (e.data) {
|
|
const t = e.data.slice(0);
|
|
for (let e = 0; e < t.length; e++) t instanceof Uint8Array || t instanceof Uint8ClampedArray ? t[e] = Math.floor(255 * kt(t[e] / 255)) : t[e] = kt(t[e]);
|
|
return {
|
|
data: t,
|
|
width: e.width,
|
|
height: e.height
|
|
}
|
|
}
|
|
return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."), e
|
|
}
|
|
}
|
|
let zt = 0;
|
|
class Wt {
|
|
constructor(e = null) {
|
|
this.isSource = !0, Object.defineProperty(this, "id", {
|
|
value: zt++
|
|
}), this.uuid = At(), this.data = e, this.dataReady = !0, this.version = 0
|
|
}
|
|
set needsUpdate(e) {
|
|
!0 === e && this.version++
|
|
}
|
|
toJSON(e) {
|
|
const t = void 0 === e || "string" == typeof e;
|
|
if (!t && void 0 !== e.images[this.uuid]) return e.images[this.uuid];
|
|
const n = {
|
|
uuid: this.uuid,
|
|
url: ""
|
|
},
|
|
i = this.data;
|
|
if (null !== i) {
|
|
let e;
|
|
if (Array.isArray(i)) {
|
|
e = [];
|
|
for (let t = 0, n = i.length; t < n; t++) i[t].isDataTexture ? e.push(Ht(i[t].image)) : e.push(Ht(i[t]))
|
|
} else e = Ht(i);
|
|
n.url = e
|
|
}
|
|
return t || (e.images[this.uuid] = n), n
|
|
}
|
|
}
|
|
|
|
function Ht(e) {
|
|
return "undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && e instanceof ImageBitmap ? Ot.getDataURL(e) : e.data ? {
|
|
data: Array.from(e.data),
|
|
width: e.width,
|
|
height: e.height,
|
|
type: e.data.constructor.name
|
|
} : (console.warn("THREE.Texture: Unable to serialize Texture."), {})
|
|
}
|
|
let Vt = 0;
|
|
class Gt extends dt {
|
|
constructor(e = Gt.DEFAULT_IMAGE, t = Gt.DEFAULT_MAPPING, n = 1001, i = 1001, r = 1006, a = 1008, s = 1023, o = 1009, l = Gt.DEFAULT_ANISOTROPY, c = "") {
|
|
super(), this.isTexture = !0, Object.defineProperty(this, "id", {
|
|
value: Vt++
|
|
}), this.uuid = At(), this.name = "", this.source = new Wt(e), this.mipmaps = [], this.mapping = t, this.channel = 0, this.wrapS = n, this.wrapT = i, this.magFilter = r, this.minFilter = a, this.anisotropy = l, this.format = s, this.internalFormat = null, this.type = o, this.offset = new Et(0, 0), this.repeat = new Et(1, 1), this.center = new Et(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new St, this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.colorSpace = c, this.userData = {}, this.version = 0, this.onUpdate = null, this.renderTarget = null, this.isRenderTargetTexture = !1, this.pmremVersion = 0
|
|
}
|
|
get image() {
|
|
return this.source.data
|
|
}
|
|
set image(e = null) {
|
|
this.source.data = e
|
|
}
|
|
updateMatrix() {
|
|
this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y)
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
copy(e) {
|
|
return this.name = e.name, this.source = e.source, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.channel = e.channel, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.internalFormat = e.internalFormat, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.colorSpace = e.colorSpace, this.renderTarget = e.renderTarget, this.isRenderTargetTexture = e.isRenderTargetTexture, this.userData = JSON.parse(JSON.stringify(e.userData)), this.needsUpdate = !0, this
|
|
}
|
|
toJSON(e) {
|
|
const t = void 0 === e || "string" == typeof e;
|
|
if (!t && void 0 !== e.textures[this.uuid]) return e.textures[this.uuid];
|
|
const n = {
|
|
metadata: {
|
|
version: 4.6,
|
|
type: "Texture",
|
|
generator: "Texture.toJSON"
|
|
},
|
|
uuid: this.uuid,
|
|
name: this.name,
|
|
image: this.source.toJSON(e).uuid,
|
|
mapping: this.mapping,
|
|
channel: this.channel,
|
|
repeat: [this.repeat.x, this.repeat.y],
|
|
offset: [this.offset.x, this.offset.y],
|
|
center: [this.center.x, this.center.y],
|
|
rotation: this.rotation,
|
|
wrap: [this.wrapS, this.wrapT],
|
|
format: this.format,
|
|
internalFormat: this.internalFormat,
|
|
type: this.type,
|
|
colorSpace: this.colorSpace,
|
|
minFilter: this.minFilter,
|
|
magFilter: this.magFilter,
|
|
anisotropy: this.anisotropy,
|
|
flipY: this.flipY,
|
|
generateMipmaps: this.generateMipmaps,
|
|
premultiplyAlpha: this.premultiplyAlpha,
|
|
unpackAlignment: this.unpackAlignment
|
|
};
|
|
return Object.keys(this.userData).length > 0 && (n.userData = this.userData), t || (e.textures[this.uuid] = n), n
|
|
}
|
|
dispose() {
|
|
this.dispatchEvent({
|
|
type: "dispose"
|
|
})
|
|
}
|
|
transformUv(e) {
|
|
if (300 !== this.mapping) return e;
|
|
if (e.applyMatrix3(this.matrix), e.x < 0 || e.x > 1) switch (this.wrapS) {
|
|
case N:
|
|
e.x = e.x - Math.floor(e.x);
|
|
break;
|
|
case F:
|
|
e.x = e.x < 0 ? 0 : 1;
|
|
break;
|
|
case O:
|
|
1 === Math.abs(Math.floor(e.x) % 2) ? e.x = Math.ceil(e.x) - e.x : e.x = e.x - Math.floor(e.x)
|
|
}
|
|
if (e.y < 0 || e.y > 1) switch (this.wrapT) {
|
|
case N:
|
|
e.y = e.y - Math.floor(e.y);
|
|
break;
|
|
case F:
|
|
e.y = e.y < 0 ? 0 : 1;
|
|
break;
|
|
case O:
|
|
1 === Math.abs(Math.floor(e.y) % 2) ? e.y = Math.ceil(e.y) - e.y : e.y = e.y - Math.floor(e.y)
|
|
}
|
|
return this.flipY && (e.y = 1 - e.y), e
|
|
}
|
|
set needsUpdate(e) {
|
|
!0 === e && (this.version++, this.source.needsUpdate = !0)
|
|
}
|
|
set needsPMREMUpdate(e) {
|
|
!0 === e && this.pmremVersion++
|
|
}
|
|
}
|
|
Gt.DEFAULT_IMAGE = null, Gt.DEFAULT_MAPPING = 300, Gt.DEFAULT_ANISOTROPY = 1;
|
|
class Qt {
|
|
constructor(e = 0, t = 0, n = 0, i = 1) {
|
|
Qt.prototype.isVector4 = !0, this.x = e, this.y = t, this.z = n, this.w = i
|
|
}
|
|
get width() {
|
|
return this.z
|
|
}
|
|
set width(e) {
|
|
this.z = e
|
|
}
|
|
get height() {
|
|
return this.w
|
|
}
|
|
set height(e) {
|
|
this.w = e
|
|
}
|
|
set(e, t, n, i) {
|
|
return this.x = e, this.y = t, this.z = n, this.w = i, this
|
|
}
|
|
setScalar(e) {
|
|
return this.x = e, this.y = e, this.z = e, this.w = e, this
|
|
}
|
|
setX(e) {
|
|
return this.x = e, this
|
|
}
|
|
setY(e) {
|
|
return this.y = e, this
|
|
}
|
|
setZ(e) {
|
|
return this.z = e, this
|
|
}
|
|
setW(e) {
|
|
return this.w = e, this
|
|
}
|
|
setComponent(e, t) {
|
|
switch (e) {
|
|
case 0:
|
|
this.x = t;
|
|
break;
|
|
case 1:
|
|
this.y = t;
|
|
break;
|
|
case 2:
|
|
this.z = t;
|
|
break;
|
|
case 3:
|
|
this.w = t;
|
|
break;
|
|
default:
|
|
throw new Error("index is out of range: " + e)
|
|
}
|
|
return this
|
|
}
|
|
getComponent(e) {
|
|
switch (e) {
|
|
case 0:
|
|
return this.x;
|
|
case 1:
|
|
return this.y;
|
|
case 2:
|
|
return this.z;
|
|
case 3:
|
|
return this.w;
|
|
default:
|
|
throw new Error("index is out of range: " + e)
|
|
}
|
|
}
|
|
clone() {
|
|
return new this.constructor(this.x, this.y, this.z, this.w)
|
|
}
|
|
copy(e) {
|
|
return this.x = e.x, this.y = e.y, this.z = e.z, this.w = void 0 !== e.w ? e.w : 1, this
|
|
}
|
|
add(e) {
|
|
return this.x += e.x, this.y += e.y, this.z += e.z, this.w += e.w, this
|
|
}
|
|
addScalar(e) {
|
|
return this.x += e, this.y += e, this.z += e, this.w += e, this
|
|
}
|
|
addVectors(e, t) {
|
|
return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this.w = e.w + t.w, this
|
|
}
|
|
addScaledVector(e, t) {
|
|
return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this.w += e.w * t, this
|
|
}
|
|
sub(e) {
|
|
return this.x -= e.x, this.y -= e.y, this.z -= e.z, this.w -= e.w, this
|
|
}
|
|
subScalar(e) {
|
|
return this.x -= e, this.y -= e, this.z -= e, this.w -= e, this
|
|
}
|
|
subVectors(e, t) {
|
|
return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this.w = e.w - t.w, this
|
|
}
|
|
multiply(e) {
|
|
return this.x *= e.x, this.y *= e.y, this.z *= e.z, this.w *= e.w, this
|
|
}
|
|
multiplyScalar(e) {
|
|
return this.x *= e, this.y *= e, this.z *= e, this.w *= e, this
|
|
}
|
|
applyMatrix4(e) {
|
|
const t = this.x,
|
|
n = this.y,
|
|
i = this.z,
|
|
r = this.w,
|
|
a = e.elements;
|
|
return this.x = a[0] * t + a[4] * n + a[8] * i + a[12] * r, this.y = a[1] * t + a[5] * n + a[9] * i + a[13] * r, this.z = a[2] * t + a[6] * n + a[10] * i + a[14] * r, this.w = a[3] * t + a[7] * n + a[11] * i + a[15] * r, this
|
|
}
|
|
divide(e) {
|
|
return this.x /= e.x, this.y /= e.y, this.z /= e.z, this.w /= e.w, this
|
|
}
|
|
divideScalar(e) {
|
|
return this.multiplyScalar(1 / e)
|
|
}
|
|
setAxisAngleFromQuaternion(e) {
|
|
this.w = 2 * Math.acos(e.w);
|
|
const t = Math.sqrt(1 - e.w * e.w);
|
|
return t < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = e.x / t, this.y = e.y / t, this.z = e.z / t), this
|
|
}
|
|
setAxisAngleFromRotationMatrix(e) {
|
|
let t, n, i, r;
|
|
const a = .01,
|
|
s = .1,
|
|
o = e.elements,
|
|
l = o[0],
|
|
c = o[4],
|
|
h = o[8],
|
|
u = o[1],
|
|
d = o[5],
|
|
f = o[9],
|
|
p = o[2],
|
|
m = o[6],
|
|
g = o[10];
|
|
if (Math.abs(c - u) < a && Math.abs(h - p) < a && Math.abs(f - m) < a) {
|
|
if (Math.abs(c + u) < s && Math.abs(h + p) < s && Math.abs(f + m) < s && Math.abs(l + d + g - 3) < s) return this.set(1, 0, 0, 0), this;
|
|
t = Math.PI;
|
|
const e = (l + 1) / 2,
|
|
o = (d + 1) / 2,
|
|
A = (g + 1) / 2,
|
|
_ = (c + u) / 4,
|
|
v = (h + p) / 4,
|
|
w = (f + m) / 4;
|
|
return e > o && e > A ? e < a ? (n = 0, i = .707106781, r = .707106781) : (n = Math.sqrt(e), i = _ / n, r = v / n) : o > A ? o < a ? (n = .707106781, i = 0, r = .707106781) : (i = Math.sqrt(o), n = _ / i, r = w / i) : A < a ? (n = .707106781, i = .707106781, r = 0) : (r = Math.sqrt(A), n = v / r, i = w / r), this.set(n, i, r, t), this
|
|
}
|
|
let A = Math.sqrt((m - f) * (m - f) + (h - p) * (h - p) + (u - c) * (u - c));
|
|
return Math.abs(A) < .001 && (A = 1), this.x = (m - f) / A, this.y = (h - p) / A, this.z = (u - c) / A, this.w = Math.acos((l + d + g - 1) / 2), this
|
|
}
|
|
setFromMatrixPosition(e) {
|
|
const t = e.elements;
|
|
return this.x = t[12], this.y = t[13], this.z = t[14], this.w = t[15], this
|
|
}
|
|
min(e) {
|
|
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this.w = Math.min(this.w, e.w), this
|
|
}
|
|
max(e) {
|
|
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this.w = Math.max(this.w, e.w), this
|
|
}
|
|
clamp(e, t) {
|
|
return this.x = _t(this.x, e.x, t.x), this.y = _t(this.y, e.y, t.y), this.z = _t(this.z, e.z, t.z), this.w = _t(this.w, e.w, t.w), this
|
|
}
|
|
clampScalar(e, t) {
|
|
return this.x = _t(this.x, e, t), this.y = _t(this.y, e, t), this.z = _t(this.z, e, t), this.w = _t(this.w, e, t), this
|
|
}
|
|
clampLength(e, t) {
|
|
const n = this.length();
|
|
return this.divideScalar(n || 1).multiplyScalar(_t(n, e, t))
|
|
}
|
|
floor() {
|
|
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this.w = Math.floor(this.w), this
|
|
}
|
|
ceil() {
|
|
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this.w = Math.ceil(this.w), this
|
|
}
|
|
round() {
|
|
return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this.w = Math.round(this.w), this
|
|
}
|
|
roundToZero() {
|
|
return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this.w = Math.trunc(this.w), this
|
|
}
|
|
negate() {
|
|
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this
|
|
}
|
|
dot(e) {
|
|
return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w
|
|
}
|
|
lengthSq() {
|
|
return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w
|
|
}
|
|
length() {
|
|
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)
|
|
}
|
|
manhattanLength() {
|
|
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w)
|
|
}
|
|
normalize() {
|
|
return this.divideScalar(this.length() || 1)
|
|
}
|
|
setLength(e) {
|
|
return this.normalize().multiplyScalar(e)
|
|
}
|
|
lerp(e, t) {
|
|
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this.w += (e.w - this.w) * t, this
|
|
}
|
|
lerpVectors(e, t, n) {
|
|
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this.w = e.w + (t.w - e.w) * n, this
|
|
}
|
|
equals(e) {
|
|
return e.x === this.x && e.y === this.y && e.z === this.z && e.w === this.w
|
|
}
|
|
fromArray(e, t = 0) {
|
|
return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this.w = e[t + 3], this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e[t + 3] = this.w, e
|
|
}
|
|
fromBufferAttribute(e, t) {
|
|
return this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this.w = e.getW(t), this
|
|
}
|
|
random() {
|
|
return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this.w = Math.random(), this
|
|
}*[Symbol.iterator]() {
|
|
yield this.x, yield this.y, yield this.z, yield this.w
|
|
}
|
|
}
|
|
class Xt extends dt {
|
|
constructor(e = 1, t = 1, n = {}) {
|
|
super(), this.isRenderTarget = !0, this.width = e, this.height = t, this.depth = 1, this.scissor = new Qt(0, 0, e, t), this.scissorTest = !1, this.viewport = new Qt(0, 0, e, t);
|
|
const i = {
|
|
width: e,
|
|
height: t,
|
|
depth: 1
|
|
};
|
|
n = Object.assign({
|
|
generateMipmaps: !1,
|
|
internalFormat: null,
|
|
minFilter: V,
|
|
depthBuffer: !0,
|
|
stencilBuffer: !1,
|
|
resolveDepthBuffer: !0,
|
|
resolveStencilBuffer: !0,
|
|
depthTexture: null,
|
|
samples: 0,
|
|
count: 1
|
|
}, n);
|
|
const r = new Gt(i, n.mapping, n.wrapS, n.wrapT, n.magFilter, n.minFilter, n.format, n.type, n.anisotropy, n.colorSpace);
|
|
r.flipY = !1, r.generateMipmaps = n.generateMipmaps, r.internalFormat = n.internalFormat, this.textures = [];
|
|
const a = n.count;
|
|
for (let e = 0; e < a; e++) this.textures[e] = r.clone(), this.textures[e].isRenderTargetTexture = !0, this.textures[e].renderTarget = this;
|
|
this.depthBuffer = n.depthBuffer, this.stencilBuffer = n.stencilBuffer, this.resolveDepthBuffer = n.resolveDepthBuffer, this.resolveStencilBuffer = n.resolveStencilBuffer, this._depthTexture = null, this.depthTexture = n.depthTexture, this.samples = n.samples
|
|
}
|
|
get texture() {
|
|
return this.textures[0]
|
|
}
|
|
set texture(e) {
|
|
this.textures[0] = e
|
|
}
|
|
set depthTexture(e) {
|
|
null !== this._depthTexture && (this._depthTexture.renderTarget = null), null !== e && (e.renderTarget = this), this._depthTexture = e
|
|
}
|
|
get depthTexture() {
|
|
return this._depthTexture
|
|
}
|
|
setSize(e, t, n = 1) {
|
|
if (this.width !== e || this.height !== t || this.depth !== n) {
|
|
this.width = e, this.height = t, this.depth = n;
|
|
for (let i = 0, r = this.textures.length; i < r; i++) this.textures[i].image.width = e, this.textures[i].image.height = t, this.textures[i].image.depth = n;
|
|
this.dispose()
|
|
}
|
|
this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t)
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
copy(e) {
|
|
this.width = e.width, this.height = e.height, this.depth = e.depth, this.scissor.copy(e.scissor), this.scissorTest = e.scissorTest, this.viewport.copy(e.viewport), this.textures.length = 0;
|
|
for (let t = 0, n = e.textures.length; t < n; t++) {
|
|
this.textures[t] = e.textures[t].clone(), this.textures[t].isRenderTargetTexture = !0, this.textures[t].renderTarget = this;
|
|
const n = Object.assign({}, e.textures[t].image);
|
|
this.textures[t].source = new Wt(n)
|
|
}
|
|
return this.depthBuffer = e.depthBuffer, this.stencilBuffer = e.stencilBuffer, this.resolveDepthBuffer = e.resolveDepthBuffer, this.resolveStencilBuffer = e.resolveStencilBuffer, null !== e.depthTexture && (this.depthTexture = e.depthTexture.clone()), this.samples = e.samples, this
|
|
}
|
|
dispose() {
|
|
this.dispatchEvent({
|
|
type: "dispose"
|
|
})
|
|
}
|
|
}
|
|
class jt extends Xt {
|
|
constructor(e = 1, t = 1, n = {}) {
|
|
super(e, t, n), this.isWebGLRenderTarget = !0
|
|
}
|
|
}
|
|
class qt extends Gt {
|
|
constructor(e = null, t = 1, n = 1, i = 1) {
|
|
super(null), this.isDataArrayTexture = !0, this.image = {
|
|
data: e,
|
|
width: t,
|
|
height: n,
|
|
depth: i
|
|
}, this.magFilter = z, this.minFilter = z, this.wrapR = F, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1, this.layerUpdates = new Set
|
|
}
|
|
addLayerUpdate(e) {
|
|
this.layerUpdates.add(e)
|
|
}
|
|
clearLayerUpdates() {
|
|
this.layerUpdates.clear()
|
|
}
|
|
}
|
|
class Yt extends Gt {
|
|
constructor(e = null, t = 1, n = 1, i = 1) {
|
|
super(null), this.isData3DTexture = !0, this.image = {
|
|
data: e,
|
|
width: t,
|
|
height: n,
|
|
depth: i
|
|
}, this.magFilter = z, this.minFilter = z, this.wrapR = F, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1
|
|
}
|
|
}
|
|
class Kt {
|
|
constructor(e = 0, t = 0, n = 0, i = 1) {
|
|
this.isQuaternion = !0, this._x = e, this._y = t, this._z = n, this._w = i
|
|
}
|
|
static slerpFlat(e, t, n, i, r, a, s) {
|
|
let o = n[i + 0],
|
|
l = n[i + 1],
|
|
c = n[i + 2],
|
|
h = n[i + 3];
|
|
const u = r[a + 0],
|
|
d = r[a + 1],
|
|
f = r[a + 2],
|
|
p = r[a + 3];
|
|
if (0 === s) return e[t + 0] = o, e[t + 1] = l, e[t + 2] = c, void(e[t + 3] = h);
|
|
if (1 === s) return e[t + 0] = u, e[t + 1] = d, e[t + 2] = f, void(e[t + 3] = p);
|
|
if (h !== p || o !== u || l !== d || c !== f) {
|
|
let e = 1 - s;
|
|
const t = o * u + l * d + c * f + h * p,
|
|
n = t >= 0 ? 1 : -1,
|
|
i = 1 - t * t;
|
|
if (i > Number.EPSILON) {
|
|
const r = Math.sqrt(i),
|
|
a = Math.atan2(r, t * n);
|
|
e = Math.sin(e * a) / r, s = Math.sin(s * a) / r
|
|
}
|
|
const r = s * n;
|
|
if (o = o * e + u * r, l = l * e + d * r, c = c * e + f * r, h = h * e + p * r, e === 1 - s) {
|
|
const e = 1 / Math.sqrt(o * o + l * l + c * c + h * h);
|
|
o *= e, l *= e, c *= e, h *= e
|
|
}
|
|
}
|
|
e[t] = o, e[t + 1] = l, e[t + 2] = c, e[t + 3] = h
|
|
}
|
|
static multiplyQuaternionsFlat(e, t, n, i, r, a) {
|
|
const s = n[i],
|
|
o = n[i + 1],
|
|
l = n[i + 2],
|
|
c = n[i + 3],
|
|
h = r[a],
|
|
u = r[a + 1],
|
|
d = r[a + 2],
|
|
f = r[a + 3];
|
|
return e[t] = s * f + c * h + o * d - l * u, e[t + 1] = o * f + c * u + l * h - s * d, e[t + 2] = l * f + c * d + s * u - o * h, e[t + 3] = c * f - s * h - o * u - l * d, e
|
|
}
|
|
get x() {
|
|
return this._x
|
|
}
|
|
set x(e) {
|
|
this._x = e, this._onChangeCallback()
|
|
}
|
|
get y() {
|
|
return this._y
|
|
}
|
|
set y(e) {
|
|
this._y = e, this._onChangeCallback()
|
|
}
|
|
get z() {
|
|
return this._z
|
|
}
|
|
set z(e) {
|
|
this._z = e, this._onChangeCallback()
|
|
}
|
|
get w() {
|
|
return this._w
|
|
}
|
|
set w(e) {
|
|
this._w = e, this._onChangeCallback()
|
|
}
|
|
set(e, t, n, i) {
|
|
return this._x = e, this._y = t, this._z = n, this._w = i, this._onChangeCallback(), this
|
|
}
|
|
clone() {
|
|
return new this.constructor(this._x, this._y, this._z, this._w)
|
|
}
|
|
copy(e) {
|
|
return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this
|
|
}
|
|
setFromEuler(e, t = !0) {
|
|
const n = e._x,
|
|
i = e._y,
|
|
r = e._z,
|
|
a = e._order,
|
|
s = Math.cos,
|
|
o = Math.sin,
|
|
l = s(n / 2),
|
|
c = s(i / 2),
|
|
h = s(r / 2),
|
|
u = o(n / 2),
|
|
d = o(i / 2),
|
|
f = o(r / 2);
|
|
switch (a) {
|
|
case "XYZ":
|
|
this._x = u * c * h + l * d * f, this._y = l * d * h - u * c * f, this._z = l * c * f + u * d * h, this._w = l * c * h - u * d * f;
|
|
break;
|
|
case "YXZ":
|
|
this._x = u * c * h + l * d * f, this._y = l * d * h - u * c * f, this._z = l * c * f - u * d * h, this._w = l * c * h + u * d * f;
|
|
break;
|
|
case "ZXY":
|
|
this._x = u * c * h - l * d * f, this._y = l * d * h + u * c * f, this._z = l * c * f + u * d * h, this._w = l * c * h - u * d * f;
|
|
break;
|
|
case "ZYX":
|
|
this._x = u * c * h - l * d * f, this._y = l * d * h + u * c * f, this._z = l * c * f - u * d * h, this._w = l * c * h + u * d * f;
|
|
break;
|
|
case "YZX":
|
|
this._x = u * c * h + l * d * f, this._y = l * d * h + u * c * f, this._z = l * c * f - u * d * h, this._w = l * c * h - u * d * f;
|
|
break;
|
|
case "XZY":
|
|
this._x = u * c * h - l * d * f, this._y = l * d * h - u * c * f, this._z = l * c * f + u * d * h, this._w = l * c * h + u * d * f;
|
|
break;
|
|
default:
|
|
console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: " + a)
|
|
}
|
|
return !0 === t && this._onChangeCallback(), this
|
|
}
|
|
setFromAxisAngle(e, t) {
|
|
const n = t / 2,
|
|
i = Math.sin(n);
|
|
return this._x = e.x * i, this._y = e.y * i, this._z = e.z * i, this._w = Math.cos(n), this._onChangeCallback(), this
|
|
}
|
|
setFromRotationMatrix(e) {
|
|
const t = e.elements,
|
|
n = t[0],
|
|
i = t[4],
|
|
r = t[8],
|
|
a = t[1],
|
|
s = t[5],
|
|
o = t[9],
|
|
l = t[2],
|
|
c = t[6],
|
|
h = t[10],
|
|
u = n + s + h;
|
|
if (u > 0) {
|
|
const e = .5 / Math.sqrt(u + 1);
|
|
this._w = .25 / e, this._x = (c - o) * e, this._y = (r - l) * e, this._z = (a - i) * e
|
|
} else if (n > s && n > h) {
|
|
const e = 2 * Math.sqrt(1 + n - s - h);
|
|
this._w = (c - o) / e, this._x = .25 * e, this._y = (i + a) / e, this._z = (r + l) / e
|
|
} else if (s > h) {
|
|
const e = 2 * Math.sqrt(1 + s - n - h);
|
|
this._w = (r - l) / e, this._x = (i + a) / e, this._y = .25 * e, this._z = (o + c) / e
|
|
} else {
|
|
const e = 2 * Math.sqrt(1 + h - n - s);
|
|
this._w = (a - i) / e, this._x = (r + l) / e, this._y = (o + c) / e, this._z = .25 * e
|
|
}
|
|
return this._onChangeCallback(), this
|
|
}
|
|
setFromUnitVectors(e, t) {
|
|
let n = e.dot(t) + 1;
|
|
return n < Number.EPSILON ? (n = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = n) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = n)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = n), this.normalize()
|
|
}
|
|
angleTo(e) {
|
|
return 2 * Math.acos(Math.abs(_t(this.dot(e), -1, 1)))
|
|
}
|
|
rotateTowards(e, t) {
|
|
const n = this.angleTo(e);
|
|
if (0 === n) return this;
|
|
const i = Math.min(1, t / n);
|
|
return this.slerp(e, i), this
|
|
}
|
|
identity() {
|
|
return this.set(0, 0, 0, 1)
|
|
}
|
|
invert() {
|
|
return this.conjugate()
|
|
}
|
|
conjugate() {
|
|
return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this
|
|
}
|
|
dot(e) {
|
|
return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w
|
|
}
|
|
lengthSq() {
|
|
return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w
|
|
}
|
|
length() {
|
|
return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
|
|
}
|
|
normalize() {
|
|
let e = this.length();
|
|
return 0 === e ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x = this._x * e, this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this
|
|
}
|
|
multiply(e) {
|
|
return this.multiplyQuaternions(this, e)
|
|
}
|
|
premultiply(e) {
|
|
return this.multiplyQuaternions(e, this)
|
|
}
|
|
multiplyQuaternions(e, t) {
|
|
const n = e._x,
|
|
i = e._y,
|
|
r = e._z,
|
|
a = e._w,
|
|
s = t._x,
|
|
o = t._y,
|
|
l = t._z,
|
|
c = t._w;
|
|
return this._x = n * c + a * s + i * l - r * o, this._y = i * c + a * o + r * s - n * l, this._z = r * c + a * l + n * o - i * s, this._w = a * c - n * s - i * o - r * l, this._onChangeCallback(), this
|
|
}
|
|
slerp(e, t) {
|
|
if (0 === t) return this;
|
|
if (1 === t) return this.copy(e);
|
|
const n = this._x,
|
|
i = this._y,
|
|
r = this._z,
|
|
a = this._w;
|
|
let s = a * e._w + n * e._x + i * e._y + r * e._z;
|
|
if (s < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, s = -s) : this.copy(e), s >= 1) return this._w = a, this._x = n, this._y = i, this._z = r, this;
|
|
const o = 1 - s * s;
|
|
if (o <= Number.EPSILON) {
|
|
const e = 1 - t;
|
|
return this._w = e * a + t * this._w, this._x = e * n + t * this._x, this._y = e * i + t * this._y, this._z = e * r + t * this._z, this.normalize(), this
|
|
}
|
|
const l = Math.sqrt(o),
|
|
c = Math.atan2(l, s),
|
|
h = Math.sin((1 - t) * c) / l,
|
|
u = Math.sin(t * c) / l;
|
|
return this._w = a * h + this._w * u, this._x = n * h + this._x * u, this._y = i * h + this._y * u, this._z = r * h + this._z * u, this._onChangeCallback(), this
|
|
}
|
|
slerpQuaternions(e, t, n) {
|
|
return this.copy(e).slerp(t, n)
|
|
}
|
|
random() {
|
|
const e = 2 * Math.PI * Math.random(),
|
|
t = 2 * Math.PI * Math.random(),
|
|
n = Math.random(),
|
|
i = Math.sqrt(1 - n),
|
|
r = Math.sqrt(n);
|
|
return this.set(i * Math.sin(e), i * Math.cos(e), r * Math.sin(t), r * Math.cos(t))
|
|
}
|
|
equals(e) {
|
|
return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w
|
|
}
|
|
fromArray(e, t = 0) {
|
|
return this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e
|
|
}
|
|
fromBufferAttribute(e, t) {
|
|
return this._x = e.getX(t), this._y = e.getY(t), this._z = e.getZ(t), this._w = e.getW(t), this._onChangeCallback(), this
|
|
}
|
|
toJSON() {
|
|
return this.toArray()
|
|
}
|
|
_onChange(e) {
|
|
return this._onChangeCallback = e, this
|
|
}
|
|
_onChangeCallback() {}*[Symbol.iterator]() {
|
|
yield this._x, yield this._y, yield this._z, yield this._w
|
|
}
|
|
}
|
|
class Zt {
|
|
constructor(e = 0, t = 0, n = 0) {
|
|
Zt.prototype.isVector3 = !0, this.x = e, this.y = t, this.z = n
|
|
}
|
|
set(e, t, n) {
|
|
return void 0 === n && (n = this.z), this.x = e, this.y = t, this.z = n, this
|
|
}
|
|
setScalar(e) {
|
|
return this.x = e, this.y = e, this.z = e, this
|
|
}
|
|
setX(e) {
|
|
return this.x = e, this
|
|
}
|
|
setY(e) {
|
|
return this.y = e, this
|
|
}
|
|
setZ(e) {
|
|
return this.z = e, this
|
|
}
|
|
setComponent(e, t) {
|
|
switch (e) {
|
|
case 0:
|
|
this.x = t;
|
|
break;
|
|
case 1:
|
|
this.y = t;
|
|
break;
|
|
case 2:
|
|
this.z = t;
|
|
break;
|
|
default:
|
|
throw new Error("index is out of range: " + e)
|
|
}
|
|
return this
|
|
}
|
|
getComponent(e) {
|
|
switch (e) {
|
|
case 0:
|
|
return this.x;
|
|
case 1:
|
|
return this.y;
|
|
case 2:
|
|
return this.z;
|
|
default:
|
|
throw new Error("index is out of range: " + e)
|
|
}
|
|
}
|
|
clone() {
|
|
return new this.constructor(this.x, this.y, this.z)
|
|
}
|
|
copy(e) {
|
|
return this.x = e.x, this.y = e.y, this.z = e.z, this
|
|
}
|
|
add(e) {
|
|
return this.x += e.x, this.y += e.y, this.z += e.z, this
|
|
}
|
|
addScalar(e) {
|
|
return this.x += e, this.y += e, this.z += e, this
|
|
}
|
|
addVectors(e, t) {
|
|
return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this
|
|
}
|
|
addScaledVector(e, t) {
|
|
return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this
|
|
}
|
|
sub(e) {
|
|
return this.x -= e.x, this.y -= e.y, this.z -= e.z, this
|
|
}
|
|
subScalar(e) {
|
|
return this.x -= e, this.y -= e, this.z -= e, this
|
|
}
|
|
subVectors(e, t) {
|
|
return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this
|
|
}
|
|
multiply(e) {
|
|
return this.x *= e.x, this.y *= e.y, this.z *= e.z, this
|
|
}
|
|
multiplyScalar(e) {
|
|
return this.x *= e, this.y *= e, this.z *= e, this
|
|
}
|
|
multiplyVectors(e, t) {
|
|
return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this
|
|
}
|
|
applyEuler(e) {
|
|
return this.applyQuaternion($t.setFromEuler(e))
|
|
}
|
|
applyAxisAngle(e, t) {
|
|
return this.applyQuaternion($t.setFromAxisAngle(e, t))
|
|
}
|
|
applyMatrix3(e) {
|
|
const t = this.x,
|
|
n = this.y,
|
|
i = this.z,
|
|
r = e.elements;
|
|
return this.x = r[0] * t + r[3] * n + r[6] * i, this.y = r[1] * t + r[4] * n + r[7] * i, this.z = r[2] * t + r[5] * n + r[8] * i, this
|
|
}
|
|
applyNormalMatrix(e) {
|
|
return this.applyMatrix3(e).normalize()
|
|
}
|
|
applyMatrix4(e) {
|
|
const t = this.x,
|
|
n = this.y,
|
|
i = this.z,
|
|
r = e.elements,
|
|
a = 1 / (r[3] * t + r[7] * n + r[11] * i + r[15]);
|
|
return this.x = (r[0] * t + r[4] * n + r[8] * i + r[12]) * a, this.y = (r[1] * t + r[5] * n + r[9] * i + r[13]) * a, this.z = (r[2] * t + r[6] * n + r[10] * i + r[14]) * a, this
|
|
}
|
|
applyQuaternion(e) {
|
|
const t = this.x,
|
|
n = this.y,
|
|
i = this.z,
|
|
r = e.x,
|
|
a = e.y,
|
|
s = e.z,
|
|
o = e.w,
|
|
l = 2 * (a * i - s * n),
|
|
c = 2 * (s * t - r * i),
|
|
h = 2 * (r * n - a * t);
|
|
return this.x = t + o * l + a * h - s * c, this.y = n + o * c + s * l - r * h, this.z = i + o * h + r * c - a * l, this
|
|
}
|
|
project(e) {
|
|
return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)
|
|
}
|
|
unproject(e) {
|
|
return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)
|
|
}
|
|
transformDirection(e) {
|
|
const t = this.x,
|
|
n = this.y,
|
|
i = this.z,
|
|
r = e.elements;
|
|
return this.x = r[0] * t + r[4] * n + r[8] * i, this.y = r[1] * t + r[5] * n + r[9] * i, this.z = r[2] * t + r[6] * n + r[10] * i, this.normalize()
|
|
}
|
|
divide(e) {
|
|
return this.x /= e.x, this.y /= e.y, this.z /= e.z, this
|
|
}
|
|
divideScalar(e) {
|
|
return this.multiplyScalar(1 / e)
|
|
}
|
|
min(e) {
|
|
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this
|
|
}
|
|
max(e) {
|
|
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this
|
|
}
|
|
clamp(e, t) {
|
|
return this.x = _t(this.x, e.x, t.x), this.y = _t(this.y, e.y, t.y), this.z = _t(this.z, e.z, t.z), this
|
|
}
|
|
clampScalar(e, t) {
|
|
return this.x = _t(this.x, e, t), this.y = _t(this.y, e, t), this.z = _t(this.z, e, t), this
|
|
}
|
|
clampLength(e, t) {
|
|
const n = this.length();
|
|
return this.divideScalar(n || 1).multiplyScalar(_t(n, e, t))
|
|
}
|
|
floor() {
|
|
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this
|
|
}
|
|
ceil() {
|
|
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this
|
|
}
|
|
round() {
|
|
return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this
|
|
}
|
|
roundToZero() {
|
|
return this.x = Math.trunc(this.x), this.y = Math.trunc(this.y), this.z = Math.trunc(this.z), this
|
|
}
|
|
negate() {
|
|
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this
|
|
}
|
|
dot(e) {
|
|
return this.x * e.x + this.y * e.y + this.z * e.z
|
|
}
|
|
lengthSq() {
|
|
return this.x * this.x + this.y * this.y + this.z * this.z
|
|
}
|
|
length() {
|
|
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
|
|
}
|
|
manhattanLength() {
|
|
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
|
|
}
|
|
normalize() {
|
|
return this.divideScalar(this.length() || 1)
|
|
}
|
|
setLength(e) {
|
|
return this.normalize().multiplyScalar(e)
|
|
}
|
|
lerp(e, t) {
|
|
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this
|
|
}
|
|
lerpVectors(e, t, n) {
|
|
return this.x = e.x + (t.x - e.x) * n, this.y = e.y + (t.y - e.y) * n, this.z = e.z + (t.z - e.z) * n, this
|
|
}
|
|
cross(e) {
|
|
return this.crossVectors(this, e)
|
|
}
|
|
crossVectors(e, t) {
|
|
const n = e.x,
|
|
i = e.y,
|
|
r = e.z,
|
|
a = t.x,
|
|
s = t.y,
|
|
o = t.z;
|
|
return this.x = i * o - r * s, this.y = r * a - n * o, this.z = n * s - i * a, this
|
|
}
|
|
projectOnVector(e) {
|
|
const t = e.lengthSq();
|
|
if (0 === t) return this.set(0, 0, 0);
|
|
const n = e.dot(this) / t;
|
|
return this.copy(e).multiplyScalar(n)
|
|
}
|
|
projectOnPlane(e) {
|
|
return Jt.copy(this).projectOnVector(e), this.sub(Jt)
|
|
}
|
|
reflect(e) {
|
|
return this.sub(Jt.copy(e).multiplyScalar(2 * this.dot(e)))
|
|
}
|
|
angleTo(e) {
|
|
const t = Math.sqrt(this.lengthSq() * e.lengthSq());
|
|
if (0 === t) return Math.PI / 2;
|
|
const n = this.dot(e) / t;
|
|
return Math.acos(_t(n, -1, 1))
|
|
}
|
|
distanceTo(e) {
|
|
return Math.sqrt(this.distanceToSquared(e))
|
|
}
|
|
distanceToSquared(e) {
|
|
const t = this.x - e.x,
|
|
n = this.y - e.y,
|
|
i = this.z - e.z;
|
|
return t * t + n * n + i * i
|
|
}
|
|
manhattanDistanceTo(e) {
|
|
return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z)
|
|
}
|
|
setFromSpherical(e) {
|
|
return this.setFromSphericalCoords(e.radius, e.phi, e.theta)
|
|
}
|
|
setFromSphericalCoords(e, t, n) {
|
|
const i = Math.sin(t) * e;
|
|
return this.x = i * Math.sin(n), this.y = Math.cos(t) * e, this.z = i * Math.cos(n), this
|
|
}
|
|
setFromCylindrical(e) {
|
|
return this.setFromCylindricalCoords(e.radius, e.theta, e.y)
|
|
}
|
|
setFromCylindricalCoords(e, t, n) {
|
|
return this.x = e * Math.sin(t), this.y = n, this.z = e * Math.cos(t), this
|
|
}
|
|
setFromMatrixPosition(e) {
|
|
const t = e.elements;
|
|
return this.x = t[12], this.y = t[13], this.z = t[14], this
|
|
}
|
|
setFromMatrixScale(e) {
|
|
const t = this.setFromMatrixColumn(e, 0).length(),
|
|
n = this.setFromMatrixColumn(e, 1).length(),
|
|
i = this.setFromMatrixColumn(e, 2).length();
|
|
return this.x = t, this.y = n, this.z = i, this
|
|
}
|
|
setFromMatrixColumn(e, t) {
|
|
return this.fromArray(e.elements, 4 * t)
|
|
}
|
|
setFromMatrix3Column(e, t) {
|
|
return this.fromArray(e.elements, 3 * t)
|
|
}
|
|
setFromEuler(e) {
|
|
return this.x = e._x, this.y = e._y, this.z = e._z, this
|
|
}
|
|
setFromColor(e) {
|
|
return this.x = e.r, this.y = e.g, this.z = e.b, this
|
|
}
|
|
equals(e) {
|
|
return e.x === this.x && e.y === this.y && e.z === this.z
|
|
}
|
|
fromArray(e, t = 0) {
|
|
return this.x = e[t], this.y = e[t + 1], this.z = e[t + 2], this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
return e[t] = this.x, e[t + 1] = this.y, e[t + 2] = this.z, e
|
|
}
|
|
fromBufferAttribute(e, t) {
|
|
return this.x = e.getX(t), this.y = e.getY(t), this.z = e.getZ(t), this
|
|
}
|
|
random() {
|
|
return this.x = Math.random(), this.y = Math.random(), this.z = Math.random(), this
|
|
}
|
|
randomDirection() {
|
|
const e = Math.random() * Math.PI * 2,
|
|
t = 2 * Math.random() - 1,
|
|
n = Math.sqrt(1 - t * t);
|
|
return this.x = n * Math.cos(e), this.y = t, this.z = n * Math.sin(e), this
|
|
}*[Symbol.iterator]() {
|
|
yield this.x, yield this.y, yield this.z
|
|
}
|
|
}
|
|
const Jt = new Zt,
|
|
$t = new Kt;
|
|
class en {
|
|
constructor(e = new Zt(1 / 0, 1 / 0, 1 / 0), t = new Zt(-1 / 0, -1 / 0, -1 / 0)) {
|
|
this.isBox3 = !0, this.min = e, this.max = t
|
|
}
|
|
set(e, t) {
|
|
return this.min.copy(e), this.max.copy(t), this
|
|
}
|
|
setFromArray(e) {
|
|
this.makeEmpty();
|
|
for (let t = 0, n = e.length; t < n; t += 3) this.expandByPoint(nn.fromArray(e, t));
|
|
return this
|
|
}
|
|
setFromBufferAttribute(e) {
|
|
this.makeEmpty();
|
|
for (let t = 0, n = e.count; t < n; t++) this.expandByPoint(nn.fromBufferAttribute(e, t));
|
|
return this
|
|
}
|
|
setFromPoints(e) {
|
|
this.makeEmpty();
|
|
for (let t = 0, n = e.length; t < n; t++) this.expandByPoint(e[t]);
|
|
return this
|
|
}
|
|
setFromCenterAndSize(e, t) {
|
|
const n = nn.copy(t).multiplyScalar(.5);
|
|
return this.min.copy(e).sub(n), this.max.copy(e).add(n), this
|
|
}
|
|
setFromObject(e, t = !1) {
|
|
return this.makeEmpty(), this.expandByObject(e, t)
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
copy(e) {
|
|
return this.min.copy(e.min), this.max.copy(e.max), this
|
|
}
|
|
makeEmpty() {
|
|
return this.min.x = this.min.y = this.min.z = 1 / 0, this.max.x = this.max.y = this.max.z = -1 / 0, this
|
|
}
|
|
isEmpty() {
|
|
return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z
|
|
}
|
|
getCenter(e) {
|
|
return this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(.5)
|
|
}
|
|
getSize(e) {
|
|
return this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min)
|
|
}
|
|
expandByPoint(e) {
|
|
return this.min.min(e), this.max.max(e), this
|
|
}
|
|
expandByVector(e) {
|
|
return this.min.sub(e), this.max.add(e), this
|
|
}
|
|
expandByScalar(e) {
|
|
return this.min.addScalar(-e), this.max.addScalar(e), this
|
|
}
|
|
expandByObject(e, t = !1) {
|
|
e.updateWorldMatrix(!1, !1);
|
|
const n = e.geometry;
|
|
if (void 0 !== n) {
|
|
const i = n.getAttribute("position");
|
|
if (!0 === t && void 0 !== i && !0 !== e.isInstancedMesh)
|
|
for (let t = 0, n = i.count; t < n; t++) !0 === e.isMesh ? e.getVertexPosition(t, nn) : nn.fromBufferAttribute(i, t), nn.applyMatrix4(e.matrixWorld), this.expandByPoint(nn);
|
|
else void 0 !== e.boundingBox ? (null === e.boundingBox && e.computeBoundingBox(), rn.copy(e.boundingBox)) : (null === n.boundingBox && n.computeBoundingBox(), rn.copy(n.boundingBox)), rn.applyMatrix4(e.matrixWorld), this.union(rn)
|
|
}
|
|
const i = e.children;
|
|
for (let e = 0, n = i.length; e < n; e++) this.expandByObject(i[e], t);
|
|
return this
|
|
}
|
|
containsPoint(e) {
|
|
return e.x >= this.min.x && e.x <= this.max.x && e.y >= this.min.y && e.y <= this.max.y && e.z >= this.min.z && e.z <= this.max.z
|
|
}
|
|
containsBox(e) {
|
|
return this.min.x <= e.min.x && e.max.x <= this.max.x && this.min.y <= e.min.y && e.max.y <= this.max.y && this.min.z <= e.min.z && e.max.z <= this.max.z
|
|
}
|
|
getParameter(e, t) {
|
|
return t.set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y), (e.z - this.min.z) / (this.max.z - this.min.z))
|
|
}
|
|
intersectsBox(e) {
|
|
return e.max.x >= this.min.x && e.min.x <= this.max.x && e.max.y >= this.min.y && e.min.y <= this.max.y && e.max.z >= this.min.z && e.min.z <= this.max.z
|
|
}
|
|
intersectsSphere(e) {
|
|
return this.clampPoint(e.center, nn), nn.distanceToSquared(e.center) <= e.radius * e.radius
|
|
}
|
|
intersectsPlane(e) {
|
|
let t, n;
|
|
return e.normal.x > 0 ? (t = e.normal.x * this.min.x, n = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, n = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, n += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, n += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, n += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, n += e.normal.z * this.min.z), t <= -e.constant && n >= -e.constant
|
|
}
|
|
intersectsTriangle(e) {
|
|
if (this.isEmpty()) return !1;
|
|
this.getCenter(un), dn.subVectors(this.max, un), an.subVectors(e.a, un), sn.subVectors(e.b, un), on.subVectors(e.c, un), ln.subVectors(sn, an), cn.subVectors(on, sn), hn.subVectors(an, on);
|
|
let t = [0, -ln.z, ln.y, 0, -cn.z, cn.y, 0, -hn.z, hn.y, ln.z, 0, -ln.x, cn.z, 0, -cn.x, hn.z, 0, -hn.x, -ln.y, ln.x, 0, -cn.y, cn.x, 0, -hn.y, hn.x, 0];
|
|
return !!mn(t, an, sn, on, dn) && (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !!mn(t, an, sn, on, dn) && (fn.crossVectors(ln, cn), t = [fn.x, fn.y, fn.z], mn(t, an, sn, on, dn)))
|
|
}
|
|
clampPoint(e, t) {
|
|
return t.copy(e).clamp(this.min, this.max)
|
|
}
|
|
distanceToPoint(e) {
|
|
return this.clampPoint(e, nn).distanceTo(e)
|
|
}
|
|
getBoundingSphere(e) {
|
|
return this.isEmpty() ? e.makeEmpty() : (this.getCenter(e.center), e.radius = .5 * this.getSize(nn).length()), e
|
|
}
|
|
intersect(e) {
|
|
return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this
|
|
}
|
|
union(e) {
|
|
return this.min.min(e.min), this.max.max(e.max), this
|
|
}
|
|
applyMatrix4(e) {
|
|
return this.isEmpty() || (tn[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), tn[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), tn[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), tn[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), tn[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), tn[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), tn[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), tn[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(tn)), this
|
|
}
|
|
translate(e) {
|
|
return this.min.add(e), this.max.add(e), this
|
|
}
|
|
equals(e) {
|
|
return e.min.equals(this.min) && e.max.equals(this.max)
|
|
}
|
|
}
|
|
const tn = [new Zt, new Zt, new Zt, new Zt, new Zt, new Zt, new Zt, new Zt],
|
|
nn = new Zt,
|
|
rn = new en,
|
|
an = new Zt,
|
|
sn = new Zt,
|
|
on = new Zt,
|
|
ln = new Zt,
|
|
cn = new Zt,
|
|
hn = new Zt,
|
|
un = new Zt,
|
|
dn = new Zt,
|
|
fn = new Zt,
|
|
pn = new Zt;
|
|
|
|
function mn(e, t, n, i, r) {
|
|
for (let a = 0, s = e.length - 3; a <= s; a += 3) {
|
|
pn.fromArray(e, a);
|
|
const s = r.x * Math.abs(pn.x) + r.y * Math.abs(pn.y) + r.z * Math.abs(pn.z),
|
|
o = t.dot(pn),
|
|
l = n.dot(pn),
|
|
c = i.dot(pn);
|
|
if (Math.max(-Math.max(o, l, c), Math.min(o, l, c)) > s) return !1
|
|
}
|
|
return !0
|
|
}
|
|
const gn = new en,
|
|
An = new Zt,
|
|
_n = new Zt;
|
|
class vn {
|
|
constructor(e = new Zt, t = -1) {
|
|
this.isSphere = !0, this.center = e, this.radius = t
|
|
}
|
|
set(e, t) {
|
|
return this.center.copy(e), this.radius = t, this
|
|
}
|
|
setFromPoints(e, t) {
|
|
const n = this.center;
|
|
void 0 !== t ? n.copy(t) : gn.setFromPoints(e).getCenter(n);
|
|
let i = 0;
|
|
for (let t = 0, r = e.length; t < r; t++) i = Math.max(i, n.distanceToSquared(e[t]));
|
|
return this.radius = Math.sqrt(i), this
|
|
}
|
|
copy(e) {
|
|
return this.center.copy(e.center), this.radius = e.radius, this
|
|
}
|
|
isEmpty() {
|
|
return this.radius < 0
|
|
}
|
|
makeEmpty() {
|
|
return this.center.set(0, 0, 0), this.radius = -1, this
|
|
}
|
|
containsPoint(e) {
|
|
return e.distanceToSquared(this.center) <= this.radius * this.radius
|
|
}
|
|
distanceToPoint(e) {
|
|
return e.distanceTo(this.center) - this.radius
|
|
}
|
|
intersectsSphere(e) {
|
|
const t = this.radius + e.radius;
|
|
return e.center.distanceToSquared(this.center) <= t * t
|
|
}
|
|
intersectsBox(e) {
|
|
return e.intersectsSphere(this)
|
|
}
|
|
intersectsPlane(e) {
|
|
return Math.abs(e.distanceToPoint(this.center)) <= this.radius
|
|
}
|
|
clampPoint(e, t) {
|
|
const n = this.center.distanceToSquared(e);
|
|
return t.copy(e), n > this.radius * this.radius && (t.sub(this.center).normalize(), t.multiplyScalar(this.radius).add(this.center)), t
|
|
}
|
|
getBoundingBox(e) {
|
|
return this.isEmpty() ? (e.makeEmpty(), e) : (e.set(this.center, this.center), e.expandByScalar(this.radius), e)
|
|
}
|
|
applyMatrix4(e) {
|
|
return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this
|
|
}
|
|
translate(e) {
|
|
return this.center.add(e), this
|
|
}
|
|
expandByPoint(e) {
|
|
if (this.isEmpty()) return this.center.copy(e), this.radius = 0, this;
|
|
An.subVectors(e, this.center);
|
|
const t = An.lengthSq();
|
|
if (t > this.radius * this.radius) {
|
|
const e = Math.sqrt(t),
|
|
n = .5 * (e - this.radius);
|
|
this.center.addScaledVector(An, n / e), this.radius += n
|
|
}
|
|
return this
|
|
}
|
|
union(e) {
|
|
return e.isEmpty() ? this : this.isEmpty() ? (this.copy(e), this) : (!0 === this.center.equals(e.center) ? this.radius = Math.max(this.radius, e.radius) : (_n.subVectors(e.center, this.center).setLength(e.radius), this.expandByPoint(An.copy(e.center).add(_n)), this.expandByPoint(An.copy(e.center).sub(_n))), this)
|
|
}
|
|
equals(e) {
|
|
return e.center.equals(this.center) && e.radius === this.radius
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
}
|
|
const wn = new Zt,
|
|
yn = new Zt,
|
|
xn = new Zt,
|
|
bn = new Zt,
|
|
En = new Zt,
|
|
Sn = new Zt,
|
|
Mn = new Zt;
|
|
class Tn {
|
|
constructor(e = new Zt, t = new Zt(0, 0, -1)) {
|
|
this.origin = e, this.direction = t
|
|
}
|
|
set(e, t) {
|
|
return this.origin.copy(e), this.direction.copy(t), this
|
|
}
|
|
copy(e) {
|
|
return this.origin.copy(e.origin), this.direction.copy(e.direction), this
|
|
}
|
|
at(e, t) {
|
|
return t.copy(this.origin).addScaledVector(this.direction, e)
|
|
}
|
|
lookAt(e) {
|
|
return this.direction.copy(e).sub(this.origin).normalize(), this
|
|
}
|
|
recast(e) {
|
|
return this.origin.copy(this.at(e, wn)), this
|
|
}
|
|
closestPointToPoint(e, t) {
|
|
t.subVectors(e, this.origin);
|
|
const n = t.dot(this.direction);
|
|
return n < 0 ? t.copy(this.origin) : t.copy(this.origin).addScaledVector(this.direction, n)
|
|
}
|
|
distanceToPoint(e) {
|
|
return Math.sqrt(this.distanceSqToPoint(e))
|
|
}
|
|
distanceSqToPoint(e) {
|
|
const t = wn.subVectors(e, this.origin).dot(this.direction);
|
|
return t < 0 ? this.origin.distanceToSquared(e) : (wn.copy(this.origin).addScaledVector(this.direction, t), wn.distanceToSquared(e))
|
|
}
|
|
distanceSqToSegment(e, t, n, i) {
|
|
yn.copy(e).add(t).multiplyScalar(.5), xn.copy(t).sub(e).normalize(), bn.copy(this.origin).sub(yn);
|
|
const r = .5 * e.distanceTo(t),
|
|
a = -this.direction.dot(xn),
|
|
s = bn.dot(this.direction),
|
|
o = -bn.dot(xn),
|
|
l = bn.lengthSq(),
|
|
c = Math.abs(1 - a * a);
|
|
let h, u, d, f;
|
|
if (c > 0)
|
|
if (h = a * o - s, u = a * s - o, f = r * c, h >= 0)
|
|
if (u >= -f)
|
|
if (u <= f) {
|
|
const e = 1 / c;
|
|
h *= e, u *= e, d = h * (h + a * u + 2 * s) + u * (a * h + u + 2 * o) + l
|
|
} else u = r, h = Math.max(0, -(a * u + s)), d = -h * h + u * (u + 2 * o) + l;
|
|
else u = -r, h = Math.max(0, -(a * u + s)), d = -h * h + u * (u + 2 * o) + l;
|
|
else u <= -f ? (h = Math.max(0, -(-a * r + s)), u = h > 0 ? -r : Math.min(Math.max(-r, -o), r), d = -h * h + u * (u + 2 * o) + l) : u <= f ? (h = 0, u = Math.min(Math.max(-r, -o), r), d = u * (u + 2 * o) + l) : (h = Math.max(0, -(a * r + s)), u = h > 0 ? r : Math.min(Math.max(-r, -o), r), d = -h * h + u * (u + 2 * o) + l);
|
|
else u = a > 0 ? -r : r, h = Math.max(0, -(a * u + s)), d = -h * h + u * (u + 2 * o) + l;
|
|
return n && n.copy(this.origin).addScaledVector(this.direction, h), i && i.copy(yn).addScaledVector(xn, u), d
|
|
}
|
|
intersectSphere(e, t) {
|
|
wn.subVectors(e.center, this.origin);
|
|
const n = wn.dot(this.direction),
|
|
i = wn.dot(wn) - n * n,
|
|
r = e.radius * e.radius;
|
|
if (i > r) return null;
|
|
const a = Math.sqrt(r - i),
|
|
s = n - a,
|
|
o = n + a;
|
|
return o < 0 ? null : s < 0 ? this.at(o, t) : this.at(s, t)
|
|
}
|
|
intersectsSphere(e) {
|
|
return this.distanceSqToPoint(e.center) <= e.radius * e.radius
|
|
}
|
|
distanceToPlane(e) {
|
|
const t = e.normal.dot(this.direction);
|
|
if (0 === t) return 0 === e.distanceToPoint(this.origin) ? 0 : null;
|
|
const n = -(this.origin.dot(e.normal) + e.constant) / t;
|
|
return n >= 0 ? n : null
|
|
}
|
|
intersectPlane(e, t) {
|
|
const n = this.distanceToPlane(e);
|
|
return null === n ? null : this.at(n, t)
|
|
}
|
|
intersectsPlane(e) {
|
|
const t = e.distanceToPoint(this.origin);
|
|
if (0 === t) return !0;
|
|
return e.normal.dot(this.direction) * t < 0
|
|
}
|
|
intersectBox(e, t) {
|
|
let n, i, r, a, s, o;
|
|
const l = 1 / this.direction.x,
|
|
c = 1 / this.direction.y,
|
|
h = 1 / this.direction.z,
|
|
u = this.origin;
|
|
return l >= 0 ? (n = (e.min.x - u.x) * l, i = (e.max.x - u.x) * l) : (n = (e.max.x - u.x) * l, i = (e.min.x - u.x) * l), c >= 0 ? (r = (e.min.y - u.y) * c, a = (e.max.y - u.y) * c) : (r = (e.max.y - u.y) * c, a = (e.min.y - u.y) * c), n > a || r > i ? null : ((r > n || isNaN(n)) && (n = r), (a < i || isNaN(i)) && (i = a), h >= 0 ? (s = (e.min.z - u.z) * h, o = (e.max.z - u.z) * h) : (s = (e.max.z - u.z) * h, o = (e.min.z - u.z) * h), n > o || s > i ? null : ((s > n || n != n) && (n = s), (o < i || i != i) && (i = o), i < 0 ? null : this.at(n >= 0 ? n : i, t)))
|
|
}
|
|
intersectsBox(e) {
|
|
return null !== this.intersectBox(e, wn)
|
|
}
|
|
intersectTriangle(e, t, n, i, r) {
|
|
En.subVectors(t, e), Sn.subVectors(n, e), Mn.crossVectors(En, Sn);
|
|
let a, s = this.direction.dot(Mn);
|
|
if (s > 0) {
|
|
if (i) return null;
|
|
a = 1
|
|
} else {
|
|
if (!(s < 0)) return null;
|
|
a = -1, s = -s
|
|
}
|
|
bn.subVectors(this.origin, e);
|
|
const o = a * this.direction.dot(Sn.crossVectors(bn, Sn));
|
|
if (o < 0) return null;
|
|
const l = a * this.direction.dot(En.cross(bn));
|
|
if (l < 0) return null;
|
|
if (o + l > s) return null;
|
|
const c = -a * bn.dot(Mn);
|
|
return c < 0 ? null : this.at(c / s, r)
|
|
}
|
|
applyMatrix4(e) {
|
|
return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this
|
|
}
|
|
equals(e) {
|
|
return e.origin.equals(this.origin) && e.direction.equals(this.direction)
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
}
|
|
class Cn {
|
|
constructor(e, t, n, i, r, a, s, o, l, c, h, u, d, f, p, m) {
|
|
Cn.prototype.isMatrix4 = !0, this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], void 0 !== e && this.set(e, t, n, i, r, a, s, o, l, c, h, u, d, f, p, m)
|
|
}
|
|
set(e, t, n, i, r, a, s, o, l, c, h, u, d, f, p, m) {
|
|
const g = this.elements;
|
|
return g[0] = e, g[4] = t, g[8] = n, g[12] = i, g[1] = r, g[5] = a, g[9] = s, g[13] = o, g[2] = l, g[6] = c, g[10] = h, g[14] = u, g[3] = d, g[7] = f, g[11] = p, g[15] = m, this
|
|
}
|
|
identity() {
|
|
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this
|
|
}
|
|
clone() {
|
|
return (new Cn).fromArray(this.elements)
|
|
}
|
|
copy(e) {
|
|
const t = this.elements,
|
|
n = e.elements;
|
|
return t[0] = n[0], t[1] = n[1], t[2] = n[2], t[3] = n[3], t[4] = n[4], t[5] = n[5], t[6] = n[6], t[7] = n[7], t[8] = n[8], t[9] = n[9], t[10] = n[10], t[11] = n[11], t[12] = n[12], t[13] = n[13], t[14] = n[14], t[15] = n[15], this
|
|
}
|
|
copyPosition(e) {
|
|
const t = this.elements,
|
|
n = e.elements;
|
|
return t[12] = n[12], t[13] = n[13], t[14] = n[14], this
|
|
}
|
|
setFromMatrix3(e) {
|
|
const t = e.elements;
|
|
return this.set(t[0], t[3], t[6], 0, t[1], t[4], t[7], 0, t[2], t[5], t[8], 0, 0, 0, 0, 1), this
|
|
}
|
|
extractBasis(e, t, n) {
|
|
return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), n.setFromMatrixColumn(this, 2), this
|
|
}
|
|
makeBasis(e, t, n) {
|
|
return this.set(e.x, t.x, n.x, 0, e.y, t.y, n.y, 0, e.z, t.z, n.z, 0, 0, 0, 0, 1), this
|
|
}
|
|
extractRotation(e) {
|
|
const t = this.elements,
|
|
n = e.elements,
|
|
i = 1 / In.setFromMatrixColumn(e, 0).length(),
|
|
r = 1 / In.setFromMatrixColumn(e, 1).length(),
|
|
a = 1 / In.setFromMatrixColumn(e, 2).length();
|
|
return t[0] = n[0] * i, t[1] = n[1] * i, t[2] = n[2] * i, t[3] = 0, t[4] = n[4] * r, t[5] = n[5] * r, t[6] = n[6] * r, t[7] = 0, t[8] = n[8] * a, t[9] = n[9] * a, t[10] = n[10] * a, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this
|
|
}
|
|
makeRotationFromEuler(e) {
|
|
const t = this.elements,
|
|
n = e.x,
|
|
i = e.y,
|
|
r = e.z,
|
|
a = Math.cos(n),
|
|
s = Math.sin(n),
|
|
o = Math.cos(i),
|
|
l = Math.sin(i),
|
|
c = Math.cos(r),
|
|
h = Math.sin(r);
|
|
if ("XYZ" === e.order) {
|
|
const e = a * c,
|
|
n = a * h,
|
|
i = s * c,
|
|
r = s * h;
|
|
t[0] = o * c, t[4] = -o * h, t[8] = l, t[1] = n + i * l, t[5] = e - r * l, t[9] = -s * o, t[2] = r - e * l, t[6] = i + n * l, t[10] = a * o
|
|
} else if ("YXZ" === e.order) {
|
|
const e = o * c,
|
|
n = o * h,
|
|
i = l * c,
|
|
r = l * h;
|
|
t[0] = e + r * s, t[4] = i * s - n, t[8] = a * l, t[1] = a * h, t[5] = a * c, t[9] = -s, t[2] = n * s - i, t[6] = r + e * s, t[10] = a * o
|
|
} else if ("ZXY" === e.order) {
|
|
const e = o * c,
|
|
n = o * h,
|
|
i = l * c,
|
|
r = l * h;
|
|
t[0] = e - r * s, t[4] = -a * h, t[8] = i + n * s, t[1] = n + i * s, t[5] = a * c, t[9] = r - e * s, t[2] = -a * l, t[6] = s, t[10] = a * o
|
|
} else if ("ZYX" === e.order) {
|
|
const e = a * c,
|
|
n = a * h,
|
|
i = s * c,
|
|
r = s * h;
|
|
t[0] = o * c, t[4] = i * l - n, t[8] = e * l + r, t[1] = o * h, t[5] = r * l + e, t[9] = n * l - i, t[2] = -l, t[6] = s * o, t[10] = a * o
|
|
} else if ("YZX" === e.order) {
|
|
const e = a * o,
|
|
n = a * l,
|
|
i = s * o,
|
|
r = s * l;
|
|
t[0] = o * c, t[4] = r - e * h, t[8] = i * h + n, t[1] = h, t[5] = a * c, t[9] = -s * c, t[2] = -l * c, t[6] = n * h + i, t[10] = e - r * h
|
|
} else if ("XZY" === e.order) {
|
|
const e = a * o,
|
|
n = a * l,
|
|
i = s * o,
|
|
r = s * l;
|
|
t[0] = o * c, t[4] = -h, t[8] = l * c, t[1] = e * h + r, t[5] = a * c, t[9] = n * h - i, t[2] = i * h - n, t[6] = s * c, t[10] = r * h + e
|
|
}
|
|
return t[3] = 0, t[7] = 0, t[11] = 0, t[12] = 0, t[13] = 0, t[14] = 0, t[15] = 1, this
|
|
}
|
|
makeRotationFromQuaternion(e) {
|
|
return this.compose(Pn, e, Bn)
|
|
}
|
|
lookAt(e, t, n) {
|
|
const i = this.elements;
|
|
return Un.subVectors(e, t), 0 === Un.lengthSq() && (Un.z = 1), Un.normalize(), Dn.crossVectors(n, Un), 0 === Dn.lengthSq() && (1 === Math.abs(n.z) ? Un.x += 1e-4 : Un.z += 1e-4, Un.normalize(), Dn.crossVectors(n, Un)), Dn.normalize(), Ln.crossVectors(Un, Dn), i[0] = Dn.x, i[4] = Ln.x, i[8] = Un.x, i[1] = Dn.y, i[5] = Ln.y, i[9] = Un.y, i[2] = Dn.z, i[6] = Ln.z, i[10] = Un.z, this
|
|
}
|
|
multiply(e) {
|
|
return this.multiplyMatrices(this, e)
|
|
}
|
|
premultiply(e) {
|
|
return this.multiplyMatrices(e, this)
|
|
}
|
|
multiplyMatrices(e, t) {
|
|
const n = e.elements,
|
|
i = t.elements,
|
|
r = this.elements,
|
|
a = n[0],
|
|
s = n[4],
|
|
o = n[8],
|
|
l = n[12],
|
|
c = n[1],
|
|
h = n[5],
|
|
u = n[9],
|
|
d = n[13],
|
|
f = n[2],
|
|
p = n[6],
|
|
m = n[10],
|
|
g = n[14],
|
|
A = n[3],
|
|
_ = n[7],
|
|
v = n[11],
|
|
w = n[15],
|
|
y = i[0],
|
|
x = i[4],
|
|
b = i[8],
|
|
E = i[12],
|
|
S = i[1],
|
|
M = i[5],
|
|
T = i[9],
|
|
C = i[13],
|
|
I = i[2],
|
|
R = i[6],
|
|
P = i[10],
|
|
B = i[14],
|
|
D = i[3],
|
|
L = i[7],
|
|
U = i[11],
|
|
k = i[15];
|
|
return r[0] = a * y + s * S + o * I + l * D, r[4] = a * x + s * M + o * R + l * L, r[8] = a * b + s * T + o * P + l * U, r[12] = a * E + s * C + o * B + l * k, r[1] = c * y + h * S + u * I + d * D, r[5] = c * x + h * M + u * R + d * L, r[9] = c * b + h * T + u * P + d * U, r[13] = c * E + h * C + u * B + d * k, r[2] = f * y + p * S + m * I + g * D, r[6] = f * x + p * M + m * R + g * L, r[10] = f * b + p * T + m * P + g * U, r[14] = f * E + p * C + m * B + g * k, r[3] = A * y + _ * S + v * I + w * D, r[7] = A * x + _ * M + v * R + w * L, r[11] = A * b + _ * T + v * P + w * U, r[15] = A * E + _ * C + v * B + w * k, this
|
|
}
|
|
multiplyScalar(e) {
|
|
const t = this.elements;
|
|
return t[0] *= e, t[4] *= e, t[8] *= e, t[12] *= e, t[1] *= e, t[5] *= e, t[9] *= e, t[13] *= e, t[2] *= e, t[6] *= e, t[10] *= e, t[14] *= e, t[3] *= e, t[7] *= e, t[11] *= e, t[15] *= e, this
|
|
}
|
|
determinant() {
|
|
const e = this.elements,
|
|
t = e[0],
|
|
n = e[4],
|
|
i = e[8],
|
|
r = e[12],
|
|
a = e[1],
|
|
s = e[5],
|
|
o = e[9],
|
|
l = e[13],
|
|
c = e[2],
|
|
h = e[6],
|
|
u = e[10],
|
|
d = e[14];
|
|
return e[3] * (+r * o * h - i * l * h - r * s * u + n * l * u + i * s * d - n * o * d) + e[7] * (+t * o * d - t * l * u + r * a * u - i * a * d + i * l * c - r * o * c) + e[11] * (+t * l * h - t * s * d - r * a * h + n * a * d + r * s * c - n * l * c) + e[15] * (-i * s * c - t * o * h + t * s * u + i * a * h - n * a * u + n * o * c)
|
|
}
|
|
transpose() {
|
|
const e = this.elements;
|
|
let t;
|
|
return t = e[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], e[8] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[7], e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this
|
|
}
|
|
setPosition(e, t, n) {
|
|
const i = this.elements;
|
|
return e.isVector3 ? (i[12] = e.x, i[13] = e.y, i[14] = e.z) : (i[12] = e, i[13] = t, i[14] = n), this
|
|
}
|
|
invert() {
|
|
const e = this.elements,
|
|
t = e[0],
|
|
n = e[1],
|
|
i = e[2],
|
|
r = e[3],
|
|
a = e[4],
|
|
s = e[5],
|
|
o = e[6],
|
|
l = e[7],
|
|
c = e[8],
|
|
h = e[9],
|
|
u = e[10],
|
|
d = e[11],
|
|
f = e[12],
|
|
p = e[13],
|
|
m = e[14],
|
|
g = e[15],
|
|
A = h * m * l - p * u * l + p * o * d - s * m * d - h * o * g + s * u * g,
|
|
_ = f * u * l - c * m * l - f * o * d + a * m * d + c * o * g - a * u * g,
|
|
v = c * p * l - f * h * l + f * s * d - a * p * d - c * s * g + a * h * g,
|
|
w = f * h * o - c * p * o - f * s * u + a * p * u + c * s * m - a * h * m,
|
|
y = t * A + n * _ + i * v + r * w;
|
|
if (0 === y) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
const x = 1 / y;
|
|
return e[0] = A * x, e[1] = (p * u * r - h * m * r - p * i * d + n * m * d + h * i * g - n * u * g) * x, e[2] = (s * m * r - p * o * r + p * i * l - n * m * l - s * i * g + n * o * g) * x, e[3] = (h * o * r - s * u * r - h * i * l + n * u * l + s * i * d - n * o * d) * x, e[4] = _ * x, e[5] = (c * m * r - f * u * r + f * i * d - t * m * d - c * i * g + t * u * g) * x, e[6] = (f * o * r - a * m * r - f * i * l + t * m * l + a * i * g - t * o * g) * x, e[7] = (a * u * r - c * o * r + c * i * l - t * u * l - a * i * d + t * o * d) * x, e[8] = v * x, e[9] = (f * h * r - c * p * r - f * n * d + t * p * d + c * n * g - t * h * g) * x, e[10] = (a * p * r - f * s * r + f * n * l - t * p * l - a * n * g + t * s * g) * x, e[11] = (c * s * r - a * h * r - c * n * l + t * h * l + a * n * d - t * s * d) * x, e[12] = w * x, e[13] = (c * p * i - f * h * i + f * n * u - t * p * u - c * n * m + t * h * m) * x, e[14] = (f * s * i - a * p * i - f * n * o + t * p * o + a * n * m - t * s * m) * x, e[15] = (a * h * i - c * s * i + c * n * o - t * h * o - a * n * u + t * s * u) * x, this
|
|
}
|
|
scale(e) {
|
|
const t = this.elements,
|
|
n = e.x,
|
|
i = e.y,
|
|
r = e.z;
|
|
return t[0] *= n, t[4] *= i, t[8] *= r, t[1] *= n, t[5] *= i, t[9] *= r, t[2] *= n, t[6] *= i, t[10] *= r, t[3] *= n, t[7] *= i, t[11] *= r, this
|
|
}
|
|
getMaxScaleOnAxis() {
|
|
const e = this.elements,
|
|
t = e[0] * e[0] + e[1] * e[1] + e[2] * e[2],
|
|
n = e[4] * e[4] + e[5] * e[5] + e[6] * e[6],
|
|
i = e[8] * e[8] + e[9] * e[9] + e[10] * e[10];
|
|
return Math.sqrt(Math.max(t, n, i))
|
|
}
|
|
makeTranslation(e, t, n) {
|
|
return e.isVector3 ? this.set(1, 0, 0, e.x, 0, 1, 0, e.y, 0, 0, 1, e.z, 0, 0, 0, 1) : this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1), this
|
|
}
|
|
makeRotationX(e) {
|
|
const t = Math.cos(e),
|
|
n = Math.sin(e);
|
|
return this.set(1, 0, 0, 0, 0, t, -n, 0, 0, n, t, 0, 0, 0, 0, 1), this
|
|
}
|
|
makeRotationY(e) {
|
|
const t = Math.cos(e),
|
|
n = Math.sin(e);
|
|
return this.set(t, 0, n, 0, 0, 1, 0, 0, -n, 0, t, 0, 0, 0, 0, 1), this
|
|
}
|
|
makeRotationZ(e) {
|
|
const t = Math.cos(e),
|
|
n = Math.sin(e);
|
|
return this.set(t, -n, 0, 0, n, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this
|
|
}
|
|
makeRotationAxis(e, t) {
|
|
const n = Math.cos(t),
|
|
i = Math.sin(t),
|
|
r = 1 - n,
|
|
a = e.x,
|
|
s = e.y,
|
|
o = e.z,
|
|
l = r * a,
|
|
c = r * s;
|
|
return this.set(l * a + n, l * s - i * o, l * o + i * s, 0, l * s + i * o, c * s + n, c * o - i * a, 0, l * o - i * s, c * o + i * a, r * o * o + n, 0, 0, 0, 0, 1), this
|
|
}
|
|
makeScale(e, t, n) {
|
|
return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, n, 0, 0, 0, 0, 1), this
|
|
}
|
|
makeShear(e, t, n, i, r, a) {
|
|
return this.set(1, n, r, 0, e, 1, a, 0, t, i, 1, 0, 0, 0, 0, 1), this
|
|
}
|
|
compose(e, t, n) {
|
|
const i = this.elements,
|
|
r = t._x,
|
|
a = t._y,
|
|
s = t._z,
|
|
o = t._w,
|
|
l = r + r,
|
|
c = a + a,
|
|
h = s + s,
|
|
u = r * l,
|
|
d = r * c,
|
|
f = r * h,
|
|
p = a * c,
|
|
m = a * h,
|
|
g = s * h,
|
|
A = o * l,
|
|
_ = o * c,
|
|
v = o * h,
|
|
w = n.x,
|
|
y = n.y,
|
|
x = n.z;
|
|
return i[0] = (1 - (p + g)) * w, i[1] = (d + v) * w, i[2] = (f - _) * w, i[3] = 0, i[4] = (d - v) * y, i[5] = (1 - (u + g)) * y, i[6] = (m + A) * y, i[7] = 0, i[8] = (f + _) * x, i[9] = (m - A) * x, i[10] = (1 - (u + p)) * x, i[11] = 0, i[12] = e.x, i[13] = e.y, i[14] = e.z, i[15] = 1, this
|
|
}
|
|
decompose(e, t, n) {
|
|
const i = this.elements;
|
|
let r = In.set(i[0], i[1], i[2]).length();
|
|
const a = In.set(i[4], i[5], i[6]).length(),
|
|
s = In.set(i[8], i[9], i[10]).length();
|
|
this.determinant() < 0 && (r = -r), e.x = i[12], e.y = i[13], e.z = i[14], Rn.copy(this);
|
|
const o = 1 / r,
|
|
l = 1 / a,
|
|
c = 1 / s;
|
|
return Rn.elements[0] *= o, Rn.elements[1] *= o, Rn.elements[2] *= o, Rn.elements[4] *= l, Rn.elements[5] *= l, Rn.elements[6] *= l, Rn.elements[8] *= c, Rn.elements[9] *= c, Rn.elements[10] *= c, t.setFromRotationMatrix(Rn), n.x = r, n.y = a, n.z = s, this
|
|
}
|
|
makePerspective(e, t, n, i, r, a, s = 2e3) {
|
|
const o = this.elements,
|
|
l = 2 * r / (t - e),
|
|
c = 2 * r / (n - i),
|
|
h = (t + e) / (t - e),
|
|
u = (n + i) / (n - i);
|
|
let d, f;
|
|
if (s === ht) d = -(a + r) / (a - r), f = -2 * a * r / (a - r);
|
|
else {
|
|
if (s !== ut) throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: " + s);
|
|
d = -a / (a - r), f = -a * r / (a - r)
|
|
}
|
|
return o[0] = l, o[4] = 0, o[8] = h, o[12] = 0, o[1] = 0, o[5] = c, o[9] = u, o[13] = 0, o[2] = 0, o[6] = 0, o[10] = d, o[14] = f, o[3] = 0, o[7] = 0, o[11] = -1, o[15] = 0, this
|
|
}
|
|
makeOrthographic(e, t, n, i, r, a, s = 2e3) {
|
|
const o = this.elements,
|
|
l = 1 / (t - e),
|
|
c = 1 / (n - i),
|
|
h = 1 / (a - r),
|
|
u = (t + e) * l,
|
|
d = (n + i) * c;
|
|
let f, p;
|
|
if (s === ht) f = (a + r) * h, p = -2 * h;
|
|
else {
|
|
if (s !== ut) throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: " + s);
|
|
f = r * h, p = -1 * h
|
|
}
|
|
return o[0] = 2 * l, o[4] = 0, o[8] = 0, o[12] = -u, o[1] = 0, o[5] = 2 * c, o[9] = 0, o[13] = -d, o[2] = 0, o[6] = 0, o[10] = p, o[14] = -f, o[3] = 0, o[7] = 0, o[11] = 0, o[15] = 1, this
|
|
}
|
|
equals(e) {
|
|
const t = this.elements,
|
|
n = e.elements;
|
|
for (let e = 0; e < 16; e++)
|
|
if (t[e] !== n[e]) return !1;
|
|
return !0
|
|
}
|
|
fromArray(e, t = 0) {
|
|
for (let n = 0; n < 16; n++) this.elements[n] = e[n + t];
|
|
return this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
const n = this.elements;
|
|
return e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2], e[t + 3] = n[3], e[t + 4] = n[4], e[t + 5] = n[5], e[t + 6] = n[6], e[t + 7] = n[7], e[t + 8] = n[8], e[t + 9] = n[9], e[t + 10] = n[10], e[t + 11] = n[11], e[t + 12] = n[12], e[t + 13] = n[13], e[t + 14] = n[14], e[t + 15] = n[15], e
|
|
}
|
|
}
|
|
const In = new Zt,
|
|
Rn = new Cn,
|
|
Pn = new Zt(0, 0, 0),
|
|
Bn = new Zt(1, 1, 1),
|
|
Dn = new Zt,
|
|
Ln = new Zt,
|
|
Un = new Zt,
|
|
kn = new Cn,
|
|
Nn = new Kt;
|
|
class Fn {
|
|
constructor(e = 0, t = 0, n = 0, i = Fn.DEFAULT_ORDER) {
|
|
this.isEuler = !0, this._x = e, this._y = t, this._z = n, this._order = i
|
|
}
|
|
get x() {
|
|
return this._x
|
|
}
|
|
set x(e) {
|
|
this._x = e, this._onChangeCallback()
|
|
}
|
|
get y() {
|
|
return this._y
|
|
}
|
|
set y(e) {
|
|
this._y = e, this._onChangeCallback()
|
|
}
|
|
get z() {
|
|
return this._z
|
|
}
|
|
set z(e) {
|
|
this._z = e, this._onChangeCallback()
|
|
}
|
|
get order() {
|
|
return this._order
|
|
}
|
|
set order(e) {
|
|
this._order = e, this._onChangeCallback()
|
|
}
|
|
set(e, t, n, i = this._order) {
|
|
return this._x = e, this._y = t, this._z = n, this._order = i, this._onChangeCallback(), this
|
|
}
|
|
clone() {
|
|
return new this.constructor(this._x, this._y, this._z, this._order)
|
|
}
|
|
copy(e) {
|
|
return this._x = e._x, this._y = e._y, this._z = e._z, this._order = e._order, this._onChangeCallback(), this
|
|
}
|
|
setFromRotationMatrix(e, t = this._order, n = !0) {
|
|
const i = e.elements,
|
|
r = i[0],
|
|
a = i[4],
|
|
s = i[8],
|
|
o = i[1],
|
|
l = i[5],
|
|
c = i[9],
|
|
h = i[2],
|
|
u = i[6],
|
|
d = i[10];
|
|
switch (t) {
|
|
case "XYZ":
|
|
this._y = Math.asin(_t(s, -1, 1)), Math.abs(s) < .9999999 ? (this._x = Math.atan2(-c, d), this._z = Math.atan2(-a, r)) : (this._x = Math.atan2(u, l), this._z = 0);
|
|
break;
|
|
case "YXZ":
|
|
this._x = Math.asin(-_t(c, -1, 1)), Math.abs(c) < .9999999 ? (this._y = Math.atan2(s, d), this._z = Math.atan2(o, l)) : (this._y = Math.atan2(-h, r), this._z = 0);
|
|
break;
|
|
case "ZXY":
|
|
this._x = Math.asin(_t(u, -1, 1)), Math.abs(u) < .9999999 ? (this._y = Math.atan2(-h, d), this._z = Math.atan2(-a, l)) : (this._y = 0, this._z = Math.atan2(o, r));
|
|
break;
|
|
case "ZYX":
|
|
this._y = Math.asin(-_t(h, -1, 1)), Math.abs(h) < .9999999 ? (this._x = Math.atan2(u, d), this._z = Math.atan2(o, r)) : (this._x = 0, this._z = Math.atan2(-a, l));
|
|
break;
|
|
case "YZX":
|
|
this._z = Math.asin(_t(o, -1, 1)), Math.abs(o) < .9999999 ? (this._x = Math.atan2(-c, l), this._y = Math.atan2(-h, r)) : (this._x = 0, this._y = Math.atan2(s, d));
|
|
break;
|
|
case "XZY":
|
|
this._z = Math.asin(-_t(a, -1, 1)), Math.abs(a) < .9999999 ? (this._x = Math.atan2(u, l), this._y = Math.atan2(s, r)) : (this._x = Math.atan2(-c, d), this._y = 0);
|
|
break;
|
|
default:
|
|
console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: " + t)
|
|
}
|
|
return this._order = t, !0 === n && this._onChangeCallback(), this
|
|
}
|
|
setFromQuaternion(e, t, n) {
|
|
return kn.makeRotationFromQuaternion(e), this.setFromRotationMatrix(kn, t, n)
|
|
}
|
|
setFromVector3(e, t = this._order) {
|
|
return this.set(e.x, e.y, e.z, t)
|
|
}
|
|
reorder(e) {
|
|
return Nn.setFromEuler(this), this.setFromQuaternion(Nn, e)
|
|
}
|
|
equals(e) {
|
|
return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order
|
|
}
|
|
fromArray(e) {
|
|
return this._x = e[0], this._y = e[1], this._z = e[2], void 0 !== e[3] && (this._order = e[3]), this._onChangeCallback(), this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
return e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e
|
|
}
|
|
_onChange(e) {
|
|
return this._onChangeCallback = e, this
|
|
}
|
|
_onChangeCallback() {}*[Symbol.iterator]() {
|
|
yield this._x, yield this._y, yield this._z, yield this._order
|
|
}
|
|
}
|
|
Fn.DEFAULT_ORDER = "XYZ";
|
|
class On {
|
|
constructor() {
|
|
this.mask = 1
|
|
}
|
|
set(e) {
|
|
this.mask = 1 << e >>> 0
|
|
}
|
|
enable(e) {
|
|
this.mask |= 1 << e
|
|
}
|
|
enableAll() {
|
|
this.mask = -1
|
|
}
|
|
toggle(e) {
|
|
this.mask ^= 1 << e
|
|
}
|
|
disable(e) {
|
|
this.mask &= ~(1 << e)
|
|
}
|
|
disableAll() {
|
|
this.mask = 0
|
|
}
|
|
test(e) {
|
|
return !!(this.mask & e.mask)
|
|
}
|
|
isEnabled(e) {
|
|
return !!(this.mask & 1 << e)
|
|
}
|
|
}
|
|
let zn = 0;
|
|
const Wn = new Zt,
|
|
Hn = new Kt,
|
|
Vn = new Cn,
|
|
Gn = new Zt,
|
|
Qn = new Zt,
|
|
Xn = new Zt,
|
|
jn = new Kt,
|
|
qn = new Zt(1, 0, 0),
|
|
Yn = new Zt(0, 1, 0),
|
|
Kn = new Zt(0, 0, 1),
|
|
Zn = {
|
|
type: "added"
|
|
},
|
|
Jn = {
|
|
type: "removed"
|
|
},
|
|
$n = {
|
|
type: "childadded",
|
|
child: null
|
|
},
|
|
ei = {
|
|
type: "childremoved",
|
|
child: null
|
|
};
|
|
class ti extends dt {
|
|
constructor() {
|
|
super(), this.isObject3D = !0, Object.defineProperty(this, "id", {
|
|
value: zn++
|
|
}), this.uuid = At(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = ti.DEFAULT_UP.clone();
|
|
const e = new Zt,
|
|
t = new Fn,
|
|
n = new Kt,
|
|
i = new Zt(1, 1, 1);
|
|
t._onChange((function() {
|
|
n.setFromEuler(t, !1)
|
|
})), n._onChange((function() {
|
|
t.setFromQuaternion(n, void 0, !1)
|
|
})), Object.defineProperties(this, {
|
|
position: {
|
|
configurable: !0,
|
|
enumerable: !0,
|
|
value: e
|
|
},
|
|
rotation: {
|
|
configurable: !0,
|
|
enumerable: !0,
|
|
value: t
|
|
},
|
|
quaternion: {
|
|
configurable: !0,
|
|
enumerable: !0,
|
|
value: n
|
|
},
|
|
scale: {
|
|
configurable: !0,
|
|
enumerable: !0,
|
|
value: i
|
|
},
|
|
modelViewMatrix: {
|
|
value: new Cn
|
|
},
|
|
normalMatrix: {
|
|
value: new St
|
|
}
|
|
}), this.matrix = new Cn, this.matrixWorld = new Cn, this.matrixAutoUpdate = ti.DEFAULT_MATRIX_AUTO_UPDATE, this.matrixWorldAutoUpdate = ti.DEFAULT_MATRIX_WORLD_AUTO_UPDATE, this.matrixWorldNeedsUpdate = !1, this.layers = new On, this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.animations = [], this.userData = {}
|
|
}
|
|
onBeforeShadow() {}
|
|
onAfterShadow() {}
|
|
onBeforeRender() {}
|
|
onAfterRender() {}
|
|
applyMatrix4(e) {
|
|
this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale)
|
|
}
|
|
applyQuaternion(e) {
|
|
return this.quaternion.premultiply(e), this
|
|
}
|
|
setRotationFromAxisAngle(e, t) {
|
|
this.quaternion.setFromAxisAngle(e, t)
|
|
}
|
|
setRotationFromEuler(e) {
|
|
this.quaternion.setFromEuler(e, !0)
|
|
}
|
|
setRotationFromMatrix(e) {
|
|
this.quaternion.setFromRotationMatrix(e)
|
|
}
|
|
setRotationFromQuaternion(e) {
|
|
this.quaternion.copy(e)
|
|
}
|
|
rotateOnAxis(e, t) {
|
|
return Hn.setFromAxisAngle(e, t), this.quaternion.multiply(Hn), this
|
|
}
|
|
rotateOnWorldAxis(e, t) {
|
|
return Hn.setFromAxisAngle(e, t), this.quaternion.premultiply(Hn), this
|
|
}
|
|
rotateX(e) {
|
|
return this.rotateOnAxis(qn, e)
|
|
}
|
|
rotateY(e) {
|
|
return this.rotateOnAxis(Yn, e)
|
|
}
|
|
rotateZ(e) {
|
|
return this.rotateOnAxis(Kn, e)
|
|
}
|
|
translateOnAxis(e, t) {
|
|
return Wn.copy(e).applyQuaternion(this.quaternion), this.position.add(Wn.multiplyScalar(t)), this
|
|
}
|
|
translateX(e) {
|
|
return this.translateOnAxis(qn, e)
|
|
}
|
|
translateY(e) {
|
|
return this.translateOnAxis(Yn, e)
|
|
}
|
|
translateZ(e) {
|
|
return this.translateOnAxis(Kn, e)
|
|
}
|
|
localToWorld(e) {
|
|
return this.updateWorldMatrix(!0, !1), e.applyMatrix4(this.matrixWorld)
|
|
}
|
|
worldToLocal(e) {
|
|
return this.updateWorldMatrix(!0, !1), e.applyMatrix4(Vn.copy(this.matrixWorld).invert())
|
|
}
|
|
lookAt(e, t, n) {
|
|
e.isVector3 ? Gn.copy(e) : Gn.set(e, t, n);
|
|
const i = this.parent;
|
|
this.updateWorldMatrix(!0, !1), Qn.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Vn.lookAt(Qn, Gn, this.up) : Vn.lookAt(Gn, Qn, this.up), this.quaternion.setFromRotationMatrix(Vn), i && (Vn.extractRotation(i.matrixWorld), Hn.setFromRotationMatrix(Vn), this.quaternion.premultiply(Hn.invert()))
|
|
}
|
|
add(e) {
|
|
if (arguments.length > 1) {
|
|
for (let e = 0; e < arguments.length; e++) this.add(arguments[e]);
|
|
return this
|
|
}
|
|
return e === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (e.removeFromParent(), e.parent = this, this.children.push(e), e.dispatchEvent(Zn), $n.child = e, this.dispatchEvent($n), $n.child = null) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this)
|
|
}
|
|
remove(e) {
|
|
if (arguments.length > 1) {
|
|
for (let e = 0; e < arguments.length; e++) this.remove(arguments[e]);
|
|
return this
|
|
}
|
|
const t = this.children.indexOf(e);
|
|
return -1 !== t && (e.parent = null, this.children.splice(t, 1), e.dispatchEvent(Jn), ei.child = e, this.dispatchEvent(ei), ei.child = null), this
|
|
}
|
|
removeFromParent() {
|
|
const e = this.parent;
|
|
return null !== e && e.remove(this), this
|
|
}
|
|
clear() {
|
|
return this.remove(...this.children)
|
|
}
|
|
attach(e) {
|
|
return this.updateWorldMatrix(!0, !1), Vn.copy(this.matrixWorld).invert(), null !== e.parent && (e.parent.updateWorldMatrix(!0, !1), Vn.multiply(e.parent.matrixWorld)), e.applyMatrix4(Vn), e.removeFromParent(), e.parent = this, this.children.push(e), e.updateWorldMatrix(!1, !0), e.dispatchEvent(Zn), $n.child = e, this.dispatchEvent($n), $n.child = null, this
|
|
}
|
|
getObjectById(e) {
|
|
return this.getObjectByProperty("id", e)
|
|
}
|
|
getObjectByName(e) {
|
|
return this.getObjectByProperty("name", e)
|
|
}
|
|
getObjectByProperty(e, t) {
|
|
if (this[e] === t) return this;
|
|
for (let n = 0, i = this.children.length; n < i; n++) {
|
|
const i = this.children[n].getObjectByProperty(e, t);
|
|
if (void 0 !== i) return i
|
|
}
|
|
}
|
|
getObjectsByProperty(e, t, n = []) {
|
|
this[e] === t && n.push(this);
|
|
const i = this.children;
|
|
for (let r = 0, a = i.length; r < a; r++) i[r].getObjectsByProperty(e, t, n);
|
|
return n
|
|
}
|
|
getWorldPosition(e) {
|
|
return this.updateWorldMatrix(!0, !1), e.setFromMatrixPosition(this.matrixWorld)
|
|
}
|
|
getWorldQuaternion(e) {
|
|
return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Qn, e, Xn), e
|
|
}
|
|
getWorldScale(e) {
|
|
return this.updateWorldMatrix(!0, !1), this.matrixWorld.decompose(Qn, jn, e), e
|
|
}
|
|
getWorldDirection(e) {
|
|
this.updateWorldMatrix(!0, !1);
|
|
const t = this.matrixWorld.elements;
|
|
return e.set(t[8], t[9], t[10]).normalize()
|
|
}
|
|
raycast() {}
|
|
traverse(e) {
|
|
e(this);
|
|
const t = this.children;
|
|
for (let n = 0, i = t.length; n < i; n++) t[n].traverse(e)
|
|
}
|
|
traverseVisible(e) {
|
|
if (!1 === this.visible) return;
|
|
e(this);
|
|
const t = this.children;
|
|
for (let n = 0, i = t.length; n < i; n++) t[n].traverseVisible(e)
|
|
}
|
|
traverseAncestors(e) {
|
|
const t = this.parent;
|
|
null !== t && (e(t), t.traverseAncestors(e))
|
|
}
|
|
updateMatrix() {
|
|
this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0
|
|
}
|
|
updateMatrixWorld(e) {
|
|
this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (!0 === this.matrixWorldAutoUpdate && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), this.matrixWorldNeedsUpdate = !1, e = !0);
|
|
const t = this.children;
|
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
t[n].updateMatrixWorld(e)
|
|
}
|
|
}
|
|
updateWorldMatrix(e, t) {
|
|
const n = this.parent;
|
|
if (!0 === e && null !== n && n.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), !0 === this.matrixWorldAutoUpdate && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix)), !0 === t) {
|
|
const e = this.children;
|
|
for (let t = 0, n = e.length; t < n; t++) {
|
|
e[t].updateWorldMatrix(!1, !0)
|
|
}
|
|
}
|
|
}
|
|
toJSON(e) {
|
|
const t = void 0 === e || "string" == typeof e,
|
|
n = {};
|
|
t && (e = {
|
|
geometries: {},
|
|
materials: {},
|
|
textures: {},
|
|
images: {},
|
|
shapes: {},
|
|
skeletons: {},
|
|
animations: {},
|
|
nodes: {}
|
|
}, n.metadata = {
|
|
version: 4.6,
|
|
type: "Object",
|
|
generator: "Object3D.toJSON"
|
|
});
|
|
const i = {};
|
|
|
|
function r(t, n) {
|
|
return void 0 === t[n.uuid] && (t[n.uuid] = n.toJSON(e)), n.uuid
|
|
}
|
|
if (i.uuid = this.uuid, i.type = this.type, "" !== this.name && (i.name = this.name), !0 === this.castShadow && (i.castShadow = !0), !0 === this.receiveShadow && (i.receiveShadow = !0), !1 === this.visible && (i.visible = !1), !1 === this.frustumCulled && (i.frustumCulled = !1), 0 !== this.renderOrder && (i.renderOrder = this.renderOrder), Object.keys(this.userData).length > 0 && (i.userData = this.userData), i.layers = this.layers.mask, i.matrix = this.matrix.toArray(), i.up = this.up.toArray(), !1 === this.matrixAutoUpdate && (i.matrixAutoUpdate = !1), this.isInstancedMesh && (i.type = "InstancedMesh", i.count = this.count, i.instanceMatrix = this.instanceMatrix.toJSON(), null !== this.instanceColor && (i.instanceColor = this.instanceColor.toJSON())), this.isBatchedMesh && (i.type = "BatchedMesh", i.perObjectFrustumCulled = this.perObjectFrustumCulled, i.sortObjects = this.sortObjects, i.drawRanges = this._drawRanges, i.reservedRanges = this._reservedRanges, i.visibility = this._visibility, i.active = this._active, i.bounds = this._bounds.map((e => ({
|
|
boxInitialized: e.boxInitialized,
|
|
boxMin: e.box.min.toArray(),
|
|
boxMax: e.box.max.toArray(),
|
|
sphereInitialized: e.sphereInitialized,
|
|
sphereRadius: e.sphere.radius,
|
|
sphereCenter: e.sphere.center.toArray()
|
|
}))), i.maxInstanceCount = this._maxInstanceCount, i.maxVertexCount = this._maxVertexCount, i.maxIndexCount = this._maxIndexCount, i.geometryInitialized = this._geometryInitialized, i.geometryCount = this._geometryCount, i.matricesTexture = this._matricesTexture.toJSON(e), null !== this._colorsTexture && (i.colorsTexture = this._colorsTexture.toJSON(e)), null !== this.boundingSphere && (i.boundingSphere = {
|
|
center: i.boundingSphere.center.toArray(),
|
|
radius: i.boundingSphere.radius
|
|
}), null !== this.boundingBox && (i.boundingBox = {
|
|
min: i.boundingBox.min.toArray(),
|
|
max: i.boundingBox.max.toArray()
|
|
})), this.isScene) this.background && (this.background.isColor ? i.background = this.background.toJSON() : this.background.isTexture && (i.background = this.background.toJSON(e).uuid)), this.environment && this.environment.isTexture && !0 !== this.environment.isRenderTargetTexture && (i.environment = this.environment.toJSON(e).uuid);
|
|
else if (this.isMesh || this.isLine || this.isPoints) {
|
|
i.geometry = r(e.geometries, this.geometry);
|
|
const t = this.geometry.parameters;
|
|
if (void 0 !== t && void 0 !== t.shapes) {
|
|
const n = t.shapes;
|
|
if (Array.isArray(n))
|
|
for (let t = 0, i = n.length; t < i; t++) {
|
|
const i = n[t];
|
|
r(e.shapes, i)
|
|
} else r(e.shapes, n)
|
|
}
|
|
}
|
|
if (this.isSkinnedMesh && (i.bindMode = this.bindMode, i.bindMatrix = this.bindMatrix.toArray(), void 0 !== this.skeleton && (r(e.skeletons, this.skeleton), i.skeleton = this.skeleton.uuid)), void 0 !== this.material)
|
|
if (Array.isArray(this.material)) {
|
|
const t = [];
|
|
for (let n = 0, i = this.material.length; n < i; n++) t.push(r(e.materials, this.material[n]));
|
|
i.material = t
|
|
} else i.material = r(e.materials, this.material);
|
|
if (this.children.length > 0) {
|
|
i.children = [];
|
|
for (let t = 0; t < this.children.length; t++) i.children.push(this.children[t].toJSON(e).object)
|
|
}
|
|
if (this.animations.length > 0) {
|
|
i.animations = [];
|
|
for (let t = 0; t < this.animations.length; t++) {
|
|
const n = this.animations[t];
|
|
i.animations.push(r(e.animations, n))
|
|
}
|
|
}
|
|
if (t) {
|
|
const t = a(e.geometries),
|
|
i = a(e.materials),
|
|
r = a(e.textures),
|
|
s = a(e.images),
|
|
o = a(e.shapes),
|
|
l = a(e.skeletons),
|
|
c = a(e.animations),
|
|
h = a(e.nodes);
|
|
t.length > 0 && (n.geometries = t), i.length > 0 && (n.materials = i), r.length > 0 && (n.textures = r), s.length > 0 && (n.images = s), o.length > 0 && (n.shapes = o), l.length > 0 && (n.skeletons = l), c.length > 0 && (n.animations = c), h.length > 0 && (n.nodes = h)
|
|
}
|
|
return n.object = i, n;
|
|
|
|
function a(e) {
|
|
const t = [];
|
|
for (const n in e) {
|
|
const i = e[n];
|
|
delete i.metadata, t.push(i)
|
|
}
|
|
return t
|
|
}
|
|
}
|
|
clone(e) {
|
|
return (new this.constructor).copy(this, e)
|
|
}
|
|
copy(e, t = !0) {
|
|
if (this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.rotation.order = e.rotation.order, this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldAutoUpdate = e.matrixWorldAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.animations = e.animations.slice(), this.userData = JSON.parse(JSON.stringify(e.userData)), !0 === t)
|
|
for (let t = 0; t < e.children.length; t++) {
|
|
const n = e.children[t];
|
|
this.add(n.clone())
|
|
}
|
|
return this
|
|
}
|
|
}
|
|
ti.DEFAULT_UP = new Zt(0, 1, 0), ti.DEFAULT_MATRIX_AUTO_UPDATE = !0, ti.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = !0;
|
|
const ni = new Zt,
|
|
ii = new Zt,
|
|
ri = new Zt,
|
|
ai = new Zt,
|
|
si = new Zt,
|
|
oi = new Zt,
|
|
li = new Zt,
|
|
ci = new Zt,
|
|
hi = new Zt,
|
|
ui = new Zt,
|
|
di = new Qt,
|
|
fi = new Qt,
|
|
pi = new Qt;
|
|
class mi {
|
|
constructor(e = new Zt, t = new Zt, n = new Zt) {
|
|
this.a = e, this.b = t, this.c = n
|
|
}
|
|
static getNormal(e, t, n, i) {
|
|
i.subVectors(n, t), ni.subVectors(e, t), i.cross(ni);
|
|
const r = i.lengthSq();
|
|
return r > 0 ? i.multiplyScalar(1 / Math.sqrt(r)) : i.set(0, 0, 0)
|
|
}
|
|
static getBarycoord(e, t, n, i, r) {
|
|
ni.subVectors(i, t), ii.subVectors(n, t), ri.subVectors(e, t);
|
|
const a = ni.dot(ni),
|
|
s = ni.dot(ii),
|
|
o = ni.dot(ri),
|
|
l = ii.dot(ii),
|
|
c = ii.dot(ri),
|
|
h = a * l - s * s;
|
|
if (0 === h) return r.set(0, 0, 0), null;
|
|
const u = 1 / h,
|
|
d = (l * o - s * c) * u,
|
|
f = (a * c - s * o) * u;
|
|
return r.set(1 - d - f, f, d)
|
|
}
|
|
static containsPoint(e, t, n, i) {
|
|
return null !== this.getBarycoord(e, t, n, i, ai) && (ai.x >= 0 && ai.y >= 0 && ai.x + ai.y <= 1)
|
|
}
|
|
static getInterpolation(e, t, n, i, r, a, s, o) {
|
|
return null === this.getBarycoord(e, t, n, i, ai) ? (o.x = 0, o.y = 0, "z" in o && (o.z = 0), "w" in o && (o.w = 0), null) : (o.setScalar(0), o.addScaledVector(r, ai.x), o.addScaledVector(a, ai.y), o.addScaledVector(s, ai.z), o)
|
|
}
|
|
static getInterpolatedAttribute(e, t, n, i, r, a) {
|
|
return di.setScalar(0), fi.setScalar(0), pi.setScalar(0), di.fromBufferAttribute(e, t), fi.fromBufferAttribute(e, n), pi.fromBufferAttribute(e, i), a.setScalar(0), a.addScaledVector(di, r.x), a.addScaledVector(fi, r.y), a.addScaledVector(pi, r.z), a
|
|
}
|
|
static isFrontFacing(e, t, n, i) {
|
|
return ni.subVectors(n, t), ii.subVectors(e, t), ni.cross(ii).dot(i) < 0
|
|
}
|
|
set(e, t, n) {
|
|
return this.a.copy(e), this.b.copy(t), this.c.copy(n), this
|
|
}
|
|
setFromPointsAndIndices(e, t, n, i) {
|
|
return this.a.copy(e[t]), this.b.copy(e[n]), this.c.copy(e[i]), this
|
|
}
|
|
setFromAttributeAndIndices(e, t, n, i) {
|
|
return this.a.fromBufferAttribute(e, t), this.b.fromBufferAttribute(e, n), this.c.fromBufferAttribute(e, i), this
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
copy(e) {
|
|
return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this
|
|
}
|
|
getArea() {
|
|
return ni.subVectors(this.c, this.b), ii.subVectors(this.a, this.b), .5 * ni.cross(ii).length()
|
|
}
|
|
getMidpoint(e) {
|
|
return e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3)
|
|
}
|
|
getNormal(e) {
|
|
return mi.getNormal(this.a, this.b, this.c, e)
|
|
}
|
|
getPlane(e) {
|
|
return e.setFromCoplanarPoints(this.a, this.b, this.c)
|
|
}
|
|
getBarycoord(e, t) {
|
|
return mi.getBarycoord(e, this.a, this.b, this.c, t)
|
|
}
|
|
getInterpolation(e, t, n, i, r) {
|
|
return mi.getInterpolation(e, this.a, this.b, this.c, t, n, i, r)
|
|
}
|
|
containsPoint(e) {
|
|
return mi.containsPoint(e, this.a, this.b, this.c)
|
|
}
|
|
isFrontFacing(e) {
|
|
return mi.isFrontFacing(this.a, this.b, this.c, e)
|
|
}
|
|
intersectsBox(e) {
|
|
return e.intersectsTriangle(this)
|
|
}
|
|
closestPointToPoint(e, t) {
|
|
const n = this.a,
|
|
i = this.b,
|
|
r = this.c;
|
|
let a, s;
|
|
si.subVectors(i, n), oi.subVectors(r, n), ci.subVectors(e, n);
|
|
const o = si.dot(ci),
|
|
l = oi.dot(ci);
|
|
if (o <= 0 && l <= 0) return t.copy(n);
|
|
hi.subVectors(e, i);
|
|
const c = si.dot(hi),
|
|
h = oi.dot(hi);
|
|
if (c >= 0 && h <= c) return t.copy(i);
|
|
const u = o * h - c * l;
|
|
if (u <= 0 && o >= 0 && c <= 0) return a = o / (o - c), t.copy(n).addScaledVector(si, a);
|
|
ui.subVectors(e, r);
|
|
const d = si.dot(ui),
|
|
f = oi.dot(ui);
|
|
if (f >= 0 && d <= f) return t.copy(r);
|
|
const p = d * l - o * f;
|
|
if (p <= 0 && l >= 0 && f <= 0) return s = l / (l - f), t.copy(n).addScaledVector(oi, s);
|
|
const m = c * f - d * h;
|
|
if (m <= 0 && h - c >= 0 && d - f >= 0) return li.subVectors(r, i), s = (h - c) / (h - c + (d - f)), t.copy(i).addScaledVector(li, s);
|
|
const g = 1 / (m + p + u);
|
|
return a = p * g, s = u * g, t.copy(n).addScaledVector(si, a).addScaledVector(oi, s)
|
|
}
|
|
equals(e) {
|
|
return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c)
|
|
}
|
|
}
|
|
const gi = {
|
|
aliceblue: 15792383,
|
|
antiquewhite: 16444375,
|
|
aqua: 65535,
|
|
aquamarine: 8388564,
|
|
azure: 15794175,
|
|
beige: 16119260,
|
|
bisque: 16770244,
|
|
black: 0,
|
|
blanchedalmond: 16772045,
|
|
blue: 255,
|
|
blueviolet: 9055202,
|
|
brown: 10824234,
|
|
burlywood: 14596231,
|
|
cadetblue: 6266528,
|
|
chartreuse: 8388352,
|
|
chocolate: 13789470,
|
|
coral: 16744272,
|
|
cornflowerblue: 6591981,
|
|
cornsilk: 16775388,
|
|
crimson: 14423100,
|
|
cyan: 65535,
|
|
darkblue: 139,
|
|
darkcyan: 35723,
|
|
darkgoldenrod: 12092939,
|
|
darkgray: 11119017,
|
|
darkgreen: 25600,
|
|
darkgrey: 11119017,
|
|
darkkhaki: 12433259,
|
|
darkmagenta: 9109643,
|
|
darkolivegreen: 5597999,
|
|
darkorange: 16747520,
|
|
darkorchid: 10040012,
|
|
darkred: 9109504,
|
|
darksalmon: 15308410,
|
|
darkseagreen: 9419919,
|
|
darkslateblue: 4734347,
|
|
darkslategray: 3100495,
|
|
darkslategrey: 3100495,
|
|
darkturquoise: 52945,
|
|
darkviolet: 9699539,
|
|
deeppink: 16716947,
|
|
deepskyblue: 49151,
|
|
dimgray: 6908265,
|
|
dimgrey: 6908265,
|
|
dodgerblue: 2003199,
|
|
firebrick: 11674146,
|
|
floralwhite: 16775920,
|
|
forestgreen: 2263842,
|
|
fuchsia: 16711935,
|
|
gainsboro: 14474460,
|
|
ghostwhite: 16316671,
|
|
gold: 16766720,
|
|
goldenrod: 14329120,
|
|
gray: 8421504,
|
|
green: 32768,
|
|
greenyellow: 11403055,
|
|
grey: 8421504,
|
|
honeydew: 15794160,
|
|
hotpink: 16738740,
|
|
indianred: 13458524,
|
|
indigo: 4915330,
|
|
ivory: 16777200,
|
|
khaki: 15787660,
|
|
lavender: 15132410,
|
|
lavenderblush: 16773365,
|
|
lawngreen: 8190976,
|
|
lemonchiffon: 16775885,
|
|
lightblue: 11393254,
|
|
lightcoral: 15761536,
|
|
lightcyan: 14745599,
|
|
lightgoldenrodyellow: 16448210,
|
|
lightgray: 13882323,
|
|
lightgreen: 9498256,
|
|
lightgrey: 13882323,
|
|
lightpink: 16758465,
|
|
lightsalmon: 16752762,
|
|
lightseagreen: 2142890,
|
|
lightskyblue: 8900346,
|
|
lightslategray: 7833753,
|
|
lightslategrey: 7833753,
|
|
lightsteelblue: 11584734,
|
|
lightyellow: 16777184,
|
|
lime: 65280,
|
|
limegreen: 3329330,
|
|
linen: 16445670,
|
|
magenta: 16711935,
|
|
maroon: 8388608,
|
|
mediumaquamarine: 6737322,
|
|
mediumblue: 205,
|
|
mediumorchid: 12211667,
|
|
mediumpurple: 9662683,
|
|
mediumseagreen: 3978097,
|
|
mediumslateblue: 8087790,
|
|
mediumspringgreen: 64154,
|
|
mediumturquoise: 4772300,
|
|
mediumvioletred: 13047173,
|
|
midnightblue: 1644912,
|
|
mintcream: 16121850,
|
|
mistyrose: 16770273,
|
|
moccasin: 16770229,
|
|
navajowhite: 16768685,
|
|
navy: 128,
|
|
oldlace: 16643558,
|
|
olive: 8421376,
|
|
olivedrab: 7048739,
|
|
orange: 16753920,
|
|
orangered: 16729344,
|
|
orchid: 14315734,
|
|
palegoldenrod: 15657130,
|
|
palegreen: 10025880,
|
|
paleturquoise: 11529966,
|
|
palevioletred: 14381203,
|
|
papayawhip: 16773077,
|
|
peachpuff: 16767673,
|
|
peru: 13468991,
|
|
pink: 16761035,
|
|
plum: 14524637,
|
|
powderblue: 11591910,
|
|
purple: 8388736,
|
|
rebeccapurple: 6697881,
|
|
red: 16711680,
|
|
rosybrown: 12357519,
|
|
royalblue: 4286945,
|
|
saddlebrown: 9127187,
|
|
salmon: 16416882,
|
|
sandybrown: 16032864,
|
|
seagreen: 3050327,
|
|
seashell: 16774638,
|
|
sienna: 10506797,
|
|
silver: 12632256,
|
|
skyblue: 8900331,
|
|
slateblue: 6970061,
|
|
slategray: 7372944,
|
|
slategrey: 7372944,
|
|
snow: 16775930,
|
|
springgreen: 65407,
|
|
steelblue: 4620980,
|
|
tan: 13808780,
|
|
teal: 32896,
|
|
thistle: 14204888,
|
|
tomato: 16737095,
|
|
turquoise: 4251856,
|
|
violet: 15631086,
|
|
wheat: 16113331,
|
|
white: 16777215,
|
|
whitesmoke: 16119285,
|
|
yellow: 16776960,
|
|
yellowgreen: 10145074
|
|
},
|
|
Ai = {
|
|
h: 0,
|
|
s: 0,
|
|
l: 0
|
|
},
|
|
_i = {
|
|
h: 0,
|
|
s: 0,
|
|
l: 0
|
|
};
|
|
|
|
function vi(e, t, n) {
|
|
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? e + 6 * (t - e) * n : n < .5 ? t : n < 2 / 3 ? e + 6 * (t - e) * (2 / 3 - n) : e
|
|
}
|
|
class wi {
|
|
constructor(e, t, n) {
|
|
return this.isColor = !0, this.r = 1, this.g = 1, this.b = 1, this.set(e, t, n)
|
|
}
|
|
set(e, t, n) {
|
|
if (void 0 === t && void 0 === n) {
|
|
const t = e;
|
|
t && t.isColor ? this.copy(t) : "number" == typeof t ? this.setHex(t) : "string" == typeof t && this.setStyle(t)
|
|
} else this.setRGB(e, t, n);
|
|
return this
|
|
}
|
|
setScalar(e) {
|
|
return this.r = e, this.g = e, this.b = e, this
|
|
}
|
|
setHex(e, t = Ye) {
|
|
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (255 & e) / 255, Ut.toWorkingColorSpace(this, t), this
|
|
}
|
|
setRGB(e, t, n, i = Ut.workingColorSpace) {
|
|
return this.r = e, this.g = t, this.b = n, Ut.toWorkingColorSpace(this, i), this
|
|
}
|
|
setHSL(e, t, n, i = Ut.workingColorSpace) {
|
|
if (e = vt(e, 1), t = _t(t, 0, 1), n = _t(n, 0, 1), 0 === t) this.r = this.g = this.b = n;
|
|
else {
|
|
const i = n <= .5 ? n * (1 + t) : n + t - n * t,
|
|
r = 2 * n - i;
|
|
this.r = vi(r, i, e + 1 / 3), this.g = vi(r, i, e), this.b = vi(r, i, e - 1 / 3)
|
|
}
|
|
return Ut.toWorkingColorSpace(this, i), this
|
|
}
|
|
setStyle(e, t = Ye) {
|
|
function n(t) {
|
|
void 0 !== t && parseFloat(t) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored.")
|
|
}
|
|
let i;
|
|
if (i = /^(\w+)\(([^\)]*)\)/.exec(e)) {
|
|
let r;
|
|
const a = i[1],
|
|
s = i[2];
|
|
switch (a) {
|
|
case "rgb":
|
|
case "rgba":
|
|
if (r = /^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)) return n(r[4]), this.setRGB(Math.min(255, parseInt(r[1], 10)) / 255, Math.min(255, parseInt(r[2], 10)) / 255, Math.min(255, parseInt(r[3], 10)) / 255, t);
|
|
if (r = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)) return n(r[4]), this.setRGB(Math.min(100, parseInt(r[1], 10)) / 100, Math.min(100, parseInt(r[2], 10)) / 100, Math.min(100, parseInt(r[3], 10)) / 100, t);
|
|
break;
|
|
case "hsl":
|
|
case "hsla":
|
|
if (r = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)) return n(r[4]), this.setHSL(parseFloat(r[1]) / 360, parseFloat(r[2]) / 100, parseFloat(r[3]) / 100, t);
|
|
break;
|
|
default:
|
|
console.warn("THREE.Color: Unknown color model " + e)
|
|
}
|
|
} else if (i = /^\#([A-Fa-f\d]+)$/.exec(e)) {
|
|
const n = i[1],
|
|
r = n.length;
|
|
if (3 === r) return this.setRGB(parseInt(n.charAt(0), 16) / 15, parseInt(n.charAt(1), 16) / 15, parseInt(n.charAt(2), 16) / 15, t);
|
|
if (6 === r) return this.setHex(parseInt(n, 16), t);
|
|
console.warn("THREE.Color: Invalid hex color " + e)
|
|
} else if (e && e.length > 0) return this.setColorName(e, t);
|
|
return this
|
|
}
|
|
setColorName(e, t = Ye) {
|
|
const n = gi[e.toLowerCase()];
|
|
return void 0 !== n ? this.setHex(n, t) : console.warn("THREE.Color: Unknown color " + e), this
|
|
}
|
|
clone() {
|
|
return new this.constructor(this.r, this.g, this.b)
|
|
}
|
|
copy(e) {
|
|
return this.r = e.r, this.g = e.g, this.b = e.b, this
|
|
}
|
|
copySRGBToLinear(e) {
|
|
return this.r = kt(e.r), this.g = kt(e.g), this.b = kt(e.b), this
|
|
}
|
|
copyLinearToSRGB(e) {
|
|
return this.r = Nt(e.r), this.g = Nt(e.g), this.b = Nt(e.b), this
|
|
}
|
|
convertSRGBToLinear() {
|
|
return this.copySRGBToLinear(this), this
|
|
}
|
|
convertLinearToSRGB() {
|
|
return this.copyLinearToSRGB(this), this
|
|
}
|
|
getHex(e = Ye) {
|
|
return Ut.fromWorkingColorSpace(yi.copy(this), e), 65536 * Math.round(_t(255 * yi.r, 0, 255)) + 256 * Math.round(_t(255 * yi.g, 0, 255)) + Math.round(_t(255 * yi.b, 0, 255))
|
|
}
|
|
getHexString(e = Ye) {
|
|
return ("000000" + this.getHex(e).toString(16)).slice(-6)
|
|
}
|
|
getHSL(e, t = Ut.workingColorSpace) {
|
|
Ut.fromWorkingColorSpace(yi.copy(this), t);
|
|
const n = yi.r,
|
|
i = yi.g,
|
|
r = yi.b,
|
|
a = Math.max(n, i, r),
|
|
s = Math.min(n, i, r);
|
|
let o, l;
|
|
const c = (s + a) / 2;
|
|
if (s === a) o = 0, l = 0;
|
|
else {
|
|
const e = a - s;
|
|
switch (l = c <= .5 ? e / (a + s) : e / (2 - a - s), a) {
|
|
case n:
|
|
o = (i - r) / e + (i < r ? 6 : 0);
|
|
break;
|
|
case i:
|
|
o = (r - n) / e + 2;
|
|
break;
|
|
case r:
|
|
o = (n - i) / e + 4
|
|
}
|
|
o /= 6
|
|
}
|
|
return e.h = o, e.s = l, e.l = c, e
|
|
}
|
|
getRGB(e, t = Ut.workingColorSpace) {
|
|
return Ut.fromWorkingColorSpace(yi.copy(this), t), e.r = yi.r, e.g = yi.g, e.b = yi.b, e
|
|
}
|
|
getStyle(e = Ye) {
|
|
Ut.fromWorkingColorSpace(yi.copy(this), e);
|
|
const t = yi.r,
|
|
n = yi.g,
|
|
i = yi.b;
|
|
return e !== Ye ? `color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})` : `rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`
|
|
}
|
|
offsetHSL(e, t, n) {
|
|
return this.getHSL(Ai), this.setHSL(Ai.h + e, Ai.s + t, Ai.l + n)
|
|
}
|
|
add(e) {
|
|
return this.r += e.r, this.g += e.g, this.b += e.b, this
|
|
}
|
|
addColors(e, t) {
|
|
return this.r = e.r + t.r, this.g = e.g + t.g, this.b = e.b + t.b, this
|
|
}
|
|
addScalar(e) {
|
|
return this.r += e, this.g += e, this.b += e, this
|
|
}
|
|
sub(e) {
|
|
return this.r = Math.max(0, this.r - e.r), this.g = Math.max(0, this.g - e.g), this.b = Math.max(0, this.b - e.b), this
|
|
}
|
|
multiply(e) {
|
|
return this.r *= e.r, this.g *= e.g, this.b *= e.b, this
|
|
}
|
|
multiplyScalar(e) {
|
|
return this.r *= e, this.g *= e, this.b *= e, this
|
|
}
|
|
lerp(e, t) {
|
|
return this.r += (e.r - this.r) * t, this.g += (e.g - this.g) * t, this.b += (e.b - this.b) * t, this
|
|
}
|
|
lerpColors(e, t, n) {
|
|
return this.r = e.r + (t.r - e.r) * n, this.g = e.g + (t.g - e.g) * n, this.b = e.b + (t.b - e.b) * n, this
|
|
}
|
|
lerpHSL(e, t) {
|
|
this.getHSL(Ai), e.getHSL(_i);
|
|
const n = wt(Ai.h, _i.h, t),
|
|
i = wt(Ai.s, _i.s, t),
|
|
r = wt(Ai.l, _i.l, t);
|
|
return this.setHSL(n, i, r), this
|
|
}
|
|
setFromVector3(e) {
|
|
return this.r = e.x, this.g = e.y, this.b = e.z, this
|
|
}
|
|
applyMatrix3(e) {
|
|
const t = this.r,
|
|
n = this.g,
|
|
i = this.b,
|
|
r = e.elements;
|
|
return this.r = r[0] * t + r[3] * n + r[6] * i, this.g = r[1] * t + r[4] * n + r[7] * i, this.b = r[2] * t + r[5] * n + r[8] * i, this
|
|
}
|
|
equals(e) {
|
|
return e.r === this.r && e.g === this.g && e.b === this.b
|
|
}
|
|
fromArray(e, t = 0) {
|
|
return this.r = e[t], this.g = e[t + 1], this.b = e[t + 2], this
|
|
}
|
|
toArray(e = [], t = 0) {
|
|
return e[t] = this.r, e[t + 1] = this.g, e[t + 2] = this.b, e
|
|
}
|
|
fromBufferAttribute(e, t) {
|
|
return this.r = e.getX(t), this.g = e.getY(t), this.b = e.getZ(t), this
|
|
}
|
|
toJSON() {
|
|
return this.getHex()
|
|
}*[Symbol.iterator]() {
|
|
yield this.r, yield this.g, yield this.b
|
|
}
|
|
}
|
|
const yi = new wi;
|
|
wi.NAMES = gi;
|
|
let xi = 0;
|
|
class bi extends dt {
|
|
constructor() {
|
|
super(), this.isMaterial = !0, Object.defineProperty(this, "id", {
|
|
value: xi++
|
|
}), this.uuid = At(), this.name = "", this.type = "Material", this.blending = 1, this.side = 0, this.vertexColors = !1, this.opacity = 1, this.transparent = !1, this.alphaHash = !1, this.blendSrc = 204, this.blendDst = 205, this.blendEquation = a, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.blendColor = new wi(0, 0, 0), this.blendAlpha = 0, this.depthFunc = 3, this.depthTest = !0, this.depthWrite = !0, this.stencilWriteMask = 255, this.stencilFunc = 519, this.stencilRef = 0, this.stencilFuncMask = 255, this.stencilFail = $e, this.stencilZFail = $e, this.stencilZPass = $e, this.stencilWrite = !1, this.clippingPlanes = null, this.clipIntersection = !1, this.clipShadows = !1, this.shadowSide = null, this.colorWrite = !0, this.precision = null, this.polygonOffset = !1, this.polygonOffsetFactor = 0, this.polygonOffsetUnits = 0, this.dithering = !1, this.alphaToCoverage = !1, this.premultipliedAlpha = !1, this.forceSinglePass = !1, this.visible = !0, this.toneMapped = !0, this.userData = {}, this.version = 0, this._alphaTest = 0
|
|
}
|
|
get alphaTest() {
|
|
return this._alphaTest
|
|
}
|
|
set alphaTest(e) {
|
|
this._alphaTest > 0 != e > 0 && this.version++, this._alphaTest = e
|
|
}
|
|
onBeforeRender() {}
|
|
onBeforeCompile() {}
|
|
customProgramCacheKey() {
|
|
return this.onBeforeCompile.toString()
|
|
}
|
|
setValues(e) {
|
|
if (void 0 !== e)
|
|
for (const t in e) {
|
|
const n = e[t];
|
|
if (void 0 === n) {
|
|
console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);
|
|
continue
|
|
}
|
|
const i = this[t];
|
|
void 0 !== i ? i && i.isColor ? i.set(n) : i && i.isVector3 && n && n.isVector3 ? i.copy(n) : this[t] = n : console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`)
|
|
}
|
|
}
|
|
toJSON(e) {
|
|
const t = void 0 === e || "string" == typeof e;
|
|
t && (e = {
|
|
textures: {},
|
|
images: {}
|
|
});
|
|
const n = {
|
|
metadata: {
|
|
version: 4.6,
|
|
type: "Material",
|
|
generator: "Material.toJSON"
|
|
}
|
|
};
|
|
|
|
function i(e) {
|
|
const t = [];
|
|
for (const n in e) {
|
|
const i = e[n];
|
|
delete i.metadata, t.push(i)
|
|
}
|
|
return t
|
|
}
|
|
if (n.uuid = this.uuid, n.type = this.type, "" !== this.name && (n.name = this.name), this.color && this.color.isColor && (n.color = this.color.getHex()), void 0 !== this.roughness && (n.roughness = this.roughness), void 0 !== this.metalness && (n.metalness = this.metalness), void 0 !== this.sheen && (n.sheen = this.sheen), this.sheenColor && this.sheenColor.isColor && (n.sheenColor = this.sheenColor.getHex()), void 0 !== this.sheenRoughness && (n.sheenRoughness = this.sheenRoughness), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), void 0 !== this.emissiveIntensity && 1 !== this.emissiveIntensity && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.getHex()), void 0 !== this.specularIntensity && (n.specularIntensity = this.specularIntensity), this.specularColor && this.specularColor.isColor && (n.specularColor = this.specularColor.getHex()), void 0 !== this.shininess && (n.shininess = this.shininess), void 0 !== this.clearcoat && (n.clearcoat = this.clearcoat), void 0 !== this.clearcoatRoughness && (n.clearcoatRoughness = this.clearcoatRoughness), this.clearcoatMap && this.clearcoatMap.isTexture && (n.clearcoatMap = this.clearcoatMap.toJSON(e).uuid), this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (n.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(e).uuid), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (n.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(e).uuid, n.clearcoatNormalScale = this.clearcoatNormalScale.toArray()), void 0 !== this.dispersion && (n.dispersion = this.dispersion), void 0 !== this.iridescence && (n.iridescence = this.iridescence), void 0 !== this.iridescenceIOR && (n.iridescenceIOR = this.iridescenceIOR), void 0 !== this.iridescenceThicknessRange && (n.iridescenceThicknessRange = this.iridescenceThicknessRange), this.iridescenceMap && this.iridescenceMap.isTexture && (n.iridescenceMap = this.iridescenceMap.toJSON(e).uuid), this.iridescenceThicknessMap && this.iridescenceThicknessMap.isTexture && (n.iridescenceThicknessMap = this.iridescenceThicknessMap.toJSON(e).uuid), void 0 !== this.anisotropy && (n.anisotropy = this.anisotropy), void 0 !== this.anisotropyRotation && (n.anisotropyRotation = this.anisotropyRotation), this.anisotropyMap && this.anisotropyMap.isTexture && (n.anisotropyMap = this.anisotropyMap.toJSON(e).uuid), this.map && this.map.isTexture && (n.map = this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (n.matcap = this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(e).uuid, n.lightMapIntensity = this.lightMapIntensity), this.aoMap && this.aoMap.isTexture && (n.aoMap = this.aoMap.toJSON(e).uuid, n.aoMapIntensity = this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(e).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(e).uuid, n.normalMapType = this.normalMapType, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(e).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(e).uuid), this.specularIntensityMap && this.specularIntensityMap.isTexture && (n.specularIntensityMap = this.specularIntensityMap.toJSON(e).uuid), this.specularColorMap && this.specularColorMap.isTexture && (n.specularColorMap = this.specularColorMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(e).uuid, void 0 !== this.combine && (n.combine = this.combine)), void 0 !== this.envMapRotation && (n.envMapRotation = this.envMapRotation.toArray()), void 0 !== this.envMapIntensity && (n.envMapIntensity = this.envMapIntensity), void 0 !== this.reflectivity && (n.reflectivity = this.reflectivity), void 0 !== this.refractionRatio && (n.refractionRatio = this.refractionRatio), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(e).uuid), void 0 !== this.transmission && (n.transmission = this.transmission), this.transmissionMap && this.transmissionMap.isTexture && (n.transmissionMap = this.transmissionMap.toJSON(e).uuid), void 0 !== this.thickness && (n.thickness = this.thickness), this.thicknessMap && this.thicknessMap.isTexture && (n.thicknessMap = this.thicknessMap.toJSON(e).uuid), void 0 !== this.attenuationDistance && this.attenuationDistance !== 1 / 0 && (n.attenuationDistance = this.attenuationDistance), void 0 !== this.attenuationColor && (n.attenuationColor = this.attenuationColor.getHex()), void 0 !== this.size && (n.size = this.size), null !== this.shadowSide && (n.shadowSide = this.shadowSide), void 0 !== this.sizeAttenuation && (n.sizeAttenuation = this.sizeAttenuation), 1 !== this.blending && (n.blending = this.blending), 0 !== this.side && (n.side = this.side), !0 === this.vertexColors && (n.vertexColors = !0), this.opacity < 1 && (n.opacity = this.opacity), !0 === this.transparent && (n.transparent = !0), 204 !== this.blendSrc && (n.blendSrc = this.blendSrc), 205 !== this.blendDst && (n.blendDst = this.blendDst), this.blendEquation !== a && (n.blendEquation = this.blendEquation), null !== this.blendSrcAlpha && (n.blendSrcAlpha = this.blendSrcAlpha), null !== this.blendDstAlpha && (n.blendDstAlpha = this.blendDstAlpha), null !== this.blendEquationAlpha && (n.blendEquationAlpha = this.blendEquationAlpha), this.blendColor && this.blendColor.isColor && (n.blendColor = this.blendColor.getHex()), 0 !== this.blendAlpha && (n.blendAlpha = this.blendAlpha), 3 !== this.depthFunc && (n.depthFunc = this.depthFunc), !1 === this.depthTest && (n.depthTest = this.depthTest), !1 === this.depthWrite && (n.depthWrite = this.depthWrite), !1 === this.colorWrite && (n.colorWrite = this.colorWrite), 255 !== this.stencilWriteMask && (n.stencilWriteMask = this.stencilWriteMask), 519 !== this.stencilFunc && (n.stencilFunc = this.stencilFunc), 0 !== this.stencilRef && (n.stencilRef = this.stencilRef), 255 !== this.stencilFuncMask && (n.stencilFuncMask = this.stencilFuncMask), this.stencilFail !== $e && (n.stencilFail = this.stencilFail), this.stencilZFail !== $e && (n.stencilZFail = this.stencilZFail), this.stencilZPass !== $e && (n.stencilZPass = this.stencilZPass), !0 === this.stencilWrite && (n.stencilWrite = this.stencilWrite), void 0 !== this.rotation && 0 !== this.rotation && (n.rotation = this.rotation), !0 === this.polygonOffset && (n.polygonOffset = !0), 0 !== this.polygonOffsetFactor && (n.polygonOffsetFactor = this.polygonOffsetFactor), 0 !== this.polygonOffsetUnits && (n.polygonOffsetUnits = this.polygonOffsetUnits), void 0 !== this.linewidth && 1 !== this.linewidth && (n.linewidth = this.linewidth), void 0 !== this.dashSize && (n.dashSize = this.dashSize), void 0 !== this.gapSize && (n.gapSize = this.gapSize), void 0 !== this.scale && (n.scale = this.scale), !0 === this.dithering && (n.dithering = !0), this.alphaTest > 0 && (n.alphaTest = this.alphaTest), !0 === this.alphaHash && (n.alphaHash = !0), !0 === this.alphaToCoverage && (n.alphaToCoverage = !0), !0 === this.premultipliedAlpha && (n.premultipliedAlpha = !0), !0 === this.forceSinglePass && (n.forceSinglePass = !0), !0 === this.wireframe && (n.wireframe = !0), this.wireframeLinewidth > 1 && (n.wireframeLinewidth = this.wireframeLinewidth), "round" !== this.wireframeLinecap && (n.wireframeLinecap = this.wireframeLinecap), "round" !== this.wireframeLinejoin && (n.wireframeLinejoin = this.wireframeLinejoin), !0 === this.flatShading && (n.flatShading = !0), !1 === this.visible && (n.visible = !1), !1 === this.toneMapped && (n.toneMapped = !1), !1 === this.fog && (n.fog = !1), Object.keys(this.userData).length > 0 && (n.userData = this.userData), t) {
|
|
const t = i(e.textures),
|
|
r = i(e.images);
|
|
t.length > 0 && (n.textures = t), r.length > 0 && (n.images = r)
|
|
}
|
|
return n
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
copy(e) {
|
|
this.name = e.name, this.blending = e.blending, this.side = e.side, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.blendColor.copy(e.blendColor), this.blendAlpha = e.blendAlpha, this.depthFunc = e.depthFunc, this.depthTest = e.depthTest, this.depthWrite = e.depthWrite, this.stencilWriteMask = e.stencilWriteMask, this.stencilFunc = e.stencilFunc, this.stencilRef = e.stencilRef, this.stencilFuncMask = e.stencilFuncMask, this.stencilFail = e.stencilFail, this.stencilZFail = e.stencilZFail, this.stencilZPass = e.stencilZPass, this.stencilWrite = e.stencilWrite;
|
|
const t = e.clippingPlanes;
|
|
let n = null;
|
|
if (null !== t) {
|
|
const e = t.length;
|
|
n = new Array(e);
|
|
for (let i = 0; i !== e; ++i) n[i] = t[i].clone()
|
|
}
|
|
return this.clippingPlanes = n, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.alphaHash = e.alphaHash, this.alphaToCoverage = e.alphaToCoverage, this.premultipliedAlpha = e.premultipliedAlpha, this.forceSinglePass = e.forceSinglePass, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this
|
|
}
|
|
dispose() {
|
|
this.dispatchEvent({
|
|
type: "dispose"
|
|
})
|
|
}
|
|
set needsUpdate(e) {
|
|
!0 === e && this.version++
|
|
}
|
|
onBuild() {
|
|
console.warn("Material: onBuild() has been removed.")
|
|
}
|
|
}
|
|
class Ei extends bi {
|
|
constructor(e) {
|
|
super(), this.isMeshBasicMaterial = !0, this.type = "MeshBasicMaterial", this.color = new wi(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new Fn, this.combine = 0, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.fog = !0, this.setValues(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.fog = e.fog, this
|
|
}
|
|
}
|
|
const Si = new Zt,
|
|
Mi = new Et;
|
|
let Ti = 0;
|
|
class Ci {
|
|
constructor(e, t, n = !1) {
|
|
if (Array.isArray(e)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
|
|
this.isBufferAttribute = !0, Object.defineProperty(this, "id", {
|
|
value: Ti++
|
|
}), this.name = "", this.array = e, this.itemSize = t, this.count = void 0 !== e ? e.length / t : 0, this.normalized = n, this.usage = lt, this.updateRanges = [], this.gpuType = J, this.version = 0
|
|
}
|
|
onUploadCallback() {}
|
|
set needsUpdate(e) {
|
|
!0 === e && this.version++
|
|
}
|
|
setUsage(e) {
|
|
return this.usage = e, this
|
|
}
|
|
addUpdateRange(e, t) {
|
|
this.updateRanges.push({
|
|
start: e,
|
|
count: t
|
|
})
|
|
}
|
|
clearUpdateRanges() {
|
|
this.updateRanges.length = 0
|
|
}
|
|
copy(e) {
|
|
return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this.gpuType = e.gpuType, this
|
|
}
|
|
copyAt(e, t, n) {
|
|
e *= this.itemSize, n *= t.itemSize;
|
|
for (let i = 0, r = this.itemSize; i < r; i++) this.array[e + i] = t.array[n + i];
|
|
return this
|
|
}
|
|
copyArray(e) {
|
|
return this.array.set(e), this
|
|
}
|
|
applyMatrix3(e) {
|
|
if (2 === this.itemSize)
|
|
for (let t = 0, n = this.count; t < n; t++) Mi.fromBufferAttribute(this, t), Mi.applyMatrix3(e), this.setXY(t, Mi.x, Mi.y);
|
|
else if (3 === this.itemSize)
|
|
for (let t = 0, n = this.count; t < n; t++) Si.fromBufferAttribute(this, t), Si.applyMatrix3(e), this.setXYZ(t, Si.x, Si.y, Si.z);
|
|
return this
|
|
}
|
|
applyMatrix4(e) {
|
|
for (let t = 0, n = this.count; t < n; t++) Si.fromBufferAttribute(this, t), Si.applyMatrix4(e), this.setXYZ(t, Si.x, Si.y, Si.z);
|
|
return this
|
|
}
|
|
applyNormalMatrix(e) {
|
|
for (let t = 0, n = this.count; t < n; t++) Si.fromBufferAttribute(this, t), Si.applyNormalMatrix(e), this.setXYZ(t, Si.x, Si.y, Si.z);
|
|
return this
|
|
}
|
|
transformDirection(e) {
|
|
for (let t = 0, n = this.count; t < n; t++) Si.fromBufferAttribute(this, t), Si.transformDirection(e), this.setXYZ(t, Si.x, Si.y, Si.z);
|
|
return this
|
|
}
|
|
set(e, t = 0) {
|
|
return this.array.set(e, t), this
|
|
}
|
|
getComponent(e, t) {
|
|
let n = this.array[e * this.itemSize + t];
|
|
return this.normalized && (n = yt(n, this.array)), n
|
|
}
|
|
setComponent(e, t, n) {
|
|
return this.normalized && (n = xt(n, this.array)), this.array[e * this.itemSize + t] = n, this
|
|
}
|
|
getX(e) {
|
|
let t = this.array[e * this.itemSize];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
setX(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.array[e * this.itemSize] = t, this
|
|
}
|
|
getY(e) {
|
|
let t = this.array[e * this.itemSize + 1];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
setY(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.array[e * this.itemSize + 1] = t, this
|
|
}
|
|
getZ(e) {
|
|
let t = this.array[e * this.itemSize + 2];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
setZ(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.array[e * this.itemSize + 2] = t, this
|
|
}
|
|
getW(e) {
|
|
let t = this.array[e * this.itemSize + 3];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
setW(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.array[e * this.itemSize + 3] = t, this
|
|
}
|
|
setXY(e, t, n) {
|
|
return e *= this.itemSize, this.normalized && (t = xt(t, this.array), n = xt(n, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this
|
|
}
|
|
setXYZ(e, t, n, i) {
|
|
return e *= this.itemSize, this.normalized && (t = xt(t, this.array), n = xt(n, this.array), i = xt(i, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = i, this
|
|
}
|
|
setXYZW(e, t, n, i, r) {
|
|
return e *= this.itemSize, this.normalized && (t = xt(t, this.array), n = xt(n, this.array), i = xt(i, this.array), r = xt(r, this.array)), this.array[e + 0] = t, this.array[e + 1] = n, this.array[e + 2] = i, this.array[e + 3] = r, this
|
|
}
|
|
onUpload(e) {
|
|
return this.onUploadCallback = e, this
|
|
}
|
|
clone() {
|
|
return new this.constructor(this.array, this.itemSize).copy(this)
|
|
}
|
|
toJSON() {
|
|
const e = {
|
|
itemSize: this.itemSize,
|
|
type: this.array.constructor.name,
|
|
array: Array.from(this.array),
|
|
normalized: this.normalized
|
|
};
|
|
return "" !== this.name && (e.name = this.name), this.usage !== lt && (e.usage = this.usage), e
|
|
}
|
|
}
|
|
class Ii extends Ci {
|
|
constructor(e, t, n) {
|
|
super(new Uint16Array(e), t, n)
|
|
}
|
|
}
|
|
class Ri extends Ci {
|
|
constructor(e, t, n) {
|
|
super(new Uint32Array(e), t, n)
|
|
}
|
|
}
|
|
class Pi extends Ci {
|
|
constructor(e, t, n) {
|
|
super(new Float32Array(e), t, n)
|
|
}
|
|
}
|
|
let Bi = 0;
|
|
const Di = new Cn,
|
|
Li = new ti,
|
|
Ui = new Zt,
|
|
ki = new en,
|
|
Ni = new en,
|
|
Fi = new Zt;
|
|
class Oi extends dt {
|
|
constructor() {
|
|
super(), this.isBufferGeometry = !0, Object.defineProperty(this, "id", {
|
|
value: Bi++
|
|
}), this.uuid = At(), this.name = "", this.type = "BufferGeometry", this.index = null, this.indirect = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = {
|
|
start: 0,
|
|
count: 1 / 0
|
|
}, this.userData = {}
|
|
}
|
|
getIndex() {
|
|
return this.index
|
|
}
|
|
setIndex(e) {
|
|
return Array.isArray(e) ? this.index = new(Tt(e) ? Ri : Ii)(e, 1) : this.index = e, this
|
|
}
|
|
setIndirect(e) {
|
|
return this.indirect = e, this
|
|
}
|
|
getIndirect() {
|
|
return this.indirect
|
|
}
|
|
getAttribute(e) {
|
|
return this.attributes[e]
|
|
}
|
|
setAttribute(e, t) {
|
|
return this.attributes[e] = t, this
|
|
}
|
|
deleteAttribute(e) {
|
|
return delete this.attributes[e], this
|
|
}
|
|
hasAttribute(e) {
|
|
return void 0 !== this.attributes[e]
|
|
}
|
|
addGroup(e, t, n = 0) {
|
|
this.groups.push({
|
|
start: e,
|
|
count: t,
|
|
materialIndex: n
|
|
})
|
|
}
|
|
clearGroups() {
|
|
this.groups = []
|
|
}
|
|
setDrawRange(e, t) {
|
|
this.drawRange.start = e, this.drawRange.count = t
|
|
}
|
|
applyMatrix4(e) {
|
|
const t = this.attributes.position;
|
|
void 0 !== t && (t.applyMatrix4(e), t.needsUpdate = !0);
|
|
const n = this.attributes.normal;
|
|
if (void 0 !== n) {
|
|
const t = (new St).getNormalMatrix(e);
|
|
n.applyNormalMatrix(t), n.needsUpdate = !0
|
|
}
|
|
const i = this.attributes.tangent;
|
|
return void 0 !== i && (i.transformDirection(e), i.needsUpdate = !0), null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(), this
|
|
}
|
|
applyQuaternion(e) {
|
|
return Di.makeRotationFromQuaternion(e), this.applyMatrix4(Di), this
|
|
}
|
|
rotateX(e) {
|
|
return Di.makeRotationX(e), this.applyMatrix4(Di), this
|
|
}
|
|
rotateY(e) {
|
|
return Di.makeRotationY(e), this.applyMatrix4(Di), this
|
|
}
|
|
rotateZ(e) {
|
|
return Di.makeRotationZ(e), this.applyMatrix4(Di), this
|
|
}
|
|
translate(e, t, n) {
|
|
return Di.makeTranslation(e, t, n), this.applyMatrix4(Di), this
|
|
}
|
|
scale(e, t, n) {
|
|
return Di.makeScale(e, t, n), this.applyMatrix4(Di), this
|
|
}
|
|
lookAt(e) {
|
|
return Li.lookAt(e), Li.updateMatrix(), this.applyMatrix4(Li.matrix), this
|
|
}
|
|
center() {
|
|
return this.computeBoundingBox(), this.boundingBox.getCenter(Ui).negate(), this.translate(Ui.x, Ui.y, Ui.z), this
|
|
}
|
|
setFromPoints(e) {
|
|
const t = this.getAttribute("position");
|
|
if (void 0 === t) {
|
|
const t = [];
|
|
for (let n = 0, i = e.length; n < i; n++) {
|
|
const i = e[n];
|
|
t.push(i.x, i.y, i.z || 0)
|
|
}
|
|
this.setAttribute("position", new Pi(t, 3))
|
|
} else {
|
|
const n = Math.min(e.length, t.count);
|
|
for (let i = 0; i < n; i++) {
|
|
const n = e[i];
|
|
t.setXYZ(i, n.x, n.y, n.z || 0)
|
|
}
|
|
e.length > t.count && console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."), t.needsUpdate = !0
|
|
}
|
|
return this
|
|
}
|
|
computeBoundingBox() {
|
|
null === this.boundingBox && (this.boundingBox = new en);
|
|
const e = this.attributes.position,
|
|
t = this.morphAttributes.position;
|
|
if (e && e.isGLBufferAttribute) return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.", this), void this.boundingBox.set(new Zt(-1 / 0, -1 / 0, -1 / 0), new Zt(1 / 0, 1 / 0, 1 / 0));
|
|
if (void 0 !== e) {
|
|
if (this.boundingBox.setFromBufferAttribute(e), t)
|
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
const n = t[e];
|
|
ki.setFromBufferAttribute(n), this.morphTargetsRelative ? (Fi.addVectors(this.boundingBox.min, ki.min), this.boundingBox.expandByPoint(Fi), Fi.addVectors(this.boundingBox.max, ki.max), this.boundingBox.expandByPoint(Fi)) : (this.boundingBox.expandByPoint(ki.min), this.boundingBox.expandByPoint(ki.max))
|
|
}
|
|
} else this.boundingBox.makeEmpty();
|
|
(isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this)
|
|
}
|
|
computeBoundingSphere() {
|
|
null === this.boundingSphere && (this.boundingSphere = new vn);
|
|
const e = this.attributes.position,
|
|
t = this.morphAttributes.position;
|
|
if (e && e.isGLBufferAttribute) return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.", this), void this.boundingSphere.set(new Zt, 1 / 0);
|
|
if (e) {
|
|
const n = this.boundingSphere.center;
|
|
if (ki.setFromBufferAttribute(e), t)
|
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
const n = t[e];
|
|
Ni.setFromBufferAttribute(n), this.morphTargetsRelative ? (Fi.addVectors(ki.min, Ni.min), ki.expandByPoint(Fi), Fi.addVectors(ki.max, Ni.max), ki.expandByPoint(Fi)) : (ki.expandByPoint(Ni.min), ki.expandByPoint(Ni.max))
|
|
}
|
|
ki.getCenter(n);
|
|
let i = 0;
|
|
for (let t = 0, r = e.count; t < r; t++) Fi.fromBufferAttribute(e, t), i = Math.max(i, n.distanceToSquared(Fi));
|
|
if (t)
|
|
for (let r = 0, a = t.length; r < a; r++) {
|
|
const a = t[r],
|
|
s = this.morphTargetsRelative;
|
|
for (let t = 0, r = a.count; t < r; t++) Fi.fromBufferAttribute(a, t), s && (Ui.fromBufferAttribute(e, t), Fi.add(Ui)), i = Math.max(i, n.distanceToSquared(Fi))
|
|
}
|
|
this.boundingSphere.radius = Math.sqrt(i), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this)
|
|
}
|
|
}
|
|
computeTangents() {
|
|
const e = this.index,
|
|
t = this.attributes;
|
|
if (null === e || void 0 === t.position || void 0 === t.normal || void 0 === t.uv) return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");
|
|
const n = t.position,
|
|
i = t.normal,
|
|
r = t.uv;
|
|
!1 === this.hasAttribute("tangent") && this.setAttribute("tangent", new Ci(new Float32Array(4 * n.count), 4));
|
|
const a = this.getAttribute("tangent"),
|
|
s = [],
|
|
o = [];
|
|
for (let e = 0; e < n.count; e++) s[e] = new Zt, o[e] = new Zt;
|
|
const l = new Zt,
|
|
c = new Zt,
|
|
h = new Zt,
|
|
u = new Et,
|
|
d = new Et,
|
|
f = new Et,
|
|
p = new Zt,
|
|
m = new Zt;
|
|
|
|
function g(e, t, i) {
|
|
l.fromBufferAttribute(n, e), c.fromBufferAttribute(n, t), h.fromBufferAttribute(n, i), u.fromBufferAttribute(r, e), d.fromBufferAttribute(r, t), f.fromBufferAttribute(r, i), c.sub(l), h.sub(l), d.sub(u), f.sub(u);
|
|
const a = 1 / (d.x * f.y - f.x * d.y);
|
|
isFinite(a) && (p.copy(c).multiplyScalar(f.y).addScaledVector(h, -d.y).multiplyScalar(a), m.copy(h).multiplyScalar(d.x).addScaledVector(c, -f.x).multiplyScalar(a), s[e].add(p), s[t].add(p), s[i].add(p), o[e].add(m), o[t].add(m), o[i].add(m))
|
|
}
|
|
let A = this.groups;
|
|
0 === A.length && (A = [{
|
|
start: 0,
|
|
count: e.count
|
|
}]);
|
|
for (let t = 0, n = A.length; t < n; ++t) {
|
|
const n = A[t],
|
|
i = n.start;
|
|
for (let t = i, r = i + n.count; t < r; t += 3) g(e.getX(t + 0), e.getX(t + 1), e.getX(t + 2))
|
|
}
|
|
const _ = new Zt,
|
|
v = new Zt,
|
|
w = new Zt,
|
|
y = new Zt;
|
|
|
|
function x(e) {
|
|
w.fromBufferAttribute(i, e), y.copy(w);
|
|
const t = s[e];
|
|
_.copy(t), _.sub(w.multiplyScalar(w.dot(t))).normalize(), v.crossVectors(y, t);
|
|
const n = v.dot(o[e]) < 0 ? -1 : 1;
|
|
a.setXYZW(e, _.x, _.y, _.z, n)
|
|
}
|
|
for (let t = 0, n = A.length; t < n; ++t) {
|
|
const n = A[t],
|
|
i = n.start;
|
|
for (let t = i, r = i + n.count; t < r; t += 3) x(e.getX(t + 0)), x(e.getX(t + 1)), x(e.getX(t + 2))
|
|
}
|
|
}
|
|
computeVertexNormals() {
|
|
const e = this.index,
|
|
t = this.getAttribute("position");
|
|
if (void 0 !== t) {
|
|
let n = this.getAttribute("normal");
|
|
if (void 0 === n) n = new Ci(new Float32Array(3 * t.count), 3), this.setAttribute("normal", n);
|
|
else
|
|
for (let e = 0, t = n.count; e < t; e++) n.setXYZ(e, 0, 0, 0);
|
|
const i = new Zt,
|
|
r = new Zt,
|
|
a = new Zt,
|
|
s = new Zt,
|
|
o = new Zt,
|
|
l = new Zt,
|
|
c = new Zt,
|
|
h = new Zt;
|
|
if (e)
|
|
for (let u = 0, d = e.count; u < d; u += 3) {
|
|
const d = e.getX(u + 0),
|
|
f = e.getX(u + 1),
|
|
p = e.getX(u + 2);
|
|
i.fromBufferAttribute(t, d), r.fromBufferAttribute(t, f), a.fromBufferAttribute(t, p), c.subVectors(a, r), h.subVectors(i, r), c.cross(h), s.fromBufferAttribute(n, d), o.fromBufferAttribute(n, f), l.fromBufferAttribute(n, p), s.add(c), o.add(c), l.add(c), n.setXYZ(d, s.x, s.y, s.z), n.setXYZ(f, o.x, o.y, o.z), n.setXYZ(p, l.x, l.y, l.z)
|
|
} else
|
|
for (let e = 0, s = t.count; e < s; e += 3) i.fromBufferAttribute(t, e + 0), r.fromBufferAttribute(t, e + 1), a.fromBufferAttribute(t, e + 2), c.subVectors(a, r), h.subVectors(i, r), c.cross(h), n.setXYZ(e + 0, c.x, c.y, c.z), n.setXYZ(e + 1, c.x, c.y, c.z), n.setXYZ(e + 2, c.x, c.y, c.z);
|
|
this.normalizeNormals(), n.needsUpdate = !0
|
|
}
|
|
}
|
|
normalizeNormals() {
|
|
const e = this.attributes.normal;
|
|
for (let t = 0, n = e.count; t < n; t++) Fi.fromBufferAttribute(e, t), Fi.normalize(), e.setXYZ(t, Fi.x, Fi.y, Fi.z)
|
|
}
|
|
toNonIndexed() {
|
|
function e(e, t) {
|
|
const n = e.array,
|
|
i = e.itemSize,
|
|
r = e.normalized,
|
|
a = new n.constructor(t.length * i);
|
|
let s = 0,
|
|
o = 0;
|
|
for (let r = 0, l = t.length; r < l; r++) {
|
|
s = e.isInterleavedBufferAttribute ? t[r] * e.data.stride + e.offset : t[r] * i;
|
|
for (let e = 0; e < i; e++) a[o++] = n[s++]
|
|
}
|
|
return new Ci(a, i, r)
|
|
}
|
|
if (null === this.index) return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."), this;
|
|
const t = new Oi,
|
|
n = this.index.array,
|
|
i = this.attributes;
|
|
for (const r in i) {
|
|
const a = e(i[r], n);
|
|
t.setAttribute(r, a)
|
|
}
|
|
const r = this.morphAttributes;
|
|
for (const i in r) {
|
|
const a = [],
|
|
s = r[i];
|
|
for (let t = 0, i = s.length; t < i; t++) {
|
|
const i = e(s[t], n);
|
|
a.push(i)
|
|
}
|
|
t.morphAttributes[i] = a
|
|
}
|
|
t.morphTargetsRelative = this.morphTargetsRelative;
|
|
const a = this.groups;
|
|
for (let e = 0, n = a.length; e < n; e++) {
|
|
const n = a[e];
|
|
t.addGroup(n.start, n.count, n.materialIndex)
|
|
}
|
|
return t
|
|
}
|
|
toJSON() {
|
|
const e = {
|
|
metadata: {
|
|
version: 4.6,
|
|
type: "BufferGeometry",
|
|
generator: "BufferGeometry.toJSON"
|
|
}
|
|
};
|
|
if (e.uuid = this.uuid, e.type = this.type, "" !== this.name && (e.name = this.name), Object.keys(this.userData).length > 0 && (e.userData = this.userData), void 0 !== this.parameters) {
|
|
const t = this.parameters;
|
|
for (const n in t) void 0 !== t[n] && (e[n] = t[n]);
|
|
return e
|
|
}
|
|
e.data = {
|
|
attributes: {}
|
|
};
|
|
const t = this.index;
|
|
null !== t && (e.data.index = {
|
|
type: t.array.constructor.name,
|
|
array: Array.prototype.slice.call(t.array)
|
|
});
|
|
const n = this.attributes;
|
|
for (const t in n) {
|
|
const i = n[t];
|
|
e.data.attributes[t] = i.toJSON(e.data)
|
|
}
|
|
const i = {};
|
|
let r = !1;
|
|
for (const t in this.morphAttributes) {
|
|
const n = this.morphAttributes[t],
|
|
a = [];
|
|
for (let t = 0, i = n.length; t < i; t++) {
|
|
const i = n[t];
|
|
a.push(i.toJSON(e.data))
|
|
}
|
|
a.length > 0 && (i[t] = a, r = !0)
|
|
}
|
|
r && (e.data.morphAttributes = i, e.data.morphTargetsRelative = this.morphTargetsRelative);
|
|
const a = this.groups;
|
|
a.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(a)));
|
|
const s = this.boundingSphere;
|
|
return null !== s && (e.data.boundingSphere = {
|
|
center: s.center.toArray(),
|
|
radius: s.radius
|
|
}), e
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
copy(e) {
|
|
this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null;
|
|
const t = {};
|
|
this.name = e.name;
|
|
const n = e.index;
|
|
null !== n && this.setIndex(n.clone(t));
|
|
const i = e.attributes;
|
|
for (const e in i) {
|
|
const n = i[e];
|
|
this.setAttribute(e, n.clone(t))
|
|
}
|
|
const r = e.morphAttributes;
|
|
for (const e in r) {
|
|
const n = [],
|
|
i = r[e];
|
|
for (let e = 0, r = i.length; e < r; e++) n.push(i[e].clone(t));
|
|
this.morphAttributes[e] = n
|
|
}
|
|
this.morphTargetsRelative = e.morphTargetsRelative;
|
|
const a = e.groups;
|
|
for (let e = 0, t = a.length; e < t; e++) {
|
|
const t = a[e];
|
|
this.addGroup(t.start, t.count, t.materialIndex)
|
|
}
|
|
const s = e.boundingBox;
|
|
null !== s && (this.boundingBox = s.clone());
|
|
const o = e.boundingSphere;
|
|
return null !== o && (this.boundingSphere = o.clone()), this.drawRange.start = e.drawRange.start, this.drawRange.count = e.drawRange.count, this.userData = e.userData, this
|
|
}
|
|
dispose() {
|
|
this.dispatchEvent({
|
|
type: "dispose"
|
|
})
|
|
}
|
|
}
|
|
const zi = new Cn,
|
|
Wi = new Tn,
|
|
Hi = new vn,
|
|
Vi = new Zt,
|
|
Gi = new Zt,
|
|
Qi = new Zt,
|
|
Xi = new Zt,
|
|
ji = new Zt,
|
|
qi = new Zt,
|
|
Yi = new Zt,
|
|
Ki = new Zt;
|
|
class Zi extends ti {
|
|
constructor(e = new Oi, t = new Ei) {
|
|
super(), this.isMesh = !0, this.type = "Mesh", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets()
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), void 0 !== e.morphTargetInfluences && (this.morphTargetInfluences = e.morphTargetInfluences.slice()), void 0 !== e.morphTargetDictionary && (this.morphTargetDictionary = Object.assign({}, e.morphTargetDictionary)), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this
|
|
}
|
|
updateMorphTargets() {
|
|
const e = this.geometry.morphAttributes,
|
|
t = Object.keys(e);
|
|
if (t.length > 0) {
|
|
const n = e[t[0]];
|
|
if (void 0 !== n) {
|
|
this.morphTargetInfluences = [], this.morphTargetDictionary = {};
|
|
for (let e = 0, t = n.length; e < t; e++) {
|
|
const t = n[e].name || String(e);
|
|
this.morphTargetInfluences.push(0), this.morphTargetDictionary[t] = e
|
|
}
|
|
}
|
|
}
|
|
}
|
|
getVertexPosition(e, t) {
|
|
const n = this.geometry,
|
|
i = n.attributes.position,
|
|
r = n.morphAttributes.position,
|
|
a = n.morphTargetsRelative;
|
|
t.fromBufferAttribute(i, e);
|
|
const s = this.morphTargetInfluences;
|
|
if (r && s) {
|
|
qi.set(0, 0, 0);
|
|
for (let n = 0, i = r.length; n < i; n++) {
|
|
const i = s[n],
|
|
o = r[n];
|
|
0 !== i && (ji.fromBufferAttribute(o, e), a ? qi.addScaledVector(ji, i) : qi.addScaledVector(ji.sub(t), i))
|
|
}
|
|
t.add(qi)
|
|
}
|
|
return t
|
|
}
|
|
raycast(e, t) {
|
|
const n = this.geometry,
|
|
i = this.material,
|
|
r = this.matrixWorld;
|
|
if (void 0 !== i) {
|
|
if (null === n.boundingSphere && n.computeBoundingSphere(), Hi.copy(n.boundingSphere), Hi.applyMatrix4(r), Wi.copy(e.ray).recast(e.near), !1 === Hi.containsPoint(Wi.origin)) {
|
|
if (null === Wi.intersectSphere(Hi, Vi)) return;
|
|
if (Wi.origin.distanceToSquared(Vi) > (e.far - e.near) ** 2) return
|
|
}
|
|
zi.copy(r).invert(), Wi.copy(e.ray).applyMatrix4(zi), null !== n.boundingBox && !1 === Wi.intersectsBox(n.boundingBox) || this._computeIntersections(e, t, Wi)
|
|
}
|
|
}
|
|
_computeIntersections(e, t, n) {
|
|
let i;
|
|
const r = this.geometry,
|
|
a = this.material,
|
|
s = r.index,
|
|
o = r.attributes.position,
|
|
l = r.attributes.uv,
|
|
c = r.attributes.uv1,
|
|
h = r.attributes.normal,
|
|
u = r.groups,
|
|
d = r.drawRange;
|
|
if (null !== s)
|
|
if (Array.isArray(a))
|
|
for (let r = 0, o = u.length; r < o; r++) {
|
|
const o = u[r],
|
|
f = a[o.materialIndex];
|
|
for (let r = Math.max(o.start, d.start), a = Math.min(s.count, Math.min(o.start + o.count, d.start + d.count)); r < a; r += 3) {
|
|
i = Ji(this, f, e, n, l, c, h, s.getX(r), s.getX(r + 1), s.getX(r + 2)), i && (i.faceIndex = Math.floor(r / 3), i.face.materialIndex = o.materialIndex, t.push(i))
|
|
}
|
|
} else {
|
|
for (let r = Math.max(0, d.start), o = Math.min(s.count, d.start + d.count); r < o; r += 3) {
|
|
i = Ji(this, a, e, n, l, c, h, s.getX(r), s.getX(r + 1), s.getX(r + 2)), i && (i.faceIndex = Math.floor(r / 3), t.push(i))
|
|
}
|
|
} else if (void 0 !== o)
|
|
if (Array.isArray(a))
|
|
for (let r = 0, s = u.length; r < s; r++) {
|
|
const s = u[r],
|
|
f = a[s.materialIndex];
|
|
for (let r = Math.max(s.start, d.start), a = Math.min(o.count, Math.min(s.start + s.count, d.start + d.count)); r < a; r += 3) {
|
|
i = Ji(this, f, e, n, l, c, h, r, r + 1, r + 2), i && (i.faceIndex = Math.floor(r / 3), i.face.materialIndex = s.materialIndex, t.push(i))
|
|
}
|
|
} else {
|
|
for (let r = Math.max(0, d.start), s = Math.min(o.count, d.start + d.count); r < s; r += 3) {
|
|
i = Ji(this, a, e, n, l, c, h, r, r + 1, r + 2), i && (i.faceIndex = Math.floor(r / 3), t.push(i))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function Ji(e, t, n, i, r, a, s, o, l, c) {
|
|
e.getVertexPosition(o, Gi), e.getVertexPosition(l, Qi), e.getVertexPosition(c, Xi);
|
|
const h = function(e, t, n, i, r, a, s, o) {
|
|
let l;
|
|
if (l = 1 === t.side ? i.intersectTriangle(s, a, r, !0, o) : i.intersectTriangle(r, a, s, 0 === t.side, o), null === l) return null;
|
|
Ki.copy(o), Ki.applyMatrix4(e.matrixWorld);
|
|
const c = n.ray.origin.distanceTo(Ki);
|
|
return c < n.near || c > n.far ? null : {
|
|
distance: c,
|
|
point: Ki.clone(),
|
|
object: e
|
|
}
|
|
}(e, t, n, i, Gi, Qi, Xi, Yi);
|
|
if (h) {
|
|
const e = new Zt;
|
|
mi.getBarycoord(Yi, Gi, Qi, Xi, e), r && (h.uv = mi.getInterpolatedAttribute(r, o, l, c, e, new Et)), a && (h.uv1 = mi.getInterpolatedAttribute(a, o, l, c, e, new Et)), s && (h.normal = mi.getInterpolatedAttribute(s, o, l, c, e, new Zt), h.normal.dot(i.direction) > 0 && h.normal.multiplyScalar(-1));
|
|
const t = {
|
|
a: o,
|
|
b: l,
|
|
c,
|
|
normal: new Zt,
|
|
materialIndex: 0
|
|
};
|
|
mi.getNormal(Gi, Qi, Xi, t.normal), h.face = t, h.barycoord = e
|
|
}
|
|
return h
|
|
}
|
|
class $i extends Oi {
|
|
constructor(e = 1, t = 1, n = 1, i = 1, r = 1, a = 1) {
|
|
super(), this.type = "BoxGeometry", this.parameters = {
|
|
width: e,
|
|
height: t,
|
|
depth: n,
|
|
widthSegments: i,
|
|
heightSegments: r,
|
|
depthSegments: a
|
|
};
|
|
const s = this;
|
|
i = Math.floor(i), r = Math.floor(r), a = Math.floor(a);
|
|
const o = [],
|
|
l = [],
|
|
c = [],
|
|
h = [];
|
|
let u = 0,
|
|
d = 0;
|
|
|
|
function f(e, t, n, i, r, a, f, p, m, g, A) {
|
|
const _ = a / m,
|
|
v = f / g,
|
|
w = a / 2,
|
|
y = f / 2,
|
|
x = p / 2,
|
|
b = m + 1,
|
|
E = g + 1;
|
|
let S = 0,
|
|
M = 0;
|
|
const T = new Zt;
|
|
for (let a = 0; a < E; a++) {
|
|
const s = a * v - y;
|
|
for (let o = 0; o < b; o++) {
|
|
const u = o * _ - w;
|
|
T[e] = u * i, T[t] = s * r, T[n] = x, l.push(T.x, T.y, T.z), T[e] = 0, T[t] = 0, T[n] = p > 0 ? 1 : -1, c.push(T.x, T.y, T.z), h.push(o / m), h.push(1 - a / g), S += 1
|
|
}
|
|
}
|
|
for (let e = 0; e < g; e++)
|
|
for (let t = 0; t < m; t++) {
|
|
const n = u + t + b * e,
|
|
i = u + t + b * (e + 1),
|
|
r = u + (t + 1) + b * (e + 1),
|
|
a = u + (t + 1) + b * e;
|
|
o.push(n, i, a), o.push(i, r, a), M += 6
|
|
}
|
|
s.addGroup(d, M, A), d += M, u += S
|
|
}
|
|
f("z", "y", "x", -1, -1, n, t, e, a, r, 0), f("z", "y", "x", 1, -1, n, t, -e, a, r, 1), f("x", "z", "y", 1, 1, e, n, t, i, a, 2), f("x", "z", "y", 1, -1, e, n, -t, i, a, 3), f("x", "y", "z", 1, -1, e, t, n, i, r, 4), f("x", "y", "z", -1, -1, e, t, -n, i, r, 5), this.setIndex(o), this.setAttribute("position", new Pi(l, 3)), this.setAttribute("normal", new Pi(c, 3)), this.setAttribute("uv", new Pi(h, 2))
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this
|
|
}
|
|
static fromJSON(e) {
|
|
return new $i(e.width, e.height, e.depth, e.widthSegments, e.heightSegments, e.depthSegments)
|
|
}
|
|
}
|
|
|
|
function er(e) {
|
|
const t = {};
|
|
for (const n in e) {
|
|
t[n] = {};
|
|
for (const i in e[n]) {
|
|
const r = e[n][i];
|
|
r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture || r.isQuaternion) ? r.isRenderTargetTexture ? (console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."), t[n][i] = null) : t[n][i] = r.clone() : Array.isArray(r) ? t[n][i] = r.slice() : t[n][i] = r
|
|
}
|
|
}
|
|
return t
|
|
}
|
|
|
|
function tr(e) {
|
|
const t = {};
|
|
for (let n = 0; n < e.length; n++) {
|
|
const i = er(e[n]);
|
|
for (const e in i) t[e] = i[e]
|
|
}
|
|
return t
|
|
}
|
|
|
|
function nr(e) {
|
|
const t = e.getRenderTarget();
|
|
return null === t ? e.outputColorSpace : !0 === t.isXRRenderTarget ? t.texture.colorSpace : Ut.workingColorSpace
|
|
}
|
|
const ir = {
|
|
clone: er,
|
|
merge: tr
|
|
};
|
|
class rr extends bi {
|
|
constructor(e) {
|
|
super(), this.isShaderMaterial = !0, this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, this.uniformsGroups = [], this.vertexShader = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}", this.fragmentShader = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}", this.linewidth = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.clipping = !1, this.forceSinglePass = !0, this.extensions = {
|
|
clipCullDistance: !1,
|
|
multiDraw: !1
|
|
}, this.defaultAttributeValues = {
|
|
color: [1, 1, 1],
|
|
uv: [0, 0],
|
|
uv1: [0, 0]
|
|
}, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, this.glslVersion = null, void 0 !== e && this.setValues(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.fragmentShader = e.fragmentShader, this.vertexShader = e.vertexShader, this.uniforms = er(e.uniforms), this.uniformsGroups = function(e) {
|
|
const t = [];
|
|
for (let n = 0; n < e.length; n++) t.push(e[n].clone());
|
|
return t
|
|
}(e.uniformsGroups), this.defines = Object.assign({}, e.defines), this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.fog = e.fog, this.lights = e.lights, this.clipping = e.clipping, this.extensions = Object.assign({}, e.extensions), this.glslVersion = e.glslVersion, this
|
|
}
|
|
toJSON(e) {
|
|
const t = super.toJSON(e);
|
|
t.glslVersion = this.glslVersion, t.uniforms = {};
|
|
for (const n in this.uniforms) {
|
|
const i = this.uniforms[n].value;
|
|
i && i.isTexture ? t.uniforms[n] = {
|
|
type: "t",
|
|
value: i.toJSON(e).uuid
|
|
} : i && i.isColor ? t.uniforms[n] = {
|
|
type: "c",
|
|
value: i.getHex()
|
|
} : i && i.isVector2 ? t.uniforms[n] = {
|
|
type: "v2",
|
|
value: i.toArray()
|
|
} : i && i.isVector3 ? t.uniforms[n] = {
|
|
type: "v3",
|
|
value: i.toArray()
|
|
} : i && i.isVector4 ? t.uniforms[n] = {
|
|
type: "v4",
|
|
value: i.toArray()
|
|
} : i && i.isMatrix3 ? t.uniforms[n] = {
|
|
type: "m3",
|
|
value: i.toArray()
|
|
} : i && i.isMatrix4 ? t.uniforms[n] = {
|
|
type: "m4",
|
|
value: i.toArray()
|
|
} : t.uniforms[n] = {
|
|
value: i
|
|
}
|
|
}
|
|
Object.keys(this.defines).length > 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader, t.lights = this.lights, t.clipping = this.clipping;
|
|
const n = {};
|
|
for (const e in this.extensions) !0 === this.extensions[e] && (n[e] = !0);
|
|
return Object.keys(n).length > 0 && (t.extensions = n), t
|
|
}
|
|
}
|
|
class ar extends ti {
|
|
constructor() {
|
|
super(), this.isCamera = !0, this.type = "Camera", this.matrixWorldInverse = new Cn, this.projectionMatrix = new Cn, this.projectionMatrixInverse = new Cn, this.coordinateSystem = ht
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this.coordinateSystem = e.coordinateSystem, this
|
|
}
|
|
getWorldDirection(e) {
|
|
return super.getWorldDirection(e).negate()
|
|
}
|
|
updateMatrixWorld(e) {
|
|
super.updateMatrixWorld(e), this.matrixWorldInverse.copy(this.matrixWorld).invert()
|
|
}
|
|
updateWorldMatrix(e, t) {
|
|
super.updateWorldMatrix(e, t), this.matrixWorldInverse.copy(this.matrixWorld).invert()
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
}
|
|
const sr = new Zt,
|
|
or = new Et,
|
|
lr = new Et;
|
|
class cr extends ar {
|
|
constructor(e = 50, t = 1, n = .1, i = 2e3) {
|
|
super(), this.isPerspectiveCamera = !0, this.type = "PerspectiveCamera", this.fov = e, this.zoom = 1, this.near = n, this.far = i, this.focus = 10, this.aspect = t, this.view = null, this.filmGauge = 35, this.filmOffset = 0, this.updateProjectionMatrix()
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.fov = e.fov, this.zoom = e.zoom, this.near = e.near, this.far = e.far, this.focus = e.focus, this.aspect = e.aspect, this.view = null === e.view ? null : Object.assign({}, e.view), this.filmGauge = e.filmGauge, this.filmOffset = e.filmOffset, this
|
|
}
|
|
setFocalLength(e) {
|
|
const t = .5 * this.getFilmHeight() / e;
|
|
this.fov = 2 * gt * Math.atan(t), this.updateProjectionMatrix()
|
|
}
|
|
getFocalLength() {
|
|
const e = Math.tan(.5 * mt * this.fov);
|
|
return .5 * this.getFilmHeight() / e
|
|
}
|
|
getEffectiveFOV() {
|
|
return 2 * gt * Math.atan(Math.tan(.5 * mt * this.fov) / this.zoom)
|
|
}
|
|
getFilmWidth() {
|
|
return this.filmGauge * Math.min(this.aspect, 1)
|
|
}
|
|
getFilmHeight() {
|
|
return this.filmGauge / Math.max(this.aspect, 1)
|
|
}
|
|
getViewBounds(e, t, n) {
|
|
sr.set(-1, -1, .5).applyMatrix4(this.projectionMatrixInverse), t.set(sr.x, sr.y).multiplyScalar(-e / sr.z), sr.set(1, 1, .5).applyMatrix4(this.projectionMatrixInverse), n.set(sr.x, sr.y).multiplyScalar(-e / sr.z)
|
|
}
|
|
getViewSize(e, t) {
|
|
return this.getViewBounds(e, or, lr), t.subVectors(lr, or)
|
|
}
|
|
setViewOffset(e, t, n, i, r, a) {
|
|
this.aspect = e / t, null === this.view && (this.view = {
|
|
enabled: !0,
|
|
fullWidth: 1,
|
|
fullHeight: 1,
|
|
offsetX: 0,
|
|
offsetY: 0,
|
|
width: 1,
|
|
height: 1
|
|
}), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix()
|
|
}
|
|
clearViewOffset() {
|
|
null !== this.view && (this.view.enabled = !1), this.updateProjectionMatrix()
|
|
}
|
|
updateProjectionMatrix() {
|
|
const e = this.near;
|
|
let t = e * Math.tan(.5 * mt * this.fov) / this.zoom,
|
|
n = 2 * t,
|
|
i = this.aspect * n,
|
|
r = -.5 * i;
|
|
const a = this.view;
|
|
if (null !== this.view && this.view.enabled) {
|
|
const e = a.fullWidth,
|
|
s = a.fullHeight;
|
|
r += a.offsetX * i / e, t -= a.offsetY * n / s, i *= a.width / e, n *= a.height / s
|
|
}
|
|
const s = this.filmOffset;
|
|
0 !== s && (r += e * s / this.getFilmWidth()), this.projectionMatrix.makePerspective(r, r + i, t, t - n, e, this.far, this.coordinateSystem), this.projectionMatrixInverse.copy(this.projectionMatrix).invert()
|
|
}
|
|
toJSON(e) {
|
|
const t = super.toJSON(e);
|
|
return t.object.fov = this.fov, t.object.zoom = this.zoom, t.object.near = this.near, t.object.far = this.far, t.object.focus = this.focus, t.object.aspect = this.aspect, null !== this.view && (t.object.view = Object.assign({}, this.view)), t.object.filmGauge = this.filmGauge, t.object.filmOffset = this.filmOffset, t
|
|
}
|
|
}
|
|
const hr = -90;
|
|
class ur extends ti {
|
|
constructor(e, t, n) {
|
|
super(), this.type = "CubeCamera", this.renderTarget = n, this.coordinateSystem = null, this.activeMipmapLevel = 0;
|
|
const i = new cr(hr, 1, e, t);
|
|
i.layers = this.layers, this.add(i);
|
|
const r = new cr(hr, 1, e, t);
|
|
r.layers = this.layers, this.add(r);
|
|
const a = new cr(hr, 1, e, t);
|
|
a.layers = this.layers, this.add(a);
|
|
const s = new cr(hr, 1, e, t);
|
|
s.layers = this.layers, this.add(s);
|
|
const o = new cr(hr, 1, e, t);
|
|
o.layers = this.layers, this.add(o);
|
|
const l = new cr(hr, 1, e, t);
|
|
l.layers = this.layers, this.add(l)
|
|
}
|
|
updateCoordinateSystem() {
|
|
const e = this.coordinateSystem,
|
|
t = this.children.concat(),
|
|
[n, i, r, a, s, o] = t;
|
|
for (const e of t) this.remove(e);
|
|
if (e === ht) n.up.set(0, 1, 0), n.lookAt(1, 0, 0), i.up.set(0, 1, 0), i.lookAt(-1, 0, 0), r.up.set(0, 0, -1), r.lookAt(0, 1, 0), a.up.set(0, 0, 1), a.lookAt(0, -1, 0), s.up.set(0, 1, 0), s.lookAt(0, 0, 1), o.up.set(0, 1, 0), o.lookAt(0, 0, -1);
|
|
else {
|
|
if (e !== ut) throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: " + e);
|
|
n.up.set(0, -1, 0), n.lookAt(-1, 0, 0), i.up.set(0, -1, 0), i.lookAt(1, 0, 0), r.up.set(0, 0, 1), r.lookAt(0, 1, 0), a.up.set(0, 0, -1), a.lookAt(0, -1, 0), s.up.set(0, -1, 0), s.lookAt(0, 0, 1), o.up.set(0, -1, 0), o.lookAt(0, 0, -1)
|
|
}
|
|
for (const e of t) this.add(e), e.updateMatrixWorld()
|
|
}
|
|
update(e, t) {
|
|
null === this.parent && this.updateMatrixWorld();
|
|
const {
|
|
renderTarget: n,
|
|
activeMipmapLevel: i
|
|
} = this;
|
|
this.coordinateSystem !== e.coordinateSystem && (this.coordinateSystem = e.coordinateSystem, this.updateCoordinateSystem());
|
|
const [r, a, s, o, l, c] = this.children, h = e.getRenderTarget(), u = e.getActiveCubeFace(), d = e.getActiveMipmapLevel(), f = e.xr.enabled;
|
|
e.xr.enabled = !1;
|
|
const p = n.texture.generateMipmaps;
|
|
n.texture.generateMipmaps = !1, e.setRenderTarget(n, 0, i), e.render(t, r), e.setRenderTarget(n, 1, i), e.render(t, a), e.setRenderTarget(n, 2, i), e.render(t, s), e.setRenderTarget(n, 3, i), e.render(t, o), e.setRenderTarget(n, 4, i), e.render(t, l), n.texture.generateMipmaps = p, e.setRenderTarget(n, 5, i), e.render(t, c), e.setRenderTarget(h, u, d), e.xr.enabled = f, n.texture.needsPMREMUpdate = !0
|
|
}
|
|
}
|
|
class dr extends Gt {
|
|
constructor(e, t, n, i, r, a, s, o, l, c) {
|
|
super(e = void 0 !== e ? e : [], t = void 0 !== t ? t : B, n, i, r, a, s, o, l, c), this.isCubeTexture = !0, this.flipY = !1
|
|
}
|
|
get images() {
|
|
return this.image
|
|
}
|
|
set images(e) {
|
|
this.image = e
|
|
}
|
|
}
|
|
class fr extends jt {
|
|
constructor(e = 1, t = {}) {
|
|
super(e, e, t), this.isWebGLCubeRenderTarget = !0;
|
|
const n = {
|
|
width: e,
|
|
height: e,
|
|
depth: 1
|
|
},
|
|
i = [n, n, n, n, n, n];
|
|
this.texture = new dr(i, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.generateMipmaps = void 0 !== t.generateMipmaps && t.generateMipmaps, this.texture.minFilter = void 0 !== t.minFilter ? t.minFilter : V
|
|
}
|
|
fromEquirectangularTexture(e, t) {
|
|
this.texture.type = t.type, this.texture.colorSpace = t.colorSpace, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter;
|
|
const n = {
|
|
uniforms: {
|
|
tEquirect: {
|
|
value: null
|
|
}
|
|
},
|
|
vertexShader: "\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",
|
|
fragmentShader: "\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"
|
|
},
|
|
i = new $i(5, 5, 5),
|
|
r = new rr({
|
|
name: "CubemapFromEquirect",
|
|
uniforms: er(n.uniforms),
|
|
vertexShader: n.vertexShader,
|
|
fragmentShader: n.fragmentShader,
|
|
side: 1,
|
|
blending: 0
|
|
});
|
|
r.uniforms.tEquirect.value = t;
|
|
const a = new Zi(i, r),
|
|
s = t.minFilter;
|
|
t.minFilter === Q && (t.minFilter = V);
|
|
return new ur(1, 10, this).update(e, a), t.minFilter = s, a.geometry.dispose(), a.material.dispose(), this
|
|
}
|
|
clear(e, t, n, i) {
|
|
const r = e.getRenderTarget();
|
|
for (let r = 0; r < 6; r++) e.setRenderTarget(this, r), e.clear(t, n, i);
|
|
e.setRenderTarget(r)
|
|
}
|
|
}
|
|
class pr extends ti {
|
|
constructor() {
|
|
super(), this.isGroup = !0, this.type = "Group"
|
|
}
|
|
}
|
|
const mr = {
|
|
type: "move"
|
|
};
|
|
class gr {
|
|
constructor() {
|
|
this._targetRay = null, this._grip = null, this._hand = null
|
|
}
|
|
getHandSpace() {
|
|
return null === this._hand && (this._hand = new pr, this._hand.matrixAutoUpdate = !1, this._hand.visible = !1, this._hand.joints = {}, this._hand.inputState = {
|
|
pinching: !1
|
|
}), this._hand
|
|
}
|
|
getTargetRaySpace() {
|
|
return null === this._targetRay && (this._targetRay = new pr, this._targetRay.matrixAutoUpdate = !1, this._targetRay.visible = !1, this._targetRay.hasLinearVelocity = !1, this._targetRay.linearVelocity = new Zt, this._targetRay.hasAngularVelocity = !1, this._targetRay.angularVelocity = new Zt), this._targetRay
|
|
}
|
|
getGripSpace() {
|
|
return null === this._grip && (this._grip = new pr, this._grip.matrixAutoUpdate = !1, this._grip.visible = !1, this._grip.hasLinearVelocity = !1, this._grip.linearVelocity = new Zt, this._grip.hasAngularVelocity = !1, this._grip.angularVelocity = new Zt), this._grip
|
|
}
|
|
dispatchEvent(e) {
|
|
return null !== this._targetRay && this._targetRay.dispatchEvent(e), null !== this._grip && this._grip.dispatchEvent(e), null !== this._hand && this._hand.dispatchEvent(e), this
|
|
}
|
|
connect(e) {
|
|
if (e && e.hand) {
|
|
const t = this._hand;
|
|
if (t)
|
|
for (const n of e.hand.values()) this._getHandJoint(t, n)
|
|
}
|
|
return this.dispatchEvent({
|
|
type: "connected",
|
|
data: e
|
|
}), this
|
|
}
|
|
disconnect(e) {
|
|
return this.dispatchEvent({
|
|
type: "disconnected",
|
|
data: e
|
|
}), null !== this._targetRay && (this._targetRay.visible = !1), null !== this._grip && (this._grip.visible = !1), null !== this._hand && (this._hand.visible = !1), this
|
|
}
|
|
update(e, t, n) {
|
|
let i = null,
|
|
r = null,
|
|
a = null;
|
|
const s = this._targetRay,
|
|
o = this._grip,
|
|
l = this._hand;
|
|
if (e && "visible-blurred" !== t.session.visibilityState) {
|
|
if (l && e.hand) {
|
|
a = !0;
|
|
for (const i of e.hand.values()) {
|
|
const e = t.getJointPose(i, n),
|
|
r = this._getHandJoint(l, i);
|
|
null !== e && (r.matrix.fromArray(e.transform.matrix), r.matrix.decompose(r.position, r.rotation, r.scale), r.matrixWorldNeedsUpdate = !0, r.jointRadius = e.radius), r.visible = null !== e
|
|
}
|
|
const i = l.joints["index-finger-tip"],
|
|
r = l.joints["thumb-tip"],
|
|
s = i.position.distanceTo(r.position),
|
|
o = .02,
|
|
c = .005;
|
|
l.inputState.pinching && s > o + c ? (l.inputState.pinching = !1, this.dispatchEvent({
|
|
type: "pinchend",
|
|
handedness: e.handedness,
|
|
target: this
|
|
})) : !l.inputState.pinching && s <= o - c && (l.inputState.pinching = !0, this.dispatchEvent({
|
|
type: "pinchstart",
|
|
handedness: e.handedness,
|
|
target: this
|
|
}))
|
|
} else null !== o && e.gripSpace && (r = t.getPose(e.gripSpace, n), null !== r && (o.matrix.fromArray(r.transform.matrix), o.matrix.decompose(o.position, o.rotation, o.scale), o.matrixWorldNeedsUpdate = !0, r.linearVelocity ? (o.hasLinearVelocity = !0, o.linearVelocity.copy(r.linearVelocity)) : o.hasLinearVelocity = !1, r.angularVelocity ? (o.hasAngularVelocity = !0, o.angularVelocity.copy(r.angularVelocity)) : o.hasAngularVelocity = !1));
|
|
null !== s && (i = t.getPose(e.targetRaySpace, n), null === i && null !== r && (i = r), null !== i && (s.matrix.fromArray(i.transform.matrix), s.matrix.decompose(s.position, s.rotation, s.scale), s.matrixWorldNeedsUpdate = !0, i.linearVelocity ? (s.hasLinearVelocity = !0, s.linearVelocity.copy(i.linearVelocity)) : s.hasLinearVelocity = !1, i.angularVelocity ? (s.hasAngularVelocity = !0, s.angularVelocity.copy(i.angularVelocity)) : s.hasAngularVelocity = !1, this.dispatchEvent(mr)))
|
|
}
|
|
return null !== s && (s.visible = null !== i), null !== o && (o.visible = null !== r), null !== l && (l.visible = null !== a), this
|
|
}
|
|
_getHandJoint(e, t) {
|
|
if (void 0 === e.joints[t.jointName]) {
|
|
const n = new pr;
|
|
n.matrixAutoUpdate = !1, n.visible = !1, e.joints[t.jointName] = n, e.add(n)
|
|
}
|
|
return e.joints[t.jointName]
|
|
}
|
|
}
|
|
class Ar {
|
|
constructor(e, t = 1, n = 1e3) {
|
|
this.isFog = !0, this.name = "", this.color = new wi(e), this.near = t, this.far = n
|
|
}
|
|
clone() {
|
|
return new Ar(this.color, this.near, this.far)
|
|
}
|
|
toJSON() {
|
|
return {
|
|
type: "Fog",
|
|
name: this.name,
|
|
color: this.color.getHex(),
|
|
near: this.near,
|
|
far: this.far
|
|
}
|
|
}
|
|
}
|
|
class _r extends ti {
|
|
constructor() {
|
|
super(), this.isScene = !0, this.type = "Scene", this.background = null, this.environment = null, this.fog = null, this.backgroundBlurriness = 0, this.backgroundIntensity = 1, this.backgroundRotation = new Fn, this.environmentIntensity = 1, this.environmentRotation = new Fn, this.overrideMaterial = null, "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", {
|
|
detail: this
|
|
}))
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), null !== e.background && (this.background = e.background.clone()), null !== e.environment && (this.environment = e.environment.clone()), null !== e.fog && (this.fog = e.fog.clone()), this.backgroundBlurriness = e.backgroundBlurriness, this.backgroundIntensity = e.backgroundIntensity, this.backgroundRotation.copy(e.backgroundRotation), this.environmentIntensity = e.environmentIntensity, this.environmentRotation.copy(e.environmentRotation), null !== e.overrideMaterial && (this.overrideMaterial = e.overrideMaterial.clone()), this.matrixAutoUpdate = e.matrixAutoUpdate, this
|
|
}
|
|
toJSON(e) {
|
|
const t = super.toJSON(e);
|
|
return null !== this.fog && (t.object.fog = this.fog.toJSON()), this.backgroundBlurriness > 0 && (t.object.backgroundBlurriness = this.backgroundBlurriness), 1 !== this.backgroundIntensity && (t.object.backgroundIntensity = this.backgroundIntensity), t.object.backgroundRotation = this.backgroundRotation.toArray(), 1 !== this.environmentIntensity && (t.object.environmentIntensity = this.environmentIntensity), t.object.environmentRotation = this.environmentRotation.toArray(), t
|
|
}
|
|
}
|
|
class vr {
|
|
constructor(e, t) {
|
|
this.isInterleavedBuffer = !0, this.array = e, this.stride = t, this.count = void 0 !== e ? e.length / t : 0, this.usage = lt, this.updateRanges = [], this.version = 0, this.uuid = At()
|
|
}
|
|
onUploadCallback() {}
|
|
set needsUpdate(e) {
|
|
!0 === e && this.version++
|
|
}
|
|
setUsage(e) {
|
|
return this.usage = e, this
|
|
}
|
|
addUpdateRange(e, t) {
|
|
this.updateRanges.push({
|
|
start: e,
|
|
count: t
|
|
})
|
|
}
|
|
clearUpdateRanges() {
|
|
this.updateRanges.length = 0
|
|
}
|
|
copy(e) {
|
|
return this.array = new e.array.constructor(e.array), this.count = e.count, this.stride = e.stride, this.usage = e.usage, this
|
|
}
|
|
copyAt(e, t, n) {
|
|
e *= this.stride, n *= t.stride;
|
|
for (let i = 0, r = this.stride; i < r; i++) this.array[e + i] = t.array[n + i];
|
|
return this
|
|
}
|
|
set(e, t = 0) {
|
|
return this.array.set(e, t), this
|
|
}
|
|
clone(e) {
|
|
void 0 === e.arrayBuffers && (e.arrayBuffers = {}), void 0 === this.array.buffer._uuid && (this.array.buffer._uuid = At()), void 0 === e.arrayBuffers[this.array.buffer._uuid] && (e.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer);
|
|
const t = new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),
|
|
n = new this.constructor(t, this.stride);
|
|
return n.setUsage(this.usage), n
|
|
}
|
|
onUpload(e) {
|
|
return this.onUploadCallback = e, this
|
|
}
|
|
toJSON(e) {
|
|
return void 0 === e.arrayBuffers && (e.arrayBuffers = {}), void 0 === this.array.buffer._uuid && (this.array.buffer._uuid = At()), void 0 === e.arrayBuffers[this.array.buffer._uuid] && (e.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer))), {
|
|
uuid: this.uuid,
|
|
buffer: this.array.buffer._uuid,
|
|
type: this.array.constructor.name,
|
|
stride: this.stride
|
|
}
|
|
}
|
|
}
|
|
const wr = new Zt;
|
|
class yr {
|
|
constructor(e, t, n, i = !1) {
|
|
this.isInterleavedBufferAttribute = !0, this.name = "", this.data = e, this.itemSize = t, this.offset = n, this.normalized = i
|
|
}
|
|
get count() {
|
|
return this.data.count
|
|
}
|
|
get array() {
|
|
return this.data.array
|
|
}
|
|
set needsUpdate(e) {
|
|
this.data.needsUpdate = e
|
|
}
|
|
applyMatrix4(e) {
|
|
for (let t = 0, n = this.data.count; t < n; t++) wr.fromBufferAttribute(this, t), wr.applyMatrix4(e), this.setXYZ(t, wr.x, wr.y, wr.z);
|
|
return this
|
|
}
|
|
applyNormalMatrix(e) {
|
|
for (let t = 0, n = this.count; t < n; t++) wr.fromBufferAttribute(this, t), wr.applyNormalMatrix(e), this.setXYZ(t, wr.x, wr.y, wr.z);
|
|
return this
|
|
}
|
|
transformDirection(e) {
|
|
for (let t = 0, n = this.count; t < n; t++) wr.fromBufferAttribute(this, t), wr.transformDirection(e), this.setXYZ(t, wr.x, wr.y, wr.z);
|
|
return this
|
|
}
|
|
getComponent(e, t) {
|
|
let n = this.array[e * this.data.stride + this.offset + t];
|
|
return this.normalized && (n = yt(n, this.array)), n
|
|
}
|
|
setComponent(e, t, n) {
|
|
return this.normalized && (n = xt(n, this.array)), this.data.array[e * this.data.stride + this.offset + t] = n, this
|
|
}
|
|
setX(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.data.array[e * this.data.stride + this.offset] = t, this
|
|
}
|
|
setY(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 1] = t, this
|
|
}
|
|
setZ(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 2] = t, this
|
|
}
|
|
setW(e, t) {
|
|
return this.normalized && (t = xt(t, this.array)), this.data.array[e * this.data.stride + this.offset + 3] = t, this
|
|
}
|
|
getX(e) {
|
|
let t = this.data.array[e * this.data.stride + this.offset];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
getY(e) {
|
|
let t = this.data.array[e * this.data.stride + this.offset + 1];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
getZ(e) {
|
|
let t = this.data.array[e * this.data.stride + this.offset + 2];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
getW(e) {
|
|
let t = this.data.array[e * this.data.stride + this.offset + 3];
|
|
return this.normalized && (t = yt(t, this.array)), t
|
|
}
|
|
setXY(e, t, n) {
|
|
return e = e * this.data.stride + this.offset, this.normalized && (t = xt(t, this.array), n = xt(n, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this
|
|
}
|
|
setXYZ(e, t, n, i) {
|
|
return e = e * this.data.stride + this.offset, this.normalized && (t = xt(t, this.array), n = xt(n, this.array), i = xt(i, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = i, this
|
|
}
|
|
setXYZW(e, t, n, i, r) {
|
|
return e = e * this.data.stride + this.offset, this.normalized && (t = xt(t, this.array), n = xt(n, this.array), i = xt(i, this.array), r = xt(r, this.array)), this.data.array[e + 0] = t, this.data.array[e + 1] = n, this.data.array[e + 2] = i, this.data.array[e + 3] = r, this
|
|
}
|
|
clone(e) {
|
|
if (void 0 === e) {
|
|
console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");
|
|
const e = [];
|
|
for (let t = 0; t < this.count; t++) {
|
|
const n = t * this.data.stride + this.offset;
|
|
for (let t = 0; t < this.itemSize; t++) e.push(this.data.array[n + t])
|
|
}
|
|
return new Ci(new this.array.constructor(e), this.itemSize, this.normalized)
|
|
}
|
|
return void 0 === e.interleavedBuffers && (e.interleavedBuffers = {}), void 0 === e.interleavedBuffers[this.data.uuid] && (e.interleavedBuffers[this.data.uuid] = this.data.clone(e)), new yr(e.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized)
|
|
}
|
|
toJSON(e) {
|
|
if (void 0 === e) {
|
|
console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");
|
|
const e = [];
|
|
for (let t = 0; t < this.count; t++) {
|
|
const n = t * this.data.stride + this.offset;
|
|
for (let t = 0; t < this.itemSize; t++) e.push(this.data.array[n + t])
|
|
}
|
|
return {
|
|
itemSize: this.itemSize,
|
|
type: this.array.constructor.name,
|
|
array: e,
|
|
normalized: this.normalized
|
|
}
|
|
}
|
|
return void 0 === e.interleavedBuffers && (e.interleavedBuffers = {}), void 0 === e.interleavedBuffers[this.data.uuid] && (e.interleavedBuffers[this.data.uuid] = this.data.toJSON(e)), {
|
|
isInterleavedBufferAttribute: !0,
|
|
itemSize: this.itemSize,
|
|
data: this.data.uuid,
|
|
offset: this.offset,
|
|
normalized: this.normalized
|
|
}
|
|
}
|
|
}
|
|
const xr = new Zt,
|
|
br = new Qt,
|
|
Er = new Qt,
|
|
Sr = new Zt,
|
|
Mr = new Cn,
|
|
Tr = new Zt,
|
|
Cr = new vn,
|
|
Ir = new Cn,
|
|
Rr = new Tn;
|
|
class Pr extends Zi {
|
|
constructor(e, t) {
|
|
super(e, t), this.isSkinnedMesh = !0, this.type = "SkinnedMesh", this.bindMode = P, this.bindMatrix = new Cn, this.bindMatrixInverse = new Cn, this.boundingBox = null, this.boundingSphere = null
|
|
}
|
|
computeBoundingBox() {
|
|
const e = this.geometry;
|
|
null === this.boundingBox && (this.boundingBox = new en), this.boundingBox.makeEmpty();
|
|
const t = e.getAttribute("position");
|
|
for (let e = 0; e < t.count; e++) this.getVertexPosition(e, Tr), this.boundingBox.expandByPoint(Tr)
|
|
}
|
|
computeBoundingSphere() {
|
|
const e = this.geometry;
|
|
null === this.boundingSphere && (this.boundingSphere = new vn), this.boundingSphere.makeEmpty();
|
|
const t = e.getAttribute("position");
|
|
for (let e = 0; e < t.count; e++) this.getVertexPosition(e, Tr), this.boundingSphere.expandByPoint(Tr)
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.bindMode = e.bindMode, this.bindMatrix.copy(e.bindMatrix), this.bindMatrixInverse.copy(e.bindMatrixInverse), this.skeleton = e.skeleton, null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()), null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), this
|
|
}
|
|
raycast(e, t) {
|
|
const n = this.material,
|
|
i = this.matrixWorld;
|
|
void 0 !== n && (null === this.boundingSphere && this.computeBoundingSphere(), Cr.copy(this.boundingSphere), Cr.applyMatrix4(i), !1 !== e.ray.intersectsSphere(Cr) && (Ir.copy(i).invert(), Rr.copy(e.ray).applyMatrix4(Ir), null !== this.boundingBox && !1 === Rr.intersectsBox(this.boundingBox) || this._computeIntersections(e, t, Rr)))
|
|
}
|
|
getVertexPosition(e, t) {
|
|
return super.getVertexPosition(e, t), this.applyBoneTransform(e, t), t
|
|
}
|
|
bind(e, t) {
|
|
this.skeleton = e, void 0 === t && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), t = this.matrixWorld), this.bindMatrix.copy(t), this.bindMatrixInverse.copy(t).invert()
|
|
}
|
|
pose() {
|
|
this.skeleton.pose()
|
|
}
|
|
normalizeSkinWeights() {
|
|
const e = new Qt,
|
|
t = this.geometry.attributes.skinWeight;
|
|
for (let n = 0, i = t.count; n < i; n++) {
|
|
e.fromBufferAttribute(t, n);
|
|
const i = 1 / e.manhattanLength();
|
|
i !== 1 / 0 ? e.multiplyScalar(i) : e.set(1, 0, 0, 0), t.setXYZW(n, e.x, e.y, e.z, e.w)
|
|
}
|
|
}
|
|
updateMatrixWorld(e) {
|
|
super.updateMatrixWorld(e), this.bindMode === P ? this.bindMatrixInverse.copy(this.matrixWorld).invert() : "detached" === this.bindMode ? this.bindMatrixInverse.copy(this.bindMatrix).invert() : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode)
|
|
}
|
|
applyBoneTransform(e, t) {
|
|
const n = this.skeleton,
|
|
i = this.geometry;
|
|
br.fromBufferAttribute(i.attributes.skinIndex, e), Er.fromBufferAttribute(i.attributes.skinWeight, e), xr.copy(t).applyMatrix4(this.bindMatrix), t.set(0, 0, 0);
|
|
for (let e = 0; e < 4; e++) {
|
|
const i = Er.getComponent(e);
|
|
if (0 !== i) {
|
|
const r = br.getComponent(e);
|
|
Mr.multiplyMatrices(n.bones[r].matrixWorld, n.boneInverses[r]), t.addScaledVector(Sr.copy(xr).applyMatrix4(Mr), i)
|
|
}
|
|
}
|
|
return t.applyMatrix4(this.bindMatrixInverse)
|
|
}
|
|
}
|
|
class Br extends ti {
|
|
constructor() {
|
|
super(), this.isBone = !0, this.type = "Bone"
|
|
}
|
|
}
|
|
class Dr extends Gt {
|
|
constructor(e = null, t = 1, n = 1, i, r, a, s, o, l = 1003, c = 1003, h, u) {
|
|
super(null, a, s, o, l, c, i, r, h, u), this.isDataTexture = !0, this.image = {
|
|
data: e,
|
|
width: t,
|
|
height: n
|
|
}, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1
|
|
}
|
|
}
|
|
const Lr = new Cn,
|
|
Ur = new Cn;
|
|
class kr {
|
|
constructor(e = [], t = []) {
|
|
this.uuid = At(), this.bones = e.slice(0), this.boneInverses = t, this.boneMatrices = null, this.boneTexture = null, this.init()
|
|
}
|
|
init() {
|
|
const e = this.bones,
|
|
t = this.boneInverses;
|
|
if (this.boneMatrices = new Float32Array(16 * e.length), 0 === t.length) this.calculateInverses();
|
|
else if (e.length !== t.length) {
|
|
console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."), this.boneInverses = [];
|
|
for (let e = 0, t = this.bones.length; e < t; e++) this.boneInverses.push(new Cn)
|
|
}
|
|
}
|
|
calculateInverses() {
|
|
this.boneInverses.length = 0;
|
|
for (let e = 0, t = this.bones.length; e < t; e++) {
|
|
const t = new Cn;
|
|
this.bones[e] && t.copy(this.bones[e].matrixWorld).invert(), this.boneInverses.push(t)
|
|
}
|
|
}
|
|
pose() {
|
|
for (let e = 0, t = this.bones.length; e < t; e++) {
|
|
const t = this.bones[e];
|
|
t && t.matrixWorld.copy(this.boneInverses[e]).invert()
|
|
}
|
|
for (let e = 0, t = this.bones.length; e < t; e++) {
|
|
const t = this.bones[e];
|
|
t && (t.parent && t.parent.isBone ? (t.matrix.copy(t.parent.matrixWorld).invert(), t.matrix.multiply(t.matrixWorld)) : t.matrix.copy(t.matrixWorld), t.matrix.decompose(t.position, t.quaternion, t.scale))
|
|
}
|
|
}
|
|
update() {
|
|
const e = this.bones,
|
|
t = this.boneInverses,
|
|
n = this.boneMatrices,
|
|
i = this.boneTexture;
|
|
for (let i = 0, r = e.length; i < r; i++) {
|
|
const r = e[i] ? e[i].matrixWorld : Ur;
|
|
Lr.multiplyMatrices(r, t[i]), Lr.toArray(n, 16 * i)
|
|
}
|
|
null !== i && (i.needsUpdate = !0)
|
|
}
|
|
clone() {
|
|
return new kr(this.bones, this.boneInverses)
|
|
}
|
|
computeBoneTexture() {
|
|
let e = Math.sqrt(4 * this.bones.length);
|
|
e = 4 * Math.ceil(e / 4), e = Math.max(e, 4);
|
|
const t = new Float32Array(e * e * 4);
|
|
t.set(this.boneMatrices);
|
|
const n = new Dr(t, e, e, re, J);
|
|
return n.needsUpdate = !0, this.boneMatrices = t, this.boneTexture = n, this
|
|
}
|
|
getBoneByName(e) {
|
|
for (let t = 0, n = this.bones.length; t < n; t++) {
|
|
const n = this.bones[t];
|
|
if (n.name === e) return n
|
|
}
|
|
}
|
|
dispose() {
|
|
null !== this.boneTexture && (this.boneTexture.dispose(), this.boneTexture = null)
|
|
}
|
|
fromJSON(e, t) {
|
|
this.uuid = e.uuid;
|
|
for (let n = 0, i = e.bones.length; n < i; n++) {
|
|
const i = e.bones[n];
|
|
let r = t[i];
|
|
void 0 === r && (console.warn("THREE.Skeleton: No bone found with UUID:", i), r = new Br), this.bones.push(r), this.boneInverses.push((new Cn).fromArray(e.boneInverses[n]))
|
|
}
|
|
return this.init(), this
|
|
}
|
|
toJSON() {
|
|
const e = {
|
|
metadata: {
|
|
version: 4.6,
|
|
type: "Skeleton",
|
|
generator: "Skeleton.toJSON"
|
|
},
|
|
bones: [],
|
|
boneInverses: []
|
|
};
|
|
e.uuid = this.uuid;
|
|
const t = this.bones,
|
|
n = this.boneInverses;
|
|
for (let i = 0, r = t.length; i < r; i++) {
|
|
const r = t[i];
|
|
e.bones.push(r.uuid);
|
|
const a = n[i];
|
|
e.boneInverses.push(a.toArray())
|
|
}
|
|
return e
|
|
}
|
|
}
|
|
class Nr extends Ci {
|
|
constructor(e, t, n, i = 1) {
|
|
super(e, t, n), this.isInstancedBufferAttribute = !0, this.meshPerAttribute = i
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.meshPerAttribute = e.meshPerAttribute, this
|
|
}
|
|
toJSON() {
|
|
const e = super.toJSON();
|
|
return e.meshPerAttribute = this.meshPerAttribute, e.isInstancedBufferAttribute = !0, e
|
|
}
|
|
}
|
|
const Fr = new Cn,
|
|
Or = new Cn,
|
|
zr = [],
|
|
Wr = new en,
|
|
Hr = new Cn,
|
|
Vr = new Zi,
|
|
Gr = new vn;
|
|
class Qr extends Zi {
|
|
constructor(e, t, n) {
|
|
super(e, t), this.isInstancedMesh = !0, this.instanceMatrix = new Nr(new Float32Array(16 * n), 16), this.instanceColor = null, this.morphTexture = null, this.count = n, this.boundingBox = null, this.boundingSphere = null;
|
|
for (let e = 0; e < n; e++) this.setMatrixAt(e, Hr)
|
|
}
|
|
computeBoundingBox() {
|
|
const e = this.geometry,
|
|
t = this.count;
|
|
null === this.boundingBox && (this.boundingBox = new en), null === e.boundingBox && e.computeBoundingBox(), this.boundingBox.makeEmpty();
|
|
for (let n = 0; n < t; n++) this.getMatrixAt(n, Fr), Wr.copy(e.boundingBox).applyMatrix4(Fr), this.boundingBox.union(Wr)
|
|
}
|
|
computeBoundingSphere() {
|
|
const e = this.geometry,
|
|
t = this.count;
|
|
null === this.boundingSphere && (this.boundingSphere = new vn), null === e.boundingSphere && e.computeBoundingSphere(), this.boundingSphere.makeEmpty();
|
|
for (let n = 0; n < t; n++) this.getMatrixAt(n, Fr), Gr.copy(e.boundingSphere).applyMatrix4(Fr), this.boundingSphere.union(Gr)
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.instanceMatrix.copy(e.instanceMatrix), null !== e.morphTexture && (this.morphTexture = e.morphTexture.clone()), null !== e.instanceColor && (this.instanceColor = e.instanceColor.clone()), this.count = e.count, null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()), null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), this
|
|
}
|
|
getColorAt(e, t) {
|
|
t.fromArray(this.instanceColor.array, 3 * e)
|
|
}
|
|
getMatrixAt(e, t) {
|
|
t.fromArray(this.instanceMatrix.array, 16 * e)
|
|
}
|
|
getMorphAt(e, t) {
|
|
const n = t.morphTargetInfluences,
|
|
i = this.morphTexture.source.data.data,
|
|
r = e * (n.length + 1) + 1;
|
|
for (let e = 0; e < n.length; e++) n[e] = i[r + e]
|
|
}
|
|
raycast(e, t) {
|
|
const n = this.matrixWorld,
|
|
i = this.count;
|
|
if (Vr.geometry = this.geometry, Vr.material = this.material, void 0 !== Vr.material && (null === this.boundingSphere && this.computeBoundingSphere(), Gr.copy(this.boundingSphere), Gr.applyMatrix4(n), !1 !== e.ray.intersectsSphere(Gr)))
|
|
for (let r = 0; r < i; r++) {
|
|
this.getMatrixAt(r, Fr), Or.multiplyMatrices(n, Fr), Vr.matrixWorld = Or, Vr.raycast(e, zr);
|
|
for (let e = 0, n = zr.length; e < n; e++) {
|
|
const n = zr[e];
|
|
n.instanceId = r, n.object = this, t.push(n)
|
|
}
|
|
zr.length = 0
|
|
}
|
|
}
|
|
setColorAt(e, t) {
|
|
null === this.instanceColor && (this.instanceColor = new Nr(new Float32Array(3 * this.instanceMatrix.count).fill(1), 3)), t.toArray(this.instanceColor.array, 3 * e)
|
|
}
|
|
setMatrixAt(e, t) {
|
|
t.toArray(this.instanceMatrix.array, 16 * e)
|
|
}
|
|
setMorphAt(e, t) {
|
|
const n = t.morphTargetInfluences,
|
|
i = n.length + 1;
|
|
null === this.morphTexture && (this.morphTexture = new Dr(new Float32Array(i * this.count), i, this.count, oe, J));
|
|
const r = this.morphTexture.source.data.data;
|
|
let a = 0;
|
|
for (let e = 0; e < n.length; e++) a += n[e];
|
|
const s = this.geometry.morphTargetsRelative ? 1 : 1 - a,
|
|
o = i * e;
|
|
r[o] = s, r.set(n, o + 1)
|
|
}
|
|
updateMorphTargets() {}
|
|
dispose() {
|
|
this.dispatchEvent({
|
|
type: "dispose"
|
|
}), null !== this.morphTexture && (this.morphTexture.dispose(), this.morphTexture = null)
|
|
}
|
|
}
|
|
const Xr = new Zt,
|
|
jr = new Zt,
|
|
qr = new St;
|
|
class Yr {
|
|
constructor(e = new Zt(1, 0, 0), t = 0) {
|
|
this.isPlane = !0, this.normal = e, this.constant = t
|
|
}
|
|
set(e, t) {
|
|
return this.normal.copy(e), this.constant = t, this
|
|
}
|
|
setComponents(e, t, n, i) {
|
|
return this.normal.set(e, t, n), this.constant = i, this
|
|
}
|
|
setFromNormalAndCoplanarPoint(e, t) {
|
|
return this.normal.copy(e), this.constant = -t.dot(this.normal), this
|
|
}
|
|
setFromCoplanarPoints(e, t, n) {
|
|
const i = Xr.subVectors(n, t).cross(jr.subVectors(e, t)).normalize();
|
|
return this.setFromNormalAndCoplanarPoint(i, e), this
|
|
}
|
|
copy(e) {
|
|
return this.normal.copy(e.normal), this.constant = e.constant, this
|
|
}
|
|
normalize() {
|
|
const e = 1 / this.normal.length();
|
|
return this.normal.multiplyScalar(e), this.constant *= e, this
|
|
}
|
|
negate() {
|
|
return this.constant *= -1, this.normal.negate(), this
|
|
}
|
|
distanceToPoint(e) {
|
|
return this.normal.dot(e) + this.constant
|
|
}
|
|
distanceToSphere(e) {
|
|
return this.distanceToPoint(e.center) - e.radius
|
|
}
|
|
projectPoint(e, t) {
|
|
return t.copy(e).addScaledVector(this.normal, -this.distanceToPoint(e))
|
|
}
|
|
intersectLine(e, t) {
|
|
const n = e.delta(Xr),
|
|
i = this.normal.dot(n);
|
|
if (0 === i) return 0 === this.distanceToPoint(e.start) ? t.copy(e.start) : null;
|
|
const r = -(e.start.dot(this.normal) + this.constant) / i;
|
|
return r < 0 || r > 1 ? null : t.copy(e.start).addScaledVector(n, r)
|
|
}
|
|
intersectsLine(e) {
|
|
const t = this.distanceToPoint(e.start),
|
|
n = this.distanceToPoint(e.end);
|
|
return t < 0 && n > 0 || n < 0 && t > 0
|
|
}
|
|
intersectsBox(e) {
|
|
return e.intersectsPlane(this)
|
|
}
|
|
intersectsSphere(e) {
|
|
return e.intersectsPlane(this)
|
|
}
|
|
coplanarPoint(e) {
|
|
return e.copy(this.normal).multiplyScalar(-this.constant)
|
|
}
|
|
applyMatrix4(e, t) {
|
|
const n = t || qr.getNormalMatrix(e),
|
|
i = this.coplanarPoint(Xr).applyMatrix4(e),
|
|
r = this.normal.applyMatrix3(n).normalize();
|
|
return this.constant = -i.dot(r), this
|
|
}
|
|
translate(e) {
|
|
return this.constant -= e.dot(this.normal), this
|
|
}
|
|
equals(e) {
|
|
return e.normal.equals(this.normal) && e.constant === this.constant
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
}
|
|
const Kr = new vn,
|
|
Zr = new Zt;
|
|
class Jr {
|
|
constructor(e = new Yr, t = new Yr, n = new Yr, i = new Yr, r = new Yr, a = new Yr) {
|
|
this.planes = [e, t, n, i, r, a]
|
|
}
|
|
set(e, t, n, i, r, a) {
|
|
const s = this.planes;
|
|
return s[0].copy(e), s[1].copy(t), s[2].copy(n), s[3].copy(i), s[4].copy(r), s[5].copy(a), this
|
|
}
|
|
copy(e) {
|
|
const t = this.planes;
|
|
for (let n = 0; n < 6; n++) t[n].copy(e.planes[n]);
|
|
return this
|
|
}
|
|
setFromProjectionMatrix(e, t = 2e3) {
|
|
const n = this.planes,
|
|
i = e.elements,
|
|
r = i[0],
|
|
a = i[1],
|
|
s = i[2],
|
|
o = i[3],
|
|
l = i[4],
|
|
c = i[5],
|
|
h = i[6],
|
|
u = i[7],
|
|
d = i[8],
|
|
f = i[9],
|
|
p = i[10],
|
|
m = i[11],
|
|
g = i[12],
|
|
A = i[13],
|
|
_ = i[14],
|
|
v = i[15];
|
|
if (n[0].setComponents(o - r, u - l, m - d, v - g).normalize(), n[1].setComponents(o + r, u + l, m + d, v + g).normalize(), n[2].setComponents(o + a, u + c, m + f, v + A).normalize(), n[3].setComponents(o - a, u - c, m - f, v - A).normalize(), n[4].setComponents(o - s, u - h, m - p, v - _).normalize(), t === ht) n[5].setComponents(o + s, u + h, m + p, v + _).normalize();
|
|
else {
|
|
if (t !== ut) throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: " + t);
|
|
n[5].setComponents(s, h, p, _).normalize()
|
|
}
|
|
return this
|
|
}
|
|
intersectsObject(e) {
|
|
if (void 0 !== e.boundingSphere) null === e.boundingSphere && e.computeBoundingSphere(), Kr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);
|
|
else {
|
|
const t = e.geometry;
|
|
null === t.boundingSphere && t.computeBoundingSphere(), Kr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)
|
|
}
|
|
return this.intersectsSphere(Kr)
|
|
}
|
|
intersectsSprite(e) {
|
|
return Kr.center.set(0, 0, 0), Kr.radius = .7071067811865476, Kr.applyMatrix4(e.matrixWorld), this.intersectsSphere(Kr)
|
|
}
|
|
intersectsSphere(e) {
|
|
const t = this.planes,
|
|
n = e.center,
|
|
i = -e.radius;
|
|
for (let e = 0; e < 6; e++) {
|
|
if (t[e].distanceToPoint(n) < i) return !1
|
|
}
|
|
return !0
|
|
}
|
|
intersectsBox(e) {
|
|
const t = this.planes;
|
|
for (let n = 0; n < 6; n++) {
|
|
const i = t[n];
|
|
if (Zr.x = i.normal.x > 0 ? e.max.x : e.min.x, Zr.y = i.normal.y > 0 ? e.max.y : e.min.y, Zr.z = i.normal.z > 0 ? e.max.z : e.min.z, i.distanceToPoint(Zr) < 0) return !1
|
|
}
|
|
return !0
|
|
}
|
|
containsPoint(e) {
|
|
const t = this.planes;
|
|
for (let n = 0; n < 6; n++)
|
|
if (t[n].distanceToPoint(e) < 0) return !1;
|
|
return !0
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
}
|
|
class $r extends bi {
|
|
constructor(e) {
|
|
super(), this.isLineBasicMaterial = !0, this.type = "LineBasicMaterial", this.color = new wi(16777215), this.map = null, this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.fog = !0, this.setValues(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.linewidth = e.linewidth, this.linecap = e.linecap, this.linejoin = e.linejoin, this.fog = e.fog, this
|
|
}
|
|
}
|
|
const ea = new Zt,
|
|
ta = new Zt,
|
|
na = new Cn,
|
|
ia = new Tn,
|
|
ra = new vn,
|
|
aa = new Zt,
|
|
sa = new Zt;
|
|
class oa extends ti {
|
|
constructor(e = new Oi, t = new $r) {
|
|
super(), this.isLine = !0, this.type = "Line", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets()
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this
|
|
}
|
|
computeLineDistances() {
|
|
const e = this.geometry;
|
|
if (null === e.index) {
|
|
const t = e.attributes.position,
|
|
n = [0];
|
|
for (let e = 1, i = t.count; e < i; e++) ea.fromBufferAttribute(t, e - 1), ta.fromBufferAttribute(t, e), n[e] = n[e - 1], n[e] += ea.distanceTo(ta);
|
|
e.setAttribute("lineDistance", new Pi(n, 1))
|
|
} else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
|
|
return this
|
|
}
|
|
raycast(e, t) {
|
|
const n = this.geometry,
|
|
i = this.matrixWorld,
|
|
r = e.params.Line.threshold,
|
|
a = n.drawRange;
|
|
if (null === n.boundingSphere && n.computeBoundingSphere(), ra.copy(n.boundingSphere), ra.applyMatrix4(i), ra.radius += r, !1 === e.ray.intersectsSphere(ra)) return;
|
|
na.copy(i).invert(), ia.copy(e.ray).applyMatrix4(na);
|
|
const s = r / ((this.scale.x + this.scale.y + this.scale.z) / 3),
|
|
o = s * s,
|
|
l = this.isLineSegments ? 2 : 1,
|
|
c = n.index,
|
|
h = n.attributes.position;
|
|
if (null !== c) {
|
|
const n = Math.max(0, a.start),
|
|
i = Math.min(c.count, a.start + a.count);
|
|
for (let r = n, a = i - 1; r < a; r += l) {
|
|
const n = c.getX(r),
|
|
i = c.getX(r + 1),
|
|
a = la(this, e, ia, o, n, i, r);
|
|
a && t.push(a)
|
|
}
|
|
if (this.isLineLoop) {
|
|
const r = c.getX(i - 1),
|
|
a = c.getX(n),
|
|
s = la(this, e, ia, o, r, a, i - 1);
|
|
s && t.push(s)
|
|
}
|
|
} else {
|
|
const n = Math.max(0, a.start),
|
|
i = Math.min(h.count, a.start + a.count);
|
|
for (let r = n, a = i - 1; r < a; r += l) {
|
|
const n = la(this, e, ia, o, r, r + 1, r);
|
|
n && t.push(n)
|
|
}
|
|
if (this.isLineLoop) {
|
|
const r = la(this, e, ia, o, i - 1, n, i - 1);
|
|
r && t.push(r)
|
|
}
|
|
}
|
|
}
|
|
updateMorphTargets() {
|
|
const e = this.geometry.morphAttributes,
|
|
t = Object.keys(e);
|
|
if (t.length > 0) {
|
|
const n = e[t[0]];
|
|
if (void 0 !== n) {
|
|
this.morphTargetInfluences = [], this.morphTargetDictionary = {};
|
|
for (let e = 0, t = n.length; e < t; e++) {
|
|
const t = n[e].name || String(e);
|
|
this.morphTargetInfluences.push(0), this.morphTargetDictionary[t] = e
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function la(e, t, n, i, r, a, s) {
|
|
const o = e.geometry.attributes.position;
|
|
ea.fromBufferAttribute(o, r), ta.fromBufferAttribute(o, a);
|
|
if (n.distanceSqToSegment(ea, ta, aa, sa) > i) return;
|
|
aa.applyMatrix4(e.matrixWorld);
|
|
const l = t.ray.origin.distanceTo(aa);
|
|
return l < t.near || l > t.far ? void 0 : {
|
|
distance: l,
|
|
point: sa.clone().applyMatrix4(e.matrixWorld),
|
|
index: s,
|
|
face: null,
|
|
faceIndex: null,
|
|
barycoord: null,
|
|
object: e
|
|
}
|
|
}
|
|
const ca = new Zt,
|
|
ha = new Zt;
|
|
class ua extends oa {
|
|
constructor(e, t) {
|
|
super(e, t), this.isLineSegments = !0, this.type = "LineSegments"
|
|
}
|
|
computeLineDistances() {
|
|
const e = this.geometry;
|
|
if (null === e.index) {
|
|
const t = e.attributes.position,
|
|
n = [];
|
|
for (let e = 0, i = t.count; e < i; e += 2) ca.fromBufferAttribute(t, e), ha.fromBufferAttribute(t, e + 1), n[e] = 0 === e ? 0 : n[e - 1], n[e + 1] = n[e] + ca.distanceTo(ha);
|
|
e.setAttribute("lineDistance", new Pi(n, 1))
|
|
} else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
|
|
return this
|
|
}
|
|
}
|
|
class da extends oa {
|
|
constructor(e, t) {
|
|
super(e, t), this.isLineLoop = !0, this.type = "LineLoop"
|
|
}
|
|
}
|
|
class fa extends bi {
|
|
constructor(e) {
|
|
super(), this.isPointsMaterial = !0, this.type = "PointsMaterial", this.color = new wi(16777215), this.map = null, this.alphaMap = null, this.size = 1, this.sizeAttenuation = !0, this.fog = !0, this.setValues(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.color.copy(e.color), this.map = e.map, this.alphaMap = e.alphaMap, this.size = e.size, this.sizeAttenuation = e.sizeAttenuation, this.fog = e.fog, this
|
|
}
|
|
}
|
|
const pa = new Cn,
|
|
ma = new Tn,
|
|
ga = new vn,
|
|
Aa = new Zt;
|
|
class _a extends ti {
|
|
constructor(e = new Oi, t = new fa) {
|
|
super(), this.isPoints = !0, this.type = "Points", this.geometry = e, this.material = t, this.morphTargetDictionary = void 0, this.morphTargetInfluences = void 0, this.updateMorphTargets()
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.material = Array.isArray(e.material) ? e.material.slice() : e.material, this.geometry = e.geometry, this
|
|
}
|
|
raycast(e, t) {
|
|
const n = this.geometry,
|
|
i = this.matrixWorld,
|
|
r = e.params.Points.threshold,
|
|
a = n.drawRange;
|
|
if (null === n.boundingSphere && n.computeBoundingSphere(), ga.copy(n.boundingSphere), ga.applyMatrix4(i), ga.radius += r, !1 === e.ray.intersectsSphere(ga)) return;
|
|
pa.copy(i).invert(), ma.copy(e.ray).applyMatrix4(pa);
|
|
const s = r / ((this.scale.x + this.scale.y + this.scale.z) / 3),
|
|
o = s * s,
|
|
l = n.index,
|
|
c = n.attributes.position;
|
|
if (null !== l) {
|
|
for (let n = Math.max(0, a.start), r = Math.min(l.count, a.start + a.count); n < r; n++) {
|
|
const r = l.getX(n);
|
|
Aa.fromBufferAttribute(c, r), va(Aa, r, o, i, e, t, this)
|
|
}
|
|
} else {
|
|
for (let n = Math.max(0, a.start), r = Math.min(c.count, a.start + a.count); n < r; n++) Aa.fromBufferAttribute(c, n), va(Aa, n, o, i, e, t, this)
|
|
}
|
|
}
|
|
updateMorphTargets() {
|
|
const e = this.geometry.morphAttributes,
|
|
t = Object.keys(e);
|
|
if (t.length > 0) {
|
|
const n = e[t[0]];
|
|
if (void 0 !== n) {
|
|
this.morphTargetInfluences = [], this.morphTargetDictionary = {};
|
|
for (let e = 0, t = n.length; e < t; e++) {
|
|
const t = n[e].name || String(e);
|
|
this.morphTargetInfluences.push(0), this.morphTargetDictionary[t] = e
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function va(e, t, n, i, r, a, s) {
|
|
const o = ma.distanceSqToPoint(e);
|
|
if (o < n) {
|
|
const n = new Zt;
|
|
ma.closestPointToPoint(e, n), n.applyMatrix4(i);
|
|
const l = r.ray.origin.distanceTo(n);
|
|
if (l < r.near || l > r.far) return;
|
|
a.push({
|
|
distance: l,
|
|
distanceToRay: Math.sqrt(o),
|
|
point: n,
|
|
index: t,
|
|
face: null,
|
|
faceIndex: null,
|
|
barycoord: null,
|
|
object: s
|
|
})
|
|
}
|
|
}
|
|
class wa extends Gt {
|
|
constructor(e, t, n, i, r, a, s, o, l, c = 1026) {
|
|
if (c !== ae && c !== se) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
|
|
void 0 === n && c === ae && (n = Z), void 0 === n && c === se && (n = ne), super(null, i, r, a, s, o, c, n, l), this.isDepthTexture = !0, this.image = {
|
|
width: e,
|
|
height: t
|
|
}, this.magFilter = void 0 !== s ? s : z, this.minFilter = void 0 !== o ? o : z, this.flipY = !1, this.generateMipmaps = !1, this.compareFunction = null
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.source = new Wt(Object.assign({}, e.image)), this.compareFunction = e.compareFunction, this
|
|
}
|
|
toJSON(e) {
|
|
const t = super.toJSON(e);
|
|
return null !== this.compareFunction && (t.compareFunction = this.compareFunction), t
|
|
}
|
|
}
|
|
class ya extends Oi {
|
|
constructor(e = 1, t = 1, n = 1, i = 1) {
|
|
super(), this.type = "PlaneGeometry", this.parameters = {
|
|
width: e,
|
|
height: t,
|
|
widthSegments: n,
|
|
heightSegments: i
|
|
};
|
|
const r = e / 2,
|
|
a = t / 2,
|
|
s = Math.floor(n),
|
|
o = Math.floor(i),
|
|
l = s + 1,
|
|
c = o + 1,
|
|
h = e / s,
|
|
u = t / o,
|
|
d = [],
|
|
f = [],
|
|
p = [],
|
|
m = [];
|
|
for (let e = 0; e < c; e++) {
|
|
const t = e * u - a;
|
|
for (let n = 0; n < l; n++) {
|
|
const i = n * h - r;
|
|
f.push(i, -t, 0), p.push(0, 0, 1), m.push(n / s), m.push(1 - e / o)
|
|
}
|
|
}
|
|
for (let e = 0; e < o; e++)
|
|
for (let t = 0; t < s; t++) {
|
|
const n = t + l * e,
|
|
i = t + l * (e + 1),
|
|
r = t + 1 + l * (e + 1),
|
|
a = t + 1 + l * e;
|
|
d.push(n, i, a), d.push(i, r, a)
|
|
}
|
|
this.setIndex(d), this.setAttribute("position", new Pi(f, 3)), this.setAttribute("normal", new Pi(p, 3)), this.setAttribute("uv", new Pi(m, 2))
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.parameters = Object.assign({}, e.parameters), this
|
|
}
|
|
static fromJSON(e) {
|
|
return new ya(e.width, e.height, e.widthSegments, e.heightSegments)
|
|
}
|
|
}
|
|
class xa extends bi {
|
|
constructor(e) {
|
|
super(), this.isMeshStandardMaterial = !0, this.type = "MeshStandardMaterial", this.defines = {
|
|
STANDARD: ""
|
|
}, this.color = new wi(16777215), this.roughness = 1, this.metalness = 0, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new wi(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalMapType = 0, this.normalScale = new Et(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapRotation = new Fn, this.envMapIntensity = 1, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.flatShading = !1, this.fog = !0, this.setValues(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.defines = {
|
|
STANDARD: ""
|
|
}, this.color.copy(e.color), this.roughness = e.roughness, this.metalness = e.metalness, this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.emissive.copy(e.emissive), this.emissiveMap = e.emissiveMap, this.emissiveIntensity = e.emissiveIntensity, this.bumpMap = e.bumpMap, this.bumpScale = e.bumpScale, this.normalMap = e.normalMap, this.normalMapType = e.normalMapType, this.normalScale.copy(e.normalScale), this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.roughnessMap = e.roughnessMap, this.metalnessMap = e.metalnessMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.envMapRotation.copy(e.envMapRotation), this.envMapIntensity = e.envMapIntensity, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.flatShading = e.flatShading, this.fog = e.fog, this
|
|
}
|
|
}
|
|
class ba extends xa {
|
|
constructor(e) {
|
|
super(), this.isMeshPhysicalMaterial = !0, this.defines = {
|
|
STANDARD: "",
|
|
PHYSICAL: ""
|
|
}, this.type = "MeshPhysicalMaterial", this.anisotropyRotation = 0, this.anisotropyMap = null, this.clearcoatMap = null, this.clearcoatRoughness = 0, this.clearcoatRoughnessMap = null, this.clearcoatNormalScale = new Et(1, 1), this.clearcoatNormalMap = null, this.ior = 1.5, Object.defineProperty(this, "reflectivity", {
|
|
get: function() {
|
|
return _t(2.5 * (this.ior - 1) / (this.ior + 1), 0, 1)
|
|
},
|
|
set: function(e) {
|
|
this.ior = (1 + .4 * e) / (1 - .4 * e)
|
|
}
|
|
}), this.iridescenceMap = null, this.iridescenceIOR = 1.3, this.iridescenceThicknessRange = [100, 400], this.iridescenceThicknessMap = null, this.sheenColor = new wi(0), this.sheenColorMap = null, this.sheenRoughness = 1, this.sheenRoughnessMap = null, this.transmissionMap = null, this.thickness = 0, this.thicknessMap = null, this.attenuationDistance = 1 / 0, this.attenuationColor = new wi(1, 1, 1), this.specularIntensity = 1, this.specularIntensityMap = null, this.specularColor = new wi(1, 1, 1), this.specularColorMap = null, this._anisotropy = 0, this._clearcoat = 0, this._dispersion = 0, this._iridescence = 0, this._sheen = 0, this._transmission = 0, this.setValues(e)
|
|
}
|
|
get anisotropy() {
|
|
return this._anisotropy
|
|
}
|
|
set anisotropy(e) {
|
|
this._anisotropy > 0 != e > 0 && this.version++, this._anisotropy = e
|
|
}
|
|
get clearcoat() {
|
|
return this._clearcoat
|
|
}
|
|
set clearcoat(e) {
|
|
this._clearcoat > 0 != e > 0 && this.version++, this._clearcoat = e
|
|
}
|
|
get iridescence() {
|
|
return this._iridescence
|
|
}
|
|
set iridescence(e) {
|
|
this._iridescence > 0 != e > 0 && this.version++, this._iridescence = e
|
|
}
|
|
get dispersion() {
|
|
return this._dispersion
|
|
}
|
|
set dispersion(e) {
|
|
this._dispersion > 0 != e > 0 && this.version++, this._dispersion = e
|
|
}
|
|
get sheen() {
|
|
return this._sheen
|
|
}
|
|
set sheen(e) {
|
|
this._sheen > 0 != e > 0 && this.version++, this._sheen = e
|
|
}
|
|
get transmission() {
|
|
return this._transmission
|
|
}
|
|
set transmission(e) {
|
|
this._transmission > 0 != e > 0 && this.version++, this._transmission = e
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.defines = {
|
|
STANDARD: "",
|
|
PHYSICAL: ""
|
|
}, this.anisotropy = e.anisotropy, this.anisotropyRotation = e.anisotropyRotation, this.anisotropyMap = e.anisotropyMap, this.clearcoat = e.clearcoat, this.clearcoatMap = e.clearcoatMap, this.clearcoatRoughness = e.clearcoatRoughness, this.clearcoatRoughnessMap = e.clearcoatRoughnessMap, this.clearcoatNormalMap = e.clearcoatNormalMap, this.clearcoatNormalScale.copy(e.clearcoatNormalScale), this.dispersion = e.dispersion, this.ior = e.ior, this.iridescence = e.iridescence, this.iridescenceMap = e.iridescenceMap, this.iridescenceIOR = e.iridescenceIOR, this.iridescenceThicknessRange = [...e.iridescenceThicknessRange], this.iridescenceThicknessMap = e.iridescenceThicknessMap, this.sheen = e.sheen, this.sheenColor.copy(e.sheenColor), this.sheenColorMap = e.sheenColorMap, this.sheenRoughness = e.sheenRoughness, this.sheenRoughnessMap = e.sheenRoughnessMap, this.transmission = e.transmission, this.transmissionMap = e.transmissionMap, this.thickness = e.thickness, this.thicknessMap = e.thicknessMap, this.attenuationDistance = e.attenuationDistance, this.attenuationColor.copy(e.attenuationColor), this.specularIntensity = e.specularIntensity, this.specularIntensityMap = e.specularIntensityMap, this.specularColor.copy(e.specularColor), this.specularColorMap = e.specularColorMap, this
|
|
}
|
|
}
|
|
class Ea extends bi {
|
|
constructor(e) {
|
|
super(), this.isMeshDepthMaterial = !0, this.type = "MeshDepthMaterial", this.depthPacking = 3200, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.setValues(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.depthPacking = e.depthPacking, this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this
|
|
}
|
|
}
|
|
class Sa extends bi {
|
|
constructor(e) {
|
|
super(), this.isMeshDistanceMaterial = !0, this.type = "MeshDistanceMaterial", this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.setValues(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.map = e.map, this.alphaMap = e.alphaMap, this.displacementMap = e.displacementMap, this.displacementScale = e.displacementScale, this.displacementBias = e.displacementBias, this
|
|
}
|
|
}
|
|
|
|
function Ma(e, t, n) {
|
|
return !e || !n && e.constructor === t ? e : "number" == typeof t.BYTES_PER_ELEMENT ? new t(e) : Array.prototype.slice.call(e)
|
|
}
|
|
|
|
function Ta(e) {
|
|
return ArrayBuffer.isView(e) && !(e instanceof DataView)
|
|
}
|
|
|
|
function Ca(e) {
|
|
const t = e.length,
|
|
n = new Array(t);
|
|
for (let e = 0; e !== t; ++e) n[e] = e;
|
|
return n.sort((function(t, n) {
|
|
return e[t] - e[n]
|
|
})), n
|
|
}
|
|
|
|
function Ia(e, t, n) {
|
|
const i = e.length,
|
|
r = new e.constructor(i);
|
|
for (let a = 0, s = 0; s !== i; ++a) {
|
|
const i = n[a] * t;
|
|
for (let n = 0; n !== t; ++n) r[s++] = e[i + n]
|
|
}
|
|
return r
|
|
}
|
|
|
|
function Ra(e, t, n, i) {
|
|
let r = 1,
|
|
a = e[0];
|
|
for (; void 0 !== a && void 0 === a[i];) a = e[r++];
|
|
if (void 0 === a) return;
|
|
let s = a[i];
|
|
if (void 0 !== s)
|
|
if (Array.isArray(s))
|
|
do {
|
|
s = a[i], void 0 !== s && (t.push(a.time), n.push(...s)), a = e[r++]
|
|
} while (void 0 !== a);
|
|
else if (void 0 !== s.toArray)
|
|
do {
|
|
s = a[i], void 0 !== s && (t.push(a.time), s.toArray(n, n.length)), a = e[r++]
|
|
} while (void 0 !== a);
|
|
else
|
|
do {
|
|
s = a[i], void 0 !== s && (t.push(a.time), n.push(s)), a = e[r++]
|
|
} while (void 0 !== a)
|
|
}
|
|
class Pa {
|
|
constructor(e, t, n, i) {
|
|
this.parameterPositions = e, this._cachedIndex = 0, this.resultBuffer = void 0 !== i ? i : new t.constructor(n), this.sampleValues = t, this.valueSize = n, this.settings = null, this.DefaultSettings_ = {}
|
|
}
|
|
evaluate(e) {
|
|
const t = this.parameterPositions;
|
|
let n = this._cachedIndex,
|
|
i = t[n],
|
|
r = t[n - 1];
|
|
e: {
|
|
t: {
|
|
let a;n: {
|
|
i: if (!(e < i)) {
|
|
for (let a = n + 2;;) {
|
|
if (void 0 === i) {
|
|
if (e < r) break i;
|
|
return n = t.length, this._cachedIndex = n, this.copySampleValue_(n - 1)
|
|
}
|
|
if (n === a) break;
|
|
if (r = i, i = t[++n], e < i) break t
|
|
}
|
|
a = t.length;
|
|
break n
|
|
}if (e >= r) break e;
|
|
{
|
|
const s = t[1];
|
|
e < s && (n = 2, r = s);
|
|
for (let a = n - 2;;) {
|
|
if (void 0 === r) return this._cachedIndex = 0, this.copySampleValue_(0);
|
|
if (n === a) break;
|
|
if (i = r, r = t[--n - 1], e >= r) break t
|
|
}
|
|
a = n, n = 0
|
|
}
|
|
}
|
|
for (; n < a;) {
|
|
const i = n + a >>> 1;
|
|
e < t[i] ? a = i : n = i + 1
|
|
}
|
|
if (i = t[n], r = t[n - 1], void 0 === r) return this._cachedIndex = 0,
|
|
this.copySampleValue_(0);
|
|
if (void 0 === i) return n = t.length,
|
|
this._cachedIndex = n,
|
|
this.copySampleValue_(n - 1)
|
|
}
|
|
this._cachedIndex = n,
|
|
this.intervalChanged_(n, r, i)
|
|
}
|
|
return this.interpolate_(n, r, e, i)
|
|
}
|
|
getSettings_() {
|
|
return this.settings || this.DefaultSettings_
|
|
}
|
|
copySampleValue_(e) {
|
|
const t = this.resultBuffer,
|
|
n = this.sampleValues,
|
|
i = this.valueSize,
|
|
r = e * i;
|
|
for (let e = 0; e !== i; ++e) t[e] = n[r + e];
|
|
return t
|
|
}
|
|
interpolate_() {
|
|
throw new Error("call to abstract method")
|
|
}
|
|
intervalChanged_() {}
|
|
}
|
|
class Ba extends Pa {
|
|
constructor(e, t, n, i) {
|
|
super(e, t, n, i), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0, this.DefaultSettings_ = {
|
|
endingStart: Qe,
|
|
endingEnd: Qe
|
|
}
|
|
}
|
|
intervalChanged_(e, t, n) {
|
|
const i = this.parameterPositions;
|
|
let r = e - 2,
|
|
a = e + 1,
|
|
s = i[r],
|
|
o = i[a];
|
|
if (void 0 === s) switch (this.getSettings_().endingStart) {
|
|
case Xe:
|
|
r = e, s = 2 * t - n;
|
|
break;
|
|
case je:
|
|
r = i.length - 2, s = t + i[r] - i[r + 1];
|
|
break;
|
|
default:
|
|
r = e, s = n
|
|
}
|
|
if (void 0 === o) switch (this.getSettings_().endingEnd) {
|
|
case Xe:
|
|
a = e, o = 2 * n - t;
|
|
break;
|
|
case je:
|
|
a = 1, o = n + i[1] - i[0];
|
|
break;
|
|
default:
|
|
a = e - 1, o = t
|
|
}
|
|
const l = .5 * (n - t),
|
|
c = this.valueSize;
|
|
this._weightPrev = l / (t - s), this._weightNext = l / (o - n), this._offsetPrev = r * c, this._offsetNext = a * c
|
|
}
|
|
interpolate_(e, t, n, i) {
|
|
const r = this.resultBuffer,
|
|
a = this.sampleValues,
|
|
s = this.valueSize,
|
|
o = e * s,
|
|
l = o - s,
|
|
c = this._offsetPrev,
|
|
h = this._offsetNext,
|
|
u = this._weightPrev,
|
|
d = this._weightNext,
|
|
f = (n - t) / (i - t),
|
|
p = f * f,
|
|
m = p * f,
|
|
g = -u * m + 2 * u * p - u * f,
|
|
A = (1 + u) * m + (-1.5 - 2 * u) * p + (-.5 + u) * f + 1,
|
|
_ = (-1 - d) * m + (1.5 + d) * p + .5 * f,
|
|
v = d * m - d * p;
|
|
for (let e = 0; e !== s; ++e) r[e] = g * a[c + e] + A * a[l + e] + _ * a[o + e] + v * a[h + e];
|
|
return r
|
|
}
|
|
}
|
|
class Da extends Pa {
|
|
constructor(e, t, n, i) {
|
|
super(e, t, n, i)
|
|
}
|
|
interpolate_(e, t, n, i) {
|
|
const r = this.resultBuffer,
|
|
a = this.sampleValues,
|
|
s = this.valueSize,
|
|
o = e * s,
|
|
l = o - s,
|
|
c = (n - t) / (i - t),
|
|
h = 1 - c;
|
|
for (let e = 0; e !== s; ++e) r[e] = a[l + e] * h + a[o + e] * c;
|
|
return r
|
|
}
|
|
}
|
|
class La extends Pa {
|
|
constructor(e, t, n, i) {
|
|
super(e, t, n, i)
|
|
}
|
|
interpolate_(e) {
|
|
return this.copySampleValue_(e - 1)
|
|
}
|
|
}
|
|
class Ua {
|
|
constructor(e, t, n, i) {
|
|
if (void 0 === e) throw new Error("THREE.KeyframeTrack: track name is undefined");
|
|
if (void 0 === t || 0 === t.length) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + e);
|
|
this.name = e, this.times = Ma(t, this.TimeBufferType), this.values = Ma(n, this.ValueBufferType), this.setInterpolation(i || this.DefaultInterpolation)
|
|
}
|
|
static toJSON(e) {
|
|
const t = e.constructor;
|
|
let n;
|
|
if (t.toJSON !== this.toJSON) n = t.toJSON(e);
|
|
else {
|
|
n = {
|
|
name: e.name,
|
|
times: Ma(e.times, Array),
|
|
values: Ma(e.values, Array)
|
|
};
|
|
const t = e.getInterpolation();
|
|
t !== e.DefaultInterpolation && (n.interpolation = t)
|
|
}
|
|
return n.type = e.ValueTypeName, n
|
|
}
|
|
InterpolantFactoryMethodDiscrete(e) {
|
|
return new La(this.times, this.values, this.getValueSize(), e)
|
|
}
|
|
InterpolantFactoryMethodLinear(e) {
|
|
return new Da(this.times, this.values, this.getValueSize(), e)
|
|
}
|
|
InterpolantFactoryMethodSmooth(e) {
|
|
return new Ba(this.times, this.values, this.getValueSize(), e)
|
|
}
|
|
setInterpolation(e) {
|
|
let t;
|
|
switch (e) {
|
|
case He:
|
|
t = this.InterpolantFactoryMethodDiscrete;
|
|
break;
|
|
case Ve:
|
|
t = this.InterpolantFactoryMethodLinear;
|
|
break;
|
|
case Ge:
|
|
t = this.InterpolantFactoryMethodSmooth
|
|
}
|
|
if (void 0 === t) {
|
|
const t = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name;
|
|
if (void 0 === this.createInterpolant) {
|
|
if (e === this.DefaultInterpolation) throw new Error(t);
|
|
this.setInterpolation(this.DefaultInterpolation)
|
|
}
|
|
return console.warn("THREE.KeyframeTrack:", t), this
|
|
}
|
|
return this.createInterpolant = t, this
|
|
}
|
|
getInterpolation() {
|
|
switch (this.createInterpolant) {
|
|
case this.InterpolantFactoryMethodDiscrete:
|
|
return He;
|
|
case this.InterpolantFactoryMethodLinear:
|
|
return Ve;
|
|
case this.InterpolantFactoryMethodSmooth:
|
|
return Ge
|
|
}
|
|
}
|
|
getValueSize() {
|
|
return this.values.length / this.times.length
|
|
}
|
|
shift(e) {
|
|
if (0 !== e) {
|
|
const t = this.times;
|
|
for (let n = 0, i = t.length; n !== i; ++n) t[n] += e
|
|
}
|
|
return this
|
|
}
|
|
scale(e) {
|
|
if (1 !== e) {
|
|
const t = this.times;
|
|
for (let n = 0, i = t.length; n !== i; ++n) t[n] *= e
|
|
}
|
|
return this
|
|
}
|
|
trim(e, t) {
|
|
const n = this.times,
|
|
i = n.length;
|
|
let r = 0,
|
|
a = i - 1;
|
|
for (; r !== i && n[r] < e;) ++r;
|
|
for (; - 1 !== a && n[a] > t;) --a;
|
|
if (++a, 0 !== r || a !== i) {
|
|
r >= a && (a = Math.max(a, 1), r = a - 1);
|
|
const e = this.getValueSize();
|
|
this.times = n.slice(r, a), this.values = this.values.slice(r * e, a * e)
|
|
}
|
|
return this
|
|
}
|
|
validate() {
|
|
let e = !0;
|
|
const t = this.getValueSize();
|
|
t - Math.floor(t) != 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), e = !1);
|
|
const n = this.times,
|
|
i = this.values,
|
|
r = n.length;
|
|
0 === r && (console.error("THREE.KeyframeTrack: Track is empty.", this), e = !1);
|
|
let a = null;
|
|
for (let t = 0; t !== r; t++) {
|
|
const i = n[t];
|
|
if ("number" == typeof i && isNaN(i)) {
|
|
console.error("THREE.KeyframeTrack: Time is not a valid number.", this, t, i), e = !1;
|
|
break
|
|
}
|
|
if (null !== a && a > i) {
|
|
console.error("THREE.KeyframeTrack: Out of order keys.", this, t, i, a), e = !1;
|
|
break
|
|
}
|
|
a = i
|
|
}
|
|
if (void 0 !== i && Ta(i))
|
|
for (let t = 0, n = i.length; t !== n; ++t) {
|
|
const n = i[t];
|
|
if (isNaN(n)) {
|
|
console.error("THREE.KeyframeTrack: Value is not a valid number.", this, t, n), e = !1;
|
|
break
|
|
}
|
|
}
|
|
return e
|
|
}
|
|
optimize() {
|
|
const e = this.times.slice(),
|
|
t = this.values.slice(),
|
|
n = this.getValueSize(),
|
|
i = this.getInterpolation() === Ge,
|
|
r = e.length - 1;
|
|
let a = 1;
|
|
for (let s = 1; s < r; ++s) {
|
|
let r = !1;
|
|
const o = e[s];
|
|
if (o !== e[s + 1] && (1 !== s || o !== e[0]))
|
|
if (i) r = !0;
|
|
else {
|
|
const e = s * n,
|
|
i = e - n,
|
|
a = e + n;
|
|
for (let s = 0; s !== n; ++s) {
|
|
const n = t[e + s];
|
|
if (n !== t[i + s] || n !== t[a + s]) {
|
|
r = !0;
|
|
break
|
|
}
|
|
}
|
|
} if (r) {
|
|
if (s !== a) {
|
|
e[a] = e[s];
|
|
const i = s * n,
|
|
r = a * n;
|
|
for (let e = 0; e !== n; ++e) t[r + e] = t[i + e]
|
|
}++a
|
|
}
|
|
}
|
|
if (r > 0) {
|
|
e[a] = e[r];
|
|
for (let e = r * n, i = a * n, s = 0; s !== n; ++s) t[i + s] = t[e + s];
|
|
++a
|
|
}
|
|
return a !== e.length ? (this.times = e.slice(0, a), this.values = t.slice(0, a * n)) : (this.times = e, this.values = t), this
|
|
}
|
|
clone() {
|
|
const e = this.times.slice(),
|
|
t = this.values.slice(),
|
|
n = new(0, this.constructor)(this.name, e, t);
|
|
return n.createInterpolant = this.createInterpolant, n
|
|
}
|
|
}
|
|
Ua.prototype.TimeBufferType = Float32Array, Ua.prototype.ValueBufferType = Float32Array, Ua.prototype.DefaultInterpolation = Ve;
|
|
class ka extends Ua {
|
|
constructor(e, t, n) {
|
|
super(e, t, n)
|
|
}
|
|
}
|
|
ka.prototype.ValueTypeName = "bool", ka.prototype.ValueBufferType = Array, ka.prototype.DefaultInterpolation = He, ka.prototype.InterpolantFactoryMethodLinear = void 0, ka.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
class Na extends Ua {}
|
|
Na.prototype.ValueTypeName = "color";
|
|
class Fa extends Ua {}
|
|
Fa.prototype.ValueTypeName = "number";
|
|
class Oa extends Pa {
|
|
constructor(e, t, n, i) {
|
|
super(e, t, n, i)
|
|
}
|
|
interpolate_(e, t, n, i) {
|
|
const r = this.resultBuffer,
|
|
a = this.sampleValues,
|
|
s = this.valueSize,
|
|
o = (n - t) / (i - t);
|
|
let l = e * s;
|
|
for (let e = l + s; l !== e; l += 4) Kt.slerpFlat(r, 0, a, l - s, a, l, o);
|
|
return r
|
|
}
|
|
}
|
|
class za extends Ua {
|
|
InterpolantFactoryMethodLinear(e) {
|
|
return new Oa(this.times, this.values, this.getValueSize(), e)
|
|
}
|
|
}
|
|
za.prototype.ValueTypeName = "quaternion", za.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
class Wa extends Ua {
|
|
constructor(e, t, n) {
|
|
super(e, t, n)
|
|
}
|
|
}
|
|
Wa.prototype.ValueTypeName = "string", Wa.prototype.ValueBufferType = Array, Wa.prototype.DefaultInterpolation = He, Wa.prototype.InterpolantFactoryMethodLinear = void 0, Wa.prototype.InterpolantFactoryMethodSmooth = void 0;
|
|
class Ha extends Ua {}
|
|
Ha.prototype.ValueTypeName = "vector";
|
|
class Va {
|
|
constructor(e = "", t = -1, n = [], i = 2500) {
|
|
this.name = e, this.tracks = n, this.duration = t, this.blendMode = i, this.uuid = At(), this.duration < 0 && this.resetDuration()
|
|
}
|
|
static parse(e) {
|
|
const t = [],
|
|
n = e.tracks,
|
|
i = 1 / (e.fps || 1);
|
|
for (let e = 0, r = n.length; e !== r; ++e) t.push(Ga(n[e]).scale(i));
|
|
const r = new this(e.name, e.duration, t, e.blendMode);
|
|
return r.uuid = e.uuid, r
|
|
}
|
|
static toJSON(e) {
|
|
const t = [],
|
|
n = e.tracks,
|
|
i = {
|
|
name: e.name,
|
|
duration: e.duration,
|
|
tracks: t,
|
|
uuid: e.uuid,
|
|
blendMode: e.blendMode
|
|
};
|
|
for (let e = 0, i = n.length; e !== i; ++e) t.push(Ua.toJSON(n[e]));
|
|
return i
|
|
}
|
|
static CreateFromMorphTargetSequence(e, t, n, i) {
|
|
const r = t.length,
|
|
a = [];
|
|
for (let e = 0; e < r; e++) {
|
|
let s = [],
|
|
o = [];
|
|
s.push((e + r - 1) % r, e, (e + 1) % r), o.push(0, 1, 0);
|
|
const l = Ca(s);
|
|
s = Ia(s, 1, l), o = Ia(o, 1, l), i || 0 !== s[0] || (s.push(r), o.push(o[0])), a.push(new Fa(".morphTargetInfluences[" + t[e].name + "]", s, o).scale(1 / n))
|
|
}
|
|
return new this(e, -1, a)
|
|
}
|
|
static findByName(e, t) {
|
|
let n = e;
|
|
if (!Array.isArray(e)) {
|
|
const t = e;
|
|
n = t.geometry && t.geometry.animations || t.animations
|
|
}
|
|
for (let e = 0; e < n.length; e++)
|
|
if (n[e].name === t) return n[e];
|
|
return null
|
|
}
|
|
static CreateClipsFromMorphTargetSequences(e, t, n) {
|
|
const i = {},
|
|
r = /^([\w-]*?)([\d]+)$/;
|
|
for (let t = 0, n = e.length; t < n; t++) {
|
|
const n = e[t],
|
|
a = n.name.match(r);
|
|
if (a && a.length > 1) {
|
|
const e = a[1];
|
|
let t = i[e];
|
|
t || (i[e] = t = []), t.push(n)
|
|
}
|
|
}
|
|
const a = [];
|
|
for (const e in i) a.push(this.CreateFromMorphTargetSequence(e, i[e], t, n));
|
|
return a
|
|
}
|
|
static parseAnimation(e, t) {
|
|
if (!e) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null;
|
|
const n = function(e, t, n, i, r) {
|
|
if (0 !== n.length) {
|
|
const a = [],
|
|
s = [];
|
|
Ra(n, a, s, i), 0 !== a.length && r.push(new e(t, a, s))
|
|
}
|
|
},
|
|
i = [],
|
|
r = e.name || "default",
|
|
a = e.fps || 30,
|
|
s = e.blendMode;
|
|
let o = e.length || -1;
|
|
const l = e.hierarchy || [];
|
|
for (let e = 0; e < l.length; e++) {
|
|
const r = l[e].keys;
|
|
if (r && 0 !== r.length)
|
|
if (r[0].morphTargets) {
|
|
const e = {};
|
|
let t;
|
|
for (t = 0; t < r.length; t++)
|
|
if (r[t].morphTargets)
|
|
for (let n = 0; n < r[t].morphTargets.length; n++) e[r[t].morphTargets[n]] = -1;
|
|
for (const n in e) {
|
|
const e = [],
|
|
a = [];
|
|
for (let i = 0; i !== r[t].morphTargets.length; ++i) {
|
|
const i = r[t];
|
|
e.push(i.time), a.push(i.morphTarget === n ? 1 : 0)
|
|
}
|
|
i.push(new Fa(".morphTargetInfluence[" + n + "]", e, a))
|
|
}
|
|
o = e.length * a
|
|
} else {
|
|
const a = ".bones[" + t[e].name + "]";
|
|
n(Ha, a + ".position", r, "pos", i), n(za, a + ".quaternion", r, "rot", i), n(Ha, a + ".scale", r, "scl", i)
|
|
}
|
|
}
|
|
if (0 === i.length) return null;
|
|
return new this(r, o, i, s)
|
|
}
|
|
resetDuration() {
|
|
let e = 0;
|
|
for (let t = 0, n = this.tracks.length; t !== n; ++t) {
|
|
const n = this.tracks[t];
|
|
e = Math.max(e, n.times[n.times.length - 1])
|
|
}
|
|
return this.duration = e, this
|
|
}
|
|
trim() {
|
|
for (let e = 0; e < this.tracks.length; e++) this.tracks[e].trim(0, this.duration);
|
|
return this
|
|
}
|
|
validate() {
|
|
let e = !0;
|
|
for (let t = 0; t < this.tracks.length; t++) e = e && this.tracks[t].validate();
|
|
return e
|
|
}
|
|
optimize() {
|
|
for (let e = 0; e < this.tracks.length; e++) this.tracks[e].optimize();
|
|
return this
|
|
}
|
|
clone() {
|
|
const e = [];
|
|
for (let t = 0; t < this.tracks.length; t++) e.push(this.tracks[t].clone());
|
|
return new this.constructor(this.name, this.duration, e, this.blendMode)
|
|
}
|
|
toJSON() {
|
|
return this.constructor.toJSON(this)
|
|
}
|
|
}
|
|
|
|
function Ga(e) {
|
|
if (void 0 === e.type) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");
|
|
const t = function(e) {
|
|
switch (e.toLowerCase()) {
|
|
case "scalar":
|
|
case "double":
|
|
case "float":
|
|
case "number":
|
|
case "integer":
|
|
return Fa;
|
|
case "vector":
|
|
case "vector2":
|
|
case "vector3":
|
|
case "vector4":
|
|
return Ha;
|
|
case "color":
|
|
return Na;
|
|
case "quaternion":
|
|
return za;
|
|
case "bool":
|
|
case "boolean":
|
|
return ka;
|
|
case "string":
|
|
return Wa
|
|
}
|
|
throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + e)
|
|
}(e.type);
|
|
if (void 0 === e.times) {
|
|
const t = [],
|
|
n = [];
|
|
Ra(e.keys, t, n, "value"), e.times = t, e.values = n
|
|
}
|
|
return void 0 !== t.parse ? t.parse(e) : new t(e.name, e.times, e.values, e.interpolation)
|
|
}
|
|
const Qa = {
|
|
enabled: !1,
|
|
files: {},
|
|
add: function(e, t) {
|
|
!1 !== this.enabled && (this.files[e] = t)
|
|
},
|
|
get: function(e) {
|
|
if (!1 !== this.enabled) return this.files[e]
|
|
},
|
|
remove: function(e) {
|
|
delete this.files[e]
|
|
},
|
|
clear: function() {
|
|
this.files = {}
|
|
}
|
|
};
|
|
class Xa {
|
|
constructor(e, t, n) {
|
|
const i = this;
|
|
let r, a = !1,
|
|
s = 0,
|
|
o = 0;
|
|
const l = [];
|
|
this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = n, this.itemStart = function(e) {
|
|
o++, !1 === a && void 0 !== i.onStart && i.onStart(e, s, o), a = !0
|
|
}, this.itemEnd = function(e) {
|
|
s++, void 0 !== i.onProgress && i.onProgress(e, s, o), s === o && (a = !1, void 0 !== i.onLoad && i.onLoad())
|
|
}, this.itemError = function(e) {
|
|
void 0 !== i.onError && i.onError(e)
|
|
}, this.resolveURL = function(e) {
|
|
return r ? r(e) : e
|
|
}, this.setURLModifier = function(e) {
|
|
return r = e, this
|
|
}, this.addHandler = function(e, t) {
|
|
return l.push(e, t), this
|
|
}, this.removeHandler = function(e) {
|
|
const t = l.indexOf(e);
|
|
return -1 !== t && l.splice(t, 2), this
|
|
}, this.getHandler = function(e) {
|
|
for (let t = 0, n = l.length; t < n; t += 2) {
|
|
const n = l[t],
|
|
i = l[t + 1];
|
|
if (n.global && (n.lastIndex = 0), n.test(e)) return i
|
|
}
|
|
return null
|
|
}
|
|
}
|
|
}
|
|
const ja = new Xa;
|
|
class qa {
|
|
constructor(e) {
|
|
this.manager = void 0 !== e ? e : ja, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {}
|
|
}
|
|
load() {}
|
|
loadAsync(e, t) {
|
|
const n = this;
|
|
return new Promise((function(i, r) {
|
|
n.load(e, i, t, r)
|
|
}))
|
|
}
|
|
parse() {}
|
|
setCrossOrigin(e) {
|
|
return this.crossOrigin = e, this
|
|
}
|
|
setWithCredentials(e) {
|
|
return this.withCredentials = e, this
|
|
}
|
|
setPath(e) {
|
|
return this.path = e, this
|
|
}
|
|
setResourcePath(e) {
|
|
return this.resourcePath = e, this
|
|
}
|
|
setRequestHeader(e) {
|
|
return this.requestHeader = e, this
|
|
}
|
|
}
|
|
qa.DEFAULT_MATERIAL_NAME = "__DEFAULT";
|
|
const Ya = {};
|
|
class Ka extends Error {
|
|
constructor(e, t) {
|
|
super(e), this.response = t
|
|
}
|
|
}
|
|
class Za extends qa {
|
|
constructor(e) {
|
|
super(e)
|
|
}
|
|
load(e, t, n, i) {
|
|
void 0 === e && (e = ""), void 0 !== this.path && (e = this.path + e), e = this.manager.resolveURL(e);
|
|
const r = Qa.get(e);
|
|
if (void 0 !== r) return this.manager.itemStart(e), setTimeout((() => {
|
|
t && t(r), this.manager.itemEnd(e)
|
|
}), 0), r;
|
|
if (void 0 !== Ya[e]) return void Ya[e].push({
|
|
onLoad: t,
|
|
onProgress: n,
|
|
onError: i
|
|
});
|
|
Ya[e] = [], Ya[e].push({
|
|
onLoad: t,
|
|
onProgress: n,
|
|
onError: i
|
|
});
|
|
const a = new Request(e, {
|
|
headers: new Headers(this.requestHeader),
|
|
credentials: this.withCredentials ? "include" : "same-origin"
|
|
}),
|
|
s = this.mimeType,
|
|
o = this.responseType;
|
|
fetch(a).then((t => {
|
|
if (200 === t.status || 0 === t.status) {
|
|
if (0 === t.status && console.warn("THREE.FileLoader: HTTP Status 0 received."), "undefined" == typeof ReadableStream || void 0 === t.body || void 0 === t.body.getReader) return t;
|
|
const n = Ya[e],
|
|
i = t.body.getReader(),
|
|
r = t.headers.get("X-File-Size") || t.headers.get("Content-Length"),
|
|
a = r ? parseInt(r) : 0,
|
|
s = 0 !== a;
|
|
let o = 0;
|
|
const l = new ReadableStream({
|
|
start(e) {
|
|
! function t() {
|
|
i.read().then((({
|
|
done: i,
|
|
value: r
|
|
}) => {
|
|
if (i) e.close();
|
|
else {
|
|
o += r.byteLength;
|
|
const i = new ProgressEvent("progress", {
|
|
lengthComputable: s,
|
|
loaded: o,
|
|
total: a
|
|
});
|
|
for (let e = 0, t = n.length; e < t; e++) {
|
|
const t = n[e];
|
|
t.onProgress && t.onProgress(i)
|
|
}
|
|
e.enqueue(r), t()
|
|
}
|
|
}), (t => {
|
|
e.error(t)
|
|
}))
|
|
}()
|
|
}
|
|
});
|
|
return new Response(l)
|
|
}
|
|
throw new Ka(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`, t)
|
|
})).then((e => {
|
|
switch (o) {
|
|
case "arraybuffer":
|
|
return e.arrayBuffer();
|
|
case "blob":
|
|
return e.blob();
|
|
case "document":
|
|
return e.text().then((e => (new DOMParser).parseFromString(e, s)));
|
|
case "json":
|
|
return e.json();
|
|
default:
|
|
if (void 0 === s) return e.text();
|
|
{
|
|
const t = /charset="?([^;"\s]*)"?/i.exec(s),
|
|
n = t && t[1] ? t[1].toLowerCase() : void 0,
|
|
i = new TextDecoder(n);
|
|
return e.arrayBuffer().then((e => i.decode(e)))
|
|
}
|
|
}
|
|
})).then((t => {
|
|
Qa.add(e, t);
|
|
const n = Ya[e];
|
|
delete Ya[e];
|
|
for (let e = 0, i = n.length; e < i; e++) {
|
|
const i = n[e];
|
|
i.onLoad && i.onLoad(t)
|
|
}
|
|
})).catch((t => {
|
|
const n = Ya[e];
|
|
if (void 0 === n) throw this.manager.itemError(e), t;
|
|
delete Ya[e];
|
|
for (let e = 0, i = n.length; e < i; e++) {
|
|
const i = n[e];
|
|
i.onError && i.onError(t)
|
|
}
|
|
this.manager.itemError(e)
|
|
})).finally((() => {
|
|
this.manager.itemEnd(e)
|
|
})), this.manager.itemStart(e)
|
|
}
|
|
setResponseType(e) {
|
|
return this.responseType = e, this
|
|
}
|
|
setMimeType(e) {
|
|
return this.mimeType = e, this
|
|
}
|
|
}
|
|
class Ja extends qa {
|
|
constructor(e) {
|
|
super(e)
|
|
}
|
|
load(e, t, n, i) {
|
|
void 0 !== this.path && (e = this.path + e), e = this.manager.resolveURL(e);
|
|
const r = this,
|
|
a = Qa.get(e);
|
|
if (void 0 !== a) return r.manager.itemStart(e), setTimeout((function() {
|
|
t && t(a), r.manager.itemEnd(e)
|
|
}), 0), a;
|
|
const s = Ct("img");
|
|
|
|
function o() {
|
|
c(), Qa.add(e, this), t && t(this), r.manager.itemEnd(e)
|
|
}
|
|
|
|
function l(t) {
|
|
c(), i && i(t), r.manager.itemError(e), r.manager.itemEnd(e)
|
|
}
|
|
|
|
function c() {
|
|
s.removeEventListener("load", o, !1), s.removeEventListener("error", l, !1)
|
|
}
|
|
return s.addEventListener("load", o, !1), s.addEventListener("error", l, !1), "data:" !== e.slice(0, 5) && void 0 !== this.crossOrigin && (s.crossOrigin = this.crossOrigin), r.manager.itemStart(e), s.src = e, s
|
|
}
|
|
}
|
|
class $a extends qa {
|
|
constructor(e) {
|
|
super(e)
|
|
}
|
|
load(e, t, n, i) {
|
|
const r = new Gt,
|
|
a = new Ja(this.manager);
|
|
return a.setCrossOrigin(this.crossOrigin), a.setPath(this.path), a.load(e, (function(e) {
|
|
r.image = e, r.needsUpdate = !0, void 0 !== t && t(r)
|
|
}), n, i), r
|
|
}
|
|
}
|
|
class es extends ti {
|
|
constructor(e, t = 1) {
|
|
super(), this.isLight = !0, this.type = "Light", this.color = new wi(e), this.intensity = t
|
|
}
|
|
dispose() {}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.color.copy(e.color), this.intensity = e.intensity, this
|
|
}
|
|
toJSON(e) {
|
|
const t = super.toJSON(e);
|
|
return t.object.color = this.color.getHex(), t.object.intensity = this.intensity, void 0 !== this.groundColor && (t.object.groundColor = this.groundColor.getHex()), void 0 !== this.distance && (t.object.distance = this.distance), void 0 !== this.angle && (t.object.angle = this.angle), void 0 !== this.decay && (t.object.decay = this.decay), void 0 !== this.penumbra && (t.object.penumbra = this.penumbra), void 0 !== this.shadow && (t.object.shadow = this.shadow.toJSON()), void 0 !== this.target && (t.object.target = this.target.uuid), t
|
|
}
|
|
}
|
|
class ts extends es {
|
|
constructor(e, t, n) {
|
|
super(e, n), this.isHemisphereLight = !0, this.type = "HemisphereLight", this.position.copy(ti.DEFAULT_UP), this.updateMatrix(), this.groundColor = new wi(t)
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.groundColor.copy(e.groundColor), this
|
|
}
|
|
}
|
|
const ns = new Cn,
|
|
is = new Zt,
|
|
rs = new Zt;
|
|
class as {
|
|
constructor(e) {
|
|
this.camera = e, this.intensity = 1, this.bias = 0, this.normalBias = 0, this.radius = 1, this.blurSamples = 8, this.mapSize = new Et(512, 512), this.map = null, this.mapPass = null, this.matrix = new Cn, this.autoUpdate = !0, this.needsUpdate = !1, this._frustum = new Jr, this._frameExtents = new Et(1, 1), this._viewportCount = 1, this._viewports = [new Qt(0, 0, 1, 1)]
|
|
}
|
|
getViewportCount() {
|
|
return this._viewportCount
|
|
}
|
|
getFrustum() {
|
|
return this._frustum
|
|
}
|
|
updateMatrices(e) {
|
|
const t = this.camera,
|
|
n = this.matrix;
|
|
is.setFromMatrixPosition(e.matrixWorld), t.position.copy(is), rs.setFromMatrixPosition(e.target.matrixWorld), t.lookAt(rs), t.updateMatrixWorld(), ns.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), this._frustum.setFromProjectionMatrix(ns), n.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), n.multiply(ns)
|
|
}
|
|
getViewport(e) {
|
|
return this._viewports[e]
|
|
}
|
|
getFrameExtents() {
|
|
return this._frameExtents
|
|
}
|
|
dispose() {
|
|
this.map && this.map.dispose(), this.mapPass && this.mapPass.dispose()
|
|
}
|
|
copy(e) {
|
|
return this.camera = e.camera.clone(), this.intensity = e.intensity, this.bias = e.bias, this.radius = e.radius, this.mapSize.copy(e.mapSize), this
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
toJSON() {
|
|
const e = {};
|
|
return 1 !== this.intensity && (e.intensity = this.intensity), 0 !== this.bias && (e.bias = this.bias), 0 !== this.normalBias && (e.normalBias = this.normalBias), 1 !== this.radius && (e.radius = this.radius), 512 === this.mapSize.x && 512 === this.mapSize.y || (e.mapSize = this.mapSize.toArray()), e.camera = this.camera.toJSON(!1).object, delete e.camera.matrix, e
|
|
}
|
|
}
|
|
class ss extends as {
|
|
constructor() {
|
|
super(new cr(50, 1, .5, 500)), this.isSpotLightShadow = !0, this.focus = 1
|
|
}
|
|
updateMatrices(e) {
|
|
const t = this.camera,
|
|
n = 2 * gt * e.angle * this.focus,
|
|
i = this.mapSize.width / this.mapSize.height,
|
|
r = e.distance || t.far;
|
|
n === t.fov && i === t.aspect && r === t.far || (t.fov = n, t.aspect = i, t.far = r, t.updateProjectionMatrix()), super.updateMatrices(e)
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.focus = e.focus, this
|
|
}
|
|
}
|
|
class os extends es {
|
|
constructor(e, t, n = 0, i = Math.PI / 3, r = 0, a = 2) {
|
|
super(e, t), this.isSpotLight = !0, this.type = "SpotLight", this.position.copy(ti.DEFAULT_UP), this.updateMatrix(), this.target = new ti, this.distance = n, this.angle = i, this.penumbra = r, this.decay = a, this.map = null, this.shadow = new ss
|
|
}
|
|
get power() {
|
|
return this.intensity * Math.PI
|
|
}
|
|
set power(e) {
|
|
this.intensity = e / Math.PI
|
|
}
|
|
dispose() {
|
|
this.shadow.dispose()
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.distance = e.distance, this.angle = e.angle, this.penumbra = e.penumbra, this.decay = e.decay, this.target = e.target.clone(), this.shadow = e.shadow.clone(), this
|
|
}
|
|
}
|
|
const ls = new Cn,
|
|
cs = new Zt,
|
|
hs = new Zt;
|
|
class us extends as {
|
|
constructor() {
|
|
super(new cr(90, 1, .5, 500)), this.isPointLightShadow = !0, this._frameExtents = new Et(4, 2), this._viewportCount = 6, this._viewports = [new Qt(2, 1, 1, 1), new Qt(0, 1, 1, 1), new Qt(3, 1, 1, 1), new Qt(1, 1, 1, 1), new Qt(3, 0, 1, 1), new Qt(1, 0, 1, 1)], this._cubeDirections = [new Zt(1, 0, 0), new Zt(-1, 0, 0), new Zt(0, 0, 1), new Zt(0, 0, -1), new Zt(0, 1, 0), new Zt(0, -1, 0)], this._cubeUps = [new Zt(0, 1, 0), new Zt(0, 1, 0), new Zt(0, 1, 0), new Zt(0, 1, 0), new Zt(0, 0, 1), new Zt(0, 0, -1)]
|
|
}
|
|
updateMatrices(e, t = 0) {
|
|
const n = this.camera,
|
|
i = this.matrix,
|
|
r = e.distance || n.far;
|
|
r !== n.far && (n.far = r, n.updateProjectionMatrix()), cs.setFromMatrixPosition(e.matrixWorld), n.position.copy(cs), hs.copy(n.position), hs.add(this._cubeDirections[t]), n.up.copy(this._cubeUps[t]), n.lookAt(hs), n.updateMatrixWorld(), i.makeTranslation(-cs.x, -cs.y, -cs.z), ls.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse), this._frustum.setFromProjectionMatrix(ls)
|
|
}
|
|
}
|
|
class ds extends es {
|
|
constructor(e, t, n = 0, i = 2) {
|
|
super(e, t), this.isPointLight = !0, this.type = "PointLight", this.distance = n, this.decay = i, this.shadow = new us
|
|
}
|
|
get power() {
|
|
return 4 * this.intensity * Math.PI
|
|
}
|
|
set power(e) {
|
|
this.intensity = e / (4 * Math.PI)
|
|
}
|
|
dispose() {
|
|
this.shadow.dispose()
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.distance = e.distance, this.decay = e.decay, this.shadow = e.shadow.clone(), this
|
|
}
|
|
}
|
|
class fs extends ar {
|
|
constructor(e = -1, t = 1, n = 1, i = -1, r = .1, a = 2e3) {
|
|
super(), this.isOrthographicCamera = !0, this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = e, this.right = t, this.top = n, this.bottom = i, this.near = r, this.far = a, this.updateProjectionMatrix()
|
|
}
|
|
copy(e, t) {
|
|
return super.copy(e, t), this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.near = e.near, this.far = e.far, this.zoom = e.zoom, this.view = null === e.view ? null : Object.assign({}, e.view), this
|
|
}
|
|
setViewOffset(e, t, n, i, r, a) {
|
|
null === this.view && (this.view = {
|
|
enabled: !0,
|
|
fullWidth: 1,
|
|
fullHeight: 1,
|
|
offsetX: 0,
|
|
offsetY: 0,
|
|
width: 1,
|
|
height: 1
|
|
}), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix()
|
|
}
|
|
clearViewOffset() {
|
|
null !== this.view && (this.view.enabled = !1), this.updateProjectionMatrix()
|
|
}
|
|
updateProjectionMatrix() {
|
|
const e = (this.right - this.left) / (2 * this.zoom),
|
|
t = (this.top - this.bottom) / (2 * this.zoom),
|
|
n = (this.right + this.left) / 2,
|
|
i = (this.top + this.bottom) / 2;
|
|
let r = n - e,
|
|
a = n + e,
|
|
s = i + t,
|
|
o = i - t;
|
|
if (null !== this.view && this.view.enabled) {
|
|
const e = (this.right - this.left) / this.view.fullWidth / this.zoom,
|
|
t = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
|
|
r += e * this.view.offsetX, a = r + e * this.view.width, s -= t * this.view.offsetY, o = s - t * this.view.height
|
|
}
|
|
this.projectionMatrix.makeOrthographic(r, a, s, o, this.near, this.far, this.coordinateSystem), this.projectionMatrixInverse.copy(this.projectionMatrix).invert()
|
|
}
|
|
toJSON(e) {
|
|
const t = super.toJSON(e);
|
|
return t.object.zoom = this.zoom, t.object.left = this.left, t.object.right = this.right, t.object.top = this.top, t.object.bottom = this.bottom, t.object.near = this.near, t.object.far = this.far, null !== this.view && (t.object.view = Object.assign({}, this.view)), t
|
|
}
|
|
}
|
|
class ps extends as {
|
|
constructor() {
|
|
super(new fs(-5, 5, 5, -5, .5, 500)), this.isDirectionalLightShadow = !0
|
|
}
|
|
}
|
|
class ms extends es {
|
|
constructor(e, t) {
|
|
super(e, t), this.isDirectionalLight = !0, this.type = "DirectionalLight", this.position.copy(ti.DEFAULT_UP), this.updateMatrix(), this.target = new ti, this.shadow = new ps
|
|
}
|
|
dispose() {
|
|
this.shadow.dispose()
|
|
}
|
|
copy(e) {
|
|
return super.copy(e), this.target = e.target.clone(), this.shadow = e.shadow.clone(), this
|
|
}
|
|
}
|
|
class gs {
|
|
static decodeText(e) {
|
|
if (console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."), "undefined" != typeof TextDecoder) return (new TextDecoder).decode(e);
|
|
let t = "";
|
|
for (let n = 0, i = e.length; n < i; n++) t += String.fromCharCode(e[n]);
|
|
try {
|
|
return decodeURIComponent(escape(t))
|
|
} catch (e) {
|
|
return t
|
|
}
|
|
}
|
|
static extractUrlBase(e) {
|
|
const t = e.lastIndexOf("/");
|
|
return -1 === t ? "./" : e.slice(0, t + 1)
|
|
}
|
|
static resolveURL(e, t) {
|
|
return "string" != typeof e || "" === e ? "" : (/^https?:\/\//i.test(t) && /^\//.test(e) && (t = t.replace(/(^https?:\/\/[^\/]+).*/i, "$1")), /^(https?:)?\/\//i.test(e) || /^data:.*,.*$/i.test(e) || /^blob:.*$/i.test(e) ? e : t + e)
|
|
}
|
|
}
|
|
class As extends qa {
|
|
constructor(e) {
|
|
super(e), this.isImageBitmapLoader = !0, "undefined" == typeof createImageBitmap && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."), "undefined" == typeof fetch && console.warn("THREE.ImageBitmapLoader: fetch() not supported."), this.options = {
|
|
premultiplyAlpha: "none"
|
|
}
|
|
}
|
|
setOptions(e) {
|
|
return this.options = e, this
|
|
}
|
|
load(e, t, n, i) {
|
|
void 0 === e && (e = ""), void 0 !== this.path && (e = this.path + e), e = this.manager.resolveURL(e);
|
|
const r = this,
|
|
a = Qa.get(e);
|
|
if (void 0 !== a) return r.manager.itemStart(e), a.then ? void a.then((n => {
|
|
t && t(n), r.manager.itemEnd(e)
|
|
})).catch((e => {
|
|
i && i(e)
|
|
})) : (setTimeout((function() {
|
|
t && t(a), r.manager.itemEnd(e)
|
|
}), 0), a);
|
|
const s = {};
|
|
s.credentials = "anonymous" === this.crossOrigin ? "same-origin" : "include", s.headers = this.requestHeader;
|
|
const o = fetch(e, s).then((function(e) {
|
|
return e.blob()
|
|
})).then((function(e) {
|
|
return createImageBitmap(e, Object.assign(r.options, {
|
|
colorSpaceConversion: "none"
|
|
}))
|
|
})).then((function(n) {
|
|
return Qa.add(e, n), t && t(n), r.manager.itemEnd(e), n
|
|
})).catch((function(t) {
|
|
i && i(t), Qa.remove(e), r.manager.itemError(e), r.manager.itemEnd(e)
|
|
}));
|
|
Qa.add(e, o), r.manager.itemStart(e)
|
|
}
|
|
}
|
|
class _s extends cr {
|
|
constructor(e = []) {
|
|
super(), this.isArrayCamera = !0, this.cameras = e, this.index = 0
|
|
}
|
|
}
|
|
const vs = "\\[\\]\\.:\\/",
|
|
ws = new RegExp("[" + vs + "]", "g"),
|
|
ys = "[^" + vs + "]",
|
|
xs = "[^" + vs.replace("\\.", "") + "]",
|
|
bs = new RegExp("^" + /((?:WC+[\/:])*)/.source.replace("WC", ys) + /(WCOD+)?/.source.replace("WCOD", xs) + /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", ys) + /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", ys) + "$"),
|
|
Es = ["material", "materials", "bones", "map"];
|
|
class Ss {
|
|
constructor(e, t, n) {
|
|
this.path = t, this.parsedPath = n || Ss.parseTrackName(t), this.node = Ss.findNode(e, this.parsedPath.nodeName), this.rootNode = e, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound
|
|
}
|
|
static create(e, t, n) {
|
|
return e && e.isAnimationObjectGroup ? new Ss.Composite(e, t, n) : new Ss(e, t, n)
|
|
}
|
|
static sanitizeNodeName(e) {
|
|
return e.replace(/\s/g, "_").replace(ws, "")
|
|
}
|
|
static parseTrackName(e) {
|
|
const t = bs.exec(e);
|
|
if (null === t) throw new Error("PropertyBinding: Cannot parse trackName: " + e);
|
|
const n = {
|
|
nodeName: t[2],
|
|
objectName: t[3],
|
|
objectIndex: t[4],
|
|
propertyName: t[5],
|
|
propertyIndex: t[6]
|
|
},
|
|
i = n.nodeName && n.nodeName.lastIndexOf(".");
|
|
if (void 0 !== i && -1 !== i) {
|
|
const e = n.nodeName.substring(i + 1); - 1 !== Es.indexOf(e) && (n.nodeName = n.nodeName.substring(0, i), n.objectName = e)
|
|
}
|
|
if (null === n.propertyName || 0 === n.propertyName.length) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + e);
|
|
return n
|
|
}
|
|
static findNode(e, t) {
|
|
if (void 0 === t || "" === t || "." === t || -1 === t || t === e.name || t === e.uuid) return e;
|
|
if (e.skeleton) {
|
|
const n = e.skeleton.getBoneByName(t);
|
|
if (void 0 !== n) return n
|
|
}
|
|
if (e.children) {
|
|
const n = function(e) {
|
|
for (let i = 0; i < e.length; i++) {
|
|
const r = e[i];
|
|
if (r.name === t || r.uuid === t) return r;
|
|
const a = n(r.children);
|
|
if (a) return a
|
|
}
|
|
return null
|
|
},
|
|
i = n(e.children);
|
|
if (i) return i
|
|
}
|
|
return null
|
|
}
|
|
_getValue_unavailable() {}
|
|
_setValue_unavailable() {}
|
|
_getValue_direct(e, t) {
|
|
e[t] = this.targetObject[this.propertyName]
|
|
}
|
|
_getValue_array(e, t) {
|
|
const n = this.resolvedProperty;
|
|
for (let i = 0, r = n.length; i !== r; ++i) e[t++] = n[i]
|
|
}
|
|
_getValue_arrayElement(e, t) {
|
|
e[t] = this.resolvedProperty[this.propertyIndex]
|
|
}
|
|
_getValue_toArray(e, t) {
|
|
this.resolvedProperty.toArray(e, t)
|
|
}
|
|
_setValue_direct(e, t) {
|
|
this.targetObject[this.propertyName] = e[t]
|
|
}
|
|
_setValue_direct_setNeedsUpdate(e, t) {
|
|
this.targetObject[this.propertyName] = e[t], this.targetObject.needsUpdate = !0
|
|
}
|
|
_setValue_direct_setMatrixWorldNeedsUpdate(e, t) {
|
|
this.targetObject[this.propertyName] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0
|
|
}
|
|
_setValue_array(e, t) {
|
|
const n = this.resolvedProperty;
|
|
for (let i = 0, r = n.length; i !== r; ++i) n[i] = e[t++]
|
|
}
|
|
_setValue_array_setNeedsUpdate(e, t) {
|
|
const n = this.resolvedProperty;
|
|
for (let i = 0, r = n.length; i !== r; ++i) n[i] = e[t++];
|
|
this.targetObject.needsUpdate = !0
|
|
}
|
|
_setValue_array_setMatrixWorldNeedsUpdate(e, t) {
|
|
const n = this.resolvedProperty;
|
|
for (let i = 0, r = n.length; i !== r; ++i) n[i] = e[t++];
|
|
this.targetObject.matrixWorldNeedsUpdate = !0
|
|
}
|
|
_setValue_arrayElement(e, t) {
|
|
this.resolvedProperty[this.propertyIndex] = e[t]
|
|
}
|
|
_setValue_arrayElement_setNeedsUpdate(e, t) {
|
|
this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.needsUpdate = !0
|
|
}
|
|
_setValue_arrayElement_setMatrixWorldNeedsUpdate(e, t) {
|
|
this.resolvedProperty[this.propertyIndex] = e[t], this.targetObject.matrixWorldNeedsUpdate = !0
|
|
}
|
|
_setValue_fromArray(e, t) {
|
|
this.resolvedProperty.fromArray(e, t)
|
|
}
|
|
_setValue_fromArray_setNeedsUpdate(e, t) {
|
|
this.resolvedProperty.fromArray(e, t), this.targetObject.needsUpdate = !0
|
|
}
|
|
_setValue_fromArray_setMatrixWorldNeedsUpdate(e, t) {
|
|
this.resolvedProperty.fromArray(e, t), this.targetObject.matrixWorldNeedsUpdate = !0
|
|
}
|
|
_getValue_unbound(e, t) {
|
|
this.bind(), this.getValue(e, t)
|
|
}
|
|
_setValue_unbound(e, t) {
|
|
this.bind(), this.setValue(e, t)
|
|
}
|
|
bind() {
|
|
let e = this.node;
|
|
const t = this.parsedPath,
|
|
n = t.objectName,
|
|
i = t.propertyName;
|
|
let r = t.propertyIndex;
|
|
if (e || (e = Ss.findNode(this.rootNode, t.nodeName), this.node = e), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, !e) return void console.warn("THREE.PropertyBinding: No target node found for track: " + this.path + ".");
|
|
if (n) {
|
|
let i = t.objectIndex;
|
|
switch (n) {
|
|
case "materials":
|
|
if (!e.material) return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this);
|
|
if (!e.material.materials) return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
|
|
e = e.material.materials;
|
|
break;
|
|
case "bones":
|
|
if (!e.skeleton) return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
|
|
e = e.skeleton.bones;
|
|
for (let t = 0; t < e.length; t++)
|
|
if (e[t].name === i) {
|
|
i = t;
|
|
break
|
|
} break;
|
|
case "map":
|
|
if ("map" in e) {
|
|
e = e.map;
|
|
break
|
|
}
|
|
if (!e.material) return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this);
|
|
if (!e.material.map) return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.", this);
|
|
e = e.material.map;
|
|
break;
|
|
default:
|
|
if (void 0 === e[n]) return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this);
|
|
e = e[n]
|
|
}
|
|
if (void 0 !== i) {
|
|
if (void 0 === e[i]) return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, e);
|
|
e = e[i]
|
|
}
|
|
}
|
|
const a = e[i];
|
|
if (void 0 === a) {
|
|
const n = t.nodeName;
|
|
return void console.error("THREE.PropertyBinding: Trying to update property for track: " + n + "." + i + " but it wasn't found.", e)
|
|
}
|
|
let s = this.Versioning.None;
|
|
this.targetObject = e, !0 === e.isMaterial ? s = this.Versioning.NeedsUpdate : !0 === e.isObject3D && (s = this.Versioning.MatrixWorldNeedsUpdate);
|
|
let o = this.BindingType.Direct;
|
|
if (void 0 !== r) {
|
|
if ("morphTargetInfluences" === i) {
|
|
if (!e.geometry) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
|
|
if (!e.geometry.morphAttributes) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
|
|
void 0 !== e.morphTargetDictionary[r] && (r = e.morphTargetDictionary[r])
|
|
}
|
|
o = this.BindingType.ArrayElement, this.resolvedProperty = a, this.propertyIndex = r
|
|
} else void 0 !== a.fromArray && void 0 !== a.toArray ? (o = this.BindingType.HasFromToArray, this.resolvedProperty = a) : Array.isArray(a) ? (o = this.BindingType.EntireArray, this.resolvedProperty = a) : this.propertyName = i;
|
|
this.getValue = this.GetterByBindingType[o], this.setValue = this.SetterByBindingTypeAndVersioning[o][s]
|
|
}
|
|
unbind() {
|
|
this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound
|
|
}
|
|
}
|
|
Ss.Composite = class {
|
|
constructor(e, t, n) {
|
|
const i = n || Ss.parseTrackName(t);
|
|
this._targetGroup = e, this._bindings = e.subscribe_(t, i)
|
|
}
|
|
getValue(e, t) {
|
|
this.bind();
|
|
const n = this._targetGroup.nCachedObjects_,
|
|
i = this._bindings[n];
|
|
void 0 !== i && i.getValue(e, t)
|
|
}
|
|
setValue(e, t) {
|
|
const n = this._bindings;
|
|
for (let i = this._targetGroup.nCachedObjects_, r = n.length; i !== r; ++i) n[i].setValue(e, t)
|
|
}
|
|
bind() {
|
|
const e = this._bindings;
|
|
for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].bind()
|
|
}
|
|
unbind() {
|
|
const e = this._bindings;
|
|
for (let t = this._targetGroup.nCachedObjects_, n = e.length; t !== n; ++t) e[t].unbind()
|
|
}
|
|
}, Ss.prototype.BindingType = {
|
|
Direct: 0,
|
|
EntireArray: 1,
|
|
ArrayElement: 2,
|
|
HasFromToArray: 3
|
|
}, Ss.prototype.Versioning = {
|
|
None: 0,
|
|
NeedsUpdate: 1,
|
|
MatrixWorldNeedsUpdate: 2
|
|
}, Ss.prototype.GetterByBindingType = [Ss.prototype._getValue_direct, Ss.prototype._getValue_array, Ss.prototype._getValue_arrayElement, Ss.prototype._getValue_toArray], Ss.prototype.SetterByBindingTypeAndVersioning = [
|
|
[Ss.prototype._setValue_direct, Ss.prototype._setValue_direct_setNeedsUpdate, Ss.prototype._setValue_direct_setMatrixWorldNeedsUpdate],
|
|
[Ss.prototype._setValue_array, Ss.prototype._setValue_array_setNeedsUpdate, Ss.prototype._setValue_array_setMatrixWorldNeedsUpdate],
|
|
[Ss.prototype._setValue_arrayElement, Ss.prototype._setValue_arrayElement_setNeedsUpdate, Ss.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],
|
|
[Ss.prototype._setValue_fromArray, Ss.prototype._setValue_fromArray_setNeedsUpdate, Ss.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]
|
|
];
|
|
new Float32Array(1);
|
|
const Ms = new Cn;
|
|
class Ts {
|
|
constructor(e, t, n = 0, i = 1 / 0) {
|
|
this.ray = new Tn(e, t), this.near = n, this.far = i, this.camera = null, this.layers = new On, this.params = {
|
|
Mesh: {},
|
|
Line: {
|
|
threshold: 1
|
|
},
|
|
LOD: {},
|
|
Points: {
|
|
threshold: 1
|
|
},
|
|
Sprite: {}
|
|
}
|
|
}
|
|
set(e, t) {
|
|
this.ray.set(e, t)
|
|
}
|
|
setFromCamera(e, t) {
|
|
t.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(t.matrixWorld), this.ray.direction.set(e.x, e.y, .5).unproject(t).sub(this.ray.origin).normalize(), this.camera = t) : t.isOrthographicCamera ? (this.ray.origin.set(e.x, e.y, (t.near + t.far) / (t.near - t.far)).unproject(t), this.ray.direction.set(0, 0, -1).transformDirection(t.matrixWorld), this.camera = t) : console.error("THREE.Raycaster: Unsupported camera type: " + t.type)
|
|
}
|
|
setFromXRController(e) {
|
|
return Ms.identity().extractRotation(e.matrixWorld), this.ray.origin.setFromMatrixPosition(e.matrixWorld), this.ray.direction.set(0, 0, -1).applyMatrix4(Ms), this
|
|
}
|
|
intersectObject(e, t = !0, n = []) {
|
|
return Is(e, this, n, t), n.sort(Cs), n
|
|
}
|
|
intersectObjects(e, t = !0, n = []) {
|
|
for (let i = 0, r = e.length; i < r; i++) Is(e[i], this, n, t);
|
|
return n.sort(Cs), n
|
|
}
|
|
}
|
|
|
|
function Cs(e, t) {
|
|
return e.distance - t.distance
|
|
}
|
|
|
|
function Is(e, t, n, i) {
|
|
let r = !0;
|
|
if (e.layers.test(t.layers)) {
|
|
!1 === e.raycast(t, n) && (r = !1)
|
|
}
|
|
if (!0 === r && !0 === i) {
|
|
const i = e.children;
|
|
for (let e = 0, r = i.length; e < r; e++) Is(i[e], t, n, !0)
|
|
}
|
|
}
|
|
|
|
function Rs(e, t, n, i) {
|
|
const r = function(e) {
|
|
switch (e) {
|
|
case X:
|
|
case j:
|
|
return {
|
|
byteLength: 1, components: 1
|
|
};
|
|
case Y:
|
|
case q:
|
|
case $:
|
|
return {
|
|
byteLength: 2, components: 1
|
|
};
|
|
case ee:
|
|
case te:
|
|
return {
|
|
byteLength: 2, components: 4
|
|
};
|
|
case Z:
|
|
case K:
|
|
case J:
|
|
return {
|
|
byteLength: 4, components: 1
|
|
};
|
|
case ie:
|
|
return {
|
|
byteLength: 4, components: 3
|
|
}
|
|
}
|
|
throw new Error(`Unknown texture type ${e}.`)
|
|
}(i);
|
|
switch (n) {
|
|
case 1021:
|
|
case 1024:
|
|
return e * t;
|
|
case 1025:
|
|
return e * t * 2;
|
|
case oe:
|
|
case le:
|
|
return e * t / r.components * r.byteLength;
|
|
case 1030:
|
|
case ce:
|
|
return e * t * 2 / r.components * r.byteLength;
|
|
case 1022:
|
|
return e * t * 3 / r.components * r.byteLength;
|
|
case re:
|
|
case he:
|
|
return e * t * 4 / r.components * r.byteLength;
|
|
case ue:
|
|
case de:
|
|
return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 8;
|
|
case fe:
|
|
case pe:
|
|
return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 16;
|
|
case ge:
|
|
case _e:
|
|
return Math.max(e, 16) * Math.max(t, 8) / 4;
|
|
case me:
|
|
case Ae:
|
|
return Math.max(e, 8) * Math.max(t, 8) / 2;
|
|
case ve:
|
|
case we:
|
|
return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 8;
|
|
case ye:
|
|
case xe:
|
|
return Math.floor((e + 3) / 4) * Math.floor((t + 3) / 4) * 16;
|
|
case be:
|
|
return Math.floor((e + 4) / 5) * Math.floor((t + 3) / 4) * 16;
|
|
case Ee:
|
|
return Math.floor((e + 4) / 5) * Math.floor((t + 4) / 5) * 16;
|
|
case Se:
|
|
return Math.floor((e + 5) / 6) * Math.floor((t + 4) / 5) * 16;
|
|
case Me:
|
|
return Math.floor((e + 5) / 6) * Math.floor((t + 5) / 6) * 16;
|
|
case Te:
|
|
return Math.floor((e + 7) / 8) * Math.floor((t + 4) / 5) * 16;
|
|
case Ce:
|
|
return Math.floor((e + 7) / 8) * Math.floor((t + 5) / 6) * 16;
|
|
case Ie:
|
|
return Math.floor((e + 7) / 8) * Math.floor((t + 7) / 8) * 16;
|
|
case Re:
|
|
return Math.floor((e + 9) / 10) * Math.floor((t + 4) / 5) * 16;
|
|
case Pe:
|
|
return Math.floor((e + 9) / 10) * Math.floor((t + 5) / 6) * 16;
|
|
case Be:
|
|
return Math.floor((e + 9) / 10) * Math.floor((t + 7) / 8) * 16;
|
|
case De:
|
|
return Math.floor((e + 9) / 10) * Math.floor((t + 9) / 10) * 16;
|
|
case Le:
|
|
return Math.floor((e + 11) / 12) * Math.floor((t + 9) / 10) * 16;
|
|
case Ue:
|
|
return Math.floor((e + 11) / 12) * Math.floor((t + 11) / 12) * 16;
|
|
case ke:
|
|
case Ne:
|
|
case Fe:
|
|
return Math.ceil(e / 4) * Math.ceil(t / 4) * 16;
|
|
case 36283:
|
|
case Oe:
|
|
return Math.ceil(e / 4) * Math.ceil(t / 4) * 8;
|
|
case ze:
|
|
case We:
|
|
return Math.ceil(e / 4) * Math.ceil(t / 4) * 16
|
|
}
|
|
throw new Error(`Unable to determine texture byte length for ${n} format.`)
|
|
}
|
|
"undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register", {
|
|
detail: {
|
|
revision: e
|
|
}
|
|
})), "undefined" != typeof window && (window.__THREE__ ? console.warn("WARNING: Multiple instances of Three.js being imported.") : window.__THREE__ = e);
|
|
const Ps = {
|
|
c: null,
|
|
u: [new Zt, new Zt, new Zt],
|
|
e: []
|
|
},
|
|
Bs = {
|
|
c: null,
|
|
u: [new Zt, new Zt, new Zt],
|
|
e: []
|
|
},
|
|
Ds = [
|
|
[],
|
|
[],
|
|
[]
|
|
],
|
|
Ls = [
|
|
[],
|
|
[],
|
|
[]
|
|
],
|
|
Us = [],
|
|
ks = new Zt,
|
|
Ns = new Zt,
|
|
Fs = new Zt,
|
|
Os = new Zt,
|
|
zs = new Zt,
|
|
Ws = new Zt,
|
|
Hs = new St,
|
|
Vs = new en,
|
|
Gs = new Cn,
|
|
Qs = new Cn,
|
|
Xs = new Tn;
|
|
class js {
|
|
constructor(e = new Zt, t = new Zt, n = new St) {
|
|
this.center = e, this.halfSize = t, this.rotation = n
|
|
}
|
|
set(e, t, n) {
|
|
return this.center = e, this.halfSize = t, this.rotation = n, this
|
|
}
|
|
copy(e) {
|
|
return this.center.copy(e.center), this.halfSize.copy(e.halfSize), this.rotation.copy(e.rotation), this
|
|
}
|
|
clone() {
|
|
return (new this.constructor).copy(this)
|
|
}
|
|
getSize(e) {
|
|
return e.copy(this.halfSize).multiplyScalar(2)
|
|
}
|
|
clampPoint(e, t) {
|
|
const n = this.halfSize;
|
|
Os.subVectors(e, this.center), this.rotation.extractBasis(ks, Ns, Fs), t.copy(this.center);
|
|
const i = bt.clamp(Os.dot(ks), -n.x, n.x);
|
|
t.add(ks.multiplyScalar(i));
|
|
const r = bt.clamp(Os.dot(Ns), -n.y, n.y);
|
|
t.add(Ns.multiplyScalar(r));
|
|
const a = bt.clamp(Os.dot(Fs), -n.z, n.z);
|
|
return t.add(Fs.multiplyScalar(a)), t
|
|
}
|
|
containsPoint(e) {
|
|
return Os.subVectors(e, this.center), this.rotation.extractBasis(ks, Ns, Fs), Math.abs(Os.dot(ks)) <= this.halfSize.x && Math.abs(Os.dot(Ns)) <= this.halfSize.y && Math.abs(Os.dot(Fs)) <= this.halfSize.z
|
|
}
|
|
intersectsBox3(e) {
|
|
return this.intersectsOBB(qs.fromBox3(e))
|
|
}
|
|
intersectsSphere(e) {
|
|
return this.clampPoint(e.center, Ws), Ws.distanceToSquared(e.center) <= e.radius * e.radius
|
|
}
|
|
intersectsOBB(e, t = Number.EPSILON) {
|
|
Ps.c = this.center, Ps.e[0] = this.halfSize.x, Ps.e[1] = this.halfSize.y, Ps.e[2] = this.halfSize.z, this.rotation.extractBasis(Ps.u[0], Ps.u[1], Ps.u[2]), Bs.c = e.center, Bs.e[0] = e.halfSize.x, Bs.e[1] = e.halfSize.y, Bs.e[2] = e.halfSize.z, e.rotation.extractBasis(Bs.u[0], Bs.u[1], Bs.u[2]);
|
|
for (let e = 0; e < 3; e++)
|
|
for (let t = 0; t < 3; t++) Ds[e][t] = Ps.u[e].dot(Bs.u[t]);
|
|
Os.subVectors(Bs.c, Ps.c), Us[0] = Os.dot(Ps.u[0]), Us[1] = Os.dot(Ps.u[1]), Us[2] = Os.dot(Ps.u[2]);
|
|
for (let e = 0; e < 3; e++)
|
|
for (let n = 0; n < 3; n++) Ls[e][n] = Math.abs(Ds[e][n]) + t;
|
|
let n, i;
|
|
for (let e = 0; e < 3; e++)
|
|
if (n = Ps.e[e], i = Bs.e[0] * Ls[e][0] + Bs.e[1] * Ls[e][1] + Bs.e[2] * Ls[e][2], Math.abs(Us[e]) > n + i) return !1;
|
|
for (let e = 0; e < 3; e++)
|
|
if (n = Ps.e[0] * Ls[0][e] + Ps.e[1] * Ls[1][e] + Ps.e[2] * Ls[2][e], i = Bs.e[e], Math.abs(Us[0] * Ds[0][e] + Us[1] * Ds[1][e] + Us[2] * Ds[2][e]) > n + i) return !1;
|
|
return n = Ps.e[1] * Ls[2][0] + Ps.e[2] * Ls[1][0], i = Bs.e[1] * Ls[0][2] + Bs.e[2] * Ls[0][1], !(Math.abs(Us[2] * Ds[1][0] - Us[1] * Ds[2][0]) > n + i) && (n = Ps.e[1] * Ls[2][1] + Ps.e[2] * Ls[1][1], i = Bs.e[0] * Ls[0][2] + Bs.e[2] * Ls[0][0], !(Math.abs(Us[2] * Ds[1][1] - Us[1] * Ds[2][1]) > n + i) && (n = Ps.e[1] * Ls[2][2] + Ps.e[2] * Ls[1][2], i = Bs.e[0] * Ls[0][1] + Bs.e[1] * Ls[0][0], !(Math.abs(Us[2] * Ds[1][2] - Us[1] * Ds[2][2]) > n + i) && (n = Ps.e[0] * Ls[2][0] + Ps.e[2] * Ls[0][0], i = Bs.e[1] * Ls[1][2] + Bs.e[2] * Ls[1][1], !(Math.abs(Us[0] * Ds[2][0] - Us[2] * Ds[0][0]) > n + i) && (n = Ps.e[0] * Ls[2][1] + Ps.e[2] * Ls[0][1], i = Bs.e[0] * Ls[1][2] + Bs.e[2] * Ls[1][0], !(Math.abs(Us[0] * Ds[2][1] - Us[2] * Ds[0][1]) > n + i) && (n = Ps.e[0] * Ls[2][2] + Ps.e[2] * Ls[0][2], i = Bs.e[0] * Ls[1][1] + Bs.e[1] * Ls[1][0], !(Math.abs(Us[0] * Ds[2][2] - Us[2] * Ds[0][2]) > n + i) && (n = Ps.e[0] * Ls[1][0] + Ps.e[1] * Ls[0][0], i = Bs.e[1] * Ls[2][2] + Bs.e[2] * Ls[2][1], !(Math.abs(Us[1] * Ds[0][0] - Us[0] * Ds[1][0]) > n + i) && (n = Ps.e[0] * Ls[1][1] + Ps.e[1] * Ls[0][1], i = Bs.e[0] * Ls[2][2] + Bs.e[2] * Ls[2][0], !(Math.abs(Us[1] * Ds[0][1] - Us[0] * Ds[1][1]) > n + i) && (n = Ps.e[0] * Ls[1][2] + Ps.e[1] * Ls[0][2], i = Bs.e[0] * Ls[2][1] + Bs.e[1] * Ls[2][0], !(Math.abs(Us[1] * Ds[0][2] - Us[0] * Ds[1][2]) > n + i)))))))))
|
|
}
|
|
intersectsPlane(e) {
|
|
this.rotation.extractBasis(ks, Ns, Fs);
|
|
const t = this.halfSize.x * Math.abs(e.normal.dot(ks)) + this.halfSize.y * Math.abs(e.normal.dot(Ns)) + this.halfSize.z * Math.abs(e.normal.dot(Fs)),
|
|
n = e.normal.dot(this.center) - e.constant;
|
|
return Math.abs(n) <= t
|
|
}
|
|
intersectRay(e, t) {
|
|
return this.getSize(zs), Vs.setFromCenterAndSize(Os.set(0, 0, 0), zs), Gs.setFromMatrix3(this.rotation), Gs.setPosition(this.center), Qs.copy(Gs).invert(), Xs.copy(e).applyMatrix4(Qs), Xs.intersectBox(Vs, t) ? t.applyMatrix4(Gs) : null
|
|
}
|
|
intersectsRay(e) {
|
|
return null !== this.intersectRay(e, Os)
|
|
}
|
|
fromBox3(e) {
|
|
return e.getCenter(this.center), e.getSize(this.halfSize).multiplyScalar(.5), this.rotation.identity(), this
|
|
}
|
|
equals(e) {
|
|
return e.center.equals(this.center) && e.halfSize.equals(this.halfSize) && e.rotation.equals(this.rotation)
|
|
}
|
|
applyMatrix4(e) {
|
|
const t = e.elements;
|
|
let n = Os.set(t[0], t[1], t[2]).length();
|
|
const i = Os.set(t[4], t[5], t[6]).length(),
|
|
r = Os.set(t[8], t[9], t[10]).length();
|
|
e.determinant() < 0 && (n = -n), Hs.setFromMatrix4(e);
|
|
const a = 1 / n,
|
|
s = 1 / i,
|
|
o = 1 / r;
|
|
return Hs.elements[0] *= a, Hs.elements[1] *= a, Hs.elements[2] *= a, Hs.elements[3] *= s, Hs.elements[4] *= s, Hs.elements[5] *= s, Hs.elements[6] *= o, Hs.elements[7] *= o, Hs.elements[8] *= o, this.rotation.multiply(Hs), this.halfSize.x *= n, this.halfSize.y *= i, this.halfSize.z *= r, Os.setFromMatrixPosition(e), this.center.add(Os), this
|
|
}
|
|
}
|
|
const qs = new js;
|
|
|
|
function Ys(e) {
|
|
let t = e.length;
|
|
for (; --t >= 0;) e[t] = 0
|
|
}
|
|
const Ks = 256,
|
|
Zs = 286,
|
|
Js = 30,
|
|
$s = 15,
|
|
eo = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0]),
|
|
to = new Uint8Array([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13]),
|
|
no = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7]),
|
|
io = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]),
|
|
ro = new Array(576);
|
|
Ys(ro);
|
|
const ao = new Array(60);
|
|
Ys(ao);
|
|
const so = new Array(512);
|
|
Ys(so);
|
|
const oo = new Array(256);
|
|
Ys(oo);
|
|
const lo = new Array(29);
|
|
Ys(lo);
|
|
const co = new Array(Js);
|
|
|
|
function ho(e, t, n, i, r) {
|
|
this.static_tree = e, this.extra_bits = t, this.extra_base = n, this.elems = i, this.max_length = r, this.has_stree = e && e.length
|
|
}
|
|
let uo, fo, po;
|
|
|
|
function mo(e, t) {
|
|
this.dyn_tree = e, this.max_code = 0, this.stat_desc = t
|
|
}
|
|
Ys(co);
|
|
const go = e => e < 256 ? so[e] : so[256 + (e >>> 7)],
|
|
Ao = (e, t) => {
|
|
e.pending_buf[e.pending++] = 255 & t, e.pending_buf[e.pending++] = t >>> 8 & 255
|
|
},
|
|
_o = (e, t, n) => {
|
|
e.bi_valid > 16 - n ? (e.bi_buf |= t << e.bi_valid & 65535, Ao(e, e.bi_buf), e.bi_buf = t >> 16 - e.bi_valid, e.bi_valid += n - 16) : (e.bi_buf |= t << e.bi_valid & 65535, e.bi_valid += n)
|
|
},
|
|
vo = (e, t, n) => {
|
|
_o(e, n[2 * t], n[2 * t + 1])
|
|
},
|
|
wo = (e, t) => {
|
|
let n = 0;
|
|
do {
|
|
n |= 1 & e, e >>>= 1, n <<= 1
|
|
} while (--t > 0);
|
|
return n >>> 1
|
|
},
|
|
yo = (e, t, n) => {
|
|
const i = new Array(16);
|
|
let r, a, s = 0;
|
|
for (r = 1; r <= $s; r++) s = s + n[r - 1] << 1, i[r] = s;
|
|
for (a = 0; a <= t; a++) {
|
|
let t = e[2 * a + 1];
|
|
0 !== t && (e[2 * a] = wo(i[t]++, t))
|
|
}
|
|
},
|
|
xo = e => {
|
|
let t;
|
|
for (t = 0; t < Zs; t++) e.dyn_ltree[2 * t] = 0;
|
|
for (t = 0; t < Js; t++) e.dyn_dtree[2 * t] = 0;
|
|
for (t = 0; t < 19; t++) e.bl_tree[2 * t] = 0;
|
|
e.dyn_ltree[512] = 1, e.opt_len = e.static_len = 0, e.sym_next = e.matches = 0
|
|
},
|
|
bo = e => {
|
|
e.bi_valid > 8 ? Ao(e, e.bi_buf) : e.bi_valid > 0 && (e.pending_buf[e.pending++] = e.bi_buf), e.bi_buf = 0, e.bi_valid = 0
|
|
},
|
|
Eo = (e, t, n, i) => {
|
|
const r = 2 * t,
|
|
a = 2 * n;
|
|
return e[r] < e[a] || e[r] === e[a] && i[t] <= i[n]
|
|
},
|
|
So = (e, t, n) => {
|
|
const i = e.heap[n];
|
|
let r = n << 1;
|
|
for (; r <= e.heap_len && (r < e.heap_len && Eo(t, e.heap[r + 1], e.heap[r], e.depth) && r++, !Eo(t, i, e.heap[r], e.depth));) e.heap[n] = e.heap[r], n = r, r <<= 1;
|
|
e.heap[n] = i
|
|
},
|
|
Mo = (e, t, n) => {
|
|
let i, r, a, s, o = 0;
|
|
if (0 !== e.sym_next)
|
|
do {
|
|
i = 255 & e.pending_buf[e.sym_buf + o++], i += (255 & e.pending_buf[e.sym_buf + o++]) << 8, r = e.pending_buf[e.sym_buf + o++], 0 === i ? vo(e, r, t) : (a = oo[r], vo(e, a + Ks + 1, t), s = eo[a], 0 !== s && (r -= lo[a], _o(e, r, s)), i--, a = go(i), vo(e, a, n), s = to[a], 0 !== s && (i -= co[a], _o(e, i, s)))
|
|
} while (o < e.sym_next);
|
|
vo(e, 256, t)
|
|
},
|
|
To = (e, t) => {
|
|
const n = t.dyn_tree,
|
|
i = t.stat_desc.static_tree,
|
|
r = t.stat_desc.has_stree,
|
|
a = t.stat_desc.elems;
|
|
let s, o, l, c = -1;
|
|
for (e.heap_len = 0, e.heap_max = 573, s = 0; s < a; s++) 0 !== n[2 * s] ? (e.heap[++e.heap_len] = c = s, e.depth[s] = 0) : n[2 * s + 1] = 0;
|
|
for (; e.heap_len < 2;) l = e.heap[++e.heap_len] = c < 2 ? ++c : 0, n[2 * l] = 1, e.depth[l] = 0, e.opt_len--, r && (e.static_len -= i[2 * l + 1]);
|
|
for (t.max_code = c, s = e.heap_len >> 1; s >= 1; s--) So(e, n, s);
|
|
l = a;
|
|
do {
|
|
s = e.heap[1], e.heap[1] = e.heap[e.heap_len--], So(e, n, 1), o = e.heap[1], e.heap[--e.heap_max] = s, e.heap[--e.heap_max] = o, n[2 * l] = n[2 * s] + n[2 * o], e.depth[l] = (e.depth[s] >= e.depth[o] ? e.depth[s] : e.depth[o]) + 1, n[2 * s + 1] = n[2 * o + 1] = l, e.heap[1] = l++, So(e, n, 1)
|
|
} while (e.heap_len >= 2);
|
|
e.heap[--e.heap_max] = e.heap[1], ((e, t) => {
|
|
const n = t.dyn_tree,
|
|
i = t.max_code,
|
|
r = t.stat_desc.static_tree,
|
|
a = t.stat_desc.has_stree,
|
|
s = t.stat_desc.extra_bits,
|
|
o = t.stat_desc.extra_base,
|
|
l = t.stat_desc.max_length;
|
|
let c, h, u, d, f, p, m = 0;
|
|
for (d = 0; d <= $s; d++) e.bl_count[d] = 0;
|
|
for (n[2 * e.heap[e.heap_max] + 1] = 0, c = e.heap_max + 1; c < 573; c++) h = e.heap[c], d = n[2 * n[2 * h + 1] + 1] + 1, d > l && (d = l, m++), n[2 * h + 1] = d, h > i || (e.bl_count[d]++, f = 0, h >= o && (f = s[h - o]), p = n[2 * h], e.opt_len += p * (d + f), a && (e.static_len += p * (r[2 * h + 1] + f)));
|
|
if (0 !== m) {
|
|
do {
|
|
for (d = l - 1; 0 === e.bl_count[d];) d--;
|
|
e.bl_count[d]--, e.bl_count[d + 1] += 2, e.bl_count[l]--, m -= 2
|
|
} while (m > 0);
|
|
for (d = l; 0 !== d; d--)
|
|
for (h = e.bl_count[d]; 0 !== h;) u = e.heap[--c], u > i || (n[2 * u + 1] !== d && (e.opt_len += (d - n[2 * u + 1]) * n[2 * u], n[2 * u + 1] = d), h--)
|
|
}
|
|
})(e, t), yo(n, c, e.bl_count)
|
|
},
|
|
Co = (e, t, n) => {
|
|
let i, r, a = -1,
|
|
s = t[1],
|
|
o = 0,
|
|
l = 7,
|
|
c = 4;
|
|
for (0 === s && (l = 138, c = 3), t[2 * (n + 1) + 1] = 65535, i = 0; i <= n; i++) r = s, s = t[2 * (i + 1) + 1], ++o < l && r === s || (o < c ? e.bl_tree[2 * r] += o : 0 !== r ? (r !== a && e.bl_tree[2 * r]++, e.bl_tree[32]++) : o <= 10 ? e.bl_tree[34]++ : e.bl_tree[36]++, o = 0, a = r, 0 === s ? (l = 138, c = 3) : r === s ? (l = 6, c = 3) : (l = 7, c = 4))
|
|
},
|
|
Io = (e, t, n) => {
|
|
let i, r, a = -1,
|
|
s = t[1],
|
|
o = 0,
|
|
l = 7,
|
|
c = 4;
|
|
for (0 === s && (l = 138, c = 3), i = 0; i <= n; i++)
|
|
if (r = s, s = t[2 * (i + 1) + 1], !(++o < l && r === s)) {
|
|
if (o < c)
|
|
do {
|
|
vo(e, r, e.bl_tree)
|
|
} while (0 != --o);
|
|
else 0 !== r ? (r !== a && (vo(e, r, e.bl_tree), o--), vo(e, 16, e.bl_tree), _o(e, o - 3, 2)) : o <= 10 ? (vo(e, 17, e.bl_tree), _o(e, o - 3, 3)) : (vo(e, 18, e.bl_tree), _o(e, o - 11, 7));
|
|
o = 0, a = r, 0 === s ? (l = 138, c = 3) : r === s ? (l = 6, c = 3) : (l = 7, c = 4)
|
|
}
|
|
};
|
|
let Ro = !1;
|
|
const Po = (e, t, n, i) => {
|
|
_o(e, 0 + (i ? 1 : 0), 3), bo(e), Ao(e, n), Ao(e, ~n), n && e.pending_buf.set(e.window.subarray(t, t + n), e.pending), e.pending += n
|
|
};
|
|
var Bo = (e, t, n, i) => {
|
|
let r, a, s = 0;
|
|
e.level > 0 ? (2 === e.strm.data_type && (e.strm.data_type = (e => {
|
|
let t, n = 4093624447;
|
|
for (t = 0; t <= 31; t++, n >>>= 1)
|
|
if (1 & n && 0 !== e.dyn_ltree[2 * t]) return 0;
|
|
if (0 !== e.dyn_ltree[18] || 0 !== e.dyn_ltree[20] || 0 !== e.dyn_ltree[26]) return 1;
|
|
for (t = 32; t < Ks; t++)
|
|
if (0 !== e.dyn_ltree[2 * t]) return 1;
|
|
return 0
|
|
})(e)), To(e, e.l_desc), To(e, e.d_desc), s = (e => {
|
|
let t;
|
|
for (Co(e, e.dyn_ltree, e.l_desc.max_code), Co(e, e.dyn_dtree, e.d_desc.max_code), To(e, e.bl_desc), t = 18; t >= 3 && 0 === e.bl_tree[2 * io[t] + 1]; t--);
|
|
return e.opt_len += 3 * (t + 1) + 5 + 5 + 4, t
|
|
})(e), r = e.opt_len + 3 + 7 >>> 3, a = e.static_len + 3 + 7 >>> 3, a <= r && (r = a)) : r = a = n + 5, n + 4 <= r && -1 !== t ? Po(e, t, n, i) : 4 === e.strategy || a === r ? (_o(e, 2 + (i ? 1 : 0), 3), Mo(e, ro, ao)) : (_o(e, 4 + (i ? 1 : 0), 3), ((e, t, n, i) => {
|
|
let r;
|
|
for (_o(e, t - 257, 5), _o(e, n - 1, 5), _o(e, i - 4, 4), r = 0; r < i; r++) _o(e, e.bl_tree[2 * io[r] + 1], 3);
|
|
Io(e, e.dyn_ltree, t - 1), Io(e, e.dyn_dtree, n - 1)
|
|
})(e, e.l_desc.max_code + 1, e.d_desc.max_code + 1, s + 1), Mo(e, e.dyn_ltree, e.dyn_dtree)), xo(e), i && bo(e)
|
|
},
|
|
Do = {
|
|
_tr_init: e => {
|
|
Ro || ((() => {
|
|
let e, t, n, i, r;
|
|
const a = new Array(16);
|
|
for (n = 0, i = 0; i < 28; i++)
|
|
for (lo[i] = n, e = 0; e < 1 << eo[i]; e++) oo[n++] = i;
|
|
for (oo[n - 1] = i, r = 0, i = 0; i < 16; i++)
|
|
for (co[i] = r, e = 0; e < 1 << to[i]; e++) so[r++] = i;
|
|
for (r >>= 7; i < Js; i++)
|
|
for (co[i] = r << 7, e = 0; e < 1 << to[i] - 7; e++) so[256 + r++] = i;
|
|
for (t = 0; t <= $s; t++) a[t] = 0;
|
|
for (e = 0; e <= 143;) ro[2 * e + 1] = 8, e++, a[8]++;
|
|
for (; e <= 255;) ro[2 * e + 1] = 9, e++, a[9]++;
|
|
for (; e <= 279;) ro[2 * e + 1] = 7, e++, a[7]++;
|
|
for (; e <= 287;) ro[2 * e + 1] = 8, e++, a[8]++;
|
|
for (yo(ro, 287, a), e = 0; e < Js; e++) ao[2 * e + 1] = 5, ao[2 * e] = wo(e, 5);
|
|
uo = new ho(ro, eo, 257, Zs, $s), fo = new ho(ao, to, 0, Js, $s), po = new ho(new Array(0), no, 0, 19, 7)
|
|
})(), Ro = !0), e.l_desc = new mo(e.dyn_ltree, uo), e.d_desc = new mo(e.dyn_dtree, fo), e.bl_desc = new mo(e.bl_tree, po), e.bi_buf = 0, e.bi_valid = 0, xo(e)
|
|
},
|
|
_tr_stored_block: Po,
|
|
_tr_flush_block: Bo,
|
|
_tr_tally: (e, t, n) => (e.pending_buf[e.sym_buf + e.sym_next++] = t, e.pending_buf[e.sym_buf + e.sym_next++] = t >> 8, e.pending_buf[e.sym_buf + e.sym_next++] = n, 0 === t ? e.dyn_ltree[2 * n]++ : (e.matches++, t--, e.dyn_ltree[2 * (oo[n] + Ks + 1)]++, e.dyn_dtree[2 * go(t)]++), e.sym_next === e.sym_end),
|
|
_tr_align: e => {
|
|
_o(e, 2, 3), vo(e, 256, ro), (e => {
|
|
16 === e.bi_valid ? (Ao(e, e.bi_buf), e.bi_buf = 0, e.bi_valid = 0) : e.bi_valid >= 8 && (e.pending_buf[e.pending++] = 255 & e.bi_buf, e.bi_buf >>= 8, e.bi_valid -= 8)
|
|
})(e)
|
|
}
|
|
};
|
|
var Lo = (e, t, n, i) => {
|
|
let r = 65535 & e,
|
|
a = e >>> 16 & 65535,
|
|
s = 0;
|
|
for (; 0 !== n;) {
|
|
s = n > 2e3 ? 2e3 : n, n -= s;
|
|
do {
|
|
r = r + t[i++] | 0, a = a + r | 0
|
|
} while (--s);
|
|
r %= 65521, a %= 65521
|
|
}
|
|
return r | a << 16
|
|
};
|
|
const Uo = new Uint32Array((() => {
|
|
let e, t = [];
|
|
for (var n = 0; n < 256; n++) {
|
|
e = n;
|
|
for (var i = 0; i < 8; i++) e = 1 & e ? 3988292384 ^ e >>> 1 : e >>> 1;
|
|
t[n] = e
|
|
}
|
|
return t
|
|
})());
|
|
var ko = (e, t, n, i) => {
|
|
const r = Uo,
|
|
a = i + n;
|
|
e ^= -1;
|
|
for (let n = i; n < a; n++) e = e >>> 8 ^ r[255 & (e ^ t[n])];
|
|
return ~e
|
|
},
|
|
No = {
|
|
2: "need dictionary",
|
|
1: "stream end",
|
|
0: "",
|
|
"-1": "file error",
|
|
"-2": "stream error",
|
|
"-3": "data error",
|
|
"-4": "insufficient memory",
|
|
"-5": "buffer error",
|
|
"-6": "incompatible version"
|
|
},
|
|
Fo = {
|
|
Z_NO_FLUSH: 0,
|
|
Z_PARTIAL_FLUSH: 1,
|
|
Z_SYNC_FLUSH: 2,
|
|
Z_FULL_FLUSH: 3,
|
|
Z_FINISH: 4,
|
|
Z_BLOCK: 5,
|
|
Z_TREES: 6,
|
|
Z_OK: 0,
|
|
Z_STREAM_END: 1,
|
|
Z_NEED_DICT: 2,
|
|
Z_ERRNO: -1,
|
|
Z_STREAM_ERROR: -2,
|
|
Z_DATA_ERROR: -3,
|
|
Z_MEM_ERROR: -4,
|
|
Z_BUF_ERROR: -5,
|
|
Z_NO_COMPRESSION: 0,
|
|
Z_BEST_SPEED: 1,
|
|
Z_BEST_COMPRESSION: 9,
|
|
Z_DEFAULT_COMPRESSION: -1,
|
|
Z_FILTERED: 1,
|
|
Z_HUFFMAN_ONLY: 2,
|
|
Z_RLE: 3,
|
|
Z_FIXED: 4,
|
|
Z_DEFAULT_STRATEGY: 0,
|
|
Z_BINARY: 0,
|
|
Z_TEXT: 1,
|
|
Z_UNKNOWN: 2,
|
|
Z_DEFLATED: 8
|
|
};
|
|
const {
|
|
_tr_init: Oo,
|
|
_tr_stored_block: zo,
|
|
_tr_flush_block: Wo,
|
|
_tr_tally: Ho,
|
|
_tr_align: Vo
|
|
} = Do, {
|
|
Z_NO_FLUSH: Go,
|
|
Z_PARTIAL_FLUSH: Qo,
|
|
Z_FULL_FLUSH: Xo,
|
|
Z_FINISH: jo,
|
|
Z_BLOCK: qo,
|
|
Z_OK: Yo,
|
|
Z_STREAM_END: Ko,
|
|
Z_STREAM_ERROR: Zo,
|
|
Z_DATA_ERROR: Jo,
|
|
Z_BUF_ERROR: $o,
|
|
Z_DEFAULT_COMPRESSION: el,
|
|
Z_FILTERED: tl,
|
|
Z_HUFFMAN_ONLY: nl,
|
|
Z_RLE: il,
|
|
Z_FIXED: rl,
|
|
Z_DEFAULT_STRATEGY: al,
|
|
Z_UNKNOWN: sl,
|
|
Z_DEFLATED: ol
|
|
} = Fo, ll = 258, cl = 262, hl = 42, ul = 113, dl = 666, fl = (e, t) => (e.msg = No[t], t), pl = e => 2 * e - (e > 4 ? 9 : 0), ml = e => {
|
|
let t = e.length;
|
|
for (; --t >= 0;) e[t] = 0
|
|
}, gl = e => {
|
|
let t, n, i, r = e.w_size;
|
|
t = e.hash_size, i = t;
|
|
do {
|
|
n = e.head[--i], e.head[i] = n >= r ? n - r : 0
|
|
} while (--t);
|
|
t = r, i = t;
|
|
do {
|
|
n = e.prev[--i], e.prev[i] = n >= r ? n - r : 0
|
|
} while (--t)
|
|
};
|
|
let Al = (e, t, n) => (t << e.hash_shift ^ n) & e.hash_mask;
|
|
const _l = e => {
|
|
const t = e.state;
|
|
let n = t.pending;
|
|
n > e.avail_out && (n = e.avail_out), 0 !== n && (e.output.set(t.pending_buf.subarray(t.pending_out, t.pending_out + n), e.next_out), e.next_out += n, t.pending_out += n, e.total_out += n, e.avail_out -= n, t.pending -= n, 0 === t.pending && (t.pending_out = 0))
|
|
},
|
|
vl = (e, t) => {
|
|
Wo(e, e.block_start >= 0 ? e.block_start : -1, e.strstart - e.block_start, t), e.block_start = e.strstart, _l(e.strm)
|
|
},
|
|
wl = (e, t) => {
|
|
e.pending_buf[e.pending++] = t
|
|
},
|
|
yl = (e, t) => {
|
|
e.pending_buf[e.pending++] = t >>> 8 & 255, e.pending_buf[e.pending++] = 255 & t
|
|
},
|
|
xl = (e, t, n, i) => {
|
|
let r = e.avail_in;
|
|
return r > i && (r = i), 0 === r ? 0 : (e.avail_in -= r, t.set(e.input.subarray(e.next_in, e.next_in + r), n), 1 === e.state.wrap ? e.adler = Lo(e.adler, t, r, n) : 2 === e.state.wrap && (e.adler = ko(e.adler, t, r, n)), e.next_in += r, e.total_in += r, r)
|
|
},
|
|
bl = (e, t) => {
|
|
let n, i, r = e.max_chain_length,
|
|
a = e.strstart,
|
|
s = e.prev_length,
|
|
o = e.nice_match;
|
|
const l = e.strstart > e.w_size - cl ? e.strstart - (e.w_size - cl) : 0,
|
|
c = e.window,
|
|
h = e.w_mask,
|
|
u = e.prev,
|
|
d = e.strstart + ll;
|
|
let f = c[a + s - 1],
|
|
p = c[a + s];
|
|
e.prev_length >= e.good_match && (r >>= 2), o > e.lookahead && (o = e.lookahead);
|
|
do {
|
|
if (n = t, c[n + s] === p && c[n + s - 1] === f && c[n] === c[a] && c[++n] === c[a + 1]) {
|
|
a += 2, n++;
|
|
do {} while (c[++a] === c[++n] && c[++a] === c[++n] && c[++a] === c[++n] && c[++a] === c[++n] && c[++a] === c[++n] && c[++a] === c[++n] && c[++a] === c[++n] && c[++a] === c[++n] && a < d);
|
|
if (i = ll - (d - a), a = d - ll, i > s) {
|
|
if (e.match_start = t, s = i, i >= o) break;
|
|
f = c[a + s - 1], p = c[a + s]
|
|
}
|
|
}
|
|
} while ((t = u[t & h]) > l && 0 != --r);
|
|
return s <= e.lookahead ? s : e.lookahead
|
|
},
|
|
El = e => {
|
|
const t = e.w_size;
|
|
let n, i, r;
|
|
do {
|
|
if (i = e.window_size - e.lookahead - e.strstart, e.strstart >= t + (t - cl) && (e.window.set(e.window.subarray(t, t + t - i), 0), e.match_start -= t, e.strstart -= t, e.block_start -= t, e.insert > e.strstart && (e.insert = e.strstart), gl(e), i += t), 0 === e.strm.avail_in) break;
|
|
if (n = xl(e.strm, e.window, e.strstart + e.lookahead, i), e.lookahead += n, e.lookahead + e.insert >= 3)
|
|
for (r = e.strstart - e.insert, e.ins_h = e.window[r], e.ins_h = Al(e, e.ins_h, e.window[r + 1]); e.insert && (e.ins_h = Al(e, e.ins_h, e.window[r + 3 - 1]), e.prev[r & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = r, r++, e.insert--, !(e.lookahead + e.insert < 3)););
|
|
} while (e.lookahead < cl && 0 !== e.strm.avail_in)
|
|
},
|
|
Sl = (e, t) => {
|
|
let n, i, r, a = e.pending_buf_size - 5 > e.w_size ? e.w_size : e.pending_buf_size - 5,
|
|
s = 0,
|
|
o = e.strm.avail_in;
|
|
do {
|
|
if (n = 65535, r = e.bi_valid + 42 >> 3, e.strm.avail_out < r) break;
|
|
if (r = e.strm.avail_out - r, i = e.strstart - e.block_start, n > i + e.strm.avail_in && (n = i + e.strm.avail_in), n > r && (n = r), n < a && (0 === n && t !== jo || t === Go || n !== i + e.strm.avail_in)) break;
|
|
s = t === jo && n === i + e.strm.avail_in ? 1 : 0, zo(e, 0, 0, s), e.pending_buf[e.pending - 4] = n, e.pending_buf[e.pending - 3] = n >> 8, e.pending_buf[e.pending - 2] = ~n, e.pending_buf[e.pending - 1] = ~n >> 8, _l(e.strm), i && (i > n && (i = n), e.strm.output.set(e.window.subarray(e.block_start, e.block_start + i), e.strm.next_out), e.strm.next_out += i, e.strm.avail_out -= i, e.strm.total_out += i, e.block_start += i, n -= i), n && (xl(e.strm, e.strm.output, e.strm.next_out, n), e.strm.next_out += n, e.strm.avail_out -= n, e.strm.total_out += n)
|
|
} while (0 === s);
|
|
return o -= e.strm.avail_in, o && (o >= e.w_size ? (e.matches = 2, e.window.set(e.strm.input.subarray(e.strm.next_in - e.w_size, e.strm.next_in), 0), e.strstart = e.w_size, e.insert = e.strstart) : (e.window_size - e.strstart <= o && (e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, e.insert > e.strstart && (e.insert = e.strstart)), e.window.set(e.strm.input.subarray(e.strm.next_in - o, e.strm.next_in), e.strstart), e.strstart += o, e.insert += o > e.w_size - e.insert ? e.w_size - e.insert : o), e.block_start = e.strstart), e.high_water < e.strstart && (e.high_water = e.strstart), s ? 4 : t !== Go && t !== jo && 0 === e.strm.avail_in && e.strstart === e.block_start ? 2 : (r = e.window_size - e.strstart, e.strm.avail_in > r && e.block_start >= e.w_size && (e.block_start -= e.w_size, e.strstart -= e.w_size, e.window.set(e.window.subarray(e.w_size, e.w_size + e.strstart), 0), e.matches < 2 && e.matches++, r += e.w_size, e.insert > e.strstart && (e.insert = e.strstart)), r > e.strm.avail_in && (r = e.strm.avail_in), r && (xl(e.strm, e.window, e.strstart, r), e.strstart += r, e.insert += r > e.w_size - e.insert ? e.w_size - e.insert : r), e.high_water < e.strstart && (e.high_water = e.strstart), r = e.bi_valid + 42 >> 3, r = e.pending_buf_size - r > 65535 ? 65535 : e.pending_buf_size - r, a = r > e.w_size ? e.w_size : r, i = e.strstart - e.block_start, (i >= a || (i || t === jo) && t !== Go && 0 === e.strm.avail_in && i <= r) && (n = i > r ? r : i, s = t === jo && 0 === e.strm.avail_in && n === i ? 1 : 0, zo(e, e.block_start, n, s), e.block_start += n, _l(e.strm)), s ? 3 : 1)
|
|
},
|
|
Ml = (e, t) => {
|
|
let n, i;
|
|
for (;;) {
|
|
if (e.lookahead < cl) {
|
|
if (El(e), e.lookahead < cl && t === Go) return 1;
|
|
if (0 === e.lookahead) break
|
|
}
|
|
if (n = 0, e.lookahead >= 3 && (e.ins_h = Al(e, e.ins_h, e.window[e.strstart + 3 - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), 0 !== n && e.strstart - n <= e.w_size - cl && (e.match_length = bl(e, n)), e.match_length >= 3)
|
|
if (i = Ho(e, e.strstart - e.match_start, e.match_length - 3), e.lookahead -= e.match_length, e.match_length <= e.max_lazy_match && e.lookahead >= 3) {
|
|
e.match_length--;
|
|
do {
|
|
e.strstart++, e.ins_h = Al(e, e.ins_h, e.window[e.strstart + 3 - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart
|
|
} while (0 != --e.match_length);
|
|
e.strstart++
|
|
} else e.strstart += e.match_length, e.match_length = 0, e.ins_h = e.window[e.strstart], e.ins_h = Al(e, e.ins_h, e.window[e.strstart + 1]);
|
|
else i = Ho(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++;
|
|
if (i && (vl(e, !1), 0 === e.strm.avail_out)) return 1
|
|
}
|
|
return e.insert = e.strstart < 2 ? e.strstart : 2, t === jo ? (vl(e, !0), 0 === e.strm.avail_out ? 3 : 4) : e.sym_next && (vl(e, !1), 0 === e.strm.avail_out) ? 1 : 2
|
|
},
|
|
Tl = (e, t) => {
|
|
let n, i, r;
|
|
for (;;) {
|
|
if (e.lookahead < cl) {
|
|
if (El(e), e.lookahead < cl && t === Go) return 1;
|
|
if (0 === e.lookahead) break
|
|
}
|
|
if (n = 0, e.lookahead >= 3 && (e.ins_h = Al(e, e.ins_h, e.window[e.strstart + 3 - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart), e.prev_length = e.match_length, e.prev_match = e.match_start, e.match_length = 2, 0 !== n && e.prev_length < e.max_lazy_match && e.strstart - n <= e.w_size - cl && (e.match_length = bl(e, n), e.match_length <= 5 && (e.strategy === tl || 3 === e.match_length && e.strstart - e.match_start > 4096) && (e.match_length = 2)), e.prev_length >= 3 && e.match_length <= e.prev_length) {
|
|
r = e.strstart + e.lookahead - 3, i = Ho(e, e.strstart - 1 - e.prev_match, e.prev_length - 3), e.lookahead -= e.prev_length - 1, e.prev_length -= 2;
|
|
do {
|
|
++e.strstart <= r && (e.ins_h = Al(e, e.ins_h, e.window[e.strstart + 3 - 1]), n = e.prev[e.strstart & e.w_mask] = e.head[e.ins_h], e.head[e.ins_h] = e.strstart)
|
|
} while (0 != --e.prev_length);
|
|
if (e.match_available = 0, e.match_length = 2, e.strstart++, i && (vl(e, !1), 0 === e.strm.avail_out)) return 1
|
|
} else if (e.match_available) {
|
|
if (i = Ho(e, 0, e.window[e.strstart - 1]), i && vl(e, !1), e.strstart++, e.lookahead--, 0 === e.strm.avail_out) return 1
|
|
} else e.match_available = 1, e.strstart++, e.lookahead--
|
|
}
|
|
return e.match_available && (i = Ho(e, 0, e.window[e.strstart - 1]), e.match_available = 0), e.insert = e.strstart < 2 ? e.strstart : 2, t === jo ? (vl(e, !0), 0 === e.strm.avail_out ? 3 : 4) : e.sym_next && (vl(e, !1), 0 === e.strm.avail_out) ? 1 : 2
|
|
};
|
|
|
|
function Cl(e, t, n, i, r) {
|
|
this.good_length = e, this.max_lazy = t, this.nice_length = n, this.max_chain = i, this.func = r
|
|
}
|
|
const Il = [new Cl(0, 0, 0, 0, Sl), new Cl(4, 4, 8, 4, Ml), new Cl(4, 5, 16, 8, Ml), new Cl(4, 6, 32, 32, Ml), new Cl(4, 4, 16, 16, Tl), new Cl(8, 16, 32, 32, Tl), new Cl(8, 16, 128, 128, Tl), new Cl(8, 32, 128, 256, Tl), new Cl(32, 128, 258, 1024, Tl), new Cl(32, 258, 258, 4096, Tl)];
|
|
|
|
function Rl() {
|
|
this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = ol, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new Uint16Array(1146), this.dyn_dtree = new Uint16Array(122), this.bl_tree = new Uint16Array(78), ml(this.dyn_ltree), ml(this.dyn_dtree), ml(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new Uint16Array(16), this.heap = new Uint16Array(573), ml(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new Uint16Array(573), ml(this.depth), this.sym_buf = 0, this.lit_bufsize = 0, this.sym_next = 0, this.sym_end = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0
|
|
}
|
|
const Pl = e => {
|
|
if (!e) return 1;
|
|
const t = e.state;
|
|
return !t || t.strm !== e || t.status !== hl && 57 !== t.status && 69 !== t.status && 73 !== t.status && 91 !== t.status && 103 !== t.status && t.status !== ul && t.status !== dl ? 1 : 0
|
|
},
|
|
Bl = e => {
|
|
if (Pl(e)) return fl(e, Zo);
|
|
e.total_in = e.total_out = 0, e.data_type = sl;
|
|
const t = e.state;
|
|
return t.pending = 0, t.pending_out = 0, t.wrap < 0 && (t.wrap = -t.wrap), t.status = 2 === t.wrap ? 57 : t.wrap ? hl : ul, e.adler = 2 === t.wrap ? 0 : 1, t.last_flush = -2, Oo(t), Yo
|
|
},
|
|
Dl = e => {
|
|
const t = Bl(e);
|
|
var n;
|
|
return t === Yo && ((n = e.state).window_size = 2 * n.w_size, ml(n.head), n.max_lazy_match = Il[n.level].max_lazy, n.good_match = Il[n.level].good_length, n.nice_match = Il[n.level].nice_length, n.max_chain_length = Il[n.level].max_chain, n.strstart = 0, n.block_start = 0, n.lookahead = 0, n.insert = 0, n.match_length = n.prev_length = 2, n.match_available = 0, n.ins_h = 0), t
|
|
},
|
|
Ll = (e, t, n, i, r, a) => {
|
|
if (!e) return Zo;
|
|
let s = 1;
|
|
if (t === el && (t = 6), i < 0 ? (s = 0, i = -i) : i > 15 && (s = 2, i -= 16), r < 1 || r > 9 || n !== ol || i < 8 || i > 15 || t < 0 || t > 9 || a < 0 || a > rl || 8 === i && 1 !== s) return fl(e, Zo);
|
|
8 === i && (i = 9);
|
|
const o = new Rl;
|
|
return e.state = o, o.strm = e, o.status = hl, o.wrap = s, o.gzhead = null, o.w_bits = i, o.w_size = 1 << o.w_bits, o.w_mask = o.w_size - 1, o.hash_bits = r + 7, o.hash_size = 1 << o.hash_bits, o.hash_mask = o.hash_size - 1, o.hash_shift = ~~((o.hash_bits + 3 - 1) / 3), o.window = new Uint8Array(2 * o.w_size), o.head = new Uint16Array(o.hash_size), o.prev = new Uint16Array(o.w_size), o.lit_bufsize = 1 << r + 6, o.pending_buf_size = 4 * o.lit_bufsize, o.pending_buf = new Uint8Array(o.pending_buf_size), o.sym_buf = o.lit_bufsize, o.sym_end = 3 * (o.lit_bufsize - 1), o.level = t, o.strategy = a, o.method = n, Dl(e)
|
|
};
|
|
var Ul = {
|
|
deflateInit: (e, t) => Ll(e, t, ol, 15, 8, al),
|
|
deflateInit2: Ll,
|
|
deflateReset: Dl,
|
|
deflateResetKeep: Bl,
|
|
deflateSetHeader: (e, t) => Pl(e) || 2 !== e.state.wrap ? Zo : (e.state.gzhead = t, Yo),
|
|
deflate: (e, t) => {
|
|
if (Pl(e) || t > qo || t < 0) return e ? fl(e, Zo) : Zo;
|
|
const n = e.state;
|
|
if (!e.output || 0 !== e.avail_in && !e.input || n.status === dl && t !== jo) return fl(e, 0 === e.avail_out ? $o : Zo);
|
|
const i = n.last_flush;
|
|
if (n.last_flush = t, 0 !== n.pending) {
|
|
if (_l(e), 0 === e.avail_out) return n.last_flush = -1, Yo
|
|
} else if (0 === e.avail_in && pl(t) <= pl(i) && t !== jo) return fl(e, $o);
|
|
if (n.status === dl && 0 !== e.avail_in) return fl(e, $o);
|
|
if (n.status === hl && 0 === n.wrap && (n.status = ul), n.status === hl) {
|
|
let t = ol + (n.w_bits - 8 << 4) << 8,
|
|
i = -1;
|
|
if (i = n.strategy >= nl || n.level < 2 ? 0 : n.level < 6 ? 1 : 6 === n.level ? 2 : 3, t |= i << 6, 0 !== n.strstart && (t |= 32), t += 31 - t % 31, yl(n, t), 0 !== n.strstart && (yl(n, e.adler >>> 16), yl(n, 65535 & e.adler)), e.adler = 1, n.status = ul, _l(e), 0 !== n.pending) return n.last_flush = -1, Yo
|
|
}
|
|
if (57 === n.status)
|
|
if (e.adler = 0, wl(n, 31), wl(n, 139), wl(n, 8), n.gzhead) wl(n, (n.gzhead.text ? 1 : 0) + (n.gzhead.hcrc ? 2 : 0) + (n.gzhead.extra ? 4 : 0) + (n.gzhead.name ? 8 : 0) + (n.gzhead.comment ? 16 : 0)), wl(n, 255 & n.gzhead.time), wl(n, n.gzhead.time >> 8 & 255), wl(n, n.gzhead.time >> 16 & 255), wl(n, n.gzhead.time >> 24 & 255), wl(n, 9 === n.level ? 2 : n.strategy >= nl || n.level < 2 ? 4 : 0), wl(n, 255 & n.gzhead.os), n.gzhead.extra && n.gzhead.extra.length && (wl(n, 255 & n.gzhead.extra.length), wl(n, n.gzhead.extra.length >> 8 & 255)), n.gzhead.hcrc && (e.adler = ko(e.adler, n.pending_buf, n.pending, 0)), n.gzindex = 0, n.status = 69;
|
|
else if (wl(n, 0), wl(n, 0), wl(n, 0), wl(n, 0), wl(n, 0), wl(n, 9 === n.level ? 2 : n.strategy >= nl || n.level < 2 ? 4 : 0), wl(n, 3), n.status = ul, _l(e), 0 !== n.pending) return n.last_flush = -1, Yo;
|
|
if (69 === n.status) {
|
|
if (n.gzhead.extra) {
|
|
let t = n.pending,
|
|
i = (65535 & n.gzhead.extra.length) - n.gzindex;
|
|
for (; n.pending + i > n.pending_buf_size;) {
|
|
let r = n.pending_buf_size - n.pending;
|
|
if (n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex, n.gzindex + r), n.pending), n.pending = n.pending_buf_size, n.gzhead.hcrc && n.pending > t && (e.adler = ko(e.adler, n.pending_buf, n.pending - t, t)), n.gzindex += r, _l(e), 0 !== n.pending) return n.last_flush = -1, Yo;
|
|
t = 0, i -= r
|
|
}
|
|
let r = new Uint8Array(n.gzhead.extra);
|
|
n.pending_buf.set(r.subarray(n.gzindex, n.gzindex + i), n.pending), n.pending += i, n.gzhead.hcrc && n.pending > t && (e.adler = ko(e.adler, n.pending_buf, n.pending - t, t)), n.gzindex = 0
|
|
}
|
|
n.status = 73
|
|
}
|
|
if (73 === n.status) {
|
|
if (n.gzhead.name) {
|
|
let t, i = n.pending;
|
|
do {
|
|
if (n.pending === n.pending_buf_size) {
|
|
if (n.gzhead.hcrc && n.pending > i && (e.adler = ko(e.adler, n.pending_buf, n.pending - i, i)), _l(e), 0 !== n.pending) return n.last_flush = -1, Yo;
|
|
i = 0
|
|
}
|
|
t = n.gzindex < n.gzhead.name.length ? 255 & n.gzhead.name.charCodeAt(n.gzindex++) : 0, wl(n, t)
|
|
} while (0 !== t);
|
|
n.gzhead.hcrc && n.pending > i && (e.adler = ko(e.adler, n.pending_buf, n.pending - i, i)), n.gzindex = 0
|
|
}
|
|
n.status = 91
|
|
}
|
|
if (91 === n.status) {
|
|
if (n.gzhead.comment) {
|
|
let t, i = n.pending;
|
|
do {
|
|
if (n.pending === n.pending_buf_size) {
|
|
if (n.gzhead.hcrc && n.pending > i && (e.adler = ko(e.adler, n.pending_buf, n.pending - i, i)), _l(e), 0 !== n.pending) return n.last_flush = -1, Yo;
|
|
i = 0
|
|
}
|
|
t = n.gzindex < n.gzhead.comment.length ? 255 & n.gzhead.comment.charCodeAt(n.gzindex++) : 0, wl(n, t)
|
|
} while (0 !== t);
|
|
n.gzhead.hcrc && n.pending > i && (e.adler = ko(e.adler, n.pending_buf, n.pending - i, i))
|
|
}
|
|
n.status = 103
|
|
}
|
|
if (103 === n.status) {
|
|
if (n.gzhead.hcrc) {
|
|
if (n.pending + 2 > n.pending_buf_size && (_l(e), 0 !== n.pending)) return n.last_flush = -1, Yo;
|
|
wl(n, 255 & e.adler), wl(n, e.adler >> 8 & 255), e.adler = 0
|
|
}
|
|
if (n.status = ul, _l(e), 0 !== n.pending) return n.last_flush = -1, Yo
|
|
}
|
|
if (0 !== e.avail_in || 0 !== n.lookahead || t !== Go && n.status !== dl) {
|
|
let i = 0 === n.level ? Sl(n, t) : n.strategy === nl ? ((e, t) => {
|
|
let n;
|
|
for (;;) {
|
|
if (0 === e.lookahead && (El(e), 0 === e.lookahead)) {
|
|
if (t === Go) return 1;
|
|
break
|
|
}
|
|
if (e.match_length = 0, n = Ho(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++, n && (vl(e, !1), 0 === e.strm.avail_out)) return 1
|
|
}
|
|
return e.insert = 0, t === jo ? (vl(e, !0), 0 === e.strm.avail_out ? 3 : 4) : e.sym_next && (vl(e, !1), 0 === e.strm.avail_out) ? 1 : 2
|
|
})(n, t) : n.strategy === il ? ((e, t) => {
|
|
let n, i, r, a;
|
|
const s = e.window;
|
|
for (;;) {
|
|
if (e.lookahead <= ll) {
|
|
if (El(e), e.lookahead <= ll && t === Go) return 1;
|
|
if (0 === e.lookahead) break
|
|
}
|
|
if (e.match_length = 0, e.lookahead >= 3 && e.strstart > 0 && (r = e.strstart - 1, i = s[r], i === s[++r] && i === s[++r] && i === s[++r])) {
|
|
a = e.strstart + ll;
|
|
do {} while (i === s[++r] && i === s[++r] && i === s[++r] && i === s[++r] && i === s[++r] && i === s[++r] && i === s[++r] && i === s[++r] && r < a);
|
|
e.match_length = ll - (a - r), e.match_length > e.lookahead && (e.match_length = e.lookahead)
|
|
}
|
|
if (e.match_length >= 3 ? (n = Ho(e, 1, e.match_length - 3), e.lookahead -= e.match_length, e.strstart += e.match_length, e.match_length = 0) : (n = Ho(e, 0, e.window[e.strstart]), e.lookahead--, e.strstart++), n && (vl(e, !1), 0 === e.strm.avail_out)) return 1
|
|
}
|
|
return e.insert = 0, t === jo ? (vl(e, !0), 0 === e.strm.avail_out ? 3 : 4) : e.sym_next && (vl(e, !1), 0 === e.strm.avail_out) ? 1 : 2
|
|
})(n, t) : Il[n.level].func(n, t);
|
|
if (3 !== i && 4 !== i || (n.status = dl), 1 === i || 3 === i) return 0 === e.avail_out && (n.last_flush = -1), Yo;
|
|
if (2 === i && (t === Qo ? Vo(n) : t !== qo && (zo(n, 0, 0, !1), t === Xo && (ml(n.head), 0 === n.lookahead && (n.strstart = 0, n.block_start = 0, n.insert = 0))), _l(e), 0 === e.avail_out)) return n.last_flush = -1, Yo
|
|
}
|
|
return t !== jo ? Yo : n.wrap <= 0 ? Ko : (2 === n.wrap ? (wl(n, 255 & e.adler), wl(n, e.adler >> 8 & 255), wl(n, e.adler >> 16 & 255), wl(n, e.adler >> 24 & 255), wl(n, 255 & e.total_in), wl(n, e.total_in >> 8 & 255), wl(n, e.total_in >> 16 & 255), wl(n, e.total_in >> 24 & 255)) : (yl(n, e.adler >>> 16), yl(n, 65535 & e.adler)), _l(e), n.wrap > 0 && (n.wrap = -n.wrap), 0 !== n.pending ? Yo : Ko)
|
|
},
|
|
deflateEnd: e => {
|
|
if (Pl(e)) return Zo;
|
|
const t = e.state.status;
|
|
return e.state = null, t === ul ? fl(e, Jo) : Yo
|
|
},
|
|
deflateSetDictionary: (e, t) => {
|
|
let n = t.length;
|
|
if (Pl(e)) return Zo;
|
|
const i = e.state,
|
|
r = i.wrap;
|
|
if (2 === r || 1 === r && i.status !== hl || i.lookahead) return Zo;
|
|
if (1 === r && (e.adler = Lo(e.adler, t, n, 0)), i.wrap = 0, n >= i.w_size) {
|
|
0 === r && (ml(i.head), i.strstart = 0, i.block_start = 0, i.insert = 0);
|
|
let e = new Uint8Array(i.w_size);
|
|
e.set(t.subarray(n - i.w_size, n), 0), t = e, n = i.w_size
|
|
}
|
|
const a = e.avail_in,
|
|
s = e.next_in,
|
|
o = e.input;
|
|
for (e.avail_in = n, e.next_in = 0, e.input = t, El(i); i.lookahead >= 3;) {
|
|
let e = i.strstart,
|
|
t = i.lookahead - 2;
|
|
do {
|
|
i.ins_h = Al(i, i.ins_h, i.window[e + 3 - 1]), i.prev[e & i.w_mask] = i.head[i.ins_h], i.head[i.ins_h] = e, e++
|
|
} while (--t);
|
|
i.strstart = e, i.lookahead = 2, El(i)
|
|
}
|
|
return i.strstart += i.lookahead, i.block_start = i.strstart, i.insert = i.lookahead, i.lookahead = 0, i.match_length = i.prev_length = 2, i.match_available = 0, e.next_in = s, e.input = o, e.avail_in = a, i.wrap = r, Yo
|
|
},
|
|
deflateInfo: "pako deflate (from Nodeca project)"
|
|
};
|
|
const kl = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
|
|
var Nl = function(e) {
|
|
const t = Array.prototype.slice.call(arguments, 1);
|
|
for (; t.length;) {
|
|
const n = t.shift();
|
|
if (n) {
|
|
if ("object" != typeof n) throw new TypeError(n + "must be non-object");
|
|
for (const t in n) kl(n, t) && (e[t] = n[t])
|
|
}
|
|
}
|
|
return e
|
|
},
|
|
Fl = e => {
|
|
let t = 0;
|
|
for (let n = 0, i = e.length; n < i; n++) t += e[n].length;
|
|
const n = new Uint8Array(t);
|
|
for (let t = 0, i = 0, r = e.length; t < r; t++) {
|
|
let r = e[t];
|
|
n.set(r, i), i += r.length
|
|
}
|
|
return n
|
|
};
|
|
let Ol = !0;
|
|
try {
|
|
String.fromCharCode.apply(null, new Uint8Array(1))
|
|
} catch (e) {
|
|
Ol = !1
|
|
}
|
|
const zl = new Uint8Array(256);
|
|
for (let e = 0; e < 256; e++) zl[e] = e >= 252 ? 6 : e >= 248 ? 5 : e >= 240 ? 4 : e >= 224 ? 3 : e >= 192 ? 2 : 1;
|
|
zl[254] = zl[254] = 1;
|
|
var Wl = e => {
|
|
if ("function" == typeof TextEncoder && TextEncoder.prototype.encode) return (new TextEncoder).encode(e);
|
|
let t, n, i, r, a, s = e.length,
|
|
o = 0;
|
|
for (r = 0; r < s; r++) n = e.charCodeAt(r), 55296 == (64512 & n) && r + 1 < s && (i = e.charCodeAt(r + 1), 56320 == (64512 & i) && (n = 65536 + (n - 55296 << 10) + (i - 56320), r++)), o += n < 128 ? 1 : n < 2048 ? 2 : n < 65536 ? 3 : 4;
|
|
for (t = new Uint8Array(o), a = 0, r = 0; a < o; r++) n = e.charCodeAt(r), 55296 == (64512 & n) && r + 1 < s && (i = e.charCodeAt(r + 1), 56320 == (64512 & i) && (n = 65536 + (n - 55296 << 10) + (i - 56320), r++)), n < 128 ? t[a++] = n : n < 2048 ? (t[a++] = 192 | n >>> 6, t[a++] = 128 | 63 & n) : n < 65536 ? (t[a++] = 224 | n >>> 12, t[a++] = 128 | n >>> 6 & 63, t[a++] = 128 | 63 & n) : (t[a++] = 240 | n >>> 18, t[a++] = 128 | n >>> 12 & 63, t[a++] = 128 | n >>> 6 & 63, t[a++] = 128 | 63 & n);
|
|
return t
|
|
},
|
|
Hl = (e, t) => {
|
|
const n = t || e.length;
|
|
if ("function" == typeof TextDecoder && TextDecoder.prototype.decode) return (new TextDecoder).decode(e.subarray(0, t));
|
|
let i, r;
|
|
const a = new Array(2 * n);
|
|
for (r = 0, i = 0; i < n;) {
|
|
let t = e[i++];
|
|
if (t < 128) {
|
|
a[r++] = t;
|
|
continue
|
|
}
|
|
let s = zl[t];
|
|
if (s > 4) a[r++] = 65533, i += s - 1;
|
|
else {
|
|
for (t &= 2 === s ? 31 : 3 === s ? 15 : 7; s > 1 && i < n;) t = t << 6 | 63 & e[i++], s--;
|
|
s > 1 ? a[r++] = 65533 : t < 65536 ? a[r++] = t : (t -= 65536, a[r++] = 55296 | t >> 10 & 1023, a[r++] = 56320 | 1023 & t)
|
|
}
|
|
}
|
|
return ((e, t) => {
|
|
if (t < 65534 && e.subarray && Ol) return String.fromCharCode.apply(null, e.length === t ? e : e.subarray(0, t));
|
|
let n = "";
|
|
for (let i = 0; i < t; i++) n += String.fromCharCode(e[i]);
|
|
return n
|
|
})(a, r)
|
|
},
|
|
Vl = (e, t) => {
|
|
(t = t || e.length) > e.length && (t = e.length);
|
|
let n = t - 1;
|
|
for (; n >= 0 && 128 == (192 & e[n]);) n--;
|
|
return n < 0 || 0 === n ? t : n + zl[e[n]] > t ? n : t
|
|
};
|
|
var Gl = function() {
|
|
this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0
|
|
};
|
|
const Ql = Object.prototype.toString,
|
|
{
|
|
Z_NO_FLUSH: Xl,
|
|
Z_SYNC_FLUSH: jl,
|
|
Z_FULL_FLUSH: ql,
|
|
Z_FINISH: Yl,
|
|
Z_OK: Kl,
|
|
Z_STREAM_END: Zl,
|
|
Z_DEFAULT_COMPRESSION: Jl,
|
|
Z_DEFAULT_STRATEGY: $l,
|
|
Z_DEFLATED: ec
|
|
} = Fo;
|
|
|
|
function tc(e) {
|
|
this.options = Nl({
|
|
level: Jl,
|
|
method: ec,
|
|
chunkSize: 16384,
|
|
windowBits: 15,
|
|
memLevel: 8,
|
|
strategy: $l
|
|
}, e || {});
|
|
let t = this.options;
|
|
t.raw && t.windowBits > 0 ? t.windowBits = -t.windowBits : t.gzip && t.windowBits > 0 && t.windowBits < 16 && (t.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Gl, this.strm.avail_out = 0;
|
|
let n = Ul.deflateInit2(this.strm, t.level, t.method, t.windowBits, t.memLevel, t.strategy);
|
|
if (n !== Kl) throw new Error(No[n]);
|
|
if (t.header && Ul.deflateSetHeader(this.strm, t.header), t.dictionary) {
|
|
let e;
|
|
if (e = "string" == typeof t.dictionary ? Wl(t.dictionary) : "[object ArrayBuffer]" === Ql.call(t.dictionary) ? new Uint8Array(t.dictionary) : t.dictionary, n = Ul.deflateSetDictionary(this.strm, e), n !== Kl) throw new Error(No[n]);
|
|
this._dict_set = !0
|
|
}
|
|
}
|
|
|
|
function nc(e, t) {
|
|
const n = new tc(t);
|
|
if (n.push(e, !0), n.err) throw n.msg || No[n.err];
|
|
return n.result
|
|
}
|
|
tc.prototype.push = function(e, t) {
|
|
const n = this.strm,
|
|
i = this.options.chunkSize;
|
|
let r, a;
|
|
if (this.ended) return !1;
|
|
for (a = t === ~~t ? t : !0 === t ? Yl : Xl, "string" == typeof e ? n.input = Wl(e) : "[object ArrayBuffer]" === Ql.call(e) ? n.input = new Uint8Array(e) : n.input = e, n.next_in = 0, n.avail_in = n.input.length;;)
|
|
if (0 === n.avail_out && (n.output = new Uint8Array(i), n.next_out = 0, n.avail_out = i), (a === jl || a === ql) && n.avail_out <= 6) this.onData(n.output.subarray(0, n.next_out)), n.avail_out = 0;
|
|
else {
|
|
if (r = Ul.deflate(n, a), r === Zl) return n.next_out > 0 && this.onData(n.output.subarray(0, n.next_out)), r = Ul.deflateEnd(this.strm), this.onEnd(r), this.ended = !0, r === Kl;
|
|
if (0 !== n.avail_out) {
|
|
if (a > 0 && n.next_out > 0) this.onData(n.output.subarray(0, n.next_out)), n.avail_out = 0;
|
|
else if (0 === n.avail_in) break
|
|
} else this.onData(n.output)
|
|
} return !0
|
|
}, tc.prototype.onData = function(e) {
|
|
this.chunks.push(e)
|
|
}, tc.prototype.onEnd = function(e) {
|
|
e === Kl && (this.result = Fl(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg
|
|
};
|
|
var ic = {
|
|
Deflate: tc,
|
|
deflate: nc,
|
|
deflateRaw: function(e, t) {
|
|
return (t = t || {}).raw = !0, nc(e, t)
|
|
},
|
|
gzip: function(e, t) {
|
|
return (t = t || {}).gzip = !0, nc(e, t)
|
|
},
|
|
constants: Fo
|
|
};
|
|
const rc = 16209;
|
|
var ac = function(e, t) {
|
|
let n, i, r, a, s, o, l, c, h, u, d, f, p, m, g, A, _, v, w, y, x, b, E, S;
|
|
const M = e.state;
|
|
n = e.next_in, E = e.input, i = n + (e.avail_in - 5), r = e.next_out, S = e.output, a = r - (t - e.avail_out), s = r + (e.avail_out - 257), o = M.dmax, l = M.wsize, c = M.whave, h = M.wnext, u = M.window, d = M.hold, f = M.bits, p = M.lencode, m = M.distcode, g = (1 << M.lenbits) - 1, A = (1 << M.distbits) - 1;
|
|
e: do {
|
|
f < 15 && (d += E[n++] << f, f += 8, d += E[n++] << f, f += 8), _ = p[d & g];
|
|
t: for (;;) {
|
|
if (v = _ >>> 24, d >>>= v, f -= v, v = _ >>> 16 & 255, 0 === v) S[r++] = 65535 & _;
|
|
else {
|
|
if (!(16 & v)) {
|
|
if (64 & v) {
|
|
if (32 & v) {
|
|
M.mode = 16191;
|
|
break e
|
|
}
|
|
e.msg = "invalid literal/length code", M.mode = rc;
|
|
break e
|
|
}
|
|
_ = p[(65535 & _) + (d & (1 << v) - 1)];
|
|
continue t
|
|
}
|
|
for (w = 65535 & _, v &= 15, v && (f < v && (d += E[n++] << f, f += 8), w += d & (1 << v) - 1, d >>>= v, f -= v), f < 15 && (d += E[n++] << f, f += 8, d += E[n++] << f, f += 8), _ = m[d & A];;) {
|
|
if (v = _ >>> 24, d >>>= v, f -= v, v = _ >>> 16 & 255, 16 & v) {
|
|
if (y = 65535 & _, v &= 15, f < v && (d += E[n++] << f, f += 8, f < v && (d += E[n++] << f, f += 8)), y += d & (1 << v) - 1, y > o) {
|
|
e.msg = "invalid distance too far back", M.mode = rc;
|
|
break e
|
|
}
|
|
if (d >>>= v, f -= v, v = r - a, y > v) {
|
|
if (v = y - v, v > c && M.sane) {
|
|
e.msg = "invalid distance too far back", M.mode = rc;
|
|
break e
|
|
}
|
|
if (x = 0, b = u, 0 === h) {
|
|
if (x += l - v, v < w) {
|
|
w -= v;
|
|
do {
|
|
S[r++] = u[x++]
|
|
} while (--v);
|
|
x = r - y, b = S
|
|
}
|
|
} else if (h < v) {
|
|
if (x += l + h - v, v -= h, v < w) {
|
|
w -= v;
|
|
do {
|
|
S[r++] = u[x++]
|
|
} while (--v);
|
|
if (x = 0, h < w) {
|
|
v = h, w -= v;
|
|
do {
|
|
S[r++] = u[x++]
|
|
} while (--v);
|
|
x = r - y, b = S
|
|
}
|
|
}
|
|
} else if (x += h - v, v < w) {
|
|
w -= v;
|
|
do {
|
|
S[r++] = u[x++]
|
|
} while (--v);
|
|
x = r - y, b = S
|
|
}
|
|
for (; w > 2;) S[r++] = b[x++], S[r++] = b[x++], S[r++] = b[x++], w -= 3;
|
|
w && (S[r++] = b[x++], w > 1 && (S[r++] = b[x++]))
|
|
} else {
|
|
x = r - y;
|
|
do {
|
|
S[r++] = S[x++], S[r++] = S[x++], S[r++] = S[x++], w -= 3
|
|
} while (w > 2);
|
|
w && (S[r++] = S[x++], w > 1 && (S[r++] = S[x++]))
|
|
}
|
|
break
|
|
}
|
|
if (64 & v) {
|
|
e.msg = "invalid distance code", M.mode = rc;
|
|
break e
|
|
}
|
|
_ = m[(65535 & _) + (d & (1 << v) - 1)]
|
|
}
|
|
}
|
|
break
|
|
}
|
|
} while (n < i && r < s);
|
|
w = f >> 3, n -= w, f -= w << 3, d &= (1 << f) - 1, e.next_in = n, e.next_out = r, e.avail_in = n < i ? i - n + 5 : 5 - (n - i), e.avail_out = r < s ? s - r + 257 : 257 - (r - s), M.hold = d, M.bits = f
|
|
};
|
|
const sc = 15,
|
|
oc = new Uint16Array([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0]),
|
|
lc = new Uint8Array([16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78]),
|
|
cc = new Uint16Array([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0]),
|
|
hc = new Uint8Array([16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]);
|
|
var uc = (e, t, n, i, r, a, s, o) => {
|
|
const l = o.bits;
|
|
let c, h, u, d, f, p, m = 0,
|
|
g = 0,
|
|
A = 0,
|
|
_ = 0,
|
|
v = 0,
|
|
w = 0,
|
|
y = 0,
|
|
x = 0,
|
|
b = 0,
|
|
E = 0,
|
|
S = null;
|
|
const M = new Uint16Array(16),
|
|
T = new Uint16Array(16);
|
|
let C, I, R, P = null;
|
|
for (m = 0; m <= sc; m++) M[m] = 0;
|
|
for (g = 0; g < i; g++) M[t[n + g]]++;
|
|
for (v = l, _ = sc; _ >= 1 && 0 === M[_]; _--);
|
|
if (v > _ && (v = _), 0 === _) return r[a++] = 20971520, r[a++] = 20971520, o.bits = 1, 0;
|
|
for (A = 1; A < _ && 0 === M[A]; A++);
|
|
for (v < A && (v = A), x = 1, m = 1; m <= sc; m++)
|
|
if (x <<= 1, x -= M[m], x < 0) return -1;
|
|
if (x > 0 && (0 === e || 1 !== _)) return -1;
|
|
for (T[1] = 0, m = 1; m < sc; m++) T[m + 1] = T[m] + M[m];
|
|
for (g = 0; g < i; g++) 0 !== t[n + g] && (s[T[t[n + g]]++] = g);
|
|
if (0 === e ? (S = P = s, p = 20) : 1 === e ? (S = oc, P = lc, p = 257) : (S = cc, P = hc, p = 0), E = 0, g = 0, m = A, f = a, w = v, y = 0, u = -1, b = 1 << v, d = b - 1, 1 === e && b > 852 || 2 === e && b > 592) return 1;
|
|
for (;;) {
|
|
C = m - y, s[g] + 1 < p ? (I = 0, R = s[g]) : s[g] >= p ? (I = P[s[g] - p], R = S[s[g] - p]) : (I = 96, R = 0), c = 1 << m - y, h = 1 << w, A = h;
|
|
do {
|
|
h -= c, r[f + (E >> y) + h] = C << 24 | I << 16 | R
|
|
} while (0 !== h);
|
|
for (c = 1 << m - 1; E & c;) c >>= 1;
|
|
if (0 !== c ? (E &= c - 1, E += c) : E = 0, g++, 0 == --M[m]) {
|
|
if (m === _) break;
|
|
m = t[n + s[g]]
|
|
}
|
|
if (m > v && (E & d) !== u) {
|
|
for (0 === y && (y = v), f += A, w = m - y, x = 1 << w; w + y < _ && (x -= M[w + y], !(x <= 0));) w++, x <<= 1;
|
|
if (b += 1 << w, 1 === e && b > 852 || 2 === e && b > 592) return 1;
|
|
u = E & d, r[u] = v << 24 | w << 16 | f - a
|
|
}
|
|
}
|
|
return 0 !== E && (r[f + E] = m - y << 24 | 64 << 16), o.bits = v, 0
|
|
};
|
|
const {
|
|
Z_FINISH: dc,
|
|
Z_BLOCK: fc,
|
|
Z_TREES: pc,
|
|
Z_OK: mc,
|
|
Z_STREAM_END: gc,
|
|
Z_NEED_DICT: Ac,
|
|
Z_STREAM_ERROR: _c,
|
|
Z_DATA_ERROR: vc,
|
|
Z_MEM_ERROR: wc,
|
|
Z_BUF_ERROR: yc,
|
|
Z_DEFLATED: xc
|
|
} = Fo, bc = 16180, Ec = 16190, Sc = 16191, Mc = 16192, Tc = 16194, Cc = 16199, Ic = 16200, Rc = 16206, Pc = 16209, Bc = e => (e >>> 24 & 255) + (e >>> 8 & 65280) + ((65280 & e) << 8) + ((255 & e) << 24);
|
|
|
|
function Dc() {
|
|
this.strm = null, this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new Uint16Array(320), this.work = new Uint16Array(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0
|
|
}
|
|
const Lc = e => {
|
|
if (!e) return 1;
|
|
const t = e.state;
|
|
return !t || t.strm !== e || t.mode < bc || t.mode > 16211 ? 1 : 0
|
|
},
|
|
Uc = e => {
|
|
if (Lc(e)) return _c;
|
|
const t = e.state;
|
|
return e.total_in = e.total_out = t.total = 0, e.msg = "", t.wrap && (e.adler = 1 & t.wrap), t.mode = bc, t.last = 0, t.havedict = 0, t.flags = -1, t.dmax = 32768, t.head = null, t.hold = 0, t.bits = 0, t.lencode = t.lendyn = new Int32Array(852), t.distcode = t.distdyn = new Int32Array(592), t.sane = 1, t.back = -1, mc
|
|
},
|
|
kc = e => {
|
|
if (Lc(e)) return _c;
|
|
const t = e.state;
|
|
return t.wsize = 0, t.whave = 0, t.wnext = 0, Uc(e)
|
|
},
|
|
Nc = (e, t) => {
|
|
let n;
|
|
if (Lc(e)) return _c;
|
|
const i = e.state;
|
|
return t < 0 ? (n = 0, t = -t) : (n = 5 + (t >> 4), t < 48 && (t &= 15)), t && (t < 8 || t > 15) ? _c : (null !== i.window && i.wbits !== t && (i.window = null), i.wrap = n, i.wbits = t, kc(e))
|
|
},
|
|
Fc = (e, t) => {
|
|
if (!e) return _c;
|
|
const n = new Dc;
|
|
e.state = n, n.strm = e, n.window = null, n.mode = bc;
|
|
const i = Nc(e, t);
|
|
return i !== mc && (e.state = null), i
|
|
};
|
|
let Oc, zc, Wc = !0;
|
|
const Hc = e => {
|
|
if (Wc) {
|
|
Oc = new Int32Array(512), zc = new Int32Array(32);
|
|
let t = 0;
|
|
for (; t < 144;) e.lens[t++] = 8;
|
|
for (; t < 256;) e.lens[t++] = 9;
|
|
for (; t < 280;) e.lens[t++] = 7;
|
|
for (; t < 288;) e.lens[t++] = 8;
|
|
for (uc(1, e.lens, 0, 288, Oc, 0, e.work, {
|
|
bits: 9
|
|
}), t = 0; t < 32;) e.lens[t++] = 5;
|
|
uc(2, e.lens, 0, 32, zc, 0, e.work, {
|
|
bits: 5
|
|
}), Wc = !1
|
|
}
|
|
e.lencode = Oc, e.lenbits = 9, e.distcode = zc, e.distbits = 5
|
|
},
|
|
Vc = (e, t, n, i) => {
|
|
let r;
|
|
const a = e.state;
|
|
return null === a.window && (a.wsize = 1 << a.wbits, a.wnext = 0, a.whave = 0, a.window = new Uint8Array(a.wsize)), i >= a.wsize ? (a.window.set(t.subarray(n - a.wsize, n), 0), a.wnext = 0, a.whave = a.wsize) : (r = a.wsize - a.wnext, r > i && (r = i), a.window.set(t.subarray(n - i, n - i + r), a.wnext), (i -= r) ? (a.window.set(t.subarray(n - i, n), 0), a.wnext = i, a.whave = a.wsize) : (a.wnext += r, a.wnext === a.wsize && (a.wnext = 0), a.whave < a.wsize && (a.whave += r))), 0
|
|
};
|
|
var Gc = {
|
|
inflateReset: kc,
|
|
inflateReset2: Nc,
|
|
inflateResetKeep: Uc,
|
|
inflateInit: e => Fc(e, 15),
|
|
inflateInit2: Fc,
|
|
inflate: (e, t) => {
|
|
let n, i, r, a, s, o, l, c, h, u, d, f, p, m, g, A, _, v, w, y, x, b, E = 0;
|
|
const S = new Uint8Array(4);
|
|
let M, T;
|
|
const C = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
if (Lc(e) || !e.output || !e.input && 0 !== e.avail_in) return _c;
|
|
n = e.state, n.mode === Sc && (n.mode = Mc), s = e.next_out, r = e.output, l = e.avail_out, a = e.next_in, i = e.input, o = e.avail_in, c = n.hold, h = n.bits, u = o, d = l, b = mc;
|
|
e: for (;;) switch (n.mode) {
|
|
case bc:
|
|
if (0 === n.wrap) {
|
|
n.mode = Mc;
|
|
break
|
|
}
|
|
for (; h < 16;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (2 & n.wrap && 35615 === c) {
|
|
0 === n.wbits && (n.wbits = 15), n.check = 0, S[0] = 255 & c, S[1] = c >>> 8 & 255, n.check = ko(n.check, S, 2, 0), c = 0, h = 0, n.mode = 16181;
|
|
break
|
|
}
|
|
if (n.head && (n.head.done = !1), !(1 & n.wrap) || (((255 & c) << 8) + (c >> 8)) % 31) {
|
|
e.msg = "incorrect header check", n.mode = Pc;
|
|
break
|
|
}
|
|
if ((15 & c) !== xc) {
|
|
e.msg = "unknown compression method", n.mode = Pc;
|
|
break
|
|
}
|
|
if (c >>>= 4, h -= 4, x = 8 + (15 & c), 0 === n.wbits && (n.wbits = x), x > 15 || x > n.wbits) {
|
|
e.msg = "invalid window size", n.mode = Pc;
|
|
break
|
|
}
|
|
n.dmax = 1 << n.wbits, n.flags = 0, e.adler = n.check = 1, n.mode = 512 & c ? 16189 : Sc, c = 0, h = 0;
|
|
break;
|
|
case 16181:
|
|
for (; h < 16;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (n.flags = c, (255 & n.flags) !== xc) {
|
|
e.msg = "unknown compression method", n.mode = Pc;
|
|
break
|
|
}
|
|
if (57344 & n.flags) {
|
|
e.msg = "unknown header flags set", n.mode = Pc;
|
|
break
|
|
}
|
|
n.head && (n.head.text = c >> 8 & 1), 512 & n.flags && 4 & n.wrap && (S[0] = 255 & c, S[1] = c >>> 8 & 255, n.check = ko(n.check, S, 2, 0)), c = 0, h = 0, n.mode = 16182;
|
|
case 16182:
|
|
for (; h < 32;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
n.head && (n.head.time = c), 512 & n.flags && 4 & n.wrap && (S[0] = 255 & c, S[1] = c >>> 8 & 255, S[2] = c >>> 16 & 255, S[3] = c >>> 24 & 255, n.check = ko(n.check, S, 4, 0)), c = 0, h = 0, n.mode = 16183;
|
|
case 16183:
|
|
for (; h < 16;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
n.head && (n.head.xflags = 255 & c, n.head.os = c >> 8), 512 & n.flags && 4 & n.wrap && (S[0] = 255 & c, S[1] = c >>> 8 & 255, n.check = ko(n.check, S, 2, 0)), c = 0, h = 0, n.mode = 16184;
|
|
case 16184:
|
|
if (1024 & n.flags) {
|
|
for (; h < 16;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
n.length = c, n.head && (n.head.extra_len = c), 512 & n.flags && 4 & n.wrap && (S[0] = 255 & c, S[1] = c >>> 8 & 255, n.check = ko(n.check, S, 2, 0)), c = 0, h = 0
|
|
} else n.head && (n.head.extra = null);
|
|
n.mode = 16185;
|
|
case 16185:
|
|
if (1024 & n.flags && (f = n.length, f > o && (f = o), f && (n.head && (x = n.head.extra_len - n.length, n.head.extra || (n.head.extra = new Uint8Array(n.head.extra_len)), n.head.extra.set(i.subarray(a, a + f), x)), 512 & n.flags && 4 & n.wrap && (n.check = ko(n.check, i, f, a)), o -= f, a += f, n.length -= f), n.length)) break e;
|
|
n.length = 0, n.mode = 16186;
|
|
case 16186:
|
|
if (2048 & n.flags) {
|
|
if (0 === o) break e;
|
|
f = 0;
|
|
do {
|
|
x = i[a + f++], n.head && x && n.length < 65536 && (n.head.name += String.fromCharCode(x))
|
|
} while (x && f < o);
|
|
if (512 & n.flags && 4 & n.wrap && (n.check = ko(n.check, i, f, a)), o -= f, a += f, x) break e
|
|
} else n.head && (n.head.name = null);
|
|
n.length = 0, n.mode = 16187;
|
|
case 16187:
|
|
if (4096 & n.flags) {
|
|
if (0 === o) break e;
|
|
f = 0;
|
|
do {
|
|
x = i[a + f++], n.head && x && n.length < 65536 && (n.head.comment += String.fromCharCode(x))
|
|
} while (x && f < o);
|
|
if (512 & n.flags && 4 & n.wrap && (n.check = ko(n.check, i, f, a)), o -= f, a += f, x) break e
|
|
} else n.head && (n.head.comment = null);
|
|
n.mode = 16188;
|
|
case 16188:
|
|
if (512 & n.flags) {
|
|
for (; h < 16;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (4 & n.wrap && c !== (65535 & n.check)) {
|
|
e.msg = "header crc mismatch", n.mode = Pc;
|
|
break
|
|
}
|
|
c = 0, h = 0
|
|
}
|
|
n.head && (n.head.hcrc = n.flags >> 9 & 1, n.head.done = !0), e.adler = n.check = 0, n.mode = Sc;
|
|
break;
|
|
case 16189:
|
|
for (; h < 32;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
e.adler = n.check = Bc(c), c = 0, h = 0, n.mode = Ec;
|
|
case Ec:
|
|
if (0 === n.havedict) return e.next_out = s, e.avail_out = l, e.next_in = a, e.avail_in = o, n.hold = c, n.bits = h, Ac;
|
|
e.adler = n.check = 1, n.mode = Sc;
|
|
case Sc:
|
|
if (t === fc || t === pc) break e;
|
|
case Mc:
|
|
if (n.last) {
|
|
c >>>= 7 & h, h -= 7 & h, n.mode = Rc;
|
|
break
|
|
}
|
|
for (; h < 3;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
switch (n.last = 1 & c, c >>>= 1, h -= 1, 3 & c) {
|
|
case 0:
|
|
n.mode = 16193;
|
|
break;
|
|
case 1:
|
|
if (Hc(n), n.mode = Cc, t === pc) {
|
|
c >>>= 2, h -= 2;
|
|
break e
|
|
}
|
|
break;
|
|
case 2:
|
|
n.mode = 16196;
|
|
break;
|
|
case 3:
|
|
e.msg = "invalid block type", n.mode = Pc
|
|
}
|
|
c >>>= 2, h -= 2;
|
|
break;
|
|
case 16193:
|
|
for (c >>>= 7 & h, h -= 7 & h; h < 32;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if ((65535 & c) != (c >>> 16 ^ 65535)) {
|
|
e.msg = "invalid stored block lengths", n.mode = Pc;
|
|
break
|
|
}
|
|
if (n.length = 65535 & c, c = 0, h = 0, n.mode = Tc, t === pc) break e;
|
|
case Tc:
|
|
n.mode = 16195;
|
|
case 16195:
|
|
if (f = n.length, f) {
|
|
if (f > o && (f = o), f > l && (f = l), 0 === f) break e;
|
|
r.set(i.subarray(a, a + f), s), o -= f, a += f, l -= f, s += f, n.length -= f;
|
|
break
|
|
}
|
|
n.mode = Sc;
|
|
break;
|
|
case 16196:
|
|
for (; h < 14;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (n.nlen = 257 + (31 & c), c >>>= 5, h -= 5, n.ndist = 1 + (31 & c), c >>>= 5, h -= 5, n.ncode = 4 + (15 & c), c >>>= 4, h -= 4, n.nlen > 286 || n.ndist > 30) {
|
|
e.msg = "too many length or distance symbols", n.mode = Pc;
|
|
break
|
|
}
|
|
n.have = 0, n.mode = 16197;
|
|
case 16197:
|
|
for (; n.have < n.ncode;) {
|
|
for (; h < 3;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
n.lens[C[n.have++]] = 7 & c, c >>>= 3, h -= 3
|
|
}
|
|
for (; n.have < 19;) n.lens[C[n.have++]] = 0;
|
|
if (n.lencode = n.lendyn, n.lenbits = 7, M = {
|
|
bits: n.lenbits
|
|
}, b = uc(0, n.lens, 0, 19, n.lencode, 0, n.work, M), n.lenbits = M.bits, b) {
|
|
e.msg = "invalid code lengths set", n.mode = Pc;
|
|
break
|
|
}
|
|
n.have = 0, n.mode = 16198;
|
|
case 16198:
|
|
for (; n.have < n.nlen + n.ndist;) {
|
|
for (; E = n.lencode[c & (1 << n.lenbits) - 1], g = E >>> 24, A = E >>> 16 & 255, _ = 65535 & E, !(g <= h);) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (_ < 16) c >>>= g, h -= g, n.lens[n.have++] = _;
|
|
else {
|
|
if (16 === _) {
|
|
for (T = g + 2; h < T;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (c >>>= g, h -= g, 0 === n.have) {
|
|
e.msg = "invalid bit length repeat", n.mode = Pc;
|
|
break
|
|
}
|
|
x = n.lens[n.have - 1], f = 3 + (3 & c), c >>>= 2, h -= 2
|
|
} else if (17 === _) {
|
|
for (T = g + 3; h < T;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
c >>>= g, h -= g, x = 0, f = 3 + (7 & c), c >>>= 3, h -= 3
|
|
} else {
|
|
for (T = g + 7; h < T;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
c >>>= g, h -= g, x = 0, f = 11 + (127 & c), c >>>= 7, h -= 7
|
|
}
|
|
if (n.have + f > n.nlen + n.ndist) {
|
|
e.msg = "invalid bit length repeat", n.mode = Pc;
|
|
break
|
|
}
|
|
for (; f--;) n.lens[n.have++] = x
|
|
}
|
|
}
|
|
if (n.mode === Pc) break;
|
|
if (0 === n.lens[256]) {
|
|
e.msg = "invalid code -- missing end-of-block", n.mode = Pc;
|
|
break
|
|
}
|
|
if (n.lenbits = 9, M = {
|
|
bits: n.lenbits
|
|
}, b = uc(1, n.lens, 0, n.nlen, n.lencode, 0, n.work, M), n.lenbits = M.bits, b) {
|
|
e.msg = "invalid literal/lengths set", n.mode = Pc;
|
|
break
|
|
}
|
|
if (n.distbits = 6, n.distcode = n.distdyn, M = {
|
|
bits: n.distbits
|
|
}, b = uc(2, n.lens, n.nlen, n.ndist, n.distcode, 0, n.work, M), n.distbits = M.bits, b) {
|
|
e.msg = "invalid distances set", n.mode = Pc;
|
|
break
|
|
}
|
|
if (n.mode = Cc, t === pc) break e;
|
|
case Cc:
|
|
n.mode = Ic;
|
|
case Ic:
|
|
if (o >= 6 && l >= 258) {
|
|
e.next_out = s, e.avail_out = l, e.next_in = a, e.avail_in = o, n.hold = c, n.bits = h, ac(e, d), s = e.next_out, r = e.output, l = e.avail_out, a = e.next_in, i = e.input, o = e.avail_in, c = n.hold, h = n.bits, n.mode === Sc && (n.back = -1);
|
|
break
|
|
}
|
|
for (n.back = 0; E = n.lencode[c & (1 << n.lenbits) - 1], g = E >>> 24, A = E >>> 16 & 255, _ = 65535 & E, !(g <= h);) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (A && !(240 & A)) {
|
|
for (v = g, w = A, y = _; E = n.lencode[y + ((c & (1 << v + w) - 1) >> v)], g = E >>> 24, A = E >>> 16 & 255, _ = 65535 & E, !(v + g <= h);) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
c >>>= v, h -= v, n.back += v
|
|
}
|
|
if (c >>>= g, h -= g, n.back += g, n.length = _, 0 === A) {
|
|
n.mode = 16205;
|
|
break
|
|
}
|
|
if (32 & A) {
|
|
n.back = -1, n.mode = Sc;
|
|
break
|
|
}
|
|
if (64 & A) {
|
|
e.msg = "invalid literal/length code", n.mode = Pc;
|
|
break
|
|
}
|
|
n.extra = 15 & A, n.mode = 16201;
|
|
case 16201:
|
|
if (n.extra) {
|
|
for (T = n.extra; h < T;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
n.length += c & (1 << n.extra) - 1, c >>>= n.extra, h -= n.extra, n.back += n.extra
|
|
}
|
|
n.was = n.length, n.mode = 16202;
|
|
case 16202:
|
|
for (; E = n.distcode[c & (1 << n.distbits) - 1], g = E >>> 24, A = E >>> 16 & 255, _ = 65535 & E, !(g <= h);) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (!(240 & A)) {
|
|
for (v = g, w = A, y = _; E = n.distcode[y + ((c & (1 << v + w) - 1) >> v)], g = E >>> 24, A = E >>> 16 & 255, _ = 65535 & E, !(v + g <= h);) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
c >>>= v, h -= v, n.back += v
|
|
}
|
|
if (c >>>= g, h -= g, n.back += g, 64 & A) {
|
|
e.msg = "invalid distance code", n.mode = Pc;
|
|
break
|
|
}
|
|
n.offset = _, n.extra = 15 & A, n.mode = 16203;
|
|
case 16203:
|
|
if (n.extra) {
|
|
for (T = n.extra; h < T;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
n.offset += c & (1 << n.extra) - 1, c >>>= n.extra, h -= n.extra, n.back += n.extra
|
|
}
|
|
if (n.offset > n.dmax) {
|
|
e.msg = "invalid distance too far back", n.mode = Pc;
|
|
break
|
|
}
|
|
n.mode = 16204;
|
|
case 16204:
|
|
if (0 === l) break e;
|
|
if (f = d - l, n.offset > f) {
|
|
if (f = n.offset - f, f > n.whave && n.sane) {
|
|
e.msg = "invalid distance too far back", n.mode = Pc;
|
|
break
|
|
}
|
|
f > n.wnext ? (f -= n.wnext, p = n.wsize - f) : p = n.wnext - f, f > n.length && (f = n.length), m = n.window
|
|
} else m = r, p = s - n.offset, f = n.length;
|
|
f > l && (f = l), l -= f, n.length -= f;
|
|
do {
|
|
r[s++] = m[p++]
|
|
} while (--f);
|
|
0 === n.length && (n.mode = Ic);
|
|
break;
|
|
case 16205:
|
|
if (0 === l) break e;
|
|
r[s++] = n.length, l--, n.mode = Ic;
|
|
break;
|
|
case Rc:
|
|
if (n.wrap) {
|
|
for (; h < 32;) {
|
|
if (0 === o) break e;
|
|
o--, c |= i[a++] << h, h += 8
|
|
}
|
|
if (d -= l, e.total_out += d, n.total += d, 4 & n.wrap && d && (e.adler = n.check = n.flags ? ko(n.check, r, d, s - d) : Lo(n.check, r, d, s - d)), d = l, 4 & n.wrap && (n.flags ? c : Bc(c)) !== n.check) {
|
|
e.msg = "incorrect data check", n.mode = Pc;
|
|
break
|
|
}
|
|
c = 0, h = 0
|
|
}
|
|
n.mode = 16207;
|
|
case 16207:
|
|
if (n.wrap && n.flags) {
|
|
for (; h < 32;) {
|
|
if (0 === o) break e;
|
|
o--, c += i[a++] << h, h += 8
|
|
}
|
|
if (4 & n.wrap && c !== (4294967295 & n.total)) {
|
|
e.msg = "incorrect length check", n.mode = Pc;
|
|
break
|
|
}
|
|
c = 0, h = 0
|
|
}
|
|
n.mode = 16208;
|
|
case 16208:
|
|
b = gc;
|
|
break e;
|
|
case Pc:
|
|
b = vc;
|
|
break e;
|
|
case 16210:
|
|
return wc;
|
|
default:
|
|
return _c
|
|
}
|
|
return e.next_out = s, e.avail_out = l, e.next_in = a, e.avail_in = o, n.hold = c, n.bits = h, (n.wsize || d !== e.avail_out && n.mode < Pc && (n.mode < Rc || t !== dc)) && Vc(e, e.output, e.next_out, d - e.avail_out), u -= e.avail_in, d -= e.avail_out, e.total_in += u, e.total_out += d, n.total += d, 4 & n.wrap && d && (e.adler = n.check = n.flags ? ko(n.check, r, d, e.next_out - d) : Lo(n.check, r, d, e.next_out - d)), e.data_type = n.bits + (n.last ? 64 : 0) + (n.mode === Sc ? 128 : 0) + (n.mode === Cc || n.mode === Tc ? 256 : 0), (0 === u && 0 === d || t === dc) && b === mc && (b = yc), b
|
|
},
|
|
inflateEnd: e => {
|
|
if (Lc(e)) return _c;
|
|
let t = e.state;
|
|
return t.window && (t.window = null), e.state = null, mc
|
|
},
|
|
inflateGetHeader: (e, t) => {
|
|
if (Lc(e)) return _c;
|
|
const n = e.state;
|
|
return 2 & n.wrap ? (n.head = t, t.done = !1, mc) : _c
|
|
},
|
|
inflateSetDictionary: (e, t) => {
|
|
const n = t.length;
|
|
let i, r, a;
|
|
return Lc(e) ? _c : (i = e.state, 0 !== i.wrap && i.mode !== Ec ? _c : i.mode === Ec && (r = 1, r = Lo(r, t, n, 0), r !== i.check) ? vc : (a = Vc(e, t, n, n), a ? (i.mode = 16210, wc) : (i.havedict = 1, mc)))
|
|
},
|
|
inflateInfo: "pako inflate (from Nodeca project)"
|
|
};
|
|
var Qc = function() {
|
|
this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1
|
|
};
|
|
const Xc = Object.prototype.toString,
|
|
{
|
|
Z_NO_FLUSH: jc,
|
|
Z_FINISH: qc,
|
|
Z_OK: Yc,
|
|
Z_STREAM_END: Kc,
|
|
Z_NEED_DICT: Zc,
|
|
Z_STREAM_ERROR: Jc,
|
|
Z_DATA_ERROR: $c,
|
|
Z_MEM_ERROR: eh
|
|
} = Fo;
|
|
|
|
function th(e) {
|
|
this.options = Nl({
|
|
chunkSize: 65536,
|
|
windowBits: 15,
|
|
to: ""
|
|
}, e || {});
|
|
const t = this.options;
|
|
t.raw && t.windowBits >= 0 && t.windowBits < 16 && (t.windowBits = -t.windowBits, 0 === t.windowBits && (t.windowBits = -15)), !(t.windowBits >= 0 && t.windowBits < 16) || e && e.windowBits || (t.windowBits += 32), t.windowBits > 15 && t.windowBits < 48 && (15 & t.windowBits || (t.windowBits |= 15)), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new Gl, this.strm.avail_out = 0;
|
|
let n = Gc.inflateInit2(this.strm, t.windowBits);
|
|
if (n !== Yc) throw new Error(No[n]);
|
|
if (this.header = new Qc, Gc.inflateGetHeader(this.strm, this.header), t.dictionary && ("string" == typeof t.dictionary ? t.dictionary = Wl(t.dictionary) : "[object ArrayBuffer]" === Xc.call(t.dictionary) && (t.dictionary = new Uint8Array(t.dictionary)), t.raw && (n = Gc.inflateSetDictionary(this.strm, t.dictionary), n !== Yc))) throw new Error(No[n])
|
|
}
|
|
|
|
function nh(e, t) {
|
|
const n = new th(t);
|
|
if (n.push(e), n.err) throw n.msg || No[n.err];
|
|
return n.result
|
|
}
|
|
th.prototype.push = function(e, t) {
|
|
const n = this.strm,
|
|
i = this.options.chunkSize,
|
|
r = this.options.dictionary;
|
|
let a, s, o;
|
|
if (this.ended) return !1;
|
|
for (s = t === ~~t ? t : !0 === t ? qc : jc, "[object ArrayBuffer]" === Xc.call(e) ? n.input = new Uint8Array(e) : n.input = e, n.next_in = 0, n.avail_in = n.input.length;;) {
|
|
for (0 === n.avail_out && (n.output = new Uint8Array(i), n.next_out = 0, n.avail_out = i), a = Gc.inflate(n, s), a === Zc && r && (a = Gc.inflateSetDictionary(n, r), a === Yc ? a = Gc.inflate(n, s) : a === $c && (a = Zc)); n.avail_in > 0 && a === Kc && n.state.wrap > 0 && 0 !== e[n.next_in];) Gc.inflateReset(n), a = Gc.inflate(n, s);
|
|
switch (a) {
|
|
case Jc:
|
|
case $c:
|
|
case Zc:
|
|
case eh:
|
|
return this.onEnd(a), this.ended = !0, !1
|
|
}
|
|
if (o = n.avail_out, n.next_out && (0 === n.avail_out || a === Kc))
|
|
if ("string" === this.options.to) {
|
|
let e = Vl(n.output, n.next_out),
|
|
t = n.next_out - e,
|
|
r = Hl(n.output, e);
|
|
n.next_out = t, n.avail_out = i - t, t && n.output.set(n.output.subarray(e, e + t), 0), this.onData(r)
|
|
} else this.onData(n.output.length === n.next_out ? n.output : n.output.subarray(0, n.next_out));
|
|
if (a !== Yc || 0 !== o) {
|
|
if (a === Kc) return a = Gc.inflateEnd(this.strm), this.onEnd(a), this.ended = !0, !0;
|
|
if (0 === n.avail_in) break
|
|
}
|
|
}
|
|
return !0
|
|
}, th.prototype.onData = function(e) {
|
|
this.chunks.push(e)
|
|
}, th.prototype.onEnd = function(e) {
|
|
e === Yc && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = Fl(this.chunks)), this.chunks = [], this.err = e, this.msg = this.strm.msg
|
|
};
|
|
var ih = {
|
|
Inflate: th,
|
|
inflate: nh,
|
|
inflateRaw: function(e, t) {
|
|
return (t = t || {}).raw = !0, nh(e, t)
|
|
},
|
|
ungzip: nh,
|
|
constants: Fo
|
|
};
|
|
const {
|
|
Deflate: rh,
|
|
deflate: ah,
|
|
deflateRaw: sh,
|
|
gzip: oh
|
|
} = ic, {
|
|
Inflate: lh,
|
|
inflate: ch,
|
|
inflateRaw: hh,
|
|
ungzip: uh
|
|
} = ih;
|
|
var dh = {
|
|
Deflate: rh,
|
|
deflate: ah,
|
|
deflateRaw: sh,
|
|
gzip: oh,
|
|
Inflate: lh,
|
|
inflate: ch,
|
|
inflateRaw: hh,
|
|
ungzip: uh,
|
|
constants: Fo
|
|
};
|
|
|
|
function fh(e) {
|
|
let t;
|
|
e = (e = e.replace(/-/g, "+")).replace(/_/g, "/");
|
|
try {
|
|
t = atob(e)
|
|
} catch (e) {
|
|
return null
|
|
}
|
|
const n = new Uint8Array(t.length);
|
|
for (let e = 0; e < t.length; ++e) {
|
|
const i = t.charCodeAt(e);
|
|
if (i > 255) return null;
|
|
n[e] = i
|
|
}
|
|
return n
|
|
}
|
|
var ph, mh, gh, Ah, _h, vh, wh, yh, xh, bh, Eh, Sh = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
Mh = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class Th {
|
|
constructor(e) {
|
|
ph.add(this), gh.set(this, []), Ah.set(this, []), _h.set(this, []), vh.set(this, []), wh.set(this, []), yh.set(this, null), null != e && (Sh(this, gh, e.up, "f"), Sh(this, Ah, e.right, "f"), Sh(this, _h, e.down, "f"), Sh(this, vh, e.left, "f"), Sh(this, wh, e.reset, "f"))
|
|
}
|
|
recordFrame(e, t) {
|
|
if (e > mh.maxFrames) throw new Error("Frame number exceeds maximum frame count.");
|
|
if (null != Mh(this, yh, "f") && e <= Mh(this, yh, "f")) throw new Error("Frame number must be greater than the previous recorded frame.");
|
|
Sh(this, yh, e, "f");
|
|
const n = Mh(this, gh, "f").length % 2 != 0,
|
|
i = Mh(this, Ah, "f").length % 2 != 0,
|
|
r = Mh(this, _h, "f").length % 2 != 0,
|
|
a = Mh(this, vh, "f").length % 2 != 0,
|
|
s = Mh(this, wh, "f").length % 2 != 0;
|
|
t.up != n && Mh(this, gh, "f").push(e), t.right != i && Mh(this, Ah, "f").push(e), t.down != r && Mh(this, _h, "f").push(e), t.left != a && Mh(this, vh, "f").push(e), t.reset != s && Mh(this, wh, "f").push(e)
|
|
}
|
|
getFrame(e) {
|
|
return {
|
|
up: (Mh(this, ph, "m", xh).call(this, e, Mh(this, gh, "f")) + 1) % 2 != 0,
|
|
right: (Mh(this, ph, "m", xh).call(this, e, Mh(this, Ah, "f")) + 1) % 2 != 0,
|
|
down: (Mh(this, ph, "m", xh).call(this, e, Mh(this, _h, "f")) + 1) % 2 != 0,
|
|
left: (Mh(this, ph, "m", xh).call(this, e, Mh(this, vh, "f")) + 1) % 2 != 0,
|
|
reset: (Mh(this, ph, "m", xh).call(this, e, Mh(this, wh, "f")) + 1) % 2 != 0
|
|
}
|
|
}
|
|
serialize() {
|
|
const e = new Uint8Array(3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length + 3 + 3 * Mh(this, _h, "f").length + 3 + 3 * Mh(this, vh, "f").length + 3 + 3 * Mh(this, wh, "f").length);
|
|
Mh(this, ph, "m", bh).call(this, Mh(this, gh, "f"), e.subarray(0, 3 + 3 * Mh(this, gh, "f").length)), Mh(this, ph, "m", bh).call(this, Mh(this, Ah, "f"), e.subarray(3 + 3 * Mh(this, gh, "f").length, 3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length)), Mh(this, ph, "m", bh).call(this, Mh(this, _h, "f"), e.subarray(3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length, 3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length + 3 + 3 * Mh(this, _h, "f").length)), Mh(this, ph, "m", bh).call(this, Mh(this, vh, "f"), e.subarray(3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length + 3 + 3 * Mh(this, _h, "f").length, 3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length + 3 + 3 * Mh(this, _h, "f").length + 3 + 3 * Mh(this, vh, "f").length)), Mh(this, ph, "m", bh).call(this, Mh(this, wh, "f"), e.subarray(3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length + 3 + 3 * Mh(this, _h, "f").length + 3 + 3 * Mh(this, vh, "f").length, 3 + 3 * Mh(this, gh, "f").length + 3 + 3 * Mh(this, Ah, "f").length + 3 + 3 * Mh(this, _h, "f").length + 3 + 3 * Mh(this, vh, "f").length + 3 + 3 * Mh(this, wh, "f").length));
|
|
const t = new dh.Deflate({
|
|
level: 9
|
|
});
|
|
return t.push(new Uint8Array(e), !0),
|
|
function(e) {
|
|
let t = "";
|
|
for (const n of e) t += String.fromCharCode(n);
|
|
let n = btoa(t);
|
|
return n = n.replace(/\+/g, "-"), n = n.replace(/\//g, "_"), n = n.replace(/=/g, ""), n
|
|
}(t.result)
|
|
}
|
|
static deserialize(e) {
|
|
const t = fh(e);
|
|
if (null == t) return null;
|
|
const n = new dh.Inflate;
|
|
if (n.push(t, !0), n.err) return null;
|
|
const i = n.result;
|
|
if (!(i instanceof Uint8Array)) return null;
|
|
const r = Mh(mh, mh, "m", Eh).call(mh, i);
|
|
if (null == r) return null;
|
|
const a = Mh(mh, mh, "m", Eh).call(mh, i.subarray(3 + 3 * r.length));
|
|
if (null == a) return null;
|
|
const s = Mh(mh, mh, "m", Eh).call(mh, i.subarray(3 + 3 * r.length + 3 + 3 * a.length));
|
|
if (null == s) return null;
|
|
const o = Mh(mh, mh, "m", Eh).call(mh, i.subarray(3 + 3 * r.length + 3 + 3 * a.length + 3 + 3 * s.length));
|
|
if (null == o) return null;
|
|
const l = Mh(mh, mh, "m", Eh).call(mh, i.subarray(3 + 3 * r.length + 3 + 3 * a.length + 3 + 3 * s.length + 3 + 3 * o.length));
|
|
return null == l ? null : new mh({
|
|
up: r,
|
|
right: a,
|
|
down: s,
|
|
left: o,
|
|
reset: l
|
|
})
|
|
}
|
|
}
|
|
mh = Th, gh = new WeakMap, Ah = new WeakMap, _h = new WeakMap, vh = new WeakMap, wh = new WeakMap, yh = new WeakMap, ph = new WeakSet, xh = function(e, t) {
|
|
let n = -1;
|
|
for (let i = 0; i < t.length; ++i) {
|
|
const r = t[i];
|
|
if (r == e) {
|
|
n = i;
|
|
break
|
|
}
|
|
if (r > e) break;
|
|
n = i
|
|
}
|
|
return n
|
|
}, bh = function(e, t) {
|
|
t[0] = 255 & e.length, t[1] = e.length >>> 8 & 255, t[2] = e.length >>> 16 & 255;
|
|
for (let n = 0; n < e.length; ++n) {
|
|
let i;
|
|
i = 0 == n ? e[n] : e[n] - e[n - 1], t[3 + 3 * n] = 255 & i, t[3 + 3 * n + 1] = i >>> 8 & 255, t[3 + 3 * n + 2] = i >>> 16 & 255
|
|
}
|
|
}, Eh = function(e) {
|
|
if (e.length < 3) return null;
|
|
const t = e[0] | e[1] << 8 | e[2] << 16;
|
|
if (e.length < 3 + 3 * t) return null;
|
|
const n = [];
|
|
for (let i = 0; i < t; ++i) {
|
|
const t = e[3 + 3 * i] | e[3 + 3 * i + 1] << 8 | e[3 + 3 * i + 2] << 16;
|
|
0 == i ? n.push(t) : n.push(n[i - 1] + t)
|
|
}
|
|
return n
|
|
}, Th.maxFrames = 5999999;
|
|
const Ch = Th;
|
|
var Ih, Rh, Ph, Bh, Dh, Lh, Uh, kh, Nh, Fh, Oh, zh, Wh, Hh = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
Vh = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class Gh {
|
|
constructor() {
|
|
Rh.set(this, void 0), Ph.set(this, void 0), Bh.set(this, void 0), Dh.set(this, void 0), Lh.set(this, void 0), Uh.set(this, []), kh.set(this, new Map), Fh.set(this, []), Oh.set(this, new Map), zh.set(this, null), Wh.set(this, null), Hh(this, Rh, new Ammo.btDefaultCollisionConfiguration, "f"), Hh(this, Ph, new Ammo.btCollisionDispatcher(Vh(this, Rh, "f")), "f"), Hh(this, Bh, new Ammo.btDbvtBroadphase, "f"), Hh(this, Dh, new Ammo.btSequentialImpulseConstraintSolver, "f"), Hh(this, Lh, new Ammo.btDiscreteDynamicsWorld(Vh(this, Ph, "f"), Vh(this, Bh, "f"), Vh(this, Dh, "f"), Vh(this, Rh, "f")), "f");
|
|
const e = new Ammo.btVector3(0, -9.82, 0);
|
|
Vh(this, Lh, "f").setGravity(e), Ammo.destroy(e)
|
|
}
|
|
dispose() {
|
|
for (const {
|
|
body: e
|
|
}
|
|
of Vh(this, Fh, "f")) null != e && Vh(this, Lh, "f").removeRigidBody(e);
|
|
Vh(this, Fh, "f").length = 0;
|
|
for (const {
|
|
body: e
|
|
}
|
|
of Vh(this, Uh, "f")) null != e && (Ammo.destroy(e.getMotionState()), Ammo.destroy(e));
|
|
Vh(this, Uh, "f").length = 0, Vh(this, kh, "f").clear();
|
|
for (const e of Vh(this, Oh, "f").values())
|
|
for (const t of e) Ammo.destroy(t.getMotionState()), Ammo.destroy(t);
|
|
Vh(this, Oh, "f").clear(), null != Vh(this, zh, "f") && (Vh(this, zh, "f").isActive && Vh(this, Lh, "f").removeRigidBody(Vh(this, zh, "f").body), Ammo.destroy(Vh(this, zh, "f").body.getMotionState()), Ammo.destroy(Vh(this, zh, "f").body), Ammo.destroy(Vh(this, zh, "f").shape)), null != Vh(this, Wh, "f") && (Vh(this, Wh, "f").isActive && Vh(this, Lh, "f").removeRigidBody(Vh(this, Wh, "f").body), Ammo.destroy(Vh(this, Wh, "f").body.getMotionState()), Ammo.destroy(Vh(this, Wh, "f").body), Ammo.destroy(Vh(this, Wh, "f").shape), Ammo.destroy(Vh(this, Wh, "f").triangleMesh)), Ammo.destroy(Vh(this, Lh, "f")), Ammo.destroy(Vh(this, Dh, "f")), Ammo.destroy(Vh(this, Bh, "f")), Ammo.destroy(Vh(this, Ph, "f")), Ammo.destroy(Vh(this, Rh, "f"))
|
|
}
|
|
createGroundPlane() {
|
|
if (null != Vh(this, zh, "f")) throw new Error("Ground is already initialized");
|
|
const e = new Ammo.btVector3(0, 1, 0),
|
|
t = new Ammo.btStaticPlaneShape(e, 0);
|
|
t.setMargin(.01), Ammo.destroy(e);
|
|
const n = new Ammo.btTransform;
|
|
n.setIdentity();
|
|
const i = new Ammo.btDefaultMotionState(n);
|
|
Ammo.destroy(n);
|
|
const r = new Ammo.btVector3;
|
|
t.calculateLocalInertia(0, r);
|
|
const a = new Ammo.btRigidBodyConstructionInfo(0, i, t, r),
|
|
s = new Ammo.btRigidBody(a);
|
|
s.setFriction(1), Ammo.destroy(r), Ammo.destroy(a), Hh(this, zh, {
|
|
body: s,
|
|
shape: t,
|
|
isActive: !1
|
|
}, "f")
|
|
}
|
|
createMountains(e, t) {
|
|
if (e.length % 9 != 0) throw new Error("Number of mountain vertices is not dividable by 9");
|
|
if (e.length > 0) {
|
|
if (null != Vh(this, Wh, "f")) throw new Error("Mountains are already initialized");
|
|
let n = 1 / 0;
|
|
const i = new Ammo.btTriangleMesh;
|
|
for (let t = 0; t < e.length; t += 9) {
|
|
const r = e[t + 0],
|
|
a = e[t + 1],
|
|
s = e[t + 2],
|
|
o = e[t + 3],
|
|
l = e[t + 4],
|
|
c = e[t + 5],
|
|
h = e[t + 6],
|
|
u = e[t + 7],
|
|
d = e[t + 8],
|
|
f = new Ammo.btVector3(r, a, s),
|
|
p = new Ammo.btVector3(o, l, c),
|
|
m = new Ammo.btVector3(h, u, d);
|
|
i.addTriangle(f, p, m), Ammo.destroy(f), Ammo.destroy(p), Ammo.destroy(m), n = Math.min(n, new Zt(r, a, s).lengthSq(), new Zt(o, l, c).lengthSq(), new Zt(h, u, d).lengthSq())
|
|
}
|
|
const r = new Ammo.btBvhTriangleMeshShape(i);
|
|
r.setMargin(.02);
|
|
const a = new Ammo.btVector3(t.x, t.y, t.z),
|
|
s = new Ammo.btTransform;
|
|
s.setIdentity(), s.setOrigin(a), Ammo.destroy(a);
|
|
const o = new Ammo.btVector3;
|
|
r.calculateLocalInertia(0, o);
|
|
const l = new Ammo.btDefaultMotionState(s);
|
|
Ammo.destroy(s);
|
|
const c = new Ammo.btRigidBodyConstructionInfo(0, l, r, o),
|
|
h = new Ammo.btRigidBody(c);
|
|
h.setFriction(1), Ammo.destroy(o), Ammo.destroy(c);
|
|
const u = Math.sqrt(n);
|
|
Hh(this, Wh, {
|
|
body: h,
|
|
shape: r,
|
|
triangleMesh: i,
|
|
offset: t,
|
|
minimumRadius: u,
|
|
isActive: !1
|
|
}, "f")
|
|
}
|
|
}
|
|
addStaticBody(e, t, n) {
|
|
const i = Vh(Ih, Ih, "f", Nh);
|
|
(t = t.clone()).applyMatrix4(e);
|
|
const r = {
|
|
active: !1,
|
|
matrix: e,
|
|
shape: n,
|
|
body: null,
|
|
min: t.min.clone(),
|
|
max: t.max.clone()
|
|
};
|
|
Vh(this, Uh, "f").push(r);
|
|
for (let e = Math.floor((t.min.x - 3) / i); e <= Math.ceil((t.max.x + 3) / i); ++e)
|
|
for (let n = Math.floor((t.min.y - 3) / i); n <= Math.ceil((t.max.y + 3) / i); ++n)
|
|
for (let a = Math.floor((t.min.z - 3) / i); a <= Math.ceil((t.max.z + 3) / i); ++a) {
|
|
const t = Vh(this, kh, "f").get(e);
|
|
if (null == t) Vh(this, kh, "f").set(e, new Map([
|
|
[n, new Map([
|
|
[a, [r]]
|
|
])]
|
|
]));
|
|
else {
|
|
const e = t.get(n);
|
|
if (null == e) t.set(n, new Map([
|
|
[a, [r]]
|
|
]));
|
|
else {
|
|
const t = e.get(a);
|
|
null == t ? e.set(a, [r]) : t.push(r)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
activePhysicsAt(e) {
|
|
if (null != Vh(this, zh, "f") && (e.y < 4 ? Vh(this, zh, "f").isActive || (Vh(this, Lh, "f").addRigidBody(Vh(this, zh, "f").body), Vh(this, zh, "f").isActive = !0) : e.y > 5 && Vh(this, zh, "f").isActive && (Vh(this, Lh, "f").removeRigidBody(Vh(this, zh, "f").body), Vh(this, zh, "f").isActive = !1)), null != Vh(this, Wh, "f")) {
|
|
const t = e.distanceTo(Vh(this, Wh, "f").offset);
|
|
t > Vh(this, Wh, "f").minimumRadius - 10 ? Vh(this, Wh, "f").isActive || (Vh(this, Lh, "f").addRigidBody(Vh(this, Wh, "f").body), Vh(this, Wh, "f").isActive = !0) : t < Vh(this, Wh, "f").minimumRadius - 20 && Vh(this, Wh, "f").isActive && (Vh(this, Lh, "f").removeRigidBody(Vh(this, Wh, "f").body), Vh(this, Wh, "f").isActive = !1)
|
|
}
|
|
const t = new Ammo.btVector3,
|
|
n = new Ammo.btVector3;
|
|
Hh(this, Fh, Vh(this, Fh, "f").filter((t => {
|
|
if (t.active && (e.x < t.min.x - 3 || e.x > t.max.x + 3 || e.y < t.min.y - 3 || e.y > t.max.y + 3 || e.z < t.min.z - 3 || e.z > t.max.z + 3)) {
|
|
const e = Vh(this, Oh, "f").get(t.shape);
|
|
return null == e ? Vh(this, Oh, "f").set(t.shape, [t.body]) : e.push(t.body), Vh(this, Lh, "f").removeRigidBody(t.body), t.body = null, t.active = !1, !1
|
|
}
|
|
return !0
|
|
})), "f");
|
|
const i = e.clone().divideScalar(Vh(Ih, Ih, "f", Nh)).floor(),
|
|
r = Vh(this, kh, "f").get(i.x);
|
|
if (null != r) {
|
|
const t = r.get(i.y);
|
|
if (null != t) {
|
|
const n = t.get(i.z);
|
|
if (null != n)
|
|
for (const t of n)
|
|
if (!t.active && e.x >= t.min.x - 3 && e.x <= t.max.x + 3 && e.y >= t.min.y - 3 && e.y <= t.max.y + 3 && e.z >= t.min.z - 3 && e.z <= t.max.z + 3) {
|
|
let e = Vh(this, Oh, "f").get(t.shape);
|
|
null == e && (e = [], Vh(this, Oh, "f").set(t.shape, e));
|
|
const n = new Ammo.btTransform;
|
|
let i;
|
|
if (n.setFromOpenGLMatrix(t.matrix.elements), e.length > 0) i = e.pop(), i.setWorldTransform(n), Ammo.destroy(n), Vh(this, Lh, "f").addRigidBody(i);
|
|
else {
|
|
const e = new Ammo.btDefaultMotionState(n);
|
|
Ammo.destroy(n);
|
|
const r = new Ammo.btVector3;
|
|
t.shape.calculateLocalInertia(0, r);
|
|
const a = new Ammo.btRigidBodyConstructionInfo(0, e, t.shape, r);
|
|
i = new Ammo.btRigidBody(a), i.setFriction(1), Ammo.destroy(r), Ammo.destroy(a), Vh(this, Lh, "f").addRigidBody(i)
|
|
}
|
|
if (null != t.body) throw new Error("Activating already active rigid body");
|
|
t.body = i, t.active = !0, Vh(this, Fh, "f").push(t)
|
|
}
|
|
}
|
|
}
|
|
Ammo.destroy(t), Ammo.destroy(n)
|
|
}
|
|
step() {
|
|
Vh(this, Lh, "f").stepSimulation(1 / Ih.stepsPerSecond, 0, 1 / Ih.stepsPerSecond)
|
|
}
|
|
get world() {
|
|
return Vh(this, Lh, "f")
|
|
}
|
|
get dispatcher() {
|
|
return Vh(this, Ph, "f")
|
|
}
|
|
}
|
|
Ih = Gh, Rh = new WeakMap, Ph = new WeakMap, Bh = new WeakMap, Dh = new WeakMap, Lh = new WeakMap, Uh = new WeakMap, kh = new WeakMap, Fh = new WeakMap, Oh = new WeakMap, zh = new WeakMap, Wh = new WeakMap, Nh = {
|
|
value: 20
|
|
}, Gh.stepsPerSecond = 1e3;
|
|
const Qh = Gh;
|
|
var Xh, jh = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
qh = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class Yh {
|
|
constructor(e) {
|
|
if (Xh.set(this, 0), null != e) {
|
|
if (!Number.isSafeInteger(e)) throw new Error("Frames is not a safe integer");
|
|
jh(this, Xh, e, "f")
|
|
}
|
|
}
|
|
get numberOfFrames() {
|
|
return qh(this, Xh, "f")
|
|
}
|
|
get time() {
|
|
return qh(this, Xh, "f") / 1e3
|
|
}
|
|
increment() {
|
|
var e;
|
|
jh(this, Xh, (e = qh(this, Xh, "f"), ++e), "f")
|
|
}
|
|
difference(e) {
|
|
return new Yh(qh(this, Xh, "f") - qh(e, Xh, "f"))
|
|
}
|
|
lessThan(e) {
|
|
return qh(this, Xh, "f") < qh(e, Xh, "f")
|
|
}
|
|
greaterThan(e) {
|
|
return qh(this, Xh, "f") > qh(e, Xh, "f")
|
|
}
|
|
lessOrEqual(e) {
|
|
return qh(this, Xh, "f") <= qh(e, Xh, "f")
|
|
}
|
|
greaterOrEqual(e) {
|
|
return qh(this, Xh, "f") >= qh(e, Xh, "f")
|
|
}
|
|
equals(e) {
|
|
return qh(this, Xh, "f") == qh(e, Xh, "f")
|
|
}
|
|
isNegative() {
|
|
return qh(this, Xh, "f") < 0
|
|
}
|
|
clone() {
|
|
const e = new Yh;
|
|
return jh(e, Xh, qh(this, Xh, "f"), "f"), e
|
|
}
|
|
}
|
|
Xh = new WeakMap;
|
|
const Kh = Yh;
|
|
var Zh;
|
|
! function(e) {
|
|
e[e.Checkpoint = 0] = "Checkpoint", e[e.Finish = 1] = "Finish"
|
|
}(Zh || (Zh = {}));
|
|
const Jh = Zh,
|
|
$h = [
|
|
[new Kt(0, 0, 0, 1), new Kt(0, .7071067811865475, 0, .7071067811865476), new Kt(0, 1, 0, 0), new Kt(0, .7071067811865476, 0, -.7071067811865475)],
|
|
[new Kt(0, 0, 1, 0), new Kt(.7071067811865475, 0, .7071067811865476, 0), new Kt(1, 0, 0, 0), new Kt(.7071067811865476, 0, -.7071067811865475, 0)],
|
|
[new Kt(0, 0, -.7071067811865477, .7071067811865475), new Kt(.5, .5, -.5, .5), new Kt(.7071067811865475, .7071067811865477, 0, 0), new Kt(.5, .5, .5, -.5)],
|
|
[new Kt(0, 0, .7071067811865475, .7071067811865476), new Kt(.5, -.5, .5, .5), new Kt(.7071067811865476, -.7071067811865475, 0, 0), new Kt(.5, -.5, -.5, -.5)],
|
|
[new Kt(.7071067811865475, 0, 0, .7071067811865476), new Kt(.5, .5, .5, .5), new Kt(0, .7071067811865476, .7071067811865475, 0), new Kt(-.5, .5, .5, -.5)],
|
|
[new Kt(-.7071067811865477, 0, 0, .7071067811865475), new Kt(-.5, -.5, .5, .5), new Kt(0, -.7071067811865475, .7071067811865477, 0), new Kt(.5, -.5, .5, -.5)]
|
|
];
|
|
|
|
function eu(e, t) {
|
|
return $h[t][e].clone()
|
|
}
|
|
var tu, nu, iu, ru, au, su, ou, lu, cu, hu = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
uu = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class du {
|
|
constructor(e, t, n) {
|
|
tu.add(this), iu.set(this, void 0), ru.set(this, new Map), au.set(this, []), su.set(this, []), ou.set(this, []), hu(this, iu, t, "f"), n.forEachPart(((n, i, r, a, s, o, l, c) => {
|
|
uu(this, tu, "m", lu).call(this, n, i, r, s, o, a, e, t);
|
|
const h = uu(this, ru, "f").get(a);
|
|
null == h ? uu(this, ru, "f").set(a, [{
|
|
x: n,
|
|
y: i,
|
|
z: r,
|
|
rotation: s,
|
|
rotationAxis: o,
|
|
type: a,
|
|
checkpointOrder: c
|
|
}]) : h.push({
|
|
x: n,
|
|
y: i,
|
|
z: r,
|
|
rotation: s,
|
|
rotationAxis: o,
|
|
type: a,
|
|
checkpointOrder: c
|
|
})
|
|
}));
|
|
const i = uu(this, iu, "f").getPartTypesWithDetector(Jh.Finish);
|
|
for (const e of i) {
|
|
const t = uu(this, iu, "f").getDetector(e);
|
|
if (null == t) throw new Error("Part detector is missing");
|
|
const n = uu(this, ru, "f").get(e);
|
|
null != n && hu(this, au, uu(this, au, "f").concat(n.map((({
|
|
x: e,
|
|
y: n,
|
|
z: i,
|
|
rotation: r,
|
|
rotationAxis: a,
|
|
type: s,
|
|
checkpointOrder: o
|
|
}) => ({
|
|
x: e,
|
|
y: n,
|
|
z: i,
|
|
rotation: r,
|
|
rotationAxis: a,
|
|
type: s,
|
|
checkpointOrder: o,
|
|
detector: t
|
|
})))), "f")
|
|
}
|
|
const r = uu(this, iu, "f").getPartTypesWithDetector(Jh.Checkpoint);
|
|
for (const e of r) {
|
|
const t = uu(this, iu, "f").getDetector(e);
|
|
if (null == t) throw new Error("Part detector is missing");
|
|
const n = uu(this, ru, "f").get(e);
|
|
null != n && hu(this, su, uu(this, su, "f").concat(n.map((({
|
|
x: e,
|
|
y: n,
|
|
z: i,
|
|
rotation: r,
|
|
rotationAxis: a,
|
|
type: s,
|
|
checkpointOrder: o
|
|
}) => {
|
|
if (null == o) throw new Error("Checkpoint has no checkpoint order");
|
|
return {
|
|
x: e,
|
|
y: n,
|
|
z: i,
|
|
rotation: r,
|
|
rotationAxis: a,
|
|
type: s,
|
|
checkpointOrder: o,
|
|
detector: t
|
|
}
|
|
}))), "f")
|
|
}
|
|
hu(this, ou, uu(this, su, "f").map((e => e.checkpointOrder)).filter(((e, t, n) => n.indexOf(e) == t)).sort(((e, t) => e - t)), "f")
|
|
}
|
|
checkCheckpoint(e, t) {
|
|
return uu(this, tu, "m", cu).call(this, e, t)
|
|
}
|
|
checkFinish(e) {
|
|
return uu(this, tu, "m", cu).call(this, e)
|
|
}
|
|
getTotalNumberOfCheckpointIndices() {
|
|
return uu(this, ou, "f").length
|
|
}
|
|
}
|
|
nu = du, iu = new WeakMap, ru = new WeakMap, au = new WeakMap, su = new WeakMap, ou = new WeakMap, tu = new WeakSet, lu = function(e, t, n, i, r, a, s, o) {
|
|
const l = eu(i, r),
|
|
c = new Zt(e * nu.partSize, t * nu.partSize, n * nu.partSize),
|
|
h = (new Cn).compose(c, l, new Zt(1, 1, 1)),
|
|
{
|
|
boundingBox: u,
|
|
shape: d
|
|
} = o.getPhysicsShape(a);
|
|
s.addStaticBody(h, u, d)
|
|
}, cu = function(e, t) {
|
|
let n = [],
|
|
i = null;
|
|
null == t ? n = uu(this, au, "f") : (n = uu(this, su, "f"), t < uu(this, ou, "f").length && (i = uu(this, ou, "f")[t]));
|
|
for (const {
|
|
x: t,
|
|
y: r,
|
|
z: a,
|
|
rotation: s,
|
|
rotationAxis: o,
|
|
type: l,
|
|
checkpointOrder: c,
|
|
detector: h
|
|
}
|
|
of n)
|
|
if (c == i) {
|
|
const n = eu(s, o),
|
|
i = h.center.clone().applyQuaternion(n).add(new Zt(t * nu.partSize, r * nu.partSize, a * nu.partSize)),
|
|
c = h.size.clone().applyQuaternion(n);
|
|
c.x = Math.abs(c.x), c.y = Math.abs(c.y), c.z = Math.abs(c.z);
|
|
const u = (new en).setFromCenterAndSize(i, c);
|
|
if (e.intersectsBox3(u)) return {
|
|
x: t,
|
|
y: r,
|
|
z: a,
|
|
rotation: s,
|
|
rotationAxis: o,
|
|
type: l
|
|
}
|
|
} return null
|
|
}, du.partSize = 5;
|
|
const fu = du;
|
|
var pu;
|
|
! function(e) {
|
|
e[e.Straight = 0] = "Straight", e[e.TurnSharp = 1] = "TurnSharp", e[e.SlopeUp = 2] = "SlopeUp", e[e.SlopeDown = 3] = "SlopeDown", e[e.Slope = 4] = "Slope", e[e.Start = 5] = "Start", e[e.Finish = 6] = "Finish", e[e.ToWideMiddle = 7] = "ToWideMiddle", e[e.ToWideLeft = 8] = "ToWideLeft", e[e.ToWideRight = 9] = "ToWideRight", e[e.StraightWide = 10] = "StraightWide", e[e.InnerCornerWide = 11] = "InnerCornerWide", e[e.OuterCornerWide = 12] = "OuterCornerWide", e[e.SlopeUpLeftWide = 13] = "SlopeUpLeftWide", e[e.SlopeUpRightWide = 14] = "SlopeUpRightWide", e[e.SlopeDownLeftWide = 15] = "SlopeDownLeftWide", e[e.SlopeDownRightWide = 16] = "SlopeDownRightWide", e[e.SlopeLeftWide = 17] = "SlopeLeftWide", e[e.SlopeRightWide = 18] = "SlopeRightWide", e[e.PillarTop = 19] = "PillarTop", e[e.PillarMiddle = 20] = "PillarMiddle", e[e.PillarBottom = 21] = "PillarBottom", e[e.PillarShort = 22] = "PillarShort", e[e.PlanePillarBottom = 23] = "PlanePillarBottom", e[e.PlanePillarShort = 24] = "PlanePillarShort", e[e.Plane = 25] = "Plane", e[e.PlaneWall = 26] = "PlaneWall", e[e.PlaneWallCorner = 27] = "PlaneWallCorner", e[e.PlaneWallInnerCorner = 28] = "PlaneWallInnerCorner", e[e.Block = 29] = "Block", e[e.WallTrackTop = 30] = "WallTrackTop", e[e.WallTrackMiddle = 31] = "WallTrackMiddle", e[e.WallTrackBottom = 32] = "WallTrackBottom", e[e.PlaneSlopeUp = 33] = "PlaneSlopeUp", e[e.PlaneSlopeDown = 34] = "PlaneSlopeDown", e[e.PlaneSlope = 35] = "PlaneSlope", e[e.TurnShort = 36] = "TurnShort", e[e.TurnLong = 37] = "TurnLong", e[e.SlopeUpLong = 38] = "SlopeUpLong", e[e.SlopeDownLong = 39] = "SlopeDownLong", e[e.SlopePillar = 40] = "SlopePillar", e[e.TurnSLeft = 41] = "TurnSLeft", e[e.TurnSRight = 42] = "TurnSRight", e[e.IntersectionT = 43] = "IntersectionT", e[e.IntersectionCross = 44] = "IntersectionCross", e[e.PillarBranch1 = 45] = "PillarBranch1", e[e.PillarBranch2 = 46] = "PillarBranch2", e[e.PillarBranch3 = 47] = "PillarBranch3", e[e.PillarBranch4 = 48] = "PillarBranch4", e[e.WallTrackBottomCorner = 49] = "WallTrackBottomCorner", e[e.WallTrackMiddleCorner = 50] = "WallTrackMiddleCorner", e[e.WallTrackTopCorner = 51] = "WallTrackTopCorner", e[e.Checkpoint = 52] = "Checkpoint", e[e.HalfBlock = 53] = "HalfBlock", e[e.QuarterBlock = 54] = "QuarterBlock", e[e.HalfPlane = 55] = "HalfPlane", e[e.QuarterPlane = 56] = "QuarterPlane", e[e.PlaneBridge = 57] = "PlaneBridge", e[e.SignArrowLeft = 58] = "SignArrowLeft", e[e.SignArrowRight = 59] = "SignArrowRight", e[e.SignArrowUp = 61] = "SignArrowUp", e[e.SignArrowDown = 62] = "SignArrowDown", e[e.SignWarning = 63] = "SignWarning", e[e.SignWrongWay = 64] = "SignWrongWay", e[e.CheckpointWide = 65] = "CheckpointWide", e[e.WallTrackCeiling = 66] = "WallTrackCeiling", e[e.WallTrackFloor = 67] = "WallTrackFloor", e[e.BlockSlopedDown = 68] = "BlockSlopedDown", e[e.BlockSlopedDownInnerCorner = 69] = "BlockSlopedDownInnerCorner", e[e.BlockSlopedDownOuterCorner = 70] = "BlockSlopedDownOuterCorner", e[e.BlockSlopedUp = 71] = "BlockSlopedUp", e[e.BlockSlopedUpInnerCorner = 72] = "BlockSlopedUpInnerCorner", e[e.BlockSlopedUpOuterCorner = 73] = "BlockSlopedUpOuterCorner", e[e.FinishWide = 74] = "FinishWide", e[e.PlaneCheckpoint = 75] = "PlaneCheckpoint", e[e.PlaneFinish = 76] = "PlaneFinish", e[e.PlaneCheckpointWide = 77] = "PlaneCheckpointWide", e[e.PlaneFinishWide = 78] = "PlaneFinishWide", e[e.WallTrackBottomInnerCorner = 79] = "WallTrackBottomInnerCorner", e[e.WallTrackInnerCorner = 80] = "WallTrackInnerCorner", e[e.WallTrackTopInnerCorner = 81] = "WallTrackTopInnerCorner", e[e.TurnLong2 = 82] = "TurnLong2", e[e.TurnLong3 = 83] = "TurnLong3", e[e.SlopePillarShort = 84] = "SlopePillarShort", e[e.BlockSlopeUp = 85] = "BlockSlopeUp", e[e.BlockSlopeDown = 86] = "BlockSlopeDown", e[e.BlockSlopeVerticalTop = 87] = "BlockSlopeVerticalTop", e[e.BlockSlopeVerticalBottom = 88] = "BlockSlopeVerticalBottom", e[e.PlaneSlopeVerticalBottom = 90] = "PlaneSlopeVerticalBottom", e[e.StartWide = 91] = "StartWide", e[e.PlaneStart = 92] = "PlaneStart", e[e.PlaneStartWide = 93] = "PlaneStartWide", e[e.TurnShortLeftWide = 94] = "TurnShortLeftWide", e[e.TurnShortRightWide = 95] = "TurnShortRightWide", e[e.TurnLongLeftWide = 96] = "TurnLongLeftWide", e[e.TurnLongRightWide = 97] = "TurnLongRightWide", e[e.SlopeUpVertical = 98] = "SlopeUpVertical", e[e.PlaneSlopePillar = 99] = "PlaneSlopePillar", e[e.PlaneSlopePillarShort = 100] = "PlaneSlopePillarShort", e[e.PillarBranch1Top = 101] = "PillarBranch1Top", e[e.PillarBranch1Bottom = 102] = "PillarBranch1Bottom", e[e.PillarBranch1Middle = 103] = "PillarBranch1Middle", e[e.PillarBranch2Top = 104] = "PillarBranch2Top", e[e.PillarBranch2Middle = 105] = "PillarBranch2Middle", e[e.PillarBranch2Bottom = 106] = "PillarBranch2Bottom", e[e.PillarBranch3Top = 107] = "PillarBranch3Top", e[e.PillarBranch3Middle = 108] = "PillarBranch3Middle", e[e.PillarBranch3Bottom = 109] = "PillarBranch3Bottom", e[e.PillarBranch4Top = 110] = "PillarBranch4Top", e[e.PillarBranch4Middle = 111] = "PillarBranch4Middle", e[e.PillarBranch4Bottom = 112] = "PillarBranch4Bottom", e[e.PillarBranch5 = 113] = "PillarBranch5", e[e.PillarBranch5Top = 114] = "PillarBranch5Top", e[e.PillarBranch5Middle = 115] = "PillarBranch5Middle", e[e.PillarBranch5Bottom = 116] = "PillarBranch5Bottom", e[e.ToWideDouble = 117] = "ToWideDouble", e[e.ToWideDiagonal = 118] = "ToWideDiagonal", e[e.StraightPillarBottom = 119] = "StraightPillarBottom", e[e.StraightPillarShort = 120] = "StraightPillarShort", e[e.TurnSharpPillarBottom = 121] = "TurnSharpPillarBottom", e[e.TurnSharpPillarShort = 122] = "TurnSharpPillarShort", e[e.IntersectionTPillarBottom = 123] = "IntersectionTPillarBottom", e[e.IntersectionTPillarShort = 124] = "IntersectionTPillarShort", e[e.IntersectionCrossPillarBottom = 125] = "IntersectionCrossPillarBottom", e[e.IntersectionCrossPillarShort = 126] = "IntersectionCrossPillarShort", e[e.PlaneBridgeCorner = 127] = "PlaneBridgeCorner", e[e.PlaneBridgeIntersectionT = 128] = "PlaneBridgeIntersectionT", e[e.PlaneBridgeIntersectionCross = 129] = "PlaneBridgeIntersectionCross", e[e.BlockBridge = 130] = "BlockBridge", e[e.BlockBridgeCorner = 131] = "BlockBridgeCorner", e[e.BlockBridgeIntersectionT = 132] = "BlockBridgeIntersectionT", e[e.BlockBridgeIntersectionCross = 133] = "BlockBridgeIntersectionCross", e[e.WallTrackCeilingCorner = 134] = "WallTrackCeilingCorner", e[e.WallTrackCeilingPlaneCorner = 135] = "WallTrackCeilingPlaneCorner", e[e.WallTrackFloorCorner = 136] = "WallTrackFloorCorner", e[e.WallTrackFloorPlaneCorner = 137] = "WallTrackFloorPlaneCorner", e[e.SlopeUpVerticalLeftWide = 138] = "SlopeUpVerticalLeftWide", e[e.SlopeUpVerticalRightWide = 139] = "SlopeUpVerticalRightWide", e[e.BlockSlopeVerticalCornerTop = 140] = "BlockSlopeVerticalCornerTop", e[e.BlockSlopeVerticalCornerBottom = 141] = "BlockSlopeVerticalCornerBottom", e[e.WallTrackSlopeToVertical = 142] = "WallTrackSlopeToVertical", e[e.PlaneSlopeToVertical = 143] = "PlaneSlopeToVertical", e[e.BlockSlopeToVertical = 144] = "BlockSlopeToVertical", e[e.PlaneSlopeUpLong = 145] = "PlaneSlopeUpLong", e[e.PlaneSlopeDownLong = 146] = "PlaneSlopeDownLong", e[e.SlopeUpLongLeftWide = 147] = "SlopeUpLongLeftWide", e[e.SlopeUpLongRightWide = 148] = "SlopeUpLongRightWide", e[e.SlopeDownLongLeftWide = 149] = "SlopeDownLongLeftWide", e[e.SlopeDownLongRightWide = 150] = "SlopeDownLongRightWide", e[e.BlockSlopeUpLong = 151] = "BlockSlopeUpLong", e[e.BlockSlopeDownLong = 152] = "BlockSlopeDownLong", e[e.BlockSlopeVerticalInnerCornerBottom = 153] = "BlockSlopeVerticalInnerCornerBottom", e[e.BlockSlopeVerticalInnerCornerTop = 154] = "BlockSlopeVerticalInnerCornerTop", e[e.BlockInnerCorner = 155] = "BlockInnerCorner"
|
|
}(pu || (pu = {}));
|
|
const mu = pu;
|
|
var gu;
|
|
! function(e) {
|
|
e[e.YPositive = 0] = "YPositive", e[e.YNegative = 1] = "YNegative", e[e.XPositive = 2] = "XPositive", e[e.XNegative = 3] = "XNegative", e[e.ZPositive = 4] = "ZPositive", e[e.ZNegative = 5] = "ZNegative"
|
|
}(gu || (gu = {}));
|
|
const Au = gu;
|
|
|
|
function _u(e) {
|
|
let t, n, i, r = -1,
|
|
a = 0;
|
|
for (let s = 0; s < e.length; ++s) {
|
|
const o = e[s];
|
|
if (void 0 === t && (t = o.array.constructor), t !== o.array.constructor) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."), null;
|
|
if (void 0 === n && (n = o.itemSize), n !== o.itemSize) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."), null;
|
|
if (void 0 === i && (i = o.normalized), i !== o.normalized) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."), null;
|
|
if (-1 === r && (r = o.gpuType), r !== o.gpuType) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
|
|
a += o.count * n
|
|
}
|
|
const s = new t(a),
|
|
o = new Ci(s, n, i);
|
|
let l = 0;
|
|
for (let t = 0; t < e.length; ++t) {
|
|
const i = e[t];
|
|
if (i.isInterleavedBufferAttribute) {
|
|
const e = l / n;
|
|
for (let t = 0, r = i.count; t < r; t++)
|
|
for (let r = 0; r < n; r++) {
|
|
const n = i.getComponent(t, r);
|
|
o.setComponent(t + e, r, n)
|
|
}
|
|
} else s.set(i.array, l);
|
|
l += i.count * n
|
|
}
|
|
return void 0 !== r && (o.gpuType = r), o
|
|
}
|
|
|
|
function vu(e, t) {
|
|
if (0 === t) return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), e;
|
|
if (2 === t || 1 === t) {
|
|
let n = e.getIndex();
|
|
if (null === n) {
|
|
const t = [],
|
|
i = e.getAttribute("position");
|
|
if (void 0 === i) return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e;
|
|
for (let e = 0; e < i.count; e++) t.push(e);
|
|
e.setIndex(t), n = e.getIndex()
|
|
}
|
|
const i = n.count - 2,
|
|
r = [];
|
|
if (2 === t)
|
|
for (let e = 1; e <= i; e++) r.push(n.getX(0)), r.push(n.getX(e)), r.push(n.getX(e + 1));
|
|
else
|
|
for (let e = 0; e < i; e++) e % 2 == 0 ? (r.push(n.getX(e)), r.push(n.getX(e + 1)), r.push(n.getX(e + 2))) : (r.push(n.getX(e + 2)), r.push(n.getX(e + 1)), r.push(n.getX(e)));
|
|
r.length / 3 !== i && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
|
|
const a = e.clone();
|
|
return a.setIndex(r), a.clearGroups(), a
|
|
}
|
|
return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), e
|
|
}
|
|
class wu extends qa {
|
|
constructor(e) {
|
|
super(e), this.dracoLoader = null, this.ktx2Loader = null, this.meshoptDecoder = null, this.pluginCallbacks = [], this.register((function(e) {
|
|
return new Mu(e)
|
|
})), this.register((function(e) {
|
|
return new Tu(e)
|
|
})), this.register((function(e) {
|
|
return new ku(e)
|
|
})), this.register((function(e) {
|
|
return new Nu(e)
|
|
})), this.register((function(e) {
|
|
return new Fu(e)
|
|
})), this.register((function(e) {
|
|
return new Iu(e)
|
|
})), this.register((function(e) {
|
|
return new Ru(e)
|
|
})), this.register((function(e) {
|
|
return new Pu(e)
|
|
})), this.register((function(e) {
|
|
return new Bu(e)
|
|
})), this.register((function(e) {
|
|
return new Su(e)
|
|
})), this.register((function(e) {
|
|
return new Du(e)
|
|
})), this.register((function(e) {
|
|
return new Cu(e)
|
|
})), this.register((function(e) {
|
|
return new Uu(e)
|
|
})), this.register((function(e) {
|
|
return new Lu(e)
|
|
})), this.register((function(e) {
|
|
return new bu(e)
|
|
})), this.register((function(e) {
|
|
return new Ou(e)
|
|
})), this.register((function(e) {
|
|
return new zu(e)
|
|
}))
|
|
}
|
|
load(e, t, n, i) {
|
|
const r = this;
|
|
let a;
|
|
if ("" !== this.resourcePath) a = this.resourcePath;
|
|
else if ("" !== this.path) {
|
|
const t = gs.extractUrlBase(e);
|
|
a = gs.resolveURL(t, this.path)
|
|
} else a = gs.extractUrlBase(e);
|
|
this.manager.itemStart(e);
|
|
const s = function(t) {
|
|
i ? i(t) : console.error(t), r.manager.itemError(e), r.manager.itemEnd(e)
|
|
},
|
|
o = new Za(this.manager);
|
|
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, (function(n) {
|
|
try {
|
|
r.parse(n, a, (function(n) {
|
|
t(n), r.manager.itemEnd(e)
|
|
}), s)
|
|
} catch (e) {
|
|
s(e)
|
|
}
|
|
}), n, s)
|
|
}
|
|
setDRACOLoader(e) {
|
|
return this.dracoLoader = e, this
|
|
}
|
|
setKTX2Loader(e) {
|
|
return this.ktx2Loader = e, this
|
|
}
|
|
setMeshoptDecoder(e) {
|
|
return this.meshoptDecoder = e, this
|
|
}
|
|
register(e) {
|
|
return -1 === this.pluginCallbacks.indexOf(e) && this.pluginCallbacks.push(e), this
|
|
}
|
|
unregister(e) {
|
|
return -1 !== this.pluginCallbacks.indexOf(e) && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e), 1), this
|
|
}
|
|
parse(e, t, n, i) {
|
|
let r;
|
|
const a = {},
|
|
s = {},
|
|
o = new TextDecoder;
|
|
if ("string" == typeof e) r = JSON.parse(e);
|
|
else if (e instanceof ArrayBuffer) {
|
|
if (o.decode(new Uint8Array(e, 0, 4)) === Wu) {
|
|
try {
|
|
a[xu.KHR_BINARY_GLTF] = new Gu(e)
|
|
} catch (e) {
|
|
return void(i && i(e))
|
|
}
|
|
r = JSON.parse(a[xu.KHR_BINARY_GLTF].content)
|
|
} else r = JSON.parse(o.decode(e))
|
|
} else r = e;
|
|
if (void 0 === r.asset || r.asset.version[0] < 2) return void(i && i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));
|
|
const l = new md(r, {
|
|
path: t || this.resourcePath || "",
|
|
crossOrigin: this.crossOrigin,
|
|
requestHeader: this.requestHeader,
|
|
manager: this.manager,
|
|
ktx2Loader: this.ktx2Loader,
|
|
meshoptDecoder: this.meshoptDecoder
|
|
});
|
|
l.fileLoader.setRequestHeader(this.requestHeader);
|
|
for (let e = 0; e < this.pluginCallbacks.length; e++) {
|
|
const t = this.pluginCallbacks[e](l);
|
|
t.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), s[t.name] = t, a[t.name] = !0
|
|
}
|
|
if (r.extensionsUsed)
|
|
for (let e = 0; e < r.extensionsUsed.length; ++e) {
|
|
const t = r.extensionsUsed[e],
|
|
n = r.extensionsRequired || [];
|
|
switch (t) {
|
|
case xu.KHR_MATERIALS_UNLIT:
|
|
a[t] = new Eu;
|
|
break;
|
|
case xu.KHR_DRACO_MESH_COMPRESSION:
|
|
a[t] = new Qu(r, this.dracoLoader);
|
|
break;
|
|
case xu.KHR_TEXTURE_TRANSFORM:
|
|
a[t] = new Xu;
|
|
break;
|
|
case xu.KHR_MESH_QUANTIZATION:
|
|
a[t] = new ju;
|
|
break;
|
|
default:
|
|
n.indexOf(t) >= 0 && void 0 === s[t] && console.warn('THREE.GLTFLoader: Unknown extension "' + t + '".')
|
|
}
|
|
}
|
|
l.setExtensions(a), l.setPlugins(s), l.parse(n, i)
|
|
}
|
|
parseAsync(e, t) {
|
|
const n = this;
|
|
return new Promise((function(i, r) {
|
|
n.parse(e, t, i, r)
|
|
}))
|
|
}
|
|
}
|
|
|
|
function yu() {
|
|
let e = {};
|
|
return {
|
|
get: function(t) {
|
|
return e[t]
|
|
},
|
|
add: function(t, n) {
|
|
e[t] = n
|
|
},
|
|
remove: function(t) {
|
|
delete e[t]
|
|
},
|
|
removeAll: function() {
|
|
e = {}
|
|
}
|
|
}
|
|
}
|
|
const xu = {
|
|
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
|
|
KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
|
|
KHR_MATERIALS_IOR: "KHR_materials_ior",
|
|
KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
|
|
KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
|
|
KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
|
|
KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
|
|
KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
|
|
KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
|
|
KHR_MATERIALS_VOLUME: "KHR_materials_volume",
|
|
KHR_TEXTURE_BASISU: "KHR_texture_basisu",
|
|
KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
|
|
KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
|
|
KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
|
|
EXT_MATERIALS_BUMP: "EXT_materials_bump",
|
|
EXT_TEXTURE_WEBP: "EXT_texture_webp",
|
|
EXT_TEXTURE_AVIF: "EXT_texture_avif",
|
|
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
};
|
|
class bu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_LIGHTS_PUNCTUAL, this.cache = {
|
|
refs: {},
|
|
uses: {}
|
|
}
|
|
}
|
|
_markDefs() {
|
|
const e = this.parser,
|
|
t = this.parser.json.nodes || [];
|
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
const i = t[n];
|
|
i.extensions && i.extensions[this.name] && void 0 !== i.extensions[this.name].light && e._addNodeRef(this.cache, i.extensions[this.name].light)
|
|
}
|
|
}
|
|
_loadLight(e) {
|
|
const t = this.parser,
|
|
n = "light:" + e;
|
|
let i = t.cache.get(n);
|
|
if (i) return i;
|
|
const r = t.json,
|
|
a = ((r.extensions && r.extensions[this.name] || {}).lights || [])[e];
|
|
let s;
|
|
const o = new wi(16777215);
|
|
void 0 !== a.color && o.setRGB(a.color[0], a.color[1], a.color[2], Ke);
|
|
const l = void 0 !== a.range ? a.range : 0;
|
|
switch (a.type) {
|
|
case "directional":
|
|
s = new ms(o), s.target.position.set(0, 0, -1), s.add(s.target);
|
|
break;
|
|
case "point":
|
|
s = new ds(o), s.distance = l;
|
|
break;
|
|
case "spot":
|
|
s = new os(o), s.distance = l, a.spot = a.spot || {}, a.spot.innerConeAngle = void 0 !== a.spot.innerConeAngle ? a.spot.innerConeAngle : 0, a.spot.outerConeAngle = void 0 !== a.spot.outerConeAngle ? a.spot.outerConeAngle : Math.PI / 4, s.angle = a.spot.outerConeAngle, s.penumbra = 1 - a.spot.innerConeAngle / a.spot.outerConeAngle, s.target.position.set(0, 0, -1), s.add(s.target);
|
|
break;
|
|
default:
|
|
throw new Error("THREE.GLTFLoader: Unexpected light type: " + a.type)
|
|
}
|
|
return s.position.set(0, 0, 0), cd(s, a), void 0 !== a.intensity && (s.intensity = a.intensity), s.name = t.createUniqueName(a.name || "light_" + e), i = Promise.resolve(s), t.cache.add(n, i), i
|
|
}
|
|
getDependency(e, t) {
|
|
if ("light" === e) return this._loadLight(t)
|
|
}
|
|
createNodeAttachment(e) {
|
|
const t = this,
|
|
n = this.parser,
|
|
i = n.json.nodes[e],
|
|
r = (i.extensions && i.extensions[this.name] || {}).light;
|
|
return void 0 === r ? null : this._loadLight(r).then((function(e) {
|
|
return n._getNodeRef(t.cache, r, e)
|
|
}))
|
|
}
|
|
}
|
|
class Eu {
|
|
constructor() {
|
|
this.name = xu.KHR_MATERIALS_UNLIT
|
|
}
|
|
getMaterialType() {
|
|
return Ei
|
|
}
|
|
extendParams(e, t, n) {
|
|
const i = [];
|
|
e.color = new wi(1, 1, 1), e.opacity = 1;
|
|
const r = t.pbrMetallicRoughness;
|
|
if (r) {
|
|
if (Array.isArray(r.baseColorFactor)) {
|
|
const t = r.baseColorFactor;
|
|
e.color.setRGB(t[0], t[1], t[2], Ke), e.opacity = t[3]
|
|
}
|
|
void 0 !== r.baseColorTexture && i.push(n.assignTexture(e, "map", r.baseColorTexture, Ye))
|
|
}
|
|
return Promise.all(i)
|
|
}
|
|
}
|
|
class Su {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_EMISSIVE_STRENGTH
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser.json.materials[e];
|
|
if (!n.extensions || !n.extensions[this.name]) return Promise.resolve();
|
|
const i = n.extensions[this.name].emissiveStrength;
|
|
return void 0 !== i && (t.emissiveIntensity = i), Promise.resolve()
|
|
}
|
|
}
|
|
class Mu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_CLEARCOAT
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [],
|
|
a = i.extensions[this.name];
|
|
if (void 0 !== a.clearcoatFactor && (t.clearcoat = a.clearcoatFactor), void 0 !== a.clearcoatTexture && r.push(n.assignTexture(t, "clearcoatMap", a.clearcoatTexture)), void 0 !== a.clearcoatRoughnessFactor && (t.clearcoatRoughness = a.clearcoatRoughnessFactor), void 0 !== a.clearcoatRoughnessTexture && r.push(n.assignTexture(t, "clearcoatRoughnessMap", a.clearcoatRoughnessTexture)), void 0 !== a.clearcoatNormalTexture && (r.push(n.assignTexture(t, "clearcoatNormalMap", a.clearcoatNormalTexture)), void 0 !== a.clearcoatNormalTexture.scale)) {
|
|
const e = a.clearcoatNormalTexture.scale;
|
|
t.clearcoatNormalScale = new Et(e, e)
|
|
}
|
|
return Promise.all(r)
|
|
}
|
|
}
|
|
class Tu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_DISPERSION
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser.json.materials[e];
|
|
if (!n.extensions || !n.extensions[this.name]) return Promise.resolve();
|
|
const i = n.extensions[this.name];
|
|
return t.dispersion = void 0 !== i.dispersion ? i.dispersion : 0, Promise.resolve()
|
|
}
|
|
}
|
|
class Cu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_IRIDESCENCE
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [],
|
|
a = i.extensions[this.name];
|
|
return void 0 !== a.iridescenceFactor && (t.iridescence = a.iridescenceFactor), void 0 !== a.iridescenceTexture && r.push(n.assignTexture(t, "iridescenceMap", a.iridescenceTexture)), void 0 !== a.iridescenceIor && (t.iridescenceIOR = a.iridescenceIor), void 0 === t.iridescenceThicknessRange && (t.iridescenceThicknessRange = [100, 400]), void 0 !== a.iridescenceThicknessMinimum && (t.iridescenceThicknessRange[0] = a.iridescenceThicknessMinimum), void 0 !== a.iridescenceThicknessMaximum && (t.iridescenceThicknessRange[1] = a.iridescenceThicknessMaximum), void 0 !== a.iridescenceThicknessTexture && r.push(n.assignTexture(t, "iridescenceThicknessMap", a.iridescenceThicknessTexture)), Promise.all(r)
|
|
}
|
|
}
|
|
class Iu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_SHEEN
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [];
|
|
t.sheenColor = new wi(0, 0, 0), t.sheenRoughness = 0, t.sheen = 1;
|
|
const a = i.extensions[this.name];
|
|
if (void 0 !== a.sheenColorFactor) {
|
|
const e = a.sheenColorFactor;
|
|
t.sheenColor.setRGB(e[0], e[1], e[2], Ke)
|
|
}
|
|
return void 0 !== a.sheenRoughnessFactor && (t.sheenRoughness = a.sheenRoughnessFactor), void 0 !== a.sheenColorTexture && r.push(n.assignTexture(t, "sheenColorMap", a.sheenColorTexture, Ye)), void 0 !== a.sheenRoughnessTexture && r.push(n.assignTexture(t, "sheenRoughnessMap", a.sheenRoughnessTexture)), Promise.all(r)
|
|
}
|
|
}
|
|
class Ru {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_TRANSMISSION
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [],
|
|
a = i.extensions[this.name];
|
|
return void 0 !== a.transmissionFactor && (t.transmission = a.transmissionFactor), void 0 !== a.transmissionTexture && r.push(n.assignTexture(t, "transmissionMap", a.transmissionTexture)), Promise.all(r)
|
|
}
|
|
}
|
|
class Pu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_VOLUME
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [],
|
|
a = i.extensions[this.name];
|
|
t.thickness = void 0 !== a.thicknessFactor ? a.thicknessFactor : 0, void 0 !== a.thicknessTexture && r.push(n.assignTexture(t, "thicknessMap", a.thicknessTexture)), t.attenuationDistance = a.attenuationDistance || 1 / 0;
|
|
const s = a.attenuationColor || [1, 1, 1];
|
|
return t.attenuationColor = (new wi).setRGB(s[0], s[1], s[2], Ke), Promise.all(r)
|
|
}
|
|
}
|
|
class Bu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_IOR
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser.json.materials[e];
|
|
if (!n.extensions || !n.extensions[this.name]) return Promise.resolve();
|
|
const i = n.extensions[this.name];
|
|
return t.ior = void 0 !== i.ior ? i.ior : 1.5, Promise.resolve()
|
|
}
|
|
}
|
|
class Du {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_SPECULAR
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [],
|
|
a = i.extensions[this.name];
|
|
t.specularIntensity = void 0 !== a.specularFactor ? a.specularFactor : 1, void 0 !== a.specularTexture && r.push(n.assignTexture(t, "specularIntensityMap", a.specularTexture));
|
|
const s = a.specularColorFactor || [1, 1, 1];
|
|
return t.specularColor = (new wi).setRGB(s[0], s[1], s[2], Ke), void 0 !== a.specularColorTexture && r.push(n.assignTexture(t, "specularColorMap", a.specularColorTexture, Ye)), Promise.all(r)
|
|
}
|
|
}
|
|
class Lu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.EXT_MATERIALS_BUMP
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [],
|
|
a = i.extensions[this.name];
|
|
return t.bumpScale = void 0 !== a.bumpFactor ? a.bumpFactor : 1, void 0 !== a.bumpTexture && r.push(n.assignTexture(t, "bumpMap", a.bumpTexture)), Promise.all(r)
|
|
}
|
|
}
|
|
class Uu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_MATERIALS_ANISOTROPY
|
|
}
|
|
getMaterialType(e) {
|
|
const t = this.parser.json.materials[e];
|
|
return t.extensions && t.extensions[this.name] ? ba : null
|
|
}
|
|
extendMaterialParams(e, t) {
|
|
const n = this.parser,
|
|
i = n.json.materials[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return Promise.resolve();
|
|
const r = [],
|
|
a = i.extensions[this.name];
|
|
return void 0 !== a.anisotropyStrength && (t.anisotropy = a.anisotropyStrength), void 0 !== a.anisotropyRotation && (t.anisotropyRotation = a.anisotropyRotation), void 0 !== a.anisotropyTexture && r.push(n.assignTexture(t, "anisotropyMap", a.anisotropyTexture)), Promise.all(r)
|
|
}
|
|
}
|
|
class ku {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.KHR_TEXTURE_BASISU
|
|
}
|
|
loadTexture(e) {
|
|
const t = this.parser,
|
|
n = t.json,
|
|
i = n.textures[e];
|
|
if (!i.extensions || !i.extensions[this.name]) return null;
|
|
const r = i.extensions[this.name],
|
|
a = t.options.ktx2Loader;
|
|
if (!a) {
|
|
if (n.extensionsRequired && n.extensionsRequired.indexOf(this.name) >= 0) throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
return null
|
|
}
|
|
return t.loadTextureImage(e, r.source, a)
|
|
}
|
|
}
|
|
class Nu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.EXT_TEXTURE_WEBP, this.isSupported = null
|
|
}
|
|
loadTexture(e) {
|
|
const t = this.name,
|
|
n = this.parser,
|
|
i = n.json,
|
|
r = i.textures[e];
|
|
if (!r.extensions || !r.extensions[t]) return null;
|
|
const a = r.extensions[t],
|
|
s = i.images[a.source];
|
|
let o = n.textureLoader;
|
|
if (s.uri) {
|
|
const e = n.options.manager.getHandler(s.uri);
|
|
null !== e && (o = e)
|
|
}
|
|
return this.detectSupport().then((function(r) {
|
|
if (r) return n.loadTextureImage(e, a.source, o);
|
|
if (i.extensionsRequired && i.extensionsRequired.indexOf(t) >= 0) throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
return n.loadTexture(e)
|
|
}))
|
|
}
|
|
detectSupport() {
|
|
return this.isSupported || (this.isSupported = new Promise((function(e) {
|
|
const t = new Image;
|
|
t.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", t.onload = t.onerror = function() {
|
|
e(1 === t.height)
|
|
}
|
|
}))), this.isSupported
|
|
}
|
|
}
|
|
class Fu {
|
|
constructor(e) {
|
|
this.parser = e, this.name = xu.EXT_TEXTURE_AVIF, this.isSupported = null
|
|
}
|
|
loadTexture(e) {
|
|
const t = this.name,
|
|
n = this.parser,
|
|
i = n.json,
|
|
r = i.textures[e];
|
|
if (!r.extensions || !r.extensions[t]) return null;
|
|
const a = r.extensions[t],
|
|
s = i.images[a.source];
|
|
let o = n.textureLoader;
|
|
if (s.uri) {
|
|
const e = n.options.manager.getHandler(s.uri);
|
|
null !== e && (o = e)
|
|
}
|
|
return this.detectSupport().then((function(r) {
|
|
if (r) return n.loadTextureImage(e, a.source, o);
|
|
if (i.extensionsRequired && i.extensionsRequired.indexOf(t) >= 0) throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
return n.loadTexture(e)
|
|
}))
|
|
}
|
|
detectSupport() {
|
|
return this.isSupported || (this.isSupported = new Promise((function(e) {
|
|
const t = new Image;
|
|
t.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", t.onload = t.onerror = function() {
|
|
e(1 === t.height)
|
|
}
|
|
}))), this.isSupported
|
|
}
|
|
}
|
|
class Ou {
|
|
constructor(e) {
|
|
this.name = xu.EXT_MESHOPT_COMPRESSION, this.parser = e
|
|
}
|
|
loadBufferView(e) {
|
|
const t = this.parser.json,
|
|
n = t.bufferViews[e];
|
|
if (n.extensions && n.extensions[this.name]) {
|
|
const e = n.extensions[this.name],
|
|
i = this.parser.getDependency("buffer", e.buffer),
|
|
r = this.parser.options.meshoptDecoder;
|
|
if (!r || !r.supported) {
|
|
if (t.extensionsRequired && t.extensionsRequired.indexOf(this.name) >= 0) throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
return null
|
|
}
|
|
return i.then((function(t) {
|
|
const n = e.byteOffset || 0,
|
|
i = e.byteLength || 0,
|
|
a = e.count,
|
|
s = e.byteStride,
|
|
o = new Uint8Array(t, n, i);
|
|
return r.decodeGltfBufferAsync ? r.decodeGltfBufferAsync(a, s, o, e.mode, e.filter).then((function(e) {
|
|
return e.buffer
|
|
})) : r.ready.then((function() {
|
|
const t = new ArrayBuffer(a * s);
|
|
return r.decodeGltfBuffer(new Uint8Array(t), a, s, o, e.mode, e.filter), t
|
|
}))
|
|
}))
|
|
}
|
|
return null
|
|
}
|
|
}
|
|
class zu {
|
|
constructor(e) {
|
|
this.name = xu.EXT_MESH_GPU_INSTANCING, this.parser = e
|
|
}
|
|
createNodeMesh(e) {
|
|
const t = this.parser.json,
|
|
n = t.nodes[e];
|
|
if (!n.extensions || !n.extensions[this.name] || void 0 === n.mesh) return null;
|
|
const i = t.meshes[n.mesh];
|
|
for (const e of i.primitives)
|
|
if (e.mode !== Zu.TRIANGLES && e.mode !== Zu.TRIANGLE_STRIP && e.mode !== Zu.TRIANGLE_FAN && void 0 !== e.mode) return null;
|
|
const r = n.extensions[this.name].attributes,
|
|
a = [],
|
|
s = {};
|
|
for (const e in r) a.push(this.parser.getDependency("accessor", r[e]).then((t => (s[e] = t, s[e]))));
|
|
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(e)), Promise.all(a).then((e => {
|
|
const t = e.pop(),
|
|
n = t.isGroup ? t.children : [t],
|
|
i = e[0].count,
|
|
r = [];
|
|
for (const e of n) {
|
|
const t = new Cn,
|
|
n = new Zt,
|
|
a = new Kt,
|
|
o = new Zt(1, 1, 1),
|
|
l = new Qr(e.geometry, e.material, i);
|
|
for (let e = 0; e < i; e++) s.TRANSLATION && n.fromBufferAttribute(s.TRANSLATION, e), s.ROTATION && a.fromBufferAttribute(s.ROTATION, e), s.SCALE && o.fromBufferAttribute(s.SCALE, e), l.setMatrixAt(e, t.compose(n, a, o));
|
|
for (const t in s)
|
|
if ("_COLOR_0" === t) {
|
|
const e = s[t];
|
|
l.instanceColor = new Nr(e.array, e.itemSize, e.normalized)
|
|
} else "TRANSLATION" !== t && "ROTATION" !== t && "SCALE" !== t && e.geometry.setAttribute(t, s[t]);
|
|
ti.prototype.copy.call(l, e), this.parser.assignFinalMaterial(l), r.push(l)
|
|
}
|
|
return t.isGroup ? (t.clear(), t.add(...r), t) : r[0]
|
|
})))
|
|
}
|
|
}
|
|
const Wu = "glTF",
|
|
Hu = 1313821514,
|
|
Vu = 5130562;
|
|
class Gu {
|
|
constructor(e) {
|
|
this.name = xu.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
const t = new DataView(e, 0, 12),
|
|
n = new TextDecoder;
|
|
if (this.header = {
|
|
magic: n.decode(new Uint8Array(e.slice(0, 4))),
|
|
version: t.getUint32(4, !0),
|
|
length: t.getUint32(8, !0)
|
|
}, this.header.magic !== Wu) throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
if (this.header.version < 2) throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
const i = this.header.length - 12,
|
|
r = new DataView(e, 12);
|
|
let a = 0;
|
|
for (; a < i;) {
|
|
const t = r.getUint32(a, !0);
|
|
a += 4;
|
|
const i = r.getUint32(a, !0);
|
|
if (a += 4, i === Hu) {
|
|
const i = new Uint8Array(e, 12 + a, t);
|
|
this.content = n.decode(i)
|
|
} else if (i === Vu) {
|
|
const n = 12 + a;
|
|
this.body = e.slice(n, n + t)
|
|
}
|
|
a += t
|
|
}
|
|
if (null === this.content) throw new Error("THREE.GLTFLoader: JSON content not found.")
|
|
}
|
|
}
|
|
class Qu {
|
|
constructor(e, t) {
|
|
if (!t) throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
this.name = xu.KHR_DRACO_MESH_COMPRESSION, this.json = e, this.dracoLoader = t, this.dracoLoader.preload()
|
|
}
|
|
decodePrimitive(e, t) {
|
|
const n = this.json,
|
|
i = this.dracoLoader,
|
|
r = e.extensions[this.name].bufferView,
|
|
a = e.extensions[this.name].attributes,
|
|
s = {},
|
|
o = {},
|
|
l = {};
|
|
for (const e in a) {
|
|
const t = nd[e] || e.toLowerCase();
|
|
s[t] = a[e]
|
|
}
|
|
for (const t in e.attributes) {
|
|
const i = nd[t] || t.toLowerCase();
|
|
if (void 0 !== a[t]) {
|
|
const r = n.accessors[e.attributes[t]],
|
|
a = Ju[r.componentType];
|
|
l[i] = a.name, o[i] = !0 === r.normalized
|
|
}
|
|
}
|
|
return t.getDependency("bufferView", r).then((function(e) {
|
|
return new Promise((function(t, n) {
|
|
i.decodeDracoFile(e, (function(e) {
|
|
for (const t in e.attributes) {
|
|
const n = e.attributes[t],
|
|
i = o[t];
|
|
void 0 !== i && (n.normalized = i)
|
|
}
|
|
t(e)
|
|
}), s, l, Ke, n)
|
|
}))
|
|
}))
|
|
}
|
|
}
|
|
class Xu {
|
|
constructor() {
|
|
this.name = xu.KHR_TEXTURE_TRANSFORM
|
|
}
|
|
extendTexture(e, t) {
|
|
return void 0 !== t.texCoord && t.texCoord !== e.channel || void 0 !== t.offset || void 0 !== t.rotation || void 0 !== t.scale ? (e = e.clone(), void 0 !== t.texCoord && (e.channel = t.texCoord), void 0 !== t.offset && e.offset.fromArray(t.offset), void 0 !== t.rotation && (e.rotation = t.rotation), void 0 !== t.scale && e.repeat.fromArray(t.scale), e.needsUpdate = !0, e) : e
|
|
}
|
|
}
|
|
class ju {
|
|
constructor() {
|
|
this.name = xu.KHR_MESH_QUANTIZATION
|
|
}
|
|
}
|
|
class qu extends Pa {
|
|
constructor(e, t, n, i) {
|
|
super(e, t, n, i)
|
|
}
|
|
copySampleValue_(e) {
|
|
const t = this.resultBuffer,
|
|
n = this.sampleValues,
|
|
i = this.valueSize,
|
|
r = e * i * 3 + i;
|
|
for (let e = 0; e !== i; e++) t[e] = n[r + e];
|
|
return t
|
|
}
|
|
interpolate_(e, t, n, i) {
|
|
const r = this.resultBuffer,
|
|
a = this.sampleValues,
|
|
s = this.valueSize,
|
|
o = 2 * s,
|
|
l = 3 * s,
|
|
c = i - t,
|
|
h = (n - t) / c,
|
|
u = h * h,
|
|
d = u * h,
|
|
f = e * l,
|
|
p = f - l,
|
|
m = -2 * d + 3 * u,
|
|
g = d - u,
|
|
A = 1 - m,
|
|
_ = g - u + h;
|
|
for (let e = 0; e !== s; e++) {
|
|
const t = a[p + e + s],
|
|
n = a[p + e + o] * c,
|
|
i = a[f + e + s],
|
|
l = a[f + e] * c;
|
|
r[e] = A * t + _ * n + m * i + g * l
|
|
}
|
|
return r
|
|
}
|
|
}
|
|
const Yu = new Kt;
|
|
class Ku extends qu {
|
|
interpolate_(e, t, n, i) {
|
|
const r = super.interpolate_(e, t, n, i);
|
|
return Yu.fromArray(r).normalize().toArray(r), r
|
|
}
|
|
}
|
|
const Zu = {
|
|
FLOAT: 5126,
|
|
FLOAT_MAT3: 35675,
|
|
FLOAT_MAT4: 35676,
|
|
FLOAT_VEC2: 35664,
|
|
FLOAT_VEC3: 35665,
|
|
FLOAT_VEC4: 35666,
|
|
LINEAR: 9729,
|
|
REPEAT: 10497,
|
|
SAMPLER_2D: 35678,
|
|
POINTS: 0,
|
|
LINES: 1,
|
|
LINE_LOOP: 2,
|
|
LINE_STRIP: 3,
|
|
TRIANGLES: 4,
|
|
TRIANGLE_STRIP: 5,
|
|
TRIANGLE_FAN: 6,
|
|
UNSIGNED_BYTE: 5121,
|
|
UNSIGNED_SHORT: 5123
|
|
},
|
|
Ju = {
|
|
5120: Int8Array,
|
|
5121: Uint8Array,
|
|
5122: Int16Array,
|
|
5123: Uint16Array,
|
|
5125: Uint32Array,
|
|
5126: Float32Array
|
|
},
|
|
$u = {
|
|
9728: z,
|
|
9729: V,
|
|
9984: W,
|
|
9985: G,
|
|
9986: H,
|
|
9987: Q
|
|
},
|
|
ed = {
|
|
33071: F,
|
|
33648: O,
|
|
10497: N
|
|
},
|
|
td = {
|
|
SCALAR: 1,
|
|
VEC2: 2,
|
|
VEC3: 3,
|
|
VEC4: 4,
|
|
MAT2: 4,
|
|
MAT3: 9,
|
|
MAT4: 16
|
|
},
|
|
nd = {
|
|
POSITION: "position",
|
|
NORMAL: "normal",
|
|
TANGENT: "tangent",
|
|
TEXCOORD_0: "uv",
|
|
TEXCOORD_1: "uv1",
|
|
TEXCOORD_2: "uv2",
|
|
TEXCOORD_3: "uv3",
|
|
COLOR_0: "color",
|
|
WEIGHTS_0: "skinWeight",
|
|
JOINTS_0: "skinIndex"
|
|
},
|
|
id = {
|
|
scale: "scale",
|
|
translation: "position",
|
|
rotation: "quaternion",
|
|
weights: "morphTargetInfluences"
|
|
},
|
|
rd = {
|
|
CUBICSPLINE: void 0,
|
|
LINEAR: Ve,
|
|
STEP: He
|
|
},
|
|
ad = "OPAQUE",
|
|
sd = "MASK",
|
|
od = "BLEND";
|
|
|
|
function ld(e, t, n) {
|
|
for (const i in n.extensions) void 0 === e[i] && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[i] = n.extensions[i])
|
|
}
|
|
|
|
function cd(e, t) {
|
|
void 0 !== t.extras && ("object" == typeof t.extras ? Object.assign(e.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras))
|
|
}
|
|
|
|
function hd(e, t) {
|
|
if (e.updateMorphTargets(), void 0 !== t.weights)
|
|
for (let n = 0, i = t.weights.length; n < i; n++) e.morphTargetInfluences[n] = t.weights[n];
|
|
if (t.extras && Array.isArray(t.extras.targetNames)) {
|
|
const n = t.extras.targetNames;
|
|
if (e.morphTargetInfluences.length === n.length) {
|
|
e.morphTargetDictionary = {};
|
|
for (let t = 0, i = n.length; t < i; t++) e.morphTargetDictionary[n[t]] = t
|
|
} else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")
|
|
}
|
|
}
|
|
|
|
function ud(e) {
|
|
let t;
|
|
const n = e.extensions && e.extensions[xu.KHR_DRACO_MESH_COMPRESSION];
|
|
if (t = n ? "draco:" + n.bufferView + ":" + n.indices + ":" + dd(n.attributes) : e.indices + ":" + dd(e.attributes) + ":" + e.mode, void 0 !== e.targets)
|
|
for (let n = 0, i = e.targets.length; n < i; n++) t += ":" + dd(e.targets[n]);
|
|
return t
|
|
}
|
|
|
|
function dd(e) {
|
|
let t = "";
|
|
const n = Object.keys(e).sort();
|
|
for (let i = 0, r = n.length; i < r; i++) t += n[i] + ":" + e[n[i]] + ";";
|
|
return t
|
|
}
|
|
|
|
function fd(e) {
|
|
switch (e) {
|
|
case Int8Array:
|
|
return 1 / 127;
|
|
case Uint8Array:
|
|
return 1 / 255;
|
|
case Int16Array:
|
|
return 1 / 32767;
|
|
case Uint16Array:
|
|
return 1 / 65535;
|
|
default:
|
|
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")
|
|
}
|
|
}
|
|
const pd = new Cn;
|
|
class md {
|
|
constructor(e = {}, t = {}) {
|
|
this.json = e, this.extensions = {}, this.plugins = {}, this.options = t, this.cache = new yu, this.associations = new Map, this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = {
|
|
refs: {},
|
|
uses: {}
|
|
}, this.cameraCache = {
|
|
refs: {},
|
|
uses: {}
|
|
}, this.lightCache = {
|
|
refs: {},
|
|
uses: {}
|
|
}, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
|
|
let n = !1,
|
|
i = -1,
|
|
r = !1,
|
|
a = -1;
|
|
if ("undefined" != typeof navigator) {
|
|
const e = navigator.userAgent;
|
|
n = !0 === /^((?!chrome|android).)*safari/i.test(e);
|
|
const t = e.match(/Version\/(\d+)/);
|
|
i = n && t ? parseInt(t[1], 10) : -1, r = e.indexOf("Firefox") > -1, a = r ? e.match(/Firefox\/([0-9]+)\./)[1] : -1
|
|
}
|
|
"undefined" == typeof createImageBitmap || n && i < 17 || r && a < 98 ? this.textureLoader = new $a(this.options.manager) : this.textureLoader = new As(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new Za(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), "use-credentials" === this.options.crossOrigin && this.fileLoader.setWithCredentials(!0)
|
|
}
|
|
setExtensions(e) {
|
|
this.extensions = e
|
|
}
|
|
setPlugins(e) {
|
|
this.plugins = e
|
|
}
|
|
parse(e, t) {
|
|
const n = this,
|
|
i = this.json,
|
|
r = this.extensions;
|
|
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll((function(e) {
|
|
return e._markDefs && e._markDefs()
|
|
})), Promise.all(this._invokeAll((function(e) {
|
|
return e.beforeRoot && e.beforeRoot()
|
|
}))).then((function() {
|
|
return Promise.all([n.getDependencies("scene"), n.getDependencies("animation"), n.getDependencies("camera")])
|
|
})).then((function(t) {
|
|
const a = {
|
|
scene: t[0][i.scene || 0],
|
|
scenes: t[0],
|
|
animations: t[1],
|
|
cameras: t[2],
|
|
asset: i.asset,
|
|
parser: n,
|
|
userData: {}
|
|
};
|
|
return ld(r, a, i), cd(a, i), Promise.all(n._invokeAll((function(e) {
|
|
return e.afterRoot && e.afterRoot(a)
|
|
}))).then((function() {
|
|
for (const e of a.scenes) e.updateMatrixWorld();
|
|
e(a)
|
|
}))
|
|
})).catch(t)
|
|
}
|
|
_markDefs() {
|
|
const e = this.json.nodes || [],
|
|
t = this.json.skins || [],
|
|
n = this.json.meshes || [];
|
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
const i = t[n].joints;
|
|
for (let t = 0, n = i.length; t < n; t++) e[i[t]].isBone = !0
|
|
}
|
|
for (let t = 0, i = e.length; t < i; t++) {
|
|
const i = e[t];
|
|
void 0 !== i.mesh && (this._addNodeRef(this.meshCache, i.mesh), void 0 !== i.skin && (n[i.mesh].isSkinnedMesh = !0)), void 0 !== i.camera && this._addNodeRef(this.cameraCache, i.camera)
|
|
}
|
|
}
|
|
_addNodeRef(e, t) {
|
|
void 0 !== t && (void 0 === e.refs[t] && (e.refs[t] = e.uses[t] = 0), e.refs[t]++)
|
|
}
|
|
_getNodeRef(e, t, n) {
|
|
if (e.refs[t] <= 1) return n;
|
|
const i = n.clone(),
|
|
r = (e, t) => {
|
|
const n = this.associations.get(e);
|
|
null != n && this.associations.set(t, n);
|
|
for (const [n, i] of e.children.entries()) r(i, t.children[n])
|
|
};
|
|
return r(n, i), i.name += "_instance_" + e.uses[t]++, i
|
|
}
|
|
_invokeOne(e) {
|
|
const t = Object.values(this.plugins);
|
|
t.push(this);
|
|
for (let n = 0; n < t.length; n++) {
|
|
const i = e(t[n]);
|
|
if (i) return i
|
|
}
|
|
return null
|
|
}
|
|
_invokeAll(e) {
|
|
const t = Object.values(this.plugins);
|
|
t.unshift(this);
|
|
const n = [];
|
|
for (let i = 0; i < t.length; i++) {
|
|
const r = e(t[i]);
|
|
r && n.push(r)
|
|
}
|
|
return n
|
|
}
|
|
getDependency(e, t) {
|
|
const n = e + ":" + t;
|
|
let i = this.cache.get(n);
|
|
if (!i) {
|
|
switch (e) {
|
|
case "scene":
|
|
i = this.loadScene(t);
|
|
break;
|
|
case "node":
|
|
i = this._invokeOne((function(e) {
|
|
return e.loadNode && e.loadNode(t)
|
|
}));
|
|
break;
|
|
case "mesh":
|
|
i = this._invokeOne((function(e) {
|
|
return e.loadMesh && e.loadMesh(t)
|
|
}));
|
|
break;
|
|
case "accessor":
|
|
i = this.loadAccessor(t);
|
|
break;
|
|
case "bufferView":
|
|
i = this._invokeOne((function(e) {
|
|
return e.loadBufferView && e.loadBufferView(t)
|
|
}));
|
|
break;
|
|
case "buffer":
|
|
i = this.loadBuffer(t);
|
|
break;
|
|
case "material":
|
|
i = this._invokeOne((function(e) {
|
|
return e.loadMaterial && e.loadMaterial(t)
|
|
}));
|
|
break;
|
|
case "texture":
|
|
i = this._invokeOne((function(e) {
|
|
return e.loadTexture && e.loadTexture(t)
|
|
}));
|
|
break;
|
|
case "skin":
|
|
i = this.loadSkin(t);
|
|
break;
|
|
case "animation":
|
|
i = this._invokeOne((function(e) {
|
|
return e.loadAnimation && e.loadAnimation(t)
|
|
}));
|
|
break;
|
|
case "camera":
|
|
i = this.loadCamera(t);
|
|
break;
|
|
default:
|
|
if (i = this._invokeOne((function(n) {
|
|
return n != this && n.getDependency && n.getDependency(e, t)
|
|
})), !i) throw new Error("Unknown type: " + e)
|
|
}
|
|
this.cache.add(n, i)
|
|
}
|
|
return i
|
|
}
|
|
getDependencies(e) {
|
|
let t = this.cache.get(e);
|
|
if (!t) {
|
|
const n = this,
|
|
i = this.json[e + ("mesh" === e ? "es" : "s")] || [];
|
|
t = Promise.all(i.map((function(t, i) {
|
|
return n.getDependency(e, i)
|
|
}))), this.cache.add(e, t)
|
|
}
|
|
return t
|
|
}
|
|
loadBuffer(e) {
|
|
const t = this.json.buffers[e],
|
|
n = this.fileLoader;
|
|
if (t.type && "arraybuffer" !== t.type) throw new Error("THREE.GLTFLoader: " + t.type + " buffer type is not supported.");
|
|
if (void 0 === t.uri && 0 === e) return Promise.resolve(this.extensions[xu.KHR_BINARY_GLTF].body);
|
|
const i = this.options;
|
|
return new Promise((function(e, r) {
|
|
n.load(gs.resolveURL(t.uri, i.path), e, void 0, (function() {
|
|
r(new Error('THREE.GLTFLoader: Failed to load buffer "' + t.uri + '".'))
|
|
}))
|
|
}))
|
|
}
|
|
loadBufferView(e) {
|
|
const t = this.json.bufferViews[e];
|
|
return this.getDependency("buffer", t.buffer).then((function(e) {
|
|
const n = t.byteLength || 0,
|
|
i = t.byteOffset || 0;
|
|
return e.slice(i, i + n)
|
|
}))
|
|
}
|
|
loadAccessor(e) {
|
|
const t = this,
|
|
n = this.json,
|
|
i = this.json.accessors[e];
|
|
if (void 0 === i.bufferView && void 0 === i.sparse) {
|
|
const e = td[i.type],
|
|
t = Ju[i.componentType],
|
|
n = !0 === i.normalized,
|
|
r = new t(i.count * e);
|
|
return Promise.resolve(new Ci(r, e, n))
|
|
}
|
|
const r = [];
|
|
return void 0 !== i.bufferView ? r.push(this.getDependency("bufferView", i.bufferView)) : r.push(null), void 0 !== i.sparse && (r.push(this.getDependency("bufferView", i.sparse.indices.bufferView)), r.push(this.getDependency("bufferView", i.sparse.values.bufferView))), Promise.all(r).then((function(e) {
|
|
const r = e[0],
|
|
a = td[i.type],
|
|
s = Ju[i.componentType],
|
|
o = s.BYTES_PER_ELEMENT,
|
|
l = o * a,
|
|
c = i.byteOffset || 0,
|
|
h = void 0 !== i.bufferView ? n.bufferViews[i.bufferView].byteStride : void 0,
|
|
u = !0 === i.normalized;
|
|
let d, f;
|
|
if (h && h !== l) {
|
|
const e = Math.floor(c / h),
|
|
n = "InterleavedBuffer:" + i.bufferView + ":" + i.componentType + ":" + e + ":" + i.count;
|
|
let l = t.cache.get(n);
|
|
l || (d = new s(r, e * h, i.count * h / o), l = new vr(d, h / o), t.cache.add(n, l)), f = new yr(l, a, c % h / o, u)
|
|
} else d = null === r ? new s(i.count * a) : new s(r, c, i.count * a), f = new Ci(d, a, u);
|
|
if (void 0 !== i.sparse) {
|
|
const t = td.SCALAR,
|
|
n = Ju[i.sparse.indices.componentType],
|
|
o = i.sparse.indices.byteOffset || 0,
|
|
l = i.sparse.values.byteOffset || 0,
|
|
c = new n(e[1], o, i.sparse.count * t),
|
|
h = new s(e[2], l, i.sparse.count * a);
|
|
null !== r && (f = new Ci(f.array.slice(), f.itemSize, f.normalized)), f.normalized = !1;
|
|
for (let e = 0, t = c.length; e < t; e++) {
|
|
const t = c[e];
|
|
if (f.setX(t, h[e * a]), a >= 2 && f.setY(t, h[e * a + 1]), a >= 3 && f.setZ(t, h[e * a + 2]), a >= 4 && f.setW(t, h[e * a + 3]), a >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")
|
|
}
|
|
f.normalized = u
|
|
}
|
|
return f
|
|
}))
|
|
}
|
|
loadTexture(e) {
|
|
const t = this.json,
|
|
n = this.options,
|
|
i = t.textures[e].source,
|
|
r = t.images[i];
|
|
let a = this.textureLoader;
|
|
if (r.uri) {
|
|
const e = n.manager.getHandler(r.uri);
|
|
null !== e && (a = e)
|
|
}
|
|
return this.loadTextureImage(e, i, a)
|
|
}
|
|
loadTextureImage(e, t, n) {
|
|
const i = this,
|
|
r = this.json,
|
|
a = r.textures[e],
|
|
s = r.images[t],
|
|
o = (s.uri || s.bufferView) + ":" + a.sampler;
|
|
if (this.textureCache[o]) return this.textureCache[o];
|
|
const l = this.loadImageSource(t, n).then((function(t) {
|
|
t.flipY = !1, t.name = a.name || s.name || "", "" === t.name && "string" == typeof s.uri && !1 === s.uri.startsWith("data:image/") && (t.name = s.uri);
|
|
const n = (r.samplers || {})[a.sampler] || {};
|
|
return t.magFilter = $u[n.magFilter] || V, t.minFilter = $u[n.minFilter] || Q, t.wrapS = ed[n.wrapS] || N, t.wrapT = ed[n.wrapT] || N, t.generateMipmaps = !t.isCompressedTexture && t.minFilter !== z && t.minFilter !== V, i.associations.set(t, {
|
|
textures: e
|
|
}), t
|
|
})).catch((function() {
|
|
return null
|
|
}));
|
|
return this.textureCache[o] = l, l
|
|
}
|
|
loadImageSource(e, t) {
|
|
const n = this,
|
|
i = this.json,
|
|
r = this.options;
|
|
if (void 0 !== this.sourceCache[e]) return this.sourceCache[e].then((e => e.clone()));
|
|
const a = i.images[e],
|
|
s = self.URL || self.webkitURL;
|
|
let o = a.uri || "",
|
|
l = !1;
|
|
if (void 0 !== a.bufferView) o = n.getDependency("bufferView", a.bufferView).then((function(e) {
|
|
l = !0;
|
|
const t = new Blob([e], {
|
|
type: a.mimeType
|
|
});
|
|
return o = s.createObjectURL(t), o
|
|
}));
|
|
else if (void 0 === a.uri) throw new Error("THREE.GLTFLoader: Image " + e + " is missing URI and bufferView");
|
|
const c = Promise.resolve(o).then((function(e) {
|
|
return new Promise((function(n, i) {
|
|
let a = n;
|
|
!0 === t.isImageBitmapLoader && (a = function(e) {
|
|
const t = new Gt(e);
|
|
t.needsUpdate = !0, n(t)
|
|
}), t.load(gs.resolveURL(e, r.path), a, void 0, i)
|
|
}))
|
|
})).then((function(e) {
|
|
var t;
|
|
return !0 === l && s.revokeObjectURL(o), cd(e, a), e.userData.mimeType = a.mimeType || ((t = a.uri).search(/\.jpe?g($|\?)/i) > 0 || 0 === t.search(/^data\:image\/jpeg/) ? "image/jpeg" : t.search(/\.webp($|\?)/i) > 0 || 0 === t.search(/^data\:image\/webp/) ? "image/webp" : t.search(/\.ktx2($|\?)/i) > 0 || 0 === t.search(/^data\:image\/ktx2/) ? "image/ktx2" : "image/png"), e
|
|
})).catch((function(e) {
|
|
throw console.error("THREE.GLTFLoader: Couldn't load texture", o), e
|
|
}));
|
|
return this.sourceCache[e] = c, c
|
|
}
|
|
assignTexture(e, t, n, i) {
|
|
const r = this;
|
|
return this.getDependency("texture", n.index).then((function(a) {
|
|
if (!a) return null;
|
|
if (void 0 !== n.texCoord && n.texCoord > 0 && ((a = a.clone()).channel = n.texCoord), r.extensions[xu.KHR_TEXTURE_TRANSFORM]) {
|
|
const e = void 0 !== n.extensions ? n.extensions[xu.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
if (e) {
|
|
const t = r.associations.get(a);
|
|
a = r.extensions[xu.KHR_TEXTURE_TRANSFORM].extendTexture(a, e), r.associations.set(a, t)
|
|
}
|
|
}
|
|
return void 0 !== i && (a.colorSpace = i), e[t] = a, a
|
|
}))
|
|
}
|
|
assignFinalMaterial(e) {
|
|
const t = e.geometry;
|
|
let n = e.material;
|
|
const i = void 0 === t.attributes.tangent,
|
|
r = void 0 !== t.attributes.color,
|
|
a = void 0 === t.attributes.normal;
|
|
if (e.isPoints) {
|
|
const e = "PointsMaterial:" + n.uuid;
|
|
let t = this.cache.get(e);
|
|
t || (t = new fa, bi.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, t.sizeAttenuation = !1, this.cache.add(e, t)), n = t
|
|
} else if (e.isLine) {
|
|
const e = "LineBasicMaterial:" + n.uuid;
|
|
let t = this.cache.get(e);
|
|
t || (t = new $r, bi.prototype.copy.call(t, n), t.color.copy(n.color), t.map = n.map, this.cache.add(e, t)), n = t
|
|
}
|
|
if (i || r || a) {
|
|
let e = "ClonedMaterial:" + n.uuid + ":";
|
|
i && (e += "derivative-tangents:"), r && (e += "vertex-colors:"), a && (e += "flat-shading:");
|
|
let t = this.cache.get(e);
|
|
t || (t = n.clone(), r && (t.vertexColors = !0), a && (t.flatShading = !0), i && (t.normalScale && (t.normalScale.y *= -1), t.clearcoatNormalScale && (t.clearcoatNormalScale.y *= -1)), this.cache.add(e, t), this.associations.set(t, this.associations.get(n))), n = t
|
|
}
|
|
e.material = n
|
|
}
|
|
getMaterialType() {
|
|
return xa
|
|
}
|
|
loadMaterial(e) {
|
|
const t = this,
|
|
n = this.json,
|
|
i = this.extensions,
|
|
r = n.materials[e];
|
|
let a;
|
|
const s = {},
|
|
o = [];
|
|
if ((r.extensions || {})[xu.KHR_MATERIALS_UNLIT]) {
|
|
const e = i[xu.KHR_MATERIALS_UNLIT];
|
|
a = e.getMaterialType(), o.push(e.extendParams(s, r, t))
|
|
} else {
|
|
const n = r.pbrMetallicRoughness || {};
|
|
if (s.color = new wi(1, 1, 1), s.opacity = 1, Array.isArray(n.baseColorFactor)) {
|
|
const e = n.baseColorFactor;
|
|
s.color.setRGB(e[0], e[1], e[2], Ke), s.opacity = e[3]
|
|
}
|
|
void 0 !== n.baseColorTexture && o.push(t.assignTexture(s, "map", n.baseColorTexture, Ye)), s.metalness = void 0 !== n.metallicFactor ? n.metallicFactor : 1, s.roughness = void 0 !== n.roughnessFactor ? n.roughnessFactor : 1, void 0 !== n.metallicRoughnessTexture && (o.push(t.assignTexture(s, "metalnessMap", n.metallicRoughnessTexture)), o.push(t.assignTexture(s, "roughnessMap", n.metallicRoughnessTexture))), a = this._invokeOne((function(t) {
|
|
return t.getMaterialType && t.getMaterialType(e)
|
|
})), o.push(Promise.all(this._invokeAll((function(t) {
|
|
return t.extendMaterialParams && t.extendMaterialParams(e, s)
|
|
}))))
|
|
}!0 === r.doubleSided && (s.side = 2);
|
|
const l = r.alphaMode || ad;
|
|
if (l === od ? (s.transparent = !0, s.depthWrite = !1) : (s.transparent = !1, l === sd && (s.alphaTest = void 0 !== r.alphaCutoff ? r.alphaCutoff : .5)), void 0 !== r.normalTexture && a !== Ei && (o.push(t.assignTexture(s, "normalMap", r.normalTexture)), s.normalScale = new Et(1, 1), void 0 !== r.normalTexture.scale)) {
|
|
const e = r.normalTexture.scale;
|
|
s.normalScale.set(e, e)
|
|
}
|
|
if (void 0 !== r.occlusionTexture && a !== Ei && (o.push(t.assignTexture(s, "aoMap", r.occlusionTexture)), void 0 !== r.occlusionTexture.strength && (s.aoMapIntensity = r.occlusionTexture.strength)), void 0 !== r.emissiveFactor && a !== Ei) {
|
|
const e = r.emissiveFactor;
|
|
s.emissive = (new wi).setRGB(e[0], e[1], e[2], Ke)
|
|
}
|
|
return void 0 !== r.emissiveTexture && a !== Ei && o.push(t.assignTexture(s, "emissiveMap", r.emissiveTexture, Ye)), Promise.all(o).then((function() {
|
|
const n = new a(s);
|
|
return r.name && (n.name = r.name), cd(n, r), t.associations.set(n, {
|
|
materials: e
|
|
}), r.extensions && ld(i, n, r), n
|
|
}))
|
|
}
|
|
createUniqueName(e) {
|
|
const t = Ss.sanitizeNodeName(e || "");
|
|
return t in this.nodeNamesUsed ? t + "_" + ++this.nodeNamesUsed[t] : (this.nodeNamesUsed[t] = 0, t)
|
|
}
|
|
loadGeometries(e) {
|
|
const t = this,
|
|
n = this.extensions,
|
|
i = this.primitiveCache;
|
|
|
|
function r(e) {
|
|
return n[xu.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e, t).then((function(n) {
|
|
return gd(n, e, t)
|
|
}))
|
|
}
|
|
const a = [];
|
|
for (let n = 0, s = e.length; n < s; n++) {
|
|
const s = e[n],
|
|
o = ud(s),
|
|
l = i[o];
|
|
if (l) a.push(l.promise);
|
|
else {
|
|
let e;
|
|
e = s.extensions && s.extensions[xu.KHR_DRACO_MESH_COMPRESSION] ? r(s) : gd(new Oi, s, t), i[o] = {
|
|
primitive: s,
|
|
promise: e
|
|
}, a.push(e)
|
|
}
|
|
}
|
|
return Promise.all(a)
|
|
}
|
|
loadMesh(e) {
|
|
const t = this,
|
|
n = this.json,
|
|
i = this.extensions,
|
|
r = n.meshes[e],
|
|
a = r.primitives,
|
|
s = [];
|
|
for (let e = 0, t = a.length; e < t; e++) {
|
|
const t = void 0 === a[e].material ? (void 0 === (o = this.cache).DefaultMaterial && (o.DefaultMaterial = new xa({
|
|
color: 16777215,
|
|
emissive: 0,
|
|
metalness: 1,
|
|
roughness: 1,
|
|
transparent: !1,
|
|
depthTest: !0,
|
|
side: 0
|
|
})), o.DefaultMaterial) : this.getDependency("material", a[e].material);
|
|
s.push(t)
|
|
}
|
|
var o;
|
|
return s.push(t.loadGeometries(a)), Promise.all(s).then((function(n) {
|
|
const s = n.slice(0, n.length - 1),
|
|
o = n[n.length - 1],
|
|
l = [];
|
|
for (let n = 0, c = o.length; n < c; n++) {
|
|
const c = o[n],
|
|
h = a[n];
|
|
let u;
|
|
const d = s[n];
|
|
if (h.mode === Zu.TRIANGLES || h.mode === Zu.TRIANGLE_STRIP || h.mode === Zu.TRIANGLE_FAN || void 0 === h.mode) u = !0 === r.isSkinnedMesh ? new Pr(c, d) : new Zi(c, d), !0 === u.isSkinnedMesh && u.normalizeSkinWeights(), h.mode === Zu.TRIANGLE_STRIP ? u.geometry = vu(u.geometry, 1) : h.mode === Zu.TRIANGLE_FAN && (u.geometry = vu(u.geometry, 2));
|
|
else if (h.mode === Zu.LINES) u = new ua(c, d);
|
|
else if (h.mode === Zu.LINE_STRIP) u = new oa(c, d);
|
|
else if (h.mode === Zu.LINE_LOOP) u = new da(c, d);
|
|
else {
|
|
if (h.mode !== Zu.POINTS) throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + h.mode);
|
|
u = new _a(c, d)
|
|
}
|
|
Object.keys(u.geometry.morphAttributes).length > 0 && hd(u, r), u.name = t.createUniqueName(r.name || "mesh_" + e), cd(u, r), h.extensions && ld(i, u, h), t.assignFinalMaterial(u), l.push(u)
|
|
}
|
|
for (let n = 0, i = l.length; n < i; n++) t.associations.set(l[n], {
|
|
meshes: e,
|
|
primitives: n
|
|
});
|
|
if (1 === l.length) return r.extensions && ld(i, l[0], r), l[0];
|
|
const c = new pr;
|
|
r.extensions && ld(i, c, r), t.associations.set(c, {
|
|
meshes: e
|
|
});
|
|
for (let e = 0, t = l.length; e < t; e++) c.add(l[e]);
|
|
return c
|
|
}))
|
|
}
|
|
loadCamera(e) {
|
|
let t;
|
|
const n = this.json.cameras[e],
|
|
i = n[n.type];
|
|
if (i) return "perspective" === n.type ? t = new cr(bt.radToDeg(i.yfov), i.aspectRatio || 1, i.znear || 1, i.zfar || 2e6) : "orthographic" === n.type && (t = new fs(-i.xmag, i.xmag, i.ymag, -i.ymag, i.znear, i.zfar)), n.name && (t.name = this.createUniqueName(n.name)), cd(t, n), Promise.resolve(t);
|
|
console.warn("THREE.GLTFLoader: Missing camera parameters.")
|
|
}
|
|
loadSkin(e) {
|
|
const t = this.json.skins[e],
|
|
n = [];
|
|
for (let e = 0, i = t.joints.length; e < i; e++) n.push(this._loadNodeShallow(t.joints[e]));
|
|
return void 0 !== t.inverseBindMatrices ? n.push(this.getDependency("accessor", t.inverseBindMatrices)) : n.push(null), Promise.all(n).then((function(e) {
|
|
const n = e.pop(),
|
|
i = e,
|
|
r = [],
|
|
a = [];
|
|
for (let e = 0, s = i.length; e < s; e++) {
|
|
const s = i[e];
|
|
if (s) {
|
|
r.push(s);
|
|
const t = new Cn;
|
|
null !== n && t.fromArray(n.array, 16 * e), a.push(t)
|
|
} else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', t.joints[e])
|
|
}
|
|
return new kr(r, a)
|
|
}))
|
|
}
|
|
loadAnimation(e) {
|
|
const t = this.json,
|
|
n = this,
|
|
i = t.animations[e],
|
|
r = i.name ? i.name : "animation_" + e,
|
|
a = [],
|
|
s = [],
|
|
o = [],
|
|
l = [],
|
|
c = [];
|
|
for (let e = 0, t = i.channels.length; e < t; e++) {
|
|
const t = i.channels[e],
|
|
n = i.samplers[t.sampler],
|
|
r = t.target,
|
|
h = r.node,
|
|
u = void 0 !== i.parameters ? i.parameters[n.input] : n.input,
|
|
d = void 0 !== i.parameters ? i.parameters[n.output] : n.output;
|
|
void 0 !== r.node && (a.push(this.getDependency("node", h)), s.push(this.getDependency("accessor", u)), o.push(this.getDependency("accessor", d)), l.push(n), c.push(r))
|
|
}
|
|
return Promise.all([Promise.all(a), Promise.all(s), Promise.all(o), Promise.all(l), Promise.all(c)]).then((function(e) {
|
|
const t = e[0],
|
|
i = e[1],
|
|
a = e[2],
|
|
s = e[3],
|
|
o = e[4],
|
|
l = [];
|
|
for (let e = 0, r = t.length; e < r; e++) {
|
|
const r = t[e],
|
|
c = i[e],
|
|
h = a[e],
|
|
u = s[e],
|
|
d = o[e];
|
|
if (void 0 === r) continue;
|
|
r.updateMatrix && r.updateMatrix();
|
|
const f = n._createAnimationTracks(r, c, h, u, d);
|
|
if (f)
|
|
for (let e = 0; e < f.length; e++) l.push(f[e])
|
|
}
|
|
return new Va(r, void 0, l)
|
|
}))
|
|
}
|
|
createNodeMesh(e) {
|
|
const t = this.json,
|
|
n = this,
|
|
i = t.nodes[e];
|
|
return void 0 === i.mesh ? null : n.getDependency("mesh", i.mesh).then((function(e) {
|
|
const t = n._getNodeRef(n.meshCache, i.mesh, e);
|
|
return void 0 !== i.weights && t.traverse((function(e) {
|
|
if (e.isMesh)
|
|
for (let t = 0, n = i.weights.length; t < n; t++) e.morphTargetInfluences[t] = i.weights[t]
|
|
})), t
|
|
}))
|
|
}
|
|
loadNode(e) {
|
|
const t = this,
|
|
n = this.json.nodes[e],
|
|
i = t._loadNodeShallow(e),
|
|
r = [],
|
|
a = n.children || [];
|
|
for (let e = 0, n = a.length; e < n; e++) r.push(t.getDependency("node", a[e]));
|
|
const s = void 0 === n.skin ? Promise.resolve(null) : t.getDependency("skin", n.skin);
|
|
return Promise.all([i, Promise.all(r), s]).then((function(e) {
|
|
const t = e[0],
|
|
n = e[1],
|
|
i = e[2];
|
|
null !== i && t.traverse((function(e) {
|
|
e.isSkinnedMesh && e.bind(i, pd)
|
|
}));
|
|
for (let e = 0, i = n.length; e < i; e++) t.add(n[e]);
|
|
return t
|
|
}))
|
|
}
|
|
_loadNodeShallow(e) {
|
|
const t = this.json,
|
|
n = this.extensions,
|
|
i = this;
|
|
if (void 0 !== this.nodeCache[e]) return this.nodeCache[e];
|
|
const r = t.nodes[e],
|
|
a = r.name ? i.createUniqueName(r.name) : "",
|
|
s = [],
|
|
o = i._invokeOne((function(t) {
|
|
return t.createNodeMesh && t.createNodeMesh(e)
|
|
}));
|
|
return o && s.push(o), void 0 !== r.camera && s.push(i.getDependency("camera", r.camera).then((function(e) {
|
|
return i._getNodeRef(i.cameraCache, r.camera, e)
|
|
}))), i._invokeAll((function(t) {
|
|
return t.createNodeAttachment && t.createNodeAttachment(e)
|
|
})).forEach((function(e) {
|
|
s.push(e)
|
|
})), this.nodeCache[e] = Promise.all(s).then((function(t) {
|
|
let s;
|
|
if (s = !0 === r.isBone ? new Br : t.length > 1 ? new pr : 1 === t.length ? t[0] : new ti, s !== t[0])
|
|
for (let e = 0, n = t.length; e < n; e++) s.add(t[e]);
|
|
if (r.name && (s.userData.name = r.name, s.name = a), cd(s, r), r.extensions && ld(n, s, r), void 0 !== r.matrix) {
|
|
const e = new Cn;
|
|
e.fromArray(r.matrix), s.applyMatrix4(e)
|
|
} else void 0 !== r.translation && s.position.fromArray(r.translation), void 0 !== r.rotation && s.quaternion.fromArray(r.rotation), void 0 !== r.scale && s.scale.fromArray(r.scale);
|
|
return i.associations.has(s) || i.associations.set(s, {}), i.associations.get(s).nodes = e, s
|
|
})), this.nodeCache[e]
|
|
}
|
|
loadScene(e) {
|
|
const t = this.extensions,
|
|
n = this.json.scenes[e],
|
|
i = this,
|
|
r = new pr;
|
|
n.name && (r.name = i.createUniqueName(n.name)), cd(r, n), n.extensions && ld(t, r, n);
|
|
const a = n.nodes || [],
|
|
s = [];
|
|
for (let e = 0, t = a.length; e < t; e++) s.push(i.getDependency("node", a[e]));
|
|
return Promise.all(s).then((function(e) {
|
|
for (let t = 0, n = e.length; t < n; t++) r.add(e[t]);
|
|
return i.associations = (e => {
|
|
const t = new Map;
|
|
for (const [e, n] of i.associations)(e instanceof bi || e instanceof Gt) && t.set(e, n);
|
|
return e.traverse((e => {
|
|
const n = i.associations.get(e);
|
|
null != n && t.set(e, n)
|
|
})), t
|
|
})(r), r
|
|
}))
|
|
}
|
|
_createAnimationTracks(e, t, n, i, r) {
|
|
const a = [],
|
|
s = e.name ? e.name : e.uuid,
|
|
o = [];
|
|
let l;
|
|
switch (id[r.path] === id.weights ? e.traverse((function(e) {
|
|
e.morphTargetInfluences && o.push(e.name ? e.name : e.uuid)
|
|
})) : o.push(s), id[r.path]) {
|
|
case id.weights:
|
|
l = Fa;
|
|
break;
|
|
case id.rotation:
|
|
l = za;
|
|
break;
|
|
case id.position:
|
|
case id.scale:
|
|
l = Ha;
|
|
break;
|
|
default:
|
|
if (1 === n.itemSize) l = Fa;
|
|
else l = Ha
|
|
}
|
|
const c = void 0 !== i.interpolation ? rd[i.interpolation] : Ve,
|
|
h = this._getArrayFromAccessor(n);
|
|
for (let e = 0, n = o.length; e < n; e++) {
|
|
const n = new l(o[e] + "." + id[r.path], t.array, h, c);
|
|
"CUBICSPLINE" === i.interpolation && this._createCubicSplineTrackInterpolant(n), a.push(n)
|
|
}
|
|
return a
|
|
}
|
|
_getArrayFromAccessor(e) {
|
|
let t = e.array;
|
|
if (e.normalized) {
|
|
const e = fd(t.constructor),
|
|
n = new Float32Array(t.length);
|
|
for (let i = 0, r = t.length; i < r; i++) n[i] = t[i] * e;
|
|
t = n
|
|
}
|
|
return t
|
|
}
|
|
_createCubicSplineTrackInterpolant(e) {
|
|
e.createInterpolant = function(e) {
|
|
return new(this instanceof za ? Ku : qu)(this.times, this.values, this.getValueSize() / 3, e)
|
|
}, e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0
|
|
}
|
|
}
|
|
|
|
function gd(e, t, n) {
|
|
const i = t.attributes,
|
|
r = [];
|
|
|
|
function a(t, i) {
|
|
return n.getDependency("accessor", t).then((function(t) {
|
|
e.setAttribute(i, t)
|
|
}))
|
|
}
|
|
for (const t in i) {
|
|
const n = nd[t] || t.toLowerCase();
|
|
n in e.attributes || r.push(a(i[t], n))
|
|
}
|
|
if (void 0 !== t.indices && !e.index) {
|
|
const i = n.getDependency("accessor", t.indices).then((function(t) {
|
|
e.setIndex(t)
|
|
}));
|
|
r.push(i)
|
|
}
|
|
return Ut.workingColorSpace !== Ke && "COLOR_0" in i && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ut.workingColorSpace}" not supported.`), cd(e, t),
|
|
function(e, t, n) {
|
|
const i = t.attributes,
|
|
r = new en;
|
|
if (void 0 === i.POSITION) return;
|
|
{
|
|
const e = n.json.accessors[i.POSITION],
|
|
t = e.min,
|
|
a = e.max;
|
|
if (void 0 === t || void 0 === a) return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
if (r.set(new Zt(t[0], t[1], t[2]), new Zt(a[0], a[1], a[2])), e.normalized) {
|
|
const t = fd(Ju[e.componentType]);
|
|
r.min.multiplyScalar(t), r.max.multiplyScalar(t)
|
|
}
|
|
}
|
|
const a = t.targets;
|
|
if (void 0 !== a) {
|
|
const e = new Zt,
|
|
t = new Zt;
|
|
for (let i = 0, r = a.length; i < r; i++) {
|
|
const r = a[i];
|
|
if (void 0 !== r.POSITION) {
|
|
const i = n.json.accessors[r.POSITION],
|
|
a = i.min,
|
|
s = i.max;
|
|
if (void 0 !== a && void 0 !== s) {
|
|
if (t.setX(Math.max(Math.abs(a[0]), Math.abs(s[0]))), t.setY(Math.max(Math.abs(a[1]), Math.abs(s[1]))), t.setZ(Math.max(Math.abs(a[2]), Math.abs(s[2]))), i.normalized) {
|
|
const e = fd(Ju[i.componentType]);
|
|
t.multiplyScalar(e)
|
|
}
|
|
e.max(t)
|
|
} else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")
|
|
}
|
|
}
|
|
r.expandByVector(e)
|
|
}
|
|
e.boundingBox = r;
|
|
const s = new vn;
|
|
r.getCenter(s.center), s.radius = r.min.distanceTo(r.max) / 2, e.boundingSphere = s
|
|
}(e, t, n), Promise.all(r).then((function() {
|
|
return void 0 !== t.targets ? function(e, t, n) {
|
|
let i = !1,
|
|
r = !1,
|
|
a = !1;
|
|
for (let e = 0, n = t.length; e < n; e++) {
|
|
const n = t[e];
|
|
if (void 0 !== n.POSITION && (i = !0), void 0 !== n.NORMAL && (r = !0), void 0 !== n.COLOR_0 && (a = !0), i && r && a) break
|
|
}
|
|
if (!i && !r && !a) return Promise.resolve(e);
|
|
const s = [],
|
|
o = [],
|
|
l = [];
|
|
for (let c = 0, h = t.length; c < h; c++) {
|
|
const h = t[c];
|
|
if (i) {
|
|
const t = void 0 !== h.POSITION ? n.getDependency("accessor", h.POSITION) : e.attributes.position;
|
|
s.push(t)
|
|
}
|
|
if (r) {
|
|
const t = void 0 !== h.NORMAL ? n.getDependency("accessor", h.NORMAL) : e.attributes.normal;
|
|
o.push(t)
|
|
}
|
|
if (a) {
|
|
const t = void 0 !== h.COLOR_0 ? n.getDependency("accessor", h.COLOR_0) : e.attributes.color;
|
|
l.push(t)
|
|
}
|
|
}
|
|
return Promise.all([Promise.all(s), Promise.all(o), Promise.all(l)]).then((function(t) {
|
|
const n = t[0],
|
|
s = t[1],
|
|
o = t[2];
|
|
return i && (e.morphAttributes.position = n), r && (e.morphAttributes.normal = s), a && (e.morphAttributes.color = o), e.morphTargetsRelative = !0, e
|
|
}))
|
|
}(e, t.targets, n) : e
|
|
}))
|
|
}
|
|
/**
|
|
* @license
|
|
* Copyright 2010-2025 Three.js Authors
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
function Ad() {
|
|
let e = null,
|
|
t = !1,
|
|
n = null,
|
|
i = null;
|
|
|
|
function r(t, a) {
|
|
n(t, a), i = e.requestAnimationFrame(r)
|
|
}
|
|
return {
|
|
start: function() {
|
|
!0 !== t && null !== n && (i = e.requestAnimationFrame(r), t = !0)
|
|
},
|
|
stop: function() {
|
|
e.cancelAnimationFrame(i), t = !1
|
|
},
|
|
setAnimationLoop: function(e) {
|
|
n = e
|
|
},
|
|
setContext: function(t) {
|
|
e = t
|
|
}
|
|
}
|
|
}
|
|
|
|
function _d(e) {
|
|
const t = new WeakMap;
|
|
return {
|
|
get: function(e) {
|
|
return e.isInterleavedBufferAttribute && (e = e.data), t.get(e)
|
|
},
|
|
remove: function(n) {
|
|
n.isInterleavedBufferAttribute && (n = n.data);
|
|
const i = t.get(n);
|
|
i && (e.deleteBuffer(i.buffer), t.delete(n))
|
|
},
|
|
update: function(n, i) {
|
|
if (n.isInterleavedBufferAttribute && (n = n.data), n.isGLBufferAttribute) {
|
|
const e = t.get(n);
|
|
return void((!e || e.version < n.version) && t.set(n, {
|
|
buffer: n.buffer,
|
|
type: n.type,
|
|
bytesPerElement: n.elementSize,
|
|
version: n.version
|
|
}))
|
|
}
|
|
const r = t.get(n);
|
|
if (void 0 === r) t.set(n, function(t, n) {
|
|
const i = t.array,
|
|
r = t.usage,
|
|
a = i.byteLength,
|
|
s = e.createBuffer();
|
|
let o;
|
|
if (e.bindBuffer(n, s), e.bufferData(n, i, r), t.onUploadCallback(), i instanceof Float32Array) o = e.FLOAT;
|
|
else if (i instanceof Uint16Array) o = t.isFloat16BufferAttribute ? e.HALF_FLOAT : e.UNSIGNED_SHORT;
|
|
else if (i instanceof Int16Array) o = e.SHORT;
|
|
else if (i instanceof Uint32Array) o = e.UNSIGNED_INT;
|
|
else if (i instanceof Int32Array) o = e.INT;
|
|
else if (i instanceof Int8Array) o = e.BYTE;
|
|
else if (i instanceof Uint8Array) o = e.UNSIGNED_BYTE;
|
|
else {
|
|
if (!(i instanceof Uint8ClampedArray)) throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: " + i);
|
|
o = e.UNSIGNED_BYTE
|
|
}
|
|
return {
|
|
buffer: s,
|
|
type: o,
|
|
bytesPerElement: i.BYTES_PER_ELEMENT,
|
|
version: t.version,
|
|
size: a
|
|
}
|
|
}(n, i));
|
|
else if (r.version < n.version) {
|
|
if (r.size !== n.array.byteLength) throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");
|
|
! function(t, n, i) {
|
|
const r = n.array,
|
|
a = n.updateRanges;
|
|
if (e.bindBuffer(i, t), 0 === a.length) e.bufferSubData(i, 0, r);
|
|
else {
|
|
a.sort(((e, t) => e.start - t.start));
|
|
let t = 0;
|
|
for (let e = 1; e < a.length; e++) {
|
|
const n = a[t],
|
|
i = a[e];
|
|
i.start <= n.start + n.count + 1 ? n.count = Math.max(n.count, i.start + i.count - n.start) : (++t, a[t] = i)
|
|
}
|
|
a.length = t + 1;
|
|
for (let t = 0, n = a.length; t < n; t++) {
|
|
const n = a[t];
|
|
e.bufferSubData(i, n.start * r.BYTES_PER_ELEMENT, r, n.start, n.count)
|
|
}
|
|
n.clearUpdateRanges()
|
|
}
|
|
n.onUploadCallback()
|
|
}(r.buffer, n, i), r.version = n.version
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const vd = {
|
|
alphahash_fragment: "#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",
|
|
alphahash_pars_fragment: "#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",
|
|
alphamap_fragment: "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",
|
|
alphamap_pars_fragment: "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",
|
|
alphatest_fragment: "#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",
|
|
alphatest_pars_fragment: "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",
|
|
aomap_fragment: "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",
|
|
aomap_pars_fragment: "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",
|
|
batching_pars_vertex: "#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",
|
|
batching_vertex: "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",
|
|
begin_vertex: "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",
|
|
beginnormal_vertex: "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",
|
|
bsdfs: "float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",
|
|
iridescence_fragment: "#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",
|
|
bumpmap_pars_fragment: "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",
|
|
clipping_planes_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",
|
|
clipping_planes_pars_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",
|
|
clipping_planes_pars_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",
|
|
clipping_planes_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",
|
|
color_fragment: "#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",
|
|
color_pars_fragment: "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",
|
|
color_pars_vertex: "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",
|
|
color_vertex: "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",
|
|
common: "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",
|
|
cube_uv_reflection_fragment: "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",
|
|
defaultnormal_vertex: "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",
|
|
displacementmap_pars_vertex: "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",
|
|
displacementmap_vertex: "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",
|
|
emissivemap_fragment: "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",
|
|
emissivemap_pars_fragment: "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",
|
|
colorspace_fragment: "gl_FragColor = linearToOutputTexel( gl_FragColor );",
|
|
colorspace_pars_fragment: "vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",
|
|
envmap_fragment: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",
|
|
envmap_common_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",
|
|
envmap_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",
|
|
envmap_pars_vertex: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",
|
|
envmap_physical_pars_fragment: "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",
|
|
envmap_vertex: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",
|
|
fog_vertex: "#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",
|
|
fog_pars_vertex: "#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",
|
|
fog_fragment: "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",
|
|
fog_pars_fragment: "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",
|
|
gradientmap_pars_fragment: "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",
|
|
lightmap_pars_fragment: "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",
|
|
lights_lambert_fragment: "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",
|
|
lights_lambert_pars_fragment: "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",
|
|
lights_pars_begin: "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",
|
|
lights_toon_fragment: "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",
|
|
lights_toon_pars_fragment: "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",
|
|
lights_phong_fragment: "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",
|
|
lights_phong_pars_fragment: "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",
|
|
lights_physical_fragment: "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",
|
|
lights_physical_pars_fragment: "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",
|
|
lights_fragment_begin: "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",
|
|
lights_fragment_maps: "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",
|
|
lights_fragment_end: "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",
|
|
logdepthbuf_fragment: "#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",
|
|
logdepthbuf_pars_fragment: "#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",
|
|
logdepthbuf_pars_vertex: "#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",
|
|
logdepthbuf_vertex: "#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",
|
|
map_fragment: "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",
|
|
map_pars_fragment: "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",
|
|
map_particle_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",
|
|
map_particle_pars_fragment: "#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",
|
|
metalnessmap_fragment: "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",
|
|
metalnessmap_pars_fragment: "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",
|
|
morphinstance_vertex: "#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",
|
|
morphcolor_vertex: "#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",
|
|
morphnormal_vertex: "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",
|
|
morphtarget_pars_vertex: "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",
|
|
morphtarget_vertex: "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",
|
|
normal_fragment_begin: "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",
|
|
normal_fragment_maps: "#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",
|
|
normal_pars_fragment: "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",
|
|
normal_pars_vertex: "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",
|
|
normal_vertex: "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",
|
|
normalmap_pars_fragment: "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",
|
|
clearcoat_normal_fragment_begin: "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",
|
|
clearcoat_normal_fragment_maps: "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",
|
|
clearcoat_pars_fragment: "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",
|
|
iridescence_pars_fragment: "#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",
|
|
opaque_fragment: "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",
|
|
packing: "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",
|
|
premultiplied_alpha_fragment: "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",
|
|
project_vertex: "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",
|
|
dithering_fragment: "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",
|
|
dithering_pars_fragment: "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",
|
|
roughnessmap_fragment: "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",
|
|
roughnessmap_pars_fragment: "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",
|
|
shadowmap_pars_fragment: "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",
|
|
shadowmap_pars_vertex: "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",
|
|
shadowmap_vertex: "#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",
|
|
shadowmask_pars_fragment: "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",
|
|
skinbase_vertex: "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",
|
|
skinning_pars_vertex: "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",
|
|
skinning_vertex: "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",
|
|
skinnormal_vertex: "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",
|
|
specularmap_fragment: "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",
|
|
specularmap_pars_fragment: "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",
|
|
tonemapping_fragment: "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",
|
|
tonemapping_pars_fragment: "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",
|
|
transmission_fragment: "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",
|
|
transmission_pars_fragment: "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",
|
|
uv_pars_fragment: "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",
|
|
uv_pars_vertex: "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",
|
|
uv_vertex: "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",
|
|
worldpos_vertex: "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",
|
|
background_vert: "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",
|
|
background_frag: "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",
|
|
backgroundCube_vert: "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",
|
|
backgroundCube_frag: "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",
|
|
cube_vert: "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",
|
|
cube_frag: "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",
|
|
depth_vert: "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",
|
|
depth_frag: "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",
|
|
distanceRGBA_vert: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",
|
|
distanceRGBA_frag: "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",
|
|
equirect_vert: "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",
|
|
equirect_frag: "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",
|
|
linedashed_vert: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",
|
|
linedashed_frag: "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
|
|
meshbasic_vert: "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",
|
|
meshbasic_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
|
|
meshlambert_vert: "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
|
|
meshlambert_frag: "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
|
|
meshmatcap_vert: "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",
|
|
meshmatcap_frag: "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
|
|
meshnormal_vert: "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",
|
|
meshnormal_frag: "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",
|
|
meshphong_vert: "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
|
|
meshphong_frag: "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
|
|
meshphysical_vert: "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",
|
|
meshphysical_frag: "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
|
|
meshtoon_vert: "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
|
|
meshtoon_frag: "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
|
|
points_vert: "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",
|
|
points_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
|
|
shadow_vert: "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
|
|
shadow_frag: "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",
|
|
sprite_vert: "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",
|
|
sprite_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"
|
|
},
|
|
wd = {
|
|
common: {
|
|
diffuse: {
|
|
value: new wi(16777215)
|
|
},
|
|
opacity: {
|
|
value: 1
|
|
},
|
|
map: {
|
|
value: null
|
|
},
|
|
mapTransform: {
|
|
value: new St
|
|
},
|
|
alphaMap: {
|
|
value: null
|
|
},
|
|
alphaMapTransform: {
|
|
value: new St
|
|
},
|
|
alphaTest: {
|
|
value: 0
|
|
}
|
|
},
|
|
specularmap: {
|
|
specularMap: {
|
|
value: null
|
|
},
|
|
specularMapTransform: {
|
|
value: new St
|
|
}
|
|
},
|
|
envmap: {
|
|
envMap: {
|
|
value: null
|
|
},
|
|
envMapRotation: {
|
|
value: new St
|
|
},
|
|
flipEnvMap: {
|
|
value: -1
|
|
},
|
|
reflectivity: {
|
|
value: 1
|
|
},
|
|
ior: {
|
|
value: 1.5
|
|
},
|
|
refractionRatio: {
|
|
value: .98
|
|
}
|
|
},
|
|
aomap: {
|
|
aoMap: {
|
|
value: null
|
|
},
|
|
aoMapIntensity: {
|
|
value: 1
|
|
},
|
|
aoMapTransform: {
|
|
value: new St
|
|
}
|
|
},
|
|
lightmap: {
|
|
lightMap: {
|
|
value: null
|
|
},
|
|
lightMapIntensity: {
|
|
value: 1
|
|
},
|
|
lightMapTransform: {
|
|
value: new St
|
|
}
|
|
},
|
|
bumpmap: {
|
|
bumpMap: {
|
|
value: null
|
|
},
|
|
bumpMapTransform: {
|
|
value: new St
|
|
},
|
|
bumpScale: {
|
|
value: 1
|
|
}
|
|
},
|
|
normalmap: {
|
|
normalMap: {
|
|
value: null
|
|
},
|
|
normalMapTransform: {
|
|
value: new St
|
|
},
|
|
normalScale: {
|
|
value: new Et(1, 1)
|
|
}
|
|
},
|
|
displacementmap: {
|
|
displacementMap: {
|
|
value: null
|
|
},
|
|
displacementMapTransform: {
|
|
value: new St
|
|
},
|
|
displacementScale: {
|
|
value: 1
|
|
},
|
|
displacementBias: {
|
|
value: 0
|
|
}
|
|
},
|
|
emissivemap: {
|
|
emissiveMap: {
|
|
value: null
|
|
},
|
|
emissiveMapTransform: {
|
|
value: new St
|
|
}
|
|
},
|
|
metalnessmap: {
|
|
metalnessMap: {
|
|
value: null
|
|
},
|
|
metalnessMapTransform: {
|
|
value: new St
|
|
}
|
|
},
|
|
roughnessmap: {
|
|
roughnessMap: {
|
|
value: null
|
|
},
|
|
roughnessMapTransform: {
|
|
value: new St
|
|
}
|
|
},
|
|
gradientmap: {
|
|
gradientMap: {
|
|
value: null
|
|
}
|
|
},
|
|
fog: {
|
|
fogDensity: {
|
|
value: 25e-5
|
|
},
|
|
fogNear: {
|
|
value: 1
|
|
},
|
|
fogFar: {
|
|
value: 2e3
|
|
},
|
|
fogColor: {
|
|
value: new wi(16777215)
|
|
}
|
|
},
|
|
lights: {
|
|
ambientLightColor: {
|
|
value: []
|
|
},
|
|
lightProbe: {
|
|
value: []
|
|
},
|
|
directionalLights: {
|
|
value: [],
|
|
properties: {
|
|
direction: {},
|
|
color: {}
|
|
}
|
|
},
|
|
directionalLightShadows: {
|
|
value: [],
|
|
properties: {
|
|
shadowIntensity: 1,
|
|
shadowBias: {},
|
|
shadowNormalBias: {},
|
|
shadowRadius: {},
|
|
shadowMapSize: {}
|
|
}
|
|
},
|
|
directionalShadowMap: {
|
|
value: []
|
|
},
|
|
directionalShadowMatrix: {
|
|
value: []
|
|
},
|
|
spotLights: {
|
|
value: [],
|
|
properties: {
|
|
color: {},
|
|
position: {},
|
|
direction: {},
|
|
distance: {},
|
|
coneCos: {},
|
|
penumbraCos: {},
|
|
decay: {}
|
|
}
|
|
},
|
|
spotLightShadows: {
|
|
value: [],
|
|
properties: {
|
|
shadowIntensity: 1,
|
|
shadowBias: {},
|
|
shadowNormalBias: {},
|
|
shadowRadius: {},
|
|
shadowMapSize: {}
|
|
}
|
|
},
|
|
spotLightMap: {
|
|
value: []
|
|
},
|
|
spotShadowMap: {
|
|
value: []
|
|
},
|
|
spotLightMatrix: {
|
|
value: []
|
|
},
|
|
pointLights: {
|
|
value: [],
|
|
properties: {
|
|
color: {},
|
|
position: {},
|
|
decay: {},
|
|
distance: {}
|
|
}
|
|
},
|
|
pointLightShadows: {
|
|
value: [],
|
|
properties: {
|
|
shadowIntensity: 1,
|
|
shadowBias: {},
|
|
shadowNormalBias: {},
|
|
shadowRadius: {},
|
|
shadowMapSize: {},
|
|
shadowCameraNear: {},
|
|
shadowCameraFar: {}
|
|
}
|
|
},
|
|
pointShadowMap: {
|
|
value: []
|
|
},
|
|
pointShadowMatrix: {
|
|
value: []
|
|
},
|
|
hemisphereLights: {
|
|
value: [],
|
|
properties: {
|
|
direction: {},
|
|
skyColor: {},
|
|
groundColor: {}
|
|
}
|
|
},
|
|
rectAreaLights: {
|
|
value: [],
|
|
properties: {
|
|
color: {},
|
|
position: {},
|
|
width: {},
|
|
height: {}
|
|
}
|
|
},
|
|
ltc_1: {
|
|
value: null
|
|
},
|
|
ltc_2: {
|
|
value: null
|
|
}
|
|
},
|
|
points: {
|
|
diffuse: {
|
|
value: new wi(16777215)
|
|
},
|
|
opacity: {
|
|
value: 1
|
|
},
|
|
size: {
|
|
value: 1
|
|
},
|
|
scale: {
|
|
value: 1
|
|
},
|
|
map: {
|
|
value: null
|
|
},
|
|
alphaMap: {
|
|
value: null
|
|
},
|
|
alphaMapTransform: {
|
|
value: new St
|
|
},
|
|
alphaTest: {
|
|
value: 0
|
|
},
|
|
uvTransform: {
|
|
value: new St
|
|
}
|
|
},
|
|
sprite: {
|
|
diffuse: {
|
|
value: new wi(16777215)
|
|
},
|
|
opacity: {
|
|
value: 1
|
|
},
|
|
center: {
|
|
value: new Et(.5, .5)
|
|
},
|
|
rotation: {
|
|
value: 0
|
|
},
|
|
map: {
|
|
value: null
|
|
},
|
|
mapTransform: {
|
|
value: new St
|
|
},
|
|
alphaMap: {
|
|
value: null
|
|
},
|
|
alphaMapTransform: {
|
|
value: new St
|
|
},
|
|
alphaTest: {
|
|
value: 0
|
|
}
|
|
}
|
|
},
|
|
yd = {
|
|
basic: {
|
|
uniforms: tr([wd.common, wd.specularmap, wd.envmap, wd.aomap, wd.lightmap, wd.fog]),
|
|
vertexShader: vd.meshbasic_vert,
|
|
fragmentShader: vd.meshbasic_frag
|
|
},
|
|
lambert: {
|
|
uniforms: tr([wd.common, wd.specularmap, wd.envmap, wd.aomap, wd.lightmap, wd.emissivemap, wd.bumpmap, wd.normalmap, wd.displacementmap, wd.fog, wd.lights, {
|
|
emissive: {
|
|
value: new wi(0)
|
|
}
|
|
}]),
|
|
vertexShader: vd.meshlambert_vert,
|
|
fragmentShader: vd.meshlambert_frag
|
|
},
|
|
phong: {
|
|
uniforms: tr([wd.common, wd.specularmap, wd.envmap, wd.aomap, wd.lightmap, wd.emissivemap, wd.bumpmap, wd.normalmap, wd.displacementmap, wd.fog, wd.lights, {
|
|
emissive: {
|
|
value: new wi(0)
|
|
},
|
|
specular: {
|
|
value: new wi(1118481)
|
|
},
|
|
shininess: {
|
|
value: 30
|
|
}
|
|
}]),
|
|
vertexShader: vd.meshphong_vert,
|
|
fragmentShader: vd.meshphong_frag
|
|
},
|
|
standard: {
|
|
uniforms: tr([wd.common, wd.envmap, wd.aomap, wd.lightmap, wd.emissivemap, wd.bumpmap, wd.normalmap, wd.displacementmap, wd.roughnessmap, wd.metalnessmap, wd.fog, wd.lights, {
|
|
emissive: {
|
|
value: new wi(0)
|
|
},
|
|
roughness: {
|
|
value: 1
|
|
},
|
|
metalness: {
|
|
value: 0
|
|
},
|
|
envMapIntensity: {
|
|
value: 1
|
|
}
|
|
}]),
|
|
vertexShader: vd.meshphysical_vert,
|
|
fragmentShader: vd.meshphysical_frag
|
|
},
|
|
toon: {
|
|
uniforms: tr([wd.common, wd.aomap, wd.lightmap, wd.emissivemap, wd.bumpmap, wd.normalmap, wd.displacementmap, wd.gradientmap, wd.fog, wd.lights, {
|
|
emissive: {
|
|
value: new wi(0)
|
|
}
|
|
}]),
|
|
vertexShader: vd.meshtoon_vert,
|
|
fragmentShader: vd.meshtoon_frag
|
|
},
|
|
matcap: {
|
|
uniforms: tr([wd.common, wd.bumpmap, wd.normalmap, wd.displacementmap, wd.fog, {
|
|
matcap: {
|
|
value: null
|
|
}
|
|
}]),
|
|
vertexShader: vd.meshmatcap_vert,
|
|
fragmentShader: vd.meshmatcap_frag
|
|
},
|
|
points: {
|
|
uniforms: tr([wd.points, wd.fog]),
|
|
vertexShader: vd.points_vert,
|
|
fragmentShader: vd.points_frag
|
|
},
|
|
dashed: {
|
|
uniforms: tr([wd.common, wd.fog, {
|
|
scale: {
|
|
value: 1
|
|
},
|
|
dashSize: {
|
|
value: 1
|
|
},
|
|
totalSize: {
|
|
value: 2
|
|
}
|
|
}]),
|
|
vertexShader: vd.linedashed_vert,
|
|
fragmentShader: vd.linedashed_frag
|
|
},
|
|
depth: {
|
|
uniforms: tr([wd.common, wd.displacementmap]),
|
|
vertexShader: vd.depth_vert,
|
|
fragmentShader: vd.depth_frag
|
|
},
|
|
normal: {
|
|
uniforms: tr([wd.common, wd.bumpmap, wd.normalmap, wd.displacementmap, {
|
|
opacity: {
|
|
value: 1
|
|
}
|
|
}]),
|
|
vertexShader: vd.meshnormal_vert,
|
|
fragmentShader: vd.meshnormal_frag
|
|
},
|
|
sprite: {
|
|
uniforms: tr([wd.sprite, wd.fog]),
|
|
vertexShader: vd.sprite_vert,
|
|
fragmentShader: vd.sprite_frag
|
|
},
|
|
background: {
|
|
uniforms: {
|
|
uvTransform: {
|
|
value: new St
|
|
},
|
|
t2D: {
|
|
value: null
|
|
},
|
|
backgroundIntensity: {
|
|
value: 1
|
|
}
|
|
},
|
|
vertexShader: vd.background_vert,
|
|
fragmentShader: vd.background_frag
|
|
},
|
|
backgroundCube: {
|
|
uniforms: {
|
|
envMap: {
|
|
value: null
|
|
},
|
|
flipEnvMap: {
|
|
value: -1
|
|
},
|
|
backgroundBlurriness: {
|
|
value: 0
|
|
},
|
|
backgroundIntensity: {
|
|
value: 1
|
|
},
|
|
backgroundRotation: {
|
|
value: new St
|
|
}
|
|
},
|
|
vertexShader: vd.backgroundCube_vert,
|
|
fragmentShader: vd.backgroundCube_frag
|
|
},
|
|
cube: {
|
|
uniforms: {
|
|
tCube: {
|
|
value: null
|
|
},
|
|
tFlip: {
|
|
value: -1
|
|
},
|
|
opacity: {
|
|
value: 1
|
|
}
|
|
},
|
|
vertexShader: vd.cube_vert,
|
|
fragmentShader: vd.cube_frag
|
|
},
|
|
equirect: {
|
|
uniforms: {
|
|
tEquirect: {
|
|
value: null
|
|
}
|
|
},
|
|
vertexShader: vd.equirect_vert,
|
|
fragmentShader: vd.equirect_frag
|
|
},
|
|
distanceRGBA: {
|
|
uniforms: tr([wd.common, wd.displacementmap, {
|
|
referencePosition: {
|
|
value: new Zt
|
|
},
|
|
nearDistance: {
|
|
value: 1
|
|
},
|
|
farDistance: {
|
|
value: 1e3
|
|
}
|
|
}]),
|
|
vertexShader: vd.distanceRGBA_vert,
|
|
fragmentShader: vd.distanceRGBA_frag
|
|
},
|
|
shadow: {
|
|
uniforms: tr([wd.lights, wd.fog, {
|
|
color: {
|
|
value: new wi(0)
|
|
},
|
|
opacity: {
|
|
value: 1
|
|
}
|
|
}]),
|
|
vertexShader: vd.shadow_vert,
|
|
fragmentShader: vd.shadow_frag
|
|
}
|
|
};
|
|
yd.physical = {
|
|
uniforms: tr([yd.standard.uniforms, {
|
|
clearcoat: {
|
|
value: 0
|
|
},
|
|
clearcoatMap: {
|
|
value: null
|
|
},
|
|
clearcoatMapTransform: {
|
|
value: new St
|
|
},
|
|
clearcoatNormalMap: {
|
|
value: null
|
|
},
|
|
clearcoatNormalMapTransform: {
|
|
value: new St
|
|
},
|
|
clearcoatNormalScale: {
|
|
value: new Et(1, 1)
|
|
},
|
|
clearcoatRoughness: {
|
|
value: 0
|
|
},
|
|
clearcoatRoughnessMap: {
|
|
value: null
|
|
},
|
|
clearcoatRoughnessMapTransform: {
|
|
value: new St
|
|
},
|
|
dispersion: {
|
|
value: 0
|
|
},
|
|
iridescence: {
|
|
value: 0
|
|
},
|
|
iridescenceMap: {
|
|
value: null
|
|
},
|
|
iridescenceMapTransform: {
|
|
value: new St
|
|
},
|
|
iridescenceIOR: {
|
|
value: 1.3
|
|
},
|
|
iridescenceThicknessMinimum: {
|
|
value: 100
|
|
},
|
|
iridescenceThicknessMaximum: {
|
|
value: 400
|
|
},
|
|
iridescenceThicknessMap: {
|
|
value: null
|
|
},
|
|
iridescenceThicknessMapTransform: {
|
|
value: new St
|
|
},
|
|
sheen: {
|
|
value: 0
|
|
},
|
|
sheenColor: {
|
|
value: new wi(0)
|
|
},
|
|
sheenColorMap: {
|
|
value: null
|
|
},
|
|
sheenColorMapTransform: {
|
|
value: new St
|
|
},
|
|
sheenRoughness: {
|
|
value: 1
|
|
},
|
|
sheenRoughnessMap: {
|
|
value: null
|
|
},
|
|
sheenRoughnessMapTransform: {
|
|
value: new St
|
|
},
|
|
transmission: {
|
|
value: 0
|
|
},
|
|
transmissionMap: {
|
|
value: null
|
|
},
|
|
transmissionMapTransform: {
|
|
value: new St
|
|
},
|
|
transmissionSamplerSize: {
|
|
value: new Et
|
|
},
|
|
transmissionSamplerMap: {
|
|
value: null
|
|
},
|
|
thickness: {
|
|
value: 0
|
|
},
|
|
thicknessMap: {
|
|
value: null
|
|
},
|
|
thicknessMapTransform: {
|
|
value: new St
|
|
},
|
|
attenuationDistance: {
|
|
value: 0
|
|
},
|
|
attenuationColor: {
|
|
value: new wi(0)
|
|
},
|
|
specularColor: {
|
|
value: new wi(1, 1, 1)
|
|
},
|
|
specularColorMap: {
|
|
value: null
|
|
},
|
|
specularColorMapTransform: {
|
|
value: new St
|
|
},
|
|
specularIntensity: {
|
|
value: 1
|
|
},
|
|
specularIntensityMap: {
|
|
value: null
|
|
},
|
|
specularIntensityMapTransform: {
|
|
value: new St
|
|
},
|
|
anisotropyVector: {
|
|
value: new Et
|
|
},
|
|
anisotropyMap: {
|
|
value: null
|
|
},
|
|
anisotropyMapTransform: {
|
|
value: new St
|
|
}
|
|
}]),
|
|
vertexShader: vd.meshphysical_vert,
|
|
fragmentShader: vd.meshphysical_frag
|
|
};
|
|
const xd = {
|
|
r: 0,
|
|
b: 0,
|
|
g: 0
|
|
},
|
|
bd = new Fn,
|
|
Ed = new Cn;
|
|
|
|
function Sd(e, t, n, i, r, a, s) {
|
|
const o = new wi(0);
|
|
let l, c, h = !0 === a ? 0 : 1,
|
|
u = null,
|
|
d = 0,
|
|
f = null;
|
|
|
|
function p(e) {
|
|
let i = !0 === e.isScene ? e.background : null;
|
|
if (i && i.isTexture) {
|
|
i = (e.backgroundBlurriness > 0 ? n : t).get(i)
|
|
}
|
|
return i
|
|
}
|
|
|
|
function m(t, n) {
|
|
t.getRGB(xd, nr(e)), i.buffers.color.setClear(xd.r, xd.g, xd.b, n, s)
|
|
}
|
|
return {
|
|
getClearColor: function() {
|
|
return o
|
|
},
|
|
setClearColor: function(e, t = 1) {
|
|
o.set(e), h = t, m(o, h)
|
|
},
|
|
getClearAlpha: function() {
|
|
return h
|
|
},
|
|
setClearAlpha: function(e) {
|
|
h = e, m(o, h)
|
|
},
|
|
render: function(t) {
|
|
let n = !1;
|
|
const r = p(t);
|
|
null === r ? m(o, h) : r && r.isColor && (m(r, 1), n = !0);
|
|
const a = e.xr.getEnvironmentBlendMode();
|
|
"additive" === a ? i.buffers.color.setClear(0, 0, 0, 1, s) : "alpha-blend" === a && i.buffers.color.setClear(0, 0, 0, 0, s), (e.autoClear || n) && (i.buffers.depth.setTest(!0), i.buffers.depth.setMask(!0), i.buffers.color.setMask(!0), e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil))
|
|
},
|
|
addToRenderList: function(t, n) {
|
|
const i = p(n);
|
|
i && (i.isCubeTexture || i.mapping === k) ? (void 0 === c && (c = new Zi(new $i(1, 1, 1), new rr({
|
|
name: "BackgroundCubeMaterial",
|
|
uniforms: er(yd.backgroundCube.uniforms),
|
|
vertexShader: yd.backgroundCube.vertexShader,
|
|
fragmentShader: yd.backgroundCube.fragmentShader,
|
|
side: 1,
|
|
depthTest: !1,
|
|
depthWrite: !1,
|
|
fog: !1
|
|
})), c.geometry.deleteAttribute("normal"), c.geometry.deleteAttribute("uv"), c.onBeforeRender = function(e, t, n) {
|
|
this.matrixWorld.copyPosition(n.matrixWorld)
|
|
}, Object.defineProperty(c.material, "envMap", {
|
|
get: function() {
|
|
return this.uniforms.envMap.value
|
|
}
|
|
}), r.update(c)), bd.copy(n.backgroundRotation), bd.x *= -1, bd.y *= -1, bd.z *= -1, i.isCubeTexture && !1 === i.isRenderTargetTexture && (bd.y *= -1, bd.z *= -1), c.material.uniforms.envMap.value = i, c.material.uniforms.flipEnvMap.value = i.isCubeTexture && !1 === i.isRenderTargetTexture ? -1 : 1, c.material.uniforms.backgroundBlurriness.value = n.backgroundBlurriness, c.material.uniforms.backgroundIntensity.value = n.backgroundIntensity, c.material.uniforms.backgroundRotation.value.setFromMatrix4(Ed.makeRotationFromEuler(bd)), c.material.toneMapped = Ut.getTransfer(i.colorSpace) !== Je, u === i && d === i.version && f === e.toneMapping || (c.material.needsUpdate = !0, u = i, d = i.version, f = e.toneMapping), c.layers.enableAll(), t.unshift(c, c.geometry, c.material, 0, 0, null)) : i && i.isTexture && (void 0 === l && (l = new Zi(new ya(2, 2), new rr({
|
|
name: "BackgroundMaterial",
|
|
uniforms: er(yd.background.uniforms),
|
|
vertexShader: yd.background.vertexShader,
|
|
fragmentShader: yd.background.fragmentShader,
|
|
side: 0,
|
|
depthTest: !1,
|
|
depthWrite: !1,
|
|
fog: !1
|
|
})), l.geometry.deleteAttribute("normal"), Object.defineProperty(l.material, "map", {
|
|
get: function() {
|
|
return this.uniforms.t2D.value
|
|
}
|
|
}), r.update(l)), l.material.uniforms.t2D.value = i, l.material.uniforms.backgroundIntensity.value = n.backgroundIntensity, l.material.toneMapped = Ut.getTransfer(i.colorSpace) !== Je, !0 === i.matrixAutoUpdate && i.updateMatrix(), l.material.uniforms.uvTransform.value.copy(i.matrix), u === i && d === i.version && f === e.toneMapping || (l.material.needsUpdate = !0, u = i, d = i.version, f = e.toneMapping), l.layers.enableAll(), t.unshift(l, l.geometry, l.material, 0, 0, null))
|
|
},
|
|
dispose: function() {
|
|
void 0 !== c && (c.geometry.dispose(), c.material.dispose(), c = void 0), void 0 !== l && (l.geometry.dispose(), l.material.dispose(), l = void 0)
|
|
}
|
|
}
|
|
}
|
|
|
|
function Md(e, t) {
|
|
const n = e.getParameter(e.MAX_VERTEX_ATTRIBS),
|
|
i = {},
|
|
r = c(null);
|
|
let a = r,
|
|
s = !1;
|
|
|
|
function o(t) {
|
|
return e.bindVertexArray(t)
|
|
}
|
|
|
|
function l(t) {
|
|
return e.deleteVertexArray(t)
|
|
}
|
|
|
|
function c(e) {
|
|
const t = [],
|
|
i = [],
|
|
r = [];
|
|
for (let e = 0; e < n; e++) t[e] = 0, i[e] = 0, r[e] = 0;
|
|
return {
|
|
geometry: null,
|
|
program: null,
|
|
wireframe: !1,
|
|
newAttributes: t,
|
|
enabledAttributes: i,
|
|
attributeDivisors: r,
|
|
object: e,
|
|
attributes: {},
|
|
index: null
|
|
}
|
|
}
|
|
|
|
function h() {
|
|
const e = a.newAttributes;
|
|
for (let t = 0, n = e.length; t < n; t++) e[t] = 0
|
|
}
|
|
|
|
function u(e) {
|
|
d(e, 0)
|
|
}
|
|
|
|
function d(t, n) {
|
|
const i = a.newAttributes,
|
|
r = a.enabledAttributes,
|
|
s = a.attributeDivisors;
|
|
i[t] = 1, 0 === r[t] && (e.enableVertexAttribArray(t), r[t] = 1), s[t] !== n && (e.vertexAttribDivisor(t, n), s[t] = n)
|
|
}
|
|
|
|
function f() {
|
|
const t = a.newAttributes,
|
|
n = a.enabledAttributes;
|
|
for (let i = 0, r = n.length; i < r; i++) n[i] !== t[i] && (e.disableVertexAttribArray(i), n[i] = 0)
|
|
}
|
|
|
|
function p(t, n, i, r, a, s, o) {
|
|
!0 === o ? e.vertexAttribIPointer(t, n, i, a, s) : e.vertexAttribPointer(t, n, i, r, a, s)
|
|
}
|
|
|
|
function m() {
|
|
g(), s = !0, a !== r && (a = r, o(a.object))
|
|
}
|
|
|
|
function g() {
|
|
r.geometry = null, r.program = null, r.wireframe = !1
|
|
}
|
|
return {
|
|
setup: function(n, r, l, m, g) {
|
|
let A = !1;
|
|
const _ = function(t, n, r) {
|
|
const a = !0 === r.wireframe;
|
|
let s = i[t.id];
|
|
void 0 === s && (s = {}, i[t.id] = s);
|
|
let o = s[n.id];
|
|
void 0 === o && (o = {}, s[n.id] = o);
|
|
let l = o[a];
|
|
void 0 === l && (l = c(e.createVertexArray()), o[a] = l);
|
|
return l
|
|
}(m, l, r);
|
|
a !== _ && (a = _, o(a.object)), A = function(e, t, n, i) {
|
|
const r = a.attributes,
|
|
s = t.attributes;
|
|
let o = 0;
|
|
const l = n.getAttributes();
|
|
for (const t in l) {
|
|
if (l[t].location >= 0) {
|
|
const n = r[t];
|
|
let i = s[t];
|
|
if (void 0 === i && ("instanceMatrix" === t && e.instanceMatrix && (i = e.instanceMatrix), "instanceColor" === t && e.instanceColor && (i = e.instanceColor)), void 0 === n) return !0;
|
|
if (n.attribute !== i) return !0;
|
|
if (i && n.data !== i.data) return !0;
|
|
o++
|
|
}
|
|
}
|
|
return a.attributesNum !== o || a.index !== i
|
|
}(n, m, l, g), A && function(e, t, n, i) {
|
|
const r = {},
|
|
s = t.attributes;
|
|
let o = 0;
|
|
const l = n.getAttributes();
|
|
for (const t in l) {
|
|
if (l[t].location >= 0) {
|
|
let n = s[t];
|
|
void 0 === n && ("instanceMatrix" === t && e.instanceMatrix && (n = e.instanceMatrix), "instanceColor" === t && e.instanceColor && (n = e.instanceColor));
|
|
const i = {};
|
|
i.attribute = n, n && n.data && (i.data = n.data), r[t] = i, o++
|
|
}
|
|
}
|
|
a.attributes = r, a.attributesNum = o, a.index = i
|
|
}(n, m, l, g), null !== g && t.update(g, e.ELEMENT_ARRAY_BUFFER), (A || s) && (s = !1, function(n, i, r, a) {
|
|
h();
|
|
const s = a.attributes,
|
|
o = r.getAttributes(),
|
|
l = i.defaultAttributeValues;
|
|
for (const i in o) {
|
|
const r = o[i];
|
|
if (r.location >= 0) {
|
|
let o = s[i];
|
|
if (void 0 === o && ("instanceMatrix" === i && n.instanceMatrix && (o = n.instanceMatrix), "instanceColor" === i && n.instanceColor && (o = n.instanceColor)), void 0 !== o) {
|
|
const i = o.normalized,
|
|
s = o.itemSize,
|
|
l = t.get(o);
|
|
if (void 0 === l) continue;
|
|
const c = l.buffer,
|
|
h = l.type,
|
|
f = l.bytesPerElement,
|
|
m = h === e.INT || h === e.UNSIGNED_INT || o.gpuType === K;
|
|
if (o.isInterleavedBufferAttribute) {
|
|
const t = o.data,
|
|
l = t.stride,
|
|
g = o.offset;
|
|
if (t.isInstancedInterleavedBuffer) {
|
|
for (let e = 0; e < r.locationSize; e++) d(r.location + e, t.meshPerAttribute);
|
|
!0 !== n.isInstancedMesh && void 0 === a._maxInstanceCount && (a._maxInstanceCount = t.meshPerAttribute * t.count)
|
|
} else
|
|
for (let e = 0; e < r.locationSize; e++) u(r.location + e);
|
|
e.bindBuffer(e.ARRAY_BUFFER, c);
|
|
for (let e = 0; e < r.locationSize; e++) p(r.location + e, s / r.locationSize, h, i, l * f, (g + s / r.locationSize * e) * f, m)
|
|
} else {
|
|
if (o.isInstancedBufferAttribute) {
|
|
for (let e = 0; e < r.locationSize; e++) d(r.location + e, o.meshPerAttribute);
|
|
!0 !== n.isInstancedMesh && void 0 === a._maxInstanceCount && (a._maxInstanceCount = o.meshPerAttribute * o.count)
|
|
} else
|
|
for (let e = 0; e < r.locationSize; e++) u(r.location + e);
|
|
e.bindBuffer(e.ARRAY_BUFFER, c);
|
|
for (let e = 0; e < r.locationSize; e++) p(r.location + e, s / r.locationSize, h, i, s * f, s / r.locationSize * e * f, m)
|
|
}
|
|
} else if (void 0 !== l) {
|
|
const t = l[i];
|
|
if (void 0 !== t) switch (t.length) {
|
|
case 2:
|
|
e.vertexAttrib2fv(r.location, t);
|
|
break;
|
|
case 3:
|
|
e.vertexAttrib3fv(r.location, t);
|
|
break;
|
|
case 4:
|
|
e.vertexAttrib4fv(r.location, t);
|
|
break;
|
|
default:
|
|
e.vertexAttrib1fv(r.location, t)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
f()
|
|
}(n, r, l, m), null !== g && e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, t.get(g).buffer))
|
|
},
|
|
reset: m,
|
|
resetDefaultState: g,
|
|
dispose: function() {
|
|
m();
|
|
for (const e in i) {
|
|
const t = i[e];
|
|
for (const e in t) {
|
|
const n = t[e];
|
|
for (const e in n) l(n[e].object), delete n[e];
|
|
delete t[e]
|
|
}
|
|
delete i[e]
|
|
}
|
|
},
|
|
releaseStatesOfGeometry: function(e) {
|
|
if (void 0 === i[e.id]) return;
|
|
const t = i[e.id];
|
|
for (const e in t) {
|
|
const n = t[e];
|
|
for (const e in n) l(n[e].object), delete n[e];
|
|
delete t[e]
|
|
}
|
|
delete i[e.id]
|
|
},
|
|
releaseStatesOfProgram: function(e) {
|
|
for (const t in i) {
|
|
const n = i[t];
|
|
if (void 0 === n[e.id]) continue;
|
|
const r = n[e.id];
|
|
for (const e in r) l(r[e].object), delete r[e];
|
|
delete n[e.id]
|
|
}
|
|
},
|
|
initAttributes: h,
|
|
enableAttribute: u,
|
|
disableUnusedAttributes: f
|
|
}
|
|
}
|
|
|
|
function Td(e, t, n) {
|
|
let i;
|
|
|
|
function r(t, r, a) {
|
|
0 !== a && (e.drawArraysInstanced(i, t, r, a), n.update(r, i, a))
|
|
}
|
|
this.setMode = function(e) {
|
|
i = e
|
|
}, this.render = function(t, r) {
|
|
e.drawArrays(i, t, r), n.update(r, i, 1)
|
|
}, this.renderInstances = r, this.renderMultiDraw = function(e, r, a) {
|
|
if (0 === a) return;
|
|
t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i, e, 0, r, 0, a);
|
|
let s = 0;
|
|
for (let e = 0; e < a; e++) s += r[e];
|
|
n.update(s, i, 1)
|
|
}, this.renderMultiDrawInstances = function(e, a, s, o) {
|
|
if (0 === s) return;
|
|
const l = t.get("WEBGL_multi_draw");
|
|
if (null === l)
|
|
for (let t = 0; t < e.length; t++) r(e[t], a[t], o[t]);
|
|
else {
|
|
l.multiDrawArraysInstancedWEBGL(i, e, 0, a, 0, o, 0, s);
|
|
let t = 0;
|
|
for (let e = 0; e < s; e++) t += a[e] * o[e];
|
|
n.update(t, i, 1)
|
|
}
|
|
}
|
|
}
|
|
|
|
function Cd(e, t, n, i) {
|
|
let r;
|
|
|
|
function a(t) {
|
|
if ("highp" === t) {
|
|
if (e.getShaderPrecisionFormat(e.VERTEX_SHADER, e.HIGH_FLOAT).precision > 0 && e.getShaderPrecisionFormat(e.FRAGMENT_SHADER, e.HIGH_FLOAT).precision > 0) return "highp";
|
|
t = "mediump"
|
|
}
|
|
return "mediump" === t && e.getShaderPrecisionFormat(e.VERTEX_SHADER, e.MEDIUM_FLOAT).precision > 0 && e.getShaderPrecisionFormat(e.FRAGMENT_SHADER, e.MEDIUM_FLOAT).precision > 0 ? "mediump" : "lowp"
|
|
}
|
|
let s = void 0 !== n.precision ? n.precision : "highp";
|
|
const o = a(s);
|
|
o !== s && (console.warn("THREE.WebGLRenderer:", s, "not supported, using", o, "instead."), s = o);
|
|
const l = !0 === n.logarithmicDepthBuffer,
|
|
c = !0 === n.reverseDepthBuffer && t.has("EXT_clip_control"),
|
|
h = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),
|
|
u = e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
|
return {
|
|
isWebGL2: !0,
|
|
getMaxAnisotropy: function() {
|
|
if (void 0 !== r) return r;
|
|
if (!0 === t.has("EXT_texture_filter_anisotropic")) {
|
|
const n = t.get("EXT_texture_filter_anisotropic");
|
|
r = e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)
|
|
} else r = 0;
|
|
return r
|
|
},
|
|
getMaxPrecision: a,
|
|
textureFormatReadable: function(t) {
|
|
return t === re || i.convert(t) === e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)
|
|
},
|
|
textureTypeReadable: function(n) {
|
|
const r = n === $ && (t.has("EXT_color_buffer_half_float") || t.has("EXT_color_buffer_float"));
|
|
return !(n !== X && i.convert(n) !== e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE) && n !== J && !r)
|
|
},
|
|
precision: s,
|
|
logarithmicDepthBuffer: l,
|
|
reverseDepthBuffer: c,
|
|
maxTextures: h,
|
|
maxVertexTextures: u,
|
|
maxTextureSize: e.getParameter(e.MAX_TEXTURE_SIZE),
|
|
maxCubemapSize: e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),
|
|
maxAttributes: e.getParameter(e.MAX_VERTEX_ATTRIBS),
|
|
maxVertexUniforms: e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),
|
|
maxVaryings: e.getParameter(e.MAX_VARYING_VECTORS),
|
|
maxFragmentUniforms: e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),
|
|
vertexTextures: u > 0,
|
|
maxSamples: e.getParameter(e.MAX_SAMPLES)
|
|
}
|
|
}
|
|
|
|
function Id(e) {
|
|
const t = this;
|
|
let n = null,
|
|
i = 0,
|
|
r = !1,
|
|
a = !1;
|
|
const s = new Yr,
|
|
o = new St,
|
|
l = {
|
|
value: null,
|
|
needsUpdate: !1
|
|
};
|
|
|
|
function c(e, n, i, r) {
|
|
const a = null !== e ? e.length : 0;
|
|
let c = null;
|
|
if (0 !== a) {
|
|
if (c = l.value, !0 !== r || null === c) {
|
|
const t = i + 4 * a,
|
|
r = n.matrixWorldInverse;
|
|
o.getNormalMatrix(r), (null === c || c.length < t) && (c = new Float32Array(t));
|
|
for (let t = 0, n = i; t !== a; ++t, n += 4) s.copy(e[t]).applyMatrix4(r, o), s.normal.toArray(c, n), c[n + 3] = s.constant
|
|
}
|
|
l.value = c, l.needsUpdate = !0
|
|
}
|
|
return t.numPlanes = a, t.numIntersection = 0, c
|
|
}
|
|
this.uniform = l, this.numPlanes = 0, this.numIntersection = 0, this.init = function(e, t) {
|
|
const n = 0 !== e.length || t || 0 !== i || r;
|
|
return r = t, i = e.length, n
|
|
}, this.beginShadows = function() {
|
|
a = !0, c(null)
|
|
}, this.endShadows = function() {
|
|
a = !1
|
|
}, this.setGlobalState = function(e, t) {
|
|
n = c(e, t, 0)
|
|
}, this.setState = function(s, o, h) {
|
|
const u = s.clippingPlanes,
|
|
d = s.clipIntersection,
|
|
f = s.clipShadows,
|
|
p = e.get(s);
|
|
if (!r || null === u || 0 === u.length || a && !f) a ? c(null) : function() {
|
|
l.value !== n && (l.value = n, l.needsUpdate = i > 0);
|
|
t.numPlanes = i, t.numIntersection = 0
|
|
}();
|
|
else {
|
|
const e = a ? 0 : i,
|
|
t = 4 * e;
|
|
let r = p.clippingState || null;
|
|
l.value = r, r = c(u, o, t, h);
|
|
for (let e = 0; e !== t; ++e) r[e] = n[e];
|
|
p.clippingState = r, this.numIntersection = d ? this.numPlanes : 0, this.numPlanes += e
|
|
}
|
|
}
|
|
}
|
|
|
|
function Rd(e) {
|
|
let t = new WeakMap;
|
|
|
|
function n(e, t) {
|
|
return t === L ? e.mapping = B : t === U && (e.mapping = D), e
|
|
}
|
|
|
|
function i(e) {
|
|
const n = e.target;
|
|
n.removeEventListener("dispose", i);
|
|
const r = t.get(n);
|
|
void 0 !== r && (t.delete(n), r.dispose())
|
|
}
|
|
return {
|
|
get: function(r) {
|
|
if (r && r.isTexture) {
|
|
const a = r.mapping;
|
|
if (a === L || a === U) {
|
|
if (t.has(r)) {
|
|
return n(t.get(r).texture, r.mapping)
|
|
} {
|
|
const a = r.image;
|
|
if (a && a.height > 0) {
|
|
const s = new fr(a.height);
|
|
return s.fromEquirectangularTexture(e, r), t.set(r, s), r.addEventListener("dispose", i), n(s.texture, r.mapping)
|
|
}
|
|
return null
|
|
}
|
|
}
|
|
}
|
|
return r
|
|
},
|
|
dispose: function() {
|
|
t = new WeakMap
|
|
}
|
|
}
|
|
}
|
|
const Pd = [.125, .215, .35, .446, .526, .582],
|
|
Bd = 20,
|
|
Dd = new fs,
|
|
Ld = new wi;
|
|
let Ud = null,
|
|
kd = 0,
|
|
Nd = 0,
|
|
Fd = !1;
|
|
const Od = (1 + Math.sqrt(5)) / 2,
|
|
zd = 1 / Od,
|
|
Wd = [new Zt(-Od, zd, 0), new Zt(Od, zd, 0), new Zt(-zd, 0, Od), new Zt(zd, 0, Od), new Zt(0, Od, -zd), new Zt(0, Od, zd), new Zt(-1, 1, -1), new Zt(1, 1, -1), new Zt(-1, 1, 1), new Zt(1, 1, 1)],
|
|
Hd = new Zt;
|
|
class Vd {
|
|
constructor(e) {
|
|
this._renderer = e, this._pingPongRenderTarget = null, this._lodMax = 0, this._cubeSize = 0, this._lodPlanes = [], this._sizeLods = [], this._sigmas = [], this._blurMaterial = null, this._cubemapMaterial = null, this._equirectMaterial = null, this._compileMaterial(this._blurMaterial)
|
|
}
|
|
fromScene(e, t = 0, n = .1, i = 100, r = {}) {
|
|
const {
|
|
size: a = 256,
|
|
position: s = Hd
|
|
} = r;
|
|
Ud = this._renderer.getRenderTarget(), kd = this._renderer.getActiveCubeFace(), Nd = this._renderer.getActiveMipmapLevel(), Fd = this._renderer.xr.enabled, this._renderer.xr.enabled = !1, this._setSize(a);
|
|
const o = this._allocateTargets();
|
|
return o.depthBuffer = !0, this._sceneToCubeUV(e, n, i, o, s), t > 0 && this._blur(o, 0, 0, t), this._applyPMREM(o), this._cleanup(o), o
|
|
}
|
|
fromEquirectangular(e, t = null) {
|
|
return this._fromTexture(e, t)
|
|
}
|
|
fromCubemap(e, t = null) {
|
|
return this._fromTexture(e, t)
|
|
}
|
|
compileCubemapShader() {
|
|
null === this._cubemapMaterial && (this._cubemapMaterial = jd(), this._compileMaterial(this._cubemapMaterial))
|
|
}
|
|
compileEquirectangularShader() {
|
|
null === this._equirectMaterial && (this._equirectMaterial = Xd(), this._compileMaterial(this._equirectMaterial))
|
|
}
|
|
dispose() {
|
|
this._dispose(), null !== this._cubemapMaterial && this._cubemapMaterial.dispose(), null !== this._equirectMaterial && this._equirectMaterial.dispose()
|
|
}
|
|
_setSize(e) {
|
|
this._lodMax = Math.floor(Math.log2(e)), this._cubeSize = Math.pow(2, this._lodMax)
|
|
}
|
|
_dispose() {
|
|
null !== this._blurMaterial && this._blurMaterial.dispose(), null !== this._pingPongRenderTarget && this._pingPongRenderTarget.dispose();
|
|
for (let e = 0; e < this._lodPlanes.length; e++) this._lodPlanes[e].dispose()
|
|
}
|
|
_cleanup(e) {
|
|
this._renderer.setRenderTarget(Ud, kd, Nd), this._renderer.xr.enabled = Fd, e.scissorTest = !1, Qd(e, 0, 0, e.width, e.height)
|
|
}
|
|
_fromTexture(e, t) {
|
|
e.mapping === B || e.mapping === D ? this._setSize(0 === e.image.length ? 16 : e.image[0].width || e.image[0].image.width) : this._setSize(e.image.width / 4), Ud = this._renderer.getRenderTarget(), kd = this._renderer.getActiveCubeFace(), Nd = this._renderer.getActiveMipmapLevel(), Fd = this._renderer.xr.enabled, this._renderer.xr.enabled = !1;
|
|
const n = t || this._allocateTargets();
|
|
return this._textureToCubeUV(e, n), this._applyPMREM(n), this._cleanup(n), n
|
|
}
|
|
_allocateTargets() {
|
|
const e = 3 * Math.max(this._cubeSize, 112),
|
|
t = 4 * this._cubeSize,
|
|
n = {
|
|
magFilter: V,
|
|
minFilter: V,
|
|
generateMipmaps: !1,
|
|
type: $,
|
|
format: re,
|
|
colorSpace: Ke,
|
|
depthBuffer: !1
|
|
},
|
|
i = Gd(e, t, n);
|
|
if (null === this._pingPongRenderTarget || this._pingPongRenderTarget.width !== e || this._pingPongRenderTarget.height !== t) {
|
|
null !== this._pingPongRenderTarget && this._dispose(), this._pingPongRenderTarget = Gd(e, t, n);
|
|
const {
|
|
_lodMax: i
|
|
} = this;
|
|
({
|
|
sizeLods: this._sizeLods,
|
|
lodPlanes: this._lodPlanes,
|
|
sigmas: this._sigmas
|
|
} = function(e) {
|
|
const t = [],
|
|
n = [],
|
|
i = [];
|
|
let r = e;
|
|
const a = e - 4 + 1 + Pd.length;
|
|
for (let s = 0; s < a; s++) {
|
|
const a = Math.pow(2, r);
|
|
n.push(a);
|
|
let o = 1 / a;
|
|
s > e - 4 ? o = Pd[s - e + 4 - 1] : 0 === s && (o = 0), i.push(o);
|
|
const l = 1 / (a - 2),
|
|
c = -l,
|
|
h = 1 + l,
|
|
u = [c, c, h, c, h, h, c, c, h, h, c, h],
|
|
d = 6,
|
|
f = 6,
|
|
p = 3,
|
|
m = 2,
|
|
g = 1,
|
|
A = new Float32Array(p * f * d),
|
|
_ = new Float32Array(m * f * d),
|
|
v = new Float32Array(g * f * d);
|
|
for (let e = 0; e < d; e++) {
|
|
const t = e % 3 * 2 / 3 - 1,
|
|
n = e > 2 ? 0 : -1,
|
|
i = [t, n, 0, t + 2 / 3, n, 0, t + 2 / 3, n + 1, 0, t, n, 0, t + 2 / 3, n + 1, 0, t, n + 1, 0];
|
|
A.set(i, p * f * e), _.set(u, m * f * e);
|
|
const r = [e, e, e, e, e, e];
|
|
v.set(r, g * f * e)
|
|
}
|
|
const w = new Oi;
|
|
w.setAttribute("position", new Ci(A, p)), w.setAttribute("uv", new Ci(_, m)), w.setAttribute("faceIndex", new Ci(v, g)), t.push(w), r > 4 && r--
|
|
}
|
|
return {
|
|
lodPlanes: t,
|
|
sizeLods: n,
|
|
sigmas: i
|
|
}
|
|
}(i)), this._blurMaterial = function(e, t, n) {
|
|
const i = new Float32Array(Bd),
|
|
r = new Zt(0, 1, 0),
|
|
a = new rr({
|
|
name: "SphericalGaussianBlur",
|
|
defines: {
|
|
n: Bd,
|
|
CUBEUV_TEXEL_WIDTH: 1 / t,
|
|
CUBEUV_TEXEL_HEIGHT: 1 / n,
|
|
CUBEUV_MAX_MIP: `${e}.0`
|
|
},
|
|
uniforms: {
|
|
envMap: {
|
|
value: null
|
|
},
|
|
samples: {
|
|
value: 1
|
|
},
|
|
weights: {
|
|
value: i
|
|
},
|
|
latitudinal: {
|
|
value: !1
|
|
},
|
|
dTheta: {
|
|
value: 0
|
|
},
|
|
mipInt: {
|
|
value: 0
|
|
},
|
|
poleAxis: {
|
|
value: r
|
|
}
|
|
},
|
|
vertexShader: qd(),
|
|
fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",
|
|
blending: 0,
|
|
depthTest: !1,
|
|
depthWrite: !1
|
|
});
|
|
return a
|
|
}(i, e, t)
|
|
}
|
|
return i
|
|
}
|
|
_compileMaterial(e) {
|
|
const t = new Zi(this._lodPlanes[0], e);
|
|
this._renderer.compile(t, Dd)
|
|
}
|
|
_sceneToCubeUV(e, t, n, i, r) {
|
|
const a = new cr(90, 1, t, n),
|
|
s = [1, -1, 1, 1, 1, 1],
|
|
o = [1, 1, 1, -1, -1, -1],
|
|
l = this._renderer,
|
|
c = l.autoClear,
|
|
h = l.toneMapping;
|
|
l.getClearColor(Ld), l.toneMapping = 0, l.autoClear = !1;
|
|
const u = new Ei({
|
|
name: "PMREM.Background",
|
|
side: 1,
|
|
depthWrite: !1,
|
|
depthTest: !1
|
|
}),
|
|
d = new Zi(new $i, u);
|
|
let f = !1;
|
|
const p = e.background;
|
|
p ? p.isColor && (u.color.copy(p), e.background = null, f = !0) : (u.color.copy(Ld), f = !0);
|
|
for (let t = 0; t < 6; t++) {
|
|
const n = t % 3;
|
|
0 === n ? (a.up.set(0, s[t], 0), a.position.set(r.x, r.y, r.z), a.lookAt(r.x + o[t], r.y, r.z)) : 1 === n ? (a.up.set(0, 0, s[t]), a.position.set(r.x, r.y, r.z), a.lookAt(r.x, r.y + o[t], r.z)) : (a.up.set(0, s[t], 0), a.position.set(r.x, r.y, r.z), a.lookAt(r.x, r.y, r.z + o[t]));
|
|
const c = this._cubeSize;
|
|
Qd(i, n * c, t > 2 ? c : 0, c, c), l.setRenderTarget(i), f && l.render(d, a), l.render(e, a)
|
|
}
|
|
d.geometry.dispose(), d.material.dispose(), l.toneMapping = h, l.autoClear = c, e.background = p
|
|
}
|
|
_textureToCubeUV(e, t) {
|
|
const n = this._renderer,
|
|
i = e.mapping === B || e.mapping === D;
|
|
i ? (null === this._cubemapMaterial && (this._cubemapMaterial = jd()), this._cubemapMaterial.uniforms.flipEnvMap.value = !1 === e.isRenderTargetTexture ? -1 : 1) : null === this._equirectMaterial && (this._equirectMaterial = Xd());
|
|
const r = i ? this._cubemapMaterial : this._equirectMaterial,
|
|
a = new Zi(this._lodPlanes[0], r);
|
|
r.uniforms.envMap.value = e;
|
|
const s = this._cubeSize;
|
|
Qd(t, 0, 0, 3 * s, 2 * s), n.setRenderTarget(t), n.render(a, Dd)
|
|
}
|
|
_applyPMREM(e) {
|
|
const t = this._renderer,
|
|
n = t.autoClear;
|
|
t.autoClear = !1;
|
|
const i = this._lodPlanes.length;
|
|
for (let t = 1; t < i; t++) {
|
|
const n = Math.sqrt(this._sigmas[t] * this._sigmas[t] - this._sigmas[t - 1] * this._sigmas[t - 1]),
|
|
r = Wd[(i - t - 1) % Wd.length];
|
|
this._blur(e, t - 1, t, n, r)
|
|
}
|
|
t.autoClear = n
|
|
}
|
|
_blur(e, t, n, i, r) {
|
|
const a = this._pingPongRenderTarget;
|
|
this._halfBlur(e, a, t, n, i, "latitudinal", r), this._halfBlur(a, e, n, n, i, "longitudinal", r)
|
|
}
|
|
_halfBlur(e, t, n, i, r, a, s) {
|
|
const o = this._renderer,
|
|
l = this._blurMaterial;
|
|
"latitudinal" !== a && "longitudinal" !== a && console.error("blur direction must be either latitudinal or longitudinal!");
|
|
const c = new Zi(this._lodPlanes[i], l),
|
|
h = l.uniforms,
|
|
u = this._sizeLods[n] - 1,
|
|
d = isFinite(r) ? Math.PI / (2 * u) : 2 * Math.PI / 39,
|
|
f = r / d,
|
|
p = isFinite(r) ? 1 + Math.floor(3 * f) : Bd;
|
|
p > Bd && console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${p} samples when the maximum is set to 20`);
|
|
const m = [];
|
|
let g = 0;
|
|
for (let e = 0; e < Bd; ++e) {
|
|
const t = e / f,
|
|
n = Math.exp(-t * t / 2);
|
|
m.push(n), 0 === e ? g += n : e < p && (g += 2 * n)
|
|
}
|
|
for (let e = 0; e < m.length; e++) m[e] = m[e] / g;
|
|
h.envMap.value = e.texture, h.samples.value = p, h.weights.value = m, h.latitudinal.value = "latitudinal" === a, s && (h.poleAxis.value = s);
|
|
const {
|
|
_lodMax: A
|
|
} = this;
|
|
h.dTheta.value = d, h.mipInt.value = A - n;
|
|
const _ = this._sizeLods[i];
|
|
Qd(t, 3 * _ * (i > A - 4 ? i - A + 4 : 0), 4 * (this._cubeSize - _), 3 * _, 2 * _), o.setRenderTarget(t), o.render(c, Dd)
|
|
}
|
|
}
|
|
|
|
function Gd(e, t, n) {
|
|
const i = new jt(e, t, n);
|
|
return i.texture.mapping = k, i.texture.name = "PMREM.cubeUv", i.scissorTest = !0, i
|
|
}
|
|
|
|
function Qd(e, t, n, i, r) {
|
|
e.viewport.set(t, n, i, r), e.scissor.set(t, n, i, r)
|
|
}
|
|
|
|
function Xd() {
|
|
return new rr({
|
|
name: "EquirectangularToCubeUV",
|
|
uniforms: {
|
|
envMap: {
|
|
value: null
|
|
}
|
|
},
|
|
vertexShader: qd(),
|
|
fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",
|
|
blending: 0,
|
|
depthTest: !1,
|
|
depthWrite: !1
|
|
})
|
|
}
|
|
|
|
function jd() {
|
|
return new rr({
|
|
name: "CubemapToCubeUV",
|
|
uniforms: {
|
|
envMap: {
|
|
value: null
|
|
},
|
|
flipEnvMap: {
|
|
value: -1
|
|
}
|
|
},
|
|
vertexShader: qd(),
|
|
fragmentShader: "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",
|
|
blending: 0,
|
|
depthTest: !1,
|
|
depthWrite: !1
|
|
})
|
|
}
|
|
|
|
function qd() {
|
|
return "\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"
|
|
}
|
|
|
|
function Yd(e) {
|
|
let t = new WeakMap,
|
|
n = null;
|
|
|
|
function i(e) {
|
|
const n = e.target;
|
|
n.removeEventListener("dispose", i);
|
|
const r = t.get(n);
|
|
void 0 !== r && (t.delete(n), r.dispose())
|
|
}
|
|
return {
|
|
get: function(r) {
|
|
if (r && r.isTexture) {
|
|
const a = r.mapping,
|
|
s = a === L || a === U,
|
|
o = a === B || a === D;
|
|
if (s || o) {
|
|
let a = t.get(r);
|
|
const l = void 0 !== a ? a.texture.pmremVersion : 0;
|
|
if (r.isRenderTargetTexture && r.pmremVersion !== l) return null === n && (n = new Vd(e)), a = s ? n.fromEquirectangular(r, a) : n.fromCubemap(r, a), a.texture.pmremVersion = r.pmremVersion, t.set(r, a), a.texture;
|
|
if (void 0 !== a) return a.texture;
|
|
{
|
|
const l = r.image;
|
|
return s && l && l.height > 0 || o && l && function(e) {
|
|
let t = 0;
|
|
const n = 6;
|
|
for (let i = 0; i < n; i++) void 0 !== e[i] && t++;
|
|
return t === n
|
|
}(l) ? (null === n && (n = new Vd(e)), a = s ? n.fromEquirectangular(r) : n.fromCubemap(r), a.texture.pmremVersion = r.pmremVersion, t.set(r, a), r.addEventListener("dispose", i), a.texture) : null
|
|
}
|
|
}
|
|
}
|
|
return r
|
|
},
|
|
dispose: function() {
|
|
t = new WeakMap, null !== n && (n.dispose(), n = null)
|
|
}
|
|
}
|
|
}
|
|
|
|
function Kd(e) {
|
|
const t = {};
|
|
|
|
function n(n) {
|
|
if (void 0 !== t[n]) return t[n];
|
|
let i;
|
|
switch (n) {
|
|
case "WEBGL_depth_texture":
|
|
i = e.getExtension("WEBGL_depth_texture") || e.getExtension("MOZ_WEBGL_depth_texture") || e.getExtension("WEBKIT_WEBGL_depth_texture");
|
|
break;
|
|
case "EXT_texture_filter_anisotropic":
|
|
i = e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
|
|
break;
|
|
case "WEBGL_compressed_texture_s3tc":
|
|
i = e.getExtension("WEBGL_compressed_texture_s3tc") || e.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
|
|
break;
|
|
case "WEBGL_compressed_texture_pvrtc":
|
|
i = e.getExtension("WEBGL_compressed_texture_pvrtc") || e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");
|
|
break;
|
|
default:
|
|
i = e.getExtension(n)
|
|
}
|
|
return t[n] = i, i
|
|
}
|
|
return {
|
|
has: function(e) {
|
|
return null !== n(e)
|
|
},
|
|
init: function() {
|
|
n("EXT_color_buffer_float"), n("WEBGL_clip_cull_distance"), n("OES_texture_float_linear"), n("EXT_color_buffer_half_float"), n("WEBGL_multisampled_render_to_texture"), n("WEBGL_render_shared_exponent")
|
|
},
|
|
get: function(e) {
|
|
const t = n(e);
|
|
return null === t && Pt("THREE.WebGLRenderer: " + e + " extension not supported."), t
|
|
}
|
|
}
|
|
}
|
|
|
|
function Zd(e, t, n, i) {
|
|
const r = {},
|
|
a = new WeakMap;
|
|
|
|
function s(e) {
|
|
const o = e.target;
|
|
null !== o.index && t.remove(o.index);
|
|
for (const e in o.attributes) t.remove(o.attributes[e]);
|
|
o.removeEventListener("dispose", s), delete r[o.id];
|
|
const l = a.get(o);
|
|
l && (t.remove(l), a.delete(o)), i.releaseStatesOfGeometry(o), !0 === o.isInstancedBufferGeometry && delete o._maxInstanceCount, n.memory.geometries--
|
|
}
|
|
|
|
function o(e) {
|
|
const n = [],
|
|
i = e.index,
|
|
r = e.attributes.position;
|
|
let s = 0;
|
|
if (null !== i) {
|
|
const e = i.array;
|
|
s = i.version;
|
|
for (let t = 0, i = e.length; t < i; t += 3) {
|
|
const i = e[t + 0],
|
|
r = e[t + 1],
|
|
a = e[t + 2];
|
|
n.push(i, r, r, a, a, i)
|
|
}
|
|
} else {
|
|
if (void 0 === r) return;
|
|
{
|
|
const e = r.array;
|
|
s = r.version;
|
|
for (let t = 0, i = e.length / 3 - 1; t < i; t += 3) {
|
|
const e = t + 0,
|
|
i = t + 1,
|
|
r = t + 2;
|
|
n.push(e, i, i, r, r, e)
|
|
}
|
|
}
|
|
}
|
|
const o = new(Tt(n) ? Ri : Ii)(n, 1);
|
|
o.version = s;
|
|
const l = a.get(e);
|
|
l && t.remove(l), a.set(e, o)
|
|
}
|
|
return {
|
|
get: function(e, t) {
|
|
return !0 === r[t.id] || (t.addEventListener("dispose", s), r[t.id] = !0, n.memory.geometries++), t
|
|
},
|
|
update: function(n) {
|
|
const i = n.attributes;
|
|
for (const n in i) t.update(i[n], e.ARRAY_BUFFER)
|
|
},
|
|
getWireframeAttribute: function(e) {
|
|
const t = a.get(e);
|
|
if (t) {
|
|
const n = e.index;
|
|
null !== n && t.version < n.version && o(e)
|
|
} else o(e);
|
|
return a.get(e)
|
|
}
|
|
}
|
|
}
|
|
|
|
function Jd(e, t, n) {
|
|
let i, r, a;
|
|
|
|
function s(t, s, o) {
|
|
0 !== o && (e.drawElementsInstanced(i, s, r, t * a, o), n.update(s, i, o))
|
|
}
|
|
this.setMode = function(e) {
|
|
i = e
|
|
}, this.setIndex = function(e) {
|
|
r = e.type, a = e.bytesPerElement
|
|
}, this.render = function(t, s) {
|
|
e.drawElements(i, s, r, t * a), n.update(s, i, 1)
|
|
}, this.renderInstances = s, this.renderMultiDraw = function(e, a, s) {
|
|
if (0 === s) return;
|
|
t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i, a, 0, r, e, 0, s);
|
|
let o = 0;
|
|
for (let e = 0; e < s; e++) o += a[e];
|
|
n.update(o, i, 1)
|
|
}, this.renderMultiDrawInstances = function(e, o, l, c) {
|
|
if (0 === l) return;
|
|
const h = t.get("WEBGL_multi_draw");
|
|
if (null === h)
|
|
for (let t = 0; t < e.length; t++) s(e[t] / a, o[t], c[t]);
|
|
else {
|
|
h.multiDrawElementsInstancedWEBGL(i, o, 0, r, e, 0, c, 0, l);
|
|
let t = 0;
|
|
for (let e = 0; e < l; e++) t += o[e] * c[e];
|
|
n.update(t, i, 1)
|
|
}
|
|
}
|
|
}
|
|
|
|
function $d(e) {
|
|
const t = {
|
|
frame: 0,
|
|
calls: 0,
|
|
triangles: 0,
|
|
points: 0,
|
|
lines: 0
|
|
};
|
|
return {
|
|
memory: {
|
|
geometries: 0,
|
|
textures: 0
|
|
},
|
|
render: t,
|
|
programs: null,
|
|
autoReset: !0,
|
|
reset: function() {
|
|
t.calls = 0, t.triangles = 0, t.points = 0, t.lines = 0
|
|
},
|
|
update: function(n, i, r) {
|
|
switch (t.calls++, i) {
|
|
case e.TRIANGLES:
|
|
t.triangles += r * (n / 3);
|
|
break;
|
|
case e.LINES:
|
|
t.lines += r * (n / 2);
|
|
break;
|
|
case e.LINE_STRIP:
|
|
t.lines += r * (n - 1);
|
|
break;
|
|
case e.LINE_LOOP:
|
|
t.lines += r * n;
|
|
break;
|
|
case e.POINTS:
|
|
t.points += r * n;
|
|
break;
|
|
default:
|
|
console.error("THREE.WebGLInfo: Unknown draw mode:", i)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function ef(e, t, n) {
|
|
const i = new WeakMap,
|
|
r = new Qt;
|
|
return {
|
|
update: function(a, s, o) {
|
|
const l = a.morphTargetInfluences,
|
|
c = s.morphAttributes.position || s.morphAttributes.normal || s.morphAttributes.color,
|
|
h = void 0 !== c ? c.length : 0;
|
|
let u = i.get(s);
|
|
if (void 0 === u || u.count !== h) {
|
|
void 0 !== u && u.texture.dispose();
|
|
const d = void 0 !== s.morphAttributes.position,
|
|
f = void 0 !== s.morphAttributes.normal,
|
|
p = void 0 !== s.morphAttributes.color,
|
|
m = s.morphAttributes.position || [],
|
|
g = s.morphAttributes.normal || [],
|
|
A = s.morphAttributes.color || [];
|
|
let _ = 0;
|
|
!0 === d && (_ = 1), !0 === f && (_ = 2), !0 === p && (_ = 3);
|
|
let v = s.attributes.position.count * _,
|
|
w = 1;
|
|
v > t.maxTextureSize && (w = Math.ceil(v / t.maxTextureSize), v = t.maxTextureSize);
|
|
const y = new Float32Array(v * w * 4 * h),
|
|
x = new qt(y, v, w, h);
|
|
x.type = J, x.needsUpdate = !0;
|
|
const b = 4 * _;
|
|
for (let S = 0; S < h; S++) {
|
|
const M = m[S],
|
|
T = g[S],
|
|
C = A[S],
|
|
I = v * w * 4 * S;
|
|
for (let R = 0; R < M.count; R++) {
|
|
const P = R * b;
|
|
!0 === d && (r.fromBufferAttribute(M, R), y[I + P + 0] = r.x, y[I + P + 1] = r.y, y[I + P + 2] = r.z, y[I + P + 3] = 0), !0 === f && (r.fromBufferAttribute(T, R), y[I + P + 4] = r.x, y[I + P + 5] = r.y, y[I + P + 6] = r.z, y[I + P + 7] = 0), !0 === p && (r.fromBufferAttribute(C, R), y[I + P + 8] = r.x, y[I + P + 9] = r.y, y[I + P + 10] = r.z, y[I + P + 11] = 4 === C.itemSize ? r.w : 1)
|
|
}
|
|
}
|
|
|
|
function E() {
|
|
x.dispose(), i.delete(s), s.removeEventListener("dispose", E)
|
|
}
|
|
u = {
|
|
count: h,
|
|
texture: x,
|
|
size: new Et(v, w)
|
|
}, i.set(s, u), s.addEventListener("dispose", E)
|
|
}
|
|
if (!0 === a.isInstancedMesh && null !== a.morphTexture) o.getUniforms().setValue(e, "morphTexture", a.morphTexture, n);
|
|
else {
|
|
let B = 0;
|
|
for (let L = 0; L < l.length; L++) B += l[L];
|
|
const D = s.morphTargetsRelative ? 1 : 1 - B;
|
|
o.getUniforms().setValue(e, "morphTargetBaseInfluence", D), o.getUniforms().setValue(e, "morphTargetInfluences", l)
|
|
}
|
|
o.getUniforms().setValue(e, "morphTargetsTexture", u.texture, n), o.getUniforms().setValue(e, "morphTargetsTextureSize", u.size)
|
|
}
|
|
}
|
|
}
|
|
|
|
function tf(e, t, n, i) {
|
|
let r = new WeakMap;
|
|
|
|
function a(e) {
|
|
const t = e.target;
|
|
t.removeEventListener("dispose", a), n.remove(t.instanceMatrix), null !== t.instanceColor && n.remove(t.instanceColor)
|
|
}
|
|
return {
|
|
update: function(s) {
|
|
const o = i.render.frame,
|
|
l = s.geometry,
|
|
c = t.get(s, l);
|
|
if (r.get(c) !== o && (t.update(c), r.set(c, o)), s.isInstancedMesh && (!1 === s.hasEventListener("dispose", a) && s.addEventListener("dispose", a), r.get(s) !== o && (n.update(s.instanceMatrix, e.ARRAY_BUFFER), null !== s.instanceColor && n.update(s.instanceColor, e.ARRAY_BUFFER), r.set(s, o))), s.isSkinnedMesh) {
|
|
const e = s.skeleton;
|
|
r.get(e) !== o && (e.update(), r.set(e, o))
|
|
}
|
|
return c
|
|
},
|
|
dispose: function() {
|
|
r = new WeakMap
|
|
}
|
|
}
|
|
}
|
|
const nf = new Gt,
|
|
rf = new wa(1, 1),
|
|
af = new qt,
|
|
sf = new Yt,
|
|
of = new dr,
|
|
lf = [],
|
|
cf = [],
|
|
hf = new Float32Array(16),
|
|
uf = new Float32Array(9),
|
|
df = new Float32Array(4);
|
|
|
|
function ff(e, t, n) {
|
|
const i = e[0];
|
|
if (i <= 0 || i > 0) return e;
|
|
const r = t * n;
|
|
let a = lf[r];
|
|
if (void 0 === a && (a = new Float32Array(r), lf[r] = a), 0 !== t) {
|
|
i.toArray(a, 0);
|
|
for (let i = 1, r = 0; i !== t; ++i) r += n, e[i].toArray(a, r)
|
|
}
|
|
return a
|
|
}
|
|
|
|
function pf(e, t) {
|
|
if (e.length !== t.length) return !1;
|
|
for (let n = 0, i = e.length; n < i; n++)
|
|
if (e[n] !== t[n]) return !1;
|
|
return !0
|
|
}
|
|
|
|
function mf(e, t) {
|
|
for (let n = 0, i = t.length; n < i; n++) e[n] = t[n]
|
|
}
|
|
|
|
function gf(e, t) {
|
|
let n = cf[t];
|
|
void 0 === n && (n = new Int32Array(t), cf[t] = n);
|
|
for (let i = 0; i !== t; ++i) n[i] = e.allocateTextureUnit();
|
|
return n
|
|
}
|
|
|
|
function Af(e, t) {
|
|
const n = this.cache;
|
|
n[0] !== t && (e.uniform1f(this.addr, t), n[0] = t)
|
|
}
|
|
|
|
function _f(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y || (e.uniform2f(this.addr, t.x, t.y), n[0] = t.x, n[1] = t.y);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform2fv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function vf(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y && n[2] === t.z || (e.uniform3f(this.addr, t.x, t.y, t.z), n[0] = t.x, n[1] = t.y, n[2] = t.z);
|
|
else if (void 0 !== t.r) n[0] === t.r && n[1] === t.g && n[2] === t.b || (e.uniform3f(this.addr, t.r, t.g, t.b), n[0] = t.r, n[1] = t.g, n[2] = t.b);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform3fv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function wf(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y && n[2] === t.z && n[3] === t.w || (e.uniform4f(this.addr, t.x, t.y, t.z, t.w), n[0] = t.x, n[1] = t.y, n[2] = t.z, n[3] = t.w);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform4fv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function yf(e, t) {
|
|
const n = this.cache,
|
|
i = t.elements;
|
|
if (void 0 === i) {
|
|
if (pf(n, t)) return;
|
|
e.uniformMatrix2fv(this.addr, !1, t), mf(n, t)
|
|
} else {
|
|
if (pf(n, i)) return;
|
|
df.set(i), e.uniformMatrix2fv(this.addr, !1, df), mf(n, i)
|
|
}
|
|
}
|
|
|
|
function xf(e, t) {
|
|
const n = this.cache,
|
|
i = t.elements;
|
|
if (void 0 === i) {
|
|
if (pf(n, t)) return;
|
|
e.uniformMatrix3fv(this.addr, !1, t), mf(n, t)
|
|
} else {
|
|
if (pf(n, i)) return;
|
|
uf.set(i), e.uniformMatrix3fv(this.addr, !1, uf), mf(n, i)
|
|
}
|
|
}
|
|
|
|
function bf(e, t) {
|
|
const n = this.cache,
|
|
i = t.elements;
|
|
if (void 0 === i) {
|
|
if (pf(n, t)) return;
|
|
e.uniformMatrix4fv(this.addr, !1, t), mf(n, t)
|
|
} else {
|
|
if (pf(n, i)) return;
|
|
hf.set(i), e.uniformMatrix4fv(this.addr, !1, hf), mf(n, i)
|
|
}
|
|
}
|
|
|
|
function Ef(e, t) {
|
|
const n = this.cache;
|
|
n[0] !== t && (e.uniform1i(this.addr, t), n[0] = t)
|
|
}
|
|
|
|
function Sf(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y || (e.uniform2i(this.addr, t.x, t.y), n[0] = t.x, n[1] = t.y);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform2iv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function Mf(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y && n[2] === t.z || (e.uniform3i(this.addr, t.x, t.y, t.z), n[0] = t.x, n[1] = t.y, n[2] = t.z);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform3iv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function Tf(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y && n[2] === t.z && n[3] === t.w || (e.uniform4i(this.addr, t.x, t.y, t.z, t.w), n[0] = t.x, n[1] = t.y, n[2] = t.z, n[3] = t.w);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform4iv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function Cf(e, t) {
|
|
const n = this.cache;
|
|
n[0] !== t && (e.uniform1ui(this.addr, t), n[0] = t)
|
|
}
|
|
|
|
function If(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y || (e.uniform2ui(this.addr, t.x, t.y), n[0] = t.x, n[1] = t.y);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform2uiv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function Rf(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y && n[2] === t.z || (e.uniform3ui(this.addr, t.x, t.y, t.z), n[0] = t.x, n[1] = t.y, n[2] = t.z);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform3uiv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function Pf(e, t) {
|
|
const n = this.cache;
|
|
if (void 0 !== t.x) n[0] === t.x && n[1] === t.y && n[2] === t.z && n[3] === t.w || (e.uniform4ui(this.addr, t.x, t.y, t.z, t.w), n[0] = t.x, n[1] = t.y, n[2] = t.z, n[3] = t.w);
|
|
else {
|
|
if (pf(n, t)) return;
|
|
e.uniform4uiv(this.addr, t), mf(n, t)
|
|
}
|
|
}
|
|
|
|
function Bf(e, t, n) {
|
|
const i = this.cache,
|
|
r = n.allocateTextureUnit();
|
|
let a;
|
|
i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), this.type === e.SAMPLER_2D_SHADOW ? (rf.compareFunction = 515, a = rf) : a = nf, n.setTexture2D(t || a, r)
|
|
}
|
|
|
|
function Df(e, t, n) {
|
|
const i = this.cache,
|
|
r = n.allocateTextureUnit();
|
|
i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), n.setTexture3D(t || sf, r)
|
|
}
|
|
|
|
function Lf(e, t, n) {
|
|
const i = this.cache,
|
|
r = n.allocateTextureUnit();
|
|
i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), n.setTextureCube(t || of, r)
|
|
}
|
|
|
|
function Uf(e, t, n) {
|
|
const i = this.cache,
|
|
r = n.allocateTextureUnit();
|
|
i[0] !== r && (e.uniform1i(this.addr, r), i[0] = r), n.setTexture2DArray(t || af, r)
|
|
}
|
|
|
|
function kf(e, t) {
|
|
e.uniform1fv(this.addr, t)
|
|
}
|
|
|
|
function Nf(e, t) {
|
|
const n = ff(t, this.size, 2);
|
|
e.uniform2fv(this.addr, n)
|
|
}
|
|
|
|
function Ff(e, t) {
|
|
const n = ff(t, this.size, 3);
|
|
e.uniform3fv(this.addr, n)
|
|
}
|
|
|
|
function Of(e, t) {
|
|
const n = ff(t, this.size, 4);
|
|
e.uniform4fv(this.addr, n)
|
|
}
|
|
|
|
function zf(e, t) {
|
|
const n = ff(t, this.size, 4);
|
|
e.uniformMatrix2fv(this.addr, !1, n)
|
|
}
|
|
|
|
function Wf(e, t) {
|
|
const n = ff(t, this.size, 9);
|
|
e.uniformMatrix3fv(this.addr, !1, n)
|
|
}
|
|
|
|
function Hf(e, t) {
|
|
const n = ff(t, this.size, 16);
|
|
e.uniformMatrix4fv(this.addr, !1, n)
|
|
}
|
|
|
|
function Vf(e, t) {
|
|
e.uniform1iv(this.addr, t)
|
|
}
|
|
|
|
function Gf(e, t) {
|
|
e.uniform2iv(this.addr, t)
|
|
}
|
|
|
|
function Qf(e, t) {
|
|
e.uniform3iv(this.addr, t)
|
|
}
|
|
|
|
function Xf(e, t) {
|
|
e.uniform4iv(this.addr, t)
|
|
}
|
|
|
|
function jf(e, t) {
|
|
e.uniform1uiv(this.addr, t)
|
|
}
|
|
|
|
function qf(e, t) {
|
|
e.uniform2uiv(this.addr, t)
|
|
}
|
|
|
|
function Yf(e, t) {
|
|
e.uniform3uiv(this.addr, t)
|
|
}
|
|
|
|
function Kf(e, t) {
|
|
e.uniform4uiv(this.addr, t)
|
|
}
|
|
|
|
function Zf(e, t, n) {
|
|
const i = this.cache,
|
|
r = t.length,
|
|
a = gf(n, r);
|
|
pf(i, a) || (e.uniform1iv(this.addr, a), mf(i, a));
|
|
for (let e = 0; e !== r; ++e) n.setTexture2D(t[e] || nf, a[e])
|
|
}
|
|
|
|
function Jf(e, t, n) {
|
|
const i = this.cache,
|
|
r = t.length,
|
|
a = gf(n, r);
|
|
pf(i, a) || (e.uniform1iv(this.addr, a), mf(i, a));
|
|
for (let e = 0; e !== r; ++e) n.setTexture3D(t[e] || sf, a[e])
|
|
}
|
|
|
|
function $f(e, t, n) {
|
|
const i = this.cache,
|
|
r = t.length,
|
|
a = gf(n, r);
|
|
pf(i, a) || (e.uniform1iv(this.addr, a), mf(i, a));
|
|
for (let e = 0; e !== r; ++e) n.setTextureCube(t[e] || of, a[e])
|
|
}
|
|
|
|
function ep(e, t, n) {
|
|
const i = this.cache,
|
|
r = t.length,
|
|
a = gf(n, r);
|
|
pf(i, a) || (e.uniform1iv(this.addr, a), mf(i, a));
|
|
for (let e = 0; e !== r; ++e) n.setTexture2DArray(t[e] || af, a[e])
|
|
}
|
|
class tp {
|
|
constructor(e, t, n) {
|
|
this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.setValue = function(e) {
|
|
switch (e) {
|
|
case 5126:
|
|
return Af;
|
|
case 35664:
|
|
return _f;
|
|
case 35665:
|
|
return vf;
|
|
case 35666:
|
|
return wf;
|
|
case 35674:
|
|
return yf;
|
|
case 35675:
|
|
return xf;
|
|
case 35676:
|
|
return bf;
|
|
case 5124:
|
|
case 35670:
|
|
return Ef;
|
|
case 35667:
|
|
case 35671:
|
|
return Sf;
|
|
case 35668:
|
|
case 35672:
|
|
return Mf;
|
|
case 35669:
|
|
case 35673:
|
|
return Tf;
|
|
case 5125:
|
|
return Cf;
|
|
case 36294:
|
|
return If;
|
|
case 36295:
|
|
return Rf;
|
|
case 36296:
|
|
return Pf;
|
|
case 35678:
|
|
case 36198:
|
|
case 36298:
|
|
case 36306:
|
|
case 35682:
|
|
return Bf;
|
|
case 35679:
|
|
case 36299:
|
|
case 36307:
|
|
return Df;
|
|
case 35680:
|
|
case 36300:
|
|
case 36308:
|
|
case 36293:
|
|
return Lf;
|
|
case 36289:
|
|
case 36303:
|
|
case 36311:
|
|
case 36292:
|
|
return Uf
|
|
}
|
|
}(t.type)
|
|
}
|
|
}
|
|
class np {
|
|
constructor(e, t, n) {
|
|
this.id = e, this.addr = n, this.cache = [], this.type = t.type, this.size = t.size, this.setValue = function(e) {
|
|
switch (e) {
|
|
case 5126:
|
|
return kf;
|
|
case 35664:
|
|
return Nf;
|
|
case 35665:
|
|
return Ff;
|
|
case 35666:
|
|
return Of;
|
|
case 35674:
|
|
return zf;
|
|
case 35675:
|
|
return Wf;
|
|
case 35676:
|
|
return Hf;
|
|
case 5124:
|
|
case 35670:
|
|
return Vf;
|
|
case 35667:
|
|
case 35671:
|
|
return Gf;
|
|
case 35668:
|
|
case 35672:
|
|
return Qf;
|
|
case 35669:
|
|
case 35673:
|
|
return Xf;
|
|
case 5125:
|
|
return jf;
|
|
case 36294:
|
|
return qf;
|
|
case 36295:
|
|
return Yf;
|
|
case 36296:
|
|
return Kf;
|
|
case 35678:
|
|
case 36198:
|
|
case 36298:
|
|
case 36306:
|
|
case 35682:
|
|
return Zf;
|
|
case 35679:
|
|
case 36299:
|
|
case 36307:
|
|
return Jf;
|
|
case 35680:
|
|
case 36300:
|
|
case 36308:
|
|
case 36293:
|
|
return $f;
|
|
case 36289:
|
|
case 36303:
|
|
case 36311:
|
|
case 36292:
|
|
return ep
|
|
}
|
|
}(t.type)
|
|
}
|
|
}
|
|
class ip {
|
|
constructor(e) {
|
|
this.id = e, this.seq = [], this.map = {}
|
|
}
|
|
setValue(e, t, n) {
|
|
const i = this.seq;
|
|
for (let r = 0, a = i.length; r !== a; ++r) {
|
|
const a = i[r];
|
|
a.setValue(e, t[a.id], n)
|
|
}
|
|
}
|
|
}
|
|
const rp = /(\w+)(\])?(\[|\.)?/g;
|
|
|
|
function ap(e, t) {
|
|
e.seq.push(t), e.map[t.id] = t
|
|
}
|
|
|
|
function sp(e, t, n) {
|
|
const i = e.name,
|
|
r = i.length;
|
|
for (rp.lastIndex = 0;;) {
|
|
const a = rp.exec(i),
|
|
s = rp.lastIndex;
|
|
let o = a[1];
|
|
const l = "]" === a[2],
|
|
c = a[3];
|
|
if (l && (o |= 0), void 0 === c || "[" === c && s + 2 === r) {
|
|
ap(n, void 0 === c ? new tp(o, e, t) : new np(o, e, t));
|
|
break
|
|
} {
|
|
let e = n.map[o];
|
|
void 0 === e && (e = new ip(o), ap(n, e)), n = e
|
|
}
|
|
}
|
|
}
|
|
class op {
|
|
constructor(e, t) {
|
|
this.seq = [], this.map = {};
|
|
const n = e.getProgramParameter(t, e.ACTIVE_UNIFORMS);
|
|
for (let i = 0; i < n; ++i) {
|
|
const n = e.getActiveUniform(t, i);
|
|
sp(n, e.getUniformLocation(t, n.name), this)
|
|
}
|
|
}
|
|
setValue(e, t, n, i) {
|
|
const r = this.map[t];
|
|
void 0 !== r && r.setValue(e, n, i)
|
|
}
|
|
setOptional(e, t, n) {
|
|
const i = t[n];
|
|
void 0 !== i && this.setValue(e, n, i)
|
|
}
|
|
static upload(e, t, n, i) {
|
|
for (let r = 0, a = t.length; r !== a; ++r) {
|
|
const a = t[r],
|
|
s = n[a.id];
|
|
!1 !== s.needsUpdate && a.setValue(e, s.value, i)
|
|
}
|
|
}
|
|
static seqWithValue(e, t) {
|
|
const n = [];
|
|
for (let i = 0, r = e.length; i !== r; ++i) {
|
|
const r = e[i];
|
|
r.id in t && n.push(r)
|
|
}
|
|
return n
|
|
}
|
|
}
|
|
|
|
function lp(e, t, n) {
|
|
const i = e.createShader(t);
|
|
return e.shaderSource(i, n), e.compileShader(i), i
|
|
}
|
|
let cp = 0;
|
|
const hp = new St;
|
|
|
|
function up(e, t, n) {
|
|
const i = e.getShaderParameter(t, e.COMPILE_STATUS),
|
|
r = e.getShaderInfoLog(t).trim();
|
|
if (i && "" === r) return "";
|
|
const a = /ERROR: 0:(\d+)/.exec(r);
|
|
if (a) {
|
|
const i = parseInt(a[1]);
|
|
return n.toUpperCase() + "\n\n" + r + "\n\n" + function(e, t) {
|
|
const n = e.split("\n"),
|
|
i = [],
|
|
r = Math.max(t - 6, 0),
|
|
a = Math.min(t + 6, n.length);
|
|
for (let e = r; e < a; e++) {
|
|
const r = e + 1;
|
|
i.push(`${r===t?">":" "} ${r}: ${n[e]}`)
|
|
}
|
|
return i.join("\n")
|
|
}(e.getShaderSource(t), i)
|
|
}
|
|
return r
|
|
}
|
|
|
|
function dp(e, t) {
|
|
const n = function(e) {
|
|
Ut._getMatrix(hp, Ut.workingColorSpace, e);
|
|
const t = `mat3( ${hp.elements.map((e=>e.toFixed(4)))} )`;
|
|
switch (Ut.getTransfer(e)) {
|
|
case Ze:
|
|
return [t, "LinearTransferOETF"];
|
|
case Je:
|
|
return [t, "sRGBTransferOETF"];
|
|
default:
|
|
return console.warn("THREE.WebGLProgram: Unsupported color space: ", e), [t, "LinearTransferOETF"]
|
|
}
|
|
}(t);
|
|
return [`vec4 ${e}( vec4 value ) {`, `\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`, "}"].join("\n")
|
|
}
|
|
|
|
function fp(e, t) {
|
|
let n;
|
|
switch (t) {
|
|
case 1:
|
|
n = "Linear";
|
|
break;
|
|
case 2:
|
|
n = "Reinhard";
|
|
break;
|
|
case 3:
|
|
n = "Cineon";
|
|
break;
|
|
case 4:
|
|
n = "ACESFilmic";
|
|
break;
|
|
case 6:
|
|
n = "AgX";
|
|
break;
|
|
case 7:
|
|
n = "Neutral";
|
|
break;
|
|
case 5:
|
|
n = "Custom";
|
|
break;
|
|
default:
|
|
console.warn("THREE.WebGLProgram: Unsupported toneMapping:", t), n = "Linear"
|
|
}
|
|
return "vec3 " + e + "( vec3 color ) { return " + n + "ToneMapping( color ); }"
|
|
}
|
|
const pp = new Zt;
|
|
|
|
function mp() {
|
|
Ut.getLuminanceCoefficients(pp);
|
|
return ["float luminance( const in vec3 rgb ) {", `\tconst vec3 weights = vec3( ${pp.x.toFixed(4)}, ${pp.y.toFixed(4)}, ${pp.z.toFixed(4)} );`, "\treturn dot( weights, rgb );", "}"].join("\n")
|
|
}
|
|
|
|
function gp(e) {
|
|
return "" !== e
|
|
}
|
|
|
|
function Ap(e, t) {
|
|
const n = t.numSpotLightShadows + t.numSpotLightMaps - t.numSpotLightShadowsWithMaps;
|
|
return e.replace(/NUM_DIR_LIGHTS/g, t.numDirLights).replace(/NUM_SPOT_LIGHTS/g, t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, n).replace(/NUM_RECT_AREA_LIGHTS/g, t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, t.numPointLights).replace(/NUM_HEMI_LIGHTS/g, t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, t.numPointLightShadows)
|
|
}
|
|
|
|
function _p(e, t) {
|
|
return e.replace(/NUM_CLIPPING_PLANES/g, t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, t.numClippingPlanes - t.numClipIntersection)
|
|
}
|
|
const vp = /^[ \t]*#include +<([\w\d./]+)>/gm;
|
|
|
|
function wp(e) {
|
|
return e.replace(vp, xp)
|
|
}
|
|
const yp = new Map;
|
|
|
|
function xp(e, t) {
|
|
let n = vd[t];
|
|
if (void 0 === n) {
|
|
const e = yp.get(t);
|
|
if (void 0 === e) throw new Error("Can not resolve #include <" + t + ">");
|
|
n = vd[e], console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.', t, e)
|
|
}
|
|
return wp(n)
|
|
}
|
|
const bp = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
|
|
|
|
function Ep(e) {
|
|
return e.replace(bp, Sp)
|
|
}
|
|
|
|
function Sp(e, t, n, i) {
|
|
let r = "";
|
|
for (let e = parseInt(t); e < parseInt(n); e++) r += i.replace(/\[\s*i\s*\]/g, "[ " + e + " ]").replace(/UNROLLED_LOOP_INDEX/g, e);
|
|
return r
|
|
}
|
|
|
|
function Mp(e) {
|
|
let t = `precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;
|
|
return "highp" === e.precision ? t += "\n#define HIGH_PRECISION" : "mediump" === e.precision ? t += "\n#define MEDIUM_PRECISION" : "lowp" === e.precision && (t += "\n#define LOW_PRECISION"), t
|
|
}
|
|
|
|
function Tp(e, t, n, i) {
|
|
const r = e.getContext(),
|
|
a = n.defines;
|
|
let s = n.vertexShader,
|
|
o = n.fragmentShader;
|
|
const l = function(e) {
|
|
let t = "SHADOWMAP_TYPE_BASIC";
|
|
return 1 === e.shadowMapType ? t = "SHADOWMAP_TYPE_PCF" : 2 === e.shadowMapType ? t = "SHADOWMAP_TYPE_PCF_SOFT" : 3 === e.shadowMapType && (t = "SHADOWMAP_TYPE_VSM"), t
|
|
}(n),
|
|
c = function(e) {
|
|
let t = "ENVMAP_TYPE_CUBE";
|
|
if (e.envMap) switch (e.envMapMode) {
|
|
case B:
|
|
case D:
|
|
t = "ENVMAP_TYPE_CUBE";
|
|
break;
|
|
case k:
|
|
t = "ENVMAP_TYPE_CUBE_UV"
|
|
}
|
|
return t
|
|
}(n),
|
|
h = function(e) {
|
|
let t = "ENVMAP_MODE_REFLECTION";
|
|
e.envMap && e.envMapMode === D && (t = "ENVMAP_MODE_REFRACTION");
|
|
return t
|
|
}(n),
|
|
u = function(e) {
|
|
let t = "ENVMAP_BLENDING_NONE";
|
|
if (e.envMap) switch (e.combine) {
|
|
case 0:
|
|
t = "ENVMAP_BLENDING_MULTIPLY";
|
|
break;
|
|
case 1:
|
|
t = "ENVMAP_BLENDING_MIX";
|
|
break;
|
|
case 2:
|
|
t = "ENVMAP_BLENDING_ADD"
|
|
}
|
|
return t
|
|
}(n),
|
|
d = function(e) {
|
|
const t = e.envMapCubeUVHeight;
|
|
if (null === t) return null;
|
|
const n = Math.log2(t) - 2,
|
|
i = 1 / t;
|
|
return {
|
|
texelWidth: 1 / (3 * Math.max(Math.pow(2, n), 112)),
|
|
texelHeight: i,
|
|
maxMip: n
|
|
}
|
|
}(n),
|
|
f = function(e) {
|
|
return [e.extensionClipCullDistance ? "#extension GL_ANGLE_clip_cull_distance : require" : "", e.extensionMultiDraw ? "#extension GL_ANGLE_multi_draw : require" : ""].filter(gp).join("\n")
|
|
}(n),
|
|
p = function(e) {
|
|
const t = [];
|
|
for (const n in e) {
|
|
const i = e[n];
|
|
!1 !== i && t.push("#define " + n + " " + i)
|
|
}
|
|
return t.join("\n")
|
|
}(a),
|
|
m = r.createProgram();
|
|
let g, A, _ = n.glslVersion ? "#version " + n.glslVersion + "\n" : "";
|
|
n.isRawShaderMaterial ? (g = ["#define SHADER_TYPE " + n.shaderType, "#define SHADER_NAME " + n.shaderName, p].filter(gp).join("\n"), g.length > 0 && (g += "\n"), A = ["#define SHADER_TYPE " + n.shaderType, "#define SHADER_NAME " + n.shaderName, p].filter(gp).join("\n"), A.length > 0 && (A += "\n")) : (g = [Mp(n), "#define SHADER_TYPE " + n.shaderType, "#define SHADER_NAME " + n.shaderName, p, n.extensionClipCullDistance ? "#define USE_CLIP_DISTANCE" : "", n.batching ? "#define USE_BATCHING" : "", n.batchingColor ? "#define USE_BATCHING_COLOR" : "", n.instancing ? "#define USE_INSTANCING" : "", n.instancingColor ? "#define USE_INSTANCING_COLOR" : "", n.instancingMorph ? "#define USE_INSTANCING_MORPH" : "", n.useFog && n.fog ? "#define USE_FOG" : "", n.useFog && n.fogExp2 ? "#define FOG_EXP2" : "", n.map ? "#define USE_MAP" : "", n.envMap ? "#define USE_ENVMAP" : "", n.envMap ? "#define " + h : "", n.lightMap ? "#define USE_LIGHTMAP" : "", n.aoMap ? "#define USE_AOMAP" : "", n.bumpMap ? "#define USE_BUMPMAP" : "", n.normalMap ? "#define USE_NORMALMAP" : "", n.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", n.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", n.displacementMap ? "#define USE_DISPLACEMENTMAP" : "", n.emissiveMap ? "#define USE_EMISSIVEMAP" : "", n.anisotropy ? "#define USE_ANISOTROPY" : "", n.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", n.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", n.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", n.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", n.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", n.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", n.specularMap ? "#define USE_SPECULARMAP" : "", n.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", n.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", n.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", n.metalnessMap ? "#define USE_METALNESSMAP" : "", n.alphaMap ? "#define USE_ALPHAMAP" : "", n.alphaHash ? "#define USE_ALPHAHASH" : "", n.transmission ? "#define USE_TRANSMISSION" : "", n.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", n.thicknessMap ? "#define USE_THICKNESSMAP" : "", n.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", n.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", n.mapUv ? "#define MAP_UV " + n.mapUv : "", n.alphaMapUv ? "#define ALPHAMAP_UV " + n.alphaMapUv : "", n.lightMapUv ? "#define LIGHTMAP_UV " + n.lightMapUv : "", n.aoMapUv ? "#define AOMAP_UV " + n.aoMapUv : "", n.emissiveMapUv ? "#define EMISSIVEMAP_UV " + n.emissiveMapUv : "", n.bumpMapUv ? "#define BUMPMAP_UV " + n.bumpMapUv : "", n.normalMapUv ? "#define NORMALMAP_UV " + n.normalMapUv : "", n.displacementMapUv ? "#define DISPLACEMENTMAP_UV " + n.displacementMapUv : "", n.metalnessMapUv ? "#define METALNESSMAP_UV " + n.metalnessMapUv : "", n.roughnessMapUv ? "#define ROUGHNESSMAP_UV " + n.roughnessMapUv : "", n.anisotropyMapUv ? "#define ANISOTROPYMAP_UV " + n.anisotropyMapUv : "", n.clearcoatMapUv ? "#define CLEARCOATMAP_UV " + n.clearcoatMapUv : "", n.clearcoatNormalMapUv ? "#define CLEARCOAT_NORMALMAP_UV " + n.clearcoatNormalMapUv : "", n.clearcoatRoughnessMapUv ? "#define CLEARCOAT_ROUGHNESSMAP_UV " + n.clearcoatRoughnessMapUv : "", n.iridescenceMapUv ? "#define IRIDESCENCEMAP_UV " + n.iridescenceMapUv : "", n.iridescenceThicknessMapUv ? "#define IRIDESCENCE_THICKNESSMAP_UV " + n.iridescenceThicknessMapUv : "", n.sheenColorMapUv ? "#define SHEEN_COLORMAP_UV " + n.sheenColorMapUv : "", n.sheenRoughnessMapUv ? "#define SHEEN_ROUGHNESSMAP_UV " + n.sheenRoughnessMapUv : "", n.specularMapUv ? "#define SPECULARMAP_UV " + n.specularMapUv : "", n.specularColorMapUv ? "#define SPECULAR_COLORMAP_UV " + n.specularColorMapUv : "", n.specularIntensityMapUv ? "#define SPECULAR_INTENSITYMAP_UV " + n.specularIntensityMapUv : "", n.transmissionMapUv ? "#define TRANSMISSIONMAP_UV " + n.transmissionMapUv : "", n.thicknessMapUv ? "#define THICKNESSMAP_UV " + n.thicknessMapUv : "", n.vertexTangents && !1 === n.flatShading ? "#define USE_TANGENT" : "", n.vertexColors ? "#define USE_COLOR" : "", n.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", n.vertexUv1s ? "#define USE_UV1" : "", n.vertexUv2s ? "#define USE_UV2" : "", n.vertexUv3s ? "#define USE_UV3" : "", n.pointsUvs ? "#define USE_POINTS_UV" : "", n.flatShading ? "#define FLAT_SHADED" : "", n.skinning ? "#define USE_SKINNING" : "", n.morphTargets ? "#define USE_MORPHTARGETS" : "", n.morphNormals && !1 === n.flatShading ? "#define USE_MORPHNORMALS" : "", n.morphColors ? "#define USE_MORPHCOLORS" : "", n.morphTargetsCount > 0 ? "#define MORPHTARGETS_TEXTURE_STRIDE " + n.morphTextureStride : "", n.morphTargetsCount > 0 ? "#define MORPHTARGETS_COUNT " + n.morphTargetsCount : "", n.doubleSided ? "#define DOUBLE_SIDED" : "", n.flipSided ? "#define FLIP_SIDED" : "", n.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", n.shadowMapEnabled ? "#define " + l : "", n.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", n.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", n.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", n.reverseDepthBuffer ? "#define USE_REVERSEDEPTHBUF" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", "#ifdef USE_INSTANCING", "\tattribute mat4 instanceMatrix;", "#endif", "#ifdef USE_INSTANCING_COLOR", "\tattribute vec3 instanceColor;", "#endif", "#ifdef USE_INSTANCING_MORPH", "\tuniform sampler2D morphTexture;", "#endif", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_UV1", "\tattribute vec2 uv1;", "#endif", "#ifdef USE_UV2", "\tattribute vec2 uv2;", "#endif", "#ifdef USE_UV3", "\tattribute vec2 uv3;", "#endif", "#ifdef USE_TANGENT", "\tattribute vec4 tangent;", "#endif", "#if defined( USE_COLOR_ALPHA )", "\tattribute vec4 color;", "#elif defined( USE_COLOR )", "\tattribute vec3 color;", "#endif", "#ifdef USE_SKINNING", "\tattribute vec4 skinIndex;", "\tattribute vec4 skinWeight;", "#endif", "\n"].filter(gp).join("\n"), A = [Mp(n), "#define SHADER_TYPE " + n.shaderType, "#define SHADER_NAME " + n.shaderName, p, n.useFog && n.fog ? "#define USE_FOG" : "", n.useFog && n.fogExp2 ? "#define FOG_EXP2" : "", n.alphaToCoverage ? "#define ALPHA_TO_COVERAGE" : "", n.map ? "#define USE_MAP" : "", n.matcap ? "#define USE_MATCAP" : "", n.envMap ? "#define USE_ENVMAP" : "", n.envMap ? "#define " + c : "", n.envMap ? "#define " + h : "", n.envMap ? "#define " + u : "", d ? "#define CUBEUV_TEXEL_WIDTH " + d.texelWidth : "", d ? "#define CUBEUV_TEXEL_HEIGHT " + d.texelHeight : "", d ? "#define CUBEUV_MAX_MIP " + d.maxMip + ".0" : "", n.lightMap ? "#define USE_LIGHTMAP" : "", n.aoMap ? "#define USE_AOMAP" : "", n.bumpMap ? "#define USE_BUMPMAP" : "", n.normalMap ? "#define USE_NORMALMAP" : "", n.normalMapObjectSpace ? "#define USE_NORMALMAP_OBJECTSPACE" : "", n.normalMapTangentSpace ? "#define USE_NORMALMAP_TANGENTSPACE" : "", n.emissiveMap ? "#define USE_EMISSIVEMAP" : "", n.anisotropy ? "#define USE_ANISOTROPY" : "", n.anisotropyMap ? "#define USE_ANISOTROPYMAP" : "", n.clearcoat ? "#define USE_CLEARCOAT" : "", n.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", n.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", n.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", n.dispersion ? "#define USE_DISPERSION" : "", n.iridescence ? "#define USE_IRIDESCENCE" : "", n.iridescenceMap ? "#define USE_IRIDESCENCEMAP" : "", n.iridescenceThicknessMap ? "#define USE_IRIDESCENCE_THICKNESSMAP" : "", n.specularMap ? "#define USE_SPECULARMAP" : "", n.specularColorMap ? "#define USE_SPECULAR_COLORMAP" : "", n.specularIntensityMap ? "#define USE_SPECULAR_INTENSITYMAP" : "", n.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", n.metalnessMap ? "#define USE_METALNESSMAP" : "", n.alphaMap ? "#define USE_ALPHAMAP" : "", n.alphaTest ? "#define USE_ALPHATEST" : "", n.alphaHash ? "#define USE_ALPHAHASH" : "", n.sheen ? "#define USE_SHEEN" : "", n.sheenColorMap ? "#define USE_SHEEN_COLORMAP" : "", n.sheenRoughnessMap ? "#define USE_SHEEN_ROUGHNESSMAP" : "", n.transmission ? "#define USE_TRANSMISSION" : "", n.transmissionMap ? "#define USE_TRANSMISSIONMAP" : "", n.thicknessMap ? "#define USE_THICKNESSMAP" : "", n.vertexTangents && !1 === n.flatShading ? "#define USE_TANGENT" : "", n.vertexColors || n.instancingColor || n.batchingColor ? "#define USE_COLOR" : "", n.vertexAlphas ? "#define USE_COLOR_ALPHA" : "", n.vertexUv1s ? "#define USE_UV1" : "", n.vertexUv2s ? "#define USE_UV2" : "", n.vertexUv3s ? "#define USE_UV3" : "", n.pointsUvs ? "#define USE_POINTS_UV" : "", n.gradientMap ? "#define USE_GRADIENTMAP" : "", n.flatShading ? "#define FLAT_SHADED" : "", n.doubleSided ? "#define DOUBLE_SIDED" : "", n.flipSided ? "#define FLIP_SIDED" : "", n.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", n.shadowMapEnabled ? "#define " + l : "", n.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", n.numLightProbes > 0 ? "#define USE_LIGHT_PROBES" : "", n.decodeVideoTexture ? "#define DECODE_VIDEO_TEXTURE" : "", n.decodeVideoTextureEmissive ? "#define DECODE_VIDEO_TEXTURE_EMISSIVE" : "", n.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", n.reverseDepthBuffer ? "#define USE_REVERSEDEPTHBUF" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", 0 !== n.toneMapping ? "#define TONE_MAPPING" : "", 0 !== n.toneMapping ? vd.tonemapping_pars_fragment : "", 0 !== n.toneMapping ? fp("toneMapping", n.toneMapping) : "", n.dithering ? "#define DITHERING" : "", n.opaque ? "#define OPAQUE" : "", vd.colorspace_pars_fragment, dp("linearToOutputTexel", n.outputColorSpace), mp(), n.useDepthPacking ? "#define DEPTH_PACKING " + n.depthPacking : "", "\n"].filter(gp).join("\n")), s = wp(s), s = Ap(s, n), s = _p(s, n), o = wp(o), o = Ap(o, n), o = _p(o, n), s = Ep(s), o = Ep(o), !0 !== n.isRawShaderMaterial && (_ = "#version 300 es\n", g = [f, "#define attribute in", "#define varying out", "#define texture2D texture"].join("\n") + "\n" + g, A = ["#define varying in", n.glslVersion === ct ? "" : "layout(location = 0) out highp vec4 pc_fragColor;", n.glslVersion === ct ? "" : "#define gl_FragColor pc_fragColor", "#define gl_FragDepthEXT gl_FragDepth", "#define texture2D texture", "#define textureCube texture", "#define texture2DProj textureProj", "#define texture2DLodEXT textureLod", "#define texture2DProjLodEXT textureProjLod", "#define textureCubeLodEXT textureLod", "#define texture2DGradEXT textureGrad", "#define texture2DProjGradEXT textureProjGrad", "#define textureCubeGradEXT textureGrad"].join("\n") + "\n" + A);
|
|
const v = _ + g + s,
|
|
w = _ + A + o,
|
|
y = lp(r, r.VERTEX_SHADER, v),
|
|
x = lp(r, r.FRAGMENT_SHADER, w);
|
|
|
|
function b(t) {
|
|
if (e.debug.checkShaderErrors) {
|
|
const n = r.getProgramInfoLog(m).trim(),
|
|
i = r.getShaderInfoLog(y).trim(),
|
|
a = r.getShaderInfoLog(x).trim();
|
|
let s = !0,
|
|
o = !0;
|
|
if (!1 === r.getProgramParameter(m, r.LINK_STATUS))
|
|
if (s = !1, "function" == typeof e.debug.onShaderError) e.debug.onShaderError(r, m, y, x);
|
|
else {
|
|
const e = up(r, y, "vertex"),
|
|
i = up(r, x, "fragment");
|
|
console.error("THREE.WebGLProgram: Shader Error " + r.getError() + " - VALIDATE_STATUS " + r.getProgramParameter(m, r.VALIDATE_STATUS) + "\n\nMaterial Name: " + t.name + "\nMaterial Type: " + t.type + "\n\nProgram Info Log: " + n + "\n" + e + "\n" + i)
|
|
}
|
|
else "" !== n ? console.warn("THREE.WebGLProgram: Program Info Log:", n) : "" !== i && "" !== a || (o = !1);
|
|
o && (t.diagnostics = {
|
|
runnable: s,
|
|
programLog: n,
|
|
vertexShader: {
|
|
log: i,
|
|
prefix: g
|
|
},
|
|
fragmentShader: {
|
|
log: a,
|
|
prefix: A
|
|
}
|
|
})
|
|
}
|
|
r.deleteShader(y), r.deleteShader(x), E = new op(r, m), S = function(e, t) {
|
|
const n = {},
|
|
i = e.getProgramParameter(t, e.ACTIVE_ATTRIBUTES);
|
|
for (let r = 0; r < i; r++) {
|
|
const i = e.getActiveAttrib(t, r),
|
|
a = i.name;
|
|
let s = 1;
|
|
i.type === e.FLOAT_MAT2 && (s = 2), i.type === e.FLOAT_MAT3 && (s = 3), i.type === e.FLOAT_MAT4 && (s = 4), n[a] = {
|
|
type: i.type,
|
|
location: e.getAttribLocation(t, a),
|
|
locationSize: s
|
|
}
|
|
}
|
|
return n
|
|
}(r, m)
|
|
}
|
|
let E, S;
|
|
r.attachShader(m, y), r.attachShader(m, x), void 0 !== n.index0AttributeName ? r.bindAttribLocation(m, 0, n.index0AttributeName) : !0 === n.morphTargets && r.bindAttribLocation(m, 0, "position"), r.linkProgram(m), this.getUniforms = function() {
|
|
return void 0 === E && b(this), E
|
|
}, this.getAttributes = function() {
|
|
return void 0 === S && b(this), S
|
|
};
|
|
let M = !1 === n.rendererExtensionParallelShaderCompile;
|
|
return this.isReady = function() {
|
|
return !1 === M && (M = r.getProgramParameter(m, 37297)), M
|
|
}, this.destroy = function() {
|
|
i.releaseStatesOfProgram(this), r.deleteProgram(m), this.program = void 0
|
|
}, this.type = n.shaderType, this.name = n.shaderName, this.id = cp++, this.cacheKey = t, this.usedTimes = 1, this.program = m, this.vertexShader = y, this.fragmentShader = x, this
|
|
}
|
|
let Cp = 0;
|
|
class Ip {
|
|
constructor() {
|
|
this.shaderCache = new Map, this.materialCache = new Map
|
|
}
|
|
update(e) {
|
|
const t = e.vertexShader,
|
|
n = e.fragmentShader,
|
|
i = this._getShaderStage(t),
|
|
r = this._getShaderStage(n),
|
|
a = this._getShaderCacheForMaterial(e);
|
|
return !1 === a.has(i) && (a.add(i), i.usedTimes++), !1 === a.has(r) && (a.add(r), r.usedTimes++), this
|
|
}
|
|
remove(e) {
|
|
const t = this.materialCache.get(e);
|
|
for (const e of t) e.usedTimes--, 0 === e.usedTimes && this.shaderCache.delete(e.code);
|
|
return this.materialCache.delete(e), this
|
|
}
|
|
getVertexShaderID(e) {
|
|
return this._getShaderStage(e.vertexShader).id
|
|
}
|
|
getFragmentShaderID(e) {
|
|
return this._getShaderStage(e.fragmentShader).id
|
|
}
|
|
dispose() {
|
|
this.shaderCache.clear(), this.materialCache.clear()
|
|
}
|
|
_getShaderCacheForMaterial(e) {
|
|
const t = this.materialCache;
|
|
let n = t.get(e);
|
|
return void 0 === n && (n = new Set, t.set(e, n)), n
|
|
}
|
|
_getShaderStage(e) {
|
|
const t = this.shaderCache;
|
|
let n = t.get(e);
|
|
return void 0 === n && (n = new Rp(e), t.set(e, n)), n
|
|
}
|
|
}
|
|
class Rp {
|
|
constructor(e) {
|
|
this.id = Cp++, this.code = e, this.usedTimes = 0
|
|
}
|
|
}
|
|
|
|
function Pp(e, t, n, i, r, a, s) {
|
|
const o = new On,
|
|
l = new Ip,
|
|
c = new Set,
|
|
h = [],
|
|
u = r.logarithmicDepthBuffer,
|
|
d = r.vertexTextures;
|
|
let f = r.precision;
|
|
const p = {
|
|
MeshDepthMaterial: "depth",
|
|
MeshDistanceMaterial: "distanceRGBA",
|
|
MeshNormalMaterial: "normal",
|
|
MeshBasicMaterial: "basic",
|
|
MeshLambertMaterial: "lambert",
|
|
MeshPhongMaterial: "phong",
|
|
MeshToonMaterial: "toon",
|
|
MeshStandardMaterial: "physical",
|
|
MeshPhysicalMaterial: "physical",
|
|
MeshMatcapMaterial: "matcap",
|
|
LineBasicMaterial: "basic",
|
|
LineDashedMaterial: "dashed",
|
|
PointsMaterial: "points",
|
|
ShadowMaterial: "shadow",
|
|
SpriteMaterial: "sprite"
|
|
};
|
|
|
|
function m(e) {
|
|
return c.add(e), 0 === e ? "uv" : `uv${e}`
|
|
}
|
|
return {
|
|
getParameters: function(a, o, h, g, A) {
|
|
const _ = g.fog,
|
|
v = A.geometry,
|
|
w = a.isMeshStandardMaterial ? g.environment : null,
|
|
y = (a.isMeshStandardMaterial ? n : t).get(a.envMap || w),
|
|
x = y && y.mapping === k ? y.image.height : null,
|
|
b = p[a.type];
|
|
null !== a.precision && (f = r.getMaxPrecision(a.precision), f !== a.precision && console.warn("THREE.WebGLProgram.getParameters:", a.precision, "not supported, using", f, "instead."));
|
|
const E = v.morphAttributes.position || v.morphAttributes.normal || v.morphAttributes.color,
|
|
S = void 0 !== E ? E.length : 0;
|
|
let M, T, C, I, R = 0;
|
|
if (void 0 !== v.morphAttributes.position && (R = 1), void 0 !== v.morphAttributes.normal && (R = 2), void 0 !== v.morphAttributes.color && (R = 3), b) {
|
|
const e = yd[b];
|
|
M = e.vertexShader, T = e.fragmentShader
|
|
} else M = a.vertexShader, T = a.fragmentShader, l.update(a), C = l.getVertexShaderID(a), I = l.getFragmentShaderID(a);
|
|
const P = e.getRenderTarget(),
|
|
B = e.state.buffers.depth.getReversed(),
|
|
D = !0 === A.isInstancedMesh,
|
|
L = !0 === A.isBatchedMesh,
|
|
U = !!a.map,
|
|
N = !!a.matcap,
|
|
F = !!y,
|
|
O = !!a.aoMap,
|
|
z = !!a.lightMap,
|
|
W = !!a.bumpMap,
|
|
H = !!a.normalMap,
|
|
V = !!a.displacementMap,
|
|
G = !!a.emissiveMap,
|
|
Q = !!a.metalnessMap,
|
|
X = !!a.roughnessMap,
|
|
j = a.anisotropy > 0,
|
|
q = a.clearcoat > 0,
|
|
Y = a.dispersion > 0,
|
|
K = a.iridescence > 0,
|
|
Z = a.sheen > 0,
|
|
J = a.transmission > 0,
|
|
$ = j && !!a.anisotropyMap,
|
|
ee = q && !!a.clearcoatMap,
|
|
te = q && !!a.clearcoatNormalMap,
|
|
ne = q && !!a.clearcoatRoughnessMap,
|
|
ie = K && !!a.iridescenceMap,
|
|
re = K && !!a.iridescenceThicknessMap,
|
|
ae = Z && !!a.sheenColorMap,
|
|
se = Z && !!a.sheenRoughnessMap,
|
|
oe = !!a.specularMap,
|
|
le = !!a.specularColorMap,
|
|
ce = !!a.specularIntensityMap,
|
|
he = J && !!a.transmissionMap,
|
|
ue = J && !!a.thicknessMap,
|
|
de = !!a.gradientMap,
|
|
fe = !!a.alphaMap,
|
|
pe = a.alphaTest > 0,
|
|
me = !!a.alphaHash,
|
|
ge = !!a.extensions;
|
|
let Ae = 0;
|
|
a.toneMapped && (null !== P && !0 !== P.isXRRenderTarget || (Ae = e.toneMapping));
|
|
const _e = {
|
|
shaderID: b,
|
|
shaderType: a.type,
|
|
shaderName: a.name,
|
|
vertexShader: M,
|
|
fragmentShader: T,
|
|
defines: a.defines,
|
|
customVertexShaderID: C,
|
|
customFragmentShaderID: I,
|
|
isRawShaderMaterial: !0 === a.isRawShaderMaterial,
|
|
glslVersion: a.glslVersion,
|
|
precision: f,
|
|
batching: L,
|
|
batchingColor: L && null !== A._colorsTexture,
|
|
instancing: D,
|
|
instancingColor: D && null !== A.instanceColor,
|
|
instancingMorph: D && null !== A.morphTexture,
|
|
supportsVertexTextures: d,
|
|
outputColorSpace: null === P ? e.outputColorSpace : !0 === P.isXRRenderTarget ? P.texture.colorSpace : Ke,
|
|
alphaToCoverage: !!a.alphaToCoverage,
|
|
map: U,
|
|
matcap: N,
|
|
envMap: F,
|
|
envMapMode: F && y.mapping,
|
|
envMapCubeUVHeight: x,
|
|
aoMap: O,
|
|
lightMap: z,
|
|
bumpMap: W,
|
|
normalMap: H,
|
|
displacementMap: d && V,
|
|
emissiveMap: G,
|
|
normalMapObjectSpace: H && 1 === a.normalMapType,
|
|
normalMapTangentSpace: H && 0 === a.normalMapType,
|
|
metalnessMap: Q,
|
|
roughnessMap: X,
|
|
anisotropy: j,
|
|
anisotropyMap: $,
|
|
clearcoat: q,
|
|
clearcoatMap: ee,
|
|
clearcoatNormalMap: te,
|
|
clearcoatRoughnessMap: ne,
|
|
dispersion: Y,
|
|
iridescence: K,
|
|
iridescenceMap: ie,
|
|
iridescenceThicknessMap: re,
|
|
sheen: Z,
|
|
sheenColorMap: ae,
|
|
sheenRoughnessMap: se,
|
|
specularMap: oe,
|
|
specularColorMap: le,
|
|
specularIntensityMap: ce,
|
|
transmission: J,
|
|
transmissionMap: he,
|
|
thicknessMap: ue,
|
|
gradientMap: de,
|
|
opaque: !1 === a.transparent && 1 === a.blending && !1 === a.alphaToCoverage,
|
|
alphaMap: fe,
|
|
alphaTest: pe,
|
|
alphaHash: me,
|
|
combine: a.combine,
|
|
mapUv: U && m(a.map.channel),
|
|
aoMapUv: O && m(a.aoMap.channel),
|
|
lightMapUv: z && m(a.lightMap.channel),
|
|
bumpMapUv: W && m(a.bumpMap.channel),
|
|
normalMapUv: H && m(a.normalMap.channel),
|
|
displacementMapUv: V && m(a.displacementMap.channel),
|
|
emissiveMapUv: G && m(a.emissiveMap.channel),
|
|
metalnessMapUv: Q && m(a.metalnessMap.channel),
|
|
roughnessMapUv: X && m(a.roughnessMap.channel),
|
|
anisotropyMapUv: $ && m(a.anisotropyMap.channel),
|
|
clearcoatMapUv: ee && m(a.clearcoatMap.channel),
|
|
clearcoatNormalMapUv: te && m(a.clearcoatNormalMap.channel),
|
|
clearcoatRoughnessMapUv: ne && m(a.clearcoatRoughnessMap.channel),
|
|
iridescenceMapUv: ie && m(a.iridescenceMap.channel),
|
|
iridescenceThicknessMapUv: re && m(a.iridescenceThicknessMap.channel),
|
|
sheenColorMapUv: ae && m(a.sheenColorMap.channel),
|
|
sheenRoughnessMapUv: se && m(a.sheenRoughnessMap.channel),
|
|
specularMapUv: oe && m(a.specularMap.channel),
|
|
specularColorMapUv: le && m(a.specularColorMap.channel),
|
|
specularIntensityMapUv: ce && m(a.specularIntensityMap.channel),
|
|
transmissionMapUv: he && m(a.transmissionMap.channel),
|
|
thicknessMapUv: ue && m(a.thicknessMap.channel),
|
|
alphaMapUv: fe && m(a.alphaMap.channel),
|
|
vertexTangents: !!v.attributes.tangent && (H || j),
|
|
vertexColors: a.vertexColors,
|
|
vertexAlphas: !0 === a.vertexColors && !!v.attributes.color && 4 === v.attributes.color.itemSize,
|
|
pointsUvs: !0 === A.isPoints && !!v.attributes.uv && (U || fe),
|
|
fog: !!_,
|
|
useFog: !0 === a.fog,
|
|
fogExp2: !!_ && _.isFogExp2,
|
|
flatShading: !0 === a.flatShading,
|
|
sizeAttenuation: !0 === a.sizeAttenuation,
|
|
logarithmicDepthBuffer: u,
|
|
reverseDepthBuffer: B,
|
|
skinning: !0 === A.isSkinnedMesh,
|
|
morphTargets: void 0 !== v.morphAttributes.position,
|
|
morphNormals: void 0 !== v.morphAttributes.normal,
|
|
morphColors: void 0 !== v.morphAttributes.color,
|
|
morphTargetsCount: S,
|
|
morphTextureStride: R,
|
|
numDirLights: o.directional.length,
|
|
numPointLights: o.point.length,
|
|
numSpotLights: o.spot.length,
|
|
numSpotLightMaps: o.spotLightMap.length,
|
|
numRectAreaLights: o.rectArea.length,
|
|
numHemiLights: o.hemi.length,
|
|
numDirLightShadows: o.directionalShadowMap.length,
|
|
numPointLightShadows: o.pointShadowMap.length,
|
|
numSpotLightShadows: o.spotShadowMap.length,
|
|
numSpotLightShadowsWithMaps: o.numSpotLightShadowsWithMaps,
|
|
numLightProbes: o.numLightProbes,
|
|
numClippingPlanes: s.numPlanes,
|
|
numClipIntersection: s.numIntersection,
|
|
dithering: a.dithering,
|
|
shadowMapEnabled: e.shadowMap.enabled && h.length > 0,
|
|
shadowMapType: e.shadowMap.type,
|
|
toneMapping: Ae,
|
|
decodeVideoTexture: U && !0 === a.map.isVideoTexture && Ut.getTransfer(a.map.colorSpace) === Je,
|
|
decodeVideoTextureEmissive: G && !0 === a.emissiveMap.isVideoTexture && Ut.getTransfer(a.emissiveMap.colorSpace) === Je,
|
|
premultipliedAlpha: a.premultipliedAlpha,
|
|
doubleSided: 2 === a.side,
|
|
flipSided: 1 === a.side,
|
|
useDepthPacking: a.depthPacking >= 0,
|
|
depthPacking: a.depthPacking || 0,
|
|
index0AttributeName: a.index0AttributeName,
|
|
extensionClipCullDistance: ge && !0 === a.extensions.clipCullDistance && i.has("WEBGL_clip_cull_distance"),
|
|
extensionMultiDraw: (ge && !0 === a.extensions.multiDraw || L) && i.has("WEBGL_multi_draw"),
|
|
rendererExtensionParallelShaderCompile: i.has("KHR_parallel_shader_compile"),
|
|
customProgramCacheKey: a.customProgramCacheKey()
|
|
};
|
|
return _e.vertexUv1s = c.has(1), _e.vertexUv2s = c.has(2), _e.vertexUv3s = c.has(3), c.clear(), _e
|
|
},
|
|
getProgramCacheKey: function(t) {
|
|
const n = [];
|
|
if (t.shaderID ? n.push(t.shaderID) : (n.push(t.customVertexShaderID), n.push(t.customFragmentShaderID)), void 0 !== t.defines)
|
|
for (const e in t.defines) n.push(e), n.push(t.defines[e]);
|
|
return !1 === t.isRawShaderMaterial && (! function(e, t) {
|
|
e.push(t.precision), e.push(t.outputColorSpace), e.push(t.envMapMode), e.push(t.envMapCubeUVHeight), e.push(t.mapUv), e.push(t.alphaMapUv), e.push(t.lightMapUv), e.push(t.aoMapUv), e.push(t.bumpMapUv), e.push(t.normalMapUv), e.push(t.displacementMapUv), e.push(t.emissiveMapUv), e.push(t.metalnessMapUv), e.push(t.roughnessMapUv), e.push(t.anisotropyMapUv), e.push(t.clearcoatMapUv), e.push(t.clearcoatNormalMapUv), e.push(t.clearcoatRoughnessMapUv), e.push(t.iridescenceMapUv), e.push(t.iridescenceThicknessMapUv), e.push(t.sheenColorMapUv), e.push(t.sheenRoughnessMapUv), e.push(t.specularMapUv), e.push(t.specularColorMapUv), e.push(t.specularIntensityMapUv), e.push(t.transmissionMapUv), e.push(t.thicknessMapUv), e.push(t.combine), e.push(t.fogExp2), e.push(t.sizeAttenuation), e.push(t.morphTargetsCount), e.push(t.morphAttributeCount), e.push(t.numDirLights), e.push(t.numPointLights), e.push(t.numSpotLights), e.push(t.numSpotLightMaps), e.push(t.numHemiLights), e.push(t.numRectAreaLights), e.push(t.numDirLightShadows), e.push(t.numPointLightShadows), e.push(t.numSpotLightShadows), e.push(t.numSpotLightShadowsWithMaps), e.push(t.numLightProbes), e.push(t.shadowMapType), e.push(t.toneMapping), e.push(t.numClippingPlanes), e.push(t.numClipIntersection), e.push(t.depthPacking)
|
|
}(n, t), function(e, t) {
|
|
o.disableAll(), t.supportsVertexTextures && o.enable(0);
|
|
t.instancing && o.enable(1);
|
|
t.instancingColor && o.enable(2);
|
|
t.instancingMorph && o.enable(3);
|
|
t.matcap && o.enable(4);
|
|
t.envMap && o.enable(5);
|
|
t.normalMapObjectSpace && o.enable(6);
|
|
t.normalMapTangentSpace && o.enable(7);
|
|
t.clearcoat && o.enable(8);
|
|
t.iridescence && o.enable(9);
|
|
t.alphaTest && o.enable(10);
|
|
t.vertexColors && o.enable(11);
|
|
t.vertexAlphas && o.enable(12);
|
|
t.vertexUv1s && o.enable(13);
|
|
t.vertexUv2s && o.enable(14);
|
|
t.vertexUv3s && o.enable(15);
|
|
t.vertexTangents && o.enable(16);
|
|
t.anisotropy && o.enable(17);
|
|
t.alphaHash && o.enable(18);
|
|
t.batching && o.enable(19);
|
|
t.dispersion && o.enable(20);
|
|
t.batchingColor && o.enable(21);
|
|
e.push(o.mask), o.disableAll(), t.fog && o.enable(0);
|
|
t.useFog && o.enable(1);
|
|
t.flatShading && o.enable(2);
|
|
t.logarithmicDepthBuffer && o.enable(3);
|
|
t.reverseDepthBuffer && o.enable(4);
|
|
t.skinning && o.enable(5);
|
|
t.morphTargets && o.enable(6);
|
|
t.morphNormals && o.enable(7);
|
|
t.morphColors && o.enable(8);
|
|
t.premultipliedAlpha && o.enable(9);
|
|
t.shadowMapEnabled && o.enable(10);
|
|
t.doubleSided && o.enable(11);
|
|
t.flipSided && o.enable(12);
|
|
t.useDepthPacking && o.enable(13);
|
|
t.dithering && o.enable(14);
|
|
t.transmission && o.enable(15);
|
|
t.sheen && o.enable(16);
|
|
t.opaque && o.enable(17);
|
|
t.pointsUvs && o.enable(18);
|
|
t.decodeVideoTexture && o.enable(19);
|
|
t.decodeVideoTextureEmissive && o.enable(20);
|
|
t.alphaToCoverage && o.enable(21);
|
|
e.push(o.mask)
|
|
}(n, t), n.push(e.outputColorSpace)), n.push(t.customProgramCacheKey), n.join()
|
|
},
|
|
getUniforms: function(e) {
|
|
const t = p[e.type];
|
|
let n;
|
|
if (t) {
|
|
const e = yd[t];
|
|
n = ir.clone(e.uniforms)
|
|
} else n = e.uniforms;
|
|
return n
|
|
},
|
|
acquireProgram: function(t, n) {
|
|
let i;
|
|
for (let e = 0, t = h.length; e < t; e++) {
|
|
const t = h[e];
|
|
if (t.cacheKey === n) {
|
|
i = t, ++i.usedTimes;
|
|
break
|
|
}
|
|
}
|
|
return void 0 === i && (i = new Tp(e, n, t, a), h.push(i)), i
|
|
},
|
|
releaseProgram: function(e) {
|
|
if (0 == --e.usedTimes) {
|
|
const t = h.indexOf(e);
|
|
h[t] = h[h.length - 1], h.pop(), e.destroy()
|
|
}
|
|
},
|
|
releaseShaderCache: function(e) {
|
|
l.remove(e)
|
|
},
|
|
programs: h,
|
|
dispose: function() {
|
|
l.dispose()
|
|
}
|
|
}
|
|
}
|
|
|
|
function Bp() {
|
|
let e = new WeakMap;
|
|
return {
|
|
has: function(t) {
|
|
return e.has(t)
|
|
},
|
|
get: function(t) {
|
|
let n = e.get(t);
|
|
return void 0 === n && (n = {}, e.set(t, n)), n
|
|
},
|
|
remove: function(t) {
|
|
e.delete(t)
|
|
},
|
|
update: function(t, n, i) {
|
|
e.get(t)[n] = i
|
|
},
|
|
dispose: function() {
|
|
e = new WeakMap
|
|
}
|
|
}
|
|
}
|
|
|
|
function Dp(e, t) {
|
|
return e.groupOrder !== t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !== t.renderOrder ? e.renderOrder - t.renderOrder : e.material.id !== t.material.id ? e.material.id - t.material.id : e.z !== t.z ? e.z - t.z : e.id - t.id
|
|
}
|
|
|
|
function Lp(e, t) {
|
|
return e.groupOrder !== t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !== t.renderOrder ? e.renderOrder - t.renderOrder : e.z !== t.z ? t.z - e.z : e.id - t.id
|
|
}
|
|
|
|
function Up() {
|
|
const e = [];
|
|
let t = 0;
|
|
const n = [],
|
|
i = [],
|
|
r = [];
|
|
|
|
function a(n, i, r, a, s, o) {
|
|
let l = e[t];
|
|
return void 0 === l ? (l = {
|
|
id: n.id,
|
|
object: n,
|
|
geometry: i,
|
|
material: r,
|
|
groupOrder: a,
|
|
renderOrder: n.renderOrder,
|
|
z: s,
|
|
group: o
|
|
}, e[t] = l) : (l.id = n.id, l.object = n, l.geometry = i, l.material = r, l.groupOrder = a, l.renderOrder = n.renderOrder, l.z = s, l.group = o), t++, l
|
|
}
|
|
return {
|
|
opaque: n,
|
|
transmissive: i,
|
|
transparent: r,
|
|
init: function() {
|
|
t = 0, n.length = 0, i.length = 0, r.length = 0
|
|
},
|
|
push: function(e, t, s, o, l, c) {
|
|
const h = a(e, t, s, o, l, c);
|
|
s.transmission > 0 ? i.push(h) : !0 === s.transparent ? r.push(h) : n.push(h)
|
|
},
|
|
unshift: function(e, t, s, o, l, c) {
|
|
const h = a(e, t, s, o, l, c);
|
|
s.transmission > 0 ? i.unshift(h) : !0 === s.transparent ? r.unshift(h) : n.unshift(h)
|
|
},
|
|
finish: function() {
|
|
for (let n = t, i = e.length; n < i; n++) {
|
|
const t = e[n];
|
|
if (null === t.id) break;
|
|
t.id = null, t.object = null, t.geometry = null, t.material = null, t.group = null
|
|
}
|
|
},
|
|
sort: function(e, t) {
|
|
n.length > 1 && n.sort(e || Dp), i.length > 1 && i.sort(t || Lp), r.length > 1 && r.sort(t || Lp)
|
|
}
|
|
}
|
|
}
|
|
|
|
function kp() {
|
|
let e = new WeakMap;
|
|
return {
|
|
get: function(t, n) {
|
|
const i = e.get(t);
|
|
let r;
|
|
return void 0 === i ? (r = new Up, e.set(t, [r])) : n >= i.length ? (r = new Up, i.push(r)) : r = i[n], r
|
|
},
|
|
dispose: function() {
|
|
e = new WeakMap
|
|
}
|
|
}
|
|
}
|
|
|
|
function Np() {
|
|
const e = {};
|
|
return {
|
|
get: function(t) {
|
|
if (void 0 !== e[t.id]) return e[t.id];
|
|
let n;
|
|
switch (t.type) {
|
|
case "DirectionalLight":
|
|
n = {
|
|
direction: new Zt,
|
|
color: new wi
|
|
};
|
|
break;
|
|
case "SpotLight":
|
|
n = {
|
|
position: new Zt,
|
|
direction: new Zt,
|
|
color: new wi,
|
|
distance: 0,
|
|
coneCos: 0,
|
|
penumbraCos: 0,
|
|
decay: 0
|
|
};
|
|
break;
|
|
case "PointLight":
|
|
n = {
|
|
position: new Zt,
|
|
color: new wi,
|
|
distance: 0,
|
|
decay: 0
|
|
};
|
|
break;
|
|
case "HemisphereLight":
|
|
n = {
|
|
direction: new Zt,
|
|
skyColor: new wi,
|
|
groundColor: new wi
|
|
};
|
|
break;
|
|
case "RectAreaLight":
|
|
n = {
|
|
color: new wi,
|
|
position: new Zt,
|
|
halfWidth: new Zt,
|
|
halfHeight: new Zt
|
|
}
|
|
}
|
|
return e[t.id] = n, n
|
|
}
|
|
}
|
|
}
|
|
let Fp = 0;
|
|
|
|
function Op(e, t) {
|
|
return (t.castShadow ? 2 : 0) - (e.castShadow ? 2 : 0) + (t.map ? 1 : 0) - (e.map ? 1 : 0)
|
|
}
|
|
|
|
function zp(e) {
|
|
const t = new Np,
|
|
n = function() {
|
|
const e = {};
|
|
return {
|
|
get: function(t) {
|
|
if (void 0 !== e[t.id]) return e[t.id];
|
|
let n;
|
|
switch (t.type) {
|
|
case "DirectionalLight":
|
|
case "SpotLight":
|
|
n = {
|
|
shadowIntensity: 1,
|
|
shadowBias: 0,
|
|
shadowNormalBias: 0,
|
|
shadowRadius: 1,
|
|
shadowMapSize: new Et
|
|
};
|
|
break;
|
|
case "PointLight":
|
|
n = {
|
|
shadowIntensity: 1,
|
|
shadowBias: 0,
|
|
shadowNormalBias: 0,
|
|
shadowRadius: 1,
|
|
shadowMapSize: new Et,
|
|
shadowCameraNear: 1,
|
|
shadowCameraFar: 1e3
|
|
}
|
|
}
|
|
return e[t.id] = n, n
|
|
}
|
|
}
|
|
}(),
|
|
i = {
|
|
version: 0,
|
|
hash: {
|
|
directionalLength: -1,
|
|
pointLength: -1,
|
|
spotLength: -1,
|
|
rectAreaLength: -1,
|
|
hemiLength: -1,
|
|
numDirectionalShadows: -1,
|
|
numPointShadows: -1,
|
|
numSpotShadows: -1,
|
|
numSpotMaps: -1,
|
|
numLightProbes: -1
|
|
},
|
|
ambient: [0, 0, 0],
|
|
probe: [],
|
|
directional: [],
|
|
directionalShadow: [],
|
|
directionalShadowMap: [],
|
|
directionalShadowMatrix: [],
|
|
spot: [],
|
|
spotLightMap: [],
|
|
spotShadow: [],
|
|
spotShadowMap: [],
|
|
spotLightMatrix: [],
|
|
rectArea: [],
|
|
rectAreaLTC1: null,
|
|
rectAreaLTC2: null,
|
|
point: [],
|
|
pointShadow: [],
|
|
pointShadowMap: [],
|
|
pointShadowMatrix: [],
|
|
hemi: [],
|
|
numSpotLightShadowsWithMaps: 0,
|
|
numLightProbes: 0
|
|
};
|
|
for (let e = 0; e < 9; e++) i.probe.push(new Zt);
|
|
const r = new Zt,
|
|
a = new Cn,
|
|
s = new Cn;
|
|
return {
|
|
setup: function(r) {
|
|
let a = 0,
|
|
s = 0,
|
|
o = 0;
|
|
for (let e = 0; e < 9; e++) i.probe[e].set(0, 0, 0);
|
|
let l = 0,
|
|
c = 0,
|
|
h = 0,
|
|
u = 0,
|
|
d = 0,
|
|
f = 0,
|
|
p = 0,
|
|
m = 0,
|
|
g = 0,
|
|
A = 0,
|
|
_ = 0;
|
|
r.sort(Op);
|
|
for (let e = 0, v = r.length; e < v; e++) {
|
|
const v = r[e],
|
|
w = v.color,
|
|
y = v.intensity,
|
|
x = v.distance,
|
|
b = v.shadow && v.shadow.map ? v.shadow.map.texture : null;
|
|
if (v.isAmbientLight) a += w.r * y, s += w.g * y, o += w.b * y;
|
|
else if (v.isLightProbe) {
|
|
for (let e = 0; e < 9; e++) i.probe[e].addScaledVector(v.sh.coefficients[e], y);
|
|
_++
|
|
} else if (v.isDirectionalLight) {
|
|
const e = t.get(v);
|
|
if (e.color.copy(v.color).multiplyScalar(v.intensity), v.castShadow) {
|
|
const e = v.shadow,
|
|
t = n.get(v);
|
|
t.shadowIntensity = e.intensity, t.shadowBias = e.bias, t.shadowNormalBias = e.normalBias, t.shadowRadius = e.radius, t.shadowMapSize = e.mapSize, i.directionalShadow[l] = t, i.directionalShadowMap[l] = b, i.directionalShadowMatrix[l] = v.shadow.matrix, f++
|
|
}
|
|
i.directional[l] = e, l++
|
|
} else if (v.isSpotLight) {
|
|
const e = t.get(v);
|
|
e.position.setFromMatrixPosition(v.matrixWorld), e.color.copy(w).multiplyScalar(y), e.distance = x, e.coneCos = Math.cos(v.angle), e.penumbraCos = Math.cos(v.angle * (1 - v.penumbra)), e.decay = v.decay, i.spot[h] = e;
|
|
const r = v.shadow;
|
|
if (v.map && (i.spotLightMap[g] = v.map, g++, r.updateMatrices(v), v.castShadow && A++), i.spotLightMatrix[h] = r.matrix, v.castShadow) {
|
|
const e = n.get(v);
|
|
e.shadowIntensity = r.intensity, e.shadowBias = r.bias, e.shadowNormalBias = r.normalBias, e.shadowRadius = r.radius, e.shadowMapSize = r.mapSize, i.spotShadow[h] = e, i.spotShadowMap[h] = b, m++
|
|
}
|
|
h++
|
|
} else if (v.isRectAreaLight) {
|
|
const e = t.get(v);
|
|
e.color.copy(w).multiplyScalar(y), e.halfWidth.set(.5 * v.width, 0, 0), e.halfHeight.set(0, .5 * v.height, 0), i.rectArea[u] = e, u++
|
|
} else if (v.isPointLight) {
|
|
const e = t.get(v);
|
|
if (e.color.copy(v.color).multiplyScalar(v.intensity), e.distance = v.distance, e.decay = v.decay, v.castShadow) {
|
|
const e = v.shadow,
|
|
t = n.get(v);
|
|
t.shadowIntensity = e.intensity, t.shadowBias = e.bias, t.shadowNormalBias = e.normalBias, t.shadowRadius = e.radius, t.shadowMapSize = e.mapSize, t.shadowCameraNear = e.camera.near, t.shadowCameraFar = e.camera.far, i.pointShadow[c] = t, i.pointShadowMap[c] = b, i.pointShadowMatrix[c] = v.shadow.matrix, p++
|
|
}
|
|
i.point[c] = e, c++
|
|
} else if (v.isHemisphereLight) {
|
|
const e = t.get(v);
|
|
e.skyColor.copy(v.color).multiplyScalar(y), e.groundColor.copy(v.groundColor).multiplyScalar(y), i.hemi[d] = e, d++
|
|
}
|
|
}
|
|
u > 0 && (!0 === e.has("OES_texture_float_linear") ? (i.rectAreaLTC1 = wd.LTC_FLOAT_1, i.rectAreaLTC2 = wd.LTC_FLOAT_2) : (i.rectAreaLTC1 = wd.LTC_HALF_1, i.rectAreaLTC2 = wd.LTC_HALF_2)), i.ambient[0] = a, i.ambient[1] = s, i.ambient[2] = o;
|
|
const v = i.hash;
|
|
v.directionalLength === l && v.pointLength === c && v.spotLength === h && v.rectAreaLength === u && v.hemiLength === d && v.numDirectionalShadows === f && v.numPointShadows === p && v.numSpotShadows === m && v.numSpotMaps === g && v.numLightProbes === _ || (i.directional.length = l, i.spot.length = h, i.rectArea.length = u, i.point.length = c, i.hemi.length = d, i.directionalShadow.length = f, i.directionalShadowMap.length = f, i.pointShadow.length = p, i.pointShadowMap.length = p, i.spotShadow.length = m, i.spotShadowMap.length = m, i.directionalShadowMatrix.length = f, i.pointShadowMatrix.length = p, i.spotLightMatrix.length = m + g - A, i.spotLightMap.length = g, i.numSpotLightShadowsWithMaps = A, i.numLightProbes = _, v.directionalLength = l, v.pointLength = c, v.spotLength = h, v.rectAreaLength = u, v.hemiLength = d, v.numDirectionalShadows = f, v.numPointShadows = p, v.numSpotShadows = m, v.numSpotMaps = g, v.numLightProbes = _, i.version = Fp++)
|
|
},
|
|
setupView: function(e, t) {
|
|
let n = 0,
|
|
o = 0,
|
|
l = 0,
|
|
c = 0,
|
|
h = 0;
|
|
const u = t.matrixWorldInverse;
|
|
for (let t = 0, d = e.length; t < d; t++) {
|
|
const d = e[t];
|
|
if (d.isDirectionalLight) {
|
|
const e = i.directional[n];
|
|
e.direction.setFromMatrixPosition(d.matrixWorld), r.setFromMatrixPosition(d.target.matrixWorld), e.direction.sub(r), e.direction.transformDirection(u), n++
|
|
} else if (d.isSpotLight) {
|
|
const e = i.spot[l];
|
|
e.position.setFromMatrixPosition(d.matrixWorld), e.position.applyMatrix4(u), e.direction.setFromMatrixPosition(d.matrixWorld), r.setFromMatrixPosition(d.target.matrixWorld), e.direction.sub(r), e.direction.transformDirection(u), l++
|
|
} else if (d.isRectAreaLight) {
|
|
const e = i.rectArea[c];
|
|
e.position.setFromMatrixPosition(d.matrixWorld), e.position.applyMatrix4(u), s.identity(), a.copy(d.matrixWorld), a.premultiply(u), s.extractRotation(a), e.halfWidth.set(.5 * d.width, 0, 0), e.halfHeight.set(0, .5 * d.height, 0), e.halfWidth.applyMatrix4(s), e.halfHeight.applyMatrix4(s), c++
|
|
} else if (d.isPointLight) {
|
|
const e = i.point[o];
|
|
e.position.setFromMatrixPosition(d.matrixWorld), e.position.applyMatrix4(u), o++
|
|
} else if (d.isHemisphereLight) {
|
|
const e = i.hemi[h];
|
|
e.direction.setFromMatrixPosition(d.matrixWorld), e.direction.transformDirection(u), h++
|
|
}
|
|
}
|
|
},
|
|
state: i
|
|
}
|
|
}
|
|
|
|
function Wp(e) {
|
|
const t = new zp(e),
|
|
n = [],
|
|
i = [];
|
|
const r = {
|
|
lightsArray: n,
|
|
shadowsArray: i,
|
|
camera: null,
|
|
lights: t,
|
|
transmissionRenderTarget: {}
|
|
};
|
|
return {
|
|
init: function(e) {
|
|
r.camera = e, n.length = 0, i.length = 0
|
|
},
|
|
state: r,
|
|
setupLights: function() {
|
|
t.setup(n)
|
|
},
|
|
setupLightsView: function(e) {
|
|
t.setupView(n, e)
|
|
},
|
|
pushLight: function(e) {
|
|
n.push(e)
|
|
},
|
|
pushShadow: function(e) {
|
|
i.push(e)
|
|
}
|
|
}
|
|
}
|
|
|
|
function Hp(e) {
|
|
let t = new WeakMap;
|
|
return {
|
|
get: function(n, i = 0) {
|
|
const r = t.get(n);
|
|
let a;
|
|
return void 0 === r ? (a = new Wp(e), t.set(n, [a])) : i >= r.length ? (a = new Wp(e), r.push(a)) : a = r[i], a
|
|
},
|
|
dispose: function() {
|
|
t = new WeakMap
|
|
}
|
|
}
|
|
}
|
|
|
|
function Vp(e, n, a) {
|
|
let s = new Jr;
|
|
const o = new Et,
|
|
l = new Et,
|
|
c = new Qt,
|
|
h = new Ea({
|
|
depthPacking: 3201
|
|
}),
|
|
u = new Sa,
|
|
d = {},
|
|
f = a.maxTextureSize,
|
|
p = {
|
|
[t]: 1,
|
|
[i]: 0,
|
|
[r]: 2
|
|
},
|
|
m = new rr({
|
|
defines: {
|
|
VSM_SAMPLES: 8
|
|
},
|
|
uniforms: {
|
|
shadow_pass: {
|
|
value: null
|
|
},
|
|
resolution: {
|
|
value: new Et
|
|
},
|
|
radius: {
|
|
value: 4
|
|
}
|
|
},
|
|
vertexShader: "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",
|
|
fragmentShader: "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"
|
|
}),
|
|
g = m.clone();
|
|
g.defines.HORIZONTAL_PASS = 1;
|
|
const A = new Oi;
|
|
A.setAttribute("position", new Ci(new Float32Array([-1, -1, .5, 3, -1, .5, -1, 3, .5]), 3));
|
|
const _ = new Zi(A, m),
|
|
v = this;
|
|
this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = 1;
|
|
let w = this.type;
|
|
|
|
function y(t, i) {
|
|
const r = n.update(_);
|
|
m.defines.VSM_SAMPLES !== t.blurSamples && (m.defines.VSM_SAMPLES = t.blurSamples, g.defines.VSM_SAMPLES = t.blurSamples, m.needsUpdate = !0, g.needsUpdate = !0), null === t.mapPass && (t.mapPass = new jt(o.x, o.y)), m.uniforms.shadow_pass.value = t.map.texture, m.uniforms.resolution.value = t.mapSize, m.uniforms.radius.value = t.radius, e.setRenderTarget(t.mapPass), e.clear(), e.renderBufferDirect(i, null, r, m, _, null), g.uniforms.shadow_pass.value = t.mapPass.texture, g.uniforms.resolution.value = t.mapSize, g.uniforms.radius.value = t.radius, e.setRenderTarget(t.map), e.clear(), e.renderBufferDirect(i, null, r, g, _, null)
|
|
}
|
|
|
|
function x(t, n, i, r) {
|
|
let a = null;
|
|
const s = !0 === i.isPointLight ? t.customDistanceMaterial : t.customDepthMaterial;
|
|
if (void 0 !== s) a = s;
|
|
else if (a = !0 === i.isPointLight ? u : h, e.localClippingEnabled && !0 === n.clipShadows && Array.isArray(n.clippingPlanes) && 0 !== n.clippingPlanes.length || n.displacementMap && 0 !== n.displacementScale || n.alphaMap && n.alphaTest > 0 || n.map && n.alphaTest > 0) {
|
|
const e = a.uuid,
|
|
t = n.uuid;
|
|
let i = d[e];
|
|
void 0 === i && (i = {}, d[e] = i);
|
|
let r = i[t];
|
|
void 0 === r && (r = a.clone(), i[t] = r, n.addEventListener("dispose", E)), a = r
|
|
}
|
|
if (a.visible = n.visible, a.wireframe = n.wireframe, a.side = 3 === r ? null !== n.shadowSide ? n.shadowSide : n.side : null !== n.shadowSide ? n.shadowSide : p[n.side], a.alphaMap = n.alphaMap, a.alphaTest = n.alphaTest, a.map = n.map, a.clipShadows = n.clipShadows, a.clippingPlanes = n.clippingPlanes, a.clipIntersection = n.clipIntersection, a.displacementMap = n.displacementMap, a.displacementScale = n.displacementScale, a.displacementBias = n.displacementBias, a.wireframeLinewidth = n.wireframeLinewidth, a.linewidth = n.linewidth, !0 === i.isPointLight && !0 === a.isMeshDistanceMaterial) {
|
|
e.properties.get(a).light = i
|
|
}
|
|
return a
|
|
}
|
|
|
|
function b(t, i, r, a, o) {
|
|
if (!1 === t.visible) return;
|
|
if (t.layers.test(i.layers) && (t.isMesh || t.isLine || t.isPoints) && (t.castShadow || t.receiveShadow && 3 === o) && (!t.frustumCulled || s.intersectsObject(t))) {
|
|
t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse, t.matrixWorld);
|
|
const s = n.update(t),
|
|
l = t.material;
|
|
if (Array.isArray(l)) {
|
|
const n = s.groups;
|
|
for (let c = 0, h = n.length; c < h; c++) {
|
|
const h = n[c],
|
|
u = l[h.materialIndex];
|
|
if (u && u.visible) {
|
|
const n = x(t, u, a, o);
|
|
t.onBeforeShadow(e, t, i, r, s, n, h), e.renderBufferDirect(r, null, s, n, t, h), t.onAfterShadow(e, t, i, r, s, n, h)
|
|
}
|
|
}
|
|
} else if (l.visible) {
|
|
const n = x(t, l, a, o);
|
|
t.onBeforeShadow(e, t, i, r, s, n, null), e.renderBufferDirect(r, null, s, n, t, null), t.onAfterShadow(e, t, i, r, s, n, null)
|
|
}
|
|
}
|
|
const l = t.children;
|
|
for (let e = 0, t = l.length; e < t; e++) b(l[e], i, r, a, o)
|
|
}
|
|
|
|
function E(e) {
|
|
e.target.removeEventListener("dispose", E);
|
|
for (const t in d) {
|
|
const n = d[t],
|
|
i = e.target.uuid;
|
|
if (i in n) {
|
|
n[i].dispose(), delete n[i]
|
|
}
|
|
}
|
|
}
|
|
this.render = function(t, n, i) {
|
|
if (!1 === v.enabled) return;
|
|
if (!1 === v.autoUpdate && !1 === v.needsUpdate) return;
|
|
if (0 === t.length) return;
|
|
const r = e.getRenderTarget(),
|
|
a = e.getActiveCubeFace(),
|
|
h = e.getActiveMipmapLevel(),
|
|
u = e.state;
|
|
u.setBlending(0), u.buffers.color.setClear(1, 1, 1, 1), u.buffers.depth.setTest(!0), u.setScissorTest(!1);
|
|
const d = 3 !== w && 3 === this.type,
|
|
p = 3 === w && 3 !== this.type;
|
|
for (let r = 0, a = t.length; r < a; r++) {
|
|
const a = t[r],
|
|
h = a.shadow;
|
|
if (void 0 === h) {
|
|
console.warn("THREE.WebGLShadowMap:", a, "has no shadow.");
|
|
continue
|
|
}
|
|
if (!1 === h.autoUpdate && !1 === h.needsUpdate) continue;
|
|
o.copy(h.mapSize);
|
|
const m = h.getFrameExtents();
|
|
if (o.multiply(m), l.copy(h.mapSize), (o.x > f || o.y > f) && (o.x > f && (l.x = Math.floor(f / m.x), o.x = l.x * m.x, h.mapSize.x = l.x), o.y > f && (l.y = Math.floor(f / m.y), o.y = l.y * m.y, h.mapSize.y = l.y)), null === h.map || !0 === d || !0 === p) {
|
|
const e = 3 !== this.type ? {
|
|
minFilter: z,
|
|
magFilter: z
|
|
} : {};
|
|
null !== h.map && h.map.dispose(), h.map = new jt(o.x, o.y, e), h.map.texture.name = a.name + ".shadowMap", h.camera.updateProjectionMatrix()
|
|
}
|
|
e.setRenderTarget(h.map), e.clear();
|
|
const g = h.getViewportCount();
|
|
for (let e = 0; e < g; e++) {
|
|
const t = h.getViewport(e);
|
|
c.set(l.x * t.x, l.y * t.y, l.x * t.z, l.y * t.w), u.viewport(c), h.updateMatrices(a, e), s = h.getFrustum(), b(n, i, h.camera, a, this.type)
|
|
}!0 !== h.isPointLightShadow && 3 === this.type && y(h, i), h.needsUpdate = !1
|
|
}
|
|
w = this.type, v.needsUpdate = !1, e.setRenderTarget(r, a, h)
|
|
}
|
|
}
|
|
const Gp = {
|
|
[b]: 1,
|
|
[S]: 6,
|
|
[T]: 7,
|
|
[M]: 5,
|
|
[E]: 0,
|
|
[I]: 2,
|
|
[R]: 4,
|
|
[C]: 3
|
|
};
|
|
|
|
function Qp(e, t) {
|
|
const n = new function() {
|
|
let t = !1;
|
|
const n = new Qt;
|
|
let i = null;
|
|
const r = new Qt(0, 0, 0, 0);
|
|
return {
|
|
setMask: function(n) {
|
|
i === n || t || (e.colorMask(n, n, n, n), i = n)
|
|
},
|
|
setLocked: function(e) {
|
|
t = e
|
|
},
|
|
setClear: function(t, i, a, s, o) {
|
|
!0 === o && (t *= s, i *= s, a *= s), n.set(t, i, a, s), !1 === r.equals(n) && (e.clearColor(t, i, a, s), r.copy(n))
|
|
},
|
|
reset: function() {
|
|
t = !1, i = null, r.set(-1, 0, 0, 0)
|
|
}
|
|
}
|
|
},
|
|
i = new function() {
|
|
let n = !1,
|
|
i = !1,
|
|
r = null,
|
|
a = null,
|
|
s = null;
|
|
return {
|
|
setReversed: function(e) {
|
|
if (i !== e) {
|
|
const e = t.get("EXT_clip_control");
|
|
i ? e.clipControlEXT(e.LOWER_LEFT_EXT, e.ZERO_TO_ONE_EXT) : e.clipControlEXT(e.LOWER_LEFT_EXT, e.NEGATIVE_ONE_TO_ONE_EXT);
|
|
const n = s;
|
|
s = null, this.setClear(n)
|
|
}
|
|
i = e
|
|
},
|
|
getReversed: function() {
|
|
return i
|
|
},
|
|
setTest: function(t) {
|
|
t ? re(e.DEPTH_TEST) : ae(e.DEPTH_TEST)
|
|
},
|
|
setMask: function(t) {
|
|
r === t || n || (e.depthMask(t), r = t)
|
|
},
|
|
setFunc: function(t) {
|
|
if (i && (t = Gp[t]), a !== t) {
|
|
switch (t) {
|
|
case 0:
|
|
e.depthFunc(e.NEVER);
|
|
break;
|
|
case 1:
|
|
e.depthFunc(e.ALWAYS);
|
|
break;
|
|
case 2:
|
|
e.depthFunc(e.LESS);
|
|
break;
|
|
case 3:
|
|
default:
|
|
e.depthFunc(e.LEQUAL);
|
|
break;
|
|
case 4:
|
|
e.depthFunc(e.EQUAL);
|
|
break;
|
|
case 5:
|
|
e.depthFunc(e.GEQUAL);
|
|
break;
|
|
case 6:
|
|
e.depthFunc(e.GREATER);
|
|
break;
|
|
case 7:
|
|
e.depthFunc(e.NOTEQUAL)
|
|
}
|
|
a = t
|
|
}
|
|
},
|
|
setLocked: function(e) {
|
|
n = e
|
|
},
|
|
setClear: function(t) {
|
|
s !== t && (i && (t = 1 - t), e.clearDepth(t), s = t)
|
|
},
|
|
reset: function() {
|
|
n = !1, r = null, a = null, s = null, i = !1
|
|
}
|
|
}
|
|
},
|
|
r = new function() {
|
|
let t = !1,
|
|
n = null,
|
|
i = null,
|
|
r = null,
|
|
a = null,
|
|
s = null,
|
|
o = null,
|
|
l = null,
|
|
c = null;
|
|
return {
|
|
setTest: function(n) {
|
|
t || (n ? re(e.STENCIL_TEST) : ae(e.STENCIL_TEST))
|
|
},
|
|
setMask: function(i) {
|
|
n === i || t || (e.stencilMask(i), n = i)
|
|
},
|
|
setFunc: function(t, n, s) {
|
|
i === t && r === n && a === s || (e.stencilFunc(t, n, s), i = t, r = n, a = s)
|
|
},
|
|
setOp: function(t, n, i) {
|
|
s === t && o === n && l === i || (e.stencilOp(t, n, i), s = t, o = n, l = i)
|
|
},
|
|
setLocked: function(e) {
|
|
t = e
|
|
},
|
|
setClear: function(t) {
|
|
c !== t && (e.clearStencil(t), c = t)
|
|
},
|
|
reset: function() {
|
|
t = !1, n = null, i = null, r = null, a = null, s = null, o = null, l = null, c = null
|
|
}
|
|
}
|
|
},
|
|
b = new WeakMap,
|
|
E = new WeakMap;
|
|
let S = {},
|
|
M = {},
|
|
T = new WeakMap,
|
|
C = [],
|
|
I = null,
|
|
R = !1,
|
|
P = null,
|
|
B = null,
|
|
D = null,
|
|
L = null,
|
|
U = null,
|
|
k = null,
|
|
N = null,
|
|
F = new wi(0, 0, 0),
|
|
O = 0,
|
|
z = !1,
|
|
W = null,
|
|
H = null,
|
|
V = null,
|
|
G = null,
|
|
Q = null;
|
|
const X = e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
let j = !1,
|
|
q = 0;
|
|
const Y = e.getParameter(e.VERSION); - 1 !== Y.indexOf("WebGL") ? (q = parseFloat(/^WebGL (\d)/.exec(Y)[1]), j = q >= 1) : -1 !== Y.indexOf("OpenGL ES") && (q = parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]), j = q >= 2);
|
|
let K = null,
|
|
Z = {};
|
|
const J = e.getParameter(e.SCISSOR_BOX),
|
|
$ = e.getParameter(e.VIEWPORT),
|
|
ee = (new Qt).fromArray(J),
|
|
te = (new Qt).fromArray($);
|
|
|
|
function ne(t, n, i, r) {
|
|
const a = new Uint8Array(4),
|
|
s = e.createTexture();
|
|
e.bindTexture(t, s), e.texParameteri(t, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(t, e.TEXTURE_MAG_FILTER, e.NEAREST);
|
|
for (let s = 0; s < i; s++) t === e.TEXTURE_3D || t === e.TEXTURE_2D_ARRAY ? e.texImage3D(n, 0, e.RGBA, 1, 1, r, 0, e.RGBA, e.UNSIGNED_BYTE, a) : e.texImage2D(n + s, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, a);
|
|
return s
|
|
}
|
|
const ie = {};
|
|
|
|
function re(t) {
|
|
!0 !== S[t] && (e.enable(t), S[t] = !0)
|
|
}
|
|
|
|
function ae(t) {
|
|
!1 !== S[t] && (e.disable(t), S[t] = !1)
|
|
}
|
|
ie[e.TEXTURE_2D] = ne(e.TEXTURE_2D, e.TEXTURE_2D, 1), ie[e.TEXTURE_CUBE_MAP] = ne(e.TEXTURE_CUBE_MAP, e.TEXTURE_CUBE_MAP_POSITIVE_X, 6), ie[e.TEXTURE_2D_ARRAY] = ne(e.TEXTURE_2D_ARRAY, e.TEXTURE_2D_ARRAY, 1, 1), ie[e.TEXTURE_3D] = ne(e.TEXTURE_3D, e.TEXTURE_3D, 1, 1), n.setClear(0, 0, 0, 1), i.setClear(1), r.setClear(0), re(e.DEPTH_TEST), i.setFunc(3), ce(!1), he(1), re(e.CULL_FACE), le(0);
|
|
const se = {
|
|
[a]: e.FUNC_ADD,
|
|
[s]: e.FUNC_SUBTRACT,
|
|
[o]: e.FUNC_REVERSE_SUBTRACT
|
|
};
|
|
se[103] = e.MIN, se[104] = e.MAX;
|
|
const oe = {
|
|
[l]: e.ZERO,
|
|
[c]: e.ONE,
|
|
[h]: e.SRC_COLOR,
|
|
[d]: e.SRC_ALPHA,
|
|
[_]: e.SRC_ALPHA_SATURATE,
|
|
[g]: e.DST_COLOR,
|
|
[p]: e.DST_ALPHA,
|
|
[u]: e.ONE_MINUS_SRC_COLOR,
|
|
[f]: e.ONE_MINUS_SRC_ALPHA,
|
|
[A]: e.ONE_MINUS_DST_COLOR,
|
|
[m]: e.ONE_MINUS_DST_ALPHA,
|
|
[v]: e.CONSTANT_COLOR,
|
|
[w]: e.ONE_MINUS_CONSTANT_COLOR,
|
|
[y]: e.CONSTANT_ALPHA,
|
|
[x]: e.ONE_MINUS_CONSTANT_ALPHA
|
|
};
|
|
|
|
function le(t, n, i, r, s, o, l, c, h, u) {
|
|
if (0 !== t) {
|
|
if (!1 === R && (re(e.BLEND), R = !0), 5 === t) s = s || n, o = o || i, l = l || r, n === B && s === U || (e.blendEquationSeparate(se[n], se[s]), B = n, U = s), i === D && r === L && o === k && l === N || (e.blendFuncSeparate(oe[i], oe[r], oe[o], oe[l]), D = i, L = r, k = o, N = l), !1 !== c.equals(F) && h === O || (e.blendColor(c.r, c.g, c.b, h), F.copy(c), O = h), P = t, z = !1;
|
|
else if (t !== P || u !== z) {
|
|
if (B === a && U === a || (e.blendEquation(e.FUNC_ADD), B = a, U = a), u) switch (t) {
|
|
case 1:
|
|
e.blendFuncSeparate(e.ONE, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA);
|
|
break;
|
|
case 2:
|
|
e.blendFunc(e.ONE, e.ONE);
|
|
break;
|
|
case 3:
|
|
e.blendFuncSeparate(e.ZERO, e.ONE_MINUS_SRC_COLOR, e.ZERO, e.ONE);
|
|
break;
|
|
case 4:
|
|
e.blendFuncSeparate(e.ZERO, e.SRC_COLOR, e.ZERO, e.SRC_ALPHA);
|
|
break;
|
|
default:
|
|
console.error("THREE.WebGLState: Invalid blending: ", t)
|
|
} else switch (t) {
|
|
case 1:
|
|
e.blendFuncSeparate(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA);
|
|
break;
|
|
case 2:
|
|
e.blendFunc(e.SRC_ALPHA, e.ONE);
|
|
break;
|
|
case 3:
|
|
e.blendFuncSeparate(e.ZERO, e.ONE_MINUS_SRC_COLOR, e.ZERO, e.ONE);
|
|
break;
|
|
case 4:
|
|
e.blendFunc(e.ZERO, e.SRC_COLOR);
|
|
break;
|
|
default:
|
|
console.error("THREE.WebGLState: Invalid blending: ", t)
|
|
}
|
|
D = null, L = null, k = null, N = null, F.set(0, 0, 0), O = 0, P = t, z = u
|
|
}
|
|
} else !0 === R && (ae(e.BLEND), R = !1)
|
|
}
|
|
|
|
function ce(t) {
|
|
W !== t && (t ? e.frontFace(e.CW) : e.frontFace(e.CCW), W = t)
|
|
}
|
|
|
|
function he(t) {
|
|
0 !== t ? (re(e.CULL_FACE), t !== H && (1 === t ? e.cullFace(e.BACK) : 2 === t ? e.cullFace(e.FRONT) : e.cullFace(e.FRONT_AND_BACK))) : ae(e.CULL_FACE), H = t
|
|
}
|
|
|
|
function ue(t, n, i) {
|
|
t ? (re(e.POLYGON_OFFSET_FILL), G === n && Q === i || (e.polygonOffset(n, i), G = n, Q = i)) : ae(e.POLYGON_OFFSET_FILL)
|
|
}
|
|
return {
|
|
buffers: {
|
|
color: n,
|
|
depth: i,
|
|
stencil: r
|
|
},
|
|
enable: re,
|
|
disable: ae,
|
|
bindFramebuffer: function(t, n) {
|
|
return M[t] !== n && (e.bindFramebuffer(t, n), M[t] = n, t === e.DRAW_FRAMEBUFFER && (M[e.FRAMEBUFFER] = n), t === e.FRAMEBUFFER && (M[e.DRAW_FRAMEBUFFER] = n), !0)
|
|
},
|
|
drawBuffers: function(t, n) {
|
|
let i = C,
|
|
r = !1;
|
|
if (t) {
|
|
i = T.get(n), void 0 === i && (i = [], T.set(n, i));
|
|
const a = t.textures;
|
|
if (i.length !== a.length || i[0] !== e.COLOR_ATTACHMENT0) {
|
|
for (let t = 0, n = a.length; t < n; t++) i[t] = e.COLOR_ATTACHMENT0 + t;
|
|
i.length = a.length, r = !0
|
|
}
|
|
} else i[0] !== e.BACK && (i[0] = e.BACK, r = !0);
|
|
r && e.drawBuffers(i)
|
|
},
|
|
useProgram: function(t) {
|
|
return I !== t && (e.useProgram(t), I = t, !0)
|
|
},
|
|
setBlending: le,
|
|
setMaterial: function(t, a) {
|
|
2 === t.side ? ae(e.CULL_FACE) : re(e.CULL_FACE);
|
|
let s = 1 === t.side;
|
|
a && (s = !s), ce(s), 1 === t.blending && !1 === t.transparent ? le(0) : le(t.blending, t.blendEquation, t.blendSrc, t.blendDst, t.blendEquationAlpha, t.blendSrcAlpha, t.blendDstAlpha, t.blendColor, t.blendAlpha, t.premultipliedAlpha), i.setFunc(t.depthFunc), i.setTest(t.depthTest), i.setMask(t.depthWrite), n.setMask(t.colorWrite);
|
|
const o = t.stencilWrite;
|
|
r.setTest(o), o && (r.setMask(t.stencilWriteMask), r.setFunc(t.stencilFunc, t.stencilRef, t.stencilFuncMask), r.setOp(t.stencilFail, t.stencilZFail, t.stencilZPass)), ue(t.polygonOffset, t.polygonOffsetFactor, t.polygonOffsetUnits), !0 === t.alphaToCoverage ? re(e.SAMPLE_ALPHA_TO_COVERAGE) : ae(e.SAMPLE_ALPHA_TO_COVERAGE)
|
|
},
|
|
setFlipSided: ce,
|
|
setCullFace: he,
|
|
setLineWidth: function(t) {
|
|
t !== V && (j && e.lineWidth(t), V = t)
|
|
},
|
|
setPolygonOffset: ue,
|
|
setScissorTest: function(t) {
|
|
t ? re(e.SCISSOR_TEST) : ae(e.SCISSOR_TEST)
|
|
},
|
|
activeTexture: function(t) {
|
|
void 0 === t && (t = e.TEXTURE0 + X - 1), K !== t && (e.activeTexture(t), K = t)
|
|
},
|
|
bindTexture: function(t, n, i) {
|
|
void 0 === i && (i = null === K ? e.TEXTURE0 + X - 1 : K);
|
|
let r = Z[i];
|
|
void 0 === r && (r = {
|
|
type: void 0,
|
|
texture: void 0
|
|
}, Z[i] = r), r.type === t && r.texture === n || (K !== i && (e.activeTexture(i), K = i), e.bindTexture(t, n || ie[t]), r.type = t, r.texture = n)
|
|
},
|
|
unbindTexture: function() {
|
|
const t = Z[K];
|
|
void 0 !== t && void 0 !== t.type && (e.bindTexture(t.type, null), t.type = void 0, t.texture = void 0)
|
|
},
|
|
compressedTexImage2D: function() {
|
|
try {
|
|
e.compressedTexImage2D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
compressedTexImage3D: function() {
|
|
try {
|
|
e.compressedTexImage3D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
texImage2D: function() {
|
|
try {
|
|
e.texImage2D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
texImage3D: function() {
|
|
try {
|
|
e.texImage3D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
updateUBOMapping: function(t, n) {
|
|
let i = E.get(n);
|
|
void 0 === i && (i = new WeakMap, E.set(n, i));
|
|
let r = i.get(t);
|
|
void 0 === r && (r = e.getUniformBlockIndex(n, t.name), i.set(t, r))
|
|
},
|
|
uniformBlockBinding: function(t, n) {
|
|
const i = E.get(n).get(t);
|
|
b.get(n) !== i && (e.uniformBlockBinding(n, i, t.__bindingPointIndex), b.set(n, i))
|
|
},
|
|
texStorage2D: function() {
|
|
try {
|
|
e.texStorage2D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
texStorage3D: function() {
|
|
try {
|
|
e.texStorage3D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
texSubImage2D: function() {
|
|
try {
|
|
e.texSubImage2D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
texSubImage3D: function() {
|
|
try {
|
|
e.texSubImage3D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
compressedTexSubImage2D: function() {
|
|
try {
|
|
e.compressedTexSubImage2D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
compressedTexSubImage3D: function() {
|
|
try {
|
|
e.compressedTexSubImage3D(...arguments)
|
|
} catch (e) {
|
|
console.error("THREE.WebGLState:", e)
|
|
}
|
|
},
|
|
scissor: function(t) {
|
|
!1 === ee.equals(t) && (e.scissor(t.x, t.y, t.z, t.w), ee.copy(t))
|
|
},
|
|
viewport: function(t) {
|
|
!1 === te.equals(t) && (e.viewport(t.x, t.y, t.z, t.w), te.copy(t))
|
|
},
|
|
reset: function() {
|
|
e.disable(e.BLEND), e.disable(e.CULL_FACE), e.disable(e.DEPTH_TEST), e.disable(e.POLYGON_OFFSET_FILL), e.disable(e.SCISSOR_TEST), e.disable(e.STENCIL_TEST), e.disable(e.SAMPLE_ALPHA_TO_COVERAGE), e.blendEquation(e.FUNC_ADD), e.blendFunc(e.ONE, e.ZERO), e.blendFuncSeparate(e.ONE, e.ZERO, e.ONE, e.ZERO), e.blendColor(0, 0, 0, 0), e.colorMask(!0, !0, !0, !0), e.clearColor(0, 0, 0, 0), e.depthMask(!0), e.depthFunc(e.LESS), i.setReversed(!1), e.clearDepth(1), e.stencilMask(4294967295), e.stencilFunc(e.ALWAYS, 0, 4294967295), e.stencilOp(e.KEEP, e.KEEP, e.KEEP), e.clearStencil(0), e.cullFace(e.BACK), e.frontFace(e.CCW), e.polygonOffset(0, 0), e.activeTexture(e.TEXTURE0), e.bindFramebuffer(e.FRAMEBUFFER, null), e.bindFramebuffer(e.DRAW_FRAMEBUFFER, null), e.bindFramebuffer(e.READ_FRAMEBUFFER, null), e.useProgram(null), e.lineWidth(1), e.scissor(0, 0, e.canvas.width, e.canvas.height), e.viewport(0, 0, e.canvas.width, e.canvas.height), S = {}, K = null, Z = {}, M = {}, T = new WeakMap, C = [], I = null, R = !1, P = null, B = null, D = null, L = null, U = null, k = null, N = null, F = new wi(0, 0, 0), O = 0, z = !1, W = null, H = null, V = null, G = null, Q = null, ee.set(0, 0, e.canvas.width, e.canvas.height), te.set(0, 0, e.canvas.width, e.canvas.height), n.reset(), i.reset(), r.reset()
|
|
}
|
|
}
|
|
}
|
|
|
|
function Xp(e, t, n, i, r, a, s) {
|
|
const o = t.has("WEBGL_multisampled_render_to_texture") ? t.get("WEBGL_multisampled_render_to_texture") : null,
|
|
l = "undefined" != typeof navigator && /OculusBrowser/g.test(navigator.userAgent),
|
|
c = new Et,
|
|
h = new WeakMap;
|
|
let u;
|
|
const d = new WeakMap;
|
|
let f = !1;
|
|
try {
|
|
f = "undefined" != typeof OffscreenCanvas && null !== new OffscreenCanvas(1, 1).getContext("2d")
|
|
} catch (e) {}
|
|
|
|
function p(e, t) {
|
|
return f ? new OffscreenCanvas(e, t) : Ct("canvas")
|
|
}
|
|
|
|
function m(e, t, n) {
|
|
let i = 1;
|
|
const r = ee(e);
|
|
if ((r.width > n || r.height > n) && (i = n / Math.max(r.width, r.height)), i < 1) {
|
|
if ("undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && e instanceof ImageBitmap || "undefined" != typeof VideoFrame && e instanceof VideoFrame) {
|
|
const n = Math.floor(i * r.width),
|
|
a = Math.floor(i * r.height);
|
|
void 0 === u && (u = p(n, a));
|
|
const s = t ? p(n, a) : u;
|
|
s.width = n, s.height = a;
|
|
return s.getContext("2d").drawImage(e, 0, 0, n, a), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + r.width + "x" + r.height + ") to (" + n + "x" + a + ")."), s
|
|
}
|
|
return "data" in e && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + r.width + "x" + r.height + ")."), e
|
|
}
|
|
return e
|
|
}
|
|
|
|
function g(e) {
|
|
return e.generateMipmaps
|
|
}
|
|
|
|
function A(t) {
|
|
e.generateMipmap(t)
|
|
}
|
|
|
|
function _(t) {
|
|
return t.isWebGLCubeRenderTarget ? e.TEXTURE_CUBE_MAP : t.isWebGL3DRenderTarget ? e.TEXTURE_3D : t.isWebGLArrayRenderTarget || t.isCompressedArrayTexture ? e.TEXTURE_2D_ARRAY : e.TEXTURE_2D
|
|
}
|
|
|
|
function v(n, i, r, a, s = !1) {
|
|
if (null !== n) {
|
|
if (void 0 !== e[n]) return e[n];
|
|
console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + n + "'")
|
|
}
|
|
let o = i;
|
|
if (i === e.RED && (r === e.FLOAT && (o = e.R32F), r === e.HALF_FLOAT && (o = e.R16F), r === e.UNSIGNED_BYTE && (o = e.R8)), i === e.RED_INTEGER && (r === e.UNSIGNED_BYTE && (o = e.R8UI), r === e.UNSIGNED_SHORT && (o = e.R16UI), r === e.UNSIGNED_INT && (o = e.R32UI), r === e.BYTE && (o = e.R8I), r === e.SHORT && (o = e.R16I), r === e.INT && (o = e.R32I)), i === e.RG && (r === e.FLOAT && (o = e.RG32F), r === e.HALF_FLOAT && (o = e.RG16F), r === e.UNSIGNED_BYTE && (o = e.RG8)), i === e.RG_INTEGER && (r === e.UNSIGNED_BYTE && (o = e.RG8UI), r === e.UNSIGNED_SHORT && (o = e.RG16UI), r === e.UNSIGNED_INT && (o = e.RG32UI), r === e.BYTE && (o = e.RG8I), r === e.SHORT && (o = e.RG16I), r === e.INT && (o = e.RG32I)), i === e.RGB_INTEGER && (r === e.UNSIGNED_BYTE && (o = e.RGB8UI), r === e.UNSIGNED_SHORT && (o = e.RGB16UI), r === e.UNSIGNED_INT && (o = e.RGB32UI), r === e.BYTE && (o = e.RGB8I), r === e.SHORT && (o = e.RGB16I), r === e.INT && (o = e.RGB32I)), i === e.RGBA_INTEGER && (r === e.UNSIGNED_BYTE && (o = e.RGBA8UI), r === e.UNSIGNED_SHORT && (o = e.RGBA16UI), r === e.UNSIGNED_INT && (o = e.RGBA32UI), r === e.BYTE && (o = e.RGBA8I), r === e.SHORT && (o = e.RGBA16I), r === e.INT && (o = e.RGBA32I)), i === e.RGB && r === e.UNSIGNED_INT_5_9_9_9_REV && (o = e.RGB9_E5), i === e.RGBA) {
|
|
const t = s ? Ze : Ut.getTransfer(a);
|
|
r === e.FLOAT && (o = e.RGBA32F), r === e.HALF_FLOAT && (o = e.RGBA16F), r === e.UNSIGNED_BYTE && (o = t === Je ? e.SRGB8_ALPHA8 : e.RGBA8), r === e.UNSIGNED_SHORT_4_4_4_4 && (o = e.RGBA4), r === e.UNSIGNED_SHORT_5_5_5_1 && (o = e.RGB5_A1)
|
|
}
|
|
return o !== e.R16F && o !== e.R32F && o !== e.RG16F && o !== e.RG32F && o !== e.RGBA16F && o !== e.RGBA32F || t.get("EXT_color_buffer_float"), o
|
|
}
|
|
|
|
function w(t, n) {
|
|
let i;
|
|
return t ? null === n || n === Z || n === ne ? i = e.DEPTH24_STENCIL8 : n === J ? i = e.DEPTH32F_STENCIL8 : n === Y && (i = e.DEPTH24_STENCIL8, console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")) : null === n || n === Z || n === ne ? i = e.DEPTH_COMPONENT24 : n === J ? i = e.DEPTH_COMPONENT32F : n === Y && (i = e.DEPTH_COMPONENT16), i
|
|
}
|
|
|
|
function y(e, t) {
|
|
return !0 === g(e) || e.isFramebufferTexture && e.minFilter !== z && e.minFilter !== V ? Math.log2(Math.max(t.width, t.height)) + 1 : void 0 !== e.mipmaps && e.mipmaps.length > 0 ? e.mipmaps.length : e.isCompressedTexture && Array.isArray(e.image) ? t.mipmaps.length : 1
|
|
}
|
|
|
|
function x(e) {
|
|
const t = e.target;
|
|
t.removeEventListener("dispose", x),
|
|
function(e) {
|
|
const t = i.get(e);
|
|
if (void 0 === t.__webglInit) return;
|
|
const n = e.source,
|
|
r = d.get(n);
|
|
if (r) {
|
|
const i = r[t.__cacheKey];
|
|
i.usedTimes--, 0 === i.usedTimes && E(e), 0 === Object.keys(r).length && d.delete(n)
|
|
}
|
|
i.remove(e)
|
|
}(t), t.isVideoTexture && h.delete(t)
|
|
}
|
|
|
|
function b(t) {
|
|
const n = t.target;
|
|
n.removeEventListener("dispose", b),
|
|
function(t) {
|
|
const n = i.get(t);
|
|
t.depthTexture && (t.depthTexture.dispose(), i.remove(t.depthTexture));
|
|
if (t.isWebGLCubeRenderTarget)
|
|
for (let t = 0; t < 6; t++) {
|
|
if (Array.isArray(n.__webglFramebuffer[t]))
|
|
for (let i = 0; i < n.__webglFramebuffer[t].length; i++) e.deleteFramebuffer(n.__webglFramebuffer[t][i]);
|
|
else e.deleteFramebuffer(n.__webglFramebuffer[t]);
|
|
n.__webglDepthbuffer && e.deleteRenderbuffer(n.__webglDepthbuffer[t])
|
|
} else {
|
|
if (Array.isArray(n.__webglFramebuffer))
|
|
for (let t = 0; t < n.__webglFramebuffer.length; t++) e.deleteFramebuffer(n.__webglFramebuffer[t]);
|
|
else e.deleteFramebuffer(n.__webglFramebuffer);
|
|
if (n.__webglDepthbuffer && e.deleteRenderbuffer(n.__webglDepthbuffer), n.__webglMultisampledFramebuffer && e.deleteFramebuffer(n.__webglMultisampledFramebuffer), n.__webglColorRenderbuffer)
|
|
for (let t = 0; t < n.__webglColorRenderbuffer.length; t++) n.__webglColorRenderbuffer[t] && e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);
|
|
n.__webglDepthRenderbuffer && e.deleteRenderbuffer(n.__webglDepthRenderbuffer)
|
|
}
|
|
const r = t.textures;
|
|
for (let t = 0, n = r.length; t < n; t++) {
|
|
const n = i.get(r[t]);
|
|
n.__webglTexture && (e.deleteTexture(n.__webglTexture), s.memory.textures--), i.remove(r[t])
|
|
}
|
|
i.remove(t)
|
|
}(n)
|
|
}
|
|
|
|
function E(t) {
|
|
const n = i.get(t);
|
|
e.deleteTexture(n.__webglTexture);
|
|
const r = t.source;
|
|
delete d.get(r)[n.__cacheKey], s.memory.textures--
|
|
}
|
|
let S = 0;
|
|
|
|
function M(t, r) {
|
|
const a = i.get(t);
|
|
if (t.isVideoTexture && function(e) {
|
|
const t = s.render.frame;
|
|
h.get(e) !== t && (h.set(e, t), e.update())
|
|
}(t), !1 === t.isRenderTargetTexture && t.version > 0 && a.__version !== t.version) {
|
|
const e = t.image;
|
|
if (null === e) console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");
|
|
else {
|
|
if (!1 !== e.complete) return void B(a, t, r);
|
|
console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")
|
|
}
|
|
}
|
|
n.bindTexture(e.TEXTURE_2D, a.__webglTexture, e.TEXTURE0 + r)
|
|
}
|
|
const T = {
|
|
[N]: e.REPEAT,
|
|
[F]: e.CLAMP_TO_EDGE,
|
|
[O]: e.MIRRORED_REPEAT
|
|
},
|
|
C = {
|
|
[z]: e.NEAREST,
|
|
[W]: e.NEAREST_MIPMAP_NEAREST,
|
|
[H]: e.NEAREST_MIPMAP_LINEAR,
|
|
[V]: e.LINEAR,
|
|
[G]: e.LINEAR_MIPMAP_NEAREST,
|
|
[Q]: e.LINEAR_MIPMAP_LINEAR
|
|
},
|
|
I = {
|
|
[et]: e.NEVER,
|
|
[ot]: e.ALWAYS,
|
|
[tt]: e.LESS,
|
|
[it]: e.LEQUAL,
|
|
[nt]: e.EQUAL,
|
|
[st]: e.GEQUAL,
|
|
[rt]: e.GREATER,
|
|
[at]: e.NOTEQUAL
|
|
};
|
|
|
|
function R(n, a) {
|
|
if (a.type !== J || !1 !== t.has("OES_texture_float_linear") || a.magFilter !== V && a.magFilter !== G && a.magFilter !== H && a.magFilter !== Q && a.minFilter !== V && a.minFilter !== G && a.minFilter !== H && a.minFilter !== Q || console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."), e.texParameteri(n, e.TEXTURE_WRAP_S, T[a.wrapS]), e.texParameteri(n, e.TEXTURE_WRAP_T, T[a.wrapT]), n !== e.TEXTURE_3D && n !== e.TEXTURE_2D_ARRAY || e.texParameteri(n, e.TEXTURE_WRAP_R, T[a.wrapR]), e.texParameteri(n, e.TEXTURE_MAG_FILTER, C[a.magFilter]), e.texParameteri(n, e.TEXTURE_MIN_FILTER, C[a.minFilter]), a.compareFunction && (e.texParameteri(n, e.TEXTURE_COMPARE_MODE, e.COMPARE_REF_TO_TEXTURE), e.texParameteri(n, e.TEXTURE_COMPARE_FUNC, I[a.compareFunction])), !0 === t.has("EXT_texture_filter_anisotropic")) {
|
|
if (a.magFilter === z) return;
|
|
if (a.minFilter !== H && a.minFilter !== Q) return;
|
|
if (a.type === J && !1 === t.has("OES_texture_float_linear")) return;
|
|
if (a.anisotropy > 1 || i.get(a).__currentAnisotropy) {
|
|
const s = t.get("EXT_texture_filter_anisotropic");
|
|
e.texParameterf(n, s.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(a.anisotropy, r.getMaxAnisotropy())), i.get(a).__currentAnisotropy = a.anisotropy
|
|
}
|
|
}
|
|
}
|
|
|
|
function P(t, n) {
|
|
let i = !1;
|
|
void 0 === t.__webglInit && (t.__webglInit = !0, n.addEventListener("dispose", x));
|
|
const r = n.source;
|
|
let a = d.get(r);
|
|
void 0 === a && (a = {}, d.set(r, a));
|
|
const o = function(e) {
|
|
const t = [];
|
|
return t.push(e.wrapS), t.push(e.wrapT), t.push(e.wrapR || 0), t.push(e.magFilter), t.push(e.minFilter), t.push(e.anisotropy), t.push(e.internalFormat), t.push(e.format), t.push(e.type), t.push(e.generateMipmaps), t.push(e.premultiplyAlpha), t.push(e.flipY), t.push(e.unpackAlignment), t.push(e.colorSpace), t.join()
|
|
}(n);
|
|
if (o !== t.__cacheKey) {
|
|
void 0 === a[o] && (a[o] = {
|
|
texture: e.createTexture(),
|
|
usedTimes: 0
|
|
}, s.memory.textures++, i = !0), a[o].usedTimes++;
|
|
const r = a[t.__cacheKey];
|
|
void 0 !== r && (a[t.__cacheKey].usedTimes--, 0 === r.usedTimes && E(n)), t.__cacheKey = o, t.__webglTexture = a[o].texture
|
|
}
|
|
return i
|
|
}
|
|
|
|
function B(t, s, o) {
|
|
let l = e.TEXTURE_2D;
|
|
(s.isDataArrayTexture || s.isCompressedArrayTexture) && (l = e.TEXTURE_2D_ARRAY), s.isData3DTexture && (l = e.TEXTURE_3D);
|
|
const c = P(t, s),
|
|
h = s.source;
|
|
n.bindTexture(l, t.__webglTexture, e.TEXTURE0 + o);
|
|
const u = i.get(h);
|
|
if (h.version !== u.__version || !0 === c) {
|
|
n.activeTexture(e.TEXTURE0 + o);
|
|
const t = Ut.getPrimaries(Ut.workingColorSpace),
|
|
i = s.colorSpace === qe ? null : Ut.getPrimaries(s.colorSpace),
|
|
d = s.colorSpace === qe || t === i ? e.NONE : e.BROWSER_DEFAULT_WEBGL;
|
|
e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, s.flipY), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, s.premultiplyAlpha), e.pixelStorei(e.UNPACK_ALIGNMENT, s.unpackAlignment), e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, d);
|
|
let f = m(s.image, !1, r.maxTextureSize);
|
|
f = $(s, f);
|
|
const p = a.convert(s.format, s.colorSpace),
|
|
_ = a.convert(s.type);
|
|
let x, b = v(s.internalFormat, p, _, s.colorSpace, s.isVideoTexture);
|
|
R(l, s);
|
|
const E = s.mipmaps,
|
|
S = !0 !== s.isVideoTexture,
|
|
M = void 0 === u.__version || !0 === c,
|
|
T = h.dataReady,
|
|
C = y(s, f);
|
|
if (s.isDepthTexture) b = w(s.format === se, s.type), M && (S ? n.texStorage2D(e.TEXTURE_2D, 1, b, f.width, f.height) : n.texImage2D(e.TEXTURE_2D, 0, b, f.width, f.height, 0, p, _, null));
|
|
else if (s.isDataTexture)
|
|
if (E.length > 0) {
|
|
S && M && n.texStorage2D(e.TEXTURE_2D, C, b, E[0].width, E[0].height);
|
|
for (let t = 0, i = E.length; t < i; t++) x = E[t], S ? T && n.texSubImage2D(e.TEXTURE_2D, t, 0, 0, x.width, x.height, p, _, x.data) : n.texImage2D(e.TEXTURE_2D, t, b, x.width, x.height, 0, p, _, x.data);
|
|
s.generateMipmaps = !1
|
|
} else S ? (M && n.texStorage2D(e.TEXTURE_2D, C, b, f.width, f.height), T && n.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, f.width, f.height, p, _, f.data)) : n.texImage2D(e.TEXTURE_2D, 0, b, f.width, f.height, 0, p, _, f.data);
|
|
else if (s.isCompressedTexture)
|
|
if (s.isCompressedArrayTexture) {
|
|
S && M && n.texStorage3D(e.TEXTURE_2D_ARRAY, C, b, E[0].width, E[0].height, f.depth);
|
|
for (let t = 0, i = E.length; t < i; t++)
|
|
if (x = E[t], s.format !== re)
|
|
if (null !== p)
|
|
if (S) {
|
|
if (T)
|
|
if (s.layerUpdates.size > 0) {
|
|
const i = Rs(x.width, x.height, s.format, s.type);
|
|
for (const r of s.layerUpdates) {
|
|
const a = x.data.subarray(r * i / x.data.BYTES_PER_ELEMENT, (r + 1) * i / x.data.BYTES_PER_ELEMENT);
|
|
n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY, t, 0, 0, r, x.width, x.height, 1, p, a)
|
|
}
|
|
s.clearLayerUpdates()
|
|
} else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY, t, 0, 0, 0, x.width, x.height, f.depth, p, x.data)
|
|
} else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY, t, b, x.width, x.height, f.depth, 0, x.data, 0, 0);
|
|
else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");
|
|
else S ? T && n.texSubImage3D(e.TEXTURE_2D_ARRAY, t, 0, 0, 0, x.width, x.height, f.depth, p, _, x.data) : n.texImage3D(e.TEXTURE_2D_ARRAY, t, b, x.width, x.height, f.depth, 0, p, _, x.data)
|
|
} else {
|
|
S && M && n.texStorage2D(e.TEXTURE_2D, C, b, E[0].width, E[0].height);
|
|
for (let t = 0, i = E.length; t < i; t++) x = E[t], s.format !== re ? null !== p ? S ? T && n.compressedTexSubImage2D(e.TEXTURE_2D, t, 0, 0, x.width, x.height, p, x.data) : n.compressedTexImage2D(e.TEXTURE_2D, t, b, x.width, x.height, 0, x.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : S ? T && n.texSubImage2D(e.TEXTURE_2D, t, 0, 0, x.width, x.height, p, _, x.data) : n.texImage2D(e.TEXTURE_2D, t, b, x.width, x.height, 0, p, _, x.data)
|
|
}
|
|
else if (s.isDataArrayTexture)
|
|
if (S) {
|
|
if (M && n.texStorage3D(e.TEXTURE_2D_ARRAY, C, b, f.width, f.height, f.depth), T)
|
|
if (s.layerUpdates.size > 0) {
|
|
const t = Rs(f.width, f.height, s.format, s.type);
|
|
for (const i of s.layerUpdates) {
|
|
const r = f.data.subarray(i * t / f.data.BYTES_PER_ELEMENT, (i + 1) * t / f.data.BYTES_PER_ELEMENT);
|
|
n.texSubImage3D(e.TEXTURE_2D_ARRAY, 0, 0, 0, i, f.width, f.height, 1, p, _, r)
|
|
}
|
|
s.clearLayerUpdates()
|
|
} else n.texSubImage3D(e.TEXTURE_2D_ARRAY, 0, 0, 0, 0, f.width, f.height, f.depth, p, _, f.data)
|
|
} else n.texImage3D(e.TEXTURE_2D_ARRAY, 0, b, f.width, f.height, f.depth, 0, p, _, f.data);
|
|
else if (s.isData3DTexture) S ? (M && n.texStorage3D(e.TEXTURE_3D, C, b, f.width, f.height, f.depth), T && n.texSubImage3D(e.TEXTURE_3D, 0, 0, 0, 0, f.width, f.height, f.depth, p, _, f.data)) : n.texImage3D(e.TEXTURE_3D, 0, b, f.width, f.height, f.depth, 0, p, _, f.data);
|
|
else if (s.isFramebufferTexture) {
|
|
if (M)
|
|
if (S) n.texStorage2D(e.TEXTURE_2D, C, b, f.width, f.height);
|
|
else {
|
|
let t = f.width,
|
|
i = f.height;
|
|
for (let r = 0; r < C; r++) n.texImage2D(e.TEXTURE_2D, r, b, t, i, 0, p, _, null), t >>= 1, i >>= 1
|
|
}
|
|
} else if (E.length > 0) {
|
|
if (S && M) {
|
|
const t = ee(E[0]);
|
|
n.texStorage2D(e.TEXTURE_2D, C, b, t.width, t.height)
|
|
}
|
|
for (let t = 0, i = E.length; t < i; t++) x = E[t], S ? T && n.texSubImage2D(e.TEXTURE_2D, t, 0, 0, p, _, x) : n.texImage2D(e.TEXTURE_2D, t, b, p, _, x);
|
|
s.generateMipmaps = !1
|
|
} else if (S) {
|
|
if (M) {
|
|
const t = ee(f);
|
|
n.texStorage2D(e.TEXTURE_2D, C, b, t.width, t.height)
|
|
}
|
|
T && n.texSubImage2D(e.TEXTURE_2D, 0, 0, 0, p, _, f)
|
|
} else n.texImage2D(e.TEXTURE_2D, 0, b, p, _, f);
|
|
g(s) && A(l), u.__version = h.version, s.onUpdate && s.onUpdate(s)
|
|
}
|
|
t.__version = s.version
|
|
}
|
|
|
|
function D(t, r, s, l, c, h) {
|
|
const u = a.convert(s.format, s.colorSpace),
|
|
d = a.convert(s.type),
|
|
f = v(s.internalFormat, u, d, s.colorSpace),
|
|
p = i.get(r),
|
|
m = i.get(s);
|
|
if (m.__renderTarget = r, !p.__hasExternalTextures) {
|
|
const t = Math.max(1, r.width >> h),
|
|
i = Math.max(1, r.height >> h);
|
|
c === e.TEXTURE_3D || c === e.TEXTURE_2D_ARRAY ? n.texImage3D(c, h, f, t, i, r.depth, 0, u, d, null) : n.texImage2D(c, h, f, t, i, 0, u, d, null)
|
|
}
|
|
n.bindFramebuffer(e.FRAMEBUFFER, t), K(r) ? o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER, l, c, m.__webglTexture, 0, q(r)) : (c === e.TEXTURE_2D || c >= e.TEXTURE_CUBE_MAP_POSITIVE_X && c <= e.TEXTURE_CUBE_MAP_NEGATIVE_Z) && e.framebufferTexture2D(e.FRAMEBUFFER, l, c, m.__webglTexture, h), n.bindFramebuffer(e.FRAMEBUFFER, null)
|
|
}
|
|
|
|
function L(t, n, i) {
|
|
if (e.bindRenderbuffer(e.RENDERBUFFER, t), n.depthBuffer) {
|
|
const r = n.depthTexture,
|
|
a = r && r.isDepthTexture ? r.type : null,
|
|
s = w(n.stencilBuffer, a),
|
|
l = n.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT,
|
|
c = q(n);
|
|
K(n) ? o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER, c, s, n.width, n.height) : i ? e.renderbufferStorageMultisample(e.RENDERBUFFER, c, s, n.width, n.height) : e.renderbufferStorage(e.RENDERBUFFER, s, n.width, n.height), e.framebufferRenderbuffer(e.FRAMEBUFFER, l, e.RENDERBUFFER, t)
|
|
} else {
|
|
const t = n.textures;
|
|
for (let r = 0; r < t.length; r++) {
|
|
const s = t[r],
|
|
l = a.convert(s.format, s.colorSpace),
|
|
c = a.convert(s.type),
|
|
h = v(s.internalFormat, l, c, s.colorSpace),
|
|
u = q(n);
|
|
i && !1 === K(n) ? e.renderbufferStorageMultisample(e.RENDERBUFFER, u, h, n.width, n.height) : K(n) ? o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER, u, h, n.width, n.height) : e.renderbufferStorage(e.RENDERBUFFER, h, n.width, n.height)
|
|
}
|
|
}
|
|
e.bindRenderbuffer(e.RENDERBUFFER, null)
|
|
}
|
|
|
|
function U(t) {
|
|
const r = i.get(t),
|
|
a = !0 === t.isWebGLCubeRenderTarget;
|
|
if (r.__boundDepthTexture !== t.depthTexture) {
|
|
const e = t.depthTexture;
|
|
if (r.__depthDisposeCallback && r.__depthDisposeCallback(), e) {
|
|
const t = () => {
|
|
delete r.__boundDepthTexture, delete r.__depthDisposeCallback, e.removeEventListener("dispose", t)
|
|
};
|
|
e.addEventListener("dispose", t), r.__depthDisposeCallback = t
|
|
}
|
|
r.__boundDepthTexture = e
|
|
}
|
|
if (t.depthTexture && !r.__autoAllocateDepthBuffer) {
|
|
if (a) throw new Error("target.depthTexture not supported in Cube render targets");
|
|
! function(t, r) {
|
|
if (r && r.isWebGLCubeRenderTarget) throw new Error("Depth Texture with cube render targets is not supported");
|
|
if (n.bindFramebuffer(e.FRAMEBUFFER, t), !r.depthTexture || !r.depthTexture.isDepthTexture) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");
|
|
const a = i.get(r.depthTexture);
|
|
a.__renderTarget = r, a.__webglTexture && r.depthTexture.image.width === r.width && r.depthTexture.image.height === r.height || (r.depthTexture.image.width = r.width, r.depthTexture.image.height = r.height, r.depthTexture.needsUpdate = !0), M(r.depthTexture, 0);
|
|
const s = a.__webglTexture,
|
|
l = q(r);
|
|
if (r.depthTexture.format === ae) K(r) ? o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.TEXTURE_2D, s, 0, l) : e.framebufferTexture2D(e.FRAMEBUFFER, e.DEPTH_ATTACHMENT, e.TEXTURE_2D, s, 0);
|
|
else {
|
|
if (r.depthTexture.format !== se) throw new Error("Unknown depthTexture format");
|
|
K(r) ? o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER, e.DEPTH_STENCIL_ATTACHMENT, e.TEXTURE_2D, s, 0, l) : e.framebufferTexture2D(e.FRAMEBUFFER, e.DEPTH_STENCIL_ATTACHMENT, e.TEXTURE_2D, s, 0)
|
|
}
|
|
}(r.__webglFramebuffer, t)
|
|
} else if (a) {
|
|
r.__webglDepthbuffer = [];
|
|
for (let i = 0; i < 6; i++)
|
|
if (n.bindFramebuffer(e.FRAMEBUFFER, r.__webglFramebuffer[i]), void 0 === r.__webglDepthbuffer[i]) r.__webglDepthbuffer[i] = e.createRenderbuffer(), L(r.__webglDepthbuffer[i], t, !1);
|
|
else {
|
|
const n = t.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT,
|
|
a = r.__webglDepthbuffer[i];
|
|
e.bindRenderbuffer(e.RENDERBUFFER, a), e.framebufferRenderbuffer(e.FRAMEBUFFER, n, e.RENDERBUFFER, a)
|
|
}
|
|
} else if (n.bindFramebuffer(e.FRAMEBUFFER, r.__webglFramebuffer), void 0 === r.__webglDepthbuffer) r.__webglDepthbuffer = e.createRenderbuffer(), L(r.__webglDepthbuffer, t, !1);
|
|
else {
|
|
const n = t.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT,
|
|
i = r.__webglDepthbuffer;
|
|
e.bindRenderbuffer(e.RENDERBUFFER, i), e.framebufferRenderbuffer(e.FRAMEBUFFER, n, e.RENDERBUFFER, i)
|
|
}
|
|
n.bindFramebuffer(e.FRAMEBUFFER, null)
|
|
}
|
|
const k = [],
|
|
j = [];
|
|
|
|
function q(e) {
|
|
return Math.min(r.maxSamples, e.samples)
|
|
}
|
|
|
|
function K(e) {
|
|
const n = i.get(e);
|
|
return e.samples > 0 && !0 === t.has("WEBGL_multisampled_render_to_texture") && !1 !== n.__useRenderToTexture
|
|
}
|
|
|
|
function $(e, t) {
|
|
const n = e.colorSpace,
|
|
i = e.format,
|
|
r = e.type;
|
|
return !0 === e.isCompressedTexture || !0 === e.isVideoTexture || n !== Ke && n !== qe && (Ut.getTransfer(n) === Je ? i === re && r === X || console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.") : console.error("THREE.WebGLTextures: Unsupported texture color space:", n)), t
|
|
}
|
|
|
|
function ee(e) {
|
|
return "undefined" != typeof HTMLImageElement && e instanceof HTMLImageElement ? (c.width = e.naturalWidth || e.width, c.height = e.naturalHeight || e.height) : "undefined" != typeof VideoFrame && e instanceof VideoFrame ? (c.width = e.displayWidth, c.height = e.displayHeight) : (c.width = e.width, c.height = e.height), c
|
|
}
|
|
this.allocateTextureUnit = function() {
|
|
const e = S;
|
|
return e >= r.maxTextures && console.warn("THREE.WebGLTextures: Trying to use " + e + " texture units while this GPU supports only " + r.maxTextures), S += 1, e
|
|
}, this.resetTextureUnits = function() {
|
|
S = 0
|
|
}, this.setTexture2D = M, this.setTexture2DArray = function(t, r) {
|
|
const a = i.get(t);
|
|
t.version > 0 && a.__version !== t.version ? B(a, t, r) : n.bindTexture(e.TEXTURE_2D_ARRAY, a.__webglTexture, e.TEXTURE0 + r)
|
|
}, this.setTexture3D = function(t, r) {
|
|
const a = i.get(t);
|
|
t.version > 0 && a.__version !== t.version ? B(a, t, r) : n.bindTexture(e.TEXTURE_3D, a.__webglTexture, e.TEXTURE0 + r)
|
|
}, this.setTextureCube = function(t, s) {
|
|
const o = i.get(t);
|
|
t.version > 0 && o.__version !== t.version ? function(t, s, o) {
|
|
if (6 !== s.image.length) return;
|
|
const l = P(t, s),
|
|
c = s.source;
|
|
n.bindTexture(e.TEXTURE_CUBE_MAP, t.__webglTexture, e.TEXTURE0 + o);
|
|
const h = i.get(c);
|
|
if (c.version !== h.__version || !0 === l) {
|
|
n.activeTexture(e.TEXTURE0 + o);
|
|
const t = Ut.getPrimaries(Ut.workingColorSpace),
|
|
i = s.colorSpace === qe ? null : Ut.getPrimaries(s.colorSpace),
|
|
u = s.colorSpace === qe || t === i ? e.NONE : e.BROWSER_DEFAULT_WEBGL;
|
|
e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, s.flipY), e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL, s.premultiplyAlpha), e.pixelStorei(e.UNPACK_ALIGNMENT, s.unpackAlignment), e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL, u);
|
|
const d = s.isCompressedTexture || s.image[0].isCompressedTexture,
|
|
f = s.image[0] && s.image[0].isDataTexture,
|
|
p = [];
|
|
for (let e = 0; e < 6; e++) p[e] = d || f ? f ? s.image[e].image : s.image[e] : m(s.image[e], !0, r.maxCubemapSize), p[e] = $(s, p[e]);
|
|
const _ = p[0],
|
|
w = a.convert(s.format, s.colorSpace),
|
|
x = a.convert(s.type),
|
|
b = v(s.internalFormat, w, x, s.colorSpace),
|
|
E = !0 !== s.isVideoTexture,
|
|
S = void 0 === h.__version || !0 === l,
|
|
M = c.dataReady;
|
|
let T, C = y(s, _);
|
|
if (R(e.TEXTURE_CUBE_MAP, s), d) {
|
|
E && S && n.texStorage2D(e.TEXTURE_CUBE_MAP, C, b, _.width, _.height);
|
|
for (let t = 0; t < 6; t++) {
|
|
T = p[t].mipmaps;
|
|
for (let i = 0; i < T.length; i++) {
|
|
const r = T[i];
|
|
s.format !== re ? null !== w ? E ? M && n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i, 0, 0, r.width, r.height, w, r.data) : n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i, b, r.width, r.height, 0, r.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : E ? M && n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i, 0, 0, r.width, r.height, w, x, r.data) : n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i, b, r.width, r.height, 0, w, x, r.data)
|
|
}
|
|
}
|
|
} else {
|
|
if (T = s.mipmaps, E && S) {
|
|
T.length > 0 && C++;
|
|
const t = ee(p[0]);
|
|
n.texStorage2D(e.TEXTURE_CUBE_MAP, C, b, t.width, t.height)
|
|
}
|
|
for (let t = 0; t < 6; t++)
|
|
if (f) {
|
|
E ? M && n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, 0, 0, 0, p[t].width, p[t].height, w, x, p[t].data) : n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, 0, b, p[t].width, p[t].height, 0, w, x, p[t].data);
|
|
for (let i = 0; i < T.length; i++) {
|
|
const r = T[i].image[t].image;
|
|
E ? M && n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i + 1, 0, 0, r.width, r.height, w, x, r.data) : n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i + 1, b, r.width, r.height, 0, w, x, r.data)
|
|
}
|
|
} else {
|
|
E ? M && n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, 0, 0, 0, w, x, p[t]) : n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, 0, b, w, x, p[t]);
|
|
for (let i = 0; i < T.length; i++) {
|
|
const r = T[i];
|
|
E ? M && n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i + 1, 0, 0, w, x, r.image[t]) : n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X + t, i + 1, b, w, x, r.image[t])
|
|
}
|
|
}
|
|
}
|
|
g(s) && A(e.TEXTURE_CUBE_MAP), h.__version = c.version, s.onUpdate && s.onUpdate(s)
|
|
}
|
|
t.__version = s.version
|
|
}(o, t, s) : n.bindTexture(e.TEXTURE_CUBE_MAP, o.__webglTexture, e.TEXTURE0 + s)
|
|
}, this.rebindTextures = function(t, n, r) {
|
|
const a = i.get(t);
|
|
void 0 !== n && D(a.__webglFramebuffer, t, t.texture, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, 0), void 0 !== r && U(t)
|
|
}, this.setupRenderTarget = function(t) {
|
|
const r = t.texture,
|
|
o = i.get(t),
|
|
l = i.get(r);
|
|
t.addEventListener("dispose", b);
|
|
const c = t.textures,
|
|
h = !0 === t.isWebGLCubeRenderTarget,
|
|
u = c.length > 1;
|
|
if (u || (void 0 === l.__webglTexture && (l.__webglTexture = e.createTexture()), l.__version = r.version, s.memory.textures++), h) {
|
|
o.__webglFramebuffer = [];
|
|
for (let t = 0; t < 6; t++)
|
|
if (r.mipmaps && r.mipmaps.length > 0) {
|
|
o.__webglFramebuffer[t] = [];
|
|
for (let n = 0; n < r.mipmaps.length; n++) o.__webglFramebuffer[t][n] = e.createFramebuffer()
|
|
} else o.__webglFramebuffer[t] = e.createFramebuffer()
|
|
} else {
|
|
if (r.mipmaps && r.mipmaps.length > 0) {
|
|
o.__webglFramebuffer = [];
|
|
for (let t = 0; t < r.mipmaps.length; t++) o.__webglFramebuffer[t] = e.createFramebuffer()
|
|
} else o.__webglFramebuffer = e.createFramebuffer();
|
|
if (u)
|
|
for (let t = 0, n = c.length; t < n; t++) {
|
|
const n = i.get(c[t]);
|
|
void 0 === n.__webglTexture && (n.__webglTexture = e.createTexture(), s.memory.textures++)
|
|
}
|
|
if (t.samples > 0 && !1 === K(t)) {
|
|
o.__webglMultisampledFramebuffer = e.createFramebuffer(), o.__webglColorRenderbuffer = [], n.bindFramebuffer(e.FRAMEBUFFER, o.__webglMultisampledFramebuffer);
|
|
for (let n = 0; n < c.length; n++) {
|
|
const i = c[n];
|
|
o.__webglColorRenderbuffer[n] = e.createRenderbuffer(), e.bindRenderbuffer(e.RENDERBUFFER, o.__webglColorRenderbuffer[n]);
|
|
const r = a.convert(i.format, i.colorSpace),
|
|
s = a.convert(i.type),
|
|
l = v(i.internalFormat, r, s, i.colorSpace, !0 === t.isXRRenderTarget),
|
|
h = q(t);
|
|
e.renderbufferStorageMultisample(e.RENDERBUFFER, h, l, t.width, t.height), e.framebufferRenderbuffer(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + n, e.RENDERBUFFER, o.__webglColorRenderbuffer[n])
|
|
}
|
|
e.bindRenderbuffer(e.RENDERBUFFER, null), t.depthBuffer && (o.__webglDepthRenderbuffer = e.createRenderbuffer(), L(o.__webglDepthRenderbuffer, t, !0)), n.bindFramebuffer(e.FRAMEBUFFER, null)
|
|
}
|
|
}
|
|
if (h) {
|
|
n.bindTexture(e.TEXTURE_CUBE_MAP, l.__webglTexture), R(e.TEXTURE_CUBE_MAP, r);
|
|
for (let n = 0; n < 6; n++)
|
|
if (r.mipmaps && r.mipmaps.length > 0)
|
|
for (let i = 0; i < r.mipmaps.length; i++) D(o.__webglFramebuffer[n][i], t, r, e.COLOR_ATTACHMENT0, e.TEXTURE_CUBE_MAP_POSITIVE_X + n, i);
|
|
else D(o.__webglFramebuffer[n], t, r, e.COLOR_ATTACHMENT0, e.TEXTURE_CUBE_MAP_POSITIVE_X + n, 0);
|
|
g(r) && A(e.TEXTURE_CUBE_MAP), n.unbindTexture()
|
|
} else if (u) {
|
|
for (let r = 0, a = c.length; r < a; r++) {
|
|
const a = c[r],
|
|
s = i.get(a);
|
|
n.bindTexture(e.TEXTURE_2D, s.__webglTexture), R(e.TEXTURE_2D, a), D(o.__webglFramebuffer, t, a, e.COLOR_ATTACHMENT0 + r, e.TEXTURE_2D, 0), g(a) && A(e.TEXTURE_2D)
|
|
}
|
|
n.unbindTexture()
|
|
} else {
|
|
let i = e.TEXTURE_2D;
|
|
if ((t.isWebGL3DRenderTarget || t.isWebGLArrayRenderTarget) && (i = t.isWebGL3DRenderTarget ? e.TEXTURE_3D : e.TEXTURE_2D_ARRAY), n.bindTexture(i, l.__webglTexture), R(i, r), r.mipmaps && r.mipmaps.length > 0)
|
|
for (let n = 0; n < r.mipmaps.length; n++) D(o.__webglFramebuffer[n], t, r, e.COLOR_ATTACHMENT0, i, n);
|
|
else D(o.__webglFramebuffer, t, r, e.COLOR_ATTACHMENT0, i, 0);
|
|
g(r) && A(i), n.unbindTexture()
|
|
}
|
|
t.depthBuffer && U(t)
|
|
}, this.updateRenderTargetMipmap = function(e) {
|
|
const t = e.textures;
|
|
for (let r = 0, a = t.length; r < a; r++) {
|
|
const a = t[r];
|
|
if (g(a)) {
|
|
const t = _(e),
|
|
r = i.get(a).__webglTexture;
|
|
n.bindTexture(t, r), A(t), n.unbindTexture()
|
|
}
|
|
}
|
|
}, this.updateMultisampleRenderTarget = function(t) {
|
|
if (t.samples > 0)
|
|
if (!1 === K(t)) {
|
|
const r = t.textures,
|
|
a = t.width,
|
|
s = t.height;
|
|
let o = e.COLOR_BUFFER_BIT;
|
|
const c = t.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT,
|
|
h = i.get(t),
|
|
u = r.length > 1;
|
|
if (u)
|
|
for (let t = 0; t < r.length; t++) n.bindFramebuffer(e.FRAMEBUFFER, h.__webglMultisampledFramebuffer), e.framebufferRenderbuffer(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + t, e.RENDERBUFFER, null), n.bindFramebuffer(e.FRAMEBUFFER, h.__webglFramebuffer), e.framebufferTexture2D(e.DRAW_FRAMEBUFFER, e.COLOR_ATTACHMENT0 + t, e.TEXTURE_2D, null, 0);
|
|
n.bindFramebuffer(e.READ_FRAMEBUFFER, h.__webglMultisampledFramebuffer), n.bindFramebuffer(e.DRAW_FRAMEBUFFER, h.__webglFramebuffer);
|
|
for (let n = 0; n < r.length; n++) {
|
|
if (t.resolveDepthBuffer && (t.depthBuffer && (o |= e.DEPTH_BUFFER_BIT), t.stencilBuffer && t.resolveStencilBuffer && (o |= e.STENCIL_BUFFER_BIT)), u) {
|
|
e.framebufferRenderbuffer(e.READ_FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.RENDERBUFFER, h.__webglColorRenderbuffer[n]);
|
|
const t = i.get(r[n]).__webglTexture;
|
|
e.framebufferTexture2D(e.DRAW_FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, t, 0)
|
|
}
|
|
e.blitFramebuffer(0, 0, a, s, 0, 0, a, s, o, e.NEAREST), !0 === l && (k.length = 0, j.length = 0, k.push(e.COLOR_ATTACHMENT0 + n), t.depthBuffer && !1 === t.resolveDepthBuffer && (k.push(c), j.push(c), e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER, j)), e.invalidateFramebuffer(e.READ_FRAMEBUFFER, k))
|
|
}
|
|
if (n.bindFramebuffer(e.READ_FRAMEBUFFER, null), n.bindFramebuffer(e.DRAW_FRAMEBUFFER, null), u)
|
|
for (let t = 0; t < r.length; t++) {
|
|
n.bindFramebuffer(e.FRAMEBUFFER, h.__webglMultisampledFramebuffer), e.framebufferRenderbuffer(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0 + t, e.RENDERBUFFER, h.__webglColorRenderbuffer[t]);
|
|
const a = i.get(r[t]).__webglTexture;
|
|
n.bindFramebuffer(e.FRAMEBUFFER, h.__webglFramebuffer), e.framebufferTexture2D(e.DRAW_FRAMEBUFFER, e.COLOR_ATTACHMENT0 + t, e.TEXTURE_2D, a, 0)
|
|
}
|
|
n.bindFramebuffer(e.DRAW_FRAMEBUFFER, h.__webglMultisampledFramebuffer)
|
|
} else if (t.depthBuffer && !1 === t.resolveDepthBuffer && l) {
|
|
const n = t.stencilBuffer ? e.DEPTH_STENCIL_ATTACHMENT : e.DEPTH_ATTACHMENT;
|
|
e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER, [n])
|
|
}
|
|
}, this.setupDepthRenderbuffer = U, this.setupFrameBufferTexture = D, this.useMultisampledRTT = K
|
|
}
|
|
|
|
function jp(e, t) {
|
|
return {
|
|
convert: function(n, i = "") {
|
|
let r;
|
|
const a = Ut.getTransfer(i);
|
|
if (n === X) return e.UNSIGNED_BYTE;
|
|
if (n === ee) return e.UNSIGNED_SHORT_4_4_4_4;
|
|
if (n === te) return e.UNSIGNED_SHORT_5_5_5_1;
|
|
if (n === ie) return e.UNSIGNED_INT_5_9_9_9_REV;
|
|
if (n === j) return e.BYTE;
|
|
if (n === q) return e.SHORT;
|
|
if (n === Y) return e.UNSIGNED_SHORT;
|
|
if (n === K) return e.INT;
|
|
if (n === Z) return e.UNSIGNED_INT;
|
|
if (n === J) return e.FLOAT;
|
|
if (n === $) return e.HALF_FLOAT;
|
|
if (1021 === n) return e.ALPHA;
|
|
if (1022 === n) return e.RGB;
|
|
if (n === re) return e.RGBA;
|
|
if (1024 === n) return e.LUMINANCE;
|
|
if (1025 === n) return e.LUMINANCE_ALPHA;
|
|
if (n === ae) return e.DEPTH_COMPONENT;
|
|
if (n === se) return e.DEPTH_STENCIL;
|
|
if (n === oe) return e.RED;
|
|
if (n === le) return e.RED_INTEGER;
|
|
if (1030 === n) return e.RG;
|
|
if (n === ce) return e.RG_INTEGER;
|
|
if (n === he) return e.RGBA_INTEGER;
|
|
if (n === ue || n === de || n === fe || n === pe)
|
|
if (a === Je) {
|
|
if (r = t.get("WEBGL_compressed_texture_s3tc_srgb"), null === r) return null;
|
|
if (n === ue) return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;
|
|
if (n === de) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
|
|
if (n === fe) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
|
|
if (n === pe) return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
|
|
} else {
|
|
if (r = t.get("WEBGL_compressed_texture_s3tc"), null === r) return null;
|
|
if (n === ue) return r.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
if (n === de) return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
|
if (n === fe) return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
|
if (n === pe) return r.COMPRESSED_RGBA_S3TC_DXT5_EXT
|
|
} if (n === me || n === ge || n === Ae || n === _e) {
|
|
if (r = t.get("WEBGL_compressed_texture_pvrtc"), null === r) return null;
|
|
if (n === me) return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
if (n === ge) return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
if (n === Ae) return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
if (n === _e) return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
|
|
}
|
|
if (n === ve || n === we || n === ye) {
|
|
if (r = t.get("WEBGL_compressed_texture_etc"), null === r) return null;
|
|
if (n === ve || n === we) return a === Je ? r.COMPRESSED_SRGB8_ETC2 : r.COMPRESSED_RGB8_ETC2;
|
|
if (n === ye) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : r.COMPRESSED_RGBA8_ETC2_EAC
|
|
}
|
|
if (n === xe || n === be || n === Ee || n === Se || n === Me || n === Te || n === Ce || n === Ie || n === Re || n === Pe || n === Be || n === De || n === Le || n === Ue) {
|
|
if (r = t.get("WEBGL_compressed_texture_astc"), null === r) return null;
|
|
if (n === xe) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : r.COMPRESSED_RGBA_ASTC_4x4_KHR;
|
|
if (n === be) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : r.COMPRESSED_RGBA_ASTC_5x4_KHR;
|
|
if (n === Ee) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : r.COMPRESSED_RGBA_ASTC_5x5_KHR;
|
|
if (n === Se) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : r.COMPRESSED_RGBA_ASTC_6x5_KHR;
|
|
if (n === Me) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : r.COMPRESSED_RGBA_ASTC_6x6_KHR;
|
|
if (n === Te) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : r.COMPRESSED_RGBA_ASTC_8x5_KHR;
|
|
if (n === Ce) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : r.COMPRESSED_RGBA_ASTC_8x6_KHR;
|
|
if (n === Ie) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : r.COMPRESSED_RGBA_ASTC_8x8_KHR;
|
|
if (n === Re) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : r.COMPRESSED_RGBA_ASTC_10x5_KHR;
|
|
if (n === Pe) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : r.COMPRESSED_RGBA_ASTC_10x6_KHR;
|
|
if (n === Be) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : r.COMPRESSED_RGBA_ASTC_10x8_KHR;
|
|
if (n === De) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : r.COMPRESSED_RGBA_ASTC_10x10_KHR;
|
|
if (n === Le) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : r.COMPRESSED_RGBA_ASTC_12x10_KHR;
|
|
if (n === Ue) return a === Je ? r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : r.COMPRESSED_RGBA_ASTC_12x12_KHR
|
|
}
|
|
if (n === ke || n === Ne || n === Fe) {
|
|
if (r = t.get("EXT_texture_compression_bptc"), null === r) return null;
|
|
if (n === ke) return a === Je ? r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : r.COMPRESSED_RGBA_BPTC_UNORM_EXT;
|
|
if (n === Ne) return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
|
|
if (n === Fe) return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT
|
|
}
|
|
if (36283 === n || n === Oe || n === ze || n === We) {
|
|
if (r = t.get("EXT_texture_compression_rgtc"), null === r) return null;
|
|
if (n === ke) return r.COMPRESSED_RED_RGTC1_EXT;
|
|
if (n === Oe) return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;
|
|
if (n === ze) return r.COMPRESSED_RED_GREEN_RGTC2_EXT;
|
|
if (n === We) return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT
|
|
}
|
|
return n === ne ? e.UNSIGNED_INT_24_8 : void 0 !== e[n] ? e[n] : null
|
|
}
|
|
}
|
|
}
|
|
class qp {
|
|
constructor() {
|
|
this.texture = null, this.mesh = null, this.depthNear = 0, this.depthFar = 0
|
|
}
|
|
init(e, t, n) {
|
|
if (null === this.texture) {
|
|
const i = new Gt;
|
|
e.properties.get(i).__webglTexture = t.texture, t.depthNear === n.depthNear && t.depthFar === n.depthFar || (this.depthNear = t.depthNear, this.depthFar = t.depthFar), this.texture = i
|
|
}
|
|
}
|
|
getMesh(e) {
|
|
if (null !== this.texture && null === this.mesh) {
|
|
const t = e.cameras[0].viewport,
|
|
n = new rr({
|
|
vertexShader: "\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",
|
|
fragmentShader: "\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",
|
|
uniforms: {
|
|
depthColor: {
|
|
value: this.texture
|
|
},
|
|
depthWidth: {
|
|
value: t.z
|
|
},
|
|
depthHeight: {
|
|
value: t.w
|
|
}
|
|
}
|
|
});
|
|
this.mesh = new Zi(new ya(20, 20), n)
|
|
}
|
|
return this.mesh
|
|
}
|
|
reset() {
|
|
this.texture = null, this.mesh = null
|
|
}
|
|
getDepthTexture() {
|
|
return this.texture
|
|
}
|
|
}
|
|
class Yp extends dt {
|
|
constructor(e, t) {
|
|
super();
|
|
const n = this;
|
|
let i = null,
|
|
r = 1,
|
|
a = null,
|
|
s = "local-floor",
|
|
o = 1,
|
|
l = null,
|
|
c = null,
|
|
h = null,
|
|
u = null,
|
|
d = null,
|
|
f = null;
|
|
const p = new qp,
|
|
m = t.getContextAttributes();
|
|
let g = null,
|
|
A = null;
|
|
const _ = [],
|
|
v = [],
|
|
w = new Et;
|
|
let y = null;
|
|
const x = new cr;
|
|
x.viewport = new Qt;
|
|
const b = new cr;
|
|
b.viewport = new Qt;
|
|
const E = [x, b],
|
|
S = new _s;
|
|
let M = null,
|
|
T = null;
|
|
|
|
function C(e) {
|
|
const t = v.indexOf(e.inputSource);
|
|
if (-1 === t) return;
|
|
const n = _[t];
|
|
void 0 !== n && (n.update(e.inputSource, e.frame, l || a), n.dispatchEvent({
|
|
type: e.type,
|
|
data: e.inputSource
|
|
}))
|
|
}
|
|
|
|
function I() {
|
|
i.removeEventListener("select", C), i.removeEventListener("selectstart", C), i.removeEventListener("selectend", C), i.removeEventListener("squeeze", C), i.removeEventListener("squeezestart", C), i.removeEventListener("squeezeend", C), i.removeEventListener("end", I), i.removeEventListener("inputsourceschange", R);
|
|
for (let e = 0; e < _.length; e++) {
|
|
const t = v[e];
|
|
null !== t && (v[e] = null, _[e].disconnect(t))
|
|
}
|
|
M = null, T = null, p.reset(), e.setRenderTarget(g), d = null, u = null, h = null, i = null, A = null, U.stop(), n.isPresenting = !1, e.setPixelRatio(y), e.setSize(w.width, w.height, !1), n.dispatchEvent({
|
|
type: "sessionend"
|
|
})
|
|
}
|
|
|
|
function R(e) {
|
|
for (let t = 0; t < e.removed.length; t++) {
|
|
const n = e.removed[t],
|
|
i = v.indexOf(n);
|
|
i >= 0 && (v[i] = null, _[i].disconnect(n))
|
|
}
|
|
for (let t = 0; t < e.added.length; t++) {
|
|
const n = e.added[t];
|
|
let i = v.indexOf(n);
|
|
if (-1 === i) {
|
|
for (let e = 0; e < _.length; e++) {
|
|
if (e >= v.length) {
|
|
v.push(n), i = e;
|
|
break
|
|
}
|
|
if (null === v[e]) {
|
|
v[e] = n, i = e;
|
|
break
|
|
}
|
|
}
|
|
if (-1 === i) break
|
|
}
|
|
const r = _[i];
|
|
r && r.connect(n)
|
|
}
|
|
}
|
|
this.cameraAutoUpdate = !0, this.enabled = !1, this.isPresenting = !1, this.getController = function(e) {
|
|
let t = _[e];
|
|
return void 0 === t && (t = new gr, _[e] = t), t.getTargetRaySpace()
|
|
}, this.getControllerGrip = function(e) {
|
|
let t = _[e];
|
|
return void 0 === t && (t = new gr, _[e] = t), t.getGripSpace()
|
|
}, this.getHand = function(e) {
|
|
let t = _[e];
|
|
return void 0 === t && (t = new gr, _[e] = t), t.getHandSpace()
|
|
}, this.setFramebufferScaleFactor = function(e) {
|
|
r = e, !0 === n.isPresenting && console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")
|
|
}, this.setReferenceSpaceType = function(e) {
|
|
s = e, !0 === n.isPresenting && console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")
|
|
}, this.getReferenceSpace = function() {
|
|
return l || a
|
|
}, this.setReferenceSpace = function(e) {
|
|
l = e
|
|
}, this.getBaseLayer = function() {
|
|
return null !== u ? u : d
|
|
}, this.getBinding = function() {
|
|
return h
|
|
}, this.getFrame = function() {
|
|
return f
|
|
}, this.getSession = function() {
|
|
return i
|
|
}, this.setSession = async function(c) {
|
|
if (i = c, null !== i) {
|
|
g = e.getRenderTarget(), i.addEventListener("select", C), i.addEventListener("selectstart", C), i.addEventListener("selectend", C), i.addEventListener("squeeze", C), i.addEventListener("squeezestart", C), i.addEventListener("squeezeend", C), i.addEventListener("end", I), i.addEventListener("inputsourceschange", R), !0 !== m.xrCompatible && await t.makeXRCompatible(), y = e.getPixelRatio(), e.getSize(w);
|
|
if ("undefined" != typeof XRWebGLBinding && "createProjectionLayer" in XRWebGLBinding.prototype) {
|
|
let n = null,
|
|
a = null,
|
|
s = null;
|
|
m.depth && (s = m.stencil ? t.DEPTH24_STENCIL8 : t.DEPTH_COMPONENT24, n = m.stencil ? se : ae, a = m.stencil ? ne : Z);
|
|
const o = {
|
|
colorFormat: t.RGBA8,
|
|
depthFormat: s,
|
|
scaleFactor: r
|
|
};
|
|
h = new XRWebGLBinding(i, t), u = h.createProjectionLayer(o), i.updateRenderState({
|
|
layers: [u]
|
|
}), e.setPixelRatio(1), e.setSize(u.textureWidth, u.textureHeight, !1), A = new jt(u.textureWidth, u.textureHeight, {
|
|
format: re,
|
|
type: X,
|
|
depthTexture: new wa(u.textureWidth, u.textureHeight, a, void 0, void 0, void 0, void 0, void 0, void 0, n),
|
|
stencilBuffer: m.stencil,
|
|
colorSpace: e.outputColorSpace,
|
|
samples: m.antialias ? 4 : 0,
|
|
resolveDepthBuffer: !1 === u.ignoreDepthValues,
|
|
resolveStencilBuffer: !1 === u.ignoreDepthValues
|
|
})
|
|
} else {
|
|
const n = {
|
|
antialias: m.antialias,
|
|
alpha: !0,
|
|
depth: m.depth,
|
|
stencil: m.stencil,
|
|
framebufferScaleFactor: r
|
|
};
|
|
d = new XRWebGLLayer(i, t, n), i.updateRenderState({
|
|
baseLayer: d
|
|
}), e.setPixelRatio(1), e.setSize(d.framebufferWidth, d.framebufferHeight, !1), A = new jt(d.framebufferWidth, d.framebufferHeight, {
|
|
format: re,
|
|
type: X,
|
|
colorSpace: e.outputColorSpace,
|
|
stencilBuffer: m.stencil,
|
|
resolveDepthBuffer: !1 === d.ignoreDepthValues,
|
|
resolveStencilBuffer: !1 === d.ignoreDepthValues
|
|
})
|
|
}
|
|
A.isXRRenderTarget = !0, this.setFoveation(o), l = null, a = await i.requestReferenceSpace(s), U.setContext(i), U.start(), n.isPresenting = !0, n.dispatchEvent({
|
|
type: "sessionstart"
|
|
})
|
|
}
|
|
}, this.getEnvironmentBlendMode = function() {
|
|
if (null !== i) return i.environmentBlendMode
|
|
}, this.getDepthTexture = function() {
|
|
return p.getDepthTexture()
|
|
};
|
|
const P = new Zt,
|
|
B = new Zt;
|
|
|
|
function D(e, t) {
|
|
null === t ? e.matrixWorld.copy(e.matrix) : e.matrixWorld.multiplyMatrices(t.matrixWorld, e.matrix), e.matrixWorldInverse.copy(e.matrixWorld).invert()
|
|
}
|
|
this.updateCamera = function(e) {
|
|
if (null === i) return;
|
|
let t = e.near,
|
|
n = e.far;
|
|
null !== p.texture && (p.depthNear > 0 && (t = p.depthNear), p.depthFar > 0 && (n = p.depthFar)), S.near = b.near = x.near = t, S.far = b.far = x.far = n, M === S.near && T === S.far || (i.updateRenderState({
|
|
depthNear: S.near,
|
|
depthFar: S.far
|
|
}), M = S.near, T = S.far), x.layers.mask = 2 | e.layers.mask, b.layers.mask = 4 | e.layers.mask, S.layers.mask = x.layers.mask | b.layers.mask;
|
|
const r = e.parent,
|
|
a = S.cameras;
|
|
D(S, r);
|
|
for (let e = 0; e < a.length; e++) D(a[e], r);
|
|
2 === a.length ? function(e, t, n) {
|
|
P.setFromMatrixPosition(t.matrixWorld), B.setFromMatrixPosition(n.matrixWorld);
|
|
const i = P.distanceTo(B),
|
|
r = t.projectionMatrix.elements,
|
|
a = n.projectionMatrix.elements,
|
|
s = r[14] / (r[10] - 1),
|
|
o = r[14] / (r[10] + 1),
|
|
l = (r[9] + 1) / r[5],
|
|
c = (r[9] - 1) / r[5],
|
|
h = (r[8] - 1) / r[0],
|
|
u = (a[8] + 1) / a[0],
|
|
d = s * h,
|
|
f = s * u,
|
|
p = i / (-h + u),
|
|
m = p * -h;
|
|
if (t.matrixWorld.decompose(e.position, e.quaternion, e.scale), e.translateX(m), e.translateZ(p), e.matrixWorld.compose(e.position, e.quaternion, e.scale), e.matrixWorldInverse.copy(e.matrixWorld).invert(), -1 === r[10]) e.projectionMatrix.copy(t.projectionMatrix), e.projectionMatrixInverse.copy(t.projectionMatrixInverse);
|
|
else {
|
|
const t = s + p,
|
|
n = o + p,
|
|
r = d - m,
|
|
a = f + (i - m),
|
|
h = l * o / n * t,
|
|
u = c * o / n * t;
|
|
e.projectionMatrix.makePerspective(r, a, h, u, t, n), e.projectionMatrixInverse.copy(e.projectionMatrix).invert()
|
|
}
|
|
}(S, x, b) : S.projectionMatrix.copy(x.projectionMatrix),
|
|
function(e, t, n) {
|
|
null === n ? e.matrix.copy(t.matrixWorld) : (e.matrix.copy(n.matrixWorld), e.matrix.invert(), e.matrix.multiply(t.matrixWorld));
|
|
e.matrix.decompose(e.position, e.quaternion, e.scale), e.updateMatrixWorld(!0), e.projectionMatrix.copy(t.projectionMatrix), e.projectionMatrixInverse.copy(t.projectionMatrixInverse), e.isPerspectiveCamera && (e.fov = 2 * gt * Math.atan(1 / e.projectionMatrix.elements[5]), e.zoom = 1)
|
|
}(e, S, r)
|
|
}, this.getCamera = function() {
|
|
return S
|
|
}, this.getFoveation = function() {
|
|
if (null !== u || null !== d) return o
|
|
}, this.setFoveation = function(e) {
|
|
o = e, null !== u && (u.fixedFoveation = e), null !== d && void 0 !== d.fixedFoveation && (d.fixedFoveation = e)
|
|
}, this.hasDepthSensing = function() {
|
|
return null !== p.texture
|
|
}, this.getDepthSensingMesh = function() {
|
|
return p.getMesh(S)
|
|
};
|
|
let L = null;
|
|
const U = new Ad;
|
|
U.setAnimationLoop((function(t, r) {
|
|
if (c = r.getViewerPose(l || a), f = r, null !== c) {
|
|
const t = c.views;
|
|
null !== d && (e.setRenderTargetFramebuffer(A, d.framebuffer), e.setRenderTarget(A));
|
|
let n = !1;
|
|
t.length !== S.cameras.length && (S.cameras.length = 0, n = !0);
|
|
for (let i = 0; i < t.length; i++) {
|
|
const r = t[i];
|
|
let a = null;
|
|
if (null !== d) a = d.getViewport(r);
|
|
else {
|
|
const t = h.getViewSubImage(u, r);
|
|
a = t.viewport, 0 === i && (e.setRenderTargetTextures(A, t.colorTexture, u.ignoreDepthValues ? void 0 : t.depthStencilTexture), e.setRenderTarget(A))
|
|
}
|
|
let s = E[i];
|
|
void 0 === s && (s = new cr, s.layers.enable(i), s.viewport = new Qt, E[i] = s), s.matrix.fromArray(r.transform.matrix), s.matrix.decompose(s.position, s.quaternion, s.scale), s.projectionMatrix.fromArray(r.projectionMatrix), s.projectionMatrixInverse.copy(s.projectionMatrix).invert(), s.viewport.set(a.x, a.y, a.width, a.height), 0 === i && (S.matrix.copy(s.matrix), S.matrix.decompose(S.position, S.quaternion, S.scale)), !0 === n && S.cameras.push(s)
|
|
}
|
|
const r = i.enabledFeatures;
|
|
if (r && r.includes("depth-sensing") && "gpu-optimized" == i.depthUsage && h) {
|
|
const n = h.getDepthInformation(t[0]);
|
|
n && n.isValid && n.texture && p.init(e, n, i.renderState)
|
|
}
|
|
}
|
|
for (let e = 0; e < _.length; e++) {
|
|
const t = v[e],
|
|
n = _[e];
|
|
null !== t && void 0 !== n && n.update(t, r, l || a)
|
|
}
|
|
L && L(t, r), r.detectedPlanes && n.dispatchEvent({
|
|
type: "planesdetected",
|
|
data: r
|
|
}), f = null
|
|
})), this.setAnimationLoop = function(e) {
|
|
L = e
|
|
}, this.dispose = function() {}
|
|
}
|
|
}
|
|
const Kp = new Fn,
|
|
Zp = new Cn;
|
|
|
|
function Jp(e, t) {
|
|
function n(e, t) {
|
|
!0 === e.matrixAutoUpdate && e.updateMatrix(), t.value.copy(e.matrix)
|
|
}
|
|
|
|
function i(e, i) {
|
|
e.opacity.value = i.opacity, i.color && e.diffuse.value.copy(i.color), i.emissive && e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity), i.map && (e.map.value = i.map, n(i.map, e.mapTransform)), i.alphaMap && (e.alphaMap.value = i.alphaMap, n(i.alphaMap, e.alphaMapTransform)), i.bumpMap && (e.bumpMap.value = i.bumpMap, n(i.bumpMap, e.bumpMapTransform), e.bumpScale.value = i.bumpScale, 1 === i.side && (e.bumpScale.value *= -1)), i.normalMap && (e.normalMap.value = i.normalMap, n(i.normalMap, e.normalMapTransform), e.normalScale.value.copy(i.normalScale), 1 === i.side && e.normalScale.value.negate()), i.displacementMap && (e.displacementMap.value = i.displacementMap, n(i.displacementMap, e.displacementMapTransform), e.displacementScale.value = i.displacementScale, e.displacementBias.value = i.displacementBias), i.emissiveMap && (e.emissiveMap.value = i.emissiveMap, n(i.emissiveMap, e.emissiveMapTransform)), i.specularMap && (e.specularMap.value = i.specularMap, n(i.specularMap, e.specularMapTransform)), i.alphaTest > 0 && (e.alphaTest.value = i.alphaTest);
|
|
const r = t.get(i),
|
|
a = r.envMap,
|
|
s = r.envMapRotation;
|
|
a && (e.envMap.value = a, Kp.copy(s), Kp.x *= -1, Kp.y *= -1, Kp.z *= -1, a.isCubeTexture && !1 === a.isRenderTargetTexture && (Kp.y *= -1, Kp.z *= -1), e.envMapRotation.value.setFromMatrix4(Zp.makeRotationFromEuler(Kp)), e.flipEnvMap.value = a.isCubeTexture && !1 === a.isRenderTargetTexture ? -1 : 1, e.reflectivity.value = i.reflectivity, e.ior.value = i.ior, e.refractionRatio.value = i.refractionRatio), i.lightMap && (e.lightMap.value = i.lightMap, e.lightMapIntensity.value = i.lightMapIntensity, n(i.lightMap, e.lightMapTransform)), i.aoMap && (e.aoMap.value = i.aoMap, e.aoMapIntensity.value = i.aoMapIntensity, n(i.aoMap, e.aoMapTransform))
|
|
}
|
|
return {
|
|
refreshFogUniforms: function(t, n) {
|
|
n.color.getRGB(t.fogColor.value, nr(e)), n.isFog ? (t.fogNear.value = n.near, t.fogFar.value = n.far) : n.isFogExp2 && (t.fogDensity.value = n.density)
|
|
},
|
|
refreshMaterialUniforms: function(e, r, a, s, o) {
|
|
r.isMeshBasicMaterial || r.isMeshLambertMaterial ? i(e, r) : r.isMeshToonMaterial ? (i(e, r), function(e, t) {
|
|
t.gradientMap && (e.gradientMap.value = t.gradientMap)
|
|
}(e, r)) : r.isMeshPhongMaterial ? (i(e, r), function(e, t) {
|
|
e.specular.value.copy(t.specular), e.shininess.value = Math.max(t.shininess, 1e-4)
|
|
}(e, r)) : r.isMeshStandardMaterial ? (i(e, r), function(e, t) {
|
|
e.metalness.value = t.metalness, t.metalnessMap && (e.metalnessMap.value = t.metalnessMap, n(t.metalnessMap, e.metalnessMapTransform));
|
|
e.roughness.value = t.roughness, t.roughnessMap && (e.roughnessMap.value = t.roughnessMap, n(t.roughnessMap, e.roughnessMapTransform));
|
|
t.envMap && (e.envMapIntensity.value = t.envMapIntensity)
|
|
}(e, r), r.isMeshPhysicalMaterial && function(e, t, i) {
|
|
e.ior.value = t.ior, t.sheen > 0 && (e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen), e.sheenRoughness.value = t.sheenRoughness, t.sheenColorMap && (e.sheenColorMap.value = t.sheenColorMap, n(t.sheenColorMap, e.sheenColorMapTransform)), t.sheenRoughnessMap && (e.sheenRoughnessMap.value = t.sheenRoughnessMap, n(t.sheenRoughnessMap, e.sheenRoughnessMapTransform)));
|
|
t.clearcoat > 0 && (e.clearcoat.value = t.clearcoat, e.clearcoatRoughness.value = t.clearcoatRoughness, t.clearcoatMap && (e.clearcoatMap.value = t.clearcoatMap, n(t.clearcoatMap, e.clearcoatMapTransform)), t.clearcoatRoughnessMap && (e.clearcoatRoughnessMap.value = t.clearcoatRoughnessMap, n(t.clearcoatRoughnessMap, e.clearcoatRoughnessMapTransform)), t.clearcoatNormalMap && (e.clearcoatNormalMap.value = t.clearcoatNormalMap, n(t.clearcoatNormalMap, e.clearcoatNormalMapTransform), e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale), 1 === t.side && e.clearcoatNormalScale.value.negate()));
|
|
t.dispersion > 0 && (e.dispersion.value = t.dispersion);
|
|
t.iridescence > 0 && (e.iridescence.value = t.iridescence, e.iridescenceIOR.value = t.iridescenceIOR, e.iridescenceThicknessMinimum.value = t.iridescenceThicknessRange[0], e.iridescenceThicknessMaximum.value = t.iridescenceThicknessRange[1], t.iridescenceMap && (e.iridescenceMap.value = t.iridescenceMap, n(t.iridescenceMap, e.iridescenceMapTransform)), t.iridescenceThicknessMap && (e.iridescenceThicknessMap.value = t.iridescenceThicknessMap, n(t.iridescenceThicknessMap, e.iridescenceThicknessMapTransform)));
|
|
t.transmission > 0 && (e.transmission.value = t.transmission, e.transmissionSamplerMap.value = i.texture, e.transmissionSamplerSize.value.set(i.width, i.height), t.transmissionMap && (e.transmissionMap.value = t.transmissionMap, n(t.transmissionMap, e.transmissionMapTransform)), e.thickness.value = t.thickness, t.thicknessMap && (e.thicknessMap.value = t.thicknessMap, n(t.thicknessMap, e.thicknessMapTransform)), e.attenuationDistance.value = t.attenuationDistance, e.attenuationColor.value.copy(t.attenuationColor));
|
|
t.anisotropy > 0 && (e.anisotropyVector.value.set(t.anisotropy * Math.cos(t.anisotropyRotation), t.anisotropy * Math.sin(t.anisotropyRotation)), t.anisotropyMap && (e.anisotropyMap.value = t.anisotropyMap, n(t.anisotropyMap, e.anisotropyMapTransform)));
|
|
e.specularIntensity.value = t.specularIntensity, e.specularColor.value.copy(t.specularColor), t.specularColorMap && (e.specularColorMap.value = t.specularColorMap, n(t.specularColorMap, e.specularColorMapTransform));
|
|
t.specularIntensityMap && (e.specularIntensityMap.value = t.specularIntensityMap, n(t.specularIntensityMap, e.specularIntensityMapTransform))
|
|
}(e, r, o)) : r.isMeshMatcapMaterial ? (i(e, r), function(e, t) {
|
|
t.matcap && (e.matcap.value = t.matcap)
|
|
}(e, r)) : r.isMeshDepthMaterial ? i(e, r) : r.isMeshDistanceMaterial ? (i(e, r), function(e, n) {
|
|
const i = t.get(n).light;
|
|
e.referencePosition.value.setFromMatrixPosition(i.matrixWorld), e.nearDistance.value = i.shadow.camera.near, e.farDistance.value = i.shadow.camera.far
|
|
}(e, r)) : r.isMeshNormalMaterial ? i(e, r) : r.isLineBasicMaterial ? (function(e, t) {
|
|
e.diffuse.value.copy(t.color), e.opacity.value = t.opacity, t.map && (e.map.value = t.map, n(t.map, e.mapTransform))
|
|
}(e, r), r.isLineDashedMaterial && function(e, t) {
|
|
e.dashSize.value = t.dashSize, e.totalSize.value = t.dashSize + t.gapSize, e.scale.value = t.scale
|
|
}(e, r)) : r.isPointsMaterial ? function(e, t, i, r) {
|
|
e.diffuse.value.copy(t.color), e.opacity.value = t.opacity, e.size.value = t.size * i, e.scale.value = .5 * r, t.map && (e.map.value = t.map, n(t.map, e.uvTransform));
|
|
t.alphaMap && (e.alphaMap.value = t.alphaMap, n(t.alphaMap, e.alphaMapTransform));
|
|
t.alphaTest > 0 && (e.alphaTest.value = t.alphaTest)
|
|
}(e, r, a, s) : r.isSpriteMaterial ? function(e, t) {
|
|
e.diffuse.value.copy(t.color), e.opacity.value = t.opacity, e.rotation.value = t.rotation, t.map && (e.map.value = t.map, n(t.map, e.mapTransform));
|
|
t.alphaMap && (e.alphaMap.value = t.alphaMap, n(t.alphaMap, e.alphaMapTransform));
|
|
t.alphaTest > 0 && (e.alphaTest.value = t.alphaTest)
|
|
}(e, r) : r.isShadowMaterial ? (e.color.value.copy(r.color), e.opacity.value = r.opacity) : r.isShaderMaterial && (r.uniformsNeedUpdate = !1)
|
|
}
|
|
}
|
|
}
|
|
|
|
function $p(e, t, n, i) {
|
|
let r = {},
|
|
a = {},
|
|
s = [];
|
|
const o = e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);
|
|
|
|
function l(e, t, n, i) {
|
|
const r = e.value,
|
|
a = t + "_" + n;
|
|
if (void 0 === i[a]) return i[a] = "number" == typeof r || "boolean" == typeof r ? r : r.clone(), !0;
|
|
{
|
|
const e = i[a];
|
|
if ("number" == typeof r || "boolean" == typeof r) {
|
|
if (e !== r) return i[a] = r, !0
|
|
} else if (!1 === e.equals(r)) return e.copy(r), !0
|
|
}
|
|
return !1
|
|
}
|
|
|
|
function c(e) {
|
|
const t = {
|
|
boundary: 0,
|
|
storage: 0
|
|
};
|
|
return "number" == typeof e || "boolean" == typeof e ? (t.boundary = 4, t.storage = 4) : e.isVector2 ? (t.boundary = 8, t.storage = 8) : e.isVector3 || e.isColor ? (t.boundary = 16, t.storage = 12) : e.isVector4 ? (t.boundary = 16, t.storage = 16) : e.isMatrix3 ? (t.boundary = 48, t.storage = 48) : e.isMatrix4 ? (t.boundary = 64, t.storage = 64) : e.isTexture ? console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.") : console.warn("THREE.WebGLRenderer: Unsupported uniform value type.", e), t
|
|
}
|
|
|
|
function h(t) {
|
|
const n = t.target;
|
|
n.removeEventListener("dispose", h);
|
|
const i = s.indexOf(n.__bindingPointIndex);
|
|
s.splice(i, 1), e.deleteBuffer(r[n.id]), delete r[n.id], delete a[n.id]
|
|
}
|
|
return {
|
|
bind: function(e, t) {
|
|
const n = t.program;
|
|
i.uniformBlockBinding(e, n)
|
|
},
|
|
update: function(n, u) {
|
|
let d = r[n.id];
|
|
void 0 === d && (! function(e) {
|
|
const t = e.uniforms;
|
|
let n = 0;
|
|
const i = 16;
|
|
for (let e = 0, r = t.length; e < r; e++) {
|
|
const r = Array.isArray(t[e]) ? t[e] : [t[e]];
|
|
for (let e = 0, t = r.length; e < t; e++) {
|
|
const t = r[e],
|
|
a = Array.isArray(t.value) ? t.value : [t.value];
|
|
for (let e = 0, r = a.length; e < r; e++) {
|
|
const r = c(a[e]),
|
|
s = n % i,
|
|
o = s % r.boundary,
|
|
l = s + o;
|
|
n += o, 0 !== l && i - l < r.storage && (n += i - l), t.__data = new Float32Array(r.storage / Float32Array.BYTES_PER_ELEMENT), t.__offset = n, n += r.storage
|
|
}
|
|
}
|
|
}
|
|
const r = n % i;
|
|
r > 0 && (n += i - r);
|
|
e.__size = n, e.__cache = {}
|
|
}(n), d = function(t) {
|
|
const n = function() {
|
|
for (let e = 0; e < o; e++)
|
|
if (-1 === s.indexOf(e)) return s.push(e), e;
|
|
return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."), 0
|
|
}();
|
|
t.__bindingPointIndex = n;
|
|
const i = e.createBuffer(),
|
|
r = t.__size,
|
|
a = t.usage;
|
|
return e.bindBuffer(e.UNIFORM_BUFFER, i), e.bufferData(e.UNIFORM_BUFFER, r, a), e.bindBuffer(e.UNIFORM_BUFFER, null), e.bindBufferBase(e.UNIFORM_BUFFER, n, i), i
|
|
}(n), r[n.id] = d, n.addEventListener("dispose", h));
|
|
const f = u.program;
|
|
i.updateUBOMapping(n, f);
|
|
const p = t.render.frame;
|
|
a[n.id] !== p && (! function(t) {
|
|
const n = r[t.id],
|
|
i = t.uniforms,
|
|
a = t.__cache;
|
|
e.bindBuffer(e.UNIFORM_BUFFER, n);
|
|
for (let t = 0, n = i.length; t < n; t++) {
|
|
const n = Array.isArray(i[t]) ? i[t] : [i[t]];
|
|
for (let i = 0, r = n.length; i < r; i++) {
|
|
const r = n[i];
|
|
if (!0 === l(r, t, i, a)) {
|
|
const t = r.__offset,
|
|
n = Array.isArray(r.value) ? r.value : [r.value];
|
|
let i = 0;
|
|
for (let a = 0; a < n.length; a++) {
|
|
const s = n[a],
|
|
o = c(s);
|
|
"number" == typeof s || "boolean" == typeof s ? (r.__data[0] = s, e.bufferSubData(e.UNIFORM_BUFFER, t + i, r.__data)) : s.isMatrix3 ? (r.__data[0] = s.elements[0], r.__data[1] = s.elements[1], r.__data[2] = s.elements[2], r.__data[3] = 0, r.__data[4] = s.elements[3], r.__data[5] = s.elements[4], r.__data[6] = s.elements[5], r.__data[7] = 0, r.__data[8] = s.elements[6], r.__data[9] = s.elements[7], r.__data[10] = s.elements[8], r.__data[11] = 0) : (s.toArray(r.__data, i), i += o.storage / Float32Array.BYTES_PER_ELEMENT)
|
|
}
|
|
e.bufferSubData(e.UNIFORM_BUFFER, t, r.__data)
|
|
}
|
|
}
|
|
}
|
|
e.bindBuffer(e.UNIFORM_BUFFER, null)
|
|
}(n), a[n.id] = p)
|
|
},
|
|
dispose: function() {
|
|
for (const t in r) e.deleteBuffer(r[t]);
|
|
s = [], r = {}, a = {}
|
|
}
|
|
}
|
|
}
|
|
class em {
|
|
constructor(t = {}) {
|
|
const {
|
|
canvas: n = It(),
|
|
context: i = null,
|
|
depth: r = !0,
|
|
stencil: a = !1,
|
|
alpha: s = !1,
|
|
antialias: o = !1,
|
|
premultipliedAlpha: l = !0,
|
|
preserveDrawingBuffer: c = !1,
|
|
powerPreference: h = "default",
|
|
failIfMajorPerformanceCaveat: u = !1,
|
|
reverseDepthBuffer: d = !1
|
|
} = t;
|
|
let f;
|
|
if (this.isWebGLRenderer = !0, null !== i) {
|
|
if ("undefined" != typeof WebGLRenderingContext && i instanceof WebGLRenderingContext) throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");
|
|
f = i.getContextAttributes().alpha
|
|
} else f = s;
|
|
const p = new Uint32Array(4),
|
|
m = new Int32Array(4);
|
|
let g = null,
|
|
A = null;
|
|
const _ = [],
|
|
v = [];
|
|
this.domElement = n, this.debug = {
|
|
checkShaderErrors: !0,
|
|
onShaderError: null
|
|
}, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this._outputColorSpace = Ye, this.toneMapping = 0, this.toneMappingExposure = 1;
|
|
const w = this;
|
|
let y = !1,
|
|
x = 0,
|
|
b = 0,
|
|
E = null,
|
|
S = -1,
|
|
M = null;
|
|
const T = new Qt,
|
|
C = new Qt;
|
|
let I = null;
|
|
const R = new wi(0);
|
|
let P = 0,
|
|
B = n.width,
|
|
D = n.height,
|
|
L = 1,
|
|
U = null,
|
|
k = null;
|
|
const N = new Qt(0, 0, B, D),
|
|
F = new Qt(0, 0, B, D);
|
|
let O = !1;
|
|
const z = new Jr;
|
|
let W = !1,
|
|
H = !1;
|
|
this.transmissionResolutionScale = 1;
|
|
const V = new Cn,
|
|
G = new Cn,
|
|
j = new Zt,
|
|
q = new Qt,
|
|
K = {
|
|
background: null,
|
|
fog: null,
|
|
environment: null,
|
|
overrideMaterial: null,
|
|
isScene: !0
|
|
};
|
|
let J = !1;
|
|
|
|
function ie() {
|
|
return null === E ? L : 1
|
|
}
|
|
let re, ae, se, oe, ue, de, fe, pe, me, ge, Ae, _e, ve, we, ye, xe, be, Ee, Se, Me, Te, Ce, Ie, Re, Pe = i;
|
|
|
|
function Be(e, t) {
|
|
return n.getContext(e, t)
|
|
}
|
|
try {
|
|
const t = {
|
|
alpha: !0,
|
|
depth: r,
|
|
stencil: a,
|
|
antialias: o,
|
|
premultipliedAlpha: l,
|
|
preserveDrawingBuffer: c,
|
|
powerPreference: h,
|
|
failIfMajorPerformanceCaveat: u
|
|
};
|
|
if ("setAttribute" in n && n.setAttribute("data-engine", `three.js r${e}`), n.addEventListener("webglcontextlost", Ue, !1), n.addEventListener("webglcontextrestored", ke, !1), n.addEventListener("webglcontextcreationerror", Ne, !1), null === Pe) {
|
|
const e = "webgl2";
|
|
if (Pe = Be(e, t), null === Pe) throw Be(e) ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.")
|
|
}
|
|
} catch (e) {
|
|
throw console.error("THREE.WebGLRenderer: " + e.message), e
|
|
}
|
|
|
|
function De() {
|
|
re = new Kd(Pe), re.init(), Ce = new jp(Pe, re), ae = new Cd(Pe, re, t, Ce), se = new Qp(Pe, re), ae.reverseDepthBuffer && d && se.buffers.depth.setReversed(!0), oe = new $d(Pe), ue = new Bp, de = new Xp(Pe, re, se, ue, ae, Ce, oe), fe = new Rd(w), pe = new Yd(w), me = new _d(Pe), Ie = new Md(Pe, me), ge = new Zd(Pe, me, oe, Ie), Ae = new tf(Pe, ge, me, oe), Se = new ef(Pe, ae, de), xe = new Id(ue), _e = new Pp(w, fe, pe, re, ae, Ie, xe), ve = new Jp(w, ue), we = new kp, ye = new Hp(re), Ee = new Sd(w, fe, pe, se, Ae, f, l), be = new Vp(w, Ae, ae), Re = new $p(Pe, oe, ae, se), Me = new Td(Pe, re, oe), Te = new Jd(Pe, re, oe), oe.programs = _e.programs, w.capabilities = ae, w.extensions = re, w.properties = ue, w.renderLists = we, w.shadowMap = be, w.state = se, w.info = oe
|
|
}
|
|
De();
|
|
const Le = new Yp(w, Pe);
|
|
|
|
function Ue(e) {
|
|
e.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), y = !0
|
|
}
|
|
|
|
function ke() {
|
|
console.log("THREE.WebGLRenderer: Context Restored."), y = !1;
|
|
const e = oe.autoReset,
|
|
t = be.enabled,
|
|
n = be.autoUpdate,
|
|
i = be.needsUpdate,
|
|
r = be.type;
|
|
De(), oe.autoReset = e, be.enabled = t, be.autoUpdate = n, be.needsUpdate = i, be.type = r
|
|
}
|
|
|
|
function Ne(e) {
|
|
console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ", e.statusMessage)
|
|
}
|
|
|
|
function Fe(e) {
|
|
const t = e.target;
|
|
t.removeEventListener("dispose", Fe),
|
|
function(e) {
|
|
(function(e) {
|
|
const t = ue.get(e).programs;
|
|
void 0 !== t && (t.forEach((function(e) {
|
|
_e.releaseProgram(e)
|
|
})), e.isShaderMaterial && _e.releaseShaderCache(e))
|
|
})(e), ue.remove(e)
|
|
}(t)
|
|
}
|
|
|
|
function Oe(e, t, n) {
|
|
!0 === e.transparent && 2 === e.side && !1 === e.forceSinglePass ? (e.side = 1, e.needsUpdate = !0, Ze(e, t, n), e.side = 0, e.needsUpdate = !0, Ze(e, t, n), e.side = 2) : Ze(e, t, n)
|
|
}
|
|
this.xr = Le, this.getContext = function() {
|
|
return Pe
|
|
}, this.getContextAttributes = function() {
|
|
return Pe.getContextAttributes()
|
|
}, this.forceContextLoss = function() {
|
|
const e = re.get("WEBGL_lose_context");
|
|
e && e.loseContext()
|
|
}, this.forceContextRestore = function() {
|
|
const e = re.get("WEBGL_lose_context");
|
|
e && e.restoreContext()
|
|
}, this.getPixelRatio = function() {
|
|
return L
|
|
}, this.setPixelRatio = function(e) {
|
|
void 0 !== e && (L = e, this.setSize(B, D, !1))
|
|
}, this.getSize = function(e) {
|
|
return e.set(B, D)
|
|
}, this.setSize = function(e, t, i = !0) {
|
|
Le.isPresenting ? console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.") : (B = e, D = t, n.width = Math.floor(e * L), n.height = Math.floor(t * L), !0 === i && (n.style.width = e + "px", n.style.height = t + "px"), this.setViewport(0, 0, e, t))
|
|
}, this.getDrawingBufferSize = function(e) {
|
|
return e.set(B * L, D * L).floor()
|
|
}, this.setDrawingBufferSize = function(e, t, i) {
|
|
B = e, D = t, L = i, n.width = Math.floor(e * i), n.height = Math.floor(t * i), this.setViewport(0, 0, e, t)
|
|
}, this.getCurrentViewport = function(e) {
|
|
return e.copy(T)
|
|
}, this.getViewport = function(e) {
|
|
return e.copy(N)
|
|
}, this.setViewport = function(e, t, n, i) {
|
|
e.isVector4 ? N.set(e.x, e.y, e.z, e.w) : N.set(e, t, n, i), se.viewport(T.copy(N).multiplyScalar(L).round())
|
|
}, this.getScissor = function(e) {
|
|
return e.copy(F)
|
|
}, this.setScissor = function(e, t, n, i) {
|
|
e.isVector4 ? F.set(e.x, e.y, e.z, e.w) : F.set(e, t, n, i), se.scissor(C.copy(F).multiplyScalar(L).round())
|
|
}, this.getScissorTest = function() {
|
|
return O
|
|
}, this.setScissorTest = function(e) {
|
|
se.setScissorTest(O = e)
|
|
}, this.setOpaqueSort = function(e) {
|
|
U = e
|
|
}, this.setTransparentSort = function(e) {
|
|
k = e
|
|
}, this.getClearColor = function(e) {
|
|
return e.copy(Ee.getClearColor())
|
|
}, this.setClearColor = function() {
|
|
Ee.setClearColor(...arguments)
|
|
}, this.getClearAlpha = function() {
|
|
return Ee.getClearAlpha()
|
|
}, this.setClearAlpha = function() {
|
|
Ee.setClearAlpha(...arguments)
|
|
}, this.clear = function(e = !0, t = !0, n = !0) {
|
|
let i = 0;
|
|
if (e) {
|
|
let e = !1;
|
|
if (null !== E) {
|
|
const t = E.texture.format;
|
|
e = t === he || t === ce || t === le
|
|
}
|
|
if (e) {
|
|
const e = E.texture.type,
|
|
t = e === X || e === Z || e === Y || e === ne || e === ee || e === te,
|
|
n = Ee.getClearColor(),
|
|
i = Ee.getClearAlpha(),
|
|
r = n.r,
|
|
a = n.g,
|
|
s = n.b;
|
|
t ? (p[0] = r, p[1] = a, p[2] = s, p[3] = i, Pe.clearBufferuiv(Pe.COLOR, 0, p)) : (m[0] = r, m[1] = a, m[2] = s, m[3] = i, Pe.clearBufferiv(Pe.COLOR, 0, m))
|
|
} else i |= Pe.COLOR_BUFFER_BIT
|
|
}
|
|
t && (i |= Pe.DEPTH_BUFFER_BIT), n && (i |= Pe.STENCIL_BUFFER_BIT, this.state.buffers.stencil.setMask(4294967295)), Pe.clear(i)
|
|
}, this.clearColor = function() {
|
|
this.clear(!0, !1, !1)
|
|
}, this.clearDepth = function() {
|
|
this.clear(!1, !0, !1)
|
|
}, this.clearStencil = function() {
|
|
this.clear(!1, !1, !0)
|
|
}, this.dispose = function() {
|
|
n.removeEventListener("webglcontextlost", Ue, !1), n.removeEventListener("webglcontextrestored", ke, !1), n.removeEventListener("webglcontextcreationerror", Ne, !1), Ee.dispose(), we.dispose(), ye.dispose(), ue.dispose(), fe.dispose(), pe.dispose(), Ae.dispose(), Ie.dispose(), Re.dispose(), _e.dispose(), Le.dispose(), Le.removeEventListener("sessionstart", We), Le.removeEventListener("sessionend", He), Ve.stop()
|
|
}, this.renderBufferDirect = function(e, t, n, i, r, a) {
|
|
null === t && (t = K);
|
|
const s = r.isMesh && r.matrixWorld.determinant() < 0,
|
|
o = function(e, t, n, i, r) {
|
|
!0 !== t.isScene && (t = K);
|
|
de.resetTextureUnits();
|
|
const a = t.fog,
|
|
s = i.isMeshStandardMaterial ? t.environment : null,
|
|
o = null === E ? w.outputColorSpace : !0 === E.isXRRenderTarget ? E.texture.colorSpace : Ke,
|
|
l = (i.isMeshStandardMaterial ? pe : fe).get(i.envMap || s),
|
|
c = !0 === i.vertexColors && !!n.attributes.color && 4 === n.attributes.color.itemSize,
|
|
h = !!n.attributes.tangent && (!!i.normalMap || i.anisotropy > 0),
|
|
u = !!n.morphAttributes.position,
|
|
d = !!n.morphAttributes.normal,
|
|
f = !!n.morphAttributes.color;
|
|
let p = 0;
|
|
i.toneMapped && (null !== E && !0 !== E.isXRRenderTarget || (p = w.toneMapping));
|
|
const m = n.morphAttributes.position || n.morphAttributes.normal || n.morphAttributes.color,
|
|
g = void 0 !== m ? m.length : 0,
|
|
_ = ue.get(i),
|
|
v = A.state.lights;
|
|
if (!0 === W && (!0 === H || e !== M)) {
|
|
const t = e === M && i.id === S;
|
|
xe.setState(i, e, t)
|
|
}
|
|
let y = !1;
|
|
i.version === _.__version ? _.needsLights && _.lightsStateVersion !== v.state.version || _.outputColorSpace !== o || r.isBatchedMesh && !1 === _.batching ? y = !0 : r.isBatchedMesh || !0 !== _.batching ? r.isBatchedMesh && !0 === _.batchingColor && null === r.colorTexture || r.isBatchedMesh && !1 === _.batchingColor && null !== r.colorTexture || r.isInstancedMesh && !1 === _.instancing ? y = !0 : r.isInstancedMesh || !0 !== _.instancing ? r.isSkinnedMesh && !1 === _.skinning ? y = !0 : r.isSkinnedMesh || !0 !== _.skinning ? r.isInstancedMesh && !0 === _.instancingColor && null === r.instanceColor || r.isInstancedMesh && !1 === _.instancingColor && null !== r.instanceColor || r.isInstancedMesh && !0 === _.instancingMorph && null === r.morphTexture || r.isInstancedMesh && !1 === _.instancingMorph && null !== r.morphTexture || _.envMap !== l || !0 === i.fog && _.fog !== a ? y = !0 : void 0 === _.numClippingPlanes || _.numClippingPlanes === xe.numPlanes && _.numIntersection === xe.numIntersection ? (_.vertexAlphas !== c || _.vertexTangents !== h || _.morphTargets !== u || _.morphNormals !== d || _.morphColors !== f || _.toneMapping !== p || _.morphTargetsCount !== g) && (y = !0) : y = !0 : y = !0 : y = !0 : y = !0 : (y = !0, _.__version = i.version);
|
|
let x = _.currentProgram;
|
|
!0 === y && (x = Ze(i, t, r));
|
|
let b = !1,
|
|
T = !1,
|
|
C = !1;
|
|
const I = x.getUniforms(),
|
|
R = _.uniforms;
|
|
se.useProgram(x.program) && (b = !0, T = !0, C = !0);
|
|
i.id !== S && (S = i.id, T = !0);
|
|
if (b || M !== e) {
|
|
se.buffers.depth.getReversed() ? (V.copy(e.projectionMatrix), function(e) {
|
|
const t = e.elements;
|
|
t[2] = .5 * t[2] + .5 * t[3], t[6] = .5 * t[6] + .5 * t[7], t[10] = .5 * t[10] + .5 * t[11], t[14] = .5 * t[14] + .5 * t[15]
|
|
}(V), function(e) {
|
|
const t = e.elements; - 1 === t[11] ? (t[10] = -t[10] - 1, t[14] = -t[14]) : (t[10] = -t[10], t[14] = 1 - t[14])
|
|
}(V), I.setValue(Pe, "projectionMatrix", V)) : I.setValue(Pe, "projectionMatrix", e.projectionMatrix), I.setValue(Pe, "viewMatrix", e.matrixWorldInverse);
|
|
const t = I.map.cameraPosition;
|
|
void 0 !== t && t.setValue(Pe, j.setFromMatrixPosition(e.matrixWorld)), ae.logarithmicDepthBuffer && I.setValue(Pe, "logDepthBufFC", 2 / (Math.log(e.far + 1) / Math.LN2)), (i.isMeshPhongMaterial || i.isMeshToonMaterial || i.isMeshLambertMaterial || i.isMeshBasicMaterial || i.isMeshStandardMaterial || i.isShaderMaterial) && I.setValue(Pe, "isOrthographic", !0 === e.isOrthographicCamera), M !== e && (M = e, T = !0, C = !0)
|
|
}
|
|
if (r.isSkinnedMesh) {
|
|
I.setOptional(Pe, r, "bindMatrix"), I.setOptional(Pe, r, "bindMatrixInverse");
|
|
const e = r.skeleton;
|
|
e && (null === e.boneTexture && e.computeBoneTexture(), I.setValue(Pe, "boneTexture", e.boneTexture, de))
|
|
}
|
|
r.isBatchedMesh && (I.setOptional(Pe, r, "batchingTexture"), I.setValue(Pe, "batchingTexture", r._matricesTexture, de), I.setOptional(Pe, r, "batchingIdTexture"), I.setValue(Pe, "batchingIdTexture", r._indirectTexture, de), I.setOptional(Pe, r, "batchingColorTexture"), null !== r._colorsTexture && I.setValue(Pe, "batchingColorTexture", r._colorsTexture, de));
|
|
const P = n.morphAttributes;
|
|
void 0 === P.position && void 0 === P.normal && void 0 === P.color || Se.update(r, n, x);
|
|
(T || _.receiveShadow !== r.receiveShadow) && (_.receiveShadow = r.receiveShadow, I.setValue(Pe, "receiveShadow", r.receiveShadow));
|
|
i.isMeshGouraudMaterial && null !== i.envMap && (R.envMap.value = l, R.flipEnvMap.value = l.isCubeTexture && !1 === l.isRenderTargetTexture ? -1 : 1);
|
|
i.isMeshStandardMaterial && null === i.envMap && null !== t.environment && (R.envMapIntensity.value = t.environmentIntensity);
|
|
T && (I.setValue(Pe, "toneMappingExposure", w.toneMappingExposure), _.needsLights && (U = C, (B = R).ambientLightColor.needsUpdate = U, B.lightProbe.needsUpdate = U, B.directionalLights.needsUpdate = U, B.directionalLightShadows.needsUpdate = U, B.pointLights.needsUpdate = U, B.pointLightShadows.needsUpdate = U, B.spotLights.needsUpdate = U, B.spotLightShadows.needsUpdate = U, B.rectAreaLights.needsUpdate = U, B.hemisphereLights.needsUpdate = U), a && !0 === i.fog && ve.refreshFogUniforms(R, a), ve.refreshMaterialUniforms(R, i, L, D, A.state.transmissionRenderTarget[e.id]), op.upload(Pe, Je(_), R, de));
|
|
var B, U;
|
|
i.isShaderMaterial && !0 === i.uniformsNeedUpdate && (op.upload(Pe, Je(_), R, de), i.uniformsNeedUpdate = !1);
|
|
i.isSpriteMaterial && I.setValue(Pe, "center", r.center);
|
|
if (I.setValue(Pe, "modelViewMatrix", r.modelViewMatrix), I.setValue(Pe, "normalMatrix", r.normalMatrix), I.setValue(Pe, "modelMatrix", r.matrixWorld), i.isShaderMaterial || i.isRawShaderMaterial) {
|
|
const e = i.uniformsGroups;
|
|
for (let t = 0, n = e.length; t < n; t++) {
|
|
const n = e[t];
|
|
Re.update(n, x), Re.bind(n, x)
|
|
}
|
|
}
|
|
return x
|
|
}(e, t, n, i, r);
|
|
se.setMaterial(i, s);
|
|
let l = n.index,
|
|
c = 1;
|
|
if (!0 === i.wireframe) {
|
|
if (l = ge.getWireframeAttribute(n), void 0 === l) return;
|
|
c = 2
|
|
}
|
|
const h = n.drawRange,
|
|
u = n.attributes.position;
|
|
let d = h.start * c,
|
|
f = (h.start + h.count) * c;
|
|
null !== a && (d = Math.max(d, a.start * c), f = Math.min(f, (a.start + a.count) * c)), null !== l ? (d = Math.max(d, 0), f = Math.min(f, l.count)) : null != u && (d = Math.max(d, 0), f = Math.min(f, u.count));
|
|
const p = f - d;
|
|
if (p < 0 || p === 1 / 0) return;
|
|
let m;
|
|
Ie.setup(r, i, o, n, l);
|
|
let g = Me;
|
|
if (null !== l && (m = me.get(l), g = Te, g.setIndex(m)), r.isMesh) !0 === i.wireframe ? (se.setLineWidth(i.wireframeLinewidth * ie()), g.setMode(Pe.LINES)) : g.setMode(Pe.TRIANGLES);
|
|
else if (r.isLine) {
|
|
let e = i.linewidth;
|
|
void 0 === e && (e = 1), se.setLineWidth(e * ie()), r.isLineSegments ? g.setMode(Pe.LINES) : r.isLineLoop ? g.setMode(Pe.LINE_LOOP) : g.setMode(Pe.LINE_STRIP)
|
|
} else r.isPoints ? g.setMode(Pe.POINTS) : r.isSprite && g.setMode(Pe.TRIANGLES);
|
|
if (r.isBatchedMesh)
|
|
if (null !== r._multiDrawInstances) Pt("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."), g.renderMultiDrawInstances(r._multiDrawStarts, r._multiDrawCounts, r._multiDrawCount, r._multiDrawInstances);
|
|
else if (re.get("WEBGL_multi_draw")) g.renderMultiDraw(r._multiDrawStarts, r._multiDrawCounts, r._multiDrawCount);
|
|
else {
|
|
const e = r._multiDrawStarts,
|
|
t = r._multiDrawCounts,
|
|
n = r._multiDrawCount,
|
|
a = l ? me.get(l).bytesPerElement : 1,
|
|
s = ue.get(i).currentProgram.getUniforms();
|
|
for (let i = 0; i < n; i++) s.setValue(Pe, "_gl_DrawID", i), g.render(e[i] / a, t[i])
|
|
} else if (r.isInstancedMesh) g.renderInstances(d, p, r.count);
|
|
else if (n.isInstancedBufferGeometry) {
|
|
const e = void 0 !== n._maxInstanceCount ? n._maxInstanceCount : 1 / 0,
|
|
t = Math.min(n.instanceCount, e);
|
|
g.renderInstances(d, p, t)
|
|
} else g.render(d, p)
|
|
}, this.compile = function(e, t, n = null) {
|
|
null === n && (n = e), A = ye.get(n), A.init(t), v.push(A), n.traverseVisible((function(e) {
|
|
e.isLight && e.layers.test(t.layers) && (A.pushLight(e), e.castShadow && A.pushShadow(e))
|
|
})), e !== n && e.traverseVisible((function(e) {
|
|
e.isLight && e.layers.test(t.layers) && (A.pushLight(e), e.castShadow && A.pushShadow(e))
|
|
})), A.setupLights();
|
|
const i = new Set;
|
|
return e.traverse((function(e) {
|
|
if (!(e.isMesh || e.isPoints || e.isLine || e.isSprite)) return;
|
|
const t = e.material;
|
|
if (t)
|
|
if (Array.isArray(t))
|
|
for (let r = 0; r < t.length; r++) {
|
|
const a = t[r];
|
|
Oe(a, n, e), i.add(a)
|
|
} else Oe(t, n, e), i.add(t)
|
|
})), A = v.pop(), i
|
|
}, this.compileAsync = function(e, t, n = null) {
|
|
const i = this.compile(e, t, n);
|
|
return new Promise((t => {
|
|
function n() {
|
|
i.forEach((function(e) {
|
|
ue.get(e).currentProgram.isReady() && i.delete(e)
|
|
})), 0 !== i.size ? setTimeout(n, 10) : t(e)
|
|
}
|
|
null !== re.get("KHR_parallel_shader_compile") ? n() : setTimeout(n, 10)
|
|
}))
|
|
};
|
|
let ze = null;
|
|
|
|
function We() {
|
|
Ve.stop()
|
|
}
|
|
|
|
function He() {
|
|
Ve.start()
|
|
}
|
|
const Ve = new Ad;
|
|
|
|
function Ge(e, t, n, i) {
|
|
if (!1 === e.visible) return;
|
|
if (e.layers.test(t.layers))
|
|
if (e.isGroup) n = e.renderOrder;
|
|
else if (e.isLOD) !0 === e.autoUpdate && e.update(t);
|
|
else if (e.isLight) A.pushLight(e), e.castShadow && A.pushShadow(e);
|
|
else if (e.isSprite) {
|
|
if (!e.frustumCulled || z.intersectsSprite(e)) {
|
|
i && q.setFromMatrixPosition(e.matrixWorld).applyMatrix4(G);
|
|
const t = Ae.update(e),
|
|
r = e.material;
|
|
r.visible && g.push(e, t, r, n, q.z, null)
|
|
}
|
|
} else if ((e.isMesh || e.isLine || e.isPoints) && (!e.frustumCulled || z.intersectsObject(e))) {
|
|
const t = Ae.update(e),
|
|
r = e.material;
|
|
if (i && (void 0 !== e.boundingSphere ? (null === e.boundingSphere && e.computeBoundingSphere(), q.copy(e.boundingSphere.center)) : (null === t.boundingSphere && t.computeBoundingSphere(), q.copy(t.boundingSphere.center)), q.applyMatrix4(e.matrixWorld).applyMatrix4(G)), Array.isArray(r)) {
|
|
const i = t.groups;
|
|
for (let a = 0, s = i.length; a < s; a++) {
|
|
const s = i[a],
|
|
o = r[s.materialIndex];
|
|
o && o.visible && g.push(e, t, o, n, q.z, s)
|
|
}
|
|
} else r.visible && g.push(e, t, r, n, q.z, null)
|
|
}
|
|
const r = e.children;
|
|
for (let e = 0, a = r.length; e < a; e++) Ge(r[e], t, n, i)
|
|
}
|
|
|
|
function Qe(e, t, n, i) {
|
|
const r = e.opaque,
|
|
a = e.transmissive,
|
|
s = e.transparent;
|
|
A.setupLightsView(n), !0 === W && xe.setGlobalState(w.clippingPlanes, n), i && se.viewport(T.copy(i)), r.length > 0 && je(r, t, n), a.length > 0 && je(a, t, n), s.length > 0 && je(s, t, n), se.buffers.depth.setTest(!0), se.buffers.depth.setMask(!0), se.buffers.color.setMask(!0), se.setPolygonOffset(!1)
|
|
}
|
|
|
|
function Xe(e, t, n, i) {
|
|
if (null !== (!0 === n.isScene ? n.overrideMaterial : null)) return;
|
|
void 0 === A.state.transmissionRenderTarget[i.id] && (A.state.transmissionRenderTarget[i.id] = new jt(1, 1, {
|
|
generateMipmaps: !0,
|
|
type: re.has("EXT_color_buffer_half_float") || re.has("EXT_color_buffer_float") ? $ : X,
|
|
minFilter: Q,
|
|
samples: 4,
|
|
stencilBuffer: a,
|
|
resolveDepthBuffer: !1,
|
|
resolveStencilBuffer: !1,
|
|
colorSpace: Ut.workingColorSpace
|
|
}));
|
|
const r = A.state.transmissionRenderTarget[i.id],
|
|
s = i.viewport || T;
|
|
r.setSize(s.z * w.transmissionResolutionScale, s.w * w.transmissionResolutionScale);
|
|
const o = w.getRenderTarget();
|
|
w.setRenderTarget(r), w.getClearColor(R), P = w.getClearAlpha(), P < 1 && w.setClearColor(16777215, .5), w.clear(), J && Ee.render(n);
|
|
const l = w.toneMapping;
|
|
w.toneMapping = 0;
|
|
const c = i.viewport;
|
|
if (void 0 !== i.viewport && (i.viewport = void 0), A.setupLightsView(i), !0 === W && xe.setGlobalState(w.clippingPlanes, i), je(e, n, i), de.updateMultisampleRenderTarget(r), de.updateRenderTargetMipmap(r), !1 === re.has("WEBGL_multisampled_render_to_texture")) {
|
|
let e = !1;
|
|
for (let r = 0, a = t.length; r < a; r++) {
|
|
const a = t[r],
|
|
s = a.object,
|
|
o = a.geometry,
|
|
l = a.material,
|
|
c = a.group;
|
|
if (2 === l.side && s.layers.test(i.layers)) {
|
|
const t = l.side;
|
|
l.side = 1, l.needsUpdate = !0, qe(s, n, i, o, l, c), l.side = t, l.needsUpdate = !0, e = !0
|
|
}
|
|
}!0 === e && (de.updateMultisampleRenderTarget(r), de.updateRenderTargetMipmap(r))
|
|
}
|
|
w.setRenderTarget(o), w.setClearColor(R, P), void 0 !== c && (i.viewport = c), w.toneMapping = l
|
|
}
|
|
|
|
function je(e, t, n) {
|
|
const i = !0 === t.isScene ? t.overrideMaterial : null;
|
|
for (let r = 0, a = e.length; r < a; r++) {
|
|
const a = e[r],
|
|
s = a.object,
|
|
o = a.geometry,
|
|
l = null === i ? a.material : i,
|
|
c = a.group;
|
|
s.layers.test(n.layers) && qe(s, t, n, o, l, c)
|
|
}
|
|
}
|
|
|
|
function qe(e, t, n, i, r, a) {
|
|
e.onBeforeRender(w, t, n, i, r, a), e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, e.matrixWorld), e.normalMatrix.getNormalMatrix(e.modelViewMatrix), r.onBeforeRender(w, t, n, i, e, a), !0 === r.transparent && 2 === r.side && !1 === r.forceSinglePass ? (r.side = 1, r.needsUpdate = !0, w.renderBufferDirect(n, t, i, r, e, a), r.side = 0, r.needsUpdate = !0, w.renderBufferDirect(n, t, i, r, e, a), r.side = 2) : w.renderBufferDirect(n, t, i, r, e, a), e.onAfterRender(w, t, n, i, r, a)
|
|
}
|
|
|
|
function Ze(e, t, n) {
|
|
!0 !== t.isScene && (t = K);
|
|
const i = ue.get(e),
|
|
r = A.state.lights,
|
|
a = A.state.shadowsArray,
|
|
s = r.state.version,
|
|
o = _e.getParameters(e, r.state, a, t, n),
|
|
l = _e.getProgramCacheKey(o);
|
|
let c = i.programs;
|
|
i.environment = e.isMeshStandardMaterial ? t.environment : null, i.fog = t.fog, i.envMap = (e.isMeshStandardMaterial ? pe : fe).get(e.envMap || i.environment), i.envMapRotation = null !== i.environment && null === e.envMap ? t.environmentRotation : e.envMapRotation, void 0 === c && (e.addEventListener("dispose", Fe), c = new Map, i.programs = c);
|
|
let h = c.get(l);
|
|
if (void 0 !== h) {
|
|
if (i.currentProgram === h && i.lightsStateVersion === s) return $e(e, o), h
|
|
} else o.uniforms = _e.getUniforms(e), e.onBeforeCompile(o, w), h = _e.acquireProgram(o, l), c.set(l, h), i.uniforms = o.uniforms;
|
|
const u = i.uniforms;
|
|
return (e.isShaderMaterial || e.isRawShaderMaterial) && !0 !== e.clipping || (u.clippingPlanes = xe.uniform), $e(e, o), i.needsLights = function(e) {
|
|
return e.isMeshLambertMaterial || e.isMeshToonMaterial || e.isMeshPhongMaterial || e.isMeshStandardMaterial || e.isShadowMaterial || e.isShaderMaterial && !0 === e.lights
|
|
}(e), i.lightsStateVersion = s, i.needsLights && (u.ambientLightColor.value = r.state.ambient, u.lightProbe.value = r.state.probe, u.directionalLights.value = r.state.directional, u.directionalLightShadows.value = r.state.directionalShadow, u.spotLights.value = r.state.spot, u.spotLightShadows.value = r.state.spotShadow, u.rectAreaLights.value = r.state.rectArea, u.ltc_1.value = r.state.rectAreaLTC1, u.ltc_2.value = r.state.rectAreaLTC2, u.pointLights.value = r.state.point, u.pointLightShadows.value = r.state.pointShadow, u.hemisphereLights.value = r.state.hemi, u.directionalShadowMap.value = r.state.directionalShadowMap, u.directionalShadowMatrix.value = r.state.directionalShadowMatrix, u.spotShadowMap.value = r.state.spotShadowMap, u.spotLightMatrix.value = r.state.spotLightMatrix, u.spotLightMap.value = r.state.spotLightMap, u.pointShadowMap.value = r.state.pointShadowMap, u.pointShadowMatrix.value = r.state.pointShadowMatrix), i.currentProgram = h, i.uniformsList = null, h
|
|
}
|
|
|
|
function Je(e) {
|
|
if (null === e.uniformsList) {
|
|
const t = e.currentProgram.getUniforms();
|
|
e.uniformsList = op.seqWithValue(t.seq, e.uniforms)
|
|
}
|
|
return e.uniformsList
|
|
}
|
|
|
|
function $e(e, t) {
|
|
const n = ue.get(e);
|
|
n.outputColorSpace = t.outputColorSpace, n.batching = t.batching, n.batchingColor = t.batchingColor, n.instancing = t.instancing, n.instancingColor = t.instancingColor, n.instancingMorph = t.instancingMorph, n.skinning = t.skinning, n.morphTargets = t.morphTargets, n.morphNormals = t.morphNormals, n.morphColors = t.morphColors, n.morphTargetsCount = t.morphTargetsCount, n.numClippingPlanes = t.numClippingPlanes, n.numIntersection = t.numClipIntersection, n.vertexAlphas = t.vertexAlphas, n.vertexTangents = t.vertexTangents, n.toneMapping = t.toneMapping
|
|
}
|
|
Ve.setAnimationLoop((function(e) {
|
|
ze && ze(e)
|
|
})), "undefined" != typeof self && Ve.setContext(self), this.setAnimationLoop = function(e) {
|
|
ze = e, Le.setAnimationLoop(e), null === e ? Ve.stop() : Ve.start()
|
|
}, Le.addEventListener("sessionstart", We), Le.addEventListener("sessionend", He), this.render = function(e, t) {
|
|
if (void 0 !== t && !0 !== t.isCamera) return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
|
|
if (!0 === y) return;
|
|
if (!0 === e.matrixWorldAutoUpdate && e.updateMatrixWorld(), null === t.parent && !0 === t.matrixWorldAutoUpdate && t.updateMatrixWorld(), !0 === Le.enabled && !0 === Le.isPresenting && (!0 === Le.cameraAutoUpdate && Le.updateCamera(t), t = Le.getCamera()), !0 === e.isScene && e.onBeforeRender(w, e, t, E), A = ye.get(e, v.length), A.init(t), v.push(A), G.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), z.setFromProjectionMatrix(G), H = this.localClippingEnabled, W = xe.init(this.clippingPlanes, H), g = we.get(e, _.length), g.init(), _.push(g), !0 === Le.enabled && !0 === Le.isPresenting) {
|
|
const e = w.xr.getDepthSensingMesh();
|
|
null !== e && Ge(e, t, -1 / 0, w.sortObjects)
|
|
}
|
|
Ge(e, t, 0, w.sortObjects), g.finish(), !0 === w.sortObjects && g.sort(U, k), J = !1 === Le.enabled || !1 === Le.isPresenting || !1 === Le.hasDepthSensing(), J && Ee.addToRenderList(g, e), this.info.render.frame++, !0 === W && xe.beginShadows();
|
|
const n = A.state.shadowsArray;
|
|
be.render(n, e, t), !0 === W && xe.endShadows(), !0 === this.info.autoReset && this.info.reset();
|
|
const i = g.opaque,
|
|
r = g.transmissive;
|
|
if (A.setupLights(), t.isArrayCamera) {
|
|
const n = t.cameras;
|
|
if (r.length > 0)
|
|
for (let t = 0, a = n.length; t < a; t++) {
|
|
Xe(i, r, e, n[t])
|
|
}
|
|
J && Ee.render(e);
|
|
for (let t = 0, i = n.length; t < i; t++) {
|
|
const i = n[t];
|
|
Qe(g, e, i, i.viewport)
|
|
}
|
|
} else r.length > 0 && Xe(i, r, e, t), J && Ee.render(e), Qe(g, e, t);
|
|
null !== E && 0 === b && (de.updateMultisampleRenderTarget(E), de.updateRenderTargetMipmap(E)), !0 === e.isScene && e.onAfterRender(w, e, t), Ie.resetDefaultState(), S = -1, M = null, v.pop(), v.length > 0 ? (A = v[v.length - 1], !0 === W && xe.setGlobalState(w.clippingPlanes, A.state.camera)) : A = null, _.pop(), g = _.length > 0 ? _[_.length - 1] : null
|
|
}, this.getActiveCubeFace = function() {
|
|
return x
|
|
}, this.getActiveMipmapLevel = function() {
|
|
return b
|
|
}, this.getRenderTarget = function() {
|
|
return E
|
|
}, this.setRenderTargetTextures = function(e, t, n) {
|
|
ue.get(e.texture).__webglTexture = t, ue.get(e.depthTexture).__webglTexture = n;
|
|
const i = ue.get(e);
|
|
i.__hasExternalTextures = !0, i.__autoAllocateDepthBuffer = void 0 === n, i.__autoAllocateDepthBuffer || !0 === re.has("WEBGL_multisampled_render_to_texture") && (console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"), i.__useRenderToTexture = !1)
|
|
}, this.setRenderTargetFramebuffer = function(e, t) {
|
|
const n = ue.get(e);
|
|
n.__webglFramebuffer = t, n.__useDefaultFramebuffer = void 0 === t
|
|
};
|
|
const et = Pe.createFramebuffer();
|
|
this.setRenderTarget = function(e, t = 0, n = 0) {
|
|
E = e, x = t, b = n;
|
|
let i = !0,
|
|
r = null,
|
|
a = !1,
|
|
s = !1;
|
|
if (e) {
|
|
const o = ue.get(e);
|
|
if (void 0 !== o.__useDefaultFramebuffer) se.bindFramebuffer(Pe.FRAMEBUFFER, null), i = !1;
|
|
else if (void 0 === o.__webglFramebuffer) de.setupRenderTarget(e);
|
|
else if (o.__hasExternalTextures) de.rebindTextures(e, ue.get(e.texture).__webglTexture, ue.get(e.depthTexture).__webglTexture);
|
|
else if (e.depthBuffer) {
|
|
const t = e.depthTexture;
|
|
if (o.__boundDepthTexture !== t) {
|
|
if (null !== t && ue.has(t) && (e.width !== t.image.width || e.height !== t.image.height)) throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");
|
|
de.setupDepthRenderbuffer(e)
|
|
}
|
|
}
|
|
const l = e.texture;
|
|
(l.isData3DTexture || l.isDataArrayTexture || l.isCompressedArrayTexture) && (s = !0);
|
|
const c = ue.get(e).__webglFramebuffer;
|
|
e.isWebGLCubeRenderTarget ? (r = Array.isArray(c[t]) ? c[t][n] : c[t], a = !0) : r = e.samples > 0 && !1 === de.useMultisampledRTT(e) ? ue.get(e).__webglMultisampledFramebuffer : Array.isArray(c) ? c[n] : c, T.copy(e.viewport), C.copy(e.scissor), I = e.scissorTest
|
|
} else T.copy(N).multiplyScalar(L).floor(), C.copy(F).multiplyScalar(L).floor(), I = O;
|
|
0 !== n && (r = et);
|
|
if (se.bindFramebuffer(Pe.FRAMEBUFFER, r) && i && se.drawBuffers(e, r), se.viewport(T), se.scissor(C), se.setScissorTest(I), a) {
|
|
const i = ue.get(e.texture);
|
|
Pe.framebufferTexture2D(Pe.FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, Pe.TEXTURE_CUBE_MAP_POSITIVE_X + t, i.__webglTexture, n)
|
|
} else if (s) {
|
|
const i = ue.get(e.texture),
|
|
r = t;
|
|
Pe.framebufferTextureLayer(Pe.FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, i.__webglTexture, n, r)
|
|
} else if (null !== e && 0 !== n) {
|
|
const t = ue.get(e.texture);
|
|
Pe.framebufferTexture2D(Pe.FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, Pe.TEXTURE_2D, t.__webglTexture, n)
|
|
}
|
|
S = -1
|
|
}, this.readRenderTargetPixels = function(e, t, n, i, r, a, s) {
|
|
if (!e || !e.isWebGLRenderTarget) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
|
|
let o = ue.get(e).__webglFramebuffer;
|
|
if (e.isWebGLCubeRenderTarget && void 0 !== s && (o = o[s]), o) {
|
|
se.bindFramebuffer(Pe.FRAMEBUFFER, o);
|
|
try {
|
|
const s = e.texture,
|
|
o = s.format,
|
|
l = s.type;
|
|
if (!ae.textureFormatReadable(o)) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
|
|
if (!ae.textureTypeReadable(l)) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");
|
|
t >= 0 && t <= e.width - i && n >= 0 && n <= e.height - r && Pe.readPixels(t, n, i, r, Ce.convert(o), Ce.convert(l), a)
|
|
} finally {
|
|
const e = null !== E ? ue.get(E).__webglFramebuffer : null;
|
|
se.bindFramebuffer(Pe.FRAMEBUFFER, e)
|
|
}
|
|
}
|
|
}, this.readRenderTargetPixelsAsync = async function(e, t, n, i, r, a, s) {
|
|
if (!e || !e.isWebGLRenderTarget) throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
|
|
let o = ue.get(e).__webglFramebuffer;
|
|
if (e.isWebGLCubeRenderTarget && void 0 !== s && (o = o[s]), o) {
|
|
const s = e.texture,
|
|
l = s.format,
|
|
c = s.type;
|
|
if (!ae.textureFormatReadable(l)) throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");
|
|
if (!ae.textureTypeReadable(c)) throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");
|
|
if (t >= 0 && t <= e.width - i && n >= 0 && n <= e.height - r) {
|
|
se.bindFramebuffer(Pe.FRAMEBUFFER, o);
|
|
const e = Pe.createBuffer();
|
|
Pe.bindBuffer(Pe.PIXEL_PACK_BUFFER, e), Pe.bufferData(Pe.PIXEL_PACK_BUFFER, a.byteLength, Pe.STREAM_READ), Pe.readPixels(t, n, i, r, Ce.convert(l), Ce.convert(c), 0);
|
|
const s = null !== E ? ue.get(E).__webglFramebuffer : null;
|
|
se.bindFramebuffer(Pe.FRAMEBUFFER, s);
|
|
const h = Pe.fenceSync(Pe.SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
return Pe.flush(), await
|
|
function(e, t, n) {
|
|
return new Promise((function(i, r) {
|
|
setTimeout((function a() {
|
|
switch (e.clientWaitSync(t, e.SYNC_FLUSH_COMMANDS_BIT, 0)) {
|
|
case e.WAIT_FAILED:
|
|
r();
|
|
break;
|
|
case e.TIMEOUT_EXPIRED:
|
|
setTimeout(a, n);
|
|
break;
|
|
default:
|
|
i()
|
|
}
|
|
}), n)
|
|
}))
|
|
}(Pe, h, 4), Pe.bindBuffer(Pe.PIXEL_PACK_BUFFER, e), Pe.getBufferSubData(Pe.PIXEL_PACK_BUFFER, 0, a), Pe.deleteBuffer(e), Pe.deleteSync(h), a
|
|
}
|
|
throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")
|
|
}
|
|
}, this.copyFramebufferToTexture = function(e, t = null, n = 0) {
|
|
!0 !== e.isTexture && (Pt("WebGLRenderer: copyFramebufferToTexture function signature has changed."), t = arguments[0] || null, e = arguments[1]);
|
|
const i = Math.pow(2, -n),
|
|
r = Math.floor(e.image.width * i),
|
|
a = Math.floor(e.image.height * i),
|
|
s = null !== t ? t.x : 0,
|
|
o = null !== t ? t.y : 0;
|
|
de.setTexture2D(e, 0), Pe.copyTexSubImage2D(Pe.TEXTURE_2D, n, 0, 0, s, o, r, a), se.unbindTexture()
|
|
};
|
|
const tt = Pe.createFramebuffer(),
|
|
nt = Pe.createFramebuffer();
|
|
this.copyTextureToTexture = function(e, t, n = null, i = null, r = 0, a = null) {
|
|
let s, o, l, c, h, u, d, f, p;
|
|
!0 !== e.isTexture && (Pt("WebGLRenderer: copyTextureToTexture function signature has changed."), i = arguments[0] || null, e = arguments[1], t = arguments[2], a = arguments[3] || 0, n = null), null === a && (0 !== r ? (Pt("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."), a = r, r = 0) : a = 0);
|
|
const m = e.isCompressedTexture ? e.mipmaps[a] : e.image;
|
|
if (null !== n) s = n.max.x - n.min.x, o = n.max.y - n.min.y, l = n.isBox3 ? n.max.z - n.min.z : 1, c = n.min.x, h = n.min.y, u = n.isBox3 ? n.min.z : 0;
|
|
else {
|
|
const t = Math.pow(2, -r);
|
|
s = Math.floor(m.width * t), o = Math.floor(m.height * t), l = e.isDataArrayTexture ? m.depth : e.isData3DTexture ? Math.floor(m.depth * t) : 1, c = 0, h = 0, u = 0
|
|
}
|
|
null !== i ? (d = i.x, f = i.y, p = i.z) : (d = 0, f = 0, p = 0);
|
|
const g = Ce.convert(t.format),
|
|
A = Ce.convert(t.type);
|
|
let _;
|
|
t.isData3DTexture ? (de.setTexture3D(t, 0), _ = Pe.TEXTURE_3D) : t.isDataArrayTexture || t.isCompressedArrayTexture ? (de.setTexture2DArray(t, 0), _ = Pe.TEXTURE_2D_ARRAY) : (de.setTexture2D(t, 0), _ = Pe.TEXTURE_2D), Pe.pixelStorei(Pe.UNPACK_FLIP_Y_WEBGL, t.flipY), Pe.pixelStorei(Pe.UNPACK_PREMULTIPLY_ALPHA_WEBGL, t.premultiplyAlpha), Pe.pixelStorei(Pe.UNPACK_ALIGNMENT, t.unpackAlignment);
|
|
const v = Pe.getParameter(Pe.UNPACK_ROW_LENGTH),
|
|
w = Pe.getParameter(Pe.UNPACK_IMAGE_HEIGHT),
|
|
y = Pe.getParameter(Pe.UNPACK_SKIP_PIXELS),
|
|
x = Pe.getParameter(Pe.UNPACK_SKIP_ROWS),
|
|
b = Pe.getParameter(Pe.UNPACK_SKIP_IMAGES);
|
|
Pe.pixelStorei(Pe.UNPACK_ROW_LENGTH, m.width), Pe.pixelStorei(Pe.UNPACK_IMAGE_HEIGHT, m.height), Pe.pixelStorei(Pe.UNPACK_SKIP_PIXELS, c), Pe.pixelStorei(Pe.UNPACK_SKIP_ROWS, h), Pe.pixelStorei(Pe.UNPACK_SKIP_IMAGES, u);
|
|
const E = e.isDataArrayTexture || e.isData3DTexture,
|
|
S = t.isDataArrayTexture || t.isData3DTexture;
|
|
if (e.isDepthTexture) {
|
|
const n = ue.get(e),
|
|
i = ue.get(t),
|
|
m = ue.get(n.__renderTarget),
|
|
g = ue.get(i.__renderTarget);
|
|
se.bindFramebuffer(Pe.READ_FRAMEBUFFER, m.__webglFramebuffer), se.bindFramebuffer(Pe.DRAW_FRAMEBUFFER, g.__webglFramebuffer);
|
|
for (let n = 0; n < l; n++) E && (Pe.framebufferTextureLayer(Pe.READ_FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, ue.get(e).__webglTexture, r, u + n), Pe.framebufferTextureLayer(Pe.DRAW_FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, ue.get(t).__webglTexture, a, p + n)), Pe.blitFramebuffer(c, h, s, o, d, f, s, o, Pe.DEPTH_BUFFER_BIT, Pe.NEAREST);
|
|
se.bindFramebuffer(Pe.READ_FRAMEBUFFER, null), se.bindFramebuffer(Pe.DRAW_FRAMEBUFFER, null)
|
|
} else if (0 !== r || e.isRenderTargetTexture || ue.has(e)) {
|
|
const n = ue.get(e),
|
|
i = ue.get(t);
|
|
se.bindFramebuffer(Pe.READ_FRAMEBUFFER, tt), se.bindFramebuffer(Pe.DRAW_FRAMEBUFFER, nt);
|
|
for (let e = 0; e < l; e++) E ? Pe.framebufferTextureLayer(Pe.READ_FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, n.__webglTexture, r, u + e) : Pe.framebufferTexture2D(Pe.READ_FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, Pe.TEXTURE_2D, n.__webglTexture, r), S ? Pe.framebufferTextureLayer(Pe.DRAW_FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, i.__webglTexture, a, p + e) : Pe.framebufferTexture2D(Pe.DRAW_FRAMEBUFFER, Pe.COLOR_ATTACHMENT0, Pe.TEXTURE_2D, i.__webglTexture, a), 0 !== r ? Pe.blitFramebuffer(c, h, s, o, d, f, s, o, Pe.COLOR_BUFFER_BIT, Pe.NEAREST) : S ? Pe.copyTexSubImage3D(_, a, d, f, p + e, c, h, s, o) : Pe.copyTexSubImage2D(_, a, d, f, c, h, s, o);
|
|
se.bindFramebuffer(Pe.READ_FRAMEBUFFER, null), se.bindFramebuffer(Pe.DRAW_FRAMEBUFFER, null)
|
|
} else S ? e.isDataTexture || e.isData3DTexture ? Pe.texSubImage3D(_, a, d, f, p, s, o, l, g, A, m.data) : t.isCompressedArrayTexture ? Pe.compressedTexSubImage3D(_, a, d, f, p, s, o, l, g, m.data) : Pe.texSubImage3D(_, a, d, f, p, s, o, l, g, A, m) : e.isDataTexture ? Pe.texSubImage2D(Pe.TEXTURE_2D, a, d, f, s, o, g, A, m.data) : e.isCompressedTexture ? Pe.compressedTexSubImage2D(Pe.TEXTURE_2D, a, d, f, m.width, m.height, g, m.data) : Pe.texSubImage2D(Pe.TEXTURE_2D, a, d, f, s, o, g, A, m);
|
|
Pe.pixelStorei(Pe.UNPACK_ROW_LENGTH, v), Pe.pixelStorei(Pe.UNPACK_IMAGE_HEIGHT, w), Pe.pixelStorei(Pe.UNPACK_SKIP_PIXELS, y), Pe.pixelStorei(Pe.UNPACK_SKIP_ROWS, x), Pe.pixelStorei(Pe.UNPACK_SKIP_IMAGES, b), 0 === a && t.generateMipmaps && Pe.generateMipmap(_), se.unbindTexture()
|
|
}, this.copyTextureToTexture3D = function(e, t, n = null, i = null, r = 0) {
|
|
return !0 !== e.isTexture && (Pt("WebGLRenderer: copyTextureToTexture3D function signature has changed."), n = arguments[0] || null, i = arguments[1] || null, e = arguments[2], t = arguments[3], r = arguments[4] || 0), Pt('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'), this.copyTextureToTexture(e, t, n, i, r)
|
|
}, this.initRenderTarget = function(e) {
|
|
void 0 === ue.get(e).__webglFramebuffer && de.setupRenderTarget(e)
|
|
}, this.initTexture = function(e) {
|
|
e.isCubeTexture ? de.setTextureCube(e, 0) : e.isData3DTexture ? de.setTexture3D(e, 0) : e.isDataArrayTexture || e.isCompressedArrayTexture ? de.setTexture2DArray(e, 0) : de.setTexture2D(e, 0), se.unbindTexture()
|
|
}, this.resetState = function() {
|
|
x = 0, b = 0, E = null, se.reset(), Ie.reset()
|
|
}, "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", {
|
|
detail: this
|
|
}))
|
|
}
|
|
get coordinateSystem() {
|
|
return ht
|
|
}
|
|
get outputColorSpace() {
|
|
return this._outputColorSpace
|
|
}
|
|
set outputColorSpace(e) {
|
|
this._outputColorSpace = e;
|
|
const t = this.getContext();
|
|
t.drawingBufferColorspace = Ut._getDrawingBufferColorSpace(e), t.unpackColorSpace = Ut._getUnpackColorSpace()
|
|
}
|
|
}
|
|
var tm;
|
|
! function(e) {
|
|
e[e.ImperialUnitsEnabled = 0] = "ImperialUnitsEnabled", e[e.ResetHintEnabled = 1] = "ResetHintEnabled", e[e.GhostCarEnabled = 2] = "GhostCarEnabled", e[e.DefaultCameraMode = 3] = "DefaultCameraMode", e[e.CockpitCameraToggle = 4] = "CockpitCameraToggle", e[e.Checkpoints = 5] = "Checkpoints", e[e.Timer = 6] = "Timer", e[e.Speedometer = 7] = "Speedometer", e[e.Language = 8] = "Language", e[e.CarShadowQuality = 9] = "CarShadowQuality", e[e.TrackShadowEnabled = 10] = "TrackShadowEnabled", e[e.CloudsEnabled = 11] = "CloudsEnabled", e[e.ParticlesEnabled = 12] = "ParticlesEnabled", e[e.SkidmarksEnabled = 13] = "SkidmarksEnabled", e[e.RenderScale = 14] = "RenderScale", e[e.Antialiasing = 15] = "Antialiasing", e[e.SoundEffectVolume = 16] = "SoundEffectVolume", e[e.MusicVolume = 17] = "MusicVolume", e[e.CheckpointVolume = 18] = "CheckpointVolume"
|
|
}(tm || (tm = {}));
|
|
const nm = tm,
|
|
im = JSON.parse('{"rE":"0.5.0","l$":{"r":5,"M":4}}');
|
|
const rm = !1,
|
|
am = im.l$.r;
|
|
if (!Number.isSafeInteger(am) || am < 1) throw new Error("package.json beta version property must be a positive integer");
|
|
let sm = "";
|
|
im.rE;
|
|
const om = im.l$.M;
|
|
if (!Number.isSafeInteger(om) || om < 1) throw new Error("package.json beta physicsVersion property must be a positive integer");
|
|
var lm, cm, hm, um, dm, fm, pm, mm, gm, Am, _m, vm = function(e, t, n, i) {
|
|
return new(n || (n = Promise))((function(r, a) {
|
|
function s(e) {
|
|
try {
|
|
l(i.next(e))
|
|
} catch (e) {
|
|
a(e)
|
|
}
|
|
}
|
|
|
|
function o(e) {
|
|
try {
|
|
l(i.throw(e))
|
|
} catch (e) {
|
|
a(e)
|
|
}
|
|
}
|
|
|
|
function l(e) {
|
|
var t;
|
|
e.done ? r(e.value) : (t = e.value, t instanceof n ? t : new n((function(e) {
|
|
e(t)
|
|
}))).then(s, o)
|
|
}
|
|
l((i = i.apply(e, t || [])).next())
|
|
}))
|
|
},
|
|
wm = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
ym = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class xm {
|
|
constructor(e, t, n = !0, i = !1) {
|
|
var r;
|
|
lm.add(this), cm.set(this, void 0), hm.set(this, void 0), um.set(this, void 0), dm.set(this, void 0), fm.set(this, new cr), pm.set(this, void 0), mm.set(this, new Zt(8, 10, 10)), gm.set(this, []), wm(this, cm, e, "f"), wm(this, hm, t, "f"), wm(this, um, new em({
|
|
antialias: null === (r = null == t ? void 0 : t.getSettingBoolean(nm.Antialiasing)) || void 0 === r || r,
|
|
powerPreference: "high-performance",
|
|
canvas: e,
|
|
alpha: i
|
|
}), "f"), ym(this, um, "f").outputColorSpace = Ke, ym(this, um, "f").shadowMap.enabled = !0, ym(this, um, "f").debug.checkShaderErrors = rm, wm(this, dm, new _r, "f"), n && (ym(this, dm, "f").fog = new Ar(10211839, 0, xm.maxViewDistance)), ym(this, dm, "f").add(new ts(3891597, 11714755, 4.7)), wm(this, pm, new ms(16777215, 4.7), "f"), ym(this, pm, "f").position.copy(ym(this, mm, "f")), ym(this, pm, "f").castShadow = !0, ym(this, pm, "f").shadow.camera.top = 10, ym(this, pm, "f").shadow.camera.right = 10, ym(this, pm, "f").shadow.camera.bottom = -10, ym(this, pm, "f").shadow.camera.left = -10, ym(this, pm, "f").shadow.camera.near = 1, ym(this, pm, "f").shadow.camera.far = 50, ym(this, pm, "f").shadow.mapSize.width = 2048, ym(this, pm, "f").shadow.mapSize.height = 2048, ym(this, dm, "f").add(ym(this, pm, "f")), ym(this, dm, "f").add(ym(this, pm, "f").target), document.addEventListener("fullscreenchange", (() => {
|
|
ym(this, lm, "m", _m).call(this)
|
|
})), null != window.electron && window.electron.addFullscreenChangeListener((() => {
|
|
ym(this, lm, "m", _m).call(this)
|
|
}))
|
|
}
|
|
clear() {
|
|
ym(this, um, "f").clear()
|
|
}
|
|
update(e, t) {
|
|
var n, i, r;
|
|
const a = null !== (i = null === (n = ym(this, hm, "f")) || void 0 === n ? void 0 : n.getSettingInteger(nm.CarShadowQuality)) && void 0 !== i ? i : 0;
|
|
if (!Number.isFinite(a) || a <= 0) ym(this, pm, "f").castShadow = !1;
|
|
else {
|
|
ym(this, pm, "f").castShadow = !0;
|
|
const e = Math.min(a, ym(this, um, "f").capabilities.maxTextureSize);
|
|
ym(this, pm, "f").shadow.mapSize.width == e && ym(this, pm, "f").shadow.mapSize.height == e || (ym(this, pm, "f").shadow.mapSize.setScalar(e), null === (r = ym(this, pm, "f").shadow.map) || void 0 === r || r.dispose(), ym(this, pm, "f").shadow.map = null)
|
|
}
|
|
ym(this, mm, "f").copy(t.getSunPosition()), ym(this, pm, "f").position.addVectors(e, ym(this, mm, "f").multiplyScalar(12.5)), ym(this, pm, "f").target.position.copy(e), ym(this, lm, "m", Am).call(this), ym(this, um, "f").render(ym(this, dm, "f"), ym(this, fm, "f"))
|
|
}
|
|
getShadowDirection() {
|
|
return (new Zt).subVectors(ym(this, pm, "f").position, ym(this, pm, "f").target.position).normalize()
|
|
}
|
|
getLightTarget() {
|
|
return ym(this, pm, "f").target.position
|
|
}
|
|
getMaxAnisotropy() {
|
|
return ym(this, um, "f").capabilities.getMaxAnisotropy()
|
|
}
|
|
get isFullscreen() {
|
|
return null != window.electron ? window.electron.isFullscreen() : null != document.fullscreenElement
|
|
}
|
|
toggleFullscreen() {
|
|
return vm(this, void 0, void 0, (function*() {
|
|
this.isFullscreen ? null != window.electron ? window.electron.setFullscreen(!1) : yield document.exitFullscreen(): null != window.electron ? window.electron.setFullscreen(!0) : yield document.body.requestFullscreen()
|
|
}))
|
|
}
|
|
addFullscreenChangeListener(e) {
|
|
ym(this, gm, "f").push(e)
|
|
}
|
|
removeFullscreenChangeListener(e) {
|
|
const t = ym(this, gm, "f").indexOf(e);
|
|
t >= 0 && ym(this, gm, "f").splice(t, 1)
|
|
}
|
|
setCamera(e) {
|
|
wm(this, fm, e, "f")
|
|
}
|
|
get camera() {
|
|
return ym(this, fm, "f")
|
|
}
|
|
get canvas() {
|
|
return ym(this, cm, "f")
|
|
}
|
|
setAnimationLoop(e) {
|
|
ym(this, um, "f").setAnimationLoop(e)
|
|
}
|
|
get scene() {
|
|
return ym(this, dm, "f")
|
|
}
|
|
}
|
|
cm = new WeakMap, hm = new WeakMap, um = new WeakMap, dm = new WeakMap, fm = new WeakMap, pm = new WeakMap, mm = new WeakMap, gm = new WeakMap, lm = new WeakSet, Am = function() {
|
|
var e, t;
|
|
let n = null !== (t = null === (e = ym(this, hm, "f")) || void 0 === e ? void 0 : e.getSettingFloat(nm.RenderScale)) && void 0 !== t ? t : 1;
|
|
n = Number.isFinite(n) ? Math.min(Math.max(n, .25), 2) : 1;
|
|
const i = window.devicePixelRatio * n;
|
|
if (ym(this, um, "f").getPixelRatio() != i && ym(this, um, "f").setPixelRatio(i), ym(this, fm, "f") instanceof cr) {
|
|
const e = window.innerWidth / window.innerHeight,
|
|
t = new Et;
|
|
ym(this, um, "f").getSize(t), t.width == window.innerWidth && t.height == window.innerHeight && ym(this, fm, "f").aspect == e || (ym(this, um, "f").setSize(window.innerWidth, window.innerHeight), ym(this, fm, "f").aspect = e, ym(this, fm, "f").updateProjectionMatrix())
|
|
}
|
|
}, _m = function() {
|
|
for (const e of ym(this, gm, "f")) e()
|
|
}, xm.maxViewDistance = 1e4;
|
|
const bm = xm;
|
|
var Em, Sm, Mm, Tm, Cm, Im = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class Rm {
|
|
constructor() {
|
|
Em.add(this), Tm.set(this, new cr(Im(Sm, Sm, "f", Mm), 1, .5, bm.maxViewDistance))
|
|
}
|
|
reset(e, t, n) {
|
|
this.update(e, t, 0), Im(this, Tm, "f").fov = Im(this, Em, "m", Cm).call(this, null != n ? n : 0), Im(this, Tm, "f").updateProjectionMatrix()
|
|
}
|
|
update(e, t, n) {
|
|
Im(this, Tm, "f").fov = Im(this, Em, "m", Cm).call(this, n), Im(this, Tm, "f").updateProjectionMatrix();
|
|
const i = new Zt(0, 1.1, .4);
|
|
Im(this, Tm, "f").position.addVectors(e, i.applyQuaternion(t)), Im(this, Tm, "f").quaternion.copy(t), Im(this, Tm, "f").quaternion.multiply((new Kt).setFromEuler(new Fn(0, Math.PI, 0))), Im(this, Tm, "f").updateMatrix()
|
|
}
|
|
get camera() {
|
|
return Im(this, Tm, "f")
|
|
}
|
|
}
|
|
Sm = Rm, Tm = new WeakMap, Em = new WeakSet, Cm = function(e) {
|
|
const t = Math.min(1, Math.abs(e) / 400);
|
|
return Im(Sm, Sm, "f", Mm) + (80 - Im(Sm, Sm, "f", Mm)) * Math.pow(t, 1) / (Math.pow(t, 1) + Math.pow(1 - t, 1))
|
|
}, Mm = {
|
|
value: 70
|
|
};
|
|
const Pm = Rm;
|
|
class Bm {
|
|
constructor(e, t, n, i) {
|
|
this.primary = e, this.secondary = t, this.frame = n, this.rims = i
|
|
}
|
|
static random() {
|
|
const e = 360 * Math.random(),
|
|
t = 100 * (1 - Math.pow(Math.random(), 2)),
|
|
n = 100 * (.05 + .25 * (1 - Math.pow(Math.random(), 2)));
|
|
return new Bm(new wi("hsl(" + e.toString() + "," + t.toString() + "%," + n.toString() + "%)"), new wi("#ffffff"), new wi("#131313"), new wi("#666666"))
|
|
}
|
|
serialize() {
|
|
return this.primary.getHexString() + this.secondary.getHexString() + this.frame.getHexString() + this.rims.getHexString()
|
|
}
|
|
static deserialize(e) {
|
|
const t = [];
|
|
for (let n = 0; n < 4; n++) {
|
|
const i = e.substring(6 * n, 6 * (n + 1));
|
|
/^[0-9a-f]{6}$/i.test(i) ? t.push(new wi("#" + i)) : t.push(new wi("#555"))
|
|
}
|
|
return new Bm(t[0], t[1], t[2], t[3])
|
|
}
|
|
}
|
|
const Dm = Bm;
|
|
var Lm, Um, km, Nm, Fm, Om, zm, Wm = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
Hm = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class Vm {
|
|
constructor() {
|
|
Lm.add(this), Nm.set(this, new cr(Hm(Um, Um, "f", km), 1, .5, 1e4)), Fm.set(this, new Zt), Om.set(this, new Zt(0, 1, 0))
|
|
}
|
|
reset(e, t, n) {
|
|
Wm(this, Fm, new Zt(1e-5, 0, -1), "f"), Hm(this, Fm, "f").applyQuaternion(t), Hm(this, Fm, "f").add(e), Wm(this, Om, new Zt(0, 1, 0), "f"), Hm(this, Om, "f").applyQuaternion(t), this.update(0, e, t, 0), Hm(this, Nm, "f").fov = Hm(this, Lm, "m", zm).call(this, null != n ? n : 0), Hm(this, Nm, "f").updateProjectionMatrix()
|
|
}
|
|
update(e, t, n, i) {
|
|
Hm(this, Nm, "f").fov = Hm(this, Lm, "m", zm).call(this, i), Hm(this, Nm, "f").updateProjectionMatrix();
|
|
const r = new Zt(0, 1, 0);
|
|
r.applyQuaternion(n);
|
|
const a = Math.min(1, 5 * e);
|
|
Hm(this, Om, "f").set(a * r.x + (1 - a) * Hm(this, Om, "f").x, a * r.y + (1 - a) * Hm(this, Om, "f").y, a * r.z + (1 - a) * Hm(this, Om, "f").z);
|
|
const s = (new Zt).subVectors(t, Hm(this, Fm, "f"));
|
|
s.normalize();
|
|
const o = 5.5;
|
|
Hm(this, Nm, "f").position.x = t.x - s.x * o + 2 * Hm(this, Om, "f").x, Hm(this, Nm, "f").position.y = Math.max(.25, t.y - s.y * o + 2 * Hm(this, Om, "f").y), Hm(this, Nm, "f").position.z = t.z - s.z * o + 2 * Hm(this, Om, "f").z, Hm(this, Nm, "f").lookAt(t.x + 2 * Hm(this, Om, "f").x * .9, t.y + 2 * Hm(this, Om, "f").y * .9, t.z + 2 * Hm(this, Om, "f").z * .9), Hm(this, Nm, "f").updateMatrix(), Hm(this, Fm, "f").set(t.x - s.x * o, t.y - s.y * o, t.z - s.z * o)
|
|
}
|
|
get camera() {
|
|
return Hm(this, Nm, "f")
|
|
}
|
|
}
|
|
Um = Vm, Nm = new WeakMap, Fm = new WeakMap, Om = new WeakMap, Lm = new WeakSet, zm = function(e) {
|
|
const t = Math.abs(e) / 400;
|
|
return Hm(Um, Um, "f", km) + (100 - Hm(Um, Um, "f", km)) * Math.pow(t, 1) / (Math.pow(t, 1) + Math.pow(1 - t, 1))
|
|
}, km = {
|
|
value: 70
|
|
};
|
|
const Gm = Vm;
|
|
var Qm, Xm, jm, qm, Ym, Km, Zm, Jm, $m = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
eg = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class tg {
|
|
constructor(e) {
|
|
Xm.set(this, void 0), jm.set(this, void 0), qm.set(this, []), Ym.set(this, 256), Km.set(this, new Zt(0, 1, 0)), $m(this, Xm, e, "f"), $m(this, jm, new Qr(eg(Qm, Qm, "f", Zm), eg(Qm, Qm, "f", Jm), eg(this, Ym, "f")), "f"), eg(this, jm, "f").frustumCulled = !1, e.scene.add(eg(this, jm, "f")), this.clear()
|
|
}
|
|
dispose() {
|
|
eg(this, jm, "f").dispose(), eg(this, Xm, "f").scene.remove(eg(this, jm, "f"))
|
|
}
|
|
clear() {
|
|
eg(this, qm, "f").length = 0, eg(this, jm, "f").count = 0, eg(this, jm, "f").instanceMatrix.needsUpdate = !0
|
|
}
|
|
spawn(e, t, n) {
|
|
eg(this, qm, "f").push({
|
|
x: e + .25 * (Math.random() - .5),
|
|
y: t + .25 * (Math.random() - .5),
|
|
z: n + .25 * (Math.random() - .5),
|
|
vx: .5 * (Math.random() - .5),
|
|
vy: .5 * (Math.random() - .5),
|
|
vz: .5 * (Math.random() - .5),
|
|
rotation: Math.random() * Math.PI * 2,
|
|
lifetime: .5
|
|
})
|
|
}
|
|
update(e) {
|
|
for (let t = eg(this, qm, "f").length - 1; t >= 0; --t) {
|
|
const n = eg(this, qm, "f")[t];
|
|
n.vy += 15 * e, n.x += n.vx * e, n.y += n.vy * e, n.z += n.vz * e, n.lifetime -= e, n.lifetime <= 0 && eg(this, qm, "f").splice(t, 1)
|
|
}
|
|
let t = !1;
|
|
eg(this, jm, "f").count != eg(this, qm, "f").length && (eg(this, jm, "f").count = Math.min(eg(this, qm, "f").length, eg(this, Ym, "f")), t = !0);
|
|
for (let e = 0; e < eg(this, jm, "f").count; ++e) {
|
|
const t = eg(this, qm, "f")[eg(this, qm, "f").length - 1 - e],
|
|
n = new Cn;
|
|
n.lookAt(new Zt(t.x, t.y, t.z), eg(this, Xm, "f").camera.position, eg(this, Km, "f")), n.setPosition(t.x, t.y, t.z), n.multiply((new Cn).makeRotationZ(t.rotation));
|
|
const i = .5 + 2 * (.5 - t.lifetime);
|
|
n.scale(new Zt(i, i, i)), eg(this, jm, "f").setMatrixAt(e, n)
|
|
}(t || eg(this, qm, "f").length > 0) && (eg(this, jm, "f").instanceMatrix.needsUpdate = !0)
|
|
}
|
|
static initResources(e) {
|
|
e.addResource();
|
|
const t = (new $a).load("images/smoke.png", (() => {
|
|
e.loadedResource()
|
|
}));
|
|
eg(this, Qm, "f", Jm).map = t
|
|
}
|
|
}
|
|
Qm = tg, Xm = new WeakMap, jm = new WeakMap, qm = new WeakMap, Ym = new WeakMap, Km = new WeakMap, Zm = {
|
|
value: (() => {
|
|
const e = new ya;
|
|
return e.rotateX(Math.PI), e
|
|
})()
|
|
}, Jm = {
|
|
value: new Ei({
|
|
opacity: .3,
|
|
depthWrite: !1,
|
|
transparent: !0
|
|
})
|
|
};
|
|
const ng = tg;
|
|
var ig, rg, ag, sg, og, lg, cg, hg, ug, dg, fg, pg, mg, gg, Ag = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
_g = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class vg {
|
|
constructor(e, t, n) {
|
|
ig.add(this), ag.set(this, void 0), sg.set(this, void 0), og.set(this, void 0), lg.set(this, void 0), cg.set(this, void 0), hg.set(this, void 0), ug.set(this, 1e3), dg.set(this, 0), fg.set(this, null), pg.set(this, null), Ag(this, ag, e, "f"), Ag(this, sg, t, "f"), Ag(this, og, n, "f");
|
|
const i = new Oi;
|
|
Ag(this, cg, new Float32Array(6 * _g(this, ug, "f") * 3), "f"), Ag(this, hg, new Ci(_g(this, cg, "f"), 3), "f"), i.setAttribute("position", _g(this, hg, "f")), Ag(this, lg, new Zi(i, _g(rg, rg, "f", mg)), "f"), _g(this, lg, "f").frustumCulled = !1, _g(this, ag, "f").scene.add(_g(this, lg, "f"))
|
|
}
|
|
dispose() {
|
|
_g(this, lg, "f").geometry.dispose(), _g(this, ag, "f").scene.remove(_g(this, lg, "f"))
|
|
}
|
|
clear() {
|
|
for (let e = 0; e < _g(this, cg, "f").length; ++e) _g(this, cg, "f")[e] = 0;
|
|
_g(this, hg, "f").needsUpdate = !0, Ag(this, dg, 0, "f"), this.break()
|
|
}
|
|
break () {
|
|
Ag(this, fg, null, "f"), Ag(this, pg, null, "f")
|
|
}
|
|
spawn(e, t, n, i) {
|
|
var r, a;
|
|
const s = _g(this, fg, "f"),
|
|
o = _g(this, pg, "f");
|
|
let l = new Zt(e, t, n).add(new Zt(.172, -.3, 0).applyQuaternion(i)),
|
|
c = new Zt(e, t, n).add(new Zt(-.172, -.3, 0).applyQuaternion(i));
|
|
const h = new Zt(0, -1, 0).applyQuaternion(i),
|
|
u = _g(this, ig, "m", gg).call(this, l, h, 0, .05),
|
|
d = _g(this, ig, "m", gg).call(this, c, h, 0, .05);
|
|
if (null != u && null != d) {
|
|
if (l = u.point, c = d.point, null != s && null != o) {
|
|
const e = (Ag(this, dg, (a = _g(this, dg, "f"), r = a++, a), "f"), r);
|
|
_g(this, cg, "f")[6 * e * 3 + 0] = l.x, _g(this, cg, "f")[6 * e * 3 + 1] = l.y, _g(this, cg, "f")[6 * e * 3 + 2] = l.z, _g(this, cg, "f")[6 * e * 3 + 3] = s.x, _g(this, cg, "f")[6 * e * 3 + 4] = s.y, _g(this, cg, "f")[6 * e * 3 + 5] = s.z, _g(this, cg, "f")[6 * e * 3 + 6] = c.x, _g(this, cg, "f")[6 * e * 3 + 7] = c.y, _g(this, cg, "f")[6 * e * 3 + 8] = c.z, _g(this, cg, "f")[6 * e * 3 + 9] = c.x, _g(this, cg, "f")[6 * e * 3 + 10] = c.y, _g(this, cg, "f")[6 * e * 3 + 11] = c.z, _g(this, cg, "f")[6 * e * 3 + 12] = s.x, _g(this, cg, "f")[6 * e * 3 + 13] = s.y, _g(this, cg, "f")[6 * e * 3 + 14] = s.z, _g(this, cg, "f")[6 * e * 3 + 15] = o.x, _g(this, cg, "f")[6 * e * 3 + 16] = o.y, _g(this, cg, "f")[6 * e * 3 + 17] = o.z, _g(this, hg, "f").needsUpdate = !0, _g(this, dg, "f") >= _g(this, ug, "f") - 1 && Ag(this, dg, 0, "f")
|
|
}
|
|
Ag(this, fg, l, "f"), Ag(this, pg, c, "f")
|
|
} else this.break()
|
|
}
|
|
}
|
|
rg = vg, ag = new WeakMap, sg = new WeakMap, og = new WeakMap, lg = new WeakMap, cg = new WeakMap, hg = new WeakMap, ug = new WeakMap, dg = new WeakMap, fg = new WeakMap, pg = new WeakMap, ig = new WeakSet, gg = function(e, t, n, i) {
|
|
const r = new Ts(e, t, n, i),
|
|
a = _g(this, og, "f").shortRaycast(r);
|
|
if (null != a) return a;
|
|
const s = _g(this, sg, "f").raycast(r);
|
|
return null != s ? s : null
|
|
}, mg = {
|
|
value: new Ei({
|
|
color: 1118481,
|
|
side: 2,
|
|
polygonOffset: !0,
|
|
polygonOffsetFactor: -1,
|
|
polygonOffsetUnits: 0
|
|
})
|
|
};
|
|
const wg = vg;
|
|
var yg, xg, bg, Eg, Sg, Mg, Tg, Cg, Ig, Rg, Pg, Bg, Dg, Lg, Ug, kg, Ng, Fg, Og, zg, Wg, Hg, Vg, Gg, Qg, Xg, jg, qg, Yg, Kg, Zg, Jg, $g, eA, tA, nA, iA, rA, aA, sA, oA, lA, cA, hA, uA, dA, fA, pA, mA, gA, AA, _A, vA, wA, yA, xA, bA, EA, SA, MA, TA = function(e, t, n, i) {
|
|
return new(n || (n = Promise))((function(r, a) {
|
|
function s(e) {
|
|
try {
|
|
l(i.next(e))
|
|
} catch (e) {
|
|
a(e)
|
|
}
|
|
}
|
|
|
|
function o(e) {
|
|
try {
|
|
l(i.throw(e))
|
|
} catch (e) {
|
|
a(e)
|
|
}
|
|
}
|
|
|
|
function l(e) {
|
|
var t;
|
|
e.done ? r(e.value) : (t = e.value, t instanceof n ? t : new n((function(e) {
|
|
e(t)
|
|
}))).then(s, o)
|
|
}
|
|
l((i = i.apply(e, t || [])).next())
|
|
}))
|
|
},
|
|
CA = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
IA = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class RA {
|
|
constructor(e, t, n, i, r, a, s, o, l) {
|
|
var c;
|
|
if (yg.add(this), bg.set(this, void 0), Eg.set(this, null), Sg.set(this, 1), Mg.set(this, null), Tg.set(this, []), Cg.set(this, null), Ig.set(this, null), Rg.set(this, null), Pg.set(this, []), this.notificationAudioEnabled = !1, Bg.set(this, void 0), Dg.set(this, void 0), Lg.set(this, void 0), Ug.set(this, !1), kg.set(this, void 0), Ng.set(this, void 0), Fg.set(this, void 0), Og.set(this, void 0), zg.set(this, []), Wg.set(this, []), Hg.set(this, []), Vg.set(this, [0, 0, 0, 0]), Gg.set(this, [0, 0, 0, 0]), Qg.set(this, [0, 0, 0, 0]), Xg.set(this, void 0), jg.set(this, void 0), qg.set(this, null), Yg.set(this, null), Kg.set(this, []), Zg.set(this, null), Jg.set(this, void 0), $g.set(this, void 0), eA.set(this, void 0), tA.set(this, void 0), nA.set(this, void 0), iA.set(this, void 0), rA.set(this, void 0), aA.set(this, []), sA.set(this, null), oA.set(this, [.075, .075, .075, .075]), lA.set(this, void 0), cA.set(this, null), hA.set(this, !1), CA(this, bg, a, "f"), CA(this, Xg, r, "f"), CA(this, nA, s, "f"), CA(this, iA, o, "f"), CA(this, rA, l, "f"), CA(this, Lg, e, "f"), (null == l ? void 0 : l.getSettingBoolean(nm.ParticlesEnabled)) ? CA(this, lA, new ng(r), "f") : CA(this, lA, null, "f"), null != IA(this, nA, "f") && null != IA(this, iA, "f") && CA(this, aA, [new wg(IA(this, Xg, "f"), IA(this, nA, "f"), IA(this, iA, "f")), new wg(IA(this, Xg, "f"), IA(this, nA, "f"), IA(this, iA, "f")), new wg(IA(this, Xg, "f"), IA(this, nA, "f"), IA(this, iA, "f")), new wg(IA(this, Xg, "f"), IA(this, nA, "f"), IA(this, iA, "f"))], "f"), CA(this, Bg, new Gm, "f"), IA(this, Bg, "f").reset(t.position, t.quaternion), r.scene.add(IA(this, Bg, "f").camera), CA(this, Dg, new Pm, "f"), IA(this, Dg, "f").reset(t.position, t.quaternion), r.scene.add(IA(this, Dg, "f").camera), null == xg.models) throw new Error("Car model isn't loaded yet");
|
|
if (null != IA(this, Lg, "f") && null != IA(this, nA, "f") && null != IA(this, iA, "f")) CA(this, kg, IA(this, Lg, "f").createCar(t, IA(this, nA, "f").getMountainVertices(), IA(this, nA, "f").getMountainOffset(), IA(this, iA, "f").getTrackData(), n, (e => {
|
|
this.setCarState(e)
|
|
})), "f");
|
|
else {
|
|
const e = [new Zt(.627909, .27 - xg.suspensionResetLengthFront, 1.3478).applyQuaternion(t.quaternion).add(t.position), new Zt(-.627909, .27 - xg.suspensionResetLengthFront, 1.3478).applyQuaternion(t.quaternion).add(t.position), new Zt(.720832, .27 - xg.suspensionResetLengthRear, -1.52686).applyQuaternion(t.quaternion).add(t.position), new Zt(-.720832, .27 - xg.suspensionResetLengthRear, -1.52686).applyQuaternion(t.quaternion).add(t.position)],
|
|
n = [(new Kt).setFromEuler((new Fn).set(0, Math.PI, 0)).multiply(t.quaternion), (new Kt).setFromEuler((new Fn).set(0, Math.PI, 0)).multiply(t.quaternion), (new Kt).setFromEuler((new Fn).set(0, Math.PI, 0)).multiply(t.quaternion), (new Kt).setFromEuler((new Fn).set(0, Math.PI, 0)).multiply(t.quaternion)];
|
|
CA(this, kg, {
|
|
id: 0,
|
|
frames: 0,
|
|
speedKmh: 0,
|
|
hasStarted: !1,
|
|
finishFrames: null,
|
|
nextCheckpointIndex: 0,
|
|
hasCheckpointToRespawnAt: !1,
|
|
position: {
|
|
x: t.position.x,
|
|
y: t.position.y,
|
|
z: t.position.z
|
|
},
|
|
quaternion: {
|
|
x: t.quaternion.x,
|
|
y: t.quaternion.y,
|
|
z: t.quaternion.z,
|
|
w: t.quaternion.w
|
|
},
|
|
collisionImpulses: [],
|
|
wheelInContact: [!1, !1, !1, !1],
|
|
wheelSuspensionLength: [xg.suspensionResetLengthFront, xg.suspensionResetLengthFront, xg.suspensionResetLengthRear, xg.suspensionResetLengthRear],
|
|
wheelSuspensionVelocity: [0, 0, 0, 0],
|
|
wheelRotation: [0, 0, 0, 0],
|
|
wheelDeltaRotation: [0, 0, 0, 0],
|
|
wheelSkidInfo: [0, 0, 0, 0],
|
|
wheelPosition: e,
|
|
wheelQuaternion: n,
|
|
brakeLightEnabled: !1,
|
|
controls: {
|
|
up: !1,
|
|
right: !1,
|
|
down: !1,
|
|
left: !1,
|
|
reset: !1
|
|
}
|
|
}, "f")
|
|
}
|
|
if (CA(this, Ng, i, "f"), null == n) CA(this, Fg, null != IA(this, Ng, "f"), "f"), CA(this, Og, new Ch, "f");
|
|
else {
|
|
if (null != IA(this, Ng, "f")) throw new Error("Can't control car when recording is set");
|
|
CA(this, Fg, !1, "f"), CA(this, Og, n, "f")
|
|
}
|
|
CA(this, jg, new pr, "f"), IA(this, jg, "f").add(xg.models.chassis.clone()), IA(this, jg, "f").add(xg.models.suspension.clone()), IA(this, jg, "f").add(xg.models.wheelFL.clone()), IA(this, jg, "f").add(xg.models.wheelFR.clone()), IA(this, jg, "f").add(xg.models.wheelBL.clone()), IA(this, jg, "f").add(xg.models.wheelBR.clone());
|
|
for (const e of IA(this, jg, "f").children) {
|
|
const t = e;
|
|
Array.isArray(t.material) ? t.material = t.material.map((e => e.clone())) : t.material = t.material.clone(), t.castShadow = !0, t.receiveShadow = !0, t.frustumCulled = !1
|
|
}
|
|
IA(this, Xg, "f").scene.add(IA(this, jg, "f")), CA(this, qg, IA(this, jg, "f").getObjectByName("Body"), "f"), CA(this, Yg, IA(this, jg, "f").getObjectByName("Suspension"), "f");
|
|
{
|
|
const e = document.createElement("canvas");
|
|
e.width = 2048, e.height = 2048;
|
|
const t = e.getContext("2d");
|
|
if (null == t) throw new Error("Failed to get context for car texture");
|
|
const n = new Gt(e);
|
|
let i;
|
|
n.flipY = !1, n.anisotropy = IA(this, Xg, "f").getMaxAnisotropy(), n.needsUpdate = !0, CA(this, Jg, t, "f"), CA(this, $g, n, "f"), CA(this, tA, Dm.random(), "f"), IA(this, yg, "m", dA).call(this), CA(this, eA, {
|
|
value: new Zt(0, 0, 0)
|
|
}, "f"), i = Array.isArray(IA(this, qg, "f").material) ? IA(this, qg, "f").material : [IA(this, qg, "f").material];
|
|
for (const e of i) "Main" == e.name ? e.onBeforeCompile = e => {
|
|
e.fragmentShader = "uniform sampler2D carColorPattern;\nuniform vec3 carColorSecondary;\n" + e.fragmentShader, e.fragmentShader = e.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );", "float colorSource = texture(carColorPattern, vUv).a;\nvec4 diffuseColor = vec4( carColorSecondary * colorSource + diffuse * (1.0 - colorSource), opacity );"), e.uniforms.carColorPattern = {
|
|
value: n
|
|
}, e.uniforms.carColorSecondary = IA(this, eA, "f"), null == e.defines && (e.defines = {}), e.defines.USE_UV = !0
|
|
} : "Metal" == e.name ? e.needsUpdate = !0 : "BrakeLight" == e.name && CA(this, Zg, e, "f")
|
|
}
|
|
IA(this, Yg, "f").geometry.morphAttributes.position = [];
|
|
const h = IA(this, Yg, "f"),
|
|
u = xg.models.suspensionFL,
|
|
d = xg.models.suspensionFR,
|
|
f = xg.models.suspensionBL,
|
|
p = xg.models.suspensionBR;
|
|
for (const e of IA(this, jg, "f").children)
|
|
if (e != IA(this, qg, "f") && e != IA(this, Yg, "f")) {
|
|
const t = e;
|
|
if (!(u.geometry.attributes.position instanceof Ci && d.geometry.attributes.position instanceof Ci && f.geometry.attributes.position instanceof Ci && p.geometry.attributes.position instanceof Ci)) throw new Error("Vertices must use BufferAttribute");
|
|
const n = u.geometry.attributes.position.array,
|
|
i = d.geometry.attributes.position.array,
|
|
r = f.geometry.attributes.position.array,
|
|
a = p.geometry.attributes.position.array,
|
|
s = h.geometry.morphAttributes.position;
|
|
if ("WheelFL" == t.name) s.push(new Ci(n, 3));
|
|
else if ("WheelFR" == t.name) s.push(new Ci(i, 3));
|
|
else if ("WheelBL" == t.name) s.push(new Ci(r, 3));
|
|
else {
|
|
if ("WheelBR" != t.name) throw new Error("Unidentified wheel");
|
|
s.push(new Ci(a, 3))
|
|
}
|
|
IA(this, Kg, "f").push(t)
|
|
} IA(this, Yg, "f").updateMorphTargets(), null != IA(this, Ng, "f") && (null === (c = IA(this, Lg, "f")) || void 0 === c || c.controlCar(IA(this, kg, "f").id, IA(this, Ng, "f").up, IA(this, Ng, "f").right, IA(this, Ng, "f").down, IA(this, Ng, "f").left, IA(this, Ng, "f").reset), IA(this, Ng, "f").addChangeCallback(CA(this, cA, (e => {
|
|
var t;
|
|
null === (t = IA(this, Lg, "f")) || void 0 === t || t.controlCar(IA(this, kg, "f").id, e.up, e.right, e.down, e.left, e.reset)
|
|
}), "f")))
|
|
}
|
|
dispose() {
|
|
var e, t, n;
|
|
CA(this, hA, !0, "f"), IA(this, yg, "m", uA).call(this), IA(this, Xg, "f").scene.remove(IA(this, Bg, "f").camera), IA(this, Xg, "f").scene.remove(IA(this, Dg, "f").camera), null === (e = IA(this, lA, "f")) || void 0 === e || e.dispose();
|
|
for (const e of IA(this, aA, "f")) e.dispose();
|
|
IA(this, aA, "f").length = 0, IA(this, Xg, "f").scene.remove(IA(this, jg, "f")), IA(this, $g, "f").dispose(), null === (t = IA(this, Lg, "f")) || void 0 === t || t.deleteCar(IA(this, kg, "f").id), null != IA(this, cA, "f") && (null === (n = IA(this, Ng, "f")) || void 0 === n || n.removeChangeCallback(IA(this, cA, "f")))
|
|
}
|
|
addResetCallback(e) {
|
|
IA(this, zg, "f").push(e)
|
|
}
|
|
addCheckpointCallback(e) {
|
|
IA(this, Wg, "f").push(e)
|
|
}
|
|
addFinishCallback(e) {
|
|
IA(this, Hg, "f").push(e)
|
|
}
|
|
getChassisMatrix() {
|
|
return null != IA(this, qg, "f") ? IA(this, qg, "f").matrix : null
|
|
}
|
|
getSpeedKmh() {
|
|
return IA(this, kg, "f").speedKmh
|
|
}
|
|
start() {
|
|
var e;
|
|
null === (e = IA(this, Lg, "f")) || void 0 === e || e.startCar(IA(this, kg, "f").id, null)
|
|
}
|
|
hasStarted() {
|
|
return IA(this, kg, "f").hasStarted
|
|
}
|
|
hasFinished() {
|
|
return null != IA(this, kg, "f").finishFrames
|
|
}
|
|
getFinishTime() {
|
|
return null == IA(this, kg, "f").finishFrames ? null : new Kh(IA(this, kg, "f").finishFrames)
|
|
}
|
|
getRecording() {
|
|
return IA(this, Og, "f")
|
|
}
|
|
getTime() {
|
|
return new Kh(IA(this, kg, "f").frames)
|
|
}
|
|
getNextCheckpointIndex() {
|
|
return IA(this, kg, "f").nextCheckpointIndex
|
|
}
|
|
hasCheckpointToRespawnAt() {
|
|
return IA(this, kg, "f").hasCheckpointToRespawnAt
|
|
}
|
|
getPosition() {
|
|
return new Zt(IA(this, kg, "f").position.x, IA(this, kg, "f").position.y, IA(this, kg, "f").position.z)
|
|
}
|
|
getQuaternion() {
|
|
return new Kt(IA(this, kg, "f").quaternion.x, IA(this, kg, "f").quaternion.y, IA(this, kg, "f").quaternion.z, IA(this, kg, "f").quaternion.w)
|
|
}
|
|
getMatrix4() {
|
|
const e = this.getPosition(),
|
|
t = this.getQuaternion(),
|
|
n = (new Cn).makeRotationFromQuaternion(t);
|
|
return n.setPosition(e), n
|
|
}
|
|
get isPaused() {
|
|
return IA(this, Ug, "f")
|
|
}
|
|
set isPaused(e) {
|
|
var t;
|
|
IA(this, Ug, "f") != e && (null === (t = IA(this, Lg, "f")) || void 0 === t || t.pauseCar(IA(this, kg, "f").id, e), CA(this, Ug, e, "f"))
|
|
}
|
|
getControls() {
|
|
return null != IA(this, Ng, "f") ? IA(this, Ng, "f").getControls() : IA(this, kg, "f").controls
|
|
}
|
|
getColors() {
|
|
return IA(this, tA, "f")
|
|
}
|
|
setColors(e) {
|
|
if (IA(this, eA, "f").value = (new Zt).setFromColor(e.secondary), null != IA(this, qg, "f") && Array.isArray(IA(this, qg, "f").material))
|
|
for (const t of IA(this, qg, "f").material) "Main" == t.name ? t.color.set(e.primary) : "Metal" == t.name && t.color.set(e.frame);
|
|
if (null != IA(this, Yg, "f") && !Array.isArray(IA(this, Yg, "f").material)) {
|
|
const t = IA(this, Yg, "f").material;
|
|
"Metal" == t.name && t.color.set(e.frame)
|
|
}
|
|
for (const t of IA(this, Kg, "f"))
|
|
if (Array.isArray(t.material))
|
|
for (const n of t.material) "Metal" == n.name ? n.color.set(e.frame) : "Rim" == n.name && n.color.set(e.rims);
|
|
CA(this, tA, e, "f")
|
|
}
|
|
setOpacity(e) {
|
|
for (const t of IA(this, jg, "f").children) {
|
|
const n = t;
|
|
let i;
|
|
i = Array.isArray(n.material) ? n.material : [n.material];
|
|
for (const t of i) {
|
|
t.opacity = e;
|
|
const n = e < 1;
|
|
t.needsUpdate = n != t.transparent, t.transparent = n
|
|
}
|
|
}
|
|
}
|
|
setVisible(e) {
|
|
IA(this, jg, "f").visible = e
|
|
}
|
|
setCarState(e) {
|
|
var t;
|
|
if (IA(this, hA, "f")) return;
|
|
const n = IA(this, kg, "f");
|
|
CA(this, kg, e, "f");
|
|
const i = IA(this, kg, "f").frames != n.frames && IA(this, kg, "f").frames != n.frames + 1;
|
|
if (IA(this, kg, "f").nextCheckpointIndex > n.nextCheckpointIndex) {
|
|
this.notificationAudioEnabled && IA(this, yg, "m", pA).call(this);
|
|
for (const e of IA(this, Wg, "f")) e(n.nextCheckpointIndex)
|
|
}
|
|
if (null != IA(this, kg, "f").finishFrames && null == n.finishFrames) {
|
|
this.notificationAudioEnabled && IA(this, yg, "m", mA).call(this);
|
|
for (const e of IA(this, Hg, "f")) e(this)
|
|
}
|
|
const r = .001;
|
|
if (i) {
|
|
null === (t = IA(this, lA, "f")) || void 0 === t || t.clear();
|
|
for (const e of IA(this, aA, "f")) e.clear()
|
|
}
|
|
if (this.getTime().numberOfFrames % 10 == 0 && IA(this, yg, "m", gA).call(this, .01), i || !n.controls.reset && IA(this, kg, "f").controls.reset) {
|
|
IA(this, Bg, "f").reset(this.getPosition(), this.getQuaternion(), this.getSpeedKmh()), IA(this, Dg, "f").reset(this.getPosition(), this.getQuaternion(), this.getSpeedKmh());
|
|
for (const e of IA(this, zg, "f")) e()
|
|
}
|
|
IA(this, yg, "m", vA).call(this, r), IA(this, yg, "m", yA).call(this, r), IA(this, Fg, "f") && IA(this, kg, "f").hasStarted && null == n.finishFrames && IA(this, Og, "f").recordFrame(n.frames, IA(this, kg, "f").controls)
|
|
}
|
|
update(e) {
|
|
var t, n;
|
|
if (null != IA(this, qg, "f") && null != IA(this, Yg, "f")) {
|
|
IA(this, yg, "m", AA).call(this), null === (t = IA(this, lA, "f")) || void 0 === t || t.update(e);
|
|
const i = this.getMatrix4(),
|
|
r = this.getQuaternion();
|
|
IA(this, qg, "f").matrixAutoUpdate = !1, IA(this, qg, "f").matrix.copy(i), IA(this, qg, "f").matrix.multiply((new Cn).makeTranslation(0, xg.massOffset, 0)), IA(this, Yg, "f").matrixAutoUpdate = !1, IA(this, Yg, "f").matrix.copy(IA(this, qg, "f").matrix);
|
|
const a = 4;
|
|
for (let t = 0; t < a; t++) {
|
|
const i = IA(this, kg, "f").wheelInContact[t],
|
|
a = IA(this, kg, "f").wheelDeltaRotation[t];
|
|
if (this.hasStarted()) {
|
|
if (i) IA(this, Vg, "f")[t] = 1e3 * a, IA(this, Gg, "f")[t] = 1e3 * a;
|
|
else {
|
|
const {
|
|
up: n,
|
|
down: i
|
|
} = this.getControls(), r = 2 == t || 3 == t;
|
|
i ? IA(this, kg, "f").brakeLightEnabled ? IA(this, Gg, "f")[t] > 0 ? IA(this, Gg, "f")[t] = Math.max(0, IA(this, Gg, "f")[t] - 50 * e) : IA(this, Gg, "f")[t] < 0 && (IA(this, Gg, "f")[t] = Math.min(0, IA(this, Gg, "f")[t] + 50 * e)) : r && (IA(this, Vg, "f")[t] -= 25 * e, IA(this, Gg, "f")[t] -= 25 * e) : n && r && (IA(this, Vg, "f")[t] += 25 * e, IA(this, Gg, "f")[t] += 50 * e), IA(this, Vg, "f")[t] *= Math.max(0, 1 - e), IA(this, Gg, "f")[t] *= Math.max(0, 1 - e)
|
|
}
|
|
IA(this, Qg, "f")[t] += IA(this, Gg, "f")[t] * e
|
|
}
|
|
const s = IA(this, kg, "f").wheelPosition[t],
|
|
o = new Kt(IA(this, kg, "f").wheelQuaternion[t].x, IA(this, kg, "f").wheelQuaternion[t].y, IA(this, kg, "f").wheelQuaternion[t].z, IA(this, kg, "f").wheelQuaternion[t].w),
|
|
l = IA(this, kg, "f").wheelRotation[t];
|
|
o.multiply((new Kt).setFromAxisAngle(new Zt(-1, 0, 0), IA(this, Qg, "f")[t] - l)), IA(this, Kg, "f")[t].position.set(s.x, s.y, s.z), IA(this, Kg, "f")[t].quaternion.set(o.x, o.y, o.z, o.w);
|
|
const c = IA(this, kg, "f").wheelSuspensionLength[t],
|
|
h = IA(this, kg, "f").wheelSkidInfo[t];
|
|
IA(this, Yg, "f").morphTargetInfluences || (IA(this, Yg, "f").morphTargetInfluences = []), IA(this, Yg, "f").morphTargetInfluences[t] = 2 * c + .06, e > 0 && (null === (n = IA(this, rA, "f")) || void 0 === n ? void 0 : n.getSettingBoolean(nm.SkidmarksEnabled)) && t < IA(this, aA, "f").length && i && a > .06 && h < .5 && 0 == IA(this, oA, "f")[t] && IA(this, aA, "f")[t].spawn(s.x, s.y, s.z, r)
|
|
}
|
|
IA(this, yg, "m", EA).call(this, IA(this, kg, "f").brakeLightEnabled)
|
|
}
|
|
}
|
|
updateCameras(e) {
|
|
if (null == IA(this, kg, "f").finishFrames) {
|
|
const t = this.getPosition(),
|
|
n = this.getQuaternion(),
|
|
i = this.getSpeedKmh();
|
|
IA(this, Bg, "f").update(e, t, n, i), IA(this, Dg, "f").update(t, n, i)
|
|
}
|
|
}
|
|
get cameraOrbit() {
|
|
return IA(this, Bg, "f").camera
|
|
}
|
|
get cameraCockpit() {
|
|
return IA(this, Dg, "f").camera
|
|
}
|
|
set audioVolume(e) {
|
|
CA(this, Sg, e, "f"), null != IA(this, Eg, "f") && IA(this, Eg, "f").gain.setTargetAtTime(IA(this, Sg, "f"), 0, .01)
|
|
}
|
|
static initResources() {
|
|
return TA(this, void 0, void 0, (function*() {
|
|
const e = yield new Promise(((e, t) => {
|
|
(new wu).load("models/car.glb", (n => {
|
|
function i(e) {
|
|
const t = n.scene.getObjectByName(e);
|
|
if (null == t) throw new Error('Mesh "' + e + '" does not exist');
|
|
if (0 == t.children.length) {
|
|
const e = t;
|
|
return e.updateMatrixWorld(!0), e.geometry.applyMatrix4(e.matrix.clone()), e.matrix.identity(), e
|
|
}
|
|
const i = function(e, t = !1) {
|
|
const n = null !== e[0].index,
|
|
i = new Set(Object.keys(e[0].attributes)),
|
|
r = new Set(Object.keys(e[0].morphAttributes)),
|
|
a = {},
|
|
s = {},
|
|
o = e[0].morphTargetsRelative,
|
|
l = new Oi;
|
|
let c = 0;
|
|
for (let h = 0; h < e.length; ++h) {
|
|
const u = e[h];
|
|
let d = 0;
|
|
if (n !== (null !== u.index)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
|
|
for (const e in u.attributes) {
|
|
if (!i.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + '. All geometries must have compatible attributes; make sure "' + e + '" attribute exists among all geometries, or in none of them.'), null;
|
|
void 0 === a[e] && (a[e] = []), a[e].push(u.attributes[e]), d++
|
|
}
|
|
if (d !== i.size) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". Make sure all geometries have the same number of attributes."), null;
|
|
if (o !== u.morphTargetsRelative) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
|
|
for (const e in u.morphAttributes) {
|
|
if (!r.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". .morphAttributes must be consistent throughout all geometries."), null;
|
|
void 0 === s[e] && (s[e] = []), s[e].push(u.morphAttributes[e])
|
|
}
|
|
if (t) {
|
|
let e;
|
|
if (n) e = u.index.count;
|
|
else {
|
|
if (void 0 === u.attributes.position) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + h + ". The geometry must have either an index or a position attribute"), null;
|
|
e = u.attributes.position.count
|
|
}
|
|
l.addGroup(c, e, h), c += e
|
|
}
|
|
}
|
|
if (n) {
|
|
let t = 0;
|
|
const n = [];
|
|
for (let i = 0; i < e.length; ++i) {
|
|
const r = e[i].index;
|
|
for (let e = 0; e < r.count; ++e) n.push(r.getX(e) + t);
|
|
t += e[i].attributes.position.count
|
|
}
|
|
l.setIndex(n)
|
|
}
|
|
for (const e in a) {
|
|
const t = _u(a[e]);
|
|
if (!t) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " attribute."), null;
|
|
l.setAttribute(e, t)
|
|
}
|
|
for (const e in s) {
|
|
const t = s[e][0].length;
|
|
if (0 === t) break;
|
|
l.morphAttributes = l.morphAttributes || {}, l.morphAttributes[e] = [];
|
|
for (let n = 0; n < t; ++n) {
|
|
const t = [];
|
|
for (let i = 0; i < s[e].length; ++i) t.push(s[e][i][n]);
|
|
const i = _u(t);
|
|
if (!i) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " morphAttribute."), null;
|
|
l.morphAttributes[e].push(i)
|
|
}
|
|
}
|
|
return l
|
|
}(t.children.map((e => e.geometry)), !0);
|
|
t.updateMatrixWorld(!0), i.applyMatrix4(t.matrix.clone());
|
|
const r = t.children.map((e => e.material)),
|
|
a = new Zi(i, r);
|
|
return a.name = e, a
|
|
}
|
|
|
|
function r(e) {
|
|
let t;
|
|
t = Array.isArray(e.material) ? e.material : [e.material];
|
|
for (const e of t) e.side = 0;
|
|
return e
|
|
}
|
|
xg.models = {
|
|
chassis: r(i("Body")),
|
|
suspension: r(i("Suspension")),
|
|
suspensionFL: r(i("SuspensionFL")),
|
|
suspensionFR: r(i("SuspensionFR")),
|
|
suspensionBL: r(i("SuspensionBL")),
|
|
suspensionBR: r(i("SuspensionBR")),
|
|
wheelFL: r(i("WheelFL")),
|
|
wheelFR: r(i("WheelFR")),
|
|
wheelBL: r(i("WheelBL")),
|
|
wheelBR: r(i("WheelBR")),
|
|
collisionShapeVertices: IA(xg, xg, "m", SA).call(xg, i("Collision"))
|
|
}, xg.models.wheelFL.geometry.translate(-.627909, .218824, -1.3478), xg.models.wheelFR.geometry.translate(.627909, .218824, -1.3478), xg.models.wheelBL.geometry.translate(-.720832, .218824, 1.52686), xg.models.wheelBR.geometry.translate(.720832, .218824, 1.52686), xg.models.wheelFL.geometry.rotateZ(Math.PI), xg.models.wheelFR.geometry.rotateZ(Math.PI), xg.models.wheelBL.geometry.rotateZ(Math.PI), xg.models.wheelBR.geometry.rotateZ(Math.PI), IA(xg, xg, "m", MA).call(xg).then((t => {
|
|
e(t)
|
|
})).catch(t)
|
|
}), void 0, t)
|
|
}));
|
|
return yield new Promise(((e, t) => {
|
|
const n = new Image;
|
|
n.addEventListener("load", (() => {
|
|
e()
|
|
})), n.addEventListener("error", (() => {
|
|
t(new Error("Failed to load image"))
|
|
})), n.src = "images/car_stripe.svg", xg.images = {
|
|
stripe: n
|
|
}
|
|
})), e
|
|
}))
|
|
}
|
|
}
|
|
xg = RA, bg = new WeakMap, Eg = new WeakMap, Sg = new WeakMap, Mg = new WeakMap, Tg = new WeakMap, Cg = new WeakMap, Ig = new WeakMap, Rg = new WeakMap, Pg = new WeakMap, Bg = new WeakMap, Dg = new WeakMap, Lg = new WeakMap, Ug = new WeakMap, kg = new WeakMap, Ng = new WeakMap, Fg = new WeakMap, Og = new WeakMap, zg = new WeakMap, Wg = new WeakMap, Hg = new WeakMap, Vg = new WeakMap, Gg = new WeakMap, Qg = new WeakMap, Xg = new WeakMap, jg = new WeakMap, qg = new WeakMap, Yg = new WeakMap, Kg = new WeakMap, Zg = new WeakMap, Jg = new WeakMap, $g = new WeakMap, eA = new WeakMap, tA = new WeakMap, nA = new WeakMap, iA = new WeakMap, rA = new WeakMap, aA = new WeakMap, sA = new WeakMap, oA = new WeakMap, lA = new WeakMap, cA = new WeakMap, hA = new WeakMap, yg = new WeakSet, uA = function() {
|
|
IA(this, yg, "m", fA).call(this), setTimeout((() => {
|
|
if (null != IA(this, Mg, "f") && (IA(this, Mg, "f").source.stop(), CA(this, Mg, null, "f")), null != IA(this, Cg, "f")) {
|
|
for (const {
|
|
source: e
|
|
}
|
|
of IA(this, Cg, "f")) e.stop();
|
|
CA(this, Cg, null, "f")
|
|
}
|
|
}), 200)
|
|
}, dA = function() {
|
|
if (null == xg.images) throw new Error("Car images are not loaded yet");
|
|
IA(this, Jg, "f").clearRect(0, 0, IA(this, Jg, "f").canvas.width, IA(this, Jg, "f").canvas.height), IA(this, Jg, "f").drawImage(xg.images.stripe, 0, 0, IA(this, Jg, "f").canvas.width, IA(this, Jg, "f").canvas.height), IA(this, $g, "f").needsUpdate = !0
|
|
}, fA = function() {
|
|
if (null != IA(this, Mg, "f") && (IA(this, Mg, "f").source.playbackRate.setTargetAtTime(.7, 0, .15), IA(this, Mg, "f").gain.gain.setTargetAtTime(0, 0, .15)), null != IA(this, Cg, "f"))
|
|
for (const e of IA(this, Cg, "f")) e.source.playbackRate.setTargetAtTime(.3, 0, .15), e.gain.gain.setTargetAtTime(0, 0, .15);
|
|
if (null != IA(this, sA, "f")) {
|
|
for (const {
|
|
source: e
|
|
}
|
|
of IA(this, sA, "f")) e.stop();
|
|
CA(this, sA, null, "f")
|
|
}
|
|
}, pA = function() {
|
|
var e, t;
|
|
const n = null !== (t = null === (e = IA(this, rA, "f")) || void 0 === e ? void 0 : e.getSettingFloat(nm.CheckpointVolume)) && void 0 !== t ? t : 0;
|
|
let i = Math.min(Math.max(IA(this, Sg, "f") * n, 0), 1);
|
|
if (Number.isNaN(i) && (i = 0), i > 0 && null != IA(this, bg, "f")) {
|
|
const e = IA(this, bg, "f").getBuffer("checkpoint");
|
|
if (null != e && null != IA(this, bg, "f").context && null != IA(this, bg, "f").destinationMaster) {
|
|
const t = IA(this, bg, "f").context.createBufferSource();
|
|
t.buffer = e, t.playbackRate.value = 1.25;
|
|
const n = IA(this, bg, "f").context.createGain();
|
|
n.gain.value = .03 * i, t.connect(n), n.connect(IA(this, bg, "f").destinationMaster), t.start(0)
|
|
}
|
|
}
|
|
}, mA = function() {
|
|
var e, t;
|
|
const n = null !== (t = null === (e = IA(this, rA, "f")) || void 0 === e ? void 0 : e.getSettingFloat(nm.CheckpointVolume)) && void 0 !== t ? t : 0;
|
|
let i = Math.min(Math.max(IA(this, Sg, "f") * n, 0), 1);
|
|
if (Number.isNaN(i) && (i = 0), i > 0 && null != IA(this, bg, "f")) {
|
|
const e = IA(this, bg, "f").getBuffer("finish");
|
|
if (null != e && null != IA(this, bg, "f").context && null != IA(this, bg, "f").destinationMaster) {
|
|
const t = IA(this, bg, "f").context.createBufferSource();
|
|
t.buffer = e, t.playbackRate.value = 1.25;
|
|
const n = IA(this, bg, "f").context.createGain();
|
|
n.gain.value = .03, t.connect(n), n.connect(IA(this, bg, "f").destinationMaster), t.start(0)
|
|
}
|
|
}
|
|
}, gA = function(e) {
|
|
var t;
|
|
for (let n = 0; n < 4; n++) {
|
|
const i = IA(this, kg, "f").wheelPosition[n],
|
|
r = IA(this, kg, "f").wheelInContact[n],
|
|
a = IA(this, kg, "f").wheelDeltaRotation[n],
|
|
s = IA(this, kg, "f").wheelSkidInfo[n];
|
|
r && a > .06 && s < .5 ? (n < IA(this, aA, "f").length && (IA(this, oA, "f")[n] = Math.max(0, IA(this, oA, "f")[n] - e)), 0 == IA(this, oA, "f")[n] && null != IA(this, lA, "f") && IA(this, lA, "f").spawn(i.x, i.y, i.z)) : (n < IA(this, aA, "f").length && (null === (t = IA(this, rA, "f")) || void 0 === t ? void 0 : t.getSettingBoolean(nm.SkidmarksEnabled)) && IA(this, aA, "f")[n].break(), IA(this, oA, "f")[n] = .075)
|
|
}
|
|
}, AA = function() {
|
|
if (null != IA(this, bg, "f") && null != IA(this, bg, "f").context && null != IA(this, bg, "f").destinationSfx) {
|
|
null == IA(this, Eg, "f") && (CA(this, Eg, IA(this, bg, "f").context.createGain(), "f"), IA(this, Eg, "f").gain.value = IA(this, Sg, "f"), IA(this, Eg, "f").connect(IA(this, bg, "f").destinationSfx)), null == IA(this, Rg, "f") && (CA(this, Rg, IA(this, bg, "f").context.createPanner(), "f"), IA(this, Rg, "f").refDistance = 5, IA(this, Rg, "f").connect(IA(this, Eg, "f")));
|
|
const e = this.getPosition();
|
|
IA(this, Rg, "f").positionX.value = e.x, IA(this, Rg, "f").positionY.value = e.y, IA(this, Rg, "f").positionZ.value = e.z;
|
|
const t = 4;
|
|
if (IA(this, Pg, "f").length < t) {
|
|
IA(this, Pg, "f").length = 0;
|
|
for (let e = 0; e < t; ++e) {
|
|
const e = IA(this, bg, "f").context.createPanner();
|
|
e.refDistance = 5, e.connect(IA(this, Eg, "f")), IA(this, Pg, "f").push(e)
|
|
}
|
|
}
|
|
for (let e = 0; e < t; ++e) {
|
|
const t = IA(this, Pg, "f")[e],
|
|
n = IA(this, kg, "f").wheelPosition[e];
|
|
t.positionX.value = n.x, t.positionY.value = n.y, t.positionZ.value = n.z
|
|
}
|
|
IA(this, Xg, "f").camera != IA(this, Bg, "f").camera && IA(this, Xg, "f").camera != IA(this, Dg, "f").camera || IA(this, bg, "f").refreshListener(IA(this, Xg, "f")), IA(this, yg, "m", _A).call(this), IA(this, yg, "m", wA).call(this), IA(this, yg, "m", bA).call(this)
|
|
}
|
|
}, _A = function() {
|
|
if (null == IA(this, Mg, "f") && null != IA(this, Rg, "f") && null != IA(this, bg, "f")) {
|
|
const e = IA(this, bg, "f").getBuffer("engine");
|
|
if (null != e && null != IA(this, bg, "f").context) {
|
|
const t = IA(this, bg, "f").context.createBufferSource();
|
|
t.buffer = e, t.loop = !0, t.playbackRate.value = .7;
|
|
const n = IA(this, bg, "f").context.createGain();
|
|
n.gain.value = 0, t.connect(n), n.connect(IA(this, Rg, "f")), t.start(0, 2 * Math.random()), CA(this, Mg, {
|
|
source: t,
|
|
gain: n
|
|
}, "f")
|
|
}
|
|
}
|
|
if (null != IA(this, Mg, "f")) {
|
|
const e = (IA(this, Vg, "f")[0] + IA(this, Vg, "f")[1] + IA(this, Vg, "f")[2] + IA(this, Vg, "f")[3]) / 4,
|
|
t = .7 + Math.pow(Math.abs(e), 1 / 3) / 3,
|
|
n = IA(this, kg, "f").wheelInContact[0] || IA(this, kg, "f").wheelInContact[1] || IA(this, kg, "f").wheelInContact[2] || IA(this, kg, "f").wheelInContact[3],
|
|
{
|
|
up: i,
|
|
down: r
|
|
} = this.getControls(),
|
|
a = this.hasStarted() && !this.hasFinished() && (i && !(r && IA(this, kg, "f").brakeLightEnabled) || r && !IA(this, kg, "f").brakeLightEnabled);
|
|
let s;
|
|
s = n ? a ? t : Math.max(.7, t / 2) : a ? Math.max(.7, 1.15 * t) : Math.max(.7, t / 2), IA(this, Mg, "f").source.playbackRate.setTargetAtTime(s, 0, .05), IA(this, Mg, "f").gain.gain.setTargetAtTime(Math.min(.285, s / 14), 0, .05)
|
|
}
|
|
}, vA = function(e) {
|
|
if (IA(this, Tg, "f").length < 4) {
|
|
IA(this, Tg, "f").length = 0;
|
|
for (let e = 0; e < 4; ++e) IA(this, Tg, "f").push(0)
|
|
}
|
|
for (let t = 0; t < 4 && t < IA(this, Pg, "f").length; t++)
|
|
if (IA(this, Tg, "f")[t] -= e, IA(this, Tg, "f")[t] <= 0) {
|
|
const e = Math.abs(IA(this, kg, "f").wheelSuspensionVelocity[t]);
|
|
if (e > 4 && null != IA(this, bg, "f")) {
|
|
const n = IA(this, bg, "f").getBuffer("suspension");
|
|
if (null != n && null != IA(this, bg, "f").context) {
|
|
const i = IA(this, bg, "f").context.createBufferSource();
|
|
i.buffer = n, i.playbackRate.value = .7 + .1 * Math.random();
|
|
const r = IA(this, bg, "f").context.createGain();
|
|
r.gain.value = Math.min(.285, e / 140), i.connect(r), r.connect(IA(this, Pg, "f")[t]), i.start(IA(this, bg, "f").context.currentTime + .02 * Math.random()), IA(this, Tg, "f")[t] = .1
|
|
}
|
|
}
|
|
}
|
|
}, wA = function() {
|
|
if (null == IA(this, Cg, "f") && null != IA(this, bg, "f")) {
|
|
const e = IA(this, bg, "f").getBuffer("tires");
|
|
if (null != e && null != IA(this, bg, "f").context) {
|
|
CA(this, Cg, [], "f");
|
|
const t = 4;
|
|
for (let n = 0; n < t; n++) {
|
|
const i = IA(this, bg, "f").context.createBufferSource();
|
|
i.buffer = e, i.loop = !0, i.playbackRate.value = .3;
|
|
const r = IA(this, bg, "f").context.createGain();
|
|
r.gain.value = 0, i.connect(r), r.connect(IA(this, Pg, "f")[n]), i.start(0, n / t * 3.5 + .25 * Math.random()), IA(this, Cg, "f").push({
|
|
source: i,
|
|
gain: r
|
|
})
|
|
}
|
|
}
|
|
}
|
|
if (null != IA(this, Cg, "f"))
|
|
for (let e = 0; e < IA(this, Cg, "f").length; ++e) {
|
|
const t = IA(this, Cg, "f")[e];
|
|
if (IA(this, kg, "f").wheelInContact[e]) {
|
|
const e = Math.min(3, Math.abs(this.getSpeedKmh()) / 110);
|
|
t.gain.gain.setTargetAtTime(e / 10.5, 0, .15)
|
|
} else t.gain.gain.setTargetAtTime(0, 0, .15);
|
|
const n = .3 + Math.min(.4, Math.abs(this.getSpeedKmh()) / 800);
|
|
t.source.playbackRate.setTargetAtTime(n, 0, .15)
|
|
}
|
|
}, yA = function(e) {
|
|
null != IA(this, Ig, "f") && (IA(this, Ig, "f").timeout -= e, IA(this, Ig, "f").timeout <= 0 && CA(this, Ig, null, "f"));
|
|
const t = IA(this, kg, "f").collisionImpulses;
|
|
for (const e of t) IA(this, yg, "m", xA).call(this, e)
|
|
}, xA = function(e) {
|
|
if (e > 25 && null != IA(this, Rg, "f") && null != IA(this, bg, "f") && (null == IA(this, Ig, "f") || IA(this, Ig, "f").impulse + 100 < e)) {
|
|
CA(this, Ig, {
|
|
timeout: .2,
|
|
impulse: e
|
|
}, "f");
|
|
const t = IA(this, bg, "f").getBuffer("collision");
|
|
if (null != t && null != IA(this, bg, "f").context) {
|
|
const n = IA(this, bg, "f").context.createBufferSource();
|
|
n.buffer = t, n.playbackRate.value = .1 + .15 * Math.min(e / 4e3, 1);
|
|
const i = IA(this, bg, "f").context.createGain();
|
|
i.gain.value = Math.max(.3, Math.min(e / 4e3, 1)) / 2.5, n.connect(i), i.connect(IA(this, Rg, "f")), n.start(0)
|
|
}
|
|
}
|
|
}, bA = function() {
|
|
if (null == IA(this, sA, "f") && null != IA(this, bg, "f")) {
|
|
const e = IA(this, bg, "f").getBuffer("skidding");
|
|
if (null != e && null != IA(this, bg, "f").context) {
|
|
CA(this, sA, [], "f");
|
|
const t = 4;
|
|
for (let n = 0; n < t; ++n) {
|
|
const i = IA(this, bg, "f").context.createBufferSource();
|
|
i.buffer = e, i.loop = !0, i.playbackRate.value = .5;
|
|
const r = IA(this, bg, "f").context.createGain();
|
|
r.gain.value = 0, i.connect(r), r.connect(IA(this, Pg, "f")[n]), i.start(0, n / t * 3.5 + .25 * Math.random()), IA(this, sA, "f").push({
|
|
source: i,
|
|
gain: r
|
|
})
|
|
}
|
|
}
|
|
}
|
|
if (null != IA(this, sA, "f"))
|
|
for (let e = 0; e < IA(this, sA, "f").length; ++e) {
|
|
const t = IA(this, sA, "f")[e];
|
|
0 == IA(this, oA, "f")[e] ? t.gain.gain.setTargetAtTime(.75 / 3.5, 0, .1) : t.gain.gain.setTargetAtTime(0, 0, .1)
|
|
}
|
|
}, EA = function(e) {
|
|
null != IA(this, Zg, "f") && (e ? IA(this, Zg, "f").emissive.setRGB(1, .4, .3) : IA(this, Zg, "f").emissive.setRGB(0, 0, 0))
|
|
}, SA = function(e) {
|
|
const t = e.geometry.toNonIndexed();
|
|
if (!(t.attributes.position instanceof Ci)) throw new Error("Vertices must use BufferAttribute");
|
|
return Array.from(t.attributes.position.array)
|
|
}, MA = function() {
|
|
return TA(this, void 0, void 0, (function*() {
|
|
if (null == xg.models) throw new Error("Car models are not loaded yet");
|
|
const e = new Float32Array(xg.models.collisionShapeVertices),
|
|
t = yield window.crypto.subtle.digest("SHA-256", e.buffer), n = Array.from(new Uint8Array(t)).map((e => e.toString(16).padStart(2, "0"))).join(""), i = "dd663fb6330ed93725bf865d5eac2cd29ba19f74dbb3f67ae7f695ea1f68aed0";
|
|
return n == i || console.error("Car collision model checksum mismatch: " + n + " != " + i), n == i
|
|
}))
|
|
}, RA.massOffset = .6, RA.detectorBoxCenter = new Zt(0, .48, -.15), RA.detectorBoxSize = new Zt(.89, .22, 1.8), RA.suspensionResetLengthFront = .07809501004219055, RA.suspensionResetLengthRear = .0781289680480957, RA.models = null, RA.images = null;
|
|
const PA = RA;
|
|
var BA, DA, LA, UA, kA, NA, FA, OA, zA, WA, HA, VA, GA, QA, XA, jA, qA, YA, KA, ZA, JA, $A, e_, t_, n_, i_, r_, a_, s_, o_ = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
l_ = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
DA = new WeakMap, LA = new WeakMap, UA = new WeakMap, kA = new WeakMap, NA = new WeakMap, FA = new WeakMap, OA = new WeakMap, zA = new WeakMap, WA = new WeakMap, HA = new WeakMap, VA = new WeakMap, GA = new WeakMap, QA = new WeakMap, XA = new WeakMap, jA = new WeakMap, qA = new WeakMap, YA = new WeakMap, KA = new WeakMap, ZA = new WeakMap, JA = new WeakMap, $A = new WeakMap, e_ = new WeakMap, BA = new WeakSet, t_ = function(e) {
|
|
if (e.length % 3 != 0) throw new Error("Car collision shape number of vertices is not dividable by 3");
|
|
const t = new Ammo.btConvexHullShape;
|
|
for (let n = 0; n < e.length; n += 3) {
|
|
const i = e[n + 0],
|
|
r = e[n + 1],
|
|
a = e[n + 2],
|
|
s = new Ammo.btVector3(i, r + l_(this, OA, "f"), a);
|
|
t.addPoint(s, !0), Ammo.destroy(s)
|
|
}
|
|
return t.setMargin(.02), t
|
|
}, n_ = function() {
|
|
return new Zt(0, 0, 1).applyQuaternion(this.getQuaternion())
|
|
}, i_ = function() {
|
|
return new Zt(0, -1, 0).applyQuaternion(this.getQuaternion())
|
|
}, r_ = function() {
|
|
const e = l_(this, kA, "f").getLinearVelocity();
|
|
return new Zt(e.x(), e.y(), e.z())
|
|
}, a_ = function() {
|
|
const e = Math.abs(l_(this, BA, "m", n_).call(this).dot(l_(this, BA, "m", r_).call(this))),
|
|
t = l_(this, BA, "m", i_).call(this),
|
|
n = .05;
|
|
l_(this, WA, "f").setValue(t.x * e * n, t.y * e * n, t.z * e * n), l_(this, kA, "f").applyCentralImpulse(l_(this, WA, "f"))
|
|
}, s_ = function(e, t) {
|
|
var n;
|
|
o_(this, $A, !1, "f");
|
|
let i = !1,
|
|
r = !1,
|
|
a = !1,
|
|
s = !1,
|
|
o = !1;
|
|
l_(this, qA, "f") && (this.hasFinished() || ({
|
|
up: i,
|
|
right: r,
|
|
down: a,
|
|
left: s,
|
|
reset: o
|
|
} = null !== (n = null == t ? void 0 : t.getControls(l_(this, YA, "f").numberOfFrames)) && void 0 !== n ? n : {
|
|
up: !1,
|
|
right: !1,
|
|
down: !1,
|
|
left: !1,
|
|
reset: !1
|
|
}), l_(this, YA, "f").increment());
|
|
const l = this.getWheelInContact(0) || this.getWheelInContact(1) || this.getWheelInContact(2) || this.getWheelInContact(3);
|
|
if (!l && a && !this.hasFinished() && l_(this, qA, "f") ? l_(this, kA, "f").setDamping(.1, .6) : l_(this, kA, "f").setDamping(.1, .1), i && !this.hasFinished() && l_(this, qA, "f")) {
|
|
const e = 4e3;
|
|
l_(this, UA, "f").applyEngineForce(e, 2), l_(this, UA, "f").applyEngineForce(e, 3)
|
|
} else l_(this, UA, "f").applyEngineForce(0, 2), l_(this, UA, "f").applyEngineForce(0, 3);
|
|
if (a && !this.hasFinished() && l_(this, qA, "f"))
|
|
if (this.getSpeedKmh() > 1 || !l) {
|
|
const e = 10;
|
|
l_(this, UA, "f").setBrake(e, 0), l_(this, UA, "f").setBrake(e, 1), l_(this, UA, "f").setBrake(e, 2), l_(this, UA, "f").setBrake(e, 3), o_(this, $A, !0, "f")
|
|
} else {
|
|
const e = Math.min(0, Math.max(-2e3, -2e3 * (1 + this.getSpeedKmh() / 100)));
|
|
l_(this, UA, "f").applyEngineForce(e, 2), l_(this, UA, "f").applyEngineForce(e, 3), l_(this, UA, "f").setBrake(0, 0), l_(this, UA, "f").setBrake(0, 1), l_(this, UA, "f").setBrake(0, 2), l_(this, UA, "f").setBrake(0, 3)
|
|
}
|
|
else l_(this, UA, "f").setBrake(0, 0), l_(this, UA, "f").setBrake(0, 1), l_(this, UA, "f").setBrake(0, 2), l_(this, UA, "f").setBrake(0, 3);
|
|
const c = l_(this, BA, "m", r_).call(this).applyQuaternion(this.getQuaternion().invert()),
|
|
h = -new Et(c.x, c.z).normalize().angle() + Math.PI / 2;
|
|
let u = Math.max(0, Math.min(1, this.getSpeedKmh() / 30));
|
|
this.getWheelInContact(0) || this.getWheelInContact(1) || (u = 0);
|
|
const d = 155 / Math.pow(46, 1.55),
|
|
f = Math.max(-d, Math.min(d, h * u)),
|
|
p = 155 / Math.pow(Math.max(46, Math.abs(this.getSpeedKmh())), 1.55);
|
|
l_(this, qA, "f") && (s && !this.hasFinished() ? o_(this, XA, Math.min(l_(this, XA, "f") + 10 * e, 1), "f") : r && !this.hasFinished() ? o_(this, XA, Math.max(l_(this, XA, "f") - 10 * e, -1), "f") : l_(this, XA, "f") > 0 ? o_(this, XA, Math.max(l_(this, XA, "f") - 10 * e, 0), "f") : l_(this, XA, "f") < 0 && o_(this, XA, Math.min(l_(this, XA, "f") + 10 * e, 0), "f"));
|
|
const m = l_(this, XA, "f") * p;
|
|
let g;
|
|
g = f < 0 && m < 0 ? Math.min(f, m) : f > 0 && m > 0 ? Math.max(f, m) : f + m, l_(this, UA, "f").setSteeringValue(g, 0), l_(this, UA, "f").setSteeringValue(g, 1);
|
|
for (let e = 0; e < 4; e++) {
|
|
const t = l_(this, UA, "f").getWheelInfo(e);
|
|
let n;
|
|
n = t.m_raycastInfo.m_suspensionLength < -.2 ? 200 : 50, n != t.m_suspensionStiffness && t.set_m_suspensionStiffness(n)
|
|
}
|
|
if (o) {
|
|
if (!l_(this, JA, "f") && !this.hasFinished() && l_(this, qA, "f") && null != l_(this, ZA, "f")) {
|
|
const e = new Ammo.btTransform;
|
|
e.setIdentity(), o_(this, VA, new Zt(l_(this, ZA, "f").position.x, l_(this, ZA, "f").position.y, l_(this, ZA, "f").position.z), "f");
|
|
const t = new Ammo.btVector3(l_(this, VA, "f").x, l_(this, VA, "f").y, l_(this, VA, "f").z);
|
|
e.setOrigin(t), Ammo.destroy(t), o_(this, GA, new Kt(l_(this, ZA, "f").quaternion.x, l_(this, ZA, "f").quaternion.y, l_(this, ZA, "f").quaternion.z, l_(this, ZA, "f").quaternion.w), "f");
|
|
const n = new Ammo.btQuaternion(l_(this, GA, "f").x, l_(this, GA, "f").y, l_(this, GA, "f").z, l_(this, GA, "f").w);
|
|
e.setRotation(n), Ammo.destroy(n), l_(this, kA, "f").setWorldTransform(e), l_(this, NA, "f").setWorldTransform(e), Ammo.destroy(e);
|
|
const i = new Ammo.btVector3(0, 0, 0);
|
|
l_(this, kA, "f").setLinearVelocity(i), l_(this, kA, "f").setAngularVelocity(i), Ammo.destroy(i), l_(this, UA, "f").resetSuspension(), l_(this, UA, "f").getWheelInfo(0).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthFront), l_(this, UA, "f").getWheelInfo(1).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthFront), l_(this, UA, "f").getWheelInfo(2).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthRear), l_(this, UA, "f").getWheelInfo(3).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthRear), l_(this, UA, "f").setSteeringValue(0, 0), l_(this, UA, "f").setSteeringValue(0, 1);
|
|
const r = l_(this, UA, "f").getNumWheels();
|
|
for (let e = 0; e < r; e++) l_(this, UA, "f").updateWheelTransform(e, !0);
|
|
o_(this, KA, l_(this, ZA, "f").nextCheckpointIndex, "f")
|
|
}
|
|
o_(this, JA, !0, "f")
|
|
} else o_(this, JA, !1, "f")
|
|
};
|
|
const c_ = class {
|
|
constructor(e, t, n, i, r, a, s, o) {
|
|
BA.add(this), DA.set(this, void 0), LA.set(this, void 0), UA.set(this, void 0), kA.set(this, void 0), NA.set(this, void 0), FA.set(this, void 0), OA.set(this, void 0), zA.set(this, new Ammo.btTransform), WA.set(this, new Ammo.btVector3), HA.set(this, new js(new Zt, PA.detectorBoxSize.clone())), VA.set(this, void 0), GA.set(this, void 0), QA.set(this, void 0), XA.set(this, 0), jA.set(this, null), qA.set(this, !1), YA.set(this, new Kh), KA.set(this, 0), ZA.set(this, null), JA.set(this, !1), $A.set(this, !1), e_.set(this, null), o_(this, QA, s, "f"), o_(this, OA, a, "f"), o_(this, LA, new Qh, "f"), l_(this, LA, "f").createGroundPlane(), l_(this, LA, "f").createMountains(e, t), o_(this, DA, new fu(l_(this, LA, "f"), n, i), "f");
|
|
const l = new Ammo.btTransform;
|
|
l.setIdentity();
|
|
const c = new Ammo.btDefaultMotionState(l);
|
|
Ammo.destroy(l);
|
|
const h = new Ammo.btVector3(0, 0, 0);
|
|
o_(this, FA, l_(this, BA, "m", t_).call(this, r), "f"), l_(this, FA, "f").calculateLocalInertia(400, h);
|
|
const u = new Ammo.btRigidBodyConstructionInfo(400, c, l_(this, FA, "f"), h),
|
|
d = new Ammo.btRigidBody(u);
|
|
d.setFriction(1), d.setContactProcessingThreshold(0), Ammo.destroy(u), Ammo.destroy(h), d.setDamping(.1, .1), d.setActivationState(4), l_(this, LA, "f").world.addRigidBody(d, 1, 2), o_(this, kA, d, "f");
|
|
const f = new Ammo.btVehicleTuning,
|
|
p = new Ammo.btDefaultVehicleRaycaster(l_(this, LA, "f").world),
|
|
m = new Ammo.btRaycastVehicle(f, d, p);
|
|
m.setCoordinateSystem(0, 1, 2), l_(this, LA, "f").world.addAction(m), o_(this, UA, m, "f");
|
|
const g = new Ammo.btVector3(0, -1, 0),
|
|
A = new Ammo.btVector3(-1, 0, 0);
|
|
for (const e of ["WheelFL", "WheelFR", "WheelBL", "WheelBR"]) {
|
|
let t;
|
|
if ("WheelFL" == e) t = new Ammo.btVector3(.627909, .27, 1.3478);
|
|
else if ("WheelFR" == e) t = new Ammo.btVector3(-.627909, .27, 1.3478);
|
|
else if ("WheelBL" == e) t = new Ammo.btVector3(.720832, .27, -1.52686);
|
|
else {
|
|
if ("WheelBR" != e) throw new Error("Unidentified wheel");
|
|
t = new Ammo.btVector3(-.720832, .27, -1.52686)
|
|
}
|
|
const n = "WheelFL" == e || "WheelFR" == e,
|
|
i = m.addWheel(t, g, A, .12, .331, f, n);
|
|
Ammo.destroy(t), i.set_m_maxSuspensionTravelCm(1e3), i.set_m_maxSuspensionForce(1e6), i.set_m_suspensionStiffness(50), i.set_m_wheelsDampingRelaxation(1.35), i.set_m_wheelsDampingCompression(200), i.set_m_frictionSlip(3), i.set_m_rollInfluence(.5)
|
|
}
|
|
Ammo.destroy(g), Ammo.destroy(A);
|
|
const _ = new Ammo.btTransform;
|
|
_.setIdentity(), o_(this, VA, new Zt(o.position.x, o.position.y, o.position.z), "f");
|
|
const v = new Ammo.btVector3(l_(this, VA, "f").x, l_(this, VA, "f").y, l_(this, VA, "f").z);
|
|
_.setOrigin(v), Ammo.destroy(v), o_(this, GA, new Kt(o.quaternion.x, o.quaternion.y, o.quaternion.z, o.quaternion.w), "f");
|
|
const w = new Ammo.btQuaternion(l_(this, GA, "f").x, l_(this, GA, "f").y, l_(this, GA, "f").z, l_(this, GA, "f").w);
|
|
_.setRotation(w), Ammo.destroy(w), o_(this, NA, l_(this, kA, "f").getMotionState(), "f"), l_(this, kA, "f").setWorldTransform(_), l_(this, NA, "f").setWorldTransform(_), Ammo.destroy(_), l_(this, UA, "f").resetSuspension(), l_(this, UA, "f").getWheelInfo(0).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthFront), l_(this, UA, "f").getWheelInfo(1).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthFront), l_(this, UA, "f").getWheelInfo(2).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthRear), l_(this, UA, "f").getWheelInfo(3).m_raycastInfo.set_m_suspensionLength(PA.suspensionResetLengthRear), l_(this, UA, "f").setSteeringValue(0, 0), l_(this, UA, "f").setSteeringValue(0, 1);
|
|
const y = l_(this, UA, "f").getNumWheels();
|
|
for (let e = 0; e < y; e++) l_(this, UA, "f").updateWheelTransform(e, !0)
|
|
}
|
|
dispose() {
|
|
l_(this, LA, "f").world.removeRigidBody(l_(this, kA, "f")), Ammo.destroy(l_(this, NA, "f")), Ammo.destroy(l_(this, kA, "f")), Ammo.destroy(l_(this, zA, "f")), Ammo.destroy(l_(this, WA, "f")), Ammo.destroy(l_(this, FA, "f")), l_(this, LA, "f").world.removeAction(l_(this, UA, "f")), Ammo.destroy(l_(this, UA, "f")), l_(this, LA, "f").dispose()
|
|
}
|
|
get physics() {
|
|
return l_(this, LA, "f")
|
|
}
|
|
get controls() {
|
|
return l_(this, QA, "f")
|
|
}
|
|
getSpeedKmh() {
|
|
return this.hasStarted() ? l_(this, UA, "f").getCurrentSpeedKmHour() : 0
|
|
}
|
|
start() {
|
|
o_(this, qA, !0, "f")
|
|
}
|
|
hasStarted() {
|
|
return l_(this, qA, "f")
|
|
}
|
|
hasFinished() {
|
|
return null != l_(this, jA, "f")
|
|
}
|
|
getFinishTime() {
|
|
return l_(this, jA, "f")
|
|
}
|
|
getTime() {
|
|
return l_(this, YA, "f").clone()
|
|
}
|
|
getNextCheckpointIndex() {
|
|
return l_(this, KA, "f")
|
|
}
|
|
hasCheckpointToRespawnAt() {
|
|
return null != l_(this, ZA, "f")
|
|
}
|
|
isBrakeLightEnabled() {
|
|
return l_(this, $A, "f")
|
|
}
|
|
getPosition() {
|
|
return l_(this, VA, "f")
|
|
}
|
|
getQuaternion() {
|
|
return l_(this, GA, "f")
|
|
}
|
|
getMatrix4() {
|
|
return (new Cn).compose(this.getPosition(), this.getQuaternion(), new Zt(1, 1, 1))
|
|
}
|
|
getWheelPosition(e) {
|
|
const t = l_(this, UA, "f").getWheelTransformWS(e).getOrigin();
|
|
return new Zt(t.x(), t.y(), t.z())
|
|
}
|
|
getWheelQuaternion(e) {
|
|
const t = l_(this, UA, "f").getWheelTransformWS(e).getRotation();
|
|
return new Kt(t.x(), t.y(), t.z(), t.w())
|
|
}
|
|
getWheelInContact(e) {
|
|
return l_(this, UA, "f").getWheelInfo(e).m_raycastInfo.m_isInContact
|
|
}
|
|
getWheelSuspensionVelocity(e) {
|
|
return l_(this, UA, "f").getWheelInfo(e).m_suspensionRelativeVelocity
|
|
}
|
|
getWheelSuspensionLength(e) {
|
|
return l_(this, UA, "f").getWheelInfo(e).m_raycastInfo.m_suspensionLength
|
|
}
|
|
getWheelRotation(e) {
|
|
return l_(this, UA, "f").getWheelInfo(e).m_rotation
|
|
}
|
|
getWheelDeltaRotation(e) {
|
|
return l_(this, UA, "f").getWheelInfo(e).m_deltaRotation
|
|
}
|
|
getWheelSkidInfo(e) {
|
|
return l_(this, UA, "f").getWheelInfo(e).m_skidInfo
|
|
}
|
|
getCollisionImpulses() {
|
|
const e = [],
|
|
t = l_(this, LA, "f").dispatcher.getNumManifolds();
|
|
for (let n = 0; n < t; ++n) {
|
|
const t = l_(this, LA, "f").dispatcher.getManifoldByIndexInternal(n),
|
|
i = t.getBody0(),
|
|
r = t.getBody1();
|
|
if (i.H == l_(this, kA, "f").H || r.H == l_(this, kA, "f").H) {
|
|
const n = t.getNumContacts();
|
|
for (let i = 0; i < n; ++i) {
|
|
const n = t.getContactPoint(i);
|
|
e.push(n.getAppliedImpulse())
|
|
}
|
|
}
|
|
}
|
|
return e
|
|
}
|
|
step() {
|
|
var e;
|
|
if (this.hasStarted() && l_(this, YA, "f").numberOfFrames < Ch.maxFrames) {
|
|
const t = 1 / Qh.stepsPerSecond,
|
|
n = l_(this, VA, "f"),
|
|
i = l_(this, GA, "f");
|
|
(null == l_(this, e_, "f") || l_(this, e_, "f").manhattanDistanceTo(n) > 1.5) && (null == l_(this, e_, "f") ? o_(this, e_, n.clone(), "f") : l_(this, e_, "f").copy(n), l_(this, LA, "f").activePhysicsAt(n)), l_(this, BA, "m", a_).call(this), l_(this, BA, "m", s_).call(this, t, l_(this, QA, "f")), l_(this, LA, "f").step();
|
|
const r = l_(this, zA, "f");
|
|
l_(this, NA, "f").getWorldTransform(r);
|
|
const a = r.getOrigin(),
|
|
s = r.getRotation();
|
|
if (n.set(a.x(), a.y(), a.z()), i.set(s.x(), s.y(), s.z(), s.w()), !this.hasFinished()) {
|
|
const t = l_(this, HA, "f");
|
|
t.center.copy(PA.detectorBoxCenter).applyQuaternion(i).add(n), t.rotation.elements = [1 - 2 * (i.y * i.y + i.z * i.z), 2 * (i.x * i.y + i.z * i.w), 2 * (i.x * i.z - i.y * i.w), 2 * (i.x * i.y - i.z * i.w), 1 - 2 * (i.x * i.x + i.z * i.z), 2 * (i.y * i.z + i.x * i.w), 2 * (i.x * i.z + i.y * i.w), 2 * (i.y * i.z - i.x * i.w), 1 - 2 * (i.x * i.x + i.y * i.y)];
|
|
const r = l_(this, DA, "f").getTotalNumberOfCheckpointIndices();
|
|
if (l_(this, KA, "f") == r) null != l_(this, DA, "f").checkFinish(t) && o_(this, jA, l_(this, YA, "f").clone(), "f");
|
|
else {
|
|
const n = l_(this, DA, "f").checkCheckpoint(t, l_(this, KA, "f"));
|
|
if (null != n && (o_(this, KA, (e = l_(this, KA, "f"), ++e), "f"), n.rotationAxis == Au.YPositive)) {
|
|
const e = l_(this, BA, "m", r_).call(this);
|
|
let t = n.rotation * Math.PI / 2;
|
|
(0 == n.rotation && e.z < 0 || 1 == n.rotation && e.x < 0 || 2 == n.rotation && e.z > 0 || 3 == n.rotation && e.x > 0) && (t += Math.PI);
|
|
const i = (new Kt).setFromEuler(new Fn(0, t, 0)),
|
|
r = new Zt(0, .35, -1.35);
|
|
r.applyQuaternion(i), n.type != mu.CheckpointWide && n.type != mu.PlaneCheckpointWide || r.sub(new Zt(-10, 0, 0).applyEuler(new Fn(0, n.rotation * Math.PI / 2, 0))), o_(this, ZA, {
|
|
position: new Zt(n.x * fu.partSize + r.x, n.y * fu.partSize + r.y, n.z * fu.partSize + r.z),
|
|
quaternion: i,
|
|
nextCheckpointIndex: l_(this, KA, "f")
|
|
}, "f")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
var h_, u_, d_, f_ = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
u_ = new WeakMap, h_ = new WeakSet, d_ = function(e) {
|
|
if (e.length % 9 != 0) throw new Error("Physics shape vertices length is not dividable by 9");
|
|
const t = new en,
|
|
n = new Ammo.btTriangleMesh;
|
|
for (let i = 0; i < e.length; i += 9) {
|
|
const r = e[i + 0],
|
|
a = e[i + 1],
|
|
s = e[i + 2],
|
|
o = e[i + 3],
|
|
l = e[i + 4],
|
|
c = e[i + 5],
|
|
h = e[i + 6],
|
|
u = e[i + 7],
|
|
d = e[i + 8],
|
|
f = new Ammo.btVector3(r, a, s),
|
|
p = new Ammo.btVector3(o, l, c),
|
|
m = new Ammo.btVector3(h, u, d);
|
|
n.addTriangle(f, p, m), Ammo.destroy(f), Ammo.destroy(p), Ammo.destroy(m), t.expandByPoint(new Zt(r, a, s)), t.expandByPoint(new Zt(o, l, c)), t.expandByPoint(new Zt(h, u, d))
|
|
}
|
|
const i = new Ammo.btBvhTriangleMeshShape(n);
|
|
return i.setMargin(.01), {
|
|
boundingBox: t,
|
|
shape: i,
|
|
triangleMesh: n
|
|
}
|
|
};
|
|
const p_ = class {
|
|
constructor(e) {
|
|
h_.add(this), u_.set(this, new Map);
|
|
for (const {
|
|
id: t,
|
|
vertices: n,
|
|
detector: i,
|
|
startOffset: r
|
|
}
|
|
of e) {
|
|
const {
|
|
boundingBox: e,
|
|
shape: a,
|
|
triangleMesh: s
|
|
} = f_(this, h_, "m", d_).call(this, n);
|
|
f_(this, u_, "f").set(t, {
|
|
boundingBox: e,
|
|
shape: a,
|
|
triangleMesh: s,
|
|
detector: null != i ? {
|
|
type: i.type,
|
|
center: new Zt(i.center[0], i.center[1], i.center[2]),
|
|
size: new Zt(i.size[0], i.size[1], i.size[2])
|
|
} : null,
|
|
startOffset: null != r ? new Zt(r[0], r[1], r[2]) : null
|
|
})
|
|
}
|
|
}
|
|
dispose() {
|
|
for (const {
|
|
shape: e,
|
|
triangleMesh: t
|
|
}
|
|
of f_(this, u_, "f").values()) Ammo.destroy(e), Ammo.destroy(t);
|
|
f_(this, u_, "f").clear()
|
|
}
|
|
getPhysicsShape(e) {
|
|
const t = f_(this, u_, "f").get(e);
|
|
if (null == t) throw new Error('Track part with the id "' + e.toString() + '" has no physics model');
|
|
return {
|
|
boundingBox: t.boundingBox.clone(),
|
|
shape: t.shape
|
|
}
|
|
}
|
|
getPartTypesWithDetector(e) {
|
|
const t = [];
|
|
for (const [n, i] of f_(this, u_, "f").entries()) null != i.detector && i.detector.type == e && t.push(n);
|
|
return t
|
|
}
|
|
getStartPartTypes() {
|
|
const e = [];
|
|
for (const [t, n] of f_(this, u_, "f").entries()) null != n.startOffset && e.push(t);
|
|
return e
|
|
}
|
|
getPartStartOffset(e) {
|
|
var t, n;
|
|
const i = f_(this, u_, "f").get(e);
|
|
if (null == i) throw new Error('Track part with the id "' + e.toString() + '" does not exist');
|
|
return null !== (n = null === (t = i.startOffset) || void 0 === t ? void 0 : t.clone()) && void 0 !== n ? n : null
|
|
}
|
|
getDetector(e) {
|
|
const t = f_(this, u_, "f").get(e);
|
|
if (null == t) throw new Error('Track part with the id "' + e.toString() + '" does not exist');
|
|
return t.detector
|
|
}
|
|
};
|
|
var m_;
|
|
! function(e) {
|
|
e[e.Init = 0] = "Init", e[e.Verify = 1] = "Verify", e[e.TestDeterminism = 2] = "TestDeterminism", e[e.CreateCar = 3] = "CreateCar", e[e.DeleteCar = 4] = "DeleteCar", e[e.StartCar = 5] = "StartCar", e[e.ControlCar = 6] = "ControlCar", e[e.PauseCar = 7] = "PauseCar", e[e.VerifyResult = 8] = "VerifyResult", e[e.DeterminismResult = 9] = "DeterminismResult", e[e.UpdateResult = 10] = "UpdateResult"
|
|
}(m_ || (m_ = {}));
|
|
const g_ = m_;
|
|
var A_, __ = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
v_ = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
A_ = new WeakMap;
|
|
const w_ = class {
|
|
constructor(e) {
|
|
A_.set(this, void 0), __(this, A_, e, "f")
|
|
}
|
|
dispose() {}
|
|
getControls(e) {
|
|
return v_(this, A_, "f").getFrame(e)
|
|
}
|
|
};
|
|
var y_ = n(1312);
|
|
const x_ = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
|
b_ = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51];
|
|
|
|
function E_(e) {
|
|
let t = 0,
|
|
n = "";
|
|
for (; t < 8 * e.length;) {
|
|
const i = M_(e, t);
|
|
let r;
|
|
30 & ~i ? (r = i, t += 6) : (r = 31 & i, t += 5), n += x_[r]
|
|
}
|
|
return n
|
|
}
|
|
|
|
function S_(e) {
|
|
let t = 0;
|
|
const n = [],
|
|
i = e.length;
|
|
for (let r = 0; r < i; r++) {
|
|
const a = e.charCodeAt(r);
|
|
if (a >= b_.length) return null;
|
|
const s = b_[a];
|
|
if (-1 == s) return null;
|
|
30 & ~s ? (T_(n, t, 6, s, r == i - 1), t += 6) : (T_(n, t, 5, s, r == i - 1), t += 5)
|
|
}
|
|
return new Uint8Array(n)
|
|
}
|
|
|
|
function M_(e, t) {
|
|
if (t >= 8 * e.length) throw new Error("Out of range");
|
|
const n = Math.floor(t / 8),
|
|
i = e[n],
|
|
r = t - 8 * n;
|
|
if (r <= 2 || n >= e.length - 1) return (i & 63 << r) >>> r;
|
|
return (i & 63 << r) >>> r | (e[n + 1] & 63 >>> 8 - r) << 8 - r
|
|
}
|
|
|
|
function T_(e, t, n, i, r) {
|
|
const a = Math.floor(t / 8);
|
|
for (; a >= e.length;) e.push(0);
|
|
const s = t - 8 * a;
|
|
if (e[a] |= i << s & 255, s > 8 - n && !r) {
|
|
const t = a + 1;
|
|
t >= e.length && e.push(0), e[t] |= i >> 8 - s
|
|
}
|
|
}
|
|
var C_, I_ = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
R_ = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class P_ {
|
|
constructor(e = 28) {
|
|
if (C_.set(this, void 0), !(Number.isSafeInteger(e) && e >= 0 && e < 180)) throw new Error("Representation is not a safe integer or is out of range");
|
|
I_(this, C_, e, "f")
|
|
}
|
|
clone() {
|
|
return new P_(R_(this, C_, "f"))
|
|
}
|
|
toDegrees() {
|
|
return 2 * R_(this, C_, "f")
|
|
}
|
|
static fromDegrees(e) {
|
|
const t = Math.round(e / 2 % 180);
|
|
return new P_(t)
|
|
}
|
|
getSunPosition() {
|
|
const e = 2 * R_(this, C_, "f") * (Math.PI / 180),
|
|
t = Math.cos(e),
|
|
n = Math.sin(e);
|
|
return new Zt(t, .78, n).normalize()
|
|
}
|
|
get representation() {
|
|
return R_(this, C_, "f")
|
|
}
|
|
}
|
|
C_ = new WeakMap;
|
|
const B_ = P_;
|
|
var D_;
|
|
! function(e) {
|
|
e[e.Summer = 0] = "Summer", e[e.Winter = 1] = "Winter", e[e.Desert = 2] = "Desert"
|
|
}(D_ || (D_ = {}));
|
|
const L_ = D_;
|
|
var U_;
|
|
! function(e) {
|
|
e[e.Default = 0] = "Default", e[e.Summer = 1] = "Summer", e[e.Winter = 2] = "Winter", e[e.Desert = 3] = "Desert", e[e.Custom0 = 32] = "Custom0", e[e.Custom1 = 33] = "Custom1", e[e.Custom2 = 34] = "Custom2", e[e.Custom3 = 35] = "Custom3", e[e.Custom4 = 36] = "Custom4", e[e.Custom5 = 37] = "Custom5", e[e.Custom6 = 38] = "Custom6", e[e.Custom7 = 39] = "Custom7", e[e.Custom8 = 40] = "Custom8"
|
|
}(U_ || (U_ = {}));
|
|
const k_ = U_;
|
|
var N_;
|
|
! function(e) {
|
|
e[e.Special = 0] = "Special", e[e.Road = 1] = "Road", e[e.RoadTurns = 2] = "RoadTurns", e[e.RoadWide = 3] = "RoadWide", e[e.Plane = 4] = "Plane", e[e.Block = 5] = "Block", e[e.WallTrack = 6] = "WallTrack", e[e.Pillar = 7] = "Pillar", e[e.Sign = 8] = "Sign"
|
|
}(N_ || (N_ = {}));
|
|
const F_ = N_;
|
|
var O_, z_ = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
W_ = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class H_ {
|
|
constructor(e) {
|
|
O_.set(this, void 0);
|
|
const t = [];
|
|
for (const [n, i, r] of e) t.push([n, i, r]);
|
|
z_(this, O_, t, "f")
|
|
}
|
|
rotated(e, t) {
|
|
const n = t == Au.YNegative || t == Au.XNegative || t == Au.ZNegative;
|
|
return new H_(W_(this, O_, "f").map((([i, r, a]) => {
|
|
if (n) switch (e) {
|
|
case 0:
|
|
break;
|
|
case 1:
|
|
[i, a] = [-a - 1, i];
|
|
break;
|
|
case 2:
|
|
[i, a] = [-i - 1, -a - 1];
|
|
break;
|
|
case 3:
|
|
[i, a] = [a, -i - 1];
|
|
break;
|
|
default:
|
|
throw new Error("Invalid rotation")
|
|
} else switch (e) {
|
|
case 0:
|
|
break;
|
|
case 1:
|
|
[i, a] = [a, -i - 1];
|
|
break;
|
|
case 2:
|
|
[i, a] = [-i - 1, -a - 1];
|
|
break;
|
|
case 3:
|
|
[i, a] = [-a - 1, i];
|
|
break;
|
|
default:
|
|
throw new Error("Invalid rotation")
|
|
}
|
|
return t == Au.YPositive || (t == Au.YNegative ? [i, r] = [-i - 1, -r - 1] : t == Au.XPositive ? [i, r] = [r, -i - 1] : t == Au.XNegative ? [i, r] = [-r - 1, i] : t == Au.ZPositive ? [r, a] = [-a - 1, r] : [r, a] = [a, -r - 1]), [i, r, a]
|
|
})))
|
|
}
|
|
forEach(e) {
|
|
for (let t = 0; t < W_(this, O_, "f").length; t++) {
|
|
const [n, i, r] = W_(this, O_, "f")[t];
|
|
e(n, i, r, t)
|
|
}
|
|
}
|
|
get length() {
|
|
return W_(this, O_, "f").length
|
|
}
|
|
}
|
|
O_ = new WeakMap;
|
|
const V_ = H_,
|
|
G_ = [{
|
|
id: k_.Summer,
|
|
colors: {}
|
|
}, {
|
|
id: k_.Winter,
|
|
colors: {
|
|
Road: "#5077b2",
|
|
RoadBarrier: "#898989",
|
|
RoadEdgeWhite: "#ffffff",
|
|
RoadEdgeRed: "#1f3d6b",
|
|
BlockSurface: "#878787",
|
|
Pillar: "#2b4d7f",
|
|
PillarEdge: "#071428",
|
|
WallTrack: "#5077b2",
|
|
WallTrackBottom: "#878787",
|
|
WallTrackSides: "#ffffff",
|
|
PlaneWall: "#1f3d6b",
|
|
PlaneWallDetail: "#878787",
|
|
SignYellow: "#1b2a89",
|
|
SignRed: "#841901",
|
|
SignBlack: "#5077b2"
|
|
}
|
|
}, {
|
|
id: k_.Desert,
|
|
colors: {
|
|
Road: "#997240",
|
|
RoadBarrier: "#211001",
|
|
RoadEdgeRed: "#5b2424",
|
|
RoadEdgeWhite: "#510808",
|
|
BlockSurface: "#b78f5b",
|
|
Pillar: "#99713d",
|
|
PillarEdge: "#1c1105",
|
|
WallTrack: "#260b0b",
|
|
WallTrackBottom: "#160606",
|
|
WallTrackSides: "#75562e",
|
|
PlaneWall: "#633030",
|
|
PlaneWallDetail: "#aa8a53",
|
|
SignYellow: "#997240",
|
|
SignRed: "#d80202",
|
|
SignBlack: "#601d1d"
|
|
}
|
|
}],
|
|
Q_ = G_.concat([{
|
|
id: k_.Custom0,
|
|
colors: {
|
|
BlockSurface: "#131313"
|
|
}
|
|
}, {
|
|
id: k_.Custom1,
|
|
colors: {
|
|
BlockSurface: "#501b1b"
|
|
}
|
|
}, {
|
|
id: k_.Custom2,
|
|
colors: {
|
|
BlockSurface: "#7f4d2b"
|
|
}
|
|
}, {
|
|
id: k_.Custom3,
|
|
colors: {
|
|
BlockSurface: "#93862d"
|
|
}
|
|
}, {
|
|
id: k_.Custom4,
|
|
colors: {
|
|
BlockSurface: "#2a5e30"
|
|
}
|
|
}, {
|
|
id: k_.Custom5,
|
|
colors: {
|
|
BlockSurface: "#236363"
|
|
}
|
|
}, {
|
|
id: k_.Custom6,
|
|
colors: {
|
|
BlockSurface: "#20244b"
|
|
}
|
|
}, {
|
|
id: k_.Custom7,
|
|
colors: {
|
|
BlockSurface: "#592759"
|
|
}
|
|
}, {
|
|
id: k_.Custom8,
|
|
colors: {
|
|
BlockSurface: "#302318"
|
|
}
|
|
}]);
|
|
class X_ {
|
|
constructor(e, t, n, i, r, a, s = null, o = null) {
|
|
const l = [];
|
|
for (const [e, t] of a)
|
|
for (let n = e[0]; n <= t[0]; n++)
|
|
for (let i = e[1]; i <= t[1]; i++)
|
|
for (let r = e[2]; r <= t[2]; r++) {
|
|
if (null != l.find((([e, t, a]) => e == n && t == i && a == r))) throw new Error("Duplicate tile in track part");
|
|
l.push([n, i, r])
|
|
}
|
|
this.checksum = e, this.category = t, this.id = n, this.models = i, this.colors = r, this.tiles = new V_(l), this.detector = s, this.startOffset = o, Object.freeze(this)
|
|
}
|
|
}
|
|
const j_ = [new X_("6d94d798abd14dc3bce4e99c180309d993ad43adb5f2c90eef8e350eedafe7cf", F_.Special, mu.Start, [
|
|
["Road", "Start"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
], null, new Zt(0, .35, 1.35)), new X_("f29e34b2e05e0a4751109ae564b03fe8878a79cc6b26288f1117ed296d09c5bb", F_.Special, mu.StartWide, [
|
|
["RoadWide", "StartWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[5, 0, 1]
|
|
]
|
|
], null, new Zt(-10, .35, 1.35)), new X_("3c304054f415fbede4f73a43517db04302f38b16fa2cd4e587082b37b75e20e5", F_.Special, mu.PlaneStart, [
|
|
["Planes", "PlaneStart"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
], null, new Zt(0, .35, 1.35)), new X_("f08710416bdaa3d91d0d43f014e45d421fdb4587a334993bad0056f3dbbcb6bb", F_.Special, mu.PlaneStartWide, [
|
|
["Planes", "PlaneStartWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[5, 0, 1]
|
|
]
|
|
], null, new Zt(-10, .35, 1.35)), new X_("223fc87c72bb64b58677062ffa08ab7eafd78071bced7c53233606763cd5316b", F_.Special, mu.Checkpoint, [
|
|
["Road", "Checkpoint"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Checkpoint,
|
|
center: [0, 2.2, 0],
|
|
size: [10.5, 3.8, 1]
|
|
}), new X_("82d9a9879cee92c04c8d4ba2e16fc31bb1917a31f5802a3bb5177ca9a5cfee01", F_.Special, mu.CheckpointWide, [
|
|
["RoadWide", "CheckpointWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[5, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Checkpoint,
|
|
center: [10, 2.2, 0],
|
|
size: [30.6, 3.8, 1]
|
|
}), new X_("fe8946d7f09724b5e11f493eb5c2a5b5e3d502b15beaad003f8134ac63558948", F_.Special, mu.PlaneCheckpoint, [
|
|
["Planes", "PlaneCheckpoint"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Checkpoint,
|
|
center: [0, 2.2, 0],
|
|
size: [18.25, 3.8, 1]
|
|
}), new X_("d486d9b851db35dd44c15f9e0bb3bf582118daf7be514598a19307f61cf46678", F_.Special, mu.PlaneCheckpointWide, [
|
|
["Planes", "PlaneCheckpointWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[5, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Checkpoint,
|
|
center: [10, 2.2, 0],
|
|
size: [38.25, 3.8, 1]
|
|
}), new X_("c01200d573a3594a6a4cb73ebb600964d653e4a89267d3297f3969220742aa79", F_.Special, mu.Finish, [
|
|
["Road", "Finish"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Finish,
|
|
center: [0, 2.2, 0],
|
|
size: [10.5, 3.8, 2]
|
|
}), new X_("a9cefdff816e94a643210c58582c2809de0e3e0e0478b8d5baabd7fe81f13e73", F_.Special, mu.FinishWide, [
|
|
["RoadWide", "FinishWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[5, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Finish,
|
|
center: [10, 2.2, 0],
|
|
size: [30.6, 3.8, 2]
|
|
}), new X_("75e5f09fe8a18ecafaf1fb80929173ef0a7dc0b785596bbe0ccd85a934d79578", F_.Special, mu.PlaneFinish, [
|
|
["Planes", "PlaneFinish"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Finish,
|
|
center: [0, 2.2, 0],
|
|
size: [18.25, 3.8, 2]
|
|
}), new X_("5801b3268c75809728c63450d06000c5f6fcfd5d72691902f99d7d19d25e1d78", F_.Special, mu.PlaneFinishWide, [
|
|
["Planes", "PlaneFinishWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[5, 0, 1]
|
|
]
|
|
], {
|
|
type: Jh.Finish,
|
|
center: [10, 2.2, 0],
|
|
size: [38.25, 3.8, 2]
|
|
}), new X_("3421096c1986d008da88b5fac64cd4c475603138c9bf8a98ab6d581dda6befa7", F_.Road, mu.Straight, [
|
|
["Road", "Straight"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("bdc3bcdafec9bc26835dc76159f7223da7da5babb3a5770129fa11046c748b69", F_.Road, mu.StraightPillarBottom, [
|
|
["Road", "Straight"],
|
|
["Pillar", "SurfacePillarBottom"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("2758e984d87b3170f6618c9c689554ef169fd5f80ea7f0df292ffd69792d414e", F_.Road, mu.StraightPillarShort, [
|
|
["Road", "Straight"],
|
|
["Pillar", "SurfacePillarShort"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("fb5a81784022cfc2d3d0007a032976c8dfd066e72a3bc92f671c98c5cca36aaa", F_.Road, mu.TurnSharp, [
|
|
["Road", "TurnSharp"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("3da2e9a93da06b1376c33486f30a5f02d8c2f125f5b7d8b41166049ecd95f269", F_.Road, mu.TurnSharpPillarBottom, [
|
|
["Road", "TurnSharp"],
|
|
["Pillar", "SurfacePillarBottom"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("c642122276547382e37dcb857b130088f4dc0d208dc7fdb6055b2a93080a3ffe", F_.Road, mu.TurnSharpPillarShort, [
|
|
["Road", "TurnSharp"],
|
|
["Pillar", "SurfacePillarShort"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("110efb0facc096e1c875e545b075b0effaa1b78d50b97f906aec44796501544b", F_.RoadTurns, mu.TurnShort, [
|
|
["Road", "TurnShort"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[2, 0, -1]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[3, 0, -2]
|
|
],
|
|
[
|
|
[-1, 0, -3],
|
|
[5, 0, -3]
|
|
],
|
|
[
|
|
[0, 0, -4],
|
|
[5, 0, -4]
|
|
],
|
|
[
|
|
[1, 0, -5],
|
|
[5, 0, -5]
|
|
],
|
|
[
|
|
[3, 0, -6],
|
|
[5, 0, -6]
|
|
]
|
|
]), new X_("20a164840b0e83f3eac96ba9e3650a30e3b3dec4bb635946e3e9e9a1b74820d2", F_.RoadTurns, mu.TurnLong, [
|
|
["Road", "TurnLong"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[2, 0, -2]
|
|
],
|
|
[
|
|
[-1, 0, -3],
|
|
[2, 0, -3]
|
|
],
|
|
[
|
|
[-1, 0, -4],
|
|
[3, 0, -4]
|
|
],
|
|
[
|
|
[0, 0, -5],
|
|
[4, 0, -5]
|
|
],
|
|
[
|
|
[1, 0, -6],
|
|
[6, 0, -6]
|
|
],
|
|
[
|
|
[2, 0, -7],
|
|
[9, 0, -7]
|
|
],
|
|
[
|
|
[3, 0, -8],
|
|
[9, 0, -8]
|
|
],
|
|
[
|
|
[4, 0, -9],
|
|
[9, 0, -9]
|
|
],
|
|
[
|
|
[7, 0, -10],
|
|
[9, 0, -10]
|
|
]
|
|
]), new X_("c36dddde35a740c6f01227522bf35e1a450cddbfdd8bde1617873bef0d47c95c", F_.RoadTurns, mu.TurnLong2, [
|
|
["Road", "TurnLong2"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -4],
|
|
[2, 0, -3]
|
|
],
|
|
[
|
|
[-1, 0, -5],
|
|
[3, 0, -5]
|
|
],
|
|
[
|
|
[0, 0, -6],
|
|
[4, 0, -6]
|
|
],
|
|
[
|
|
[0, 0, -7],
|
|
[5, 0, -7]
|
|
],
|
|
[
|
|
[1, 0, -8],
|
|
[6, 0, -8]
|
|
],
|
|
[
|
|
[2, 0, -9],
|
|
[7, 0, -9]
|
|
],
|
|
[
|
|
[3, 0, -10],
|
|
[9, 0, -10]
|
|
],
|
|
[
|
|
[4, 0, -11],
|
|
[13, 0, -11]
|
|
],
|
|
[
|
|
[5, 0, -12],
|
|
[13, 0, -12]
|
|
],
|
|
[
|
|
[7, 0, -13],
|
|
[13, 0, -13]
|
|
],
|
|
[
|
|
[10, 0, -14],
|
|
[13, 0, -14]
|
|
]
|
|
]), new X_("0ed20c04a941708c23fe6ced4af3f357c0e435f09278e06f3de2806786d44059", F_.RoadTurns, mu.TurnLong3, [
|
|
["Road", "TurnLong3"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -4],
|
|
[2, 0, -3]
|
|
],
|
|
[
|
|
[-1, 0, -5],
|
|
[2, 0, -5]
|
|
],
|
|
[
|
|
[0, 0, -6],
|
|
[3, 0, -6]
|
|
],
|
|
[
|
|
[0, 0, -7],
|
|
[3, 0, -7]
|
|
],
|
|
[
|
|
[0, 0, -8],
|
|
[4, 0, -8]
|
|
],
|
|
[
|
|
[1, 0, -9],
|
|
[5, 0, -9]
|
|
],
|
|
[
|
|
[2, 0, -10],
|
|
[6, 0, -10]
|
|
],
|
|
[
|
|
[2, 0, -11],
|
|
[7, 0, -11]
|
|
],
|
|
[
|
|
[3, 0, -12],
|
|
[8, 0, -12]
|
|
],
|
|
[
|
|
[4, 0, -13],
|
|
[10, 0, -13]
|
|
],
|
|
[
|
|
[5, 0, -14],
|
|
[13, 0, -14]
|
|
],
|
|
[
|
|
[7, 0, -15],
|
|
[17, 0, -15]
|
|
],
|
|
[
|
|
[8, 0, -16],
|
|
[17, 0, -16]
|
|
],
|
|
[
|
|
[11, 0, -17],
|
|
[17, 0, -17]
|
|
],
|
|
[
|
|
[14, 0, -18],
|
|
[17, 0, -18]
|
|
]
|
|
]), new X_("034ef287319877f2fcc32fbd6f32415539a4c287dfcd620360386a781adad22a", F_.RoadTurns, mu.TurnSLeft, [
|
|
["Road", "TurnS", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-3, 0, -3],
|
|
[0, 0, -2]
|
|
],
|
|
[
|
|
[-4, 0, -4],
|
|
[0, 0, -4]
|
|
],
|
|
[
|
|
[-5, 0, -5],
|
|
[-1, 0, -5]
|
|
],
|
|
[
|
|
[-5, 0, -7],
|
|
[-2, 0, -6]
|
|
],
|
|
[
|
|
[-6, 0, -10],
|
|
[-3, 0, -8]
|
|
]
|
|
]), new X_("0d49e9feb603d0899927c7e5184f4f4fdd4363d2e1fd296f0b7b3cf4dbbf0e8d", F_.RoadTurns, mu.TurnSRight, [
|
|
["Road", "TurnS"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -3],
|
|
[2, 0, -2]
|
|
],
|
|
[
|
|
[-1, 0, -4],
|
|
[3, 0, -4]
|
|
],
|
|
[
|
|
[0, 0, -5],
|
|
[4, 0, -5]
|
|
],
|
|
[
|
|
[1, 0, -7],
|
|
[4, 0, -6]
|
|
],
|
|
[
|
|
[2, 0, -10],
|
|
[5, 0, -8]
|
|
]
|
|
]), new X_("26bca19e63867bc0b755ff6fcca65de296c9d1f109f87540103565eb88a0e03d", F_.RoadTurns, mu.TurnShortLeftWide, [
|
|
["RoadWide", "TurnShortLeftWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[1, 0, -2]
|
|
],
|
|
[
|
|
[-1, 0, -4],
|
|
[5, 0, -3]
|
|
],
|
|
[
|
|
[0, 0, -5],
|
|
[5, 0, -5]
|
|
],
|
|
[
|
|
[1, 0, -6],
|
|
[5, 0, -6]
|
|
],
|
|
[
|
|
[2, 0, -7],
|
|
[9, 0, -7]
|
|
],
|
|
[
|
|
[3, 0, -8],
|
|
[9, 0, -8]
|
|
],
|
|
[
|
|
[4, 0, -9],
|
|
[9, 0, -9]
|
|
],
|
|
[
|
|
[7, 0, -10],
|
|
[9, 0, -10]
|
|
]
|
|
]), new X_("e3845854f85dafd8cec193bcbecdac6cb79f625066de29524d5c10c5580611c5", F_.RoadTurns, mu.TurnShortRightWide, [
|
|
["RoadWide", "TurnShortRightWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[2, 0, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[3, 0, -2]
|
|
],
|
|
[
|
|
[2, 0, -6],
|
|
[5, 0, -3]
|
|
]
|
|
]), new X_("dc6088960a65a55c74353a1e7c8a1ca8ec99e683f6273bf666d6909b288bb84b", F_.RoadTurns, mu.TurnLongLeftWide, [
|
|
["RoadWide", "TurnLongLeftWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -5],
|
|
[1, 0, -3]
|
|
],
|
|
[
|
|
[0, 0, -6],
|
|
[1, 0, -6]
|
|
],
|
|
[
|
|
[0, 0, -7],
|
|
[5, 0, -7]
|
|
],
|
|
[
|
|
[1, 0, -8],
|
|
[5, 0, -8]
|
|
],
|
|
[
|
|
[2, 0, -9],
|
|
[5, 0, -9]
|
|
],
|
|
[
|
|
[3, 0, -10],
|
|
[5, 0, -10]
|
|
],
|
|
[
|
|
[4, 0, -11],
|
|
[13, 0, -11]
|
|
],
|
|
[
|
|
[5, 0, -12],
|
|
[13, 0, -12]
|
|
],
|
|
[
|
|
[7, 0, -13],
|
|
[13, 0, -13]
|
|
],
|
|
[
|
|
[10, 0, -14],
|
|
[13, 0, -14]
|
|
]
|
|
]), new X_("0bbb8d6c1e4a325e10643cf45546da725c1ea18e92a3a95f753339629a06ef6c", F_.RoadTurns, mu.TurnLongRightWide, [
|
|
["RoadWide", "TurnLongRightWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, -3],
|
|
[2, 0, -2]
|
|
],
|
|
[
|
|
[-2, 0, -4],
|
|
[3, 0, -4]
|
|
],
|
|
[
|
|
[-2, 0, -5],
|
|
[4, 0, -5]
|
|
],
|
|
[
|
|
[-2, 0, -6],
|
|
[6, 0, -6]
|
|
],
|
|
[
|
|
[2, 0, -10],
|
|
[9, 0, -7]
|
|
]
|
|
]), new X_("7d8d1eed719515ba7e48b5ef4a53b6b4bb2bef42496b6b40d2551230435ecb66", F_.Road, mu.SlopeUp, [
|
|
["Road", "SlopeUp"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, -2]
|
|
]
|
|
]), new X_("d6d54dbf283f7209032541fc6b924dc879d914f253e391cf8b34dde8354661be", F_.Road, mu.SlopeUpLong, [
|
|
["Road", "SlopeUpLong"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -4],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -5],
|
|
[1, 1, -4]
|
|
],
|
|
[
|
|
[-2, 1, -6],
|
|
[1, 2, -6]
|
|
]
|
|
]), new X_("435e8cf33d28e52f75890cba1cb6529991148afd701f9b40e9ab876c11b2c448", F_.Road, mu.SlopeDown, [
|
|
["Road", "SlopeDown"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, 0],
|
|
[1, 1, 1]
|
|
]
|
|
]), new X_("01990158f65e5d499030d8c6d0ce80d34c136189ae1a9430d4260ea7a85e91a9", F_.Road, mu.SlopeDownLong, [
|
|
["Road", "SlopeDownLong"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, 5]
|
|
],
|
|
[
|
|
[-2, 2, 3],
|
|
[1, 2, 5]
|
|
]
|
|
]), new X_("4afecc8b9bd7a3b074112008831fef6b11f9a55ab8c1e570e3e73c1e92b43c6d", F_.Road, mu.Slope, [
|
|
["Road", "Slope"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
]
|
|
]), new X_("27f9b25126b1006514941bd148c8f19dc2d82022b0c1aa2358f36cb711d4b59c", F_.Road, mu.SlopePillar, [
|
|
["Road", "Slope"],
|
|
["Pillar", "PillarTopSlope"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
],
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, -1]
|
|
]
|
|
]), new X_("eb236f0ac4bd895c170db53cb518c8df5167a9db5af4bb4f33f73c02deec5265", F_.Road, mu.SlopePillarShort, [
|
|
["Road", "Slope"],
|
|
["Pillar", "PillarShortSlope"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
],
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, -1]
|
|
]
|
|
]), new X_("99cb9068cb3f97e7cbfdbb3f1edc1085ea37514f3d5dd8936bc32089cc066a5c", F_.Road, mu.SlopeUpVertical, [
|
|
["Road", "SlopeUpVertical"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("63628b23e104a3eb3c2ba8189cd408a10fbb6ebcd6fa4359d981e3c3804c13d8", F_.Road, mu.IntersectionT, [
|
|
["Road", "IntersectionT"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("400dc4643653001d283bb13f740593fc2300c547bb4d2a962054ba6aabf3721c", F_.Road, mu.IntersectionTPillarBottom, [
|
|
["Road", "IntersectionT"],
|
|
["Pillar", "SurfacePillarBottom"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("60355388650d35fcbddaaac29e0d03bc2ae46db1a05cd23ddd3f2722ec2d409e", F_.Road, mu.IntersectionTPillarShort, [
|
|
["Road", "IntersectionT"],
|
|
["Pillar", "SurfacePillarShort"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("74197b3731c2befd03498bf5172859f0b3652f1972c19e43a99bb938769573df", F_.Road, mu.IntersectionCross, [
|
|
["Road", "IntersectionCross"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("464e69b5c4f2667c246ade9ed33fd3e50b49438ed0ab787a086dfe74c217ff6c", F_.Road, mu.IntersectionCrossPillarBottom, [
|
|
["Road", "IntersectionCross"],
|
|
["Pillar", "SurfacePillarBottom"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("90004caf354627289265314966f11b5656e6879ca7de10507e6c50cd95254b75", F_.Road, mu.IntersectionCrossPillarShort, [
|
|
["Road", "IntersectionCross"],
|
|
["Pillar", "SurfacePillarShort"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("2af8aa6050028dd6ee69b7150e83a6d8819e1848a7b1c782848d3f6448c5091a", F_.RoadWide, mu.ToWideMiddle, [
|
|
["RoadWide", "ToWideMiddle"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("26341cfe6bec34f46b10ffcd9a7706a8156b9ac41ed2cdfd166f9f8d3e9bc8f3", F_.RoadWide, mu.ToWideLeft, [
|
|
["RoadWide", "ToWideSide", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("3f82ebd6c72110b532a20673f8b54c7b25ae5988a51d3793bf383fea8ffcffc3", F_.RoadWide, mu.ToWideRight, [
|
|
["RoadWide", "ToWideSide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("f5cecce9870f41f8cba7a9fbe631c315370a7a82824d04977ec857dbb1dfed29", F_.RoadWide, mu.ToWideDouble, [
|
|
["RoadWide", "ToWideDouble"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("99dc726611397f81b47459d32c7bfb8232322d1ca976ba9a3e71cc15451d8cfb", F_.RoadWide, mu.ToWideDiagonal, [
|
|
["RoadWide", "ToWideDiagonal"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("47d7e3fb334681911e122babef127881a36a763fb22176854114495802d5ce84", F_.RoadWide, mu.StraightWide, [
|
|
["RoadWide", "StraightWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("521adc95ed5a4809eeff7eec872c3d6449e4d6a7e4941d672f1e06a50a6615de", F_.RoadWide, mu.InnerCornerWide, [
|
|
["RoadWide", "InnerCornerWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("d82274b362794e3c1772510002d5015dde345f1e72dd675c8bac41cf2331398b", F_.RoadWide, mu.OuterCornerWide, [
|
|
["RoadWide", "OuterCornerWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("9b1df4dd4687404adb5789f3b90af39ea6fa65ef741a07b116dc436dc14a2aa1", F_.RoadWide, mu.SlopeUpLeftWide, [
|
|
["RoadWide", "SlopeUpWide", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, -2]
|
|
]
|
|
]), new X_("651d4e988913b84359ad10e0c4745965b6a388eaa8c9bfbba4b6a50ae6d4f592", F_.RoadWide, mu.SlopeUpRightWide, [
|
|
["RoadWide", "SlopeUpWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, -2]
|
|
]
|
|
]), new X_("848d9930c58e66152090d7853af87c8bb7971e1771d3c337ac1a50aaa4975a78", F_.RoadWide, mu.SlopeUpLongLeftWide, [
|
|
["RoadWide", "SlopeUpLongWide", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -4],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -5],
|
|
[1, 1, -4]
|
|
],
|
|
[
|
|
[-2, 1, -6],
|
|
[1, 2, -6]
|
|
]
|
|
]), new X_("e4d54c6c3b6011a1acfb6766b6b3e7ea0de6f9c6569a5ec88c47968ad4105b2a", F_.RoadWide, mu.SlopeUpLongRightWide, [
|
|
["RoadWide", "SlopeUpLongWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -4],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -5],
|
|
[1, 1, -4]
|
|
],
|
|
[
|
|
[-2, 1, -6],
|
|
[1, 2, -6]
|
|
]
|
|
]), new X_("106ad1d4c5aded30cc3ef4cd1bdc40babab84464ce7dbce3b81cc20d55fd615f", F_.RoadWide, mu.SlopeDownLeftWide, [
|
|
["RoadWide", "SlopeDownWide", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, 0],
|
|
[1, 1, 1]
|
|
]
|
|
]), new X_("23a693633b8453c7a531de9723e6ca14d0676b1d7a4df7f78278914467b90a27", F_.RoadWide, mu.SlopeDownRightWide, [
|
|
["RoadWide", "SlopeDownWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, 0],
|
|
[1, 1, 1]
|
|
]
|
|
]), new X_("0f2e33a8b68667e30e80ceaefdb890a77643799d63c7f20672ca3185bbc04270", F_.RoadWide, mu.SlopeDownLongLeftWide, [
|
|
["RoadWide", "SlopeDownLongWide", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, 5]
|
|
],
|
|
[
|
|
[-2, 2, 3],
|
|
[1, 2, 5]
|
|
]
|
|
]), new X_("164903518c7efa4890a792017ea2b8125a2c3dae76bba4c6f1f56fb0f7e40ebc", F_.RoadWide, mu.SlopeDownLongRightWide, [
|
|
["RoadWide", "SlopeDownLongWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, 5]
|
|
],
|
|
[
|
|
[-2, 2, 3],
|
|
[1, 2, 5]
|
|
]
|
|
]), new X_("c20560fd35288c5cc74af61834b9a56efaeacdde55eb793d400b7c5b97904993", F_.RoadWide, mu.SlopeLeftWide, [
|
|
["RoadWide", "SlopeWide", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
]
|
|
]), new X_("b6a26eb3cefee53d4deef24544e5b5c1ecd25e8e8bd7c3070c7947ada55c57c2", F_.RoadWide, mu.SlopeRightWide, [
|
|
["RoadWide", "SlopeWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
]
|
|
]), new X_("b598ff14bda99600434b24a619132fec4bffcc535483b9b57b0c8c09c1be1f1b", F_.RoadWide, mu.SlopeUpVerticalLeftWide, [
|
|
["RoadWide", "SlopeUpVerticalWide"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("4e0275d3a01eaca6ec5118b8b816ed292cb7172710cf9b7801068424ab684b22", F_.RoadWide, mu.SlopeUpVerticalRightWide, [
|
|
["RoadWide", "SlopeUpVerticalWide", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("896b47675cc2ff58494979168f6fd36c27c43da29aed6a52fdf80f054630166a", F_.Plane, mu.Plane, [
|
|
["Planes", "Plane"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("dc9afb98a8bb998d3b76c3563385e58c1749e56ff43fbc7577b1f57ba8360702", F_.Plane, mu.PlanePillarBottom, [
|
|
["Planes", "Plane"],
|
|
["Pillar", "SurfacePillarBottom"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("f59ad95edd26814236ab30b73f6f4f68003885ef150201a4ace14b832abcf438", F_.Plane, mu.PlanePillarShort, [
|
|
["Planes", "Plane"],
|
|
["Pillar", "SurfacePillarShort"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("48247a66b232461083fa2aa36644e7e8779f5b426d474efd375ee7d21d009c9a", F_.Plane, mu.HalfPlane, [
|
|
["Planes", "HalfPlane"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, 0],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-1, 0, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-2, 0, -2]
|
|
]
|
|
]), new X_("eac8530d1a025291674bf34b206f75700dc8626012d8d33ed398f7aed746dac8", F_.Plane, mu.QuarterPlane, [
|
|
["Planes", "QuarterPlane"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[-2, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-2, 0, -2]
|
|
]
|
|
]), new X_("1da4dcad366aa90a5977e1b20c5d79297106ed3b4f664be04b6b3f6370c105b4", F_.Plane, mu.PlaneSlopeUp, [
|
|
["Planes", "PlaneSlopeUp"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, -2]
|
|
]
|
|
]), new X_("3e203219ec0ea114da510b37a4c392b90417af796e2b089da6d996e628c0a323", F_.Plane, mu.PlaneSlopeUpLong, [
|
|
["Planes", "PlaneSlopeUpLong"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -4],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -5],
|
|
[1, 1, -4]
|
|
],
|
|
[
|
|
[-2, 1, -6],
|
|
[1, 2, -6]
|
|
]
|
|
]), new X_("053dbf6c03eea5102b67168ccb479d8364233b36c4210aff093928bbb83d859d", F_.Plane, mu.PlaneSlopeDown, [
|
|
["Planes", "PlaneSlopeDown"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, 0],
|
|
[1, 1, 1]
|
|
]
|
|
]), new X_("d68121a3cb0ee19cab45adb136e0df6145f43ca9ecbde8a417c02a6d4a75a757", F_.Plane, mu.PlaneSlopeDownLong, [
|
|
["Planes", "PlaneSlopeDownLong"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, 5]
|
|
],
|
|
[
|
|
[-2, 2, 3],
|
|
[1, 2, 5]
|
|
]
|
|
]), new X_("67ec222e8fe770a8d728bb76ff571377c261d2f232134d4cb328c9ab772cf3ca", F_.Plane, mu.PlaneSlope, [
|
|
["Planes", "PlaneSlope"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
]
|
|
]), new X_("a52c09d87d37088b68420db07626f274c74f792cb223764624d887a5ed145a2e", F_.Plane, mu.PlaneSlopePillar, [
|
|
["Planes", "PlaneSlope"],
|
|
["Pillar", "PillarTopSlope"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
],
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, -1]
|
|
]
|
|
]), new X_("57df805433e706ec946d767d7ff0881f163c2e36bb1db00b0e3259954a787dec", F_.Plane, mu.PlaneSlopePillarShort, [
|
|
["Planes", "PlaneSlope"],
|
|
["Pillar", "PillarShortSlope"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -2]
|
|
],
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, -1]
|
|
]
|
|
]), new X_("ba0d6ec33647740bf4c60e542d1758095afa3ef451bdaec76c783dd32116e4cb", F_.Plane, mu.PlaneSlopeVerticalBottom, [
|
|
["Planes", "PlaneSlopeVertical"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("78a372de15f3151f901cf7fa7a3983ee6513cf19fa8568f10946e195c5a62515", F_.Plane, mu.PlaneSlopeToVertical, [
|
|
["Planes", "PlaneSlopeToVertical"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("5f6d1ece085d450643f1399af53673dcc6bbbf413094d8dd5ee6816d80e1c8ae", F_.Plane, mu.PlaneBridge, [
|
|
["Planes", "PlaneBridge"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 1]
|
|
]
|
|
]), new X_("32b91fc4cdf95f5b7a490d81058522bae14741601dd44c73cc110121aa1dd6e6", F_.Plane, mu.PlaneBridgeCorner, [
|
|
["Planes", "PlaneBridgeCorner"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("2db870b1821fb655437bd0527569d5a6843718fa0775682701437432265a1a88", F_.Plane, mu.PlaneBridgeIntersectionT, [
|
|
["Planes", "PlaneBridgeIntersectionT"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
]
|
|
]), new X_("33aa0e7524b74dcdae4aed89856c09d25248c4cab8f70dcc31b347f0a00fcb52", F_.Plane, mu.PlaneBridgeIntersectionCross, [
|
|
["Planes", "PlaneBridgeIntersectionCross"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, -2]
|
|
]
|
|
]), new X_("bd7cc4ab180fc0a6936fef828ae3a91566b3dd621b888fbcc57c9ac11dcb713b", F_.Plane, mu.PlaneWall, [
|
|
["Planes", "PlaneWall"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("d92568164028bb2e65799abd9dc6ba66cfe8a28515c09fbe5ac175f5966af66a", F_.Plane, mu.PlaneWallCorner, [
|
|
["Planes", "PlaneWallCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -2],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("792ab5a6f0e2bf8e556575ef12731ec30755855d4394f98eb4ca7ec8b713933c", F_.Plane, mu.PlaneWallInnerCorner, [
|
|
["Planes", "PlaneWallInnerCorner"]
|
|
], G_, [
|
|
[
|
|
[1, 0, 1],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("de0d588c4b2fe6b32d72a7e0e2984285955f805ccb86d3c269f7155401cd6b20", F_.Block, mu.Block, [
|
|
["Blocks", "Block"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("1ce6b585c0e99d71877fefe015ff16336ae62eb0caebeca62dd09d836092d7b6", F_.Block, mu.HalfBlock, [
|
|
["Blocks", "HalfBlock"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, 0],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-1, 0, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-2, 0, -2]
|
|
]
|
|
]), new X_("0d5f0609c3c98f687d55d3a73313225c1642f6285ddaca3ed536db742c85958d", F_.Block, mu.QuarterBlock, [
|
|
["Blocks", "QuarterBlock"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[-2, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-2, 0, -2]
|
|
]
|
|
]), new X_("18fc1c569c6fc04f95f10174143d19e7a9ea4e387302363f4ae60883c1acd3f0", F_.Block, mu.BlockSlopedDown, [
|
|
["Blocks", "BlockSlopedDown"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 1]
|
|
]
|
|
]), new X_("22dd5b2804c88994a4d283cb822f47de3c72f82376e4c9332d39feae85206c0f", F_.Block, mu.BlockSlopedDownInnerCorner, [
|
|
["Blocks", "BlockSlopedDownInnerCorner"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[-1, 0, 1]
|
|
],
|
|
[
|
|
[0, 0, -2],
|
|
[1, 0, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 1]
|
|
]
|
|
]), new X_("81a71b4cc6ef8520f20fd738457abc31b04258c97f9862f70190fd2a0ba91382", F_.Block, mu.BlockSlopedDownOuterCorner, [
|
|
["Blocks", "BlockSlopedDownOuterCorner"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[-1, 0, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 1]
|
|
]
|
|
]), new X_("f4e19d3bc49994a85fecd187b76c21d258e7f30f0506d90bc6f173336e11627d", F_.Block, mu.BlockSlopedUp, [
|
|
["Blocks", "BlockSlopedUp"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, -1]
|
|
]
|
|
]), new X_("fd9309468e97131bbbd1404fac34a7137cb176327789b955c1aea30267e1cded", F_.Block, mu.BlockSlopedUpInnerCorner, [
|
|
["Blocks", "BlockSlopedUpInnerCorner"]
|
|
], Q_, [
|
|
[
|
|
[-2, 1, -2],
|
|
[-1, 1, 1]
|
|
],
|
|
[
|
|
[0, 1, -2],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("1321fb07ece1b80b99dc4671b52673ac028fbf43322e9e652ad633ff6afac21b", F_.Block, mu.BlockSlopedUpOuterCorner, [
|
|
["Blocks", "BlockSlopedUpOuterCorner"]
|
|
], Q_, [
|
|
[
|
|
[-2, 1, -2],
|
|
[-1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("b97c17388fc38139f2f5a98a36d94831095f79db709dd97748ad2904bc54d689", F_.Block, mu.BlockSlopeDown, [
|
|
["Blocks", "BlockSlopeDown"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("50276826bbfb9fcb11a8519b8dae8a2b1cf82817d5431418d9a376664261be82", F_.Block, mu.BlockSlopeUp, [
|
|
["Blocks", "BlockSlopeUp"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("63fd3032796397f8e25669c1c1d3fc97b8ec0e5fc88bfcb5c00a2a2c2b517888", F_.Block, mu.BlockSlopeDownLong, [
|
|
["Blocks", "BlockSlopeDownLong"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 5]
|
|
],
|
|
[
|
|
[-2, 1, 0],
|
|
[1, 1, 5]
|
|
]
|
|
]), new X_("2d29131222a8d891b4350e6a2f335b114e001cf22e4e2f170dc9b86c4b2fd325", F_.Block, mu.BlockSlopeUpLong, [
|
|
["Blocks", "BlockSlopeUpLong"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -6],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -6],
|
|
[1, 1, -4]
|
|
]
|
|
]), new X_("0bbcd96c91b69e6e8005bfae5b64455b0d6510cb1595f3fca7f77c86ddda4560", F_.Block, mu.BlockSlopeVerticalTop, [
|
|
["Blocks", "BlockSlopeVertical", {
|
|
flipY: !0
|
|
}]
|
|
], Q_, [
|
|
[
|
|
[-2, 3, -2],
|
|
[1, 3, 1]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 2, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 1, -2]
|
|
]
|
|
]), new X_("e81a123c0be3f8f168fb584d53e8aa038785569bbf2cd1c1cead2272889591e0", F_.Block, mu.BlockSlopeVerticalBottom, [
|
|
["Blocks", "BlockSlopeVertical"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("94e14468f31af7f39b9d7ba188a364089ae81da2bd6a9db2b8f5b1b8cedce741", F_.Block, mu.BlockSlopeToVertical, [
|
|
["Blocks", "BlockSlopeToVertical"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("3a2f05b1c2c2fd976997fa473f1adb3ba14495701dc5a998f8697798384c6946", F_.Block, mu.BlockSlopeVerticalCornerTop, [
|
|
["Blocks", "BlockSlopeVerticalCornerBottom", {
|
|
flipY: !0
|
|
}]
|
|
], Q_, [
|
|
[
|
|
[-2, 3, -2],
|
|
[1, 3, 1]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[0, 2, 0]
|
|
],
|
|
[
|
|
[1, 2, -2],
|
|
[1, 2, -1]
|
|
],
|
|
[
|
|
[-2, 2, 1],
|
|
[-1, 2, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[-1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 1, 0],
|
|
[-1, 1, 0]
|
|
],
|
|
[
|
|
[0, 1, -2],
|
|
[0, 1, -1]
|
|
],
|
|
[
|
|
[1, 1, -2],
|
|
[1, 1, -2]
|
|
],
|
|
[
|
|
[-2, 1, 1],
|
|
[-2, 1, 1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-1, 0, -1]
|
|
],
|
|
[
|
|
[-2, 0, 0],
|
|
[-2, 0, 1]
|
|
],
|
|
[
|
|
[0, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("3e4fa43e69aa1dbee584e16451a95a16229bba8d638df2bf6f6c9ffb3a9629c9", F_.Block, mu.BlockInnerCorner, [
|
|
["Blocks", "BlockInnerCorner"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[-2, 0, 1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-1, 0, -1]
|
|
],
|
|
[
|
|
[0, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("cc9c95eef56def4cf013e4ac85b8013a2b4f4b4346f1f5dd41fa017de763ef17", F_.Block, mu.BlockSlopeVerticalCornerBottom, [
|
|
["Blocks", "BlockSlopeVerticalCornerBottom"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[0, 1, 0]
|
|
],
|
|
[
|
|
[1, 1, -2],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 1, 1],
|
|
[-1, 1, 1]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[-1, 2, -1]
|
|
],
|
|
[
|
|
[-2, 2, 0],
|
|
[-1, 2, 0]
|
|
],
|
|
[
|
|
[0, 2, -2],
|
|
[0, 2, -1]
|
|
],
|
|
[
|
|
[1, 2, -2],
|
|
[1, 2, -2]
|
|
],
|
|
[
|
|
[-2, 2, 1],
|
|
[-2, 2, 1]
|
|
],
|
|
[
|
|
[-2, 3, -2],
|
|
[-1, 3, -1]
|
|
],
|
|
[
|
|
[-2, 3, 0],
|
|
[-2, 3, 1]
|
|
],
|
|
[
|
|
[0, 3, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("e4c82c8e512d52269cb6588fa34b06c179340ea40e71f74cbadadc7e8353f5a2", F_.Block, mu.BlockSlopeVerticalInnerCornerTop, [
|
|
["Blocks", "BlockSlopeVerticalInnerCorner", {
|
|
flipY: !0
|
|
}]
|
|
], Q_, [
|
|
[
|
|
[-2, 3, -2],
|
|
[0, 3, 1]
|
|
],
|
|
[
|
|
[1, 3, -2],
|
|
[1, 3, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[-2, 2, -1]
|
|
],
|
|
[
|
|
[-1, 2, -2],
|
|
[-1, 2, -2]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-2, 1, -2]
|
|
]
|
|
]), new X_("926fdc6e82ecd709cc535faea6bb8778c6e2e91edb39eb6ae6308076dca2ed18", F_.Block, mu.BlockSlopeVerticalInnerCornerBottom, [
|
|
["Blocks", "BlockSlopeVerticalInnerCorner"]
|
|
], Q_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[0, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -2],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[-2, 1, -1]
|
|
],
|
|
[
|
|
[-1, 1, -2],
|
|
[-1, 1, -2]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[-2, 3, -2]
|
|
]
|
|
]), new X_("1086515ba3c1d8e5ec76b378f0bdbc77fc5a57fc8eba8972f0d5e611be945235", F_.Block, mu.BlockBridge, [
|
|
["Blocks", "BlockBridge"]
|
|
], Q_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 1]
|
|
]
|
|
]), new X_("5426ad4ff64af3f1a0f0794ad30cfc20434dfffdf44d93010f5f98671c246ff3", F_.Block, mu.BlockBridgeCorner, [
|
|
["Blocks", "BlockBridgeCorner"]
|
|
], Q_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("784b9b4459e838e5b8f74f6250769ffa52ec5cc3608abc24c380a2e792c3d338", F_.Block, mu.BlockBridgeIntersectionT, [
|
|
["Blocks", "BlockBridgeIntersectionT"]
|
|
], Q_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
]
|
|
]), new X_("dfbcbc107a3c12217bfa3b224a5757d08e995705d1c122bb2c2665bbb8447b1c", F_.Block, mu.BlockBridgeIntersectionCross, [
|
|
["Blocks", "BlockBridgeIntersectionCross"]
|
|
], Q_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 1]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, -2]
|
|
]
|
|
]), new X_("5fe53442e559418b7cc9483315b0ac45b8797f9630d5ecc4c7604dab4be25584", F_.WallTrack, mu.WallTrackTop, [
|
|
["WallTrack", "WallTrackBottom", {
|
|
flipY: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 3, -1],
|
|
[1, 3, 1]
|
|
],
|
|
[
|
|
[-2, 2, -1],
|
|
[1, 2, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 2, -2]
|
|
]
|
|
]), new X_("010d187fbfbd399bfe880bbea1b548678c239eba0be2913e5cb8a69fbd17adf7", F_.WallTrack, mu.WallTrackMiddle, [
|
|
["WallTrack", "WallTrackMiddle"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("33216a4dcb734511a80c5bf70ca6f66de555800426686eae5a2519d4c837090e", F_.WallTrack, mu.WallTrackBottom, [
|
|
["WallTrack", "WallTrackBottom"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("1e306d2a6347b68d6e275bf4ccc9c8942e0a633bf625a3bba95fa9f98ecd50ff", F_.WallTrack, mu.WallTrackSlopeToVertical, [
|
|
["WallTrack", "WallTrackSlopeToVertical"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 0],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[1, 1, 0]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[1, 3, -2]
|
|
]
|
|
]), new X_("3ed21ddbc756a6644e05f5e1ca78ff8df6d51affc472c2d86e7f23d85911e273", F_.WallTrack, mu.WallTrackTopCorner, [
|
|
["WallTrack", "WallTrackBottomCorner", {
|
|
flipY: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -1],
|
|
[-1, 0, -1]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[1, 0, -2]
|
|
],
|
|
[
|
|
[-2, 1, -1],
|
|
[-2, 1, 1]
|
|
],
|
|
[
|
|
[-1, 1, -1],
|
|
[-1, 1, 0]
|
|
],
|
|
[
|
|
[0, 1, -1],
|
|
[0, 1, -1]
|
|
],
|
|
[
|
|
[-1, 1, -2],
|
|
[1, 1, -2]
|
|
],
|
|
[
|
|
[-2, 2, 0],
|
|
[-2, 2, 1]
|
|
],
|
|
[
|
|
[-1, 2, 1],
|
|
[-1, 2, 1]
|
|
],
|
|
[
|
|
[-1, 2, -1],
|
|
[0, 2, 0]
|
|
],
|
|
[
|
|
[1, 2, -1],
|
|
[1, 2, -1]
|
|
],
|
|
[
|
|
[0, 2, -2],
|
|
[1, 2, -2]
|
|
],
|
|
[
|
|
[0, 3, -1],
|
|
[1, 3, 1]
|
|
],
|
|
[
|
|
[-1, 3, 0],
|
|
[-1, 3, 1]
|
|
]
|
|
]), new X_("4027a2439cc3e42ceda50ff3d427a31e127b25a6457b55edc2d498b474a296a7", F_.WallTrack, mu.WallTrackMiddleCorner, [
|
|
["WallTrack", "WallTrackMiddleCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -1],
|
|
[-1, 0, -1]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("498286e062056a537a482ed3385fe0ac0343b399f29d470641df8f74c0532672", F_.WallTrack, mu.WallTrackBottomCorner, [
|
|
["WallTrack", "WallTrackBottomCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 3, -1],
|
|
[-2, 3, 1]
|
|
],
|
|
[
|
|
[-1, 3, -1],
|
|
[-1, 3, -1]
|
|
],
|
|
[
|
|
[-1, 3, -2],
|
|
[1, 3, -2]
|
|
],
|
|
[
|
|
[-2, 2, -1],
|
|
[-2, 2, 1]
|
|
],
|
|
[
|
|
[-1, 2, -1],
|
|
[-1, 2, 0]
|
|
],
|
|
[
|
|
[0, 2, -1],
|
|
[0, 2, -1]
|
|
],
|
|
[
|
|
[-1, 2, -2],
|
|
[1, 2, -2]
|
|
],
|
|
[
|
|
[-2, 1, 0],
|
|
[-2, 1, 1]
|
|
],
|
|
[
|
|
[-1, 1, 1],
|
|
[-1, 1, 1]
|
|
],
|
|
[
|
|
[-1, 1, -1],
|
|
[0, 1, 0]
|
|
],
|
|
[
|
|
[1, 1, -1],
|
|
[1, 1, -1]
|
|
],
|
|
[
|
|
[0, 1, -2],
|
|
[1, 1, -2]
|
|
],
|
|
[
|
|
[0, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, 0],
|
|
[-1, 0, 1]
|
|
]
|
|
]), new X_("ac09cd62c83af376f23d37dd88273614a2a11cc04a04bff6075fd749bb1ff421", F_.WallTrack, mu.WallTrackTopInnerCorner, [
|
|
["WallTrack", "WallTrackBottomInnerCorner", {
|
|
flipY: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 3, -1],
|
|
[1, 3, 1]
|
|
],
|
|
[
|
|
[-1, 3, -2],
|
|
[1, 3, -2]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[-1, 2, -1]
|
|
],
|
|
[
|
|
[-2, 0, -2],
|
|
[-2, 1, -2]
|
|
]
|
|
]), new X_("16c9c8ece47c097f60cfc7f8a2daa2f0e7ad0befb0ebfd185402013fd1ec8e0f", F_.WallTrack, mu.WallTrackInnerCorner, [
|
|
["WallTrack", "WallTrackInnerCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[-2, 0, -2]
|
|
]
|
|
]), new X_("404e7506c2f7e9302acac39c31a659e7e09e7852786e5f0244f9827727a0bf1e", F_.WallTrack, mu.WallTrackBottomInnerCorner, [
|
|
["WallTrack", "WallTrackBottomInnerCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[-1, 0, -2],
|
|
[1, 0, -2]
|
|
],
|
|
[
|
|
[-2, 1, -2],
|
|
[-1, 1, -1]
|
|
],
|
|
[
|
|
[-2, 2, -2],
|
|
[-2, 3, -2]
|
|
]
|
|
]), new X_("8b7023471502607ef19109760bee3b954ea3b3883c32f3960f75c6651c912ffd", F_.WallTrack, mu.WallTrackFloor, [
|
|
["WallTrack", "WallTrackFloor"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("59e7f31827236c71db8b16f3f1f259c4c82c87a37e4d57a5a097c0d527d128f3", F_.WallTrack, mu.WallTrackFloorCorner, [
|
|
["WallTrack", "WallTrackFloorCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[0, 0, 0],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -2],
|
|
[1, 0, -1]
|
|
]
|
|
]), new X_("d58e3805b550b70940c845a807086865b21a4c36da74ffddedcfe5ce2d08e093", F_.WallTrack, mu.WallTrackFloorPlaneCorner, [
|
|
["WallTrack", "WallTrackFloorPlaneCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[0, 0, 0],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -2],
|
|
[1, 0, -1]
|
|
]
|
|
]), new X_("a56b0c1cf964b213a38167cbbac6f33acd403978ad75746eb51bcfd8c6a36148", F_.WallTrack, mu.WallTrackCeiling, [
|
|
["WallTrack", "WallTrackCeiling"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, 1]
|
|
]
|
|
]), new X_("f87b592d02120312e8e93d8a27c02dcda1095ac2f09879c6efafb2ca2b49d127", F_.WallTrack, mu.WallTrackCeilingCorner, [
|
|
["WallTrack", "WallTrackCeilingCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[0, 0, 0],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -2],
|
|
[1, 0, -1]
|
|
]
|
|
]), new X_("cfce1fe50f8cd26393eadd475783830e02f0b39bad4c0e00f7aa69614b22decc", F_.WallTrack, mu.WallTrackCeilingPlaneCorner, [
|
|
["WallTrack", "WallTrackCeilingPlaneCorner"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, 1],
|
|
[1, 0, 1]
|
|
],
|
|
[
|
|
[0, 0, 0],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -2],
|
|
[1, 0, -1]
|
|
]
|
|
]), new X_("19656d02145f1a4ba07dbf2f236f865d34c86f823741b247b5d444a36d61c316", F_.Pillar, mu.PillarTop, [
|
|
["Pillar", "PillarTop"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("dde596d55ffc00f0f00d361667239d9f71c414f03304fecb6a7d11f6f5e702f1", F_.Pillar, mu.PillarMiddle, [
|
|
["Pillar", "PillarMiddle"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("dced5202d9373f9dd81a39530a87a1a7036c93ae71604a4e26c3a191abf3c197", F_.Pillar, mu.PillarBottom, [
|
|
["Pillar", "PillarBottom"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("af83eebf50c302880377e4f8c1fb3b2ef96ae193e8d03c17e1fd77c73a847e63", F_.Pillar, mu.PillarShort, [
|
|
["Pillar", "PillarShort"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -1],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("25b41116fb04b1f3cdd3119f57e0000a6ea8cb12d435718ffd6bb765866c272f", F_.Pillar, mu.PillarBranch1, [
|
|
["Pillar", "PillarBranch1"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("05ae39aea4f1ddd818fa57860e688c9cb875544f9b82eafe58a2eb9c19d8d91d", F_.Pillar, mu.PillarBranch1Top, [
|
|
["Pillar", "PillarBranch1Top"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("06c29d92e42e0c32050af98d69eecc94ce15adf8ac81dbe53dfb577a83265f4e", F_.Pillar, mu.PillarBranch1Middle, [
|
|
["Pillar", "PillarBranch1Middle"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("4a989027e0bd6db264f092bac729d9d450e012a710ea28d199f7ff52efd70fbd", F_.Pillar, mu.PillarBranch1Bottom, [
|
|
["Pillar", "PillarBranch1Bottom"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
]
|
|
]), new X_("78b2ff83ad71e7f3d692abc35923fa20c2ae14c01e37d44ec430746ca1bac992", F_.Pillar, mu.PillarBranch2, [
|
|
["Pillar", "PillarBranch2"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("b22c93bc73ec2da9dbff218da1676d7436527ed284e264f37294e48ef1307301", F_.Pillar, mu.PillarBranch2Top, [
|
|
["Pillar", "PillarBranch2Top"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("79a456a8fa3da24bec6c033f6c736fa1c728745f9624ae78ca20b6a4a76afae8", F_.Pillar, mu.PillarBranch2Middle, [
|
|
["Pillar", "PillarBranch2Middle"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("3b81b3f965cbc9fda4fe09e830ba25f1b96ce512d87b0146a1192a6cd0d07335", F_.Pillar, mu.PillarBranch2Bottom, [
|
|
["Pillar", "PillarBranch2Bottom"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("27727678bbcac9d3b0172b165ca5c92b10f4b4584a3a18fef4c542f3e791f26f", F_.Pillar, mu.PillarBranch3, [
|
|
["Pillar", "PillarBranch3"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
]
|
|
]), new X_("50c7ac511d30ab9e065c928b776652f038be7683d948082bbefc419ee049e505", F_.Pillar, mu.PillarBranch3Top, [
|
|
["Pillar", "PillarBranch3Top"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
]
|
|
]), new X_("98b3bfe99e7132825f5aa93122e4e5fdec46eb2877c8eb91fa2648f709527b60", F_.Pillar, mu.PillarBranch3Middle, [
|
|
["Pillar", "PillarBranch3Middle"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
]
|
|
]), new X_("7326bbb558f8bcc28d5875c43b1b8e3646caadb873a14fde3ab517f779aea345", F_.Pillar, mu.PillarBranch3Bottom, [
|
|
["Pillar", "PillarBranch3Bottom"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
]
|
|
]), new X_("0e23c2615cfdb350bb3a700b6169589265a1d1079f61294fb497b8f80191d523", F_.Pillar, mu.PillarBranch4, [
|
|
["Pillar", "PillarBranch4"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
],
|
|
[
|
|
[-1, 0, 1],
|
|
[0, 0, 1]
|
|
]
|
|
]), new X_("e62b55e111dbcb3faefed0a203eac5b55051a2b11911946660310e3df3588da3", F_.Pillar, mu.PillarBranch4Top, [
|
|
["Pillar", "PillarBranch4Top"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
],
|
|
[
|
|
[-1, 0, 1],
|
|
[0, 0, 1]
|
|
]
|
|
]), new X_("4e2cfb89c1c591803a1440532a74c3ace37ec7fe78a526c1b57f6679c620df2e", F_.Pillar, mu.PillarBranch4Middle, [
|
|
["Pillar", "PillarBranch4Middle"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
],
|
|
[
|
|
[-1, 0, 1],
|
|
[0, 0, 1]
|
|
]
|
|
]), new X_("e7807350788e4570c8bb74d4a635639ef731d83e52922fac5bc10f415f73f794", F_.Pillar, mu.PillarBranch4Bottom, [
|
|
["Pillar", "PillarBranch4Bottom"]
|
|
], G_, [
|
|
[
|
|
[-1, 0, -2],
|
|
[0, 0, 0]
|
|
],
|
|
[
|
|
[1, 0, -1],
|
|
[1, 0, 0]
|
|
],
|
|
[
|
|
[-2, 0, -1],
|
|
[-2, 0, 0]
|
|
],
|
|
[
|
|
[-1, 0, 1],
|
|
[0, 0, 1]
|
|
]
|
|
]), new X_("836bfd12791bfebd99aba70531da4c9bd6e332d16c1e120a8888ea54f59456f9", F_.Pillar, mu.PillarBranch5, [
|
|
["Pillar", "PillarBranch5"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("ab85228116faf9ae7b1e6cb4a03530cbec808df3d3c1d7883eb41eb7cfe231d7", F_.Pillar, mu.PillarBranch5Top, [
|
|
["Pillar", "PillarBranch5Top"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("db93d5cea4e523fd67a56f8d928084ab6355331a8e5d1899115c1841866006bb", F_.Pillar, mu.PillarBranch5Middle, [
|
|
["Pillar", "PillarBranch5Middle"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("dd793efa234159e3a0ff28b064ecb715e6c8bb76e06acfe4bd0d9a2f2b9bba88", F_.Pillar, mu.PillarBranch5Bottom, [
|
|
["Pillar", "PillarBranch5Bottom"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -1],
|
|
[1, 0, 0]
|
|
]
|
|
]), new X_("350f7d3591ffd0b2cfb8204d1c6cd0022fd3bda81ea7e950fce3abea7ec89e1a", F_.Sign, mu.SignArrowLeft, [
|
|
["Signs", "SignArrowRight", {
|
|
flipX: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("22e104e58bba0a609d379578e391ce50ca523c9eee1c3fddebb6d1bb2246a0b9", F_.Sign, mu.SignArrowRight, [
|
|
["Signs", "SignArrowRight"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("acba0cfe380e625285b973e09344e61740e77d6f8cac8691ef3e0a0b0878040e", F_.Sign, mu.SignArrowUp, [
|
|
["Signs", "SignArrowUp"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("8d0dbea0a26bdf3addd372f5d9a2fdecfd776a48f31218acdeb036129b248ca5", F_.Sign, mu.SignArrowDown, [
|
|
["Signs", "SignArrowUp", {
|
|
flipY: !0
|
|
}]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("e5e1b1ca69d7b230331171be07876c4b1bdebba557c19b18ab17d91eee2771d5", F_.Sign, mu.SignWarning, [
|
|
["Signs", "SignWarning"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
]), new X_("64ed1fba4990a25bc774575ff8835117638d2c3e7c8f41bf0032d219e1083e4c", F_.Sign, mu.SignWrongWay, [
|
|
["Signs", "SignWrongWay"]
|
|
], G_, [
|
|
[
|
|
[-2, 0, -2],
|
|
[1, 0, -2]
|
|
]
|
|
])],
|
|
q_ = new Map;
|
|
for (const e of j_) {
|
|
if (q_.has(e.id)) throw new Error("Duplicate track part id " + e.id.toString());
|
|
q_.set(e.id, e)
|
|
}
|
|
|
|
function Y_(e) {
|
|
const t = q_.get(e);
|
|
if (null == t) throw new Error("Unknown track part id " + e.toString());
|
|
return t
|
|
}
|
|
const K_ = j_.filter((e => {
|
|
var t;
|
|
return (null === (t = e.detector) || void 0 === t ? void 0 : t.type) == Jh.Checkpoint
|
|
})).map((e => e.id)),
|
|
Z_ = j_.filter((e => null != e.startOffset)).map((e => e.id));
|
|
|
|
function J_(e) {
|
|
const t = e.parts;
|
|
if ("object" != typeof t && null !== t && !Array.isArray(t)) return null;
|
|
const n = new Pv(L_.Summer, new B_),
|
|
i = Object.keys(t);
|
|
for (const e of i) {
|
|
const i = parseInt(e, 10);
|
|
if (!(i in mu)) return null;
|
|
{
|
|
const e = t[i];
|
|
if (!Array.isArray(e)) return null;
|
|
if (e.length % 4 != 0) return null;
|
|
for (let t = 0; t < e.length; t += 4) {
|
|
const r = parseInt(e[t + 0], 10),
|
|
a = parseInt(e[t + 1], 10),
|
|
s = parseInt(e[t + 2], 10),
|
|
o = parseInt(e[t + 3], 10);
|
|
if (isNaN(r) || isNaN(a) || isNaN(s) || isNaN(o)) return null;
|
|
if (!(o >= 0 && o <= 3 && Math.abs(r) <= 1e9 && a >= 0 && a <= 1e9 && Math.abs(s) <= 1e9)) return null;
|
|
{
|
|
if (K_.includes(i)) return null;
|
|
let e = null;
|
|
Z_.includes(i) && (e = 0), n.addPart(4 * r, a, 4 * s, i, o, Au.YPositive, k_.Default, null, e)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return n
|
|
}
|
|
|
|
function $_(e) {
|
|
const t = fh(e);
|
|
if (null == t) return null;
|
|
const n = new Pv(L_.Summer, new B_);
|
|
let i = 0;
|
|
for (; i < t.length;) {
|
|
if (t.length - i < 2) return null;
|
|
const e = t[i + 0] | t[i + 1] << 8;
|
|
if (i += 2, !(e in mu)) return null;
|
|
if (t.length - i < 4) return null;
|
|
const r = t[i + 0] | t[i + 1] << 8 | t[i + 2] << 16 | t[i + 3] << 24;
|
|
i += 4;
|
|
for (let a = 0; a < r; ++a) {
|
|
if (t.length - i < 3) return null;
|
|
const r = (t[i + 0] | t[i + 1] << 8 | t[i + 2] << 16) - Math.pow(2, 23);
|
|
if (i += 3, t.length - i < 3) return null;
|
|
const a = t[i + 0] | t[i + 1] << 8 | t[i + 2] << 16;
|
|
if (i += 3, t.length - i < 3) return null;
|
|
const s = (t[i + 0] | t[i + 1] << 8 | t[i + 2] << 16) - Math.pow(2, 23);
|
|
if (i += 3, t.length - i < 1) return null;
|
|
const o = 3 & t[i + 0];
|
|
if (i += 1, o < 0 || o > 3) return null;
|
|
if (K_.includes(e)) return null;
|
|
let l = null;
|
|
Z_.includes(e) && (l = 0), n.addPart(4 * r, a, 4 * s, e, o, Au.YPositive, k_.Default, null, l)
|
|
}
|
|
}
|
|
return n
|
|
}
|
|
|
|
function ev(e) {
|
|
const t = S_(e);
|
|
if (null == t) return null;
|
|
const n = new dh.Inflate;
|
|
if (n.push(t, !0), n.err) return null;
|
|
const i = n.result;
|
|
if (!(i instanceof Uint8Array)) return null;
|
|
const r = new Pv(L_.Summer, new B_);
|
|
let a = 0;
|
|
for (; a < i.length;) {
|
|
if (i.length - a < 2) return null;
|
|
const e = i[a + 0] | i[a + 1] << 8;
|
|
if (a += 2, !(e in mu)) return null;
|
|
if (i.length - a < 4) return null;
|
|
const t = i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16 | i[a + 3] << 24;
|
|
a += 4;
|
|
for (let n = 0; n < t; ++n) {
|
|
if (i.length - a < 3) return null;
|
|
const t = (i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16) - Math.pow(2, 23);
|
|
if (a += 3, i.length - a < 3) return null;
|
|
const n = i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16;
|
|
if (a += 3, i.length - a < 3) return null;
|
|
const s = (i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16) - Math.pow(2, 23);
|
|
if (a += 3, i.length - a < 1) return null;
|
|
const o = i[a + 0];
|
|
if (a += 1, o < 0 || o > 3) return null;
|
|
let l = null;
|
|
if (K_.includes(e)) {
|
|
if (i.length - a < 2) return null;
|
|
l = i[a + 0] | i[a + 1] << 8, a += 2
|
|
}
|
|
let c = null;
|
|
Z_.includes(e) && (c = 0), r.addPart(4 * t, n, 4 * s, e, o, Au.YPositive, k_.Default, l, c)
|
|
}
|
|
}
|
|
return r
|
|
}
|
|
|
|
function tv(e) {
|
|
const t = S_(e);
|
|
if (null == t) return null;
|
|
const n = new dh.Inflate;
|
|
if (n.push(t, !0), n.err) return null;
|
|
const i = n.result;
|
|
if (!(i instanceof Uint8Array)) return null;
|
|
const r = new Pv(L_.Summer, new B_);
|
|
let a = 0;
|
|
for (; a < i.length;) {
|
|
if (i.length - a < 2) return null;
|
|
let e = i[a + 0] | i[a + 1] << 8;
|
|
a += 2;
|
|
let t = k_.Default;
|
|
if (e >= 134 && e <= 178) switch (e) {
|
|
case 134:
|
|
e = mu.Block, t = k_.Custom1;
|
|
break;
|
|
case 135:
|
|
e = mu.HalfBlock, t = k_.Custom1;
|
|
break;
|
|
case 136:
|
|
e = mu.QuarterBlock, t = k_.Custom1;
|
|
break;
|
|
case 137:
|
|
e = mu.BlockSlopedDown, t = k_.Custom1;
|
|
break;
|
|
case 138:
|
|
e = mu.BlockSlopedDownInnerCorner, t = k_.Custom1;
|
|
break;
|
|
case 139:
|
|
e = mu.BlockSlopedDownOuterCorner, t = k_.Custom1;
|
|
break;
|
|
case 140:
|
|
e = mu.BlockSlopedUp, t = k_.Custom1;
|
|
break;
|
|
case 141:
|
|
e = mu.BlockSlopedUpInnerCorner, t = k_.Custom1;
|
|
break;
|
|
case 142:
|
|
e = mu.BlockSlopedUpOuterCorner, t = k_.Custom1;
|
|
break;
|
|
case 143:
|
|
e = mu.BlockSlopeDown, t = k_.Custom1;
|
|
break;
|
|
case 144:
|
|
e = mu.BlockSlopeUp, t = k_.Custom1;
|
|
break;
|
|
case 145:
|
|
e = mu.BlockBridge, t = k_.Custom1;
|
|
break;
|
|
case 146:
|
|
e = mu.BlockBridgeCorner, t = k_.Custom1;
|
|
break;
|
|
case 147:
|
|
e = mu.BlockBridgeIntersectionT, t = k_.Custom1;
|
|
break;
|
|
case 148:
|
|
e = mu.BlockBridgeIntersectionCross, t = k_.Custom1;
|
|
break;
|
|
case 149:
|
|
e = mu.Block, t = k_.Custom6;
|
|
break;
|
|
case 150:
|
|
e = mu.HalfBlock, t = k_.Custom6;
|
|
break;
|
|
case 151:
|
|
e = mu.QuarterBlock, t = k_.Custom6;
|
|
break;
|
|
case 152:
|
|
e = mu.BlockSlopedDown, t = k_.Custom6;
|
|
break;
|
|
case 153:
|
|
e = mu.BlockSlopedDownInnerCorner, t = k_.Custom6;
|
|
break;
|
|
case 154:
|
|
e = mu.BlockSlopedDownOuterCorner, t = k_.Custom6;
|
|
break;
|
|
case 155:
|
|
e = mu.BlockSlopedUp, t = k_.Custom6;
|
|
break;
|
|
case 156:
|
|
e = mu.BlockSlopedUpInnerCorner, t = k_.Custom6;
|
|
break;
|
|
case 157:
|
|
e = mu.BlockSlopedUpOuterCorner, t = k_.Custom6;
|
|
break;
|
|
case 158:
|
|
e = mu.BlockSlopeDown, t = k_.Custom6;
|
|
break;
|
|
case 159:
|
|
e = mu.BlockSlopeUp, t = k_.Custom6;
|
|
break;
|
|
case 160:
|
|
e = mu.BlockBridge, t = k_.Custom6;
|
|
break;
|
|
case 161:
|
|
e = mu.BlockBridgeCorner, t = k_.Custom6;
|
|
break;
|
|
case 162:
|
|
e = mu.BlockBridgeIntersectionT, t = k_.Custom6;
|
|
break;
|
|
case 163:
|
|
e = mu.BlockBridgeIntersectionCross, t = k_.Custom6;
|
|
break;
|
|
case 164:
|
|
e = mu.Block, t = k_.Custom0;
|
|
break;
|
|
case 165:
|
|
e = mu.HalfBlock, t = k_.Custom0;
|
|
break;
|
|
case 166:
|
|
e = mu.QuarterBlock, t = k_.Custom0;
|
|
break;
|
|
case 167:
|
|
e = mu.BlockSlopedDown, t = k_.Custom0;
|
|
break;
|
|
case 168:
|
|
e = mu.BlockSlopedDownInnerCorner, t = k_.Custom0;
|
|
break;
|
|
case 169:
|
|
e = mu.BlockSlopedDownOuterCorner, t = k_.Custom0;
|
|
break;
|
|
case 170:
|
|
e = mu.BlockSlopedUp, t = k_.Custom0;
|
|
break;
|
|
case 171:
|
|
e = mu.BlockSlopedUpInnerCorner, t = k_.Custom0;
|
|
break;
|
|
case 172:
|
|
e = mu.BlockSlopedUpOuterCorner, t = k_.Custom0;
|
|
break;
|
|
case 173:
|
|
e = mu.BlockSlopeDown, t = k_.Custom0;
|
|
break;
|
|
case 174:
|
|
e = mu.BlockSlopeUp, t = k_.Custom0;
|
|
break;
|
|
case 175:
|
|
e = mu.BlockBridge, t = k_.Custom0;
|
|
break;
|
|
case 176:
|
|
e = mu.BlockBridgeCorner, t = k_.Custom0;
|
|
break;
|
|
case 177:
|
|
e = mu.BlockBridgeIntersectionT, t = k_.Custom0;
|
|
break;
|
|
case 178:
|
|
e = mu.BlockBridgeIntersectionCross, t = k_.Custom0
|
|
}
|
|
let n = null,
|
|
s = {
|
|
x: 0,
|
|
y: 0,
|
|
z: 0
|
|
};
|
|
if (79 == e) n = mu.WallTrackFloorPlaneCorner;
|
|
else if (81 == e) n = mu.WallTrackCeilingPlaneCorner, s = {
|
|
x: 0,
|
|
y: 3,
|
|
z: 0
|
|
};
|
|
else if (e >= 87 && e <= 98) switch (e) {
|
|
case 87:
|
|
e = mu.Slope, n = mu.BlockSlopedUp;
|
|
break;
|
|
case 88:
|
|
e = mu.SlopeUp, n = mu.BlockSlopeUp;
|
|
break;
|
|
case 89:
|
|
e = mu.SlopeDown, n = mu.BlockSlopeDown;
|
|
break;
|
|
case 90:
|
|
e = mu.SlopeUpLeftWide, n = mu.BlockSlopeUp;
|
|
break;
|
|
case 91:
|
|
e = mu.SlopeUpRightWide, n = mu.BlockSlopeUp;
|
|
break;
|
|
case 92:
|
|
e = mu.SlopeDownLeftWide, n = mu.BlockSlopeDown;
|
|
break;
|
|
case 93:
|
|
e = mu.SlopeDownRightWide, n = mu.BlockSlopeDown;
|
|
break;
|
|
case 94:
|
|
e = mu.SlopeLeftWide, n = mu.BlockSlopedUp;
|
|
break;
|
|
case 95:
|
|
e = mu.SlopeRightWide, n = mu.BlockSlopedUp;
|
|
break;
|
|
case 96:
|
|
e = mu.PlaneSlopeUp, n = mu.BlockSlopeUp;
|
|
break;
|
|
case 97:
|
|
e = mu.PlaneSlopeDown, n = mu.BlockSlopeDown;
|
|
break;
|
|
case 98:
|
|
e = mu.PlaneSlope, n = mu.BlockSlopedUp;
|
|
break;
|
|
default:
|
|
throw new Error("Invalid track part id")
|
|
}
|
|
if (!(e in mu)) return null;
|
|
if (i.length - a < 4) return null;
|
|
const o = i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16 | i[a + 3] << 24;
|
|
a += 4;
|
|
for (let l = 0; l < o; ++l) {
|
|
if (i.length - a < 3) return null;
|
|
const o = (i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16) - Math.pow(2, 23);
|
|
if (a += 3, i.length - a < 3) return null;
|
|
const l = i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16;
|
|
if (a += 3, i.length - a < 3) return null;
|
|
const c = (i[a + 0] | i[a + 1] << 8 | i[a + 2] << 16) - Math.pow(2, 23);
|
|
if (a += 3, i.length - a < 1) return null;
|
|
const h = i[a + 0];
|
|
if (a += 1, h < 0 || h > 3) return null;
|
|
let u = null;
|
|
if (K_.includes(e)) {
|
|
if (i.length - a < 2) return null;
|
|
u = i[a + 0] | i[a + 1] << 8, a += 2
|
|
}
|
|
let d = null;
|
|
Z_.includes(e) && (d = 0), null != n && r.addPart(4 * o + s.x, l + s.y, 4 * c + s.z, n, h, Au.YPositive, k_.Default, null, d), r.addPart(4 * o, l, 4 * c, e, h, Au.YPositive, t, u, d)
|
|
}
|
|
}
|
|
return r
|
|
}
|
|
|
|
function nv(e, t) {
|
|
let n = e;
|
|
if (t.length - n < 1) return null;
|
|
const i = t[n];
|
|
if (n += 1, !(i in L_)) return null;
|
|
if (t.length - n < 1) return null;
|
|
const r = t[n];
|
|
if (n += 1, !Number.isSafeInteger(r) || r < 0 || r >= 180) return null;
|
|
const a = new Pv(i, new B_(r));
|
|
if (t.length - n < 9) return null;
|
|
const s = t[n] | t[n + 1] << 8 | t[n + 2] << 16 | t[n + 3] << 24;
|
|
n += 4;
|
|
const o = t[n] | t[n + 1] << 8 | t[n + 2] << 16 | t[n + 3] << 24;
|
|
n += 4;
|
|
const l = t[n] | t[n + 1] << 8 | t[n + 2] << 16 | t[n + 3] << 24;
|
|
n += 4;
|
|
const c = 3 & t[n],
|
|
h = t[n] >> 2 & 3,
|
|
u = t[n] >> 4 & 3;
|
|
if (n += 1, c < 1 || c > 4 || h < 1 || h > 4 || u < 1 || u > 4) return null;
|
|
for (; n < t.length;) {
|
|
if (t.length - n < 1) return null;
|
|
const e = t[n + 0];
|
|
if (n += 1, !(e in mu)) return null;
|
|
if (t.length - n < 4) return null;
|
|
const i = t[n + 0] | t[n + 1] << 8 | t[n + 2] << 16 | t[n + 3] << 24;
|
|
n += 4;
|
|
for (let r = 0; r < i; ++r) {
|
|
if (t.length - n < c) return null;
|
|
let i = 0;
|
|
for (let e = 0; e < c; ++e) i |= t[n + e] << 8 * e;
|
|
if (i += s, n += c, t.length - n < h) return null;
|
|
let r = 0;
|
|
for (let e = 0; e < h; ++e) r |= t[n + e] << 8 * e;
|
|
if (r += o, n += h, t.length - n < u) return null;
|
|
let d = 0;
|
|
for (let e = 0; e < u; ++e) d |= t[n + e] << 8 * e;
|
|
if (d += l, n += u, t.length - n < 1) return null;
|
|
const f = t[n + 0];
|
|
if (n += 1, f < 0 || f > 3) return null;
|
|
if (t.length - n < 1) return null;
|
|
const p = t[n + 0];
|
|
if (n += 1, !(p in Au)) return null;
|
|
if (t.length - n < 1) return null;
|
|
const m = t[n + 0];
|
|
if (n += 1, !(m in k_)) return null;
|
|
let g = null;
|
|
if (K_.includes(e)) {
|
|
if (t.length - n < 2) return null;
|
|
g = t[n + 0] | t[n + 1] << 8, n += 2
|
|
}
|
|
let A = null;
|
|
if (Z_.includes(e)) {
|
|
if (t.length - n < 4) return null;
|
|
A = t[n + 0] | t[n + 1] << 8 | t[n + 2] << 16 | t[n + 3] << 24, n += 4
|
|
}
|
|
a.addPart(i, r, d, e, f, p, m, g, A)
|
|
}
|
|
}
|
|
return a
|
|
}
|
|
class iv extends Qr {
|
|
constructor(e, t) {
|
|
const n = new Ei({
|
|
color: t,
|
|
depthWrite: !1
|
|
});
|
|
super(e.geometry, n, e.count);
|
|
for (let t = 0; t < e.count; ++t) {
|
|
const n = new Cn;
|
|
e.getMatrixAt(t, n), this.setMatrixAt(t, n)
|
|
}
|
|
this.meshMatrix = e.matrixWorld, this.frustumCulled = !1, this.matrixAutoUpdate = !1, this.renderOrder = -1
|
|
}
|
|
update(e, t) {
|
|
var n = new Cn,
|
|
i = e.normal.x * t.x + e.normal.y * t.y + e.normal.z * t.z + -e.constant * t.w,
|
|
r = n.elements;
|
|
r[0] = i - t.x * e.normal.x, r[4] = -t.x * e.normal.y, r[8] = -t.x * e.normal.z, r[12] = -t.x * -e.constant, r[1] = -t.y * e.normal.x, r[5] = i - t.y * e.normal.y, r[9] = -t.y * e.normal.z, r[13] = -t.y * -e.constant, r[2] = -t.z * e.normal.x, r[6] = -t.z * e.normal.y, r[10] = i - t.z * e.normal.z, r[14] = -t.z * -e.constant, r[3] = -t.w * e.normal.x, r[7] = -t.w * e.normal.y, r[11] = -t.w * e.normal.z, r[15] = i - t.w * -e.constant, this.matrix.multiplyMatrices(n, this.meshMatrix)
|
|
}
|
|
}
|
|
var rv, av, sv, ov, lv, cv, hv, uv, dv, fv, pv, mv, gv, Av, _v, vv = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
wv = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
class yv {
|
|
constructor(e, t, n, i, r, a, s, o, l, c) {
|
|
if (this.checkpointOrder = null, this.startOrder = null, this.x = e, this.y = t, this.z = n, this.rotation = i, this.rotationAxis = r, this.color = a, this.type = s, this.matrix = o, this.checkpointOrder = l, this.startOrder = c, null != s.configuration.detector && s.configuration.detector.type == Jh.Checkpoint) {
|
|
if (null == l) throw new Error("Checkpoint has no checkpoint order")
|
|
} else if (null != l) throw new Error("Non-checkpoint has checkpoint order");
|
|
if (null != s.configuration.startOffset && null == c) throw new Error("Start part has no start order");
|
|
if (null == s.configuration.startOffset && null != c) throw new Error("Non-start part has start order")
|
|
}
|
|
}
|
|
class xv {
|
|
constructor(e, t, n) {
|
|
rv.add(this), av.set(this, void 0), sv.set(this, void 0), ov.set(this, void 0), this.environment = L_.Summer, lv.set(this, new B_), cv.set(this, []), hv.set(this, new Map), uv.set(this, new Map), dv.set(this, {
|
|
min: new Et(0, 0),
|
|
max: new Et(0, 0)
|
|
}), fv.set(this, null), pv.set(this, []), vv(this, av, e, "f"), vv(this, sv, t, "f"), vv(this, ov, n, "f")
|
|
}
|
|
get sunDirection() {
|
|
return wv(this, lv, "f")
|
|
}
|
|
set sunDirection(e) {
|
|
vv(this, lv, e.clone(), "f")
|
|
}
|
|
getID() {
|
|
return wv(this, fv, "f")
|
|
}
|
|
clear() {
|
|
vv(this, fv, null, "f"), wv(this, cv, "f").length = 0, wv(this, hv, "f").clear(), wv(this, uv, "f").clear(), wv(this, rv, "m", mv).call(this)
|
|
}
|
|
getPartsAt(e, t, n) {
|
|
const i = wv(this, hv, "f").get(e.toString() + "|" + t.toString() + "|" + n.toString());
|
|
return null == i ? [] : i.map((e => ({
|
|
id: e.type.configuration.id,
|
|
x: e.x,
|
|
y: e.y,
|
|
z: e.z,
|
|
rotation: e.rotation,
|
|
rotationAxis: e.rotationAxis,
|
|
color: e.color
|
|
})))
|
|
}
|
|
setPart(e, t, n, i, r, a, s, o, l) {
|
|
const c = wv(this, ov, "f").getPart(i);
|
|
if (s != k_.Default && !c.colors.has(s)) throw new Error("Track part color does not exist");
|
|
const h = eu(r, a),
|
|
u = new Zt(e * xv.partSize, t * xv.partSize, n * xv.partSize),
|
|
d = (new Cn).compose(u, h, new Zt(1, 1, 1)),
|
|
f = new yv(e, t, n, r, a, s, c, d, o, l);
|
|
wv(this, cv, "f").push(f);
|
|
c.configuration.tiles.rotated(r, a).forEach(((i, r, a) => {
|
|
const s = (e + i).toString() + "|" + (t + r).toString() + "|" + (n + a).toString();
|
|
if (t + r < 0) throw new Error("Track part below ground");
|
|
{
|
|
const e = wv(this, hv, "f").get(s);
|
|
null == e ? wv(this, hv, "f").set(s, [f]) : e.push(f)
|
|
}
|
|
}));
|
|
const p = wv(this, uv, "f").get(i);
|
|
null == p ? wv(this, uv, "f").set(i, [f]) : p.push(f)
|
|
}
|
|
deletePartsAt(e, t, n) {
|
|
const i = wv(this, hv, "f").get(e.toString() + "|" + t.toString() + "|" + n.toString());
|
|
if (null == i) return !1;
|
|
for (const e of i) wv(this, rv, "m", Av).call(this, e);
|
|
return !0
|
|
}
|
|
deleteSpecificPart(e, t, n, i, r, a) {
|
|
for (const s of wv(this, cv, "f"))
|
|
if (s.type.configuration.id == e && s.x == t && s.y == n && s.z == i && s.rotation == r && s.rotationAxis == a) return wv(this, rv, "m", Av).call(this, s), !0;
|
|
return !1
|
|
}
|
|
getBounds() {
|
|
return wv(this, dv, "f")
|
|
}
|
|
shortRaycast(e) {
|
|
const t = new Zt(Math.floor(e.ray.origin.x / xv.partSize), Math.floor(e.ray.origin.y / xv.partSize), Math.floor(e.ray.origin.z / xv.partSize)),
|
|
n = new Set;
|
|
for (let e = -1; e <= 0; e++)
|
|
for (let i = -1; i <= 0; i++)
|
|
for (let r = -1; r <= 0; r++) {
|
|
const a = wv(this, rv, "m", gv).call(this, t.x + e, t.y + i, t.z + r);
|
|
for (const e of a) n.add(e)
|
|
}
|
|
let i = null;
|
|
for (const t of n) {
|
|
let n = t.color;
|
|
n == k_.Default && (n = k_.Summer);
|
|
const r = t.type.colors.get(n);
|
|
if (null == r) throw new Error("Track part is not loaded yet");
|
|
if (null == i) {
|
|
r.matrixWorld.copy(t.matrix);
|
|
const n = e.intersectObject(r, !0);
|
|
n.length > 0 && (i = n[0])
|
|
}
|
|
}
|
|
return i
|
|
}
|
|
generateMeshes() {
|
|
wv(this, rv, "m", mv).call(this);
|
|
const e = wv(this, lv, "f").getSunPosition(),
|
|
t = new Qt(e.x, e.y, e.z, 0);
|
|
let n, i = null;
|
|
if (wv(this, sv, "f").getSettingBoolean(nm.TrackShadowEnabled)) switch (this.environment) {
|
|
case L_.Summer:
|
|
i = new wi(1192238);
|
|
break;
|
|
case L_.Winter:
|
|
i = new wi(3825803);
|
|
break;
|
|
case L_.Desert:
|
|
i = new wi(3883831)
|
|
}
|
|
switch (this.environment) {
|
|
case L_.Summer:
|
|
n = k_.Summer;
|
|
break;
|
|
case L_.Winter:
|
|
n = k_.Winter;
|
|
break;
|
|
case L_.Desert:
|
|
n = k_.Desert
|
|
}
|
|
for (const e of wv(this, ov, "f").getAllParts())
|
|
for (const [r, a] of e.colors) {
|
|
const s = [];
|
|
for (const t of wv(this, cv, "f")) {
|
|
let i = t.color;
|
|
i == k_.Default && (i = n), t.type == e && i == r && s.push(t)
|
|
}
|
|
if (s.length > 0) {
|
|
if (null == a) throw new Error("Mesh is not loaded");
|
|
const e = new Qr(a.geometry, a.material, s.length);
|
|
e.frustumCulled = !1, e.receiveShadow = !0;
|
|
for (let t = 0; t < s.length; ++t) e.setMatrixAt(t, s[t].matrix);
|
|
if (wv(this, av, "f").scene.add(e), wv(this, pv, "f").push(e), null != i) {
|
|
const n = new iv(e, i);
|
|
n.update(new Yr(new Zt(0, 1, 0), 0), t), wv(this, av, "f").scene.add(n), wv(this, pv, "f").push(n)
|
|
}
|
|
}
|
|
}
|
|
wv(this, rv, "m", _v).call(this)
|
|
}
|
|
getCheckpoints() {
|
|
let e = [];
|
|
const t = wv(this, ov, "f").getPartTypesWithDetector(Jh.Checkpoint);
|
|
for (const n of t) {
|
|
const t = wv(this, uv, "f").get(n);
|
|
null != t && (e = e.concat(t))
|
|
}
|
|
return e.map((e => {
|
|
if (null == e.checkpointOrder) throw new Error("Checkpoint has no checkpoint order");
|
|
if (null == e.type.configuration.detector) throw new Error("Checkpoint has no detector");
|
|
return {
|
|
x: e.x,
|
|
y: e.y,
|
|
z: e.z,
|
|
rotation: e.rotation,
|
|
rotationAxis: e.rotationAxis,
|
|
type: e.type.configuration.id,
|
|
checkpointOrder: e.checkpointOrder,
|
|
detector: e.type.configuration.detector
|
|
}
|
|
}))
|
|
}
|
|
getCheckpointOrders() {
|
|
let e = [];
|
|
const t = wv(this, ov, "f").getPartTypesWithDetector(Jh.Checkpoint);
|
|
for (const n of t) {
|
|
const t = wv(this, uv, "f").get(n);
|
|
null != t && (e = e.concat(t))
|
|
}
|
|
return e.map((e => {
|
|
if (null == e.checkpointOrder) throw new Error("Checkpoint has no checkpoint order");
|
|
if (null == e.type.configuration.detector) throw new Error("Checkpoint has no detector");
|
|
return e.checkpointOrder
|
|
}))
|
|
}
|
|
getTotalNumberOfCheckpointIndices() {
|
|
let e = [];
|
|
const t = wv(this, ov, "f").getPartTypesWithDetector(Jh.Checkpoint);
|
|
for (const n of t) {
|
|
const t = wv(this, uv, "f").get(n);
|
|
null != t && (e = e.concat(t))
|
|
}
|
|
return e.map((e => e.checkpointOrder)).filter(((e, t, n) => n.indexOf(e) == t)).length
|
|
}
|
|
getStart() {
|
|
let e = -1 / 0,
|
|
t = null;
|
|
for (const [n, i] of wv(this, uv, "f")) {
|
|
const r = wv(this, ov, "f").getPartStartOffset(n);
|
|
if (i.length > 0 && null != r)
|
|
for (const n of i) {
|
|
if (null == n.startOrder) throw new Error("Start part has no start order");
|
|
n.startOrder >= e && (e = n.startOrder, t = {
|
|
part: n,
|
|
startOffset: r
|
|
})
|
|
}
|
|
}
|
|
return null != t ? {
|
|
x: t.part.x,
|
|
y: t.part.y,
|
|
z: t.part.z,
|
|
rotation: t.part.rotation,
|
|
rotationAxis: t.part.rotationAxis,
|
|
startOffset: t.startOffset
|
|
} : null
|
|
}
|
|
getStartTransform() {
|
|
const e = this.getStart();
|
|
if (null != e) {
|
|
const t = eu(e.rotation, e.rotationAxis).multiply((new Kt).setFromEuler(new Fn(0, Math.PI, 0))),
|
|
n = e.startOffset;
|
|
return n.applyQuaternion(t), {
|
|
position: new Zt(e.x * xv.partSize + n.x, e.y * xv.partSize + n.y, e.z * xv.partSize + n.z),
|
|
quaternion: t
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
getNextStartOrder() {
|
|
let e = 0;
|
|
for (const [t, n] of wv(this, uv, "f")) {
|
|
const i = wv(this, ov, "f").getPartStartOffset(t);
|
|
if (n.length > 0 && null != i)
|
|
for (const t of n) {
|
|
if (null == t.startOrder) throw new Error("Start part has no start order");
|
|
e = Math.max(e, t.startOrder + 1)
|
|
}
|
|
}
|
|
return e
|
|
}
|
|
getTrackData() {
|
|
const e = new Pv(this.environment, wv(this, lv, "f"));
|
|
for (const t of wv(this, cv, "f")) e.addPart(t.x, t.y, t.z, t.type.configuration.id, t.rotation, t.rotationAxis, t.color, t.checkpointOrder, t.startOrder);
|
|
return e
|
|
}
|
|
loadTrackData(e, t = !0) {
|
|
return this.clear(), vv(this, fv, t ? e.getId() : null, "f"), this.environment = e.environment, this.sunDirection = e.sunDirection.clone(), e.forEachPart(((e, t, n, i, r, a, s, o, l) => {
|
|
this.setPart(e, t, n, i, r, a, s, o, l)
|
|
})), !0
|
|
}
|
|
}
|
|
av = new WeakMap, sv = new WeakMap, ov = new WeakMap, lv = new WeakMap, cv = new WeakMap, hv = new WeakMap, uv = new WeakMap, dv = new WeakMap, fv = new WeakMap, pv = new WeakMap, rv = new WeakSet, mv = function() {
|
|
for (const e of wv(this, pv, "f")) wv(this, av, "f").scene.remove(e);
|
|
wv(this, pv, "f").length = 0
|
|
}, gv = function(e, t, n) {
|
|
var i;
|
|
return null !== (i = wv(this, hv, "f").get(e.toString() + "|" + t.toString() + "|" + n.toString())) && void 0 !== i ? i : []
|
|
}, Av = function(e) {
|
|
const t = wv(this, cv, "f").indexOf(e);
|
|
if (!(t >= 0)) throw new Error("Track part missing from parts list");
|
|
wv(this, cv, "f").splice(t, 1);
|
|
e.type.configuration.tiles.rotated(e.rotation, e.rotationAxis).forEach(((t, n, i) => {
|
|
const r = (e.x + t).toString() + "|" + (e.y + n).toString() + "|" + (e.z + i).toString(),
|
|
a = wv(this, hv, "f").get(r);
|
|
if (null == a) throw new Error("Track part section missing");
|
|
{
|
|
const t = a.indexOf(e);
|
|
if (!(t >= 0)) throw new Error("Track part missing from parts by position map");
|
|
a.splice(t, 1), 0 == a.length && wv(this, hv, "f").delete(r)
|
|
}
|
|
}));
|
|
const n = wv(this, uv, "f").get(e.type.configuration.id);
|
|
if (null == n) throw new Error("Track part type is missing from parts by type map");
|
|
for (let t = 0; t < n.length; ++t) {
|
|
if (n[t] == e) {
|
|
n.splice(t, 1);
|
|
break
|
|
}
|
|
if (t == n.length - 1) throw new Error("Track part is missing from parts by type map")
|
|
}
|
|
}, _v = function() {
|
|
let e = 1 / 0,
|
|
t = 1 / 0,
|
|
n = -1 / 0,
|
|
i = -1 / 0;
|
|
for (const r of wv(this, cv, "f")) e = Math.min(r.x, e), t = Math.min(r.z, t), n = Math.max(r.x, n), i = Math.max(r.z, i);
|
|
Number.isFinite(e) && Number.isFinite(t) && Number.isFinite(n) && Number.isFinite(i) ? vv(this, dv, {
|
|
min: new Et(e, t),
|
|
max: new Et(n, i)
|
|
}, "f") : vv(this, dv, {
|
|
min: new Et,
|
|
max: new Et
|
|
}, "f")
|
|
}, xv.partSize = 5;
|
|
const bv = xv;
|
|
var Ev, Sv, Mv, Tv, Cv, Iv = function(e, t, n, i, r) {
|
|
if ("m" === i) throw new TypeError("Private method is not writable");
|
|
if ("a" === i && !r) throw new TypeError("Private accessor was defined without a setter");
|
|
if ("function" == typeof t ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
return "a" === i ? r.call(e, n) : r ? r.value = n : t.set(e, n), n
|
|
},
|
|
Rv = function(e, t, n, i) {
|
|
if ("a" === n && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
if ("function" == typeof t ? e !== t || !i : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
return "m" === n ? i : "a" === n ? i.call(e) : i ? i.value : t.get(e)
|
|
};
|
|
Sv = new WeakMap, Mv = new WeakMap, Ev = new WeakSet, Tv = function() {
|
|
let e = -1 / 0,
|
|
t = null;
|
|
for (const [n, i] of Rv(this, Mv, "f")) {
|
|
const r = Y_(n).startOffset;
|
|
if (i.length > 0 && null != r)
|
|
for (const n of i) {
|
|
if (null == n.startOrder) throw new Error("Start part has no start order");
|
|
n.startOrder >= e && (e = n.startOrder, t = {
|
|
part: n,
|
|
startOffset: r
|
|
})
|
|
}
|
|
}
|
|
return null != t ? {
|
|
x: t.part.x,
|
|
y: t.part.y,
|
|
z: t.part.z,
|
|
rotation: t.part.rotation,
|
|
rotationAxis: t.part.rotationAxis,
|
|
startOffset: t.startOffset.clone()
|
|
} : null
|
|
}, Cv = function() {
|
|
const e = [];
|
|
e.push(this.environment), e.push(Rv(this, Sv, "f").representation);
|
|
let t = 1 / 0,
|
|
n = 1 / 0,
|
|
i = 1 / 0,
|
|
r = -1 / 0,
|
|
a = -1 / 0,
|
|
s = -1 / 0;
|
|
for (const [, e] of Rv(this, Mv, "f"))
|
|
for (const o of e) t = Math.min(o.x, t), n = Math.min(o.y, n), i = Math.min(o.z, i), r = Math.max(o.x, r), a = Math.max(o.y, a), s = Math.max(o.z, s);
|
|
Number.isFinite(t) && Number.isFinite(n) && Number.isFinite(i) && Number.isFinite(r) && Number.isFinite(a) && Number.isFinite(s) || (t = 0, n = 0, i = 0, r = 0, a = 0, s = 0);
|
|
const o = r - t + 1,
|
|
l = a - n + 1,
|
|
c = s - i + 1,
|
|
h = Math.max(1, Math.min(4, Math.ceil(Math.log2(o + 1) / 8))),
|
|
u = Math.max(1, Math.min(4, Math.ceil(Math.log2(l + 1) / 8))),
|
|
d = Math.max(1, Math.min(4, Math.ceil(Math.log2(c + 1) / 8)));
|
|
e.push(255 & t, t >>> 8 & 255, t >>> 16 & 255, t >>> 24 & 255, 255 & n, n >>> 8 & 255, n >>> 16 & 255, n >>> 24 & 255, 255 & i, i >>> 8 & 255, i >>> 16 & 255, i >>> 24 & 255, 255 & (h | u << 2 | d << 4));
|
|
for (const [r, a] of Rv(this, Mv, "f")) {
|
|
if (r < 0 || r > 255) throw new Error("Type id is out of range");
|
|
const s = a.length;
|
|
e.push(255 & r, 255 & s, s >>> 8 & 255, s >>> 16 & 255, s >>> 24 & 255);
|
|
for (const s of a) {
|
|
const a = s.x - t,
|
|
o = s.y - n,
|
|
l = s.z - i;
|
|
if (1 == h ? e.push(255 & a) : 2 == h ? e.push(255 & a, a >>> 8 & 255) : 3 == h ? e.push(255 & a, a >>> 8 & 255, a >>> 16 & 255) : 4 == h && e.push(255 & a, a >>> 8 & 255, a >>> 16 & 255, a >>> 24 & 255), 1 == u ? e.push(255 & o) : 2 == u ? e.push(255 & o, o >>> 8 & 255) : 3 == u ? e.push(255 & o, o >>> 8 & 255, o >>> 16 & 255) : 4 == u && e.push(255 & o, o >>> 8 & 255, o >>> 16 & 255, o >>> 24 & 255), 1 == d ? e.push(255 & l) : 2 == d ? e.push(255 & l, l >>> 8 & 255) : 3 == d ? e.push(255 & l, l >>> 8 & 255, l >>> 16 & 255) : 4 == d && e.push(255 & l, l >>> 8 & 255, l >>> 16 & 255, l >>> 24 & 255), e.push(3 & s.rotation, 7 & s.rotationAxis, 255 & s.color), K_.includes(r)) {
|
|
if (null == s.checkpointOrder) throw new Error("Checkpoint has no checkpoint order");
|
|
e.push(255 & s.checkpointOrder, s.checkpointOrder >>> 8 & 255)
|
|
}
|
|
if (Z_.includes(r)) {
|
|
if (null == s.startOrder) throw new Error("Start has no start order");
|
|
e.push(255 & s.startOrder, s.startOrder >>> 8 & 255, s.startOrder >>> 16 & 255, s.startOrder >>> 24 & 255)
|
|
}
|
|
}
|
|
}
|
|
return new Uint8Array(e)
|
|
};
|
|
const Pv = class {
|
|
constructor(e, t) {
|
|
Ev.add(this), Sv.set(this, void 0), Mv.set(this, new Map), this.environment = e, Iv(this, Sv, t.clone(), "f")
|
|
}
|
|
get sunDirection() {
|
|
return Rv(this, Sv, "f").clone()
|
|
}
|
|
set sunDirection(e) {
|
|
Iv(this, Sv, e.clone(), "f")
|
|
}
|
|
addPart(e, t, n, i, r, a, s, o, l) {
|
|
const c = {
|
|
x: e,
|
|
y: t,
|
|
z: n,
|
|
rotation: r,
|
|
rotationAxis: a,
|
|
color: s,
|
|
checkpointOrder: o,
|
|
startOrder: l
|
|
},
|
|
h = Rv(this, Mv, "f").get(i);
|
|
null != h ? h.push(c) : Rv(this, Mv, "f").set(i, [c])
|
|
}
|
|
forEachPart(e) {
|
|
for (const [t, n] of Rv(this, Mv, "f"))
|
|
for (const i of n) e(i.x, i.y, i.z, t, i.rotation, i.rotationAxis, i.color, i.checkpointOrder, i.startOrder)
|
|
}
|
|
getId() {
|
|
return (0, y_.sha256)(Rv(this, Ev, "m", Cv).call(this))
|
|
}
|
|
getBounds() {
|
|
let e = 1 / 0,
|
|
t = 1 / 0,
|
|
n = -1 / 0,
|
|
i = -1 / 0;
|
|
return this.forEachPart(((r, a, s) => {
|
|
e = Math.min(r, e), t = Math.min(s, t), n = Math.max(r, n), i = Math.max(s, i)
|
|
})), Number.isFinite(e) && Number.isFinite(t) && Number.isFinite(n) && Number.isFinite(i) ? {
|
|
min: new Et(e, t),
|
|
max: new Et(n, i)
|
|
} : {
|
|
min: new Et,
|
|
max: new Et
|
|
}
|
|
}
|
|
hasStartingPoint() {
|
|
return null != Rv(this, Ev, "m", Tv).call(this)
|
|
}
|
|
getStartTransform() {
|
|
const e = Rv(this, Ev, "m", Tv).call(this);
|
|
if (null != e) {
|
|
const t = eu(e.rotation, e.rotationAxis).multiply((new Kt).setFromEuler(new Fn(0, Math.PI, 0))),
|
|
n = e.startOffset;
|
|
return n.applyQuaternion(t), {
|
|
position: new Zt(e.x * bv.partSize + n.x, e.y * bv.partSize + n.y, e.z * bv.partSize + n.z),
|
|
quaternion: t
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
toSaveString() {
|
|
const e = Rv(this, Ev, "m", Cv).call(this),
|
|
t = new dh.Deflate({
|
|
level: 9,
|
|
windowBits: 9,
|
|
memLevel: 9
|
|
});
|
|
t.push(e, !0);
|
|
const n = E_(t.result),
|
|
i = new dh.Deflate({
|
|
level: 9,
|
|
windowBits: 15,
|
|
memLevel: 9
|
|
});
|
|
return i.push(n, !0), E_(i.result)
|
|
}
|
|
toExportString(e) {
|
|
const t = (new TextEncoder).encode(e.name);
|
|
let n, i;
|
|
null != e.author ? (i = (new TextEncoder).encode(e.author), n = i.length) : (i = null, n = 0);
|
|
const r = new Uint8Array(1 + t.length + 1 + n);
|
|
r[0] = t.length, r.set(t, 1), r[1 + t.length] = n, null != i && r.set(i, 1 + t.length + 1);
|
|
const a = Rv(this, Ev, "m", Cv).call(this),
|
|
s = new dh.Deflate({
|
|
level: 9,
|
|
windowBits: 9,
|
|
memLevel: 9
|
|
});
|
|
s.push(r, !1), s.push(a, !0);
|
|
const o = E_(s.result),
|
|
l = new dh.Deflate({
|
|
level: 9,
|
|
windowBits: 15,
|
|
memLevel: 9
|
|
});
|
|
return l.push(o, !0), "PolyTrack1" + E_(l.result)
|
|
}
|
|
static fromSaveString(e) {
|
|
const t = function(e) {
|
|
const t = S_(e);
|
|
if (null == t) return null;
|
|
const n = new dh.Inflate({
|
|
to: "string"
|
|
});
|
|
if (n.push(t, !0), n.err) return null;
|
|
const i = n.result;
|
|
if ("string" != typeof i) return null;
|
|
const r = S_(i);
|
|
if (null == r) return null;
|
|
const a = new dh.Inflate;
|
|
if (a.push(r, !0), a.err) return null;
|
|
const s = a.result;
|
|
return s instanceof Uint8Array ? nv(0, s) : null
|
|
}(e);
|
|
if (null != t) return t;
|
|
const n = tv(e);
|
|
if (null != n) return n;
|
|
const i = ev(e);
|
|
if (null != i) return i;
|
|
const r = $_(e);
|
|
if (null != r) return r;
|
|
const a = J_(e);
|
|
return null != a ? a : null
|
|
}
|
|
static fromExportString(e) {
|
|
const t = e.replace(/\s+/g, ""),
|
|
n = function(e) {
|
|
const t = "PolyTrack1";
|
|
if (!e.startsWith(t)) return null;
|
|
const n = S_(e.substring(10));
|
|
if (null == n) return null;
|
|
const i = new dh.Inflate({
|
|
to: "string"
|
|
});
|
|
if (i.push(n, !0), i.err) return null;
|
|
const r = i.result;
|
|
if ("string" != typeof r) return null;
|
|
const a = S_(r);
|
|
if (null == a) return null;
|
|
const s = new dh.Inflate;
|
|
if (s.push(a, !0), s.err) return null;
|
|
const o = s.result;
|
|
if (!(o instanceof Uint8Array)) return null;
|
|
const l = o[0];
|
|
if (o.length < 1 + l) return null;
|
|
const c = new TextDecoder("utf-8").decode(o.subarray(1, 1 + l)),
|
|
h = o[1 + l];
|
|
if (o.length < 1 + l + 1 + h) return null;
|
|
let u;
|
|
u = h > 0 ? new TextDecoder("utf-8").decode(o.subarray(1 + l + 1, 1 + l + 1 + h)) : null;
|
|
const d = nv(1 + l + 1 + h, o);
|
|
return null == d ? null : {
|
|
trackMetadata: {
|
|
name: c,
|
|
author: u
|
|
},
|
|
trackData: d
|
|
}
|
|
}(t);
|
|
if (null != n) return n;
|
|
const i = function(e) {
|
|
if (!e.startsWith("v3")) return null;
|
|
const t = S_(e.substring(2, 4));
|
|
if (null == t) return null;
|
|
if (1 != t.length) return null;
|
|
const n = t[0],
|
|
i = S_(e.substring(4, 4 + n));
|
|
if (null == i) return null;
|
|
let r;
|
|
try {
|
|
r = new TextDecoder("utf-8").decode(i)
|
|
} catch (e) {
|
|
return null
|
|
}
|
|
const a = tv(e.substring(4 + n));
|
|
return null == a ? null : {
|
|
trackMetadata: {
|
|
name: r,
|
|
author: null
|
|
},
|
|
trackData: a
|
|
}
|
|
}(t);
|
|
if (null != i) return i;
|
|
const r = function(e) {
|
|
if (!e.startsWith("v2")) return null;
|
|
const t = S_(e.substring(2, 4));
|
|
if (null == t) return null;
|
|
if (1 != t.length) return null;
|
|
const n = t[0],
|
|
i = Math.ceil(n / 3 * 4),
|
|
r = S_(e.substring(4, 4 + i));
|
|
if (null == r) return null;
|
|
let a;
|
|
try {
|
|
a = new TextDecoder("utf-8").decode(r)
|
|
} catch (e) {
|
|
return null
|
|
}
|
|
const s = ev(e.substring(4 + i));
|
|
return null == s ? null : {
|
|
trackMetadata: {
|
|
name: a,
|
|
author: null
|
|
},
|
|
trackData: s
|
|
}
|
|
}(t);
|
|
if (null != r) return r;
|
|
const a = function(e) {
|
|
if (!e.startsWith("v1n")) return null;
|
|
const t = fh(e.substring(3, 5));
|
|
if (null == t) return null;
|
|
if (1 != t.length) return null;
|
|
const n = t[0],
|
|
i = e.substring(5, 5 + n);
|
|
let r;
|
|
try {
|
|
r = decodeURIComponent(i)
|
|
} catch (e) {
|
|
return console.error(e), null
|
|
}
|
|
const a = $_(e.substring(5 + n));
|
|
return null == a ? null : {
|
|
trackMetadata: {
|
|
name: r,
|
|
author: null
|
|
},
|
|
trackData: a
|
|
}
|
|
}(t);
|
|
if (null != a) return a;
|
|
const s = function(e) {
|
|
let t, n;
|
|
try {
|
|
t = JSON.parse(e)
|
|
} catch (e) {
|
|
return console.error(e), null
|
|
}
|
|
if ("string" != typeof t.name) return null;
|
|
if ("string" != typeof t.track) return null;
|
|
try {
|
|
n = JSON.parse(t.track)
|
|
} catch (e) {
|
|
return console.error(e), null
|
|
}
|
|
const i = J_(n);
|
|
return null == i ? null : {
|
|
trackMetadata: {
|
|
name: t.name,
|
|
author: null
|
|
},
|
|
trackData: i
|
|
}
|
|
}(e);
|
|
return null != s ? s : null
|
|
}
|
|
createThumbnail() {
|
|
let e = 1 / 0,
|
|
t = 1 / 0,
|
|
n = -1 / 0,
|
|
i = -1 / 0;
|
|
this.forEachPart(((r, a, s, o, l, c) => {
|
|
Y_(o).tiles.rotated(l, c).forEach(((a, o, l) => {
|
|
e = Math.min(e, Math.floor((r + a - 2) / 4)), t = Math.min(t, Math.floor((s + l - 2) / 4)), n = Math.max(n, Math.floor((r + a - 2) / 4)), i = Math.max(i, Math.floor((s + l - 2) / 4))
|
|
}))
|
|
})), Number.isFinite(e) && Number.isFinite(t) && Number.isFinite(n) && Number.isFinite(i) || (e = 0, t = 0, n = 0, i = 0);
|
|
const r = 10,
|
|
a = n - e + 1;
|
|
a <= r && (n += Math.ceil((r - a) / 2), e -= Math.ceil((r - a) / 2));
|
|
const s = i - t + 1;
|
|
s <= r && (i += Math.ceil((r - s) / 2), t -= Math.ceil((r - s) / 2));
|
|
const o = document.createElement("canvas");
|
|
o.width = Math.min(1024, n - e + 1), o.height = Math.min(1024, i - t + 1);
|
|
const l = o.getContext("2d");
|
|
if (null == l) throw new Error("Failed to get canvas context");
|
|
const c = l.createImageData(o.width, o.height),
|
|
h = [],
|
|
u = [],
|
|
d = [];
|
|
let f, p, m;
|
|
switch (this.environment) {
|
|
case L_.Summer:
|
|
f = 255, p = 255, m = 255;
|
|
break;
|
|
case L_.Winter:
|
|
f = 190, p = 216, m = 247;
|
|
break;
|
|
case L_.Desert:
|
|
f = 237, p = 226, m = 175
|
|
}
|
|
this.forEachPart(((n, i, r, a, s, l) => {
|
|
const g = Y_(a);
|
|
g.tiles.rotated(s, l).forEach(((i, a, s) => {
|
|
const l = Math.floor((n + i - 2) / 4) - e,
|
|
A = Math.floor((r + s - 2) / 4) - t,
|
|
_ = 4 * (l + A * o.width);
|
|
c.data[_ + 0] = f, c.data[_ + 1] = p, c.data[_ + 2] = m, c.data[_ + 3] = 255, null != g.startOffset ? u.push([l, A]) : null != g.detector && g.detector.type == Jh.Checkpoint ? h.push([l, A]) : null != g.detector && g.detector.type == Jh.Finish && d.push([l, A])
|
|
}))
|
|
}));
|
|
for (const [e, t] of h) c.data[4 * (e + t * o.width) + 0] = 226, c.data[4 * (e + t * o.width) + 1] = 192, c.data[4 * (e + t * o.width) + 2] = 38, c.data[4 * (e + t * o.width) + 3] = 255;
|
|
for (const [e, t] of u) c.data[4 * (e + t * o.width) + 0] = 51, c.data[4 * (e + t * o.width) + 1] = 140, c.data[4 * (e + t * o.width) + 2] = 224, c.data[4 * (e + t * o.width) + 3] = 255;
|
|
for (const [e, t] of d) c.data[4 * (e + t * o.width) + 0] = 209, c.data[4 * (e + t * o.width) + 1] = 41, c.data[4 * (e + t * o.width) + 2] = 41, c.data[4 * (e + t * o.width) + 3] = 255;
|
|
return l.putImageData(c, 0, 0), o
|
|
}
|
|
};
|
|
const Bv = class {
|
|
constructor() {
|
|
this.up = !1, this.right = !1, this.down = !1, this.left = !1, this.reset = !1
|
|
}
|
|
dispose() {}
|
|
getControls() {
|
|
return {
|
|
up: this.up,
|
|
right: this.right,
|
|
down: this.down,
|
|
left: this.left,
|
|
reset: this.reset
|
|
}
|
|
}
|
|
};
|
|
importScripts("lib/ammo.wasm.js");
|
|
const Dv = [];
|
|
onmessage = e => {
|
|
Dv.push(e)
|
|
}, Ammo().then((function(e) {
|
|
let t = new p_([]);
|
|
const n = [];
|
|
|
|
function i(e) {
|
|
switch (e.data.messageType) {
|
|
case g_.Init: {
|
|
const n = e.data.isRealtime;
|
|
t = new p_(e.data.trackParts),
|
|
function(e) {
|
|
e ? l() : setInterval(c)
|
|
}(n);
|
|
break
|
|
}
|
|
case g_.Verify:
|
|
! function(e) {
|
|
const n = Pv.fromSaveString(e.data.trackData);
|
|
if (null == n) throw new Error("Failed to load track");
|
|
const i = Ch.deserialize(e.data.carRecording);
|
|
if (null == i) throw new Error("Failed to deserialize recording");
|
|
const r = n.getStartTransform();
|
|
if (null == r) throw new Error("Track has no starting point");
|
|
const a = e.data.carId,
|
|
s = new c_(e.data.mountainVertices, new Zt(e.data.mountainOffset.x, e.data.mountainOffset.y, e.data.mountainOffset.z), t, n, e.data.carCollisionShapeVertices, e.data.carMassOffset, new w_(i), r);
|
|
s.start();
|
|
const o = new Kh(e.data.targetFrames);
|
|
for (; !s.hasFinished() && s.getTime().lessOrEqual(o);) s.step();
|
|
const l = s.hasFinished() && s.getTime().equals(o);
|
|
postMessage({
|
|
messageType: g_.VerifyResult,
|
|
carId: a,
|
|
result: l
|
|
}), s.dispose()
|
|
}(e);
|
|
break;
|
|
case g_.TestDeterminism:
|
|
postMessage({
|
|
messageType: g_.DeterminismResult,
|
|
isDeterminstic: r()
|
|
});
|
|
break;
|
|
case g_.CreateCar:
|
|
! function(e) {
|
|
const i = Pv.fromSaveString(e.data.trackData);
|
|
if (null == i) throw new Error("Failed to load track");
|
|
let r, a = null;
|
|
const s = e.data.carRecording;
|
|
if (null == s) r = a = new Bv;
|
|
else {
|
|
const e = Ch.deserialize(s);
|
|
if (null == e) throw new Error("Failed to deserialize recording");
|
|
r = new w_(e)
|
|
}
|
|
const o = i.getStartTransform();
|
|
if (null == o) throw new Error("Track has no starting point");
|
|
const l = e.data.carId,
|
|
c = new c_(e.data.mountainVertices, new Zt(e.data.mountainOffset.x, e.data.mountainOffset.y, e.data.mountainOffset.z), t, i, e.data.carCollisionShapeVertices, e.data.carMassOffset, r, o);
|
|
n.push({
|
|
id: l,
|
|
model: c,
|
|
controls: a,
|
|
targetSimulationTime: null,
|
|
isPaused: !1
|
|
})
|
|
}(e);
|
|
break;
|
|
case g_.DeleteCar:
|
|
! function(e) {
|
|
var t;
|
|
const i = e.data.carId;
|
|
for (let e = 0; e < n.length; e++) {
|
|
const r = n[e];
|
|
if (r.id == i) {
|
|
null === (t = r.controls) || void 0 === t || t.dispose(), r.model.dispose(), n.splice(e, 1);
|
|
break
|
|
}
|
|
}
|
|
}(e);
|
|
break;
|
|
case g_.StartCar:
|
|
! function(e) {
|
|
const t = e.data.carId;
|
|
for (const i of n)
|
|
if (i.id == t) {
|
|
i.model.start();
|
|
const t = e.data.targetSimulationTimeFrames;
|
|
i.targetSimulationTime = null != t ? new Kh(t) : null;
|
|
break
|
|
}
|
|
}(e);
|
|
break;
|
|
case g_.ControlCar:
|
|
! function(e) {
|
|
const t = e.data.carId;
|
|
for (const i of n)
|
|
if (i.id == t) {
|
|
if (null == i.controls) throw new Error("Tried to control uncontrollable car");
|
|
i.controls.up = e.data.up, i.controls.right = e.data.right, i.controls.down = e.data.down, i.controls.left = e.data.left, i.controls.reset = e.data.reset;
|
|
break
|
|
}
|
|
}(e);
|
|
break;
|
|
case g_.PauseCar:
|
|
! function(e) {
|
|
const t = e.data.carId;
|
|
for (const i of n)
|
|
if (i.id == t) {
|
|
i.isPaused = e.data.isPaused;
|
|
break
|
|
}
|
|
}(e)
|
|
}
|
|
}
|
|
for (const e of Dv) i(e);
|
|
|
|
function r() {
|
|
if (3.141592653589793 != Math.PI) return console.error("Determinism check failed: Math.PI"), !1;
|
|
if (1.4142135623730951 != Math.SQRT2) return console.error("Determinism check failed: Math.SQRT2"), !1;
|
|
if (.8325082155867481 != Math.cos(.587123751237)) return console.error("Determinism check failed: Math.cos"), !1;
|
|
if (.530868917654027 != Math.sin(2.581961285)) return console.error("Determinism check failed: Math.sin"), !1;
|
|
if (3678159.3874182813 != Math.pow(123, Math.PI)) return console.error("Determinism check failed: Math.pow"), !1;
|
|
if (123 * Math.PI != 386.41589639154455) return console.error("Determinism check failed: Multiply"), !1;
|
|
if (123 / Math.PI != 39.152116000606256) return console.error("Determinism check failed: Division"), !1;
|
|
const t = new Zt(-.6827400326728821, .11212741583585739, 2.6956899166107178),
|
|
n = new Kt(-.615668535232544, .03904851898550987, .7859793305397034, .04079177975654602),
|
|
i = new Qh;
|
|
i.createGroundPlane(), i.activePhysicsAt(new Zt(0, 0, 0));
|
|
const r = new e.btTransform;
|
|
r.setIdentity();
|
|
const a = new e.btDefaultMotionState(r);
|
|
e.destroy(r);
|
|
const s = new e.btVector3(0, 0, 0),
|
|
o = new e.btVector3(.1, .1, .1),
|
|
l = new e.btBoxShape(o);
|
|
l.calculateLocalInertia(400, s), e.destroy(o);
|
|
const c = new e.btRigidBodyConstructionInfo(400, a, l, s),
|
|
h = new e.btRigidBody(c);
|
|
e.destroy(s), e.destroy(c), h.setActivationState(4), i.world.addRigidBody(h);
|
|
const u = new e.btVehicleTuning,
|
|
d = new e.btDefaultVehicleRaycaster(i.world),
|
|
f = new e.btRaycastVehicle(u, h, d);
|
|
f.setCoordinateSystem(0, 1, 2), i.world.addAction(f);
|
|
const p = new e.btVector3(0, -1, 0),
|
|
m = new e.btVector3(-1, 0, 0);
|
|
for (const t of ["WheelFL", "WheelFR", "WheelBL", "WheelBR"]) {
|
|
let n;
|
|
if ("WheelFL" == t) n = new e.btVector3(.627909, .27, 1.3478);
|
|
else if ("WheelFR" == t) n = new e.btVector3(-.627909, .27, 1.3478);
|
|
else if ("WheelBL" == t) n = new e.btVector3(.720832, .27, -1.52686);
|
|
else {
|
|
if ("WheelBR" != t) throw new Error("Unidentified wheel");
|
|
n = new e.btVector3(-.720832, .27, -1.52686)
|
|
}
|
|
const i = "WheelFL" == t || "WheelFR" == t;
|
|
f.addWheel(n, p, m, .12, .331, u, i), e.destroy(n)
|
|
}
|
|
e.destroy(p), e.destroy(m);
|
|
const g = new e.btTransform;
|
|
g.setIdentity(), h.setWorldTransform(g), h.getMotionState().setWorldTransform(g), e.destroy(g), f.resetSuspension(), f.setSteeringValue(0, 0), f.setSteeringValue(0, 1);
|
|
const A = new e.btTransform;
|
|
A.setIdentity();
|
|
const _ = new e.btDefaultMotionState(A);
|
|
e.destroy(A);
|
|
const v = new e.btVector3(0, 0, 0),
|
|
w = new e.btVector3(.1, .1, .1),
|
|
y = new e.btBoxShape(w);
|
|
y.calculateLocalInertia(100, v), e.destroy(w);
|
|
const x = new e.btRigidBodyConstructionInfo(100, _, y, v),
|
|
b = new e.btRigidBody(x);
|
|
e.destroy(v), e.destroy(x), b.setActivationState(4), i.world.addRigidBody(b);
|
|
const E = 1e5;
|
|
f.applyEngineForce(E, 2), f.applyEngineForce(E, 3);
|
|
for (let e = 0; e < 999; e++) i.step();
|
|
const S = new e.btTransform;
|
|
h.getMotionState().getWorldTransform(S);
|
|
const M = S.getOrigin(),
|
|
T = S.getRotation();
|
|
e.destroy(S);
|
|
const C = t.equals(new Zt(M.x(), M.y(), M.z())),
|
|
I = n.equals(new Kt(T.x(), T.y(), T.z(), T.w()));
|
|
i.dispose(), e.destroy(l), e.destroy(h), e.destroy(f), e.destroy(y), e.destroy(b);
|
|
const R = C || I;
|
|
return R || console.error("Determinism check failed: Simulation"), R
|
|
}
|
|
|
|
function a(e) {
|
|
var t, n;
|
|
const i = e.id,
|
|
r = e.model,
|
|
a = r.controls.getControls(r.getTime().numberOfFrames);
|
|
r.step();
|
|
const s = r.getPosition(),
|
|
o = r.getQuaternion(),
|
|
l = r.getWheelPosition(0),
|
|
c = r.getWheelPosition(1),
|
|
h = r.getWheelPosition(2),
|
|
u = r.getWheelPosition(3),
|
|
d = r.getWheelQuaternion(0),
|
|
f = r.getWheelQuaternion(1),
|
|
p = r.getWheelQuaternion(2),
|
|
m = r.getWheelQuaternion(3);
|
|
return {
|
|
id: i,
|
|
frames: r.getTime().numberOfFrames,
|
|
speedKmh: r.getSpeedKmh(),
|
|
hasStarted: r.hasStarted(),
|
|
finishFrames: null !== (n = null === (t = r.getFinishTime()) || void 0 === t ? void 0 : t.numberOfFrames) && void 0 !== n ? n : null,
|
|
nextCheckpointIndex: r.getNextCheckpointIndex(),
|
|
hasCheckpointToRespawnAt: r.hasCheckpointToRespawnAt(),
|
|
position: {
|
|
x: s.x,
|
|
y: s.y,
|
|
z: s.z
|
|
},
|
|
quaternion: {
|
|
x: o.x,
|
|
y: o.y,
|
|
z: o.z,
|
|
w: o.w
|
|
},
|
|
collisionImpulses: r.getCollisionImpulses(),
|
|
wheelInContact: [r.getWheelInContact(0), r.getWheelInContact(1), r.getWheelInContact(2), r.getWheelInContact(3)],
|
|
wheelSuspensionLength: [r.getWheelSuspensionLength(0), r.getWheelSuspensionLength(1), r.getWheelSuspensionLength(2), r.getWheelSuspensionLength(3)],
|
|
wheelSuspensionVelocity: [r.getWheelSuspensionVelocity(0), r.getWheelSuspensionVelocity(1), r.getWheelSuspensionVelocity(2), r.getWheelSuspensionVelocity(3)],
|
|
wheelRotation: [r.getWheelRotation(0), r.getWheelRotation(1), r.getWheelRotation(2), r.getWheelRotation(3)],
|
|
wheelDeltaRotation: [r.getWheelDeltaRotation(0), r.getWheelDeltaRotation(1), r.getWheelDeltaRotation(2), r.getWheelDeltaRotation(3)],
|
|
wheelSkidInfo: [r.getWheelSkidInfo(0), r.getWheelSkidInfo(1), r.getWheelSkidInfo(2), r.getWheelSkidInfo(3)],
|
|
wheelPosition: [{
|
|
x: l.x,
|
|
y: l.y,
|
|
z: l.z
|
|
}, {
|
|
x: c.x,
|
|
y: c.y,
|
|
z: c.z
|
|
}, {
|
|
x: h.x,
|
|
y: h.y,
|
|
z: h.z
|
|
}, {
|
|
x: u.x,
|
|
y: u.y,
|
|
z: u.z
|
|
}],
|
|
wheelQuaternion: [{
|
|
x: d.x,
|
|
y: d.y,
|
|
z: d.z,
|
|
w: d.w
|
|
}, {
|
|
x: f.x,
|
|
y: f.y,
|
|
z: f.z,
|
|
w: f.w
|
|
}, {
|
|
x: p.x,
|
|
y: p.y,
|
|
z: p.z,
|
|
w: p.w
|
|
}, {
|
|
x: m.x,
|
|
y: m.y,
|
|
z: m.z,
|
|
w: m.w
|
|
}],
|
|
brakeLightEnabled: r.isBrakeLightEnabled(),
|
|
controls: a
|
|
}
|
|
}
|
|
Dv.length = 0, onmessage = i;
|
|
let s = performance.now(),
|
|
o = 0;
|
|
|
|
function l() {
|
|
const e = performance.now();
|
|
o += Math.max(0, Math.min(.1, (e - s) / 1e3)), s = e;
|
|
const t = [];
|
|
for (; o > .001;) {
|
|
o -= .001;
|
|
for (const e of n) {
|
|
if (null != e.targetSimulationTime) throw new Error("Realtime simulation does not support targetSimulationTime");
|
|
e.model.hasStarted() && e.model.getTime().numberOfFrames < Ch.maxFrames && !e.isPaused && t.push(a(e))
|
|
}
|
|
}
|
|
t.length > 0 && postMessage({
|
|
messageType: g_.UpdateResult,
|
|
carStates: t
|
|
}), requestAnimationFrame(l)
|
|
}
|
|
|
|
function c() {
|
|
const e = performance.now(),
|
|
t = [];
|
|
if (n.length > 0) {
|
|
let i;
|
|
do {
|
|
i = !0;
|
|
for (let e = 0; e < Math.max(1, Math.ceil(100 / n.length)); e++) {
|
|
for (const e of n)
|
|
if (e.model.hasStarted()) {
|
|
if (null == e.targetSimulationTime) throw new Error("Non-realtime simulation requires targetSimulationTime");
|
|
e.model.getTime().numberOfFrames < Ch.maxFrames && e.model.getTime().lessThan(e.targetSimulationTime) && !e.isPaused && (t.push(a(e)), i = !1)
|
|
} if (i) break
|
|
}
|
|
} while (Math.max(0, performance.now() - e) / 1e3 < .01 && !i)
|
|
}
|
|
postMessage({
|
|
messageType: g_.UpdateResult,
|
|
carStates: t
|
|
})
|
|
}
|
|
}))
|
|
})()
|
|
})(); |