Created
April 13, 2018 01:55
-
-
Save shawwn/cea161ed4cc88e62875c1e2faa13071c to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! For license information please see components_GLEasterEgg_app_GLEasterEgg_2fd989964ab5d9d1f8bdffdf5d09f42e-4394f555f71e35769463.js.LICENSE */ | |
__NEXT_REGISTER_CHUNK("components_GLEasterEgg_app_GLEasterEgg_2fd989964ab5d9d1f8bdffdf5d09f42e", function() { | |
webpackJsonp([1], { | |
536: function(t, e, n) { | |
"use strict"; | |
Object.defineProperty(e, "__esModule", { | |
value: !0 | |
}); | |
var i = n(1), | |
r = n.n(i), | |
a = n(0), | |
o = n(327), | |
s = n.n(o); | |
function c() {} | |
void 0 === Number.EPSILON && (Number.EPSILON = Math.pow(2, -52)), void 0 === Number.isInteger && (Number.isInteger = function(t) { | |
return "number" == typeof t && isFinite(t) && Math.floor(t) === t | |
}), void 0 === Math.sign && (Math.sign = function(t) { | |
return t < 0 ? -1 : t > 0 ? 1 : +t | |
}), "name" in Function.prototype == !1 && Object.defineProperty(Function.prototype, "name", { | |
get: function() { | |
return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1] | |
} | |
}), void 0 === Object.assign && (Object.assign = function(t) { | |
if (null == t) throw new TypeError("Cannot convert undefined or null to object"); | |
for (var e = Object(t), n = 1; n < arguments.length; n++) { | |
var i = arguments[n]; | |
if (null != i) | |
for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]) | |
} | |
return e | |
}), Object.assign(c.prototype, { | |
addEventListener: function(t, e) { | |
void 0 === this._listeners && (this._listeners = {}); | |
var n = this._listeners; | |
void 0 === n[t] && (n[t] = []), -1 === n[t].indexOf(e) && n[t].push(e) | |
}, | |
hasEventListener: function(t, e) { | |
if (void 0 === this._listeners) return !1; | |
var n = this._listeners; | |
return void 0 !== n[t] && -1 !== n[t].indexOf(e) | |
}, | |
removeEventListener: function(t, e) { | |
if (void 0 !== this._listeners) { | |
var n = this._listeners[t]; | |
if (void 0 !== n) { | |
var i = n.indexOf(e); - 1 !== i && n.splice(i, 1) | |
} | |
} | |
}, | |
dispatchEvent: function(t) { | |
if (void 0 !== this._listeners) { | |
var e = this._listeners[t.type]; | |
if (void 0 !== e) { | |
t.target = this; | |
for (var n = e.slice(0), i = 0, r = n.length; i < r; i++) n[i].call(this, t) | |
} | |
} | |
} | |
}); | |
var h, l, u, p, d, f, m, g, v, y = 0, | |
x = 1, | |
w = 2, | |
_ = 1, | |
b = 2, | |
A = 0, | |
M = 1, | |
E = 2, | |
S = 0, | |
T = 1, | |
C = 2, | |
I = 0, | |
L = 1, | |
R = 2, | |
P = 3, | |
O = 4, | |
D = 5, | |
U = 100, | |
N = 101, | |
B = 102, | |
z = 103, | |
F = 104, | |
G = 200, | |
k = 201, | |
H = 202, | |
V = 203, | |
j = 204, | |
W = 205, | |
X = 206, | |
q = 207, | |
Y = 208, | |
J = 209, | |
Z = 210, | |
Q = 0, | |
K = 1, | |
$ = 2, | |
tt = 3, | |
et = 4, | |
nt = 5, | |
it = 6, | |
rt = 7, | |
at = 0, | |
ot = 1, | |
st = 2, | |
ct = 0, | |
ht = 1, | |
lt = 2, | |
ut = 3, | |
pt = 4, | |
dt = 301, | |
ft = 302, | |
mt = 303, | |
gt = 304, | |
vt = 305, | |
yt = 306, | |
xt = 307, | |
wt = 1e3, | |
_t = 1001, | |
bt = 1002, | |
At = 1003, | |
Mt = 1004, | |
Et = 1005, | |
St = 1006, | |
Tt = 1007, | |
Ct = 1008, | |
It = 1009, | |
Lt = 1010, | |
Rt = 1011, | |
Pt = 1012, | |
Ot = 1013, | |
Dt = 1014, | |
Ut = 1015, | |
Nt = 1016, | |
Bt = 1017, | |
zt = 1018, | |
Ft = 1019, | |
Gt = 1020, | |
kt = 1021, | |
Ht = 1022, | |
Vt = 1023, | |
jt = 1024, | |
Wt = 1025, | |
Xt = 1026, | |
qt = 1027, | |
Yt = 33776, | |
Jt = 33777, | |
Zt = 33778, | |
Qt = 33779, | |
Kt = 35840, | |
$t = 35841, | |
te = 35842, | |
ee = 35843, | |
ne = 36196, | |
ie = 37808, | |
re = 37809, | |
ae = 37810, | |
oe = 37811, | |
se = 37812, | |
ce = 37813, | |
he = 37814, | |
le = 37815, | |
ue = 37816, | |
pe = 37817, | |
de = 37818, | |
fe = 37819, | |
me = 37820, | |
ge = 37821, | |
ve = 2201, | |
ye = 2400, | |
xe = 0, | |
we = 1, | |
_e = 2, | |
be = 3e3, | |
Ae = 3001, | |
Me = 3007, | |
Ee = 3002, | |
Se = 3004, | |
Te = 3005, | |
Ce = 3006, | |
Ie = 3200, | |
Le = 3201, | |
Re = { | |
DEG2RAD: Math.PI / 180, | |
RAD2DEG: 180 / Math.PI, | |
generateUUID: function() { | |
for (var t = [], e = 0; e < 256; e++) t[e] = (e < 16 ? "0" : "") + e.toString(16).toUpperCase(); | |
return function() { | |
var e = 4294967295 * Math.random() | 0, | |
n = 4294967295 * Math.random() | 0, | |
i = 4294967295 * Math.random() | 0, | |
r = 4294967295 * Math.random() | 0; | |
return t[255 & e] + t[e >> 8 & 255] + t[e >> 16 & 255] + t[e >> 24 & 255] + "-" + t[255 & n] + t[n >> 8 & 255] + "-" + t[n >> 16 & 15 | 64] + t[n >> 24 & 255] + "-" + t[63 & i | 128] + t[i >> 8 & 255] + "-" + t[i >> 16 & 255] + t[i >> 24 & 255] + t[255 & r] + t[r >> 8 & 255] + t[r >> 16 & 255] + t[r >> 24 & 255] | |
} | |
}(), | |
clamp: function(t, e, n) { | |
return Math.max(e, Math.min(n, t)) | |
}, | |
euclideanModulo: function(t, e) { | |
return (t % e + e) % e | |
}, | |
mapLinear: function(t, e, n, i, r) { | |
return i + (t - e) * (r - i) / (n - e) | |
}, | |
lerp: function(t, e, n) { | |
return (1 - n) * t + n * e | |
}, | |
smoothstep: function(t, e, n) { | |
return t <= e ? 0 : t >= n ? 1 : (t = (t - e) / (n - e)) * t * (3 - 2 * t) | |
}, | |
smootherstep: function(t, e, n) { | |
return t <= e ? 0 : t >= n ? 1 : (t = (t - e) / (n - e)) * t * t * (t * (6 * t - 15) + 10) | |
}, | |
randInt: function(t, e) { | |
return t + Math.floor(Math.random() * (e - t + 1)) | |
}, | |
randFloat: function(t, e) { | |
return t + Math.random() * (e - t) | |
}, | |
randFloatSpread: function(t) { | |
return t * (.5 - Math.random()) | |
}, | |
degToRad: function(t) { | |
return t * Re.DEG2RAD | |
}, | |
radToDeg: function(t) { | |
return t * Re.RAD2DEG | |
}, | |
isPowerOfTwo: function(t) { | |
return 0 == (t & t - 1) && 0 !== t | |
}, | |
ceilPowerOfTwo: function(t) { | |
return Math.pow(2, Math.ceil(Math.log(t) / Math.LN2)) | |
}, | |
floorPowerOfTwo: function(t) { | |
return Math.pow(2, Math.floor(Math.log(t) / Math.LN2)) | |
} | |
}; | |
function Pe(t, e) { | |
this.x = t || 0, this.y = e || 0 | |
} | |
function Oe() { | |
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], arguments.length > 0 && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.") | |
} | |
function De(t, e, n, i) { | |
this._x = t || 0, this._y = e || 0, this._z = n || 0, this._w = void 0 !== i ? i : 1 | |
} | |
function Ue(t, e, n) { | |
this.x = t || 0, this.y = e || 0, this.z = n || 0 | |
} | |
function Ne() { | |
this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], arguments.length > 0 && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.") | |
} | |
Object.defineProperties(Pe.prototype, { | |
width: { | |
get: function() { | |
return this.x | |
}, | |
set: function(t) { | |
this.x = t | |
} | |
}, | |
height: { | |
get: function() { | |
return this.y | |
}, | |
set: function(t) { | |
this.y = t | |
} | |
} | |
}), Object.assign(Pe.prototype, { | |
isVector2: !0, | |
set: function(t, e) { | |
return this.x = t, this.y = e, this | |
}, | |
setScalar: function(t) { | |
return this.x = t, this.y = t, this | |
}, | |
setX: function(t) { | |
return this.x = t, this | |
}, | |
setY: function(t) { | |
return this.y = t, this | |
}, | |
setComponent: function(t, e) { | |
switch (t) { | |
case 0: | |
this.x = e; | |
break; | |
case 1: | |
this.y = e; | |
break; | |
default: | |
throw new Error("index is out of range: " + t) | |
} | |
return this | |
}, | |
getComponent: function(t) { | |
switch (t) { | |
case 0: | |
return this.x; | |
case 1: | |
return this.y; | |
default: | |
throw new Error("index is out of range: " + t) | |
} | |
}, | |
clone: function() { | |
return new this.constructor(this.x, this.y) | |
}, | |
copy: function(t) { | |
return this.x = t.x, this.y = t.y, this | |
}, | |
add: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(t, e)) : (this.x += t.x, this.y += t.y, this) | |
}, | |
addScalar: function(t) { | |
return this.x += t, this.y += t, this | |
}, | |
addVectors: function(t, e) { | |
return this.x = t.x + e.x, this.y = t.y + e.y, this | |
}, | |
addScaledVector: function(t, e) { | |
return this.x += t.x * e, this.y += t.y * e, this | |
}, | |
sub: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(t, e)) : (this.x -= t.x, this.y -= t.y, this) | |
}, | |
subScalar: function(t) { | |
return this.x -= t, this.y -= t, this | |
}, | |
subVectors: function(t, e) { | |
return this.x = t.x - e.x, this.y = t.y - e.y, this | |
}, | |
multiply: function(t) { | |
return this.x *= t.x, this.y *= t.y, this | |
}, | |
multiplyScalar: function(t) { | |
return this.x *= t, this.y *= t, this | |
}, | |
divide: function(t) { | |
return this.x /= t.x, this.y /= t.y, this | |
}, | |
divideScalar: function(t) { | |
return this.multiplyScalar(1 / t) | |
}, | |
applyMatrix3: function(t) { | |
var e = this.x, | |
n = this.y, | |
i = t.elements; | |
return this.x = i[0] * e + i[3] * n + i[6], this.y = i[1] * e + i[4] * n + i[7], this | |
}, | |
min: function(t) { | |
return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this | |
}, | |
max: function(t) { | |
return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this | |
}, | |
clamp: function(t, e) { | |
return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this | |
}, | |
clampScalar: (h = new Pe, l = new Pe, function(t, e) { | |
return h.set(t, t), l.set(e, e), this.clamp(h, l) | |
}), | |
clampLength: function(t, e) { | |
var n = this.length(); | |
return this.divideScalar(n || 1).multiplyScalar(Math.max(t, Math.min(e, n))) | |
}, | |
floor: function() { | |
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this | |
}, | |
ceil: function() { | |
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this | |
}, | |
round: function() { | |
return this.x = Math.round(this.x), this.y = Math.round(this.y), this | |
}, | |
roundToZero: function() { | |
return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this | |
}, | |
negate: function() { | |
return this.x = -this.x, this.y = -this.y, this | |
}, | |
dot: function(t) { | |
return this.x * t.x + this.y * t.y | |
}, | |
lengthSq: function() { | |
return this.x * this.x + this.y * this.y | |
}, | |
length: function() { | |
return Math.sqrt(this.x * this.x + this.y * this.y) | |
}, | |
manhattanLength: function() { | |
return Math.abs(this.x) + Math.abs(this.y) | |
}, | |
normalize: function() { | |
return this.divideScalar(this.length() || 1) | |
}, | |
angle: function() { | |
var t = Math.atan2(this.y, this.x); | |
return t < 0 && (t += 2 * Math.PI), t | |
}, | |
distanceTo: function(t) { | |
return Math.sqrt(this.distanceToSquared(t)) | |
}, | |
distanceToSquared: function(t) { | |
var e = this.x - t.x, | |
n = this.y - t.y; | |
return e * e + n * n | |
}, | |
manhattanDistanceTo: function(t) { | |
return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) | |
}, | |
setLength: function(t) { | |
return this.normalize().multiplyScalar(t) | |
}, | |
lerp: function(t, e) { | |
return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this | |
}, | |
lerpVectors: function(t, e, n) { | |
return this.subVectors(e, t).multiplyScalar(n).add(t) | |
}, | |
equals: function(t) { | |
return t.x === this.x && t.y === this.y | |
}, | |
fromArray: function(t, e) { | |
return void 0 === e && (e = 0), this.x = t[e], this.y = t[e + 1], this | |
}, | |
toArray: function(t, e) { | |
return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this.x, t[e + 1] = this.y, t | |
}, | |
fromBufferAttribute: function(t, e, n) { | |
return void 0 !== n && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."), this.x = t.getX(e), this.y = t.getY(e), this | |
}, | |
rotateAround: function(t, e) { | |
var n = Math.cos(e), | |
i = Math.sin(e), | |
r = this.x - t.x, | |
a = this.y - t.y; | |
return this.x = r * n - a * i + t.x, this.y = r * i + a * n + t.y, this | |
} | |
}), Object.assign(Oe.prototype, { | |
isMatrix4: !0, | |
set: function(t, e, n, i, r, a, o, s, c, h, l, u, p, d, f, m) { | |
var g = this.elements; | |
return g[0] = t, g[4] = e, g[8] = n, g[12] = i, g[1] = r, g[5] = a, g[9] = o, g[13] = s, g[2] = c, g[6] = h, g[10] = l, g[14] = u, g[3] = p, g[7] = d, g[11] = f, g[15] = m, this | |
}, | |
identity: function() { | |
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this | |
}, | |
clone: function() { | |
return (new Oe).fromArray(this.elements) | |
}, | |
copy: function(t) { | |
var e = this.elements, | |
n = t.elements; | |
return e[0] = n[0], e[1] = n[1], e[2] = n[2], e[3] = n[3], e[4] = n[4], e[5] = n[5], e[6] = n[6], e[7] = n[7], e[8] = n[8], e[9] = n[9], e[10] = n[10], e[11] = n[11], e[12] = n[12], e[13] = n[13], e[14] = n[14], e[15] = n[15], this | |
}, | |
copyPosition: function(t) { | |
var e = this.elements, | |
n = t.elements; | |
return e[12] = n[12], e[13] = n[13], e[14] = n[14], this | |
}, | |
extractBasis: function(t, e, n) { | |
return t.setFromMatrixColumn(this, 0), e.setFromMatrixColumn(this, 1), n.setFromMatrixColumn(this, 2), this | |
}, | |
makeBasis: function(t, e, n) { | |
return this.set(t.x, e.x, n.x, 0, t.y, e.y, n.y, 0, t.z, e.z, n.z, 0, 0, 0, 0, 1), this | |
}, | |
extractRotation: (g = new Ue, function(t) { | |
var e = this.elements, | |
n = t.elements, | |
i = 1 / g.setFromMatrixColumn(t, 0).length(), | |
r = 1 / g.setFromMatrixColumn(t, 1).length(), | |
a = 1 / g.setFromMatrixColumn(t, 2).length(); | |
return e[0] = n[0] * i, e[1] = n[1] * i, e[2] = n[2] * i, e[4] = n[4] * r, e[5] = n[5] * r, e[6] = n[6] * r, e[8] = n[8] * a, e[9] = n[9] * a, e[10] = n[10] * a, this | |
}), | |
makeRotationFromEuler: function(t) { | |
t && t.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."); | |
var e = this.elements, | |
n = t.x, | |
i = t.y, | |
r = t.z, | |
a = Math.cos(n), | |
o = Math.sin(n), | |
s = Math.cos(i), | |
c = Math.sin(i), | |
h = Math.cos(r), | |
l = Math.sin(r); | |
if ("XYZ" === t.order) { | |
var u = a * h, | |
p = a * l, | |
d = o * h, | |
f = o * l; | |
e[0] = s * h, e[4] = -s * l, e[8] = c, e[1] = p + d * c, e[5] = u - f * c, e[9] = -o * s, e[2] = f - u * c, e[6] = d + p * c, e[10] = a * s | |
} else if ("YXZ" === t.order) { | |
var m = s * h, | |
g = s * l, | |
v = c * h, | |
y = c * l; | |
e[0] = m + y * o, e[4] = v * o - g, e[8] = a * c, e[1] = a * l, e[5] = a * h, e[9] = -o, e[2] = g * o - v, e[6] = y + m * o, e[10] = a * s | |
} else if ("ZXY" === t.order) { | |
m = s * h, g = s * l, v = c * h, y = c * l; | |
e[0] = m - y * o, e[4] = -a * l, e[8] = v + g * o, e[1] = g + v * o, e[5] = a * h, e[9] = y - m * o, e[2] = -a * c, e[6] = o, e[10] = a * s | |
} else if ("ZYX" === t.order) { | |
u = a * h, p = a * l, d = o * h, f = o * l; | |
e[0] = s * h, e[4] = d * c - p, e[8] = u * c + f, e[1] = s * l, e[5] = f * c + u, e[9] = p * c - d, e[2] = -c, e[6] = o * s, e[10] = a * s | |
} else if ("YZX" === t.order) { | |
var x = a * s, | |
w = a * c, | |
_ = o * s, | |
b = o * c; | |
e[0] = s * h, e[4] = b - x * l, e[8] = _ * l + w, e[1] = l, e[5] = a * h, e[9] = -o * h, e[2] = -c * h, e[6] = w * l + _, e[10] = x - b * l | |
} else if ("XZY" === t.order) { | |
x = a * s, w = a * c, _ = o * s, b = o * c; | |
e[0] = s * h, e[4] = -l, e[8] = c * h, e[1] = x * l + b, e[5] = a * h, e[9] = w * l - _, e[2] = _ * l - w, e[6] = o * h, e[10] = b * l + x | |
} | |
return e[3] = 0, e[7] = 0, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, this | |
}, | |
makeRotationFromQuaternion: function(t) { | |
var e = this.elements, | |
n = t._x, | |
i = t._y, | |
r = t._z, | |
a = t._w, | |
o = n + n, | |
s = i + i, | |
c = r + r, | |
h = n * o, | |
l = n * s, | |
u = n * c, | |
p = i * s, | |
d = i * c, | |
f = r * c, | |
m = a * o, | |
g = a * s, | |
v = a * c; | |
return e[0] = 1 - (p + f), e[4] = l - v, e[8] = u + g, e[1] = l + v, e[5] = 1 - (h + f), e[9] = d - m, e[2] = u - g, e[6] = d + m, e[10] = 1 - (h + p), e[3] = 0, e[7] = 0, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, this | |
}, | |
lookAt: (d = new Ue, f = new Ue, m = new Ue, function(t, e, n) { | |
var i = this.elements; | |
return m.subVectors(t, e), 0 === m.lengthSq() && (m.z = 1), m.normalize(), d.crossVectors(n, m), 0 === d.lengthSq() && (1 === Math.abs(n.z) ? m.x += 1e-4 : m.z += 1e-4, m.normalize(), d.crossVectors(n, m)), d.normalize(), f.crossVectors(m, d), i[0] = d.x, i[4] = f.x, i[8] = m.x, i[1] = d.y, i[5] = f.y, i[9] = m.y, i[2] = d.z, i[6] = f.z, i[10] = m.z, this | |
}), | |
multiply: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(t, e)) : this.multiplyMatrices(this, t) | |
}, | |
premultiply: function(t) { | |
return this.multiplyMatrices(t, this) | |
}, | |
multiplyMatrices: function(t, e) { | |
var n = t.elements, | |
i = e.elements, | |
r = this.elements, | |
a = n[0], | |
o = n[4], | |
s = n[8], | |
c = n[12], | |
h = n[1], | |
l = n[5], | |
u = n[9], | |
p = n[13], | |
d = n[2], | |
f = n[6], | |
m = n[10], | |
g = n[14], | |
v = n[3], | |
y = n[7], | |
x = n[11], | |
w = n[15], | |
_ = i[0], | |
b = i[4], | |
A = i[8], | |
M = i[12], | |
E = i[1], | |
S = i[5], | |
T = i[9], | |
C = i[13], | |
I = i[2], | |
L = i[6], | |
R = i[10], | |
P = i[14], | |
O = i[3], | |
D = i[7], | |
U = i[11], | |
N = i[15]; | |
return r[0] = a * _ + o * E + s * I + c * O, r[4] = a * b + o * S + s * L + c * D, r[8] = a * A + o * T + s * R + c * U, r[12] = a * M + o * C + s * P + c * N, r[1] = h * _ + l * E + u * I + p * O, r[5] = h * b + l * S + u * L + p * D, r[9] = h * A + l * T + u * R + p * U, r[13] = h * M + l * C + u * P + p * N, r[2] = d * _ + f * E + m * I + g * O, r[6] = d * b + f * S + m * L + g * D, r[10] = d * A + f * T + m * R + g * U, r[14] = d * M + f * C + m * P + g * N, r[3] = v * _ + y * E + x * I + w * O, r[7] = v * b + y * S + x * L + w * D, r[11] = v * A + y * T + x * R + w * U, r[15] = v * M + y * C + x * P + w * N, this | |
}, | |
multiplyScalar: function(t) { | |
var e = this.elements; | |
return e[0] *= t, e[4] *= t, e[8] *= t, e[12] *= t, e[1] *= t, e[5] *= t, e[9] *= t, e[13] *= t, e[2] *= t, e[6] *= t, e[10] *= t, e[14] *= t, e[3] *= t, e[7] *= t, e[11] *= t, e[15] *= t, this | |
}, | |
applyToBufferAttribute: function() { | |
var t = new Ue; | |
return function(e) { | |
for (var n = 0, i = e.count; n < i; n++) t.x = e.getX(n), t.y = e.getY(n), t.z = e.getZ(n), t.applyMatrix4(this), e.setXYZ(n, t.x, t.y, t.z); | |
return e | |
} | |
}(), | |
determinant: function() { | |
var t = this.elements, | |
e = t[0], | |
n = t[4], | |
i = t[8], | |
r = t[12], | |
a = t[1], | |
o = t[5], | |
s = t[9], | |
c = t[13], | |
h = t[2], | |
l = t[6], | |
u = t[10], | |
p = t[14]; | |
return t[3] * (+r * s * l - i * c * l - r * o * u + n * c * u + i * o * p - n * s * p) + t[7] * (+e * s * p - e * c * u + r * a * u - i * a * p + i * c * h - r * s * h) + t[11] * (+e * c * l - e * o * p - r * a * l + n * a * p + r * o * h - n * c * h) + t[15] * (-i * o * h - e * s * l + e * o * u + i * a * l - n * a * u + n * s * h) | |
}, | |
transpose: function() { | |
var t, e = this.elements; | |
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: function(t) { | |
var e = this.elements; | |
return e[12] = t.x, e[13] = t.y, e[14] = t.z, this | |
}, | |
getInverse: function(t, e) { | |
var n = this.elements, | |
i = t.elements, | |
r = i[0], | |
a = i[1], | |
o = i[2], | |
s = i[3], | |
c = i[4], | |
h = i[5], | |
l = i[6], | |
u = i[7], | |
p = i[8], | |
d = i[9], | |
f = i[10], | |
m = i[11], | |
g = i[12], | |
v = i[13], | |
y = i[14], | |
x = i[15], | |
w = d * y * u - v * f * u + v * l * m - h * y * m - d * l * x + h * f * x, | |
_ = g * f * u - p * y * u - g * l * m + c * y * m + p * l * x - c * f * x, | |
b = p * v * u - g * d * u + g * h * m - c * v * m - p * h * x + c * d * x, | |
A = g * d * l - p * v * l - g * h * f + c * v * f + p * h * y - c * d * y, | |
M = r * w + a * _ + o * b + s * A; | |
if (0 === M) { | |
var E = "THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0"; | |
if (!0 === e) throw new Error(E); | |
return console.warn(E), this.identity() | |
} | |
var S = 1 / M; | |
return n[0] = w * S, n[1] = (v * f * s - d * y * s - v * o * m + a * y * m + d * o * x - a * f * x) * S, n[2] = (h * y * s - v * l * s + v * o * u - a * y * u - h * o * x + a * l * x) * S, n[3] = (d * l * s - h * f * s - d * o * u + a * f * u + h * o * m - a * l * m) * S, n[4] = _ * S, n[5] = (p * y * s - g * f * s + g * o * m - r * y * m - p * o * x + r * f * x) * S, n[6] = (g * l * s - c * y * s - g * o * u + r * y * u + c * o * x - r * l * x) * S, n[7] = (c * f * s - p * l * s + p * o * u - r * f * u - c * o * m + r * l * m) * S, n[8] = b * S, n[9] = (g * d * s - p * v * s - g * a * m + r * v * m + p * a * x - r * d * x) * S, n[10] = (c * v * s - g * h * s + g * a * u - r * v * u - c * a * x + r * h * x) * S, n[11] = (p * h * s - c * d * s - p * a * u + r * d * u + c * a * m - r * h * m) * S, n[12] = A * S, n[13] = (p * v * o - g * d * o + g * a * f - r * v * f - p * a * y + r * d * y) * S, n[14] = (g * h * o - c * v * o - g * a * l + r * v * l + c * a * y - r * h * y) * S, n[15] = (c * d * o - p * h * o + p * a * l - r * d * l - c * a * f + r * h * f) * S, this | |
}, | |
scale: function(t) { | |
var e = this.elements, | |
n = t.x, | |
i = t.y, | |
r = t.z; | |
return e[0] *= n, e[4] *= i, e[8] *= r, e[1] *= n, e[5] *= i, e[9] *= r, e[2] *= n, e[6] *= i, e[10] *= r, e[3] *= n, e[7] *= i, e[11] *= r, this | |
}, | |
getMaxScaleOnAxis: function() { | |
var t = this.elements, | |
e = t[0] * t[0] + t[1] * t[1] + t[2] * t[2], | |
n = t[4] * t[4] + t[5] * t[5] + t[6] * t[6], | |
i = t[8] * t[8] + t[9] * t[9] + t[10] * t[10]; | |
return Math.sqrt(Math.max(e, n, i)) | |
}, | |
makeTranslation: function(t, e, n) { | |
return this.set(1, 0, 0, t, 0, 1, 0, e, 0, 0, 1, n, 0, 0, 0, 1), this | |
}, | |
makeRotationX: function(t) { | |
var e = Math.cos(t), | |
n = Math.sin(t); | |
return this.set(1, 0, 0, 0, 0, e, -n, 0, 0, n, e, 0, 0, 0, 0, 1), this | |
}, | |
makeRotationY: function(t) { | |
var e = Math.cos(t), | |
n = Math.sin(t); | |
return this.set(e, 0, n, 0, 0, 1, 0, 0, -n, 0, e, 0, 0, 0, 0, 1), this | |
}, | |
makeRotationZ: function(t) { | |
var e = Math.cos(t), | |
n = Math.sin(t); | |
return this.set(e, -n, 0, 0, n, e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this | |
}, | |
makeRotationAxis: function(t, e) { | |
var n = Math.cos(e), | |
i = Math.sin(e), | |
r = 1 - n, | |
a = t.x, | |
o = t.y, | |
s = t.z, | |
c = r * a, | |
h = r * o; | |
return this.set(c * a + n, c * o - i * s, c * s + i * o, 0, c * o + i * s, h * o + n, h * s - i * a, 0, c * s - i * o, h * s + i * a, r * s * s + n, 0, 0, 0, 0, 1), this | |
}, | |
makeScale: function(t, e, n) { | |
return this.set(t, 0, 0, 0, 0, e, 0, 0, 0, 0, n, 0, 0, 0, 0, 1), this | |
}, | |
makeShear: function(t, e, n) { | |
return this.set(1, e, n, 0, t, 1, n, 0, t, e, 1, 0, 0, 0, 0, 1), this | |
}, | |
compose: function(t, e, n) { | |
return this.makeRotationFromQuaternion(e), this.scale(n), this.setPosition(t), this | |
}, | |
decompose: (u = new Ue, p = new Oe, function(t, e, n) { | |
var i = this.elements, | |
r = u.set(i[0], i[1], i[2]).length(), | |
a = u.set(i[4], i[5], i[6]).length(), | |
o = u.set(i[8], i[9], i[10]).length(); | |
this.determinant() < 0 && (r = -r), t.x = i[12], t.y = i[13], t.z = i[14], p.copy(this); | |
var s = 1 / r, | |
c = 1 / a, | |
h = 1 / o; | |
return p.elements[0] *= s, p.elements[1] *= s, p.elements[2] *= s, p.elements[4] *= c, p.elements[5] *= c, p.elements[6] *= c, p.elements[8] *= h, p.elements[9] *= h, p.elements[10] *= h, e.setFromRotationMatrix(p), n.x = r, n.y = a, n.z = o, this | |
}), | |
makePerspective: function(t, e, n, i, r, a) { | |
void 0 === a && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); | |
var o = this.elements, | |
s = 2 * r / (e - t), | |
c = 2 * r / (n - i), | |
h = (e + t) / (e - t), | |
l = (n + i) / (n - i), | |
u = -(a + r) / (a - r), | |
p = -2 * a * r / (a - r); | |
return o[0] = s, o[4] = 0, o[8] = h, o[12] = 0, o[1] = 0, o[5] = c, o[9] = l, o[13] = 0, o[2] = 0, o[6] = 0, o[10] = u, o[14] = p, o[3] = 0, o[7] = 0, o[11] = -1, o[15] = 0, this | |
}, | |
makeOrthographic: function(t, e, n, i, r, a) { | |
var o = this.elements, | |
s = 1 / (e - t), | |
c = 1 / (n - i), | |
h = 1 / (a - r), | |
l = (e + t) * s, | |
u = (n + i) * c, | |
p = (a + r) * h; | |
return o[0] = 2 * s, o[4] = 0, o[8] = 0, o[12] = -l, o[1] = 0, o[5] = 2 * c, o[9] = 0, o[13] = -u, o[2] = 0, o[6] = 0, o[10] = -2 * h, o[14] = -p, o[3] = 0, o[7] = 0, o[11] = 0, o[15] = 1, this | |
}, | |
equals: function(t) { | |
for (var e = this.elements, n = t.elements, i = 0; i < 16; i++) | |
if (e[i] !== n[i]) return !1; | |
return !0 | |
}, | |
fromArray: function(t, e) { | |
void 0 === e && (e = 0); | |
for (var n = 0; n < 16; n++) this.elements[n] = t[n + e]; | |
return this | |
}, | |
toArray: function(t, e) { | |
void 0 === t && (t = []), void 0 === e && (e = 0); | |
var n = this.elements; | |
return t[e] = n[0], t[e + 1] = n[1], t[e + 2] = n[2], t[e + 3] = n[3], t[e + 4] = n[4], t[e + 5] = n[5], t[e + 6] = n[6], t[e + 7] = n[7], t[e + 8] = n[8], t[e + 9] = n[9], t[e + 10] = n[10], t[e + 11] = n[11], t[e + 12] = n[12], t[e + 13] = n[13], t[e + 14] = n[14], t[e + 15] = n[15], t | |
} | |
}), Object.assign(De, { | |
slerp: function(t, e, n, i) { | |
return n.copy(t).slerp(e, i) | |
}, | |
slerpFlat: function(t, e, n, i, r, a, o) { | |
var s = n[i + 0], | |
c = n[i + 1], | |
h = n[i + 2], | |
l = n[i + 3], | |
u = r[a + 0], | |
p = r[a + 1], | |
d = r[a + 2], | |
f = r[a + 3]; | |
if (l !== f || s !== u || c !== p || h !== d) { | |
var m = 1 - o, | |
g = s * u + c * p + h * d + l * f, | |
v = g >= 0 ? 1 : -1, | |
y = 1 - g * g; | |
if (y > Number.EPSILON) { | |
var x = Math.sqrt(y), | |
w = Math.atan2(x, g * v); | |
m = Math.sin(m * w) / x, o = Math.sin(o * w) / x | |
} | |
var _ = o * v; | |
if (s = s * m + u * _, c = c * m + p * _, h = h * m + d * _, l = l * m + f * _, m === 1 - o) { | |
var b = 1 / Math.sqrt(s * s + c * c + h * h + l * l); | |
s *= b, c *= b, h *= b, l *= b | |
} | |
} | |
t[e] = s, t[e + 1] = c, t[e + 2] = h, t[e + 3] = l | |
} | |
}), Object.defineProperties(De.prototype, { | |
x: { | |
get: function() { | |
return this._x | |
}, | |
set: function(t) { | |
this._x = t, this.onChangeCallback() | |
} | |
}, | |
y: { | |
get: function() { | |
return this._y | |
}, | |
set: function(t) { | |
this._y = t, this.onChangeCallback() | |
} | |
}, | |
z: { | |
get: function() { | |
return this._z | |
}, | |
set: function(t) { | |
this._z = t, this.onChangeCallback() | |
} | |
}, | |
w: { | |
get: function() { | |
return this._w | |
}, | |
set: function(t) { | |
this._w = t, this.onChangeCallback() | |
} | |
} | |
}), Object.assign(De.prototype, { | |
set: function(t, e, n, i) { | |
return this._x = t, this._y = e, this._z = n, this._w = i, this.onChangeCallback(), this | |
}, | |
clone: function() { | |
return new this.constructor(this._x, this._y, this._z, this._w) | |
}, | |
copy: function(t) { | |
return this._x = t.x, this._y = t.y, this._z = t.z, this._w = t.w, this.onChangeCallback(), this | |
}, | |
setFromEuler: function(t, e) { | |
if (!t || !t.isEuler) throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order."); | |
var n = t._x, | |
i = t._y, | |
r = t._z, | |
a = t.order, | |
o = Math.cos, | |
s = Math.sin, | |
c = o(n / 2), | |
h = o(i / 2), | |
l = o(r / 2), | |
u = s(n / 2), | |
p = s(i / 2), | |
d = s(r / 2); | |
return "XYZ" === a ? (this._x = u * h * l + c * p * d, this._y = c * p * l - u * h * d, this._z = c * h * d + u * p * l, this._w = c * h * l - u * p * d) : "YXZ" === a ? (this._x = u * h * l + c * p * d, this._y = c * p * l - u * h * d, this._z = c * h * d - u * p * l, this._w = c * h * l + u * p * d) : "ZXY" === a ? (this._x = u * h * l - c * p * d, this._y = c * p * l + u * h * d, this._z = c * h * d + u * p * l, this._w = c * h * l - u * p * d) : "ZYX" === a ? (this._x = u * h * l - c * p * d, this._y = c * p * l + u * h * d, this._z = c * h * d - u * p * l, this._w = c * h * l + u * p * d) : "YZX" === a ? (this._x = u * h * l + c * p * d, this._y = c * p * l + u * h * d, this._z = c * h * d - u * p * l, this._w = c * h * l - u * p * d) : "XZY" === a && (this._x = u * h * l - c * p * d, this._y = c * p * l - u * h * d, this._z = c * h * d + u * p * l, this._w = c * h * l + u * p * d), !1 !== e && this.onChangeCallback(), this | |
}, | |
setFromAxisAngle: function(t, e) { | |
var n = e / 2, | |
i = Math.sin(n); | |
return this._x = t.x * i, this._y = t.y * i, this._z = t.z * i, this._w = Math.cos(n), this.onChangeCallback(), this | |
}, | |
setFromRotationMatrix: function(t) { | |
var e, n = t.elements, | |
i = n[0], | |
r = n[4], | |
a = n[8], | |
o = n[1], | |
s = n[5], | |
c = n[9], | |
h = n[2], | |
l = n[6], | |
u = n[10], | |
p = i + s + u; | |
return p > 0 ? (e = .5 / Math.sqrt(p + 1), this._w = .25 / e, this._x = (l - c) * e, this._y = (a - h) * e, this._z = (o - r) * e) : i > s && i > u ? (e = 2 * Math.sqrt(1 + i - s - u), this._w = (l - c) / e, this._x = .25 * e, this._y = (r + o) / e, this._z = (a + h) / e) : s > u ? (e = 2 * Math.sqrt(1 + s - i - u), this._w = (a - h) / e, this._x = (r + o) / e, this._y = .25 * e, this._z = (c + l) / e) : (e = 2 * Math.sqrt(1 + u - i - s), this._w = (o - r) / e, this._x = (a + h) / e, this._y = (c + l) / e, this._z = .25 * e), this.onChangeCallback(), this | |
}, | |
setFromUnitVectors: function() { | |
var t, e = new Ue; | |
return function(n, i) { | |
return void 0 === e && (e = new Ue), (t = n.dot(i) + 1) < 1e-6 ? (t = 0, Math.abs(n.x) > Math.abs(n.z) ? e.set(-n.y, n.x, 0) : e.set(0, -n.z, n.y)) : e.crossVectors(n, i), this._x = e.x, this._y = e.y, this._z = e.z, this._w = t, this.normalize() | |
} | |
}(), | |
inverse: function() { | |
return this.conjugate() | |
}, | |
conjugate: function() { | |
return this._x *= -1, this._y *= -1, this._z *= -1, this.onChangeCallback(), this | |
}, | |
dot: function(t) { | |
return this._x * t._x + this._y * t._y + this._z * t._z + this._w * t._w | |
}, | |
lengthSq: function() { | |
return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w | |
}, | |
length: function() { | |
return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w) | |
}, | |
normalize: function() { | |
var t = this.length(); | |
return 0 === t ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (t = 1 / t, this._x = this._x * t, this._y = this._y * t, this._z = this._z * t, this._w = this._w * t), this.onChangeCallback(), this | |
}, | |
multiply: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(t, e)) : this.multiplyQuaternions(this, t) | |
}, | |
premultiply: function(t) { | |
return this.multiplyQuaternions(t, this) | |
}, | |
multiplyQuaternions: function(t, e) { | |
var n = t._x, | |
i = t._y, | |
r = t._z, | |
a = t._w, | |
o = e._x, | |
s = e._y, | |
c = e._z, | |
h = e._w; | |
return this._x = n * h + a * o + i * c - r * s, this._y = i * h + a * s + r * o - n * c, this._z = r * h + a * c + n * s - i * o, this._w = a * h - n * o - i * s - r * c, this.onChangeCallback(), this | |
}, | |
slerp: function(t, e) { | |
if (0 === e) return this; | |
if (1 === e) return this.copy(t); | |
var n = this._x, | |
i = this._y, | |
r = this._z, | |
a = this._w, | |
o = a * t._w + n * t._x + i * t._y + r * t._z; | |
if (o < 0 ? (this._w = -t._w, this._x = -t._x, this._y = -t._y, this._z = -t._z, o = -o) : this.copy(t), o >= 1) return this._w = a, this._x = n, this._y = i, this._z = r, this; | |
var s = Math.sqrt(1 - o * o); | |
if (Math.abs(s) < .001) return this._w = .5 * (a + this._w), this._x = .5 * (n + this._x), this._y = .5 * (i + this._y), this._z = .5 * (r + this._z), this; | |
var c = Math.atan2(s, o), | |
h = Math.sin((1 - e) * c) / s, | |
l = Math.sin(e * c) / s; | |
return this._w = a * h + this._w * l, this._x = n * h + this._x * l, this._y = i * h + this._y * l, this._z = r * h + this._z * l, this.onChangeCallback(), this | |
}, | |
equals: function(t) { | |
return t._x === this._x && t._y === this._y && t._z === this._z && t._w === this._w | |
}, | |
fromArray: function(t, e) { | |
return void 0 === e && (e = 0), this._x = t[e], this._y = t[e + 1], this._z = t[e + 2], this._w = t[e + 3], this.onChangeCallback(), this | |
}, | |
toArray: function(t, e) { | |
return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._w, t | |
}, | |
onChange: function(t) { | |
return this.onChangeCallback = t, this | |
}, | |
onChangeCallback: function() {} | |
}), Object.assign(Ue.prototype, { | |
isVector3: !0, | |
set: function(t, e, n) { | |
return this.x = t, this.y = e, this.z = n, this | |
}, | |
setScalar: function(t) { | |
return this.x = t, this.y = t, this.z = t, this | |
}, | |
setX: function(t) { | |
return this.x = t, this | |
}, | |
setY: function(t) { | |
return this.y = t, this | |
}, | |
setZ: function(t) { | |
return this.z = t, this | |
}, | |
setComponent: function(t, e) { | |
switch (t) { | |
case 0: | |
this.x = e; | |
break; | |
case 1: | |
this.y = e; | |
break; | |
case 2: | |
this.z = e; | |
break; | |
default: | |
throw new Error("index is out of range: " + t) | |
} | |
return this | |
}, | |
getComponent: function(t) { | |
switch (t) { | |
case 0: | |
return this.x; | |
case 1: | |
return this.y; | |
case 2: | |
return this.z; | |
default: | |
throw new Error("index is out of range: " + t) | |
} | |
}, | |
clone: function() { | |
return new this.constructor(this.x, this.y, this.z) | |
}, | |
copy: function(t) { | |
return this.x = t.x, this.y = t.y, this.z = t.z, this | |
}, | |
add: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(t, e)) : (this.x += t.x, this.y += t.y, this.z += t.z, this) | |
}, | |
addScalar: function(t) { | |
return this.x += t, this.y += t, this.z += t, this | |
}, | |
addVectors: function(t, e) { | |
return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this | |
}, | |
addScaledVector: function(t, e) { | |
return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this | |
}, | |
sub: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(t, e)) : (this.x -= t.x, this.y -= t.y, this.z -= t.z, this) | |
}, | |
subScalar: function(t) { | |
return this.x -= t, this.y -= t, this.z -= t, this | |
}, | |
subVectors: function(t, e) { | |
return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this | |
}, | |
multiply: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(t, e)) : (this.x *= t.x, this.y *= t.y, this.z *= t.z, this) | |
}, | |
multiplyScalar: function(t) { | |
return this.x *= t, this.y *= t, this.z *= t, this | |
}, | |
multiplyVectors: function(t, e) { | |
return this.x = t.x * e.x, this.y = t.y * e.y, this.z = t.z * e.z, this | |
}, | |
applyEuler: (v = new De, function(t) { | |
return t && t.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."), this.applyQuaternion(v.setFromEuler(t)) | |
}), | |
applyAxisAngle: function() { | |
var t = new De; | |
return function(e, n) { | |
return this.applyQuaternion(t.setFromAxisAngle(e, n)) | |
} | |
}(), | |
applyMatrix3: function(t) { | |
var e = this.x, | |
n = this.y, | |
i = this.z, | |
r = t.elements; | |
return this.x = r[0] * e + r[3] * n + r[6] * i, this.y = r[1] * e + r[4] * n + r[7] * i, this.z = r[2] * e + r[5] * n + r[8] * i, this | |
}, | |
applyMatrix4: function(t) { | |
var e = this.x, | |
n = this.y, | |
i = this.z, | |
r = t.elements, | |
a = 1 / (r[3] * e + r[7] * n + r[11] * i + r[15]); | |
return this.x = (r[0] * e + r[4] * n + r[8] * i + r[12]) * a, this.y = (r[1] * e + r[5] * n + r[9] * i + r[13]) * a, this.z = (r[2] * e + r[6] * n + r[10] * i + r[14]) * a, this | |
}, | |
applyQuaternion: function(t) { | |
var e = this.x, | |
n = this.y, | |
i = this.z, | |
r = t.x, | |
a = t.y, | |
o = t.z, | |
s = t.w, | |
c = s * e + a * i - o * n, | |
h = s * n + o * e - r * i, | |
l = s * i + r * n - a * e, | |
u = -r * e - a * n - o * i; | |
return this.x = c * s + u * -r + h * -o - l * -a, this.y = h * s + u * -a + l * -r - c * -o, this.z = l * s + u * -o + c * -a - h * -r, this | |
}, | |
project: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.multiplyMatrices(e.projectionMatrix, t.getInverse(e.matrixWorld)), this.applyMatrix4(t) | |
} | |
}(), | |
unproject: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.multiplyMatrices(e.matrixWorld, t.getInverse(e.projectionMatrix)), this.applyMatrix4(t) | |
} | |
}(), | |
transformDirection: function(t) { | |
var e = this.x, | |
n = this.y, | |
i = this.z, | |
r = t.elements; | |
return this.x = r[0] * e + r[4] * n + r[8] * i, this.y = r[1] * e + r[5] * n + r[9] * i, this.z = r[2] * e + r[6] * n + r[10] * i, this.normalize() | |
}, | |
divide: function(t) { | |
return this.x /= t.x, this.y /= t.y, this.z /= t.z, this | |
}, | |
divideScalar: function(t) { | |
return this.multiplyScalar(1 / t) | |
}, | |
min: function(t) { | |
return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this | |
}, | |
max: function(t) { | |
return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this | |
}, | |
clamp: function(t, e) { | |
return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this.z = Math.max(t.z, Math.min(e.z, this.z)), this | |
}, | |
clampScalar: function() { | |
var t = new Ue, | |
e = new Ue; | |
return function(n, i) { | |
return t.set(n, n, n), e.set(i, i, i), this.clamp(t, e) | |
} | |
}(), | |
clampLength: function(t, e) { | |
var n = this.length(); | |
return this.divideScalar(n || 1).multiplyScalar(Math.max(t, Math.min(e, n))) | |
}, | |
floor: function() { | |
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this | |
}, | |
ceil: function() { | |
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this | |
}, | |
round: function() { | |
return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this | |
}, | |
roundToZero: function() { | |
return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this | |
}, | |
negate: function() { | |
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this | |
}, | |
dot: function(t) { | |
return this.x * t.x + this.y * t.y + this.z * t.z | |
}, | |
lengthSq: function() { | |
return this.x * this.x + this.y * this.y + this.z * this.z | |
}, | |
length: function() { | |
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z) | |
}, | |
manhattanLength: function() { | |
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) | |
}, | |
normalize: function() { | |
return this.divideScalar(this.length() || 1) | |
}, | |
setLength: function(t) { | |
return this.normalize().multiplyScalar(t) | |
}, | |
lerp: function(t, e) { | |
return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this | |
}, | |
lerpVectors: function(t, e, n) { | |
return this.subVectors(e, t).multiplyScalar(n).add(t) | |
}, | |
cross: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), this.crossVectors(t, e)) : this.crossVectors(this, t) | |
}, | |
crossVectors: function(t, e) { | |
var n = t.x, | |
i = t.y, | |
r = t.z, | |
a = e.x, | |
o = e.y, | |
s = e.z; | |
return this.x = i * s - r * o, this.y = r * a - n * s, this.z = n * o - i * a, this | |
}, | |
projectOnVector: function(t) { | |
var e = t.dot(this) / t.lengthSq(); | |
return this.copy(t).multiplyScalar(e) | |
}, | |
projectOnPlane: function() { | |
var t = new Ue; | |
return function(e) { | |
return t.copy(this).projectOnVector(e), this.sub(t) | |
} | |
}(), | |
reflect: function() { | |
var t = new Ue; | |
return function(e) { | |
return this.sub(t.copy(e).multiplyScalar(2 * this.dot(e))) | |
} | |
}(), | |
angleTo: function(t) { | |
var e = this.dot(t) / Math.sqrt(this.lengthSq() * t.lengthSq()); | |
return Math.acos(Re.clamp(e, -1, 1)) | |
}, | |
distanceTo: function(t) { | |
return Math.sqrt(this.distanceToSquared(t)) | |
}, | |
distanceToSquared: function(t) { | |
var e = this.x - t.x, | |
n = this.y - t.y, | |
i = this.z - t.z; | |
return e * e + n * n + i * i | |
}, | |
manhattanDistanceTo: function(t) { | |
return Math.abs(this.x - t.x) + Math.abs(this.y - t.y) + Math.abs(this.z - t.z) | |
}, | |
setFromSpherical: function(t) { | |
var e = Math.sin(t.phi) * t.radius; | |
return this.x = e * Math.sin(t.theta), this.y = Math.cos(t.phi) * t.radius, this.z = e * Math.cos(t.theta), this | |
}, | |
setFromCylindrical: function(t) { | |
return this.x = t.radius * Math.sin(t.theta), this.y = t.y, this.z = t.radius * Math.cos(t.theta), this | |
}, | |
setFromMatrixPosition: function(t) { | |
var e = t.elements; | |
return this.x = e[12], this.y = e[13], this.z = e[14], this | |
}, | |
setFromMatrixScale: function(t) { | |
var e = this.setFromMatrixColumn(t, 0).length(), | |
n = this.setFromMatrixColumn(t, 1).length(), | |
i = this.setFromMatrixColumn(t, 2).length(); | |
return this.x = e, this.y = n, this.z = i, this | |
}, | |
setFromMatrixColumn: function(t, e) { | |
return this.fromArray(t.elements, 4 * e) | |
}, | |
equals: function(t) { | |
return t.x === this.x && t.y === this.y && t.z === this.z | |
}, | |
fromArray: function(t, e) { | |
return void 0 === e && (e = 0), this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this | |
}, | |
toArray: function(t, e) { | |
return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t | |
}, | |
fromBufferAttribute: function(t, e, n) { | |
return void 0 !== n && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."), this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this | |
} | |
}), Object.assign(Ne.prototype, { | |
isMatrix3: !0, | |
set: function(t, e, n, i, r, a, o, s, c) { | |
var h = this.elements; | |
return h[0] = t, h[1] = i, h[2] = o, h[3] = e, h[4] = r, h[5] = s, h[6] = n, h[7] = a, h[8] = c, this | |
}, | |
identity: function() { | |
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this | |
}, | |
clone: function() { | |
return (new this.constructor).fromArray(this.elements) | |
}, | |
copy: function(t) { | |
var e = this.elements, | |
n = t.elements; | |
return e[0] = n[0], e[1] = n[1], e[2] = n[2], e[3] = n[3], e[4] = n[4], e[5] = n[5], e[6] = n[6], e[7] = n[7], e[8] = n[8], this | |
}, | |
setFromMatrix4: function(t) { | |
var e = t.elements; | |
return this.set(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]), this | |
}, | |
applyToBufferAttribute: function() { | |
var t = new Ue; | |
return function(e) { | |
for (var n = 0, i = e.count; n < i; n++) t.x = e.getX(n), t.y = e.getY(n), t.z = e.getZ(n), t.applyMatrix3(this), e.setXYZ(n, t.x, t.y, t.z); | |
return e | |
} | |
}(), | |
multiply: function(t) { | |
return this.multiplyMatrices(this, t) | |
}, | |
premultiply: function(t) { | |
return this.multiplyMatrices(t, this) | |
}, | |
multiplyMatrices: function(t, e) { | |
var n = t.elements, | |
i = e.elements, | |
r = this.elements, | |
a = n[0], | |
o = n[3], | |
s = n[6], | |
c = n[1], | |
h = n[4], | |
l = n[7], | |
u = n[2], | |
p = n[5], | |
d = n[8], | |
f = i[0], | |
m = i[3], | |
g = i[6], | |
v = i[1], | |
y = i[4], | |
x = i[7], | |
w = i[2], | |
_ = i[5], | |
b = i[8]; | |
return r[0] = a * f + o * v + s * w, r[3] = a * m + o * y + s * _, r[6] = a * g + o * x + s * b, r[1] = c * f + h * v + l * w, r[4] = c * m + h * y + l * _, r[7] = c * g + h * x + l * b, r[2] = u * f + p * v + d * w, r[5] = u * m + p * y + d * _, r[8] = u * g + p * x + d * b, this | |
}, | |
multiplyScalar: function(t) { | |
var e = this.elements; | |
return e[0] *= t, e[3] *= t, e[6] *= t, e[1] *= t, e[4] *= t, e[7] *= t, e[2] *= t, e[5] *= t, e[8] *= t, this | |
}, | |
determinant: function() { | |
var t = this.elements, | |
e = t[0], | |
n = t[1], | |
i = t[2], | |
r = t[3], | |
a = t[4], | |
o = t[5], | |
s = t[6], | |
c = t[7], | |
h = t[8]; | |
return e * a * h - e * o * c - n * r * h + n * o * s + i * r * c - i * a * s | |
}, | |
getInverse: function(t, e) { | |
t && t.isMatrix4 && console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument."); | |
var n = t.elements, | |
i = this.elements, | |
r = n[0], | |
a = n[1], | |
o = n[2], | |
s = n[3], | |
c = n[4], | |
h = n[5], | |
l = n[6], | |
u = n[7], | |
p = n[8], | |
d = p * c - h * u, | |
f = h * l - p * s, | |
m = u * s - c * l, | |
g = r * d + a * f + o * m; | |
if (0 === g) { | |
var v = "THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0"; | |
if (!0 === e) throw new Error(v); | |
return console.warn(v), this.identity() | |
} | |
var y = 1 / g; | |
return i[0] = d * y, i[1] = (o * u - p * a) * y, i[2] = (h * a - o * c) * y, i[3] = f * y, i[4] = (p * r - o * l) * y, i[5] = (o * s - h * r) * y, i[6] = m * y, i[7] = (a * l - u * r) * y, i[8] = (c * r - a * s) * y, this | |
}, | |
transpose: function() { | |
var t, e = this.elements; | |
return t = e[1], e[1] = e[3], e[3] = t, t = e[2], e[2] = e[6], e[6] = t, t = e[5], e[5] = e[7], e[7] = t, this | |
}, | |
getNormalMatrix: function(t) { | |
return this.setFromMatrix4(t).getInverse(this).transpose() | |
}, | |
transposeIntoArray: function(t) { | |
var e = this.elements; | |
return t[0] = e[0], t[1] = e[3], t[2] = e[6], t[3] = e[1], t[4] = e[4], t[5] = e[7], t[6] = e[2], t[7] = e[5], t[8] = e[8], this | |
}, | |
setUvTransform: function(t, e, n, i, r, a, o) { | |
var s = Math.cos(r), | |
c = Math.sin(r); | |
this.set(n * s, n * c, -n * (s * a + c * o) + a + t, -i * c, i * s, -i * (-c * a + s * o) + o + e, 0, 0, 1) | |
}, | |
scale: function(t, e) { | |
var n = this.elements; | |
return n[0] *= t, n[3] *= t, n[6] *= t, n[1] *= e, n[4] *= e, n[7] *= e, this | |
}, | |
rotate: function(t) { | |
var e = Math.cos(t), | |
n = Math.sin(t), | |
i = this.elements, | |
r = i[0], | |
a = i[3], | |
o = i[6], | |
s = i[1], | |
c = i[4], | |
h = i[7]; | |
return i[0] = e * r + n * s, i[3] = e * a + n * c, i[6] = e * o + n * h, i[1] = -n * r + e * s, i[4] = -n * a + e * c, i[7] = -n * o + e * h, this | |
}, | |
translate: function(t, e) { | |
var n = this.elements; | |
return n[0] += t * n[2], n[3] += t * n[5], n[6] += t * n[8], n[1] += e * n[2], n[4] += e * n[5], n[7] += e * n[8], this | |
}, | |
equals: function(t) { | |
for (var e = this.elements, n = t.elements, i = 0; i < 9; i++) | |
if (e[i] !== n[i]) return !1; | |
return !0 | |
}, | |
fromArray: function(t, e) { | |
void 0 === e && (e = 0); | |
for (var n = 0; n < 9; n++) this.elements[n] = t[n + e]; | |
return this | |
}, | |
toArray: function(t, e) { | |
void 0 === t && (t = []), void 0 === e && (e = 0); | |
var n = this.elements; | |
return t[e] = n[0], t[e + 1] = n[1], t[e + 2] = n[2], t[e + 3] = n[3], t[e + 4] = n[4], t[e + 5] = n[5], t[e + 6] = n[6], t[e + 7] = n[7], t[e + 8] = n[8], t | |
} | |
}); | |
var Be, ze, Fe, Ge, ke, He, Ve = 0; | |
function je(t, e, n, i, r, a, o, s, c, h) { | |
Object.defineProperty(this, "id", { | |
value: Ve++ | |
}), this.uuid = Re.generateUUID(), this.name = "", this.image = void 0 !== t ? t : je.DEFAULT_IMAGE, this.mipmaps = [], this.mapping = void 0 !== e ? e : je.DEFAULT_MAPPING, this.wrapS = void 0 !== n ? n : _t, this.wrapT = void 0 !== i ? i : _t, this.magFilter = void 0 !== r ? r : St, this.minFilter = void 0 !== a ? a : Ct, this.anisotropy = void 0 !== c ? c : 1, this.format = void 0 !== o ? o : Vt, this.type = void 0 !== s ? s : It, this.offset = new Pe(0, 0), this.repeat = new Pe(1, 1), this.center = new Pe(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new Ne, this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = void 0 !== h ? h : be, this.version = 0, this.onUpdate = null | |
} | |
function We(t, e, n, i) { | |
this.x = t || 0, this.y = e || 0, this.z = n || 0, this.w = void 0 !== i ? i : 1 | |
} | |
function Xe(t, e, n) { | |
this.width = t, this.height = e, this.scissor = new We(0, 0, t, e), this.scissorTest = !1, this.viewport = new We(0, 0, t, e), void 0 === (n = n || {}).minFilter && (n.minFilter = St), this.texture = new je(void 0, void 0, n.wrapS, n.wrapT, n.magFilter, n.minFilter, n.format, n.type, n.anisotropy, n.encoding), this.depthBuffer = void 0 === n.depthBuffer || n.depthBuffer, this.stencilBuffer = void 0 === n.stencilBuffer || n.stencilBuffer, this.depthTexture = void 0 !== n.depthTexture ? n.depthTexture : null | |
} | |
function qe(t, e, n) { | |
Xe.call(this, t, e, n), this.activeCubeFace = 0, this.activeMipMapLevel = 0 | |
} | |
function Ye(t, e, n, i, r, a, o, s, c, h, l, u) { | |
je.call(this, null, a, o, s, c, h, i, r, l, u), this.image = { | |
data: t, | |
width: e, | |
height: n | |
}, this.magFilter = void 0 !== c ? c : At, this.minFilter = void 0 !== h ? h : At, this.generateMipmaps = !1, this.flipY = !1, this.unpackAlignment = 1 | |
} | |
function Je(t, e) { | |
this.min = void 0 !== t ? t : new Ue(Infinity, Infinity, Infinity), this.max = void 0 !== e ? e : new Ue(-Infinity, -Infinity, -Infinity) | |
} | |
function Ze(t, e) { | |
this.center = void 0 !== t ? t : new Ue, this.radius = void 0 !== e ? e : 0 | |
} | |
function Qe(t, e) { | |
this.normal = void 0 !== t ? t : new Ue(1, 0, 0), this.constant = void 0 !== e ? e : 0 | |
} | |
function Ke(t, e, n, i, r, a) { | |
this.planes = [void 0 !== t ? t : new Qe, void 0 !== e ? e : new Qe, void 0 !== n ? n : new Qe, void 0 !== i ? i : new Qe, void 0 !== r ? r : new Qe, void 0 !== a ? a : new Qe] | |
} | |
je.DEFAULT_IMAGE = void 0, je.DEFAULT_MAPPING = 300, je.prototype = Object.assign(Object.create(c.prototype), { | |
constructor: je, | |
isTexture: !0, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.name = t.name, this.image = t.image, this.mipmaps = t.mipmaps.slice(0), this.mapping = t.mapping, this.wrapS = t.wrapS, this.wrapT = t.wrapT, this.magFilter = t.magFilter, this.minFilter = t.minFilter, this.anisotropy = t.anisotropy, this.format = t.format, this.type = t.type, this.offset.copy(t.offset), this.repeat.copy(t.repeat), this.center.copy(t.center), this.rotation = t.rotation, this.matrixAutoUpdate = t.matrixAutoUpdate, this.matrix.copy(t.matrix), this.generateMipmaps = t.generateMipmaps, this.premultiplyAlpha = t.premultiplyAlpha, this.flipY = t.flipY, this.unpackAlignment = t.unpackAlignment, this.encoding = t.encoding, this | |
}, | |
toJSON: function(t) { | |
var e = void 0 === t || "string" == typeof t; | |
if (!e && void 0 !== t.textures[this.uuid]) return t.textures[this.uuid]; | |
var n = { | |
metadata: { | |
version: 4.5, | |
type: "Texture", | |
generator: "Texture.toJSON" | |
}, | |
uuid: this.uuid, | |
name: this.name, | |
mapping: this.mapping, | |
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, | |
minFilter: this.minFilter, | |
magFilter: this.magFilter, | |
anisotropy: this.anisotropy, | |
flipY: this.flipY | |
}; | |
if (void 0 !== this.image) { | |
var i = this.image; | |
void 0 === i.uuid && (i.uuid = Re.generateUUID()), e || void 0 !== t.images[i.uuid] || (t.images[i.uuid] = { | |
uuid: i.uuid, | |
url: function(t) { | |
var e; | |
if (t instanceof HTMLCanvasElement) e = t; | |
else { | |
(e = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")).width = t.width, e.height = t.height; | |
var n = e.getContext("2d"); | |
t instanceof ImageData ? n.putImageData(t, 0, 0) : n.drawImage(t, 0, 0, t.width, t.height) | |
} | |
return e.width > 2048 || e.height > 2048 ? e.toDataURL("image/jpeg", .6) : e.toDataURL("image/png") | |
}(i) | |
}), n.image = i.uuid | |
} | |
return e || (t.textures[this.uuid] = n), n | |
}, | |
dispose: function() { | |
this.dispatchEvent({ | |
type: "dispose" | |
}) | |
}, | |
transformUv: function(t) { | |
if (300 === this.mapping) { | |
if (t.applyMatrix3(this.matrix), t.x < 0 || t.x > 1) switch (this.wrapS) { | |
case wt: | |
t.x = t.x - Math.floor(t.x); | |
break; | |
case _t: | |
t.x = t.x < 0 ? 0 : 1; | |
break; | |
case bt: | |
1 === Math.abs(Math.floor(t.x) % 2) ? t.x = Math.ceil(t.x) - t.x : t.x = t.x - Math.floor(t.x) | |
} | |
if (t.y < 0 || t.y > 1) switch (this.wrapT) { | |
case wt: | |
t.y = t.y - Math.floor(t.y); | |
break; | |
case _t: | |
t.y = t.y < 0 ? 0 : 1; | |
break; | |
case bt: | |
1 === Math.abs(Math.floor(t.y) % 2) ? t.y = Math.ceil(t.y) - t.y : t.y = t.y - Math.floor(t.y) | |
} | |
this.flipY && (t.y = 1 - t.y) | |
} | |
} | |
}), Object.defineProperty(je.prototype, "needsUpdate", { | |
set: function(t) { | |
!0 === t && this.version++ | |
} | |
}), Object.assign(We.prototype, { | |
isVector4: !0, | |
set: function(t, e, n, i) { | |
return this.x = t, this.y = e, this.z = n, this.w = i, this | |
}, | |
setScalar: function(t) { | |
return this.x = t, this.y = t, this.z = t, this.w = t, this | |
}, | |
setX: function(t) { | |
return this.x = t, this | |
}, | |
setY: function(t) { | |
return this.y = t, this | |
}, | |
setZ: function(t) { | |
return this.z = t, this | |
}, | |
setW: function(t) { | |
return this.w = t, this | |
}, | |
setComponent: function(t, e) { | |
switch (t) { | |
case 0: | |
this.x = e; | |
break; | |
case 1: | |
this.y = e; | |
break; | |
case 2: | |
this.z = e; | |
break; | |
case 3: | |
this.w = e; | |
break; | |
default: | |
throw new Error("index is out of range: " + t) | |
} | |
return this | |
}, | |
getComponent: function(t) { | |
switch (t) { | |
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: " + t) | |
} | |
}, | |
clone: function() { | |
return new this.constructor(this.x, this.y, this.z, this.w) | |
}, | |
copy: function(t) { | |
return this.x = t.x, this.y = t.y, this.z = t.z, this.w = void 0 !== t.w ? t.w : 1, this | |
}, | |
add: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(t, e)) : (this.x += t.x, this.y += t.y, this.z += t.z, this.w += t.w, this) | |
}, | |
addScalar: function(t) { | |
return this.x += t, this.y += t, this.z += t, this.w += t, this | |
}, | |
addVectors: function(t, e) { | |
return this.x = t.x + e.x, this.y = t.y + e.y, this.z = t.z + e.z, this.w = t.w + e.w, this | |
}, | |
addScaledVector: function(t, e) { | |
return this.x += t.x * e, this.y += t.y * e, this.z += t.z * e, this.w += t.w * e, this | |
}, | |
sub: function(t, e) { | |
return void 0 !== e ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(t, e)) : (this.x -= t.x, this.y -= t.y, this.z -= t.z, this.w -= t.w, this) | |
}, | |
subScalar: function(t) { | |
return this.x -= t, this.y -= t, this.z -= t, this.w -= t, this | |
}, | |
subVectors: function(t, e) { | |
return this.x = t.x - e.x, this.y = t.y - e.y, this.z = t.z - e.z, this.w = t.w - e.w, this | |
}, | |
multiplyScalar: function(t) { | |
return this.x *= t, this.y *= t, this.z *= t, this.w *= t, this | |
}, | |
applyMatrix4: function(t) { | |
var e = this.x, | |
n = this.y, | |
i = this.z, | |
r = this.w, | |
a = t.elements; | |
return this.x = a[0] * e + a[4] * n + a[8] * i + a[12] * r, this.y = a[1] * e + a[5] * n + a[9] * i + a[13] * r, this.z = a[2] * e + a[6] * n + a[10] * i + a[14] * r, this.w = a[3] * e + a[7] * n + a[11] * i + a[15] * r, this | |
}, | |
divideScalar: function(t) { | |
return this.multiplyScalar(1 / t) | |
}, | |
setAxisAngleFromQuaternion: function(t) { | |
this.w = 2 * Math.acos(t.w); | |
var e = Math.sqrt(1 - t.w * t.w); | |
return e < 1e-4 ? (this.x = 1, this.y = 0, this.z = 0) : (this.x = t.x / e, this.y = t.y / e, this.z = t.z / e), this | |
}, | |
setAxisAngleFromRotationMatrix: function(t) { | |
var e, n, i, r, a = t.elements, | |
o = a[0], | |
s = a[4], | |
c = a[8], | |
h = a[1], | |
l = a[5], | |
u = a[9], | |
p = a[2], | |
d = a[6], | |
f = a[10]; | |
if (Math.abs(s - h) < .01 && Math.abs(c - p) < .01 && Math.abs(u - d) < .01) { | |
if (Math.abs(s + h) < .1 && Math.abs(c + p) < .1 && Math.abs(u + d) < .1 && Math.abs(o + l + f - 3) < .1) return this.set(1, 0, 0, 0), this; | |
e = Math.PI; | |
var m = (o + 1) / 2, | |
g = (l + 1) / 2, | |
v = (f + 1) / 2, | |
y = (s + h) / 4, | |
x = (c + p) / 4, | |
w = (u + d) / 4; | |
return m > g && m > v ? m < .01 ? (n = 0, i = .707106781, r = .707106781) : (i = y / (n = Math.sqrt(m)), r = x / n) : g > v ? g < .01 ? (n = .707106781, i = 0, r = .707106781) : (n = y / (i = Math.sqrt(g)), r = w / i) : v < .01 ? (n = .707106781, i = .707106781, r = 0) : (n = x / (r = Math.sqrt(v)), i = w / r), this.set(n, i, r, e), this | |
} | |
var _ = Math.sqrt((d - u) * (d - u) + (c - p) * (c - p) + (h - s) * (h - s)); | |
return Math.abs(_) < .001 && (_ = 1), this.x = (d - u) / _, this.y = (c - p) / _, this.z = (h - s) / _, this.w = Math.acos((o + l + f - 1) / 2), this | |
}, | |
min: function(t) { | |
return this.x = Math.min(this.x, t.x), this.y = Math.min(this.y, t.y), this.z = Math.min(this.z, t.z), this.w = Math.min(this.w, t.w), this | |
}, | |
max: function(t) { | |
return this.x = Math.max(this.x, t.x), this.y = Math.max(this.y, t.y), this.z = Math.max(this.z, t.z), this.w = Math.max(this.w, t.w), this | |
}, | |
clamp: function(t, e) { | |
return this.x = Math.max(t.x, Math.min(e.x, this.x)), this.y = Math.max(t.y, Math.min(e.y, this.y)), this.z = Math.max(t.z, Math.min(e.z, this.z)), this.w = Math.max(t.w, Math.min(e.w, this.w)), this | |
}, | |
clampScalar: function() { | |
var t, e; | |
return function(n, i) { | |
return void 0 === t && (t = new We, e = new We), t.set(n, n, n, n), e.set(i, i, i, i), this.clamp(t, e) | |
} | |
}(), | |
clampLength: function(t, e) { | |
var n = this.length(); | |
return this.divideScalar(n || 1).multiplyScalar(Math.max(t, Math.min(e, n))) | |
}, | |
floor: function() { | |
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: function() { | |
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: function() { | |
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: function() { | |
return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w), this | |
}, | |
negate: function() { | |
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this.w = -this.w, this | |
}, | |
dot: function(t) { | |
return this.x * t.x + this.y * t.y + this.z * t.z + this.w * t.w | |
}, | |
lengthSq: function() { | |
return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w | |
}, | |
length: function() { | |
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w) | |
}, | |
manhattanLength: function() { | |
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w) | |
}, | |
normalize: function() { | |
return this.divideScalar(this.length() || 1) | |
}, | |
setLength: function(t) { | |
return this.normalize().multiplyScalar(t) | |
}, | |
lerp: function(t, e) { | |
return this.x += (t.x - this.x) * e, this.y += (t.y - this.y) * e, this.z += (t.z - this.z) * e, this.w += (t.w - this.w) * e, this | |
}, | |
lerpVectors: function(t, e, n) { | |
return this.subVectors(e, t).multiplyScalar(n).add(t) | |
}, | |
equals: function(t) { | |
return t.x === this.x && t.y === this.y && t.z === this.z && t.w === this.w | |
}, | |
fromArray: function(t, e) { | |
return void 0 === e && (e = 0), this.x = t[e], this.y = t[e + 1], this.z = t[e + 2], this.w = t[e + 3], this | |
}, | |
toArray: function(t, e) { | |
return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this.x, t[e + 1] = this.y, t[e + 2] = this.z, t[e + 3] = this.w, t | |
}, | |
fromBufferAttribute: function(t, e, n) { | |
return void 0 !== n && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."), this.x = t.getX(e), this.y = t.getY(e), this.z = t.getZ(e), this.w = t.getW(e), this | |
} | |
}), Xe.prototype = Object.assign(Object.create(c.prototype), { | |
constructor: Xe, | |
isWebGLRenderTarget: !0, | |
setSize: function(t, e) { | |
this.width === t && this.height === e || (this.width = t, this.height = e, this.dispose()), this.viewport.set(0, 0, t, e), this.scissor.set(0, 0, t, e) | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.width = t.width, this.height = t.height, this.viewport.copy(t.viewport), this.texture = t.texture.clone(), this.depthBuffer = t.depthBuffer, this.stencilBuffer = t.stencilBuffer, this.depthTexture = t.depthTexture, this | |
}, | |
dispose: function() { | |
this.dispatchEvent({ | |
type: "dispose" | |
}) | |
} | |
}), qe.prototype = Object.create(Xe.prototype), qe.prototype.constructor = qe, qe.prototype.isWebGLRenderTargetCube = !0, Ye.prototype = Object.create(je.prototype), Ye.prototype.constructor = Ye, Ye.prototype.isDataTexture = !0, Object.assign(Je.prototype, { | |
isBox3: !0, | |
set: function(t, e) { | |
return this.min.copy(t), this.max.copy(e), this | |
}, | |
setFromArray: function(t) { | |
for (var e = Infinity, n = Infinity, i = Infinity, r = -Infinity, a = -Infinity, o = -Infinity, s = 0, c = t.length; s < c; s += 3) { | |
var h = t[s], | |
l = t[s + 1], | |
u = t[s + 2]; | |
h < e && (e = h), l < n && (n = l), u < i && (i = u), h > r && (r = h), l > a && (a = l), u > o && (o = u) | |
} | |
return this.min.set(e, n, i), this.max.set(r, a, o), this | |
}, | |
setFromBufferAttribute: function(t) { | |
for (var e = Infinity, n = Infinity, i = Infinity, r = -Infinity, a = -Infinity, o = -Infinity, s = 0, c = t.count; s < c; s++) { | |
var h = t.getX(s), | |
l = t.getY(s), | |
u = t.getZ(s); | |
h < e && (e = h), l < n && (n = l), u < i && (i = u), h > r && (r = h), l > a && (a = l), u > o && (o = u) | |
} | |
return this.min.set(e, n, i), this.max.set(r, a, o), this | |
}, | |
setFromPoints: function(t) { | |
this.makeEmpty(); | |
for (var e = 0, n = t.length; e < n; e++) this.expandByPoint(t[e]); | |
return this | |
}, | |
setFromCenterAndSize: function() { | |
var t = new Ue; | |
return function(e, n) { | |
var i = t.copy(n).multiplyScalar(.5); | |
return this.min.copy(e).sub(i), this.max.copy(e).add(i), this | |
} | |
}(), | |
setFromObject: function(t) { | |
return this.makeEmpty(), this.expandByObject(t) | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.min.copy(t.min), this.max.copy(t.max), this | |
}, | |
makeEmpty: function() { | |
return this.min.x = this.min.y = this.min.z = Infinity, this.max.x = this.max.y = this.max.z = -Infinity, this | |
}, | |
isEmpty: function() { | |
return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z | |
}, | |
getCenter: function(t) { | |
return void 0 === t && (console.warn("THREE.Box3: .getCenter() target is now required"), t = new Ue), this.isEmpty() ? t.set(0, 0, 0) : t.addVectors(this.min, this.max).multiplyScalar(.5) | |
}, | |
getSize: function(t) { | |
return void 0 === t && (console.warn("THREE.Box3: .getSize() target is now required"), t = new Ue), this.isEmpty() ? t.set(0, 0, 0) : t.subVectors(this.max, this.min) | |
}, | |
expandByPoint: function(t) { | |
return this.min.min(t), this.max.max(t), this | |
}, | |
expandByVector: function(t) { | |
return this.min.sub(t), this.max.add(t), this | |
}, | |
expandByScalar: function(t) { | |
return this.min.addScalar(-t), this.max.addScalar(t), this | |
}, | |
expandByObject: function() { | |
var t, e, n, i = new Ue; | |
function r(r) { | |
var a = r.geometry; | |
if (void 0 !== a) | |
if (a.isGeometry) { | |
var o = a.vertices; | |
for (e = 0, n = o.length; e < n; e++) i.copy(o[e]), i.applyMatrix4(r.matrixWorld), t.expandByPoint(i) | |
} else if (a.isBufferGeometry) { | |
var s = a.attributes.position; | |
if (void 0 !== s) | |
for (e = 0, n = s.count; e < n; e++) i.fromBufferAttribute(s, e).applyMatrix4(r.matrixWorld), t.expandByPoint(i) | |
} | |
} | |
return function(e) { | |
return t = this, e.updateMatrixWorld(!0), e.traverse(r), this | |
} | |
}(), | |
containsPoint: function(t) { | |
return !(t.x < this.min.x || t.x > this.max.x || t.y < this.min.y || t.y > this.max.y || t.z < this.min.z || t.z > this.max.z) | |
}, | |
containsBox: function(t) { | |
return this.min.x <= t.min.x && t.max.x <= this.max.x && this.min.y <= t.min.y && t.max.y <= this.max.y && this.min.z <= t.min.z && t.max.z <= this.max.z | |
}, | |
getParameter: function(t, e) { | |
return void 0 === e && (console.warn("THREE.Box3: .getParameter() target is now required"), e = new Ue), e.set((t.x - this.min.x) / (this.max.x - this.min.x), (t.y - this.min.y) / (this.max.y - this.min.y), (t.z - this.min.z) / (this.max.z - this.min.z)) | |
}, | |
intersectsBox: function(t) { | |
return !(t.max.x < this.min.x || t.min.x > this.max.x || t.max.y < this.min.y || t.min.y > this.max.y || t.max.z < this.min.z || t.min.z > this.max.z) | |
}, | |
intersectsSphere: (ze = new Ue, function(t) { | |
return this.clampPoint(t.center, ze), ze.distanceToSquared(t.center) <= t.radius * t.radius | |
}), | |
intersectsPlane: function(t) { | |
var e, n; | |
return t.normal.x > 0 ? (e = t.normal.x * this.min.x, n = t.normal.x * this.max.x) : (e = t.normal.x * this.max.x, n = t.normal.x * this.min.x), t.normal.y > 0 ? (e += t.normal.y * this.min.y, n += t.normal.y * this.max.y) : (e += t.normal.y * this.max.y, n += t.normal.y * this.min.y), t.normal.z > 0 ? (e += t.normal.z * this.min.z, n += t.normal.z * this.max.z) : (e += t.normal.z * this.max.z, n += t.normal.z * this.min.z), e <= t.constant && n >= t.constant | |
}, | |
intersectsTriangle: function() { | |
var t = new Ue, | |
e = new Ue, | |
n = new Ue, | |
i = new Ue, | |
r = new Ue, | |
a = new Ue, | |
o = new Ue, | |
s = new Ue, | |
c = new Ue, | |
h = new Ue; | |
function l(i) { | |
var r, a; | |
for (r = 0, a = i.length - 3; r <= a; r += 3) { | |
o.fromArray(i, r); | |
var s = c.x * Math.abs(o.x) + c.y * Math.abs(o.y) + c.z * Math.abs(o.z), | |
h = t.dot(o), | |
l = e.dot(o), | |
u = n.dot(o); | |
if (Math.max(-Math.max(h, l, u), Math.min(h, l, u)) > s) return !1 | |
} | |
return !0 | |
} | |
return function(o) { | |
if (this.isEmpty()) return !1; | |
this.getCenter(s), c.subVectors(this.max, s), t.subVectors(o.a, s), e.subVectors(o.b, s), n.subVectors(o.c, s), i.subVectors(e, t), r.subVectors(n, e), a.subVectors(t, n); | |
var u = [0, -i.z, i.y, 0, -r.z, r.y, 0, -a.z, a.y, i.z, 0, -i.x, r.z, 0, -r.x, a.z, 0, -a.x, -i.y, i.x, 0, -r.y, r.x, 0, -a.y, a.x, 0]; | |
return !!l(u) && (!!l(u = [1, 0, 0, 0, 1, 0, 0, 0, 1]) && (h.crossVectors(i, r), l(u = [h.x, h.y, h.z]))) | |
} | |
}(), | |
clampPoint: function(t, e) { | |
return void 0 === e && (console.warn("THREE.Box3: .clampPoint() target is now required"), e = new Ue), e.copy(t).clamp(this.min, this.max) | |
}, | |
distanceToPoint: function() { | |
var t = new Ue; | |
return function(e) { | |
return t.copy(e).clamp(this.min, this.max).sub(e).length() | |
} | |
}(), | |
getBoundingSphere: function() { | |
var t = new Ue; | |
return function(e) { | |
return void 0 === e && (console.warn("THREE.Box3: .getBoundingSphere() target is now required"), e = new Ze), this.getCenter(e.center), e.radius = .5 * this.getSize(t).length(), e | |
} | |
}(), | |
intersect: function(t) { | |
return this.min.max(t.min), this.max.min(t.max), this.isEmpty() && this.makeEmpty(), this | |
}, | |
union: function(t) { | |
return this.min.min(t.min), this.max.max(t.max), this | |
}, | |
applyMatrix4: (Be = [new Ue, new Ue, new Ue, new Ue, new Ue, new Ue, new Ue, new Ue], function(t) { | |
return this.isEmpty() ? this : (Be[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(t), Be[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(t), Be[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(t), Be[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(t), Be[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(t), Be[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(t), Be[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(t), Be[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(t), this.setFromPoints(Be), this) | |
}), | |
translate: function(t) { | |
return this.min.add(t), this.max.add(t), this | |
}, | |
equals: function(t) { | |
return t.min.equals(this.min) && t.max.equals(this.max) | |
} | |
}), Object.assign(Ze.prototype, { | |
set: function(t, e) { | |
return this.center.copy(t), this.radius = e, this | |
}, | |
setFromPoints: (Fe = new Je, function(t, e) { | |
var n = this.center; | |
void 0 !== e ? n.copy(e) : Fe.setFromPoints(t).getCenter(n); | |
for (var i = 0, r = 0, a = t.length; r < a; r++) i = Math.max(i, n.distanceToSquared(t[r])); | |
return this.radius = Math.sqrt(i), this | |
}), | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.center.copy(t.center), this.radius = t.radius, this | |
}, | |
empty: function() { | |
return this.radius <= 0 | |
}, | |
containsPoint: function(t) { | |
return t.distanceToSquared(this.center) <= this.radius * this.radius | |
}, | |
distanceToPoint: function(t) { | |
return t.distanceTo(this.center) - this.radius | |
}, | |
intersectsSphere: function(t) { | |
var e = this.radius + t.radius; | |
return t.center.distanceToSquared(this.center) <= e * e | |
}, | |
intersectsBox: function(t) { | |
return t.intersectsSphere(this) | |
}, | |
intersectsPlane: function(t) { | |
return Math.abs(t.distanceToPoint(this.center)) <= this.radius | |
}, | |
clampPoint: function(t, e) { | |
var n = this.center.distanceToSquared(t); | |
return void 0 === e && (console.warn("THREE.Sphere: .clampPoint() target is now required"), e = new Ue), e.copy(t), n > this.radius * this.radius && (e.sub(this.center).normalize(), e.multiplyScalar(this.radius).add(this.center)), e | |
}, | |
getBoundingBox: function(t) { | |
return void 0 === t && (console.warn("THREE.Sphere: .getBoundingBox() target is now required"), t = new Je), t.set(this.center, this.center), t.expandByScalar(this.radius), t | |
}, | |
applyMatrix4: function(t) { | |
return this.center.applyMatrix4(t), this.radius = this.radius * t.getMaxScaleOnAxis(), this | |
}, | |
translate: function(t) { | |
return this.center.add(t), this | |
}, | |
equals: function(t) { | |
return t.center.equals(this.center) && t.radius === this.radius | |
} | |
}), Object.assign(Qe.prototype, { | |
set: function(t, e) { | |
return this.normal.copy(t), this.constant = e, this | |
}, | |
setComponents: function(t, e, n, i) { | |
return this.normal.set(t, e, n), this.constant = i, this | |
}, | |
setFromNormalAndCoplanarPoint: function(t, e) { | |
return this.normal.copy(t), this.constant = -e.dot(this.normal), this | |
}, | |
setFromCoplanarPoints: function() { | |
var t = new Ue, | |
e = new Ue; | |
return function(n, i, r) { | |
var a = t.subVectors(r, i).cross(e.subVectors(n, i)).normalize(); | |
return this.setFromNormalAndCoplanarPoint(a, n), this | |
} | |
}(), | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.normal.copy(t.normal), this.constant = t.constant, this | |
}, | |
normalize: function() { | |
var t = 1 / this.normal.length(); | |
return this.normal.multiplyScalar(t), this.constant *= t, this | |
}, | |
negate: function() { | |
return this.constant *= -1, this.normal.negate(), this | |
}, | |
distanceToPoint: function(t) { | |
return this.normal.dot(t) + this.constant | |
}, | |
distanceToSphere: function(t) { | |
return this.distanceToPoint(t.center) - t.radius | |
}, | |
projectPoint: function(t, e) { | |
return void 0 === e && (console.warn("THREE.Plane: .projectPoint() target is now required"), e = new Ue), e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t) | |
}, | |
intersectLine: function() { | |
var t = new Ue; | |
return function(e, n) { | |
void 0 === n && (console.warn("THREE.Plane: .intersectLine() target is now required"), n = new Ue); | |
var i = e.delta(t), | |
r = this.normal.dot(i); | |
if (0 === r) return 0 === this.distanceToPoint(e.start) ? n.copy(e.start) : void 0; | |
var a = -(e.start.dot(this.normal) + this.constant) / r; | |
return a < 0 || a > 1 ? void 0 : n.copy(i).multiplyScalar(a).add(e.start) | |
} | |
}(), | |
intersectsLine: function(t) { | |
var e = this.distanceToPoint(t.start), | |
n = this.distanceToPoint(t.end); | |
return e < 0 && n > 0 || n < 0 && e > 0 | |
}, | |
intersectsBox: function(t) { | |
return t.intersectsPlane(this) | |
}, | |
intersectsSphere: function(t) { | |
return t.intersectsPlane(this) | |
}, | |
coplanarPoint: function(t) { | |
return void 0 === t && (console.warn("THREE.Plane: .coplanarPoint() target is now required"), t = new Ue), t.copy(this.normal).multiplyScalar(-this.constant) | |
}, | |
applyMatrix4: function() { | |
var t = new Ue, | |
e = new Ne; | |
return function(n, i) { | |
var r = i || e.getNormalMatrix(n), | |
a = this.coplanarPoint(t).applyMatrix4(n), | |
o = this.normal.applyMatrix3(r).normalize(); | |
return this.constant = -a.dot(o), this | |
} | |
}(), | |
translate: function(t) { | |
return this.constant -= t.dot(this.normal), this | |
}, | |
equals: function(t) { | |
return t.normal.equals(this.normal) && t.constant === this.constant | |
} | |
}), Object.assign(Ke.prototype, { | |
set: function(t, e, n, i, r, a) { | |
var o = this.planes; | |
return o[0].copy(t), o[1].copy(e), o[2].copy(n), o[3].copy(i), o[4].copy(r), o[5].copy(a), this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
for (var e = this.planes, n = 0; n < 6; n++) e[n].copy(t.planes[n]); | |
return this | |
}, | |
setFromMatrix: function(t) { | |
var e = this.planes, | |
n = t.elements, | |
i = n[0], | |
r = n[1], | |
a = n[2], | |
o = n[3], | |
s = n[4], | |
c = n[5], | |
h = n[6], | |
l = n[7], | |
u = n[8], | |
p = n[9], | |
d = n[10], | |
f = n[11], | |
m = n[12], | |
g = n[13], | |
v = n[14], | |
y = n[15]; | |
return e[0].setComponents(o - i, l - s, f - u, y - m).normalize(), e[1].setComponents(o + i, l + s, f + u, y + m).normalize(), e[2].setComponents(o + r, l + c, f + p, y + g).normalize(), e[3].setComponents(o - r, l - c, f - p, y - g).normalize(), e[4].setComponents(o - a, l - h, f - d, y - v).normalize(), e[5].setComponents(o + a, l + h, f + d, y + v).normalize(), this | |
}, | |
intersectsObject: (He = new Ze, function(t) { | |
var e = t.geometry; | |
return null === e.boundingSphere && e.computeBoundingSphere(), He.copy(e.boundingSphere).applyMatrix4(t.matrixWorld), this.intersectsSphere(He) | |
}), | |
intersectsSprite: function() { | |
var t = new Ze; | |
return function(e) { | |
return t.center.set(0, 0, 0), t.radius = .7071067811865476, t.applyMatrix4(e.matrixWorld), this.intersectsSphere(t) | |
} | |
}(), | |
intersectsSphere: function(t) { | |
for (var e = this.planes, n = t.center, i = -t.radius, r = 0; r < 6; r++) { | |
if (e[r].distanceToPoint(n) < i) return !1 | |
} | |
return !0 | |
}, | |
intersectsBox: (Ge = new Ue, ke = new Ue, function(t) { | |
for (var e = this.planes, n = 0; n < 6; n++) { | |
var i = e[n]; | |
Ge.x = i.normal.x > 0 ? t.min.x : t.max.x, ke.x = i.normal.x > 0 ? t.max.x : t.min.x, Ge.y = i.normal.y > 0 ? t.min.y : t.max.y, ke.y = i.normal.y > 0 ? t.max.y : t.min.y, Ge.z = i.normal.z > 0 ? t.min.z : t.max.z, ke.z = i.normal.z > 0 ? t.max.z : t.min.z; | |
var r = i.distanceToPoint(Ge), | |
a = i.distanceToPoint(ke); | |
if (r < 0 && a < 0) return !1 | |
} | |
return !0 | |
}), | |
containsPoint: function(t) { | |
for (var e = this.planes, n = 0; n < 6; n++) | |
if (e[n].distanceToPoint(t) < 0) return !1; | |
return !0 | |
} | |
}); | |
var $e, tn = { | |
alphamap_fragment: "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n", | |
alphamap_pars_fragment: "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n", | |
alphatest_fragment: "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n", | |
aomap_fragment: "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n", | |
aomap_pars_fragment: "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif", | |
begin_vertex: "\nvec3 transformed = vec3( position );\n", | |
beginnormal_vertex: "\nvec3 objectNormal = vec3( normal );\n", | |
bsdfs: "float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_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}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * 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}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.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 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat 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_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n", | |
bumpmap_pars_fragment: "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\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 );\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\n", | |
clipping_planes_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif\n", | |
clipping_planes_pars_fragment: "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n", | |
clipping_planes_pars_vertex: "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n", | |
clipping_planes_vertex: "#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n", | |
color_fragment: "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif", | |
color_pars_fragment: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n", | |
color_pars_vertex: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif", | |
color_vertex: "#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif", | |
common: "#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float 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 average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\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}\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};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\n", | |
cube_uv_reflection_fragment: "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n", | |
defaultnormal_vertex: "vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n", | |
displacementmap_pars_vertex: "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n", | |
displacementmap_vertex: "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n", | |
emissivemap_fragment: "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n", | |
emissivemap_pars_fragment: "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n", | |
encodings_fragment: " gl_FragColor = linearToOutputTexel( gl_FragColor );\n", | |
encodings_pars_fragment: "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( 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.w );\n}\nvec4 LinearTosRGB( 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.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n", | |
envmap_fragment: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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\n", | |
envmap_pars_fragment: "#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n", | |
envmap_pars_vertex: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n", | |
envmap_vertex: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n", | |
fog_vertex: "\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif", | |
fog_pars_vertex: "#ifdef USE_FOG\n varying float fogDepth;\n#endif\n", | |
fog_fragment: "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n", | |
fog_pars_fragment: "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\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\n", | |
gradientmap_pars_fragment: "#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n", | |
lightmap_fragment: "#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n", | |
lightmap_pars_fragment: "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif", | |
lights_lambert_vertex: "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n", | |
lights_pars_begin: "uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n", | |
lights_pars_maps: "#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n", | |
lights_phong_fragment: "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n", | |
lights_phong_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n", | |
lights_physical_fragment: "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n", | |
lights_physical_pars_fragment: "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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.specularRoughness;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n", | |
lights_fragment_begin: "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif\n", | |
lights_fragment_maps: "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );\n\t#ifndef STANDARD\n\t\tclearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );\n\t#endif\n#endif\n", | |
lights_fragment_end: "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n", | |
logdepthbuf_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif", | |
logdepthbuf_pars_fragment: "#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n", | |
logdepthbuf_pars_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif", | |
logdepthbuf_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n", | |
map_fragment: "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n", | |
map_pars_fragment: "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n", | |
map_particle_fragment: "#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n", | |
map_particle_pars_fragment: "#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n", | |
metalnessmap_fragment: "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n", | |
metalnessmap_pars_fragment: "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif", | |
morphnormal_vertex: "#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n", | |
morphtarget_pars_vertex: "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif", | |
morphtarget_vertex: "#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n", | |
normal_fragment_begin: "#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n", | |
normal_fragment_maps: "#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n", | |
normalmap_pars_fragment: "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n", | |
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.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\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 linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( 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 invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n", | |
premultiplied_alpha_fragment: "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n", | |
project_vertex: "vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n", | |
dithering_fragment: "#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n", | |
dithering_pars_fragment: "#if defined( 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\n", | |
roughnessmap_fragment: "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n", | |
roughnessmap_pars_fragment: "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif", | |
shadowmap_pars_fragment: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, 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\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\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 shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n", | |
shadowmap_pars_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n", | |
shadowmap_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n", | |
shadowmask_pars_fragment: "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n", | |
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\n", | |
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#endif\n", | |
specularmap_fragment: "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\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 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n", | |
tonemapping_pars_fragment: "#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( 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}\n", | |
uv_pars_fragment: "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif", | |
uv_pars_vertex: "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n", | |
uv_vertex: "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif", | |
uv2_pars_fragment: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif", | |
uv2_pars_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif", | |
uv2_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif", | |
worldpos_vertex: "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n", | |
cube_frag: "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n", | |
cube_vert: "varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\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 <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n", | |
depth_vert: "#include <common>\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>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_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}\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 <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}\n", | |
distanceRGBA_vert: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\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 <skinbase_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}\n", | |
equirect_frag: "uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n", | |
equirect_vert: "varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\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 <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", | |
linedashed_vert: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n", | |
meshbasic_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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 <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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", | |
meshbasic_vert: "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_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 <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\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 <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n", | |
meshlambert_frag: "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_pars_maps>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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 <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n", | |
meshlambert_vert: "#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_pars_maps>\n#include <color_pars_vertex>\n#include <fog_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 <uv2_vertex>\n\t#include <color_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 <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 <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\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 <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_pars_maps>\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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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 <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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n", | |
meshphong_vert: "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_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 <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n", | |
meshphysical_frag: "#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars_begin>\n#include <lights_pars_maps>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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 <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <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 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n", | |
meshphysical_vert: "#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_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 <uv2_vertex>\n\t#include <color_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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n", | |
normal_frag: "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n", | |
normal_vert: "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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>\nvoid main() {\n\t#include <uv_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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#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#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n", | |
points_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n", | |
points_vert: "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\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 <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <fog_fragment>\n}\n", | |
shadow_vert: "#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n" | |
}, | |
en = { | |
merge: function(t) { | |
for (var e = {}, n = 0; n < t.length; n++) { | |
var i = this.clone(t[n]); | |
for (var r in i) e[r] = i[r] | |
} | |
return e | |
}, | |
clone: function(t) { | |
var e = {}; | |
for (var n in t) | |
for (var i in e[n] = {}, t[n]) { | |
var r = t[n][i]; | |
r && (r.isColor || r.isMatrix3 || r.isMatrix4 || r.isVector2 || r.isVector3 || r.isVector4 || r.isTexture) ? e[n][i] = r.clone() : Array.isArray(r) ? e[n][i] = r.slice() : e[n][i] = r | |
} | |
return e | |
} | |
}, | |
nn = { | |
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 | |
}; | |
function rn(t, e, n) { | |
return void 0 === e && void 0 === n ? this.set(t) : this.setRGB(t, e, n) | |
} | |
Object.assign(rn.prototype, { | |
isColor: !0, | |
r: 1, | |
g: 1, | |
b: 1, | |
set: function(t) { | |
return t && t.isColor ? this.copy(t) : "number" == typeof t ? this.setHex(t) : "string" == typeof t && this.setStyle(t), this | |
}, | |
setScalar: function(t) { | |
return this.r = t, this.g = t, this.b = t, this | |
}, | |
setHex: function(t) { | |
return t = Math.floor(t), this.r = (t >> 16 & 255) / 255, this.g = (t >> 8 & 255) / 255, this.b = (255 & t) / 255, this | |
}, | |
setRGB: function(t, e, n) { | |
return this.r = t, this.g = e, this.b = n, this | |
}, | |
setHSL: function() { | |
function t(t, e, n) { | |
return n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + 6 * (e - t) * n : n < .5 ? e : n < 2 / 3 ? t + 6 * (e - t) * (2 / 3 - n) : t | |
} | |
return function(e, n, i) { | |
if (e = Re.euclideanModulo(e, 1), n = Re.clamp(n, 0, 1), i = Re.clamp(i, 0, 1), 0 === n) this.r = this.g = this.b = i; | |
else { | |
var r = i <= .5 ? i * (1 + n) : i + n - i * n, | |
a = 2 * i - r; | |
this.r = t(a, r, e + 1 / 3), this.g = t(a, r, e), this.b = t(a, r, e - 1 / 3) | |
} | |
return this | |
} | |
}(), | |
setStyle: function(t) { | |
function e(e) { | |
void 0 !== e && parseFloat(e) < 1 && console.warn("THREE.Color: Alpha component of " + t + " will be ignored.") | |
} | |
var n; | |
if (n = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)) { | |
var i, r = n[1], | |
a = n[2]; | |
switch (r) { | |
case "rgb": | |
case "rgba": | |
if (i = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)) return this.r = Math.min(255, parseInt(i[1], 10)) / 255, this.g = Math.min(255, parseInt(i[2], 10)) / 255, this.b = Math.min(255, parseInt(i[3], 10)) / 255, e(i[5]), this; | |
if (i = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)) return this.r = Math.min(100, parseInt(i[1], 10)) / 100, this.g = Math.min(100, parseInt(i[2], 10)) / 100, this.b = Math.min(100, parseInt(i[3], 10)) / 100, e(i[5]), this; | |
break; | |
case "hsl": | |
case "hsla": | |
if (i = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)) { | |
var o = parseFloat(i[1]) / 360, | |
s = parseInt(i[2], 10) / 100, | |
c = parseInt(i[3], 10) / 100; | |
return e(i[5]), this.setHSL(o, s, c) | |
} | |
} | |
} else if (n = /^\#([A-Fa-f0-9]+)$/.exec(t)) { | |
var h, l = (h = n[1]).length; | |
if (3 === l) return this.r = parseInt(h.charAt(0) + h.charAt(0), 16) / 255, this.g = parseInt(h.charAt(1) + h.charAt(1), 16) / 255, this.b = parseInt(h.charAt(2) + h.charAt(2), 16) / 255, this; | |
if (6 === l) return this.r = parseInt(h.charAt(0) + h.charAt(1), 16) / 255, this.g = parseInt(h.charAt(2) + h.charAt(3), 16) / 255, this.b = parseInt(h.charAt(4) + h.charAt(5), 16) / 255, this | |
} | |
t && t.length > 0 && (void 0 !== (h = nn[t]) ? this.setHex(h) : console.warn("THREE.Color: Unknown color " + t)); | |
return this | |
}, | |
clone: function() { | |
return new this.constructor(this.r, this.g, this.b) | |
}, | |
copy: function(t) { | |
return this.r = t.r, this.g = t.g, this.b = t.b, this | |
}, | |
copyGammaToLinear: function(t, e) { | |
return void 0 === e && (e = 2), this.r = Math.pow(t.r, e), this.g = Math.pow(t.g, e), this.b = Math.pow(t.b, e), this | |
}, | |
copyLinearToGamma: function(t, e) { | |
void 0 === e && (e = 2); | |
var n = e > 0 ? 1 / e : 1; | |
return this.r = Math.pow(t.r, n), this.g = Math.pow(t.g, n), this.b = Math.pow(t.b, n), this | |
}, | |
convertGammaToLinear: function() { | |
var t = this.r, | |
e = this.g, | |
n = this.b; | |
return this.r = t * t, this.g = e * e, this.b = n * n, this | |
}, | |
convertLinearToGamma: function() { | |
return this.r = Math.sqrt(this.r), this.g = Math.sqrt(this.g), this.b = Math.sqrt(this.b), this | |
}, | |
getHex: function() { | |
return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0 | |
}, | |
getHexString: function() { | |
return ("000000" + this.getHex().toString(16)).slice(-6) | |
}, | |
getHSL: function(t) { | |
void 0 === t && (console.warn("THREE.Color: .getHSL() target is now required"), t = { | |
h: 0, | |
s: 0, | |
l: 0 | |
}); | |
var e, n, i = this.r, | |
r = this.g, | |
a = this.b, | |
o = Math.max(i, r, a), | |
s = Math.min(i, r, a), | |
c = (s + o) / 2; | |
if (s === o) e = 0, n = 0; | |
else { | |
var h = o - s; | |
switch (n = c <= .5 ? h / (o + s) : h / (2 - o - s), o) { | |
case i: | |
e = (r - a) / h + (r < a ? 6 : 0); | |
break; | |
case r: | |
e = (a - i) / h + 2; | |
break; | |
case a: | |
e = (i - r) / h + 4 | |
} | |
e /= 6 | |
} | |
return t.h = e, t.s = n, t.l = c, t | |
}, | |
getStyle: function() { | |
return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")" | |
}, | |
offsetHSL: ($e = {}, function(t, e, n) { | |
return this.getHSL($e), $e.h += t, $e.s += e, $e.l += n, this.setHSL($e.h, $e.s, $e.l), this | |
}), | |
add: function(t) { | |
return this.r += t.r, this.g += t.g, this.b += t.b, this | |
}, | |
addColors: function(t, e) { | |
return this.r = t.r + e.r, this.g = t.g + e.g, this.b = t.b + e.b, this | |
}, | |
addScalar: function(t) { | |
return this.r += t, this.g += t, this.b += t, this | |
}, | |
sub: function(t) { | |
return this.r = Math.max(0, this.r - t.r), this.g = Math.max(0, this.g - t.g), this.b = Math.max(0, this.b - t.b), this | |
}, | |
multiply: function(t) { | |
return this.r *= t.r, this.g *= t.g, this.b *= t.b, this | |
}, | |
multiplyScalar: function(t) { | |
return this.r *= t, this.g *= t, this.b *= t, this | |
}, | |
lerp: function(t, e) { | |
return this.r += (t.r - this.r) * e, this.g += (t.g - this.g) * e, this.b += (t.b - this.b) * e, this | |
}, | |
equals: function(t) { | |
return t.r === this.r && t.g === this.g && t.b === this.b | |
}, | |
fromArray: function(t, e) { | |
return void 0 === e && (e = 0), this.r = t[e], this.g = t[e + 1], this.b = t[e + 2], this | |
}, | |
toArray: function(t, e) { | |
return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this.r, t[e + 1] = this.g, t[e + 2] = this.b, t | |
}, | |
toJSON: function() { | |
return this.getHex() | |
} | |
}); | |
var an, on = { | |
common: { | |
diffuse: { | |
value: new rn(15658734) | |
}, | |
opacity: { | |
value: 1 | |
}, | |
map: { | |
value: null | |
}, | |
uvTransform: { | |
value: new Ne | |
}, | |
alphaMap: { | |
value: null | |
} | |
}, | |
specularmap: { | |
specularMap: { | |
value: null | |
} | |
}, | |
envmap: { | |
envMap: { | |
value: null | |
}, | |
flipEnvMap: { | |
value: -1 | |
}, | |
reflectivity: { | |
value: 1 | |
}, | |
refractionRatio: { | |
value: .98 | |
}, | |
maxMipLevel: { | |
value: 0 | |
} | |
}, | |
aomap: { | |
aoMap: { | |
value: null | |
}, | |
aoMapIntensity: { | |
value: 1 | |
} | |
}, | |
lightmap: { | |
lightMap: { | |
value: null | |
}, | |
lightMapIntensity: { | |
value: 1 | |
} | |
}, | |
emissivemap: { | |
emissiveMap: { | |
value: null | |
} | |
}, | |
bumpmap: { | |
bumpMap: { | |
value: null | |
}, | |
bumpScale: { | |
value: 1 | |
} | |
}, | |
normalmap: { | |
normalMap: { | |
value: null | |
}, | |
normalScale: { | |
value: new Pe(1, 1) | |
} | |
}, | |
displacementmap: { | |
displacementMap: { | |
value: null | |
}, | |
displacementScale: { | |
value: 1 | |
}, | |
displacementBias: { | |
value: 0 | |
} | |
}, | |
roughnessmap: { | |
roughnessMap: { | |
value: null | |
} | |
}, | |
metalnessmap: { | |
metalnessMap: { | |
value: null | |
} | |
}, | |
gradientmap: { | |
gradientMap: { | |
value: null | |
} | |
}, | |
fog: { | |
fogDensity: { | |
value: 25e-5 | |
}, | |
fogNear: { | |
value: 1 | |
}, | |
fogFar: { | |
value: 2e3 | |
}, | |
fogColor: { | |
value: new rn(16777215) | |
} | |
}, | |
lights: { | |
ambientLightColor: { | |
value: [] | |
}, | |
directionalLights: { | |
value: [], | |
properties: { | |
direction: {}, | |
color: {}, | |
shadow: {}, | |
shadowBias: {}, | |
shadowRadius: {}, | |
shadowMapSize: {} | |
} | |
}, | |
directionalShadowMap: { | |
value: [] | |
}, | |
directionalShadowMatrix: { | |
value: [] | |
}, | |
spotLights: { | |
value: [], | |
properties: { | |
color: {}, | |
position: {}, | |
direction: {}, | |
distance: {}, | |
coneCos: {}, | |
penumbraCos: {}, | |
decay: {}, | |
shadow: {}, | |
shadowBias: {}, | |
shadowRadius: {}, | |
shadowMapSize: {} | |
} | |
}, | |
spotShadowMap: { | |
value: [] | |
}, | |
spotShadowMatrix: { | |
value: [] | |
}, | |
pointLights: { | |
value: [], | |
properties: { | |
color: {}, | |
position: {}, | |
decay: {}, | |
distance: {}, | |
shadow: {}, | |
shadowBias: {}, | |
shadowRadius: {}, | |
shadowMapSize: {}, | |
shadowCameraNear: {}, | |
shadowCameraFar: {} | |
} | |
}, | |
pointShadowMap: { | |
value: [] | |
}, | |
pointShadowMatrix: { | |
value: [] | |
}, | |
hemisphereLights: { | |
value: [], | |
properties: { | |
direction: {}, | |
skyColor: {}, | |
groundColor: {} | |
} | |
}, | |
rectAreaLights: { | |
value: [], | |
properties: { | |
color: {}, | |
position: {}, | |
width: {}, | |
height: {} | |
} | |
} | |
}, | |
points: { | |
diffuse: { | |
value: new rn(15658734) | |
}, | |
opacity: { | |
value: 1 | |
}, | |
size: { | |
value: 1 | |
}, | |
scale: { | |
value: 1 | |
}, | |
map: { | |
value: null | |
}, | |
uvTransform: { | |
value: new Ne | |
} | |
} | |
}, | |
sn = { | |
basic: { | |
uniforms: en.merge([on.common, on.specularmap, on.envmap, on.aomap, on.lightmap, on.fog]), | |
vertexShader: tn.meshbasic_vert, | |
fragmentShader: tn.meshbasic_frag | |
}, | |
lambert: { | |
uniforms: en.merge([on.common, on.specularmap, on.envmap, on.aomap, on.lightmap, on.emissivemap, on.fog, on.lights, { | |
emissive: { | |
value: new rn(0) | |
} | |
}]), | |
vertexShader: tn.meshlambert_vert, | |
fragmentShader: tn.meshlambert_frag | |
}, | |
phong: { | |
uniforms: en.merge([on.common, on.specularmap, on.envmap, on.aomap, on.lightmap, on.emissivemap, on.bumpmap, on.normalmap, on.displacementmap, on.gradientmap, on.fog, on.lights, { | |
emissive: { | |
value: new rn(0) | |
}, | |
specular: { | |
value: new rn(1118481) | |
}, | |
shininess: { | |
value: 30 | |
} | |
}]), | |
vertexShader: tn.meshphong_vert, | |
fragmentShader: tn.meshphong_frag | |
}, | |
standard: { | |
uniforms: en.merge([on.common, on.envmap, on.aomap, on.lightmap, on.emissivemap, on.bumpmap, on.normalmap, on.displacementmap, on.roughnessmap, on.metalnessmap, on.fog, on.lights, { | |
emissive: { | |
value: new rn(0) | |
}, | |
roughness: { | |
value: .5 | |
}, | |
metalness: { | |
value: .5 | |
}, | |
envMapIntensity: { | |
value: 1 | |
} | |
}]), | |
vertexShader: tn.meshphysical_vert, | |
fragmentShader: tn.meshphysical_frag | |
}, | |
points: { | |
uniforms: en.merge([on.points, on.fog]), | |
vertexShader: tn.points_vert, | |
fragmentShader: tn.points_frag | |
}, | |
dashed: { | |
uniforms: en.merge([on.common, on.fog, { | |
scale: { | |
value: 1 | |
}, | |
dashSize: { | |
value: 1 | |
}, | |
totalSize: { | |
value: 2 | |
} | |
}]), | |
vertexShader: tn.linedashed_vert, | |
fragmentShader: tn.linedashed_frag | |
}, | |
depth: { | |
uniforms: en.merge([on.common, on.displacementmap]), | |
vertexShader: tn.depth_vert, | |
fragmentShader: tn.depth_frag | |
}, | |
normal: { | |
uniforms: en.merge([on.common, on.bumpmap, on.normalmap, on.displacementmap, { | |
opacity: { | |
value: 1 | |
} | |
}]), | |
vertexShader: tn.normal_vert, | |
fragmentShader: tn.normal_frag | |
}, | |
cube: { | |
uniforms: { | |
tCube: { | |
value: null | |
}, | |
tFlip: { | |
value: -1 | |
}, | |
opacity: { | |
value: 1 | |
} | |
}, | |
vertexShader: tn.cube_vert, | |
fragmentShader: tn.cube_frag | |
}, | |
equirect: { | |
uniforms: { | |
tEquirect: { | |
value: null | |
} | |
}, | |
vertexShader: tn.equirect_vert, | |
fragmentShader: tn.equirect_frag | |
}, | |
distanceRGBA: { | |
uniforms: en.merge([on.common, on.displacementmap, { | |
referencePosition: { | |
value: new Ue | |
}, | |
nearDistance: { | |
value: 1 | |
}, | |
farDistance: { | |
value: 1e3 | |
} | |
}]), | |
vertexShader: tn.distanceRGBA_vert, | |
fragmentShader: tn.distanceRGBA_frag | |
}, | |
shadow: { | |
uniforms: en.merge([on.lights, on.fog, { | |
color: { | |
value: new rn(0) | |
}, | |
opacity: { | |
value: 1 | |
} | |
}]), | |
vertexShader: tn.shadow_vert, | |
fragmentShader: tn.shadow_frag | |
} | |
}; | |
function cn(t) { | |
var e = new WeakMap; | |
return { | |
get: function(t) { | |
return t.isInterleavedBufferAttribute && (t = t.data), e.get(t) | |
}, | |
remove: function(n) { | |
n.isInterleavedBufferAttribute && (n = n.data); | |
var i = e.get(n); | |
i && (t.deleteBuffer(i.buffer), e.delete(n)) | |
}, | |
update: function(n, i) { | |
n.isInterleavedBufferAttribute && (n = n.data); | |
var r = e.get(n); | |
void 0 === r ? e.set(n, function(e, n) { | |
var i = e.array, | |
r = e.dynamic ? t.DYNAMIC_DRAW : t.STATIC_DRAW, | |
a = t.createBuffer(); | |
t.bindBuffer(n, a), t.bufferData(n, i, r), e.onUploadCallback(); | |
var o = t.FLOAT; | |
return i instanceof Float32Array ? o = t.FLOAT : i instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : i instanceof Uint16Array ? o = t.UNSIGNED_SHORT : i instanceof Int16Array ? o = t.SHORT : i instanceof Uint32Array ? o = t.UNSIGNED_INT : i instanceof Int32Array ? o = t.INT : i instanceof Int8Array ? o = t.BYTE : i instanceof Uint8Array && (o = t.UNSIGNED_BYTE), { | |
buffer: a, | |
type: o, | |
bytesPerElement: i.BYTES_PER_ELEMENT, | |
version: e.version | |
} | |
}(n, i)) : r.version < n.version && (function(e, n, i) { | |
var r = n.array, | |
a = n.updateRange; | |
t.bindBuffer(i, e), !1 === n.dynamic ? t.bufferData(i, r, t.STATIC_DRAW) : -1 === a.count ? t.bufferSubData(i, 0, r) : 0 === a.count ? console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually.") : (t.bufferSubData(i, a.offset * r.BYTES_PER_ELEMENT, r.subarray(a.offset, a.offset + a.count)), a.count = -1) | |
}(r.buffer, n, i), r.version = n.version) | |
} | |
} | |
} | |
function hn(t, e, n, i) { | |
this._x = t || 0, this._y = e || 0, this._z = n || 0, this._order = i || hn.DefaultOrder | |
} | |
function ln() { | |
this.mask = 1 | |
} | |
sn.physical = { | |
uniforms: en.merge([sn.standard.uniforms, { | |
clearCoat: { | |
value: 0 | |
}, | |
clearCoatRoughness: { | |
value: 0 | |
} | |
}]), | |
vertexShader: tn.meshphysical_vert, | |
fragmentShader: tn.meshphysical_frag | |
}, hn.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"], hn.DefaultOrder = "XYZ", Object.defineProperties(hn.prototype, { | |
x: { | |
get: function() { | |
return this._x | |
}, | |
set: function(t) { | |
this._x = t, this.onChangeCallback() | |
} | |
}, | |
y: { | |
get: function() { | |
return this._y | |
}, | |
set: function(t) { | |
this._y = t, this.onChangeCallback() | |
} | |
}, | |
z: { | |
get: function() { | |
return this._z | |
}, | |
set: function(t) { | |
this._z = t, this.onChangeCallback() | |
} | |
}, | |
order: { | |
get: function() { | |
return this._order | |
}, | |
set: function(t) { | |
this._order = t, this.onChangeCallback() | |
} | |
} | |
}), Object.assign(hn.prototype, { | |
isEuler: !0, | |
set: function(t, e, n, i) { | |
return this._x = t, this._y = e, this._z = n, this._order = i || this._order, this.onChangeCallback(), this | |
}, | |
clone: function() { | |
return new this.constructor(this._x, this._y, this._z, this._order) | |
}, | |
copy: function(t) { | |
return this._x = t._x, this._y = t._y, this._z = t._z, this._order = t._order, this.onChangeCallback(), this | |
}, | |
setFromRotationMatrix: function(t, e, n) { | |
var i = Re.clamp, | |
r = t.elements, | |
a = r[0], | |
o = r[4], | |
s = r[8], | |
c = r[1], | |
h = r[5], | |
l = r[9], | |
u = r[2], | |
p = r[6], | |
d = r[10]; | |
return "XYZ" === (e = e || this._order) ? (this._y = Math.asin(i(s, -1, 1)), Math.abs(s) < .99999 ? (this._x = Math.atan2(-l, d), this._z = Math.atan2(-o, a)) : (this._x = Math.atan2(p, h), this._z = 0)) : "YXZ" === e ? (this._x = Math.asin(-i(l, -1, 1)), Math.abs(l) < .99999 ? (this._y = Math.atan2(s, d), this._z = Math.atan2(c, h)) : (this._y = Math.atan2(-u, a), this._z = 0)) : "ZXY" === e ? (this._x = Math.asin(i(p, -1, 1)), Math.abs(p) < .99999 ? (this._y = Math.atan2(-u, d), this._z = Math.atan2(-o, h)) : (this._y = 0, this._z = Math.atan2(c, a))) : "ZYX" === e ? (this._y = Math.asin(-i(u, -1, 1)), Math.abs(u) < .99999 ? (this._x = Math.atan2(p, d), this._z = Math.atan2(c, a)) : (this._x = 0, this._z = Math.atan2(-o, h))) : "YZX" === e ? (this._z = Math.asin(i(c, -1, 1)), Math.abs(c) < .99999 ? (this._x = Math.atan2(-l, h), this._y = Math.atan2(-u, a)) : (this._x = 0, this._y = Math.atan2(s, d))) : "XZY" === e ? (this._z = Math.asin(-i(o, -1, 1)), Math.abs(o) < .99999 ? (this._x = Math.atan2(p, h), this._y = Math.atan2(s, a)) : (this._x = Math.atan2(-l, d), this._y = 0)) : console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: " + e), this._order = e, !1 !== n && this.onChangeCallback(), this | |
}, | |
setFromQuaternion: function() { | |
var t = new Oe; | |
return function(e, n, i) { | |
return t.makeRotationFromQuaternion(e), this.setFromRotationMatrix(t, n, i) | |
} | |
}(), | |
setFromVector3: function(t, e) { | |
return this.set(t.x, t.y, t.z, e || this._order) | |
}, | |
reorder: (an = new De, function(t) { | |
return an.setFromEuler(this), this.setFromQuaternion(an, t) | |
}), | |
equals: function(t) { | |
return t._x === this._x && t._y === this._y && t._z === this._z && t._order === this._order | |
}, | |
fromArray: function(t) { | |
return this._x = t[0], this._y = t[1], this._z = t[2], void 0 !== t[3] && (this._order = t[3]), this.onChangeCallback(), this | |
}, | |
toArray: function(t, e) { | |
return void 0 === t && (t = []), void 0 === e && (e = 0), t[e] = this._x, t[e + 1] = this._y, t[e + 2] = this._z, t[e + 3] = this._order, t | |
}, | |
toVector3: function(t) { | |
return t ? t.set(this._x, this._y, this._z) : new Ue(this._x, this._y, this._z) | |
}, | |
onChange: function(t) { | |
return this.onChangeCallback = t, this | |
}, | |
onChangeCallback: function() {} | |
}), Object.assign(ln.prototype, { | |
set: function(t) { | |
this.mask = 1 << t | 0 | |
}, | |
enable: function(t) { | |
this.mask |= 1 << t | 0 | |
}, | |
toggle: function(t) { | |
this.mask ^= 1 << t | 0 | |
}, | |
disable: function(t) { | |
this.mask &= ~(1 << t | 0) | |
}, | |
test: function(t) { | |
return 0 != (this.mask & t.mask) | |
} | |
}); | |
var un, pn, dn, fn, mn = 0; | |
function gn() { | |
Object.defineProperty(this, "id", { | |
value: mn++ | |
}), this.uuid = Re.generateUUID(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = gn.DefaultUp.clone(); | |
var t = new Ue, | |
e = new hn, | |
n = new De, | |
i = new Ue(1, 1, 1); | |
e.onChange(function() { | |
n.setFromEuler(e, !1) | |
}), n.onChange(function() { | |
e.setFromQuaternion(n, void 0, !1) | |
}), Object.defineProperties(this, { | |
position: { | |
enumerable: !0, | |
value: t | |
}, | |
rotation: { | |
enumerable: !0, | |
value: e | |
}, | |
quaternion: { | |
enumerable: !0, | |
value: n | |
}, | |
scale: { | |
enumerable: !0, | |
value: i | |
}, | |
modelViewMatrix: { | |
value: new Oe | |
}, | |
normalMatrix: { | |
value: new Ne | |
} | |
}), this.matrix = new Oe, this.matrixWorld = new Oe, this.matrixAutoUpdate = gn.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.layers = new ln, this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.userData = {} | |
} | |
function vn() { | |
gn.call(this), this.type = "Camera", this.matrixWorldInverse = new Oe, this.projectionMatrix = new Oe | |
} | |
function yn(t, e, n, i, r, a) { | |
vn.call(this), this.type = "OrthographicCamera", this.zoom = 1, this.view = null, this.left = t, this.right = e, this.top = n, this.bottom = i, this.near = void 0 !== r ? r : .1, this.far = void 0 !== a ? a : 2e3, this.updateProjectionMatrix() | |
} | |
function xn(t, e, n, i, r, a) { | |
this.a = t, this.b = e, this.c = n, this.normal = i && i.isVector3 ? i : new Ue, this.vertexNormals = Array.isArray(i) ? i : [], this.color = r && r.isColor ? r : new rn, this.vertexColors = Array.isArray(r) ? r : [], this.materialIndex = void 0 !== a ? a : 0 | |
} | |
gn.DefaultUp = new Ue(0, 1, 0), gn.DefaultMatrixAutoUpdate = !0, gn.prototype = Object.assign(Object.create(c.prototype), { | |
constructor: gn, | |
isObject3D: !0, | |
onBeforeRender: function() {}, | |
onAfterRender: function() {}, | |
applyMatrix: function(t) { | |
this.matrix.multiplyMatrices(t, this.matrix), this.matrix.decompose(this.position, this.quaternion, this.scale) | |
}, | |
applyQuaternion: function(t) { | |
return this.quaternion.premultiply(t), this | |
}, | |
setRotationFromAxisAngle: function(t, e) { | |
this.quaternion.setFromAxisAngle(t, e) | |
}, | |
setRotationFromEuler: function(t) { | |
this.quaternion.setFromEuler(t, !0) | |
}, | |
setRotationFromMatrix: function(t) { | |
this.quaternion.setFromRotationMatrix(t) | |
}, | |
setRotationFromQuaternion: function(t) { | |
this.quaternion.copy(t) | |
}, | |
rotateOnAxis: (fn = new De, function(t, e) { | |
return fn.setFromAxisAngle(t, e), this.quaternion.multiply(fn), this | |
}), | |
rotateOnWorldAxis: function() { | |
var t = new De; | |
return function(e, n) { | |
return t.setFromAxisAngle(e, n), this.quaternion.premultiply(t), this | |
} | |
}(), | |
rotateX: function() { | |
var t = new Ue(1, 0, 0); | |
return function(e) { | |
return this.rotateOnAxis(t, e) | |
} | |
}(), | |
rotateY: function() { | |
var t = new Ue(0, 1, 0); | |
return function(e) { | |
return this.rotateOnAxis(t, e) | |
} | |
}(), | |
rotateZ: function() { | |
var t = new Ue(0, 0, 1); | |
return function(e) { | |
return this.rotateOnAxis(t, e) | |
} | |
}(), | |
translateOnAxis: function() { | |
var t = new Ue; | |
return function(e, n) { | |
return t.copy(e).applyQuaternion(this.quaternion), this.position.add(t.multiplyScalar(n)), this | |
} | |
}(), | |
translateX: function() { | |
var t = new Ue(1, 0, 0); | |
return function(e) { | |
return this.translateOnAxis(t, e) | |
} | |
}(), | |
translateY: function() { | |
var t = new Ue(0, 1, 0); | |
return function(e) { | |
return this.translateOnAxis(t, e) | |
} | |
}(), | |
translateZ: function() { | |
var t = new Ue(0, 0, 1); | |
return function(e) { | |
return this.translateOnAxis(t, e) | |
} | |
}(), | |
localToWorld: function(t) { | |
return t.applyMatrix4(this.matrixWorld) | |
}, | |
worldToLocal: (dn = new Oe, function(t) { | |
return t.applyMatrix4(dn.getInverse(this.matrixWorld)) | |
}), | |
lookAt: function() { | |
var t = new Oe, | |
e = new Ue; | |
return function(n, i, r) { | |
n.isVector3 ? e.copy(n) : e.set(n, i, r), this.isCamera ? t.lookAt(this.position, e, this.up) : t.lookAt(e, this.position, this.up), this.quaternion.setFromRotationMatrix(t) | |
} | |
}(), | |
add: function(t) { | |
if (arguments.length > 1) { | |
for (var e = 0; e < arguments.length; e++) this.add(arguments[e]); | |
return this | |
} | |
return t === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", t), this) : (t && t.isObject3D ? (null !== t.parent && t.parent.remove(t), t.parent = this, t.dispatchEvent({ | |
type: "added" | |
}), this.children.push(t)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", t), this) | |
}, | |
remove: function(t) { | |
if (arguments.length > 1) { | |
for (var e = 0; e < arguments.length; e++) this.remove(arguments[e]); | |
return this | |
} | |
var n = this.children.indexOf(t); | |
return -1 !== n && (t.parent = null, t.dispatchEvent({ | |
type: "removed" | |
}), this.children.splice(n, 1)), this | |
}, | |
getObjectById: function(t) { | |
return this.getObjectByProperty("id", t) | |
}, | |
getObjectByName: function(t) { | |
return this.getObjectByProperty("name", t) | |
}, | |
getObjectByProperty: function(t, e) { | |
if (this[t] === e) return this; | |
for (var n = 0, i = this.children.length; n < i; n++) { | |
var r = this.children[n].getObjectByProperty(t, e); | |
if (void 0 !== r) return r | |
} | |
}, | |
getWorldPosition: function(t) { | |
return void 0 === t && (console.warn("THREE.Object3D: .getWorldPosition() target is now required"), t = new Ue), this.updateMatrixWorld(!0), t.setFromMatrixPosition(this.matrixWorld) | |
}, | |
getWorldQuaternion: (un = new Ue, pn = new Ue, function(t) { | |
return void 0 === t && (console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"), t = new De), this.updateMatrixWorld(!0), this.matrixWorld.decompose(un, t, pn), t | |
}), | |
getWorldScale: function() { | |
var t = new Ue, | |
e = new De; | |
return function(n) { | |
return void 0 === n && (console.warn("THREE.Object3D: .getWorldScale() target is now required"), n = new Ue), this.updateMatrixWorld(!0), this.matrixWorld.decompose(t, e, n), n | |
} | |
}(), | |
getWorldDirection: function() { | |
var t = new De; | |
return function(e) { | |
return void 0 === e && (console.warn("THREE.Object3D: .getWorldDirection() target is now required"), e = new Ue), this.getWorldQuaternion(t), e.set(0, 0, 1).applyQuaternion(t) | |
} | |
}(), | |
raycast: function() {}, | |
traverse: function(t) { | |
t(this); | |
for (var e = this.children, n = 0, i = e.length; n < i; n++) e[n].traverse(t) | |
}, | |
traverseVisible: function(t) { | |
if (!1 !== this.visible) { | |
t(this); | |
for (var e = this.children, n = 0, i = e.length; n < i; n++) e[n].traverseVisible(t) | |
} | |
}, | |
traverseAncestors: function(t) { | |
var e = this.parent; | |
null !== e && (t(e), e.traverseAncestors(t)) | |
}, | |
updateMatrix: function() { | |
this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate = !0 | |
}, | |
updateMatrixWorld: function(t) { | |
this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || t) && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate = !1, t = !0); | |
for (var e = this.children, n = 0, i = e.length; n < i; n++) e[n].updateMatrixWorld(t) | |
}, | |
toJSON: function(t) { | |
var e = void 0 === t || "string" == typeof t, | |
n = {}; | |
e && (t = { | |
geometries: {}, | |
materials: {}, | |
textures: {}, | |
images: {}, | |
shapes: {} | |
}, n.metadata = { | |
version: 4.5, | |
type: "Object", | |
generator: "Object3D.toJSON" | |
}); | |
var i = {}; | |
function r(e, n) { | |
return void 0 === e[n.uuid] && (e[n.uuid] = n.toJSON(t)), 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), "{}" !== JSON.stringify(this.userData) && (i.userData = this.userData), i.matrix = this.matrix.toArray(), void 0 !== this.geometry) { | |
i.geometry = r(t.geometries, this.geometry); | |
var a = this.geometry.parameters; | |
if (void 0 !== a && void 0 !== a.shapes) { | |
var o = a.shapes; | |
if (Array.isArray(o)) | |
for (var s = 0, c = o.length; s < c; s++) { | |
var h = o[s]; | |
r(t.shapes, h) | |
} else r(t.shapes, o) | |
} | |
} | |
if (void 0 !== this.material) | |
if (Array.isArray(this.material)) { | |
var l = []; | |
for (s = 0, c = this.material.length; s < c; s++) l.push(r(t.materials, this.material[s])); | |
i.material = l | |
} else i.material = r(t.materials, this.material); | |
if (this.children.length > 0) { | |
i.children = []; | |
for (s = 0; s < this.children.length; s++) i.children.push(this.children[s].toJSON(t).object) | |
} | |
if (e) { | |
var u = m(t.geometries), | |
p = m(t.materials), | |
d = m(t.textures), | |
f = m(t.images); | |
o = m(t.shapes); | |
u.length > 0 && (n.geometries = u), p.length > 0 && (n.materials = p), d.length > 0 && (n.textures = d), f.length > 0 && (n.images = f), o.length > 0 && (n.shapes = o) | |
} | |
return n.object = i, n; | |
function m(t) { | |
var e = []; | |
for (var n in t) { | |
var i = t[n]; | |
delete i.metadata, e.push(i) | |
} | |
return e | |
} | |
}, | |
clone: function(t) { | |
return (new this.constructor).copy(this, t) | |
}, | |
copy: function(t, e) { | |
if (void 0 === e && (e = !0), this.name = t.name, this.up.copy(t.up), this.position.copy(t.position), this.quaternion.copy(t.quaternion), this.scale.copy(t.scale), this.matrix.copy(t.matrix), this.matrixWorld.copy(t.matrixWorld), this.matrixAutoUpdate = t.matrixAutoUpdate, this.matrixWorldNeedsUpdate = t.matrixWorldNeedsUpdate, this.layers.mask = t.layers.mask, this.visible = t.visible, this.castShadow = t.castShadow, this.receiveShadow = t.receiveShadow, this.frustumCulled = t.frustumCulled, this.renderOrder = t.renderOrder, this.userData = JSON.parse(JSON.stringify(t.userData)), !0 === e) | |
for (var n = 0; n < t.children.length; n++) { | |
var i = t.children[n]; | |
this.add(i.clone()) | |
} | |
return this | |
} | |
}), vn.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: vn, | |
isCamera: !0, | |
copy: function(t, e) { | |
return gn.prototype.copy.call(this, t, e), this.matrixWorldInverse.copy(t.matrixWorldInverse), this.projectionMatrix.copy(t.projectionMatrix), this | |
}, | |
getWorldDirection: function() { | |
var t = new De; | |
return function(e) { | |
return void 0 === e && (console.warn("THREE.Camera: .getWorldDirection() target is now required"), e = new Ue), this.getWorldQuaternion(t), e.set(0, 0, -1).applyQuaternion(t) | |
} | |
}(), | |
updateMatrixWorld: function(t) { | |
gn.prototype.updateMatrixWorld.call(this, t), this.matrixWorldInverse.getInverse(this.matrixWorld) | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
} | |
}), yn.prototype = Object.assign(Object.create(vn.prototype), { | |
constructor: yn, | |
isOrthographicCamera: !0, | |
copy: function(t, e) { | |
return vn.prototype.copy.call(this, t, e), this.left = t.left, this.right = t.right, this.top = t.top, this.bottom = t.bottom, this.near = t.near, this.far = t.far, this.zoom = t.zoom, this.view = null === t.view ? null : Object.assign({}, t.view), this | |
}, | |
setViewOffset: function(t, e, 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 = t, this.view.fullHeight = e, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix() | |
}, | |
clearViewOffset: function() { | |
null !== this.view && (this.view.enabled = !1), this.updateProjectionMatrix() | |
}, | |
updateProjectionMatrix: function() { | |
var t = (this.right - this.left) / (2 * this.zoom), | |
e = (this.top - this.bottom) / (2 * this.zoom), | |
n = (this.right + this.left) / 2, | |
i = (this.top + this.bottom) / 2, | |
r = n - t, | |
a = n + t, | |
o = i + e, | |
s = i - e; | |
if (null !== this.view && this.view.enabled) { | |
var c = this.zoom / (this.view.width / this.view.fullWidth), | |
h = this.zoom / (this.view.height / this.view.fullHeight), | |
l = (this.right - this.left) / this.view.width, | |
u = (this.top - this.bottom) / this.view.height; | |
a = (r += l * (this.view.offsetX / c)) + l * (this.view.width / c), s = (o -= u * (this.view.offsetY / h)) - u * (this.view.height / h) | |
} | |
this.projectionMatrix.makeOrthographic(r, a, o, s, this.near, this.far) | |
}, | |
toJSON: function(t) { | |
var e = gn.prototype.toJSON.call(this, t); | |
return e.object.zoom = this.zoom, e.object.left = this.left, e.object.right = this.right, e.object.top = this.top, e.object.bottom = this.bottom, e.object.near = this.near, e.object.far = this.far, null !== this.view && (e.object.view = Object.assign({}, this.view)), e | |
} | |
}), Object.assign(xn.prototype, { | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
this.a = t.a, this.b = t.b, this.c = t.c, this.normal.copy(t.normal), this.color.copy(t.color), this.materialIndex = t.materialIndex; | |
for (var e = 0, n = t.vertexNormals.length; e < n; e++) this.vertexNormals[e] = t.vertexNormals[e].clone(); | |
for (e = 0, n = t.vertexColors.length; e < n; e++) this.vertexColors[e] = t.vertexColors[e].clone(); | |
return this | |
} | |
}); | |
var wn, _n, bn = 0; | |
function An() { | |
Object.defineProperty(this, "id", { | |
value: bn += 2 | |
}), this.uuid = Re.generateUUID(), this.name = "", this.type = "Geometry", this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [ | |
[] | |
], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.elementsNeedUpdate = !1, this.verticesNeedUpdate = !1, this.uvsNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.lineDistancesNeedUpdate = !1, this.groupsNeedUpdate = !1 | |
} | |
function Mn(t, e, n) { | |
if (Array.isArray(t)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); | |
this.name = "", this.array = t, this.itemSize = e, this.count = void 0 !== t ? t.length / e : 0, this.normalized = !0 === n, this.dynamic = !1, this.updateRange = { | |
offset: 0, | |
count: -1 | |
}, this.version = 0 | |
} | |
function En(t, e, n) { | |
Mn.call(this, new Int8Array(t), e, n) | |
} | |
function Sn(t, e, n) { | |
Mn.call(this, new Uint8Array(t), e, n) | |
} | |
function Tn(t, e, n) { | |
Mn.call(this, new Uint8ClampedArray(t), e, n) | |
} | |
function Cn(t, e, n) { | |
Mn.call(this, new Int16Array(t), e, n) | |
} | |
function In(t, e, n) { | |
Mn.call(this, new Uint16Array(t), e, n) | |
} | |
function Ln(t, e, n) { | |
Mn.call(this, new Int32Array(t), e, n) | |
} | |
function Rn(t, e, n) { | |
Mn.call(this, new Uint32Array(t), e, n) | |
} | |
function Pn(t, e, n) { | |
Mn.call(this, new Float32Array(t), e, n) | |
} | |
function On(t, e, n) { | |
Mn.call(this, new Float64Array(t), e, n) | |
} | |
function Dn() { | |
this.vertices = [], this.normals = [], this.colors = [], this.uvs = [], this.uvs2 = [], this.groups = [], this.morphTargets = {}, this.skinWeights = [], this.skinIndices = [], this.boundingBox = null, this.boundingSphere = null, this.verticesNeedUpdate = !1, this.normalsNeedUpdate = !1, this.colorsNeedUpdate = !1, this.uvsNeedUpdate = !1, this.groupsNeedUpdate = !1 | |
} | |
function Un(t) { | |
if (0 === t.length) return -Infinity; | |
for (var e = t[0], n = 1, i = t.length; n < i; ++n) t[n] > e && (e = t[n]); | |
return e | |
} | |
An.prototype = Object.assign(Object.create(c.prototype), { | |
constructor: An, | |
isGeometry: !0, | |
applyMatrix: function(t) { | |
for (var e = (new Ne).getNormalMatrix(t), n = 0, i = this.vertices.length; n < i; n++) { | |
this.vertices[n].applyMatrix4(t) | |
} | |
for (n = 0, i = this.faces.length; n < i; n++) { | |
var r = this.faces[n]; | |
r.normal.applyMatrix3(e).normalize(); | |
for (var a = 0, o = r.vertexNormals.length; a < o; a++) r.vertexNormals[a].applyMatrix3(e).normalize() | |
} | |
return null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(), this.verticesNeedUpdate = !0, this.normalsNeedUpdate = !0, this | |
}, | |
rotateX: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.makeRotationX(e), this.applyMatrix(t), this | |
} | |
}(), | |
rotateY: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.makeRotationY(e), this.applyMatrix(t), this | |
} | |
}(), | |
rotateZ: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.makeRotationZ(e), this.applyMatrix(t), this | |
} | |
}(), | |
translate: function() { | |
var t = new Oe; | |
return function(e, n, i) { | |
return t.makeTranslation(e, n, i), this.applyMatrix(t), this | |
} | |
}(), | |
scale: function() { | |
var t = new Oe; | |
return function(e, n, i) { | |
return t.makeScale(e, n, i), this.applyMatrix(t), this | |
} | |
}(), | |
lookAt: (_n = new gn, function(t) { | |
_n.lookAt(t), _n.updateMatrix(), this.applyMatrix(_n.matrix) | |
}), | |
fromBufferGeometry: function(t) { | |
var e = this, | |
n = null !== t.index ? t.index.array : void 0, | |
i = t.attributes, | |
r = i.position.array, | |
a = void 0 !== i.normal ? i.normal.array : void 0, | |
o = void 0 !== i.color ? i.color.array : void 0, | |
s = void 0 !== i.uv ? i.uv.array : void 0, | |
c = void 0 !== i.uv2 ? i.uv2.array : void 0; | |
void 0 !== c && (this.faceVertexUvs[1] = []); | |
for (var h = [], l = [], u = [], p = 0, d = 0; p < r.length; p += 3, d += 2) e.vertices.push(new Ue(r[p], r[p + 1], r[p + 2])), void 0 !== a && h.push(new Ue(a[p], a[p + 1], a[p + 2])), void 0 !== o && e.colors.push(new rn(o[p], o[p + 1], o[p + 2])), void 0 !== s && l.push(new Pe(s[d], s[d + 1])), void 0 !== c && u.push(new Pe(c[d], c[d + 1])); | |
function f(t, n, i, r) { | |
var p = new xn(t, n, i, void 0 !== a ? [h[t].clone(), h[n].clone(), h[i].clone()] : [], void 0 !== o ? [e.colors[t].clone(), e.colors[n].clone(), e.colors[i].clone()] : [], r); | |
e.faces.push(p), void 0 !== s && e.faceVertexUvs[0].push([l[t].clone(), l[n].clone(), l[i].clone()]), void 0 !== c && e.faceVertexUvs[1].push([u[t].clone(), u[n].clone(), u[i].clone()]) | |
} | |
var m = t.groups; | |
if (m.length > 0) | |
for (p = 0; p < m.length; p++) | |
for (var g = m[p], v = g.start, y = (d = v, v + g.count); d < y; d += 3) void 0 !== n ? f(n[d], n[d + 1], n[d + 2], g.materialIndex) : f(d, d + 1, d + 2, g.materialIndex); | |
else if (void 0 !== n) | |
for (p = 0; p < n.length; p += 3) f(n[p], n[p + 1], n[p + 2]); | |
else | |
for (p = 0; p < r.length / 3; p += 3) f(p, p + 1, p + 2); | |
return this.computeFaceNormals(), null !== t.boundingBox && (this.boundingBox = t.boundingBox.clone()), null !== t.boundingSphere && (this.boundingSphere = t.boundingSphere.clone()), this | |
}, | |
center: (wn = new Ue, function() { | |
return this.computeBoundingBox(), this.boundingBox.getCenter(wn).negate(), this.translate(wn.x, wn.y, wn.z), this | |
}), | |
normalize: function() { | |
this.computeBoundingSphere(); | |
var t = this.boundingSphere.center, | |
e = this.boundingSphere.radius, | |
n = 0 === e ? 1 : 1 / e, | |
i = new Oe; | |
return i.set(n, 0, 0, -n * t.x, 0, n, 0, -n * t.y, 0, 0, n, -n * t.z, 0, 0, 0, 1), this.applyMatrix(i), this | |
}, | |
computeFaceNormals: function() { | |
for (var t = new Ue, e = new Ue, n = 0, i = this.faces.length; n < i; n++) { | |
var r = this.faces[n], | |
a = this.vertices[r.a], | |
o = this.vertices[r.b], | |
s = this.vertices[r.c]; | |
t.subVectors(s, o), e.subVectors(a, o), t.cross(e), t.normalize(), r.normal.copy(t) | |
} | |
}, | |
computeVertexNormals: function(t) { | |
var e, n, i, r, a, o; | |
for (void 0 === t && (t = !0), o = new Array(this.vertices.length), e = 0, n = this.vertices.length; e < n; e++) o[e] = new Ue; | |
if (t) { | |
var s, c, h, l = new Ue, | |
u = new Ue; | |
for (i = 0, r = this.faces.length; i < r; i++) a = this.faces[i], s = this.vertices[a.a], c = this.vertices[a.b], h = this.vertices[a.c], l.subVectors(h, c), u.subVectors(s, c), l.cross(u), o[a.a].add(l), o[a.b].add(l), o[a.c].add(l) | |
} else | |
for (this.computeFaceNormals(), i = 0, r = this.faces.length; i < r; i++) o[(a = this.faces[i]).a].add(a.normal), o[a.b].add(a.normal), o[a.c].add(a.normal); | |
for (e = 0, n = this.vertices.length; e < n; e++) o[e].normalize(); | |
for (i = 0, r = this.faces.length; i < r; i++) { | |
var p = (a = this.faces[i]).vertexNormals; | |
3 === p.length ? (p[0].copy(o[a.a]), p[1].copy(o[a.b]), p[2].copy(o[a.c])) : (p[0] = o[a.a].clone(), p[1] = o[a.b].clone(), p[2] = o[a.c].clone()) | |
} | |
this.faces.length > 0 && (this.normalsNeedUpdate = !0) | |
}, | |
computeFlatVertexNormals: function() { | |
var t, e, n; | |
for (this.computeFaceNormals(), t = 0, e = this.faces.length; t < e; t++) { | |
var i = (n = this.faces[t]).vertexNormals; | |
3 === i.length ? (i[0].copy(n.normal), i[1].copy(n.normal), i[2].copy(n.normal)) : (i[0] = n.normal.clone(), i[1] = n.normal.clone(), i[2] = n.normal.clone()) | |
} | |
this.faces.length > 0 && (this.normalsNeedUpdate = !0) | |
}, | |
computeMorphNormals: function() { | |
var t, e, n, i, r; | |
for (n = 0, i = this.faces.length; n < i; n++) | |
for ((r = this.faces[n]).__originalFaceNormal ? r.__originalFaceNormal.copy(r.normal) : r.__originalFaceNormal = r.normal.clone(), r.__originalVertexNormals || (r.__originalVertexNormals = []), t = 0, e = r.vertexNormals.length; t < e; t++) r.__originalVertexNormals[t] ? r.__originalVertexNormals[t].copy(r.vertexNormals[t]) : r.__originalVertexNormals[t] = r.vertexNormals[t].clone(); | |
var a = new An; | |
for (a.faces = this.faces, t = 0, e = this.morphTargets.length; t < e; t++) { | |
if (!this.morphNormals[t]) { | |
this.morphNormals[t] = {}, this.morphNormals[t].faceNormals = [], this.morphNormals[t].vertexNormals = []; | |
var o = this.morphNormals[t].faceNormals, | |
s = this.morphNormals[t].vertexNormals; | |
for (n = 0, i = this.faces.length; n < i; n++) c = new Ue, h = { | |
a: new Ue, | |
b: new Ue, | |
c: new Ue | |
}, o.push(c), s.push(h) | |
} | |
var c, h, l = this.morphNormals[t]; | |
for (a.vertices = this.morphTargets[t].vertices, a.computeFaceNormals(), a.computeVertexNormals(), n = 0, i = this.faces.length; n < i; n++) r = this.faces[n], c = l.faceNormals[n], h = l.vertexNormals[n], c.copy(r.normal), h.a.copy(r.vertexNormals[0]), h.b.copy(r.vertexNormals[1]), h.c.copy(r.vertexNormals[2]) | |
} | |
for (n = 0, i = this.faces.length; n < i; n++)(r = this.faces[n]).normal = r.__originalFaceNormal, r.vertexNormals = r.__originalVertexNormals | |
}, | |
computeBoundingBox: function() { | |
null === this.boundingBox && (this.boundingBox = new Je), this.boundingBox.setFromPoints(this.vertices) | |
}, | |
computeBoundingSphere: function() { | |
null === this.boundingSphere && (this.boundingSphere = new Ze), this.boundingSphere.setFromPoints(this.vertices) | |
}, | |
merge: function(t, e, n) { | |
if (t && t.isGeometry) { | |
var i, r = this.vertices.length, | |
a = this.vertices, | |
o = t.vertices, | |
s = this.faces, | |
c = t.faces, | |
h = this.faceVertexUvs[0], | |
l = t.faceVertexUvs[0], | |
u = this.colors, | |
p = t.colors; | |
void 0 === n && (n = 0), void 0 !== e && (i = (new Ne).getNormalMatrix(e)); | |
for (var d = 0, f = o.length; d < f; d++) { | |
var m = o[d].clone(); | |
void 0 !== e && m.applyMatrix4(e), a.push(m) | |
} | |
for (d = 0, f = p.length; d < f; d++) u.push(p[d].clone()); | |
for (d = 0, f = c.length; d < f; d++) { | |
var g, v, y, x = c[d], | |
w = x.vertexNormals, | |
_ = x.vertexColors; | |
(g = new xn(x.a + r, x.b + r, x.c + r)).normal.copy(x.normal), void 0 !== i && g.normal.applyMatrix3(i).normalize(); | |
for (var b = 0, A = w.length; b < A; b++) v = w[b].clone(), void 0 !== i && v.applyMatrix3(i).normalize(), g.vertexNormals.push(v); | |
g.color.copy(x.color); | |
for (b = 0, A = _.length; b < A; b++) y = _[b], g.vertexColors.push(y.clone()); | |
g.materialIndex = x.materialIndex + n, s.push(g) | |
} | |
for (d = 0, f = l.length; d < f; d++) { | |
var M = l[d], | |
E = []; | |
if (void 0 !== M) { | |
for (b = 0, A = M.length; b < A; b++) E.push(M[b].clone()); | |
h.push(E) | |
} | |
} | |
} else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", t) | |
}, | |
mergeMesh: function(t) { | |
t && t.isMesh ? (t.matrixAutoUpdate && t.updateMatrix(), this.merge(t.geometry, t.matrix)) : console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", t) | |
}, | |
mergeVertices: function() { | |
var t, e, n, i, r, a, o, s, c = {}, | |
h = [], | |
l = [], | |
u = Math.pow(10, 4); | |
for (n = 0, i = this.vertices.length; n < i; n++) t = this.vertices[n], void 0 === c[e = Math.round(t.x * u) + "_" + Math.round(t.y * u) + "_" + Math.round(t.z * u)] ? (c[e] = n, h.push(this.vertices[n]), l[n] = h.length - 1) : l[n] = l[c[e]]; | |
var p = []; | |
for (n = 0, i = this.faces.length; n < i; n++) { | |
(r = this.faces[n]).a = l[r.a], r.b = l[r.b], r.c = l[r.c], a = [r.a, r.b, r.c]; | |
for (var d = 0; d < 3; d++) | |
if (a[d] === a[(d + 1) % 3]) { | |
p.push(n); | |
break | |
} | |
} | |
for (n = p.length - 1; n >= 0; n--) { | |
var f = p[n]; | |
for (this.faces.splice(f, 1), o = 0, s = this.faceVertexUvs.length; o < s; o++) this.faceVertexUvs[o].splice(f, 1) | |
} | |
var m = this.vertices.length - h.length; | |
return this.vertices = h, m | |
}, | |
setFromPoints: function(t) { | |
this.vertices = []; | |
for (var e = 0, n = t.length; e < n; e++) { | |
var i = t[e]; | |
this.vertices.push(new Ue(i.x, i.y, i.z || 0)) | |
} | |
return this | |
}, | |
sortFacesByMaterialIndex: function() { | |
for (var t = this.faces, e = t.length, n = 0; n < e; n++) t[n]._id = n; | |
t.sort(function(t, e) { | |
return t.materialIndex - e.materialIndex | |
}); | |
var i, r, a = this.faceVertexUvs[0], | |
o = this.faceVertexUvs[1]; | |
a && a.length === e && (i = []), o && o.length === e && (r = []); | |
for (n = 0; n < e; n++) { | |
var s = t[n]._id; | |
i && i.push(a[s]), r && r.push(o[s]) | |
} | |
i && (this.faceVertexUvs[0] = i), r && (this.faceVertexUvs[1] = r) | |
}, | |
toJSON: function() { | |
var t = { | |
metadata: { | |
version: 4.5, | |
type: "Geometry", | |
generator: "Geometry.toJSON" | |
} | |
}; | |
if (t.uuid = this.uuid, t.type = this.type, "" !== this.name && (t.name = this.name), void 0 !== this.parameters) { | |
var e = this.parameters; | |
for (var n in e) void 0 !== e[n] && (t[n] = e[n]); | |
return t | |
} | |
for (var i = [], r = 0; r < this.vertices.length; r++) { | |
var a = this.vertices[r]; | |
i.push(a.x, a.y, a.z) | |
} | |
var o = [], | |
s = [], | |
c = {}, | |
h = [], | |
l = {}, | |
u = [], | |
p = {}; | |
for (r = 0; r < this.faces.length; r++) { | |
var d = this.faces[r], | |
f = void 0 !== this.faceVertexUvs[0][r], | |
m = d.normal.length() > 0, | |
g = d.vertexNormals.length > 0, | |
v = 1 !== d.color.r || 1 !== d.color.g || 1 !== d.color.b, | |
y = d.vertexColors.length > 0, | |
x = 0; | |
if (x = A(x = A(x = A(x = A(x = A(x = A(x = A(x = A(x, 0, 0), 1, !0), 2, !1), 3, f), 4, m), 5, g), 6, v), 7, y), o.push(x), o.push(d.a, d.b, d.c), o.push(d.materialIndex), f) { | |
var w = this.faceVertexUvs[0][r]; | |
o.push(S(w[0]), S(w[1]), S(w[2])) | |
} | |
if (m && o.push(M(d.normal)), g) { | |
var _ = d.vertexNormals; | |
o.push(M(_[0]), M(_[1]), M(_[2])) | |
} | |
if (v && o.push(E(d.color)), y) { | |
var b = d.vertexColors; | |
o.push(E(b[0]), E(b[1]), E(b[2])) | |
} | |
} | |
function A(t, e, n) { | |
return n ? t | 1 << e : t & ~(1 << e) | |
} | |
function M(t) { | |
var e = t.x.toString() + t.y.toString() + t.z.toString(); | |
return void 0 !== c[e] ? c[e] : (c[e] = s.length / 3, s.push(t.x, t.y, t.z), c[e]) | |
} | |
function E(t) { | |
var e = t.r.toString() + t.g.toString() + t.b.toString(); | |
return void 0 !== l[e] ? l[e] : (l[e] = h.length, h.push(t.getHex()), l[e]) | |
} | |
function S(t) { | |
var e = t.x.toString() + t.y.toString(); | |
return void 0 !== p[e] ? p[e] : (p[e] = u.length / 2, u.push(t.x, t.y), p[e]) | |
} | |
return t.data = {}, t.data.vertices = i, t.data.normals = s, h.length > 0 && (t.data.colors = h), u.length > 0 && (t.data.uvs = [u]), t.data.faces = o, t | |
}, | |
clone: function() { | |
return (new An).copy(this) | |
}, | |
copy: function(t) { | |
var e, n, i, r, a, o; | |
this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [ | |
[] | |
], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.name = t.name; | |
var s = t.vertices; | |
for (e = 0, n = s.length; e < n; e++) this.vertices.push(s[e].clone()); | |
var c = t.colors; | |
for (e = 0, n = c.length; e < n; e++) this.colors.push(c[e].clone()); | |
var h = t.faces; | |
for (e = 0, n = h.length; e < n; e++) this.faces.push(h[e].clone()); | |
for (e = 0, n = t.faceVertexUvs.length; e < n; e++) { | |
var l = t.faceVertexUvs[e]; | |
for (void 0 === this.faceVertexUvs[e] && (this.faceVertexUvs[e] = []), i = 0, r = l.length; i < r; i++) { | |
var u = l[i], | |
p = []; | |
for (a = 0, o = u.length; a < o; a++) { | |
var d = u[a]; | |
p.push(d.clone()) | |
} | |
this.faceVertexUvs[e].push(p) | |
} | |
} | |
var f = t.morphTargets; | |
for (e = 0, n = f.length; e < n; e++) { | |
var m = {}; | |
if (m.name = f[e].name, void 0 !== f[e].vertices) | |
for (m.vertices = [], i = 0, r = f[e].vertices.length; i < r; i++) m.vertices.push(f[e].vertices[i].clone()); | |
if (void 0 !== f[e].normals) | |
for (m.normals = [], i = 0, r = f[e].normals.length; i < r; i++) m.normals.push(f[e].normals[i].clone()); | |
this.morphTargets.push(m) | |
} | |
var g = t.morphNormals; | |
for (e = 0, n = g.length; e < n; e++) { | |
var v = {}; | |
if (void 0 !== g[e].vertexNormals) | |
for (v.vertexNormals = [], i = 0, r = g[e].vertexNormals.length; i < r; i++) { | |
var y = g[e].vertexNormals[i], | |
x = {}; | |
x.a = y.a.clone(), x.b = y.b.clone(), x.c = y.c.clone(), v.vertexNormals.push(x) | |
} | |
if (void 0 !== g[e].faceNormals) | |
for (v.faceNormals = [], i = 0, r = g[e].faceNormals.length; i < r; i++) v.faceNormals.push(g[e].faceNormals[i].clone()); | |
this.morphNormals.push(v) | |
} | |
var w = t.skinWeights; | |
for (e = 0, n = w.length; e < n; e++) this.skinWeights.push(w[e].clone()); | |
var _ = t.skinIndices; | |
for (e = 0, n = _.length; e < n; e++) this.skinIndices.push(_[e].clone()); | |
var b = t.lineDistances; | |
for (e = 0, n = b.length; e < n; e++) this.lineDistances.push(b[e]); | |
var A = t.boundingBox; | |
null !== A && (this.boundingBox = A.clone()); | |
var M = t.boundingSphere; | |
return null !== M && (this.boundingSphere = M.clone()), this.elementsNeedUpdate = t.elementsNeedUpdate, this.verticesNeedUpdate = t.verticesNeedUpdate, this.uvsNeedUpdate = t.uvsNeedUpdate, this.normalsNeedUpdate = t.normalsNeedUpdate, this.colorsNeedUpdate = t.colorsNeedUpdate, this.lineDistancesNeedUpdate = t.lineDistancesNeedUpdate, this.groupsNeedUpdate = t.groupsNeedUpdate, this | |
}, | |
dispose: function() { | |
this.dispatchEvent({ | |
type: "dispose" | |
}) | |
} | |
}), Object.defineProperty(Mn.prototype, "needsUpdate", { | |
set: function(t) { | |
!0 === t && this.version++ | |
} | |
}), Object.assign(Mn.prototype, { | |
isBufferAttribute: !0, | |
onUploadCallback: function() {}, | |
setArray: function(t) { | |
if (Array.isArray(t)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); | |
this.count = void 0 !== t ? t.length / this.itemSize : 0, this.array = t | |
}, | |
setDynamic: function(t) { | |
return this.dynamic = t, this | |
}, | |
copy: function(t) { | |
return this.array = new t.array.constructor(t.array), this.itemSize = t.itemSize, this.count = t.count, this.normalized = t.normalized, this.dynamic = t.dynamic, this | |
}, | |
copyAt: function(t, e, n) { | |
t *= this.itemSize, n *= e.itemSize; | |
for (var i = 0, r = this.itemSize; i < r; i++) this.array[t + i] = e.array[n + i]; | |
return this | |
}, | |
copyArray: function(t) { | |
return this.array.set(t), this | |
}, | |
copyColorsArray: function(t) { | |
for (var e = this.array, n = 0, i = 0, r = t.length; i < r; i++) { | |
var a = t[i]; | |
void 0 === a && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", i), a = new rn), e[n++] = a.r, e[n++] = a.g, e[n++] = a.b | |
} | |
return this | |
}, | |
copyVector2sArray: function(t) { | |
for (var e = this.array, n = 0, i = 0, r = t.length; i < r; i++) { | |
var a = t[i]; | |
void 0 === a && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", i), a = new Pe), e[n++] = a.x, e[n++] = a.y | |
} | |
return this | |
}, | |
copyVector3sArray: function(t) { | |
for (var e = this.array, n = 0, i = 0, r = t.length; i < r; i++) { | |
var a = t[i]; | |
void 0 === a && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", i), a = new Ue), e[n++] = a.x, e[n++] = a.y, e[n++] = a.z | |
} | |
return this | |
}, | |
copyVector4sArray: function(t) { | |
for (var e = this.array, n = 0, i = 0, r = t.length; i < r; i++) { | |
var a = t[i]; | |
void 0 === a && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", i), a = new We), e[n++] = a.x, e[n++] = a.y, e[n++] = a.z, e[n++] = a.w | |
} | |
return this | |
}, | |
set: function(t, e) { | |
return void 0 === e && (e = 0), this.array.set(t, e), this | |
}, | |
getX: function(t) { | |
return this.array[t * this.itemSize] | |
}, | |
setX: function(t, e) { | |
return this.array[t * this.itemSize] = e, this | |
}, | |
getY: function(t) { | |
return this.array[t * this.itemSize + 1] | |
}, | |
setY: function(t, e) { | |
return this.array[t * this.itemSize + 1] = e, this | |
}, | |
getZ: function(t) { | |
return this.array[t * this.itemSize + 2] | |
}, | |
setZ: function(t, e) { | |
return this.array[t * this.itemSize + 2] = e, this | |
}, | |
getW: function(t) { | |
return this.array[t * this.itemSize + 3] | |
}, | |
setW: function(t, e) { | |
return this.array[t * this.itemSize + 3] = e, this | |
}, | |
setXY: function(t, e, n) { | |
return t *= this.itemSize, this.array[t + 0] = e, this.array[t + 1] = n, this | |
}, | |
setXYZ: function(t, e, n, i) { | |
return t *= this.itemSize, this.array[t + 0] = e, this.array[t + 1] = n, this.array[t + 2] = i, this | |
}, | |
setXYZW: function(t, e, n, i, r) { | |
return t *= this.itemSize, this.array[t + 0] = e, this.array[t + 1] = n, this.array[t + 2] = i, this.array[t + 3] = r, this | |
}, | |
onUpload: function(t) { | |
return this.onUploadCallback = t, this | |
}, | |
clone: function() { | |
return new this.constructor(this.array, this.itemSize).copy(this) | |
} | |
}), En.prototype = Object.create(Mn.prototype), En.prototype.constructor = En, Sn.prototype = Object.create(Mn.prototype), Sn.prototype.constructor = Sn, Tn.prototype = Object.create(Mn.prototype), Tn.prototype.constructor = Tn, Cn.prototype = Object.create(Mn.prototype), Cn.prototype.constructor = Cn, In.prototype = Object.create(Mn.prototype), In.prototype.constructor = In, Ln.prototype = Object.create(Mn.prototype), Ln.prototype.constructor = Ln, Rn.prototype = Object.create(Mn.prototype), Rn.prototype.constructor = Rn, Pn.prototype = Object.create(Mn.prototype), Pn.prototype.constructor = Pn, On.prototype = Object.create(Mn.prototype), On.prototype.constructor = On, Object.assign(Dn.prototype, { | |
computeGroups: function(t) { | |
for (var e, n = [], i = void 0, r = t.faces, a = 0; a < r.length; a++) { | |
var o = r[a]; | |
o.materialIndex !== i && (i = o.materialIndex, void 0 !== e && (e.count = 3 * a - e.start, n.push(e)), e = { | |
start: 3 * a, | |
materialIndex: i | |
}) | |
} | |
void 0 !== e && (e.count = 3 * a - e.start, n.push(e)), this.groups = n | |
}, | |
fromGeometry: function(t) { | |
var e, n = t.faces, | |
i = t.vertices, | |
r = t.faceVertexUvs, | |
a = r[0] && r[0].length > 0, | |
o = r[1] && r[1].length > 0, | |
s = t.morphTargets, | |
c = s.length; | |
if (c > 0) { | |
e = []; | |
for (var h = 0; h < c; h++) e[h] = []; | |
this.morphTargets.position = e | |
} | |
var l, u = t.morphNormals, | |
p = u.length; | |
if (p > 0) { | |
l = []; | |
for (h = 0; h < p; h++) l[h] = []; | |
this.morphTargets.normal = l | |
} | |
var d = t.skinIndices, | |
f = t.skinWeights, | |
m = d.length === i.length, | |
g = f.length === i.length; | |
for (h = 0; h < n.length; h++) { | |
var v = n[h]; | |
this.vertices.push(i[v.a], i[v.b], i[v.c]); | |
var y = v.vertexNormals; | |
if (3 === y.length) this.normals.push(y[0], y[1], y[2]); | |
else { | |
var x = v.normal; | |
this.normals.push(x, x, x) | |
} | |
var w, _ = v.vertexColors; | |
if (3 === _.length) this.colors.push(_[0], _[1], _[2]); | |
else { | |
var b = v.color; | |
this.colors.push(b, b, b) | |
} | |
if (!0 === a) void 0 !== (w = r[0][h]) ? this.uvs.push(w[0], w[1], w[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", h), this.uvs.push(new Pe, new Pe, new Pe)); | |
if (!0 === o) void 0 !== (w = r[1][h]) ? this.uvs2.push(w[0], w[1], w[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", h), this.uvs2.push(new Pe, new Pe, new Pe)); | |
for (var A = 0; A < c; A++) { | |
var M = s[A].vertices; | |
e[A].push(M[v.a], M[v.b], M[v.c]) | |
} | |
for (A = 0; A < p; A++) { | |
var E = u[A].vertexNormals[h]; | |
l[A].push(E.a, E.b, E.c) | |
} | |
m && this.skinIndices.push(d[v.a], d[v.b], d[v.c]), g && this.skinWeights.push(f[v.a], f[v.b], f[v.c]) | |
} | |
return this.computeGroups(t), this.verticesNeedUpdate = t.verticesNeedUpdate, this.normalsNeedUpdate = t.normalsNeedUpdate, this.colorsNeedUpdate = t.colorsNeedUpdate, this.uvsNeedUpdate = t.uvsNeedUpdate, this.groupsNeedUpdate = t.groupsNeedUpdate, this | |
} | |
}); | |
var Nn = 1; | |
function Bn() { | |
Object.defineProperty(this, "id", { | |
value: Nn += 2 | |
}), this.uuid = Re.generateUUID(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = { | |
start: 0, | |
count: Infinity | |
} | |
} | |
function zn(t, e, n, i, r, a) { | |
An.call(this), this.type = "BoxGeometry", this.parameters = { | |
width: t, | |
height: e, | |
depth: n, | |
widthSegments: i, | |
heightSegments: r, | |
depthSegments: a | |
}, this.fromBufferGeometry(new Fn(t, e, n, i, r, a)), this.mergeVertices() | |
} | |
function Fn(t, e, n, i, r, a) { | |
Bn.call(this), this.type = "BoxBufferGeometry", this.parameters = { | |
width: t, | |
height: e, | |
depth: n, | |
widthSegments: i, | |
heightSegments: r, | |
depthSegments: a | |
}; | |
var o = this; | |
t = t || 1, e = e || 1, n = n || 1, i = Math.floor(i) || 1, r = Math.floor(r) || 1, a = Math.floor(a) || 1; | |
var s = [], | |
c = [], | |
h = [], | |
l = [], | |
u = 0, | |
p = 0; | |
function d(t, e, n, i, r, a, d, f, m, g, v) { | |
var y, x, w = a / m, | |
_ = d / g, | |
b = a / 2, | |
A = d / 2, | |
M = f / 2, | |
E = m + 1, | |
S = g + 1, | |
T = 0, | |
C = 0, | |
I = new Ue; | |
for (x = 0; x < S; x++) { | |
var L = x * _ - A; | |
for (y = 0; y < E; y++) { | |
var R = y * w - b; | |
I[t] = R * i, I[e] = L * r, I[n] = M, c.push(I.x, I.y, I.z), I[t] = 0, I[e] = 0, I[n] = f > 0 ? 1 : -1, h.push(I.x, I.y, I.z), l.push(y / m), l.push(1 - x / g), T += 1 | |
} | |
} | |
for (x = 0; x < g; x++) | |
for (y = 0; y < m; y++) { | |
var P = u + y + E * x, | |
O = u + y + E * (x + 1), | |
D = u + (y + 1) + E * (x + 1), | |
U = u + (y + 1) + E * x; | |
s.push(P, O, U), s.push(O, D, U), C += 6 | |
} | |
o.addGroup(p, C, v), p += C, u += T | |
} | |
d("z", "y", "x", -1, -1, n, e, t, a, r, 0), d("z", "y", "x", 1, -1, n, e, -t, a, r, 1), d("x", "z", "y", 1, 1, t, n, e, i, a, 2), d("x", "z", "y", 1, -1, t, n, -e, i, a, 3), d("x", "y", "z", 1, -1, t, e, n, i, r, 4), d("x", "y", "z", -1, -1, t, e, -n, i, r, 5), this.setIndex(s), this.addAttribute("position", new Pn(c, 3)), this.addAttribute("normal", new Pn(h, 3)), this.addAttribute("uv", new Pn(l, 2)) | |
} | |
function Gn(t, e, n, i) { | |
An.call(this), this.type = "PlaneGeometry", this.parameters = { | |
width: t, | |
height: e, | |
widthSegments: n, | |
heightSegments: i | |
}, this.fromBufferGeometry(new kn(t, e, n, i)), this.mergeVertices() | |
} | |
function kn(t, e, n, i) { | |
Bn.call(this), this.type = "PlaneBufferGeometry", this.parameters = { | |
width: t, | |
height: e, | |
widthSegments: n, | |
heightSegments: i | |
}; | |
var r, a, o = (t = t || 1) / 2, | |
s = (e = e || 1) / 2, | |
c = Math.floor(n) || 1, | |
h = Math.floor(i) || 1, | |
l = c + 1, | |
u = h + 1, | |
p = t / c, | |
d = e / h, | |
f = [], | |
m = [], | |
g = [], | |
v = []; | |
for (a = 0; a < u; a++) { | |
var y = a * d - s; | |
for (r = 0; r < l; r++) { | |
var x = r * p - o; | |
m.push(x, -y, 0), g.push(0, 0, 1), v.push(r / c), v.push(1 - a / h) | |
} | |
} | |
for (a = 0; a < h; a++) | |
for (r = 0; r < c; r++) { | |
var w = r + l * a, | |
_ = r + l * (a + 1), | |
b = r + 1 + l * (a + 1), | |
A = r + 1 + l * a; | |
f.push(w, _, A), f.push(_, b, A) | |
} | |
this.setIndex(f), this.addAttribute("position", new Pn(m, 3)), this.addAttribute("normal", new Pn(g, 3)), this.addAttribute("uv", new Pn(v, 2)) | |
} | |
Bn.prototype = Object.assign(Object.create(c.prototype), { | |
constructor: Bn, | |
isBufferGeometry: !0, | |
getIndex: function() { | |
return this.index | |
}, | |
setIndex: function(t) { | |
Array.isArray(t) ? this.index = new(Un(t) > 65535 ? Rn : In)(t, 1) : this.index = t | |
}, | |
addAttribute: function(t, e) { | |
return e && e.isBufferAttribute || e && e.isInterleavedBufferAttribute ? "index" === t ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."), void this.setIndex(e)) : (this.attributes[t] = e, this) : (console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."), void this.addAttribute(t, new Mn(arguments[1], arguments[2]))) | |
}, | |
getAttribute: function(t) { | |
return this.attributes[t] | |
}, | |
removeAttribute: function(t) { | |
return delete this.attributes[t], this | |
}, | |
addGroup: function(t, e, n) { | |
this.groups.push({ | |
start: t, | |
count: e, | |
materialIndex: void 0 !== n ? n : 0 | |
}) | |
}, | |
clearGroups: function() { | |
this.groups = [] | |
}, | |
setDrawRange: function(t, e) { | |
this.drawRange.start = t, this.drawRange.count = e | |
}, | |
applyMatrix: function(t) { | |
var e = this.attributes.position; | |
void 0 !== e && (t.applyToBufferAttribute(e), e.needsUpdate = !0); | |
var n = this.attributes.normal; | |
void 0 !== n && ((new Ne).getNormalMatrix(t).applyToBufferAttribute(n), n.needsUpdate = !0); | |
return null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(), this | |
}, | |
rotateX: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.makeRotationX(e), this.applyMatrix(t), this | |
} | |
}(), | |
rotateY: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.makeRotationY(e), this.applyMatrix(t), this | |
} | |
}(), | |
rotateZ: function() { | |
var t = new Oe; | |
return function(e) { | |
return t.makeRotationZ(e), this.applyMatrix(t), this | |
} | |
}(), | |
translate: function() { | |
var t = new Oe; | |
return function(e, n, i) { | |
return t.makeTranslation(e, n, i), this.applyMatrix(t), this | |
} | |
}(), | |
scale: function() { | |
var t = new Oe; | |
return function(e, n, i) { | |
return t.makeScale(e, n, i), this.applyMatrix(t), this | |
} | |
}(), | |
lookAt: function() { | |
var t = new gn; | |
return function(e) { | |
t.lookAt(e), t.updateMatrix(), this.applyMatrix(t.matrix) | |
} | |
}(), | |
center: function() { | |
var t = new Ue; | |
return function() { | |
return this.computeBoundingBox(), this.boundingBox.getCenter(t).negate(), this.translate(t.x, t.y, t.z), this | |
} | |
}(), | |
setFromObject: function(t) { | |
var e = t.geometry; | |
if (t.isPoints || t.isLine) { | |
var n = new Pn(3 * e.vertices.length, 3), | |
i = new Pn(3 * e.colors.length, 3); | |
if (this.addAttribute("position", n.copyVector3sArray(e.vertices)), this.addAttribute("color", i.copyColorsArray(e.colors)), e.lineDistances && e.lineDistances.length === e.vertices.length) { | |
var r = new Pn(e.lineDistances.length, 1); | |
this.addAttribute("lineDistance", r.copyArray(e.lineDistances)) | |
} | |
null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()) | |
} else t.isMesh && e && e.isGeometry && this.fromGeometry(e); | |
return this | |
}, | |
setFromPoints: function(t) { | |
for (var e = [], n = 0, i = t.length; n < i; n++) { | |
var r = t[n]; | |
e.push(r.x, r.y, r.z || 0) | |
} | |
return this.addAttribute("position", new Pn(e, 3)), this | |
}, | |
updateFromObject: function(t) { | |
var e, n = t.geometry; | |
if (t.isMesh) { | |
var i = n.__directGeometry; | |
if (!0 === n.elementsNeedUpdate && (i = void 0, n.elementsNeedUpdate = !1), void 0 === i) return this.fromGeometry(n); | |
i.verticesNeedUpdate = n.verticesNeedUpdate, i.normalsNeedUpdate = n.normalsNeedUpdate, i.colorsNeedUpdate = n.colorsNeedUpdate, i.uvsNeedUpdate = n.uvsNeedUpdate, i.groupsNeedUpdate = n.groupsNeedUpdate, n.verticesNeedUpdate = !1, n.normalsNeedUpdate = !1, n.colorsNeedUpdate = !1, n.uvsNeedUpdate = !1, n.groupsNeedUpdate = !1, n = i | |
} | |
return !0 === n.verticesNeedUpdate && (void 0 !== (e = this.attributes.position) && (e.copyVector3sArray(n.vertices), e.needsUpdate = !0), n.verticesNeedUpdate = !1), !0 === n.normalsNeedUpdate && (void 0 !== (e = this.attributes.normal) && (e.copyVector3sArray(n.normals), e.needsUpdate = !0), n.normalsNeedUpdate = !1), !0 === n.colorsNeedUpdate && (void 0 !== (e = this.attributes.color) && (e.copyColorsArray(n.colors), e.needsUpdate = !0), n.colorsNeedUpdate = !1), n.uvsNeedUpdate && (void 0 !== (e = this.attributes.uv) && (e.copyVector2sArray(n.uvs), e.needsUpdate = !0), n.uvsNeedUpdate = !1), n.lineDistancesNeedUpdate && (void 0 !== (e = this.attributes.lineDistance) && (e.copyArray(n.lineDistances), e.needsUpdate = !0), n.lineDistancesNeedUpdate = !1), n.groupsNeedUpdate && (n.computeGroups(t.geometry), this.groups = n.groups, n.groupsNeedUpdate = !1), this | |
}, | |
fromGeometry: function(t) { | |
return t.__directGeometry = (new Dn).fromGeometry(t), this.fromDirectGeometry(t.__directGeometry) | |
}, | |
fromDirectGeometry: function(t) { | |
var e = new Float32Array(3 * t.vertices.length); | |
if (this.addAttribute("position", new Mn(e, 3).copyVector3sArray(t.vertices)), t.normals.length > 0) { | |
var n = new Float32Array(3 * t.normals.length); | |
this.addAttribute("normal", new Mn(n, 3).copyVector3sArray(t.normals)) | |
} | |
if (t.colors.length > 0) { | |
var i = new Float32Array(3 * t.colors.length); | |
this.addAttribute("color", new Mn(i, 3).copyColorsArray(t.colors)) | |
} | |
if (t.uvs.length > 0) { | |
var r = new Float32Array(2 * t.uvs.length); | |
this.addAttribute("uv", new Mn(r, 2).copyVector2sArray(t.uvs)) | |
} | |
if (t.uvs2.length > 0) { | |
var a = new Float32Array(2 * t.uvs2.length); | |
this.addAttribute("uv2", new Mn(a, 2).copyVector2sArray(t.uvs2)) | |
} | |
for (var o in this.groups = t.groups, t.morphTargets) { | |
for (var s = [], c = t.morphTargets[o], h = 0, l = c.length; h < l; h++) { | |
var u = c[h], | |
p = new Pn(3 * u.length, 3); | |
s.push(p.copyVector3sArray(u)) | |
} | |
this.morphAttributes[o] = s | |
} | |
if (t.skinIndices.length > 0) { | |
var d = new Pn(4 * t.skinIndices.length, 4); | |
this.addAttribute("skinIndex", d.copyVector4sArray(t.skinIndices)) | |
} | |
if (t.skinWeights.length > 0) { | |
var f = new Pn(4 * t.skinWeights.length, 4); | |
this.addAttribute("skinWeight", f.copyVector4sArray(t.skinWeights)) | |
} | |
return null !== t.boundingSphere && (this.boundingSphere = t.boundingSphere.clone()), null !== t.boundingBox && (this.boundingBox = t.boundingBox.clone()), this | |
}, | |
computeBoundingBox: function() { | |
null === this.boundingBox && (this.boundingBox = new Je); | |
var t = this.attributes.position; | |
void 0 !== t ? this.boundingBox.setFromBufferAttribute(t) : 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: function() { | |
var t = new Je, | |
e = new Ue; | |
return function() { | |
null === this.boundingSphere && (this.boundingSphere = new Ze); | |
var n = this.attributes.position; | |
if (n) { | |
var i = this.boundingSphere.center; | |
t.setFromBufferAttribute(n), t.getCenter(i); | |
for (var r = 0, a = 0, o = n.count; a < o; a++) e.x = n.getX(a), e.y = n.getY(a), e.z = n.getZ(a), r = Math.max(r, i.distanceToSquared(e)); | |
this.boundingSphere.radius = Math.sqrt(r), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this) | |
} | |
} | |
}(), | |
computeFaceNormals: function() {}, | |
computeVertexNormals: function() { | |
var t = this.index, | |
e = this.attributes, | |
n = this.groups; | |
if (e.position) { | |
var i = e.position.array; | |
if (void 0 === e.normal) this.addAttribute("normal", new Mn(new Float32Array(i.length), 3)); | |
else | |
for (var r = e.normal.array, a = 0, o = r.length; a < o; a++) r[a] = 0; | |
var s, c, h, l = e.normal.array, | |
u = new Ue, | |
p = new Ue, | |
d = new Ue, | |
f = new Ue, | |
m = new Ue; | |
if (t) { | |
var g = t.array; | |
0 === n.length && this.addGroup(0, g.length); | |
for (var v = 0, y = n.length; v < y; ++v) { | |
var x = n[v], | |
w = x.start; | |
for (a = w, o = w + x.count; a < o; a += 3) s = 3 * g[a + 0], c = 3 * g[a + 1], h = 3 * g[a + 2], u.fromArray(i, s), p.fromArray(i, c), d.fromArray(i, h), f.subVectors(d, p), m.subVectors(u, p), f.cross(m), l[s] += f.x, l[s + 1] += f.y, l[s + 2] += f.z, l[c] += f.x, l[c + 1] += f.y, l[c + 2] += f.z, l[h] += f.x, l[h + 1] += f.y, l[h + 2] += f.z | |
} | |
} else | |
for (a = 0, o = i.length; a < o; a += 9) u.fromArray(i, a), p.fromArray(i, a + 3), d.fromArray(i, a + 6), f.subVectors(d, p), m.subVectors(u, p), f.cross(m), l[a] = f.x, l[a + 1] = f.y, l[a + 2] = f.z, l[a + 3] = f.x, l[a + 4] = f.y, l[a + 5] = f.z, l[a + 6] = f.x, l[a + 7] = f.y, l[a + 8] = f.z; | |
this.normalizeNormals(), e.normal.needsUpdate = !0 | |
} | |
}, | |
merge: function(t, e) { | |
if (t && t.isBufferGeometry) { | |
void 0 === e && (e = 0, console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.")); | |
var n = this.attributes; | |
for (var i in n) | |
if (void 0 !== t.attributes[i]) | |
for (var r = n[i].array, a = t.attributes[i], o = a.array, s = 0, c = a.itemSize * e; s < o.length; s++, c++) r[c] = o[s]; | |
return this | |
} | |
console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", t) | |
}, | |
normalizeNormals: function() { | |
var t = new Ue; | |
return function() { | |
for (var e = this.attributes.normal, n = 0, i = e.count; n < i; n++) t.x = e.getX(n), t.y = e.getY(n), t.z = e.getZ(n), t.normalize(), e.setXYZ(n, t.x, t.y, t.z) | |
} | |
}(), | |
toNonIndexed: function() { | |
if (null === this.index) return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."), this; | |
var t = new Bn, | |
e = this.index.array, | |
n = this.attributes; | |
for (var i in n) { | |
for (var r = n[i], a = r.array, o = r.itemSize, s = new a.constructor(e.length * o), c = 0, h = 0, l = 0, u = e.length; l < u; l++) { | |
c = e[l] * o; | |
for (var p = 0; p < o; p++) s[h++] = a[c++] | |
} | |
t.addAttribute(i, new Mn(s, o)) | |
} | |
var d = this.groups; | |
for (l = 0, u = d.length; l < u; l++) { | |
var f = d[l]; | |
t.addGroup(f.start, f.count, f.materialIndex) | |
} | |
return t | |
}, | |
toJSON: function() { | |
var t = { | |
metadata: { | |
version: 4.5, | |
type: "BufferGeometry", | |
generator: "BufferGeometry.toJSON" | |
} | |
}; | |
if (t.uuid = this.uuid, t.type = this.type, "" !== this.name && (t.name = this.name), void 0 !== this.parameters) { | |
var e = this.parameters; | |
for (var n in e) void 0 !== e[n] && (t[n] = e[n]); | |
return t | |
} | |
t.data = { | |
attributes: {} | |
}; | |
var i = this.index; | |
if (null !== i) { | |
var r = Array.prototype.slice.call(i.array); | |
t.data.index = { | |
type: i.array.constructor.name, | |
array: r | |
} | |
} | |
var a = this.attributes; | |
for (var n in a) { | |
var o = a[n]; | |
r = Array.prototype.slice.call(o.array); | |
t.data.attributes[n] = { | |
itemSize: o.itemSize, | |
type: o.array.constructor.name, | |
array: r, | |
normalized: o.normalized | |
} | |
} | |
var s = this.groups; | |
s.length > 0 && (t.data.groups = JSON.parse(JSON.stringify(s))); | |
var c = this.boundingSphere; | |
return null !== c && (t.data.boundingSphere = { | |
center: c.center.toArray(), | |
radius: c.radius | |
}), t | |
}, | |
clone: function() { | |
return (new Bn).copy(this) | |
}, | |
copy: function(t) { | |
var e, n, i; | |
this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.name = t.name; | |
var r = t.index; | |
null !== r && this.setIndex(r.clone()); | |
var a = t.attributes; | |
for (e in a) { | |
var o = a[e]; | |
this.addAttribute(e, o.clone()) | |
} | |
var s = t.morphAttributes; | |
for (e in s) { | |
var c = [], | |
h = s[e]; | |
for (n = 0, i = h.length; n < i; n++) c.push(h[n].clone()); | |
this.morphAttributes[e] = c | |
} | |
var l = t.groups; | |
for (n = 0, i = l.length; n < i; n++) { | |
var u = l[n]; | |
this.addGroup(u.start, u.count, u.materialIndex) | |
} | |
var p = t.boundingBox; | |
null !== p && (this.boundingBox = p.clone()); | |
var d = t.boundingSphere; | |
return null !== d && (this.boundingSphere = d.clone()), this.drawRange.start = t.drawRange.start, this.drawRange.count = t.drawRange.count, this | |
}, | |
dispose: function() { | |
this.dispatchEvent({ | |
type: "dispose" | |
}) | |
} | |
}), zn.prototype = Object.create(An.prototype), zn.prototype.constructor = zn, Fn.prototype = Object.create(Bn.prototype), Fn.prototype.constructor = Fn, Gn.prototype = Object.create(An.prototype), Gn.prototype.constructor = Gn, kn.prototype = Object.create(Bn.prototype), kn.prototype.constructor = kn; | |
var Hn, Vn, jn, Wn, Xn, qn, Yn, Jn = 0; | |
function Zn() { | |
Object.defineProperty(this, "id", { | |
value: Jn++ | |
}), this.uuid = Re.generateUUID(), this.name = "", this.type = "Material", this.fog = !0, this.lights = !0, this.blending = L, this.side = A, this.flatShading = !1, this.vertexColors = S, this.opacity = 1, this.transparent = !1, this.blendSrc = j, this.blendDst = W, this.blendEquation = U, this.blendSrcAlpha = null, this.blendDstAlpha = null, this.blendEquationAlpha = null, this.depthFunc = tt, this.depthTest = !0, this.depthWrite = !0, 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.alphaTest = 0, this.premultipliedAlpha = !1, this.overdraw = 0, this.visible = !0, this.userData = {}, this.needsUpdate = !0 | |
} | |
function Qn(t) { | |
Zn.call(this), this.type = "MeshBasicMaterial", this.color = new rn(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.combine = at, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.lights = !1, this.setValues(t) | |
} | |
function Kn(t) { | |
Zn.call(this), this.type = "ShaderMaterial", this.defines = {}, this.uniforms = {}, 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.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.extensions = { | |
derivatives: !1, | |
fragDepth: !1, | |
drawBuffers: !1, | |
shaderTextureLOD: !1 | |
}, this.defaultAttributeValues = { | |
color: [1, 1, 1], | |
uv: [0, 0], | |
uv2: [0, 0] | |
}, this.index0AttributeName = void 0, this.uniformsNeedUpdate = !1, void 0 !== t && (void 0 !== t.attributes && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."), this.setValues(t)) | |
} | |
function $n(t, e) { | |
this.origin = void 0 !== t ? t : new Ue, this.direction = void 0 !== e ? e : new Ue | |
} | |
function ti(t, e) { | |
this.start = void 0 !== t ? t : new Ue, this.end = void 0 !== e ? e : new Ue | |
} | |
function ei(t, e, n) { | |
this.a = void 0 !== t ? t : new Ue, this.b = void 0 !== e ? e : new Ue, this.c = void 0 !== n ? n : new Ue | |
} | |
function ni(t, e) { | |
gn.call(this), this.type = "Mesh", this.geometry = void 0 !== t ? t : new Bn, this.material = void 0 !== e ? e : new Qn({ | |
color: 16777215 * Math.random() | |
}), this.drawMode = xe, this.updateMorphTargets() | |
} | |
function ii(t, e) { | |
return Math.abs(e[1]) - Math.abs(t[1]) | |
} | |
function ri(t, e, n, i, r, a, o, s, c, h) { | |
t = void 0 !== t ? t : [], e = void 0 !== e ? e : dt, je.call(this, t, e, n, i, r, a, o, s, c, h), this.flipY = !1 | |
} | |
Zn.prototype = Object.assign(Object.create(c.prototype), { | |
constructor: Zn, | |
isMaterial: !0, | |
onBeforeCompile: function() {}, | |
setValues: function(t) { | |
if (void 0 !== t) | |
for (var e in t) { | |
var n = t[e]; | |
if (void 0 !== n) | |
if ("shading" !== e) { | |
var i = this[e]; | |
void 0 !== i ? i && i.isColor ? i.set(n) : i && i.isVector3 && n && n.isVector3 ? i.copy(n) : this[e] = "overdraw" === e ? Number(n) : n : console.warn("THREE." + this.type + ": '" + e + "' is not a property of this material.") | |
} else console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = 1 === n; | |
else console.warn("THREE.Material: '" + e + "' parameter is undefined.") | |
} | |
}, | |
toJSON: function(t) { | |
var e = void 0 === t || "string" == typeof t; | |
e && (t = { | |
textures: {}, | |
images: {} | |
}); | |
var n = { | |
metadata: { | |
version: 4.5, | |
type: "Material", | |
generator: "Material.toJSON" | |
} | |
}; | |
function i(t) { | |
var e = []; | |
for (var n in t) { | |
var i = t[n]; | |
delete i.metadata, e.push(i) | |
} | |
return e | |
} | |
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), this.emissive && this.emissive.isColor && (n.emissive = this.emissive.getHex()), 1 !== this.emissiveIntensity && (n.emissiveIntensity = this.emissiveIntensity), this.specular && this.specular.isColor && (n.specular = this.specular.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.map && this.map.isTexture && (n.map = this.map.toJSON(t).uuid), this.alphaMap && this.alphaMap.isTexture && (n.alphaMap = this.alphaMap.toJSON(t).uuid), this.lightMap && this.lightMap.isTexture && (n.lightMap = this.lightMap.toJSON(t).uuid), this.bumpMap && this.bumpMap.isTexture && (n.bumpMap = this.bumpMap.toJSON(t).uuid, n.bumpScale = this.bumpScale), this.normalMap && this.normalMap.isTexture && (n.normalMap = this.normalMap.toJSON(t).uuid, n.normalScale = this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (n.displacementMap = this.displacementMap.toJSON(t).uuid, n.displacementScale = this.displacementScale, n.displacementBias = this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (n.roughnessMap = this.roughnessMap.toJSON(t).uuid), this.metalnessMap && this.metalnessMap.isTexture && (n.metalnessMap = this.metalnessMap.toJSON(t).uuid), this.emissiveMap && this.emissiveMap.isTexture && (n.emissiveMap = this.emissiveMap.toJSON(t).uuid), this.specularMap && this.specularMap.isTexture && (n.specularMap = this.specularMap.toJSON(t).uuid), this.envMap && this.envMap.isTexture && (n.envMap = this.envMap.toJSON(t).uuid, n.reflectivity = this.reflectivity), this.gradientMap && this.gradientMap.isTexture && (n.gradientMap = this.gradientMap.toJSON(t).uuid), void 0 !== this.size && (n.size = this.size), void 0 !== this.sizeAttenuation && (n.sizeAttenuation = this.sizeAttenuation), this.blending !== L && (n.blending = this.blending), !0 === this.flatShading && (n.flatShading = this.flatShading), this.side !== A && (n.side = this.side), this.vertexColors !== S && (n.vertexColors = this.vertexColors), this.opacity < 1 && (n.opacity = this.opacity), !0 === this.transparent && (n.transparent = this.transparent), n.depthFunc = this.depthFunc, n.depthTest = this.depthTest, n.depthWrite = this.depthWrite, 0 !== this.rotation && (n.rotation = this.rotation), 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.premultipliedAlpha && (n.premultipliedAlpha = this.premultipliedAlpha), !0 === this.wireframe && (n.wireframe = this.wireframe), this.wireframeLinewidth > 1 && (n.wireframeLinewidth = this.wireframeLinewidth), "round" !== this.wireframeLinecap && (n.wireframeLinecap = this.wireframeLinecap), "round" !== this.wireframeLinejoin && (n.wireframeLinejoin = this.wireframeLinejoin), !0 === this.morphTargets && (n.morphTargets = !0), !0 === this.skinning && (n.skinning = !0), !1 === this.visible && (n.visible = !1), "{}" !== JSON.stringify(this.userData) && (n.userData = this.userData), e) { | |
var r = i(t.textures), | |
a = i(t.images); | |
r.length > 0 && (n.textures = r), a.length > 0 && (n.images = a) | |
} | |
return n | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
this.name = t.name, this.fog = t.fog, this.lights = t.lights, this.blending = t.blending, this.side = t.side, this.flatShading = t.flatShading, this.vertexColors = t.vertexColors, this.opacity = t.opacity, this.transparent = t.transparent, this.blendSrc = t.blendSrc, this.blendDst = t.blendDst, this.blendEquation = t.blendEquation, this.blendSrcAlpha = t.blendSrcAlpha, this.blendDstAlpha = t.blendDstAlpha, this.blendEquationAlpha = t.blendEquationAlpha, this.depthFunc = t.depthFunc, this.depthTest = t.depthTest, this.depthWrite = t.depthWrite, this.colorWrite = t.colorWrite, this.precision = t.precision, this.polygonOffset = t.polygonOffset, this.polygonOffsetFactor = t.polygonOffsetFactor, this.polygonOffsetUnits = t.polygonOffsetUnits, this.dithering = t.dithering, this.alphaTest = t.alphaTest, this.premultipliedAlpha = t.premultipliedAlpha, this.overdraw = t.overdraw, this.visible = t.visible, this.userData = JSON.parse(JSON.stringify(t.userData)), this.clipShadows = t.clipShadows, this.clipIntersection = t.clipIntersection; | |
var e = t.clippingPlanes, | |
n = null; | |
if (null !== e) { | |
var i = e.length; | |
n = new Array(i); | |
for (var r = 0; r !== i; ++r) n[r] = e[r].clone() | |
} | |
return this.clippingPlanes = n, this.shadowSide = t.shadowSide, this | |
}, | |
dispose: function() { | |
this.dispatchEvent({ | |
type: "dispose" | |
}) | |
} | |
}), Qn.prototype = Object.create(Zn.prototype), Qn.prototype.constructor = Qn, Qn.prototype.isMeshBasicMaterial = !0, Qn.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.color.copy(t.color), this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.specularMap = t.specularMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.combine = t.combine, this.reflectivity = t.reflectivity, this.refractionRatio = t.refractionRatio, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this | |
}, Kn.prototype = Object.create(Zn.prototype), Kn.prototype.constructor = Kn, Kn.prototype.isShaderMaterial = !0, Kn.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.fragmentShader = t.fragmentShader, this.vertexShader = t.vertexShader, this.uniforms = en.clone(t.uniforms), this.defines = t.defines, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.lights = t.lights, this.clipping = t.clipping, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this.morphNormals = t.morphNormals, this.extensions = t.extensions, this | |
}, Kn.prototype.toJSON = function(t) { | |
var e = Zn.prototype.toJSON.call(this, t); | |
return e.uniforms = this.uniforms, e.vertexShader = this.vertexShader, e.fragmentShader = this.fragmentShader, e | |
}, Object.assign($n.prototype, { | |
set: function(t, e) { | |
return this.origin.copy(t), this.direction.copy(e), this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.origin.copy(t.origin), this.direction.copy(t.direction), this | |
}, | |
at: function(t, e) { | |
return void 0 === e && (console.warn("THREE.Ray: .at() target is now required"), e = new Ue), e.copy(this.direction).multiplyScalar(t).add(this.origin) | |
}, | |
lookAt: function(t) { | |
return this.direction.copy(t).sub(this.origin).normalize(), this | |
}, | |
recast: function() { | |
var t = new Ue; | |
return function(e) { | |
return this.origin.copy(this.at(e, t)), this | |
} | |
}(), | |
closestPointToPoint: function(t, e) { | |
void 0 === e && (console.warn("THREE.Ray: .closestPointToPoint() target is now required"), e = new Ue), e.subVectors(t, this.origin); | |
var n = e.dot(this.direction); | |
return n < 0 ? e.copy(this.origin) : e.copy(this.direction).multiplyScalar(n).add(this.origin) | |
}, | |
distanceToPoint: function(t) { | |
return Math.sqrt(this.distanceSqToPoint(t)) | |
}, | |
distanceSqToPoint: function() { | |
var t = new Ue; | |
return function(e) { | |
var n = t.subVectors(e, this.origin).dot(this.direction); | |
return n < 0 ? this.origin.distanceToSquared(e) : (t.copy(this.direction).multiplyScalar(n).add(this.origin), t.distanceToSquared(e)) | |
} | |
}(), | |
distanceSqToSegment: (Vn = new Ue, jn = new Ue, Wn = new Ue, function(t, e, n, i) { | |
Vn.copy(t).add(e).multiplyScalar(.5), jn.copy(e).sub(t).normalize(), Wn.copy(this.origin).sub(Vn); | |
var r, a, o, s, c = .5 * t.distanceTo(e), | |
h = -this.direction.dot(jn), | |
l = Wn.dot(this.direction), | |
u = -Wn.dot(jn), | |
p = Wn.lengthSq(), | |
d = Math.abs(1 - h * h); | |
if (d > 0) | |
if (a = h * l - u, s = c * d, (r = h * u - l) >= 0) | |
if (a >= -s) | |
if (a <= s) { | |
var f = 1 / d; | |
o = (r *= f) * (r + h * (a *= f) + 2 * l) + a * (h * r + a + 2 * u) + p | |
} else a = c, o = -(r = Math.max(0, -(h * a + l))) * r + a * (a + 2 * u) + p; | |
else a = -c, o = -(r = Math.max(0, -(h * a + l))) * r + a * (a + 2 * u) + p; | |
else a <= -s ? o = -(r = Math.max(0, -(-h * c + l))) * r + (a = r > 0 ? -c : Math.min(Math.max(-c, -u), c)) * (a + 2 * u) + p : a <= s ? (r = 0, o = (a = Math.min(Math.max(-c, -u), c)) * (a + 2 * u) + p) : o = -(r = Math.max(0, -(h * c + l))) * r + (a = r > 0 ? c : Math.min(Math.max(-c, -u), c)) * (a + 2 * u) + p; | |
else a = h > 0 ? -c : c, o = -(r = Math.max(0, -(h * a + l))) * r + a * (a + 2 * u) + p; | |
return n && n.copy(this.direction).multiplyScalar(r).add(this.origin), i && i.copy(jn).multiplyScalar(a).add(Vn), o | |
}), | |
intersectSphere: function() { | |
var t = new Ue; | |
return function(e, n) { | |
t.subVectors(e.center, this.origin); | |
var i = t.dot(this.direction), | |
r = t.dot(t) - i * i, | |
a = e.radius * e.radius; | |
if (r > a) return null; | |
var o = Math.sqrt(a - r), | |
s = i - o, | |
c = i + o; | |
return s < 0 && c < 0 ? null : s < 0 ? this.at(c, n) : this.at(s, n) | |
} | |
}(), | |
intersectsSphere: function(t) { | |
return this.distanceToPoint(t.center) <= t.radius | |
}, | |
distanceToPlane: function(t) { | |
var e = t.normal.dot(this.direction); | |
if (0 === e) return 0 === t.distanceToPoint(this.origin) ? 0 : null; | |
var n = -(this.origin.dot(t.normal) + t.constant) / e; | |
return n >= 0 ? n : null | |
}, | |
intersectPlane: function(t, e) { | |
var n = this.distanceToPlane(t); | |
return null === n ? null : this.at(n, e) | |
}, | |
intersectsPlane: function(t) { | |
var e = t.distanceToPoint(this.origin); | |
return 0 === e || t.normal.dot(this.direction) * e < 0 | |
}, | |
intersectBox: function(t, e) { | |
var n, i, r, a, o, s, c = 1 / this.direction.x, | |
h = 1 / this.direction.y, | |
l = 1 / this.direction.z, | |
u = this.origin; | |
return c >= 0 ? (n = (t.min.x - u.x) * c, i = (t.max.x - u.x) * c) : (n = (t.max.x - u.x) * c, i = (t.min.x - u.x) * c), h >= 0 ? (r = (t.min.y - u.y) * h, a = (t.max.y - u.y) * h) : (r = (t.max.y - u.y) * h, a = (t.min.y - u.y) * h), n > a || r > i ? null : ((r > n || n != n) && (n = r), (a < i || i != i) && (i = a), l >= 0 ? (o = (t.min.z - u.z) * l, s = (t.max.z - u.z) * l) : (o = (t.max.z - u.z) * l, s = (t.min.z - u.z) * l), n > s || o > i ? null : ((o > n || n != n) && (n = o), (s < i || i != i) && (i = s), i < 0 ? null : this.at(n >= 0 ? n : i, e))) | |
}, | |
intersectsBox: (Hn = new Ue, function(t) { | |
return null !== this.intersectBox(t, Hn) | |
}), | |
intersectTriangle: function() { | |
var t = new Ue, | |
e = new Ue, | |
n = new Ue, | |
i = new Ue; | |
return function(r, a, o, s, c) { | |
e.subVectors(a, r), n.subVectors(o, r), i.crossVectors(e, n); | |
var h, l = this.direction.dot(i); | |
if (l > 0) { | |
if (s) return null; | |
h = 1 | |
} else { | |
if (!(l < 0)) return null; | |
h = -1, l = -l | |
} | |
t.subVectors(this.origin, r); | |
var u = h * this.direction.dot(n.crossVectors(t, n)); | |
if (u < 0) return null; | |
var p = h * this.direction.dot(e.cross(t)); | |
if (p < 0) return null; | |
if (u + p > l) return null; | |
var d = -h * t.dot(i); | |
return d < 0 ? null : this.at(d / l, c) | |
} | |
}(), | |
applyMatrix4: function(t) { | |
return this.origin.applyMatrix4(t), this.direction.transformDirection(t), this | |
}, | |
equals: function(t) { | |
return t.origin.equals(this.origin) && t.direction.equals(this.direction) | |
} | |
}), Object.assign(ti.prototype, { | |
set: function(t, e) { | |
return this.start.copy(t), this.end.copy(e), this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.start.copy(t.start), this.end.copy(t.end), this | |
}, | |
getCenter: function(t) { | |
return void 0 === t && (console.warn("THREE.Line3: .getCenter() target is now required"), t = new Ue), t.addVectors(this.start, this.end).multiplyScalar(.5) | |
}, | |
delta: function(t) { | |
return void 0 === t && (console.warn("THREE.Line3: .delta() target is now required"), t = new Ue), t.subVectors(this.end, this.start) | |
}, | |
distanceSq: function() { | |
return this.start.distanceToSquared(this.end) | |
}, | |
distance: function() { | |
return this.start.distanceTo(this.end) | |
}, | |
at: function(t, e) { | |
return void 0 === e && (console.warn("THREE.Line3: .at() target is now required"), e = new Ue), this.delta(e).multiplyScalar(t).add(this.start) | |
}, | |
closestPointToPointParameter: (Xn = new Ue, qn = new Ue, function(t, e) { | |
Xn.subVectors(t, this.start), qn.subVectors(this.end, this.start); | |
var n = qn.dot(qn), | |
i = qn.dot(Xn) / n; | |
return e && (i = Re.clamp(i, 0, 1)), i | |
}), | |
closestPointToPoint: function(t, e, n) { | |
var i = this.closestPointToPointParameter(t, e); | |
return void 0 === n && (console.warn("THREE.Line3: .closestPointToPoint() target is now required"), n = new Ue), this.delta(n).multiplyScalar(i).add(this.start) | |
}, | |
applyMatrix4: function(t) { | |
return this.start.applyMatrix4(t), this.end.applyMatrix4(t), this | |
}, | |
equals: function(t) { | |
return t.start.equals(this.start) && t.end.equals(this.end) | |
} | |
}), Object.assign(ei, { | |
getNormal: (Yn = new Ue, function(t, e, n, i) { | |
void 0 === i && (console.warn("THREE.Triangle: .getNormal() target is now required"), i = new Ue), i.subVectors(n, e), Yn.subVectors(t, e), i.cross(Yn); | |
var r = i.lengthSq(); | |
return r > 0 ? i.multiplyScalar(1 / Math.sqrt(r)) : i.set(0, 0, 0) | |
}), | |
getBarycoord: function() { | |
var t = new Ue, | |
e = new Ue, | |
n = new Ue; | |
return function(i, r, a, o, s) { | |
t.subVectors(o, r), e.subVectors(a, r), n.subVectors(i, r); | |
var c = t.dot(t), | |
h = t.dot(e), | |
l = t.dot(n), | |
u = e.dot(e), | |
p = e.dot(n), | |
d = c * u - h * h; | |
if (void 0 === s && (console.warn("THREE.Triangle: .getBarycoord() target is now required"), s = new Ue), 0 === d) return s.set(-2, -1, -1); | |
var f = 1 / d, | |
m = (u * l - h * p) * f, | |
g = (c * p - h * l) * f; | |
return s.set(1 - m - g, g, m) | |
} | |
}(), | |
containsPoint: function() { | |
var t = new Ue; | |
return function(e, n, i, r) { | |
return ei.getBarycoord(e, n, i, r, t), t.x >= 0 && t.y >= 0 && t.x + t.y <= 1 | |
} | |
}() | |
}), Object.assign(ei.prototype, { | |
set: function(t, e, n) { | |
return this.a.copy(t), this.b.copy(e), this.c.copy(n), this | |
}, | |
setFromPointsAndIndices: function(t, e, n, i) { | |
return this.a.copy(t[e]), this.b.copy(t[n]), this.c.copy(t[i]), this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.a.copy(t.a), this.b.copy(t.b), this.c.copy(t.c), this | |
}, | |
getArea: function() { | |
var t = new Ue, | |
e = new Ue; | |
return function() { | |
return t.subVectors(this.c, this.b), e.subVectors(this.a, this.b), .5 * t.cross(e).length() | |
} | |
}(), | |
getMidpoint: function(t) { | |
return void 0 === t && (console.warn("THREE.Triangle: .getMidpoint() target is now required"), t = new Ue), t.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3) | |
}, | |
getNormal: function(t) { | |
return ei.getNormal(this.a, this.b, this.c, t) | |
}, | |
getPlane: function(t) { | |
return void 0 === t && (console.warn("THREE.Triangle: .getPlane() target is now required"), t = new Ue), t.setFromCoplanarPoints(this.a, this.b, this.c) | |
}, | |
getBarycoord: function(t, e) { | |
return ei.getBarycoord(t, this.a, this.b, this.c, e) | |
}, | |
containsPoint: function(t) { | |
return ei.containsPoint(t, this.a, this.b, this.c) | |
}, | |
intersectsBox: function(t) { | |
return t.intersectsTriangle(this) | |
}, | |
closestPointToPoint: function() { | |
var t = new Qe, | |
e = [new ti, new ti, new ti], | |
n = new Ue, | |
i = new Ue; | |
return function(r, a) { | |
void 0 === a && (console.warn("THREE.Triangle: .closestPointToPoint() target is now required"), a = new Ue); | |
var o = Infinity; | |
if (t.setFromCoplanarPoints(this.a, this.b, this.c), t.projectPoint(r, n), !0 === this.containsPoint(n)) a.copy(n); | |
else { | |
e[0].set(this.a, this.b), e[1].set(this.b, this.c), e[2].set(this.c, this.a); | |
for (var s = 0; s < e.length; s++) { | |
e[s].closestPointToPoint(n, !0, i); | |
var c = n.distanceToSquared(i); | |
c < o && (o = c, a.copy(i)) | |
} | |
} | |
return a | |
} | |
}(), | |
equals: function(t) { | |
return t.a.equals(this.a) && t.b.equals(this.b) && t.c.equals(this.c) | |
} | |
}), ni.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: ni, | |
isMesh: !0, | |
setDrawMode: function(t) { | |
this.drawMode = t | |
}, | |
copy: function(t) { | |
return gn.prototype.copy.call(this, t), this.drawMode = t.drawMode, void 0 !== t.morphTargetInfluences && (this.morphTargetInfluences = t.morphTargetInfluences.slice()), void 0 !== t.morphTargetDictionary && (this.morphTargetDictionary = Object.assign({}, t.morphTargetDictionary)), this | |
}, | |
updateMorphTargets: function() { | |
var t, e, n, i = this.geometry; | |
if (i.isBufferGeometry) { | |
var r = i.morphAttributes, | |
a = Object.keys(r); | |
if (a.length > 0) { | |
var o = r[a[0]]; | |
if (void 0 !== o) | |
for (this.morphTargetInfluences = [], this.morphTargetDictionary = {}, t = 0, e = o.length; t < e; t++) n = o[t].name || String(t), this.morphTargetInfluences.push(0), this.morphTargetDictionary[n] = t | |
} | |
} else { | |
var s = i.morphTargets; | |
if (void 0 !== s && s.length > 0) | |
for (this.morphTargetInfluences = [], this.morphTargetDictionary = {}, t = 0, e = s.length; t < e; t++) n = s[t].name || String(t), this.morphTargetInfluences.push(0), this.morphTargetDictionary[n] = t | |
} | |
}, | |
raycast: function() { | |
var t = new Oe, | |
e = new $n, | |
n = new Ze, | |
i = new Ue, | |
r = new Ue, | |
a = new Ue, | |
o = new Ue, | |
s = new Ue, | |
c = new Ue, | |
h = new Pe, | |
l = new Pe, | |
u = new Pe, | |
p = new Ue, | |
d = new Ue, | |
f = new Ue; | |
function m(t, e, n, i, r, a, o) { | |
return ei.getBarycoord(t, e, n, i, p), r.multiplyScalar(p.x), a.multiplyScalar(p.y), o.multiplyScalar(p.z), r.add(a).add(o), r.clone() | |
} | |
function g(t, e, n, i, r, a, o, s) { | |
if (null === (e.side === M ? i.intersectTriangle(o, a, r, !0, s) : i.intersectTriangle(r, a, o, e.side !== E, s))) return null; | |
f.copy(s), f.applyMatrix4(t.matrixWorld); | |
var c = n.ray.origin.distanceTo(f); | |
return c < n.near || c > n.far ? null : { | |
distance: c, | |
point: f.clone(), | |
object: t | |
} | |
} | |
function v(t, e, n, o, s, c, p, f) { | |
i.fromBufferAttribute(o, c), r.fromBufferAttribute(o, p), a.fromBufferAttribute(o, f); | |
var v = g(t, t.material, e, n, i, r, a, d); | |
if (v) { | |
s && (h.fromBufferAttribute(s, c), l.fromBufferAttribute(s, p), u.fromBufferAttribute(s, f), v.uv = m(d, i, r, a, h, l, u)); | |
var y = new xn(c, p, f); | |
ei.getNormal(i, r, a, y.normal), v.face = y, v.faceIndex = c | |
} | |
return v | |
} | |
return function(p, f) { | |
var y, x = this.geometry, | |
w = this.material, | |
_ = this.matrixWorld; | |
if (void 0 !== w && (null === x.boundingSphere && x.computeBoundingSphere(), n.copy(x.boundingSphere), n.applyMatrix4(_), !1 !== p.ray.intersectsSphere(n) && (t.getInverse(_), e.copy(p.ray).applyMatrix4(t), null === x.boundingBox || !1 !== e.intersectsBox(x.boundingBox)))) | |
if (x.isBufferGeometry) { | |
var b, A, M, E, S, T = x.index, | |
C = x.attributes.position, | |
I = x.attributes.uv; | |
if (null !== T) | |
for (E = 0, S = T.count; E < S; E += 3) b = T.getX(E), A = T.getX(E + 1), M = T.getX(E + 2), (y = v(this, p, e, C, I, b, A, M)) && (y.faceIndex = Math.floor(E / 3), f.push(y)); | |
else if (void 0 !== C) | |
for (E = 0, S = C.count; E < S; E += 3)(y = v(this, p, e, C, I, b = E, A = E + 1, M = E + 2)) && (y.index = b, f.push(y)) | |
} else if (x.isGeometry) { | |
var L, R, P, O, D = Array.isArray(w), | |
U = x.vertices, | |
N = x.faces, | |
B = x.faceVertexUvs[0]; | |
B.length > 0 && (O = B); | |
for (var z = 0, F = N.length; z < F; z++) { | |
var G = N[z], | |
k = D ? w[G.materialIndex] : w; | |
if (void 0 !== k) { | |
if (L = U[G.a], R = U[G.b], P = U[G.c], !0 === k.morphTargets) { | |
var H = x.morphTargets, | |
V = this.morphTargetInfluences; | |
i.set(0, 0, 0), r.set(0, 0, 0), a.set(0, 0, 0); | |
for (var j = 0, W = H.length; j < W; j++) { | |
var X = V[j]; | |
if (0 !== X) { | |
var q = H[j].vertices; | |
i.addScaledVector(o.subVectors(q[G.a], L), X), r.addScaledVector(s.subVectors(q[G.b], R), X), a.addScaledVector(c.subVectors(q[G.c], P), X) | |
} | |
} | |
i.add(L), r.add(R), a.add(P), L = i, R = r, P = a | |
} | |
if (y = g(this, k, p, e, L, R, P, d)) { | |
if (O && O[z]) { | |
var Y = O[z]; | |
h.copy(Y[0]), l.copy(Y[1]), u.copy(Y[2]), y.uv = m(d, L, R, P, h, l, u) | |
} | |
y.face = G, y.faceIndex = z, f.push(y) | |
} | |
} | |
} | |
} | |
} | |
}(), | |
clone: function() { | |
return new this.constructor(this.geometry, this.material).copy(this) | |
} | |
}), ri.prototype = Object.create(je.prototype), ri.prototype.constructor = ri, ri.prototype.isCubeTexture = !0, Object.defineProperty(ri.prototype, "images", { | |
get: function() { | |
return this.image | |
}, | |
set: function(t) { | |
this.image = t | |
} | |
}); | |
var ai = new je, | |
oi = new ri; | |
function si() { | |
this.seq = [], this.map = {} | |
} | |
var ci = [], | |
hi = [], | |
li = new Float32Array(16), | |
ui = new Float32Array(9); | |
function pi(t, e, n) { | |
var i = t[0]; | |
if (i <= 0 || i > 0) return t; | |
var r = e * n, | |
a = ci[r]; | |
if (void 0 === a && (a = new Float32Array(r), ci[r] = a), 0 !== e) { | |
i.toArray(a, 0); | |
for (var o = 1, s = 0; o !== e; ++o) s += n, t[o].toArray(a, s) | |
} | |
return a | |
} | |
function di(t, e) { | |
var n = hi[e]; | |
void 0 === n && (n = new Int32Array(e), hi[e] = n); | |
for (var i = 0; i !== e; ++i) n[i] = t.allocTextureUnit(); | |
return n | |
} | |
function fi(t, e) { | |
t.uniform1f(this.addr, e) | |
} | |
function mi(t, e) { | |
t.uniform1i(this.addr, e) | |
} | |
function gi(t, e) { | |
void 0 === e.x ? t.uniform2fv(this.addr, e) : t.uniform2f(this.addr, e.x, e.y) | |
} | |
function vi(t, e) { | |
void 0 !== e.x ? t.uniform3f(this.addr, e.x, e.y, e.z) : void 0 !== e.r ? t.uniform3f(this.addr, e.r, e.g, e.b) : t.uniform3fv(this.addr, e) | |
} | |
function yi(t, e) { | |
void 0 === e.x ? t.uniform4fv(this.addr, e) : t.uniform4f(this.addr, e.x, e.y, e.z, e.w) | |
} | |
function xi(t, e) { | |
t.uniformMatrix2fv(this.addr, !1, e.elements || e) | |
} | |
function wi(t, e) { | |
void 0 === e.elements ? t.uniformMatrix3fv(this.addr, !1, e) : (ui.set(e.elements), t.uniformMatrix3fv(this.addr, !1, ui)) | |
} | |
function _i(t, e) { | |
void 0 === e.elements ? t.uniformMatrix4fv(this.addr, !1, e) : (li.set(e.elements), t.uniformMatrix4fv(this.addr, !1, li)) | |
} | |
function bi(t, e, n) { | |
var i = n.allocTextureUnit(); | |
t.uniform1i(this.addr, i), n.setTexture2D(e || ai, i) | |
} | |
function Ai(t, e, n) { | |
var i = n.allocTextureUnit(); | |
t.uniform1i(this.addr, i), n.setTextureCube(e || oi, i) | |
} | |
function Mi(t, e) { | |
t.uniform2iv(this.addr, e) | |
} | |
function Ei(t, e) { | |
t.uniform3iv(this.addr, e) | |
} | |
function Si(t, e) { | |
t.uniform4iv(this.addr, e) | |
} | |
function Ti(t, e) { | |
t.uniform1fv(this.addr, e) | |
} | |
function Ci(t, e) { | |
t.uniform1iv(this.addr, e) | |
} | |
function Ii(t, e) { | |
t.uniform2fv(this.addr, pi(e, this.size, 2)) | |
} | |
function Li(t, e) { | |
t.uniform3fv(this.addr, pi(e, this.size, 3)) | |
} | |
function Ri(t, e) { | |
t.uniform4fv(this.addr, pi(e, this.size, 4)) | |
} | |
function Pi(t, e) { | |
t.uniformMatrix2fv(this.addr, !1, pi(e, this.size, 4)) | |
} | |
function Oi(t, e) { | |
t.uniformMatrix3fv(this.addr, !1, pi(e, this.size, 9)) | |
} | |
function Di(t, e) { | |
t.uniformMatrix4fv(this.addr, !1, pi(e, this.size, 16)) | |
} | |
function Ui(t, e, n) { | |
var i = e.length, | |
r = di(n, i); | |
t.uniform1iv(this.addr, r); | |
for (var a = 0; a !== i; ++a) n.setTexture2D(e[a] || ai, r[a]) | |
} | |
function Ni(t, e, n) { | |
var i = e.length, | |
r = di(n, i); | |
t.uniform1iv(this.addr, r); | |
for (var a = 0; a !== i; ++a) n.setTextureCube(e[a] || oi, r[a]) | |
} | |
function Bi(t, e, n) { | |
this.id = t, this.addr = n, this.setValue = function(t) { | |
switch (t) { | |
case 5126: | |
return fi; | |
case 35664: | |
return gi; | |
case 35665: | |
return vi; | |
case 35666: | |
return yi; | |
case 35674: | |
return xi; | |
case 35675: | |
return wi; | |
case 35676: | |
return _i; | |
case 35678: | |
case 36198: | |
return bi; | |
case 35680: | |
return Ai; | |
case 5124: | |
case 35670: | |
return mi; | |
case 35667: | |
case 35671: | |
return Mi; | |
case 35668: | |
case 35672: | |
return Ei; | |
case 35669: | |
case 35673: | |
return Si | |
} | |
}(e.type) | |
} | |
function zi(t, e, n) { | |
this.id = t, this.addr = n, this.size = e.size, this.setValue = function(t) { | |
switch (t) { | |
case 5126: | |
return Ti; | |
case 35664: | |
return Ii; | |
case 35665: | |
return Li; | |
case 35666: | |
return Ri; | |
case 35674: | |
return Pi; | |
case 35675: | |
return Oi; | |
case 35676: | |
return Di; | |
case 35678: | |
return Ui; | |
case 35680: | |
return Ni; | |
case 5124: | |
case 35670: | |
return Ci; | |
case 35667: | |
case 35671: | |
return Mi; | |
case 35668: | |
case 35672: | |
return Ei; | |
case 35669: | |
case 35673: | |
return Si | |
} | |
}(e.type) | |
} | |
function Fi(t) { | |
this.id = t, si.call(this) | |
} | |
Fi.prototype.setValue = function(t, e) { | |
for (var n = this.seq, i = 0, r = n.length; i !== r; ++i) { | |
var a = n[i]; | |
a.setValue(t, e[a.id]) | |
} | |
}; | |
var Gi = /([\w\d_]+)(\])?(\[|\.)?/g; | |
function ki(t, e) { | |
t.seq.push(e), t.map[e.id] = e | |
} | |
function Hi(t, e, n) { | |
var i = t.name, | |
r = i.length; | |
for (Gi.lastIndex = 0;;) { | |
var a = Gi.exec(i), | |
o = Gi.lastIndex, | |
s = a[1], | |
c = "]" === a[2], | |
h = a[3]; | |
if (c && (s |= 0), void 0 === h || "[" === h && o + 2 === r) { | |
ki(n, void 0 === h ? new Bi(s, t, e) : new zi(s, t, e)); | |
break | |
} | |
var l = n.map[s]; | |
void 0 === l && ki(n, l = new Fi(s)), n = l | |
} | |
} | |
function Vi(t, e, n) { | |
si.call(this), this.renderer = n; | |
for (var i = t.getProgramParameter(e, t.ACTIVE_UNIFORMS), r = 0; r < i; ++r) { | |
var a = t.getActiveUniform(e, r), | |
o = a.name; | |
Hi(a, t.getUniformLocation(e, o), this) | |
} | |
} | |
function ji(t, e, n) { | |
var i = t.createShader(e); | |
return t.shaderSource(i, n), t.compileShader(i), !1 === t.getShaderParameter(i, t.COMPILE_STATUS) && console.error("THREE.WebGLShader: Shader couldn't compile."), "" !== t.getShaderInfoLog(i) && console.warn("THREE.WebGLShader: gl.getShaderInfoLog()", e === t.VERTEX_SHADER ? "vertex" : "fragment", t.getShaderInfoLog(i), function(t) { | |
for (var e = t.split("\n"), n = 0; n < e.length; n++) e[n] = n + 1 + ": " + e[n]; | |
return e.join("\n") | |
}(n)), i | |
} | |
Vi.prototype.setValue = function(t, e, n) { | |
var i = this.map[e]; | |
void 0 !== i && i.setValue(t, n, this.renderer) | |
}, Vi.prototype.setOptional = function(t, e, n) { | |
var i = e[n]; | |
void 0 !== i && this.setValue(t, n, i) | |
}, Vi.upload = function(t, e, n, i) { | |
for (var r = 0, a = e.length; r !== a; ++r) { | |
var o = e[r], | |
s = n[o.id]; | |
!1 !== s.needsUpdate && o.setValue(t, s.value, i) | |
} | |
}, Vi.seqWithValue = function(t, e) { | |
for (var n = [], i = 0, r = t.length; i !== r; ++i) { | |
var a = t[i]; | |
a.id in e && n.push(a) | |
} | |
return n | |
}; | |
var Wi = 0; | |
function Xi(t) { | |
switch (t) { | |
case be: | |
return ["Linear", "( value )"]; | |
case Ae: | |
return ["sRGB", "( value )"]; | |
case Ee: | |
return ["RGBE", "( value )"]; | |
case Se: | |
return ["RGBM", "( value, 7.0 )"]; | |
case Te: | |
return ["RGBM", "( value, 16.0 )"]; | |
case Ce: | |
return ["RGBD", "( value, 256.0 )"]; | |
case Me: | |
return ["Gamma", "( value, float( GAMMA_FACTOR ) )"]; | |
default: | |
throw new Error("unsupported encoding: " + t) | |
} | |
} | |
function qi(t, e) { | |
var n = Xi(e); | |
return "vec4 " + t + "( vec4 value ) { return " + n[0] + "ToLinear" + n[1] + "; }" | |
} | |
function Yi(t) { | |
return "" !== t | |
} | |
function Ji(t, e) { | |
return t.replace(/NUM_DIR_LIGHTS/g, e.numDirLights).replace(/NUM_SPOT_LIGHTS/g, e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, e.numPointLights).replace(/NUM_HEMI_LIGHTS/g, e.numHemiLights) | |
} | |
function Zi(t, e) { | |
return t.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection) | |
} | |
function Qi(t) { | |
return t.replace(/^[ \t]*#include +<([\w\d.]+)>/gm, function(t, e) { | |
var n = tn[e]; | |
if (void 0 === n) throw new Error("Can not resolve #include <" + e + ">"); | |
return Qi(n) | |
}) | |
} | |
function Ki(t) { | |
return t.replace(/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g, function(t, e, n, i) { | |
for (var r = "", a = parseInt(e); a < parseInt(n); a++) r += i.replace(/\[ i \]/g, "[ " + a + " ]"); | |
return r | |
}) | |
} | |
function $i(t, e, n, i, r, a) { | |
var o = t.context, | |
s = i.defines, | |
c = r.vertexShader, | |
h = r.fragmentShader, | |
l = "SHADOWMAP_TYPE_BASIC"; | |
a.shadowMapType === _ ? l = "SHADOWMAP_TYPE_PCF" : a.shadowMapType === b && (l = "SHADOWMAP_TYPE_PCF_SOFT"); | |
var u = "ENVMAP_TYPE_CUBE", | |
p = "ENVMAP_MODE_REFLECTION", | |
d = "ENVMAP_BLENDING_MULTIPLY"; | |
if (a.envMap) { | |
switch (i.envMap.mapping) { | |
case dt: | |
case ft: | |
u = "ENVMAP_TYPE_CUBE"; | |
break; | |
case yt: | |
case xt: | |
u = "ENVMAP_TYPE_CUBE_UV"; | |
break; | |
case mt: | |
case gt: | |
u = "ENVMAP_TYPE_EQUIREC"; | |
break; | |
case vt: | |
u = "ENVMAP_TYPE_SPHERE" | |
} | |
switch (i.envMap.mapping) { | |
case ft: | |
case gt: | |
p = "ENVMAP_MODE_REFRACTION" | |
} | |
switch (i.combine) { | |
case at: | |
d = "ENVMAP_BLENDING_MULTIPLY"; | |
break; | |
case ot: | |
d = "ENVMAP_BLENDING_MIX"; | |
break; | |
case st: | |
d = "ENVMAP_BLENDING_ADD" | |
} | |
} | |
var f, m, g, v, y, x = t.gammaFactor > 0 ? t.gammaFactor : 1, | |
w = function(t, e, n) { | |
return [(t = t || {}).derivatives || e.envMapCubeUV || e.bumpMap || e.normalMap || e.flatShading ? "#extension GL_OES_standard_derivatives : enable" : "", (t.fragDepth || e.logarithmicDepthBuffer) && n.get("EXT_frag_depth") ? "#extension GL_EXT_frag_depth : enable" : "", t.drawBuffers && n.get("WEBGL_draw_buffers") ? "#extension GL_EXT_draw_buffers : require" : "", (t.shaderTextureLOD || e.envMap) && n.get("EXT_shader_texture_lod") ? "#extension GL_EXT_shader_texture_lod : enable" : ""].filter(Yi).join("\n") | |
}(i.extensions, a, e), | |
A = function(t) { | |
var e = []; | |
for (var n in t) { | |
var i = t[n]; | |
!1 !== i && e.push("#define " + n + " " + i) | |
} | |
return e.join("\n") | |
}(s), | |
M = o.createProgram(); | |
i.isRawShaderMaterial ? ((f = [A].filter(Yi).join("\n")).length > 0 && (f += "\n"), (m = [w, A].filter(Yi).join("\n")).length > 0 && (m += "\n")) : (f = ["precision " + a.precision + " float;", "precision " + a.precision + " int;", "#define SHADER_NAME " + r.name, A, a.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", "#define GAMMA_FACTOR " + x, "#define MAX_BONES " + a.maxBones, a.useFog && a.fog ? "#define USE_FOG" : "", a.useFog && a.fogExp ? "#define FOG_EXP2" : "", a.map ? "#define USE_MAP" : "", a.envMap ? "#define USE_ENVMAP" : "", a.envMap ? "#define " + p : "", a.lightMap ? "#define USE_LIGHTMAP" : "", a.aoMap ? "#define USE_AOMAP" : "", a.emissiveMap ? "#define USE_EMISSIVEMAP" : "", a.bumpMap ? "#define USE_BUMPMAP" : "", a.normalMap ? "#define USE_NORMALMAP" : "", a.displacementMap && a.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "", a.specularMap ? "#define USE_SPECULARMAP" : "", a.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", a.metalnessMap ? "#define USE_METALNESSMAP" : "", a.alphaMap ? "#define USE_ALPHAMAP" : "", a.vertexColors ? "#define USE_COLOR" : "", a.flatShading ? "#define FLAT_SHADED" : "", a.skinning ? "#define USE_SKINNING" : "", a.useVertexTexture ? "#define BONE_TEXTURE" : "", a.morphTargets ? "#define USE_MORPHTARGETS" : "", a.morphNormals && !1 === a.flatShading ? "#define USE_MORPHNORMALS" : "", a.doubleSided ? "#define DOUBLE_SIDED" : "", a.flipSided ? "#define FLIP_SIDED" : "", a.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", a.shadowMapEnabled ? "#define " + l : "", a.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", a.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", a.logarithmicDepthBuffer && e.get("EXT_frag_depth") ? "#define USE_LOGDEPTHBUF_EXT" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_COLOR", "\tattribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", "\tattribute vec3 morphTarget0;", "\tattribute vec3 morphTarget1;", "\tattribute vec3 morphTarget2;", "\tattribute vec3 morphTarget3;", "\t#ifdef USE_MORPHNORMALS", "\t\tattribute vec3 morphNormal0;", "\t\tattribute vec3 morphNormal1;", "\t\tattribute vec3 morphNormal2;", "\t\tattribute vec3 morphNormal3;", "\t#else", "\t\tattribute vec3 morphTarget4;", "\t\tattribute vec3 morphTarget5;", "\t\tattribute vec3 morphTarget6;", "\t\tattribute vec3 morphTarget7;", "\t#endif", "#endif", "#ifdef USE_SKINNING", "\tattribute vec4 skinIndex;", "\tattribute vec4 skinWeight;", "#endif", "\n"].filter(Yi).join("\n"), m = [w, "precision " + a.precision + " float;", "precision " + a.precision + " int;", "#define SHADER_NAME " + r.name, A, a.alphaTest ? "#define ALPHATEST " + a.alphaTest : "", "#define GAMMA_FACTOR " + x, a.useFog && a.fog ? "#define USE_FOG" : "", a.useFog && a.fogExp ? "#define FOG_EXP2" : "", a.map ? "#define USE_MAP" : "", a.envMap ? "#define USE_ENVMAP" : "", a.envMap ? "#define " + u : "", a.envMap ? "#define " + p : "", a.envMap ? "#define " + d : "", a.lightMap ? "#define USE_LIGHTMAP" : "", a.aoMap ? "#define USE_AOMAP" : "", a.emissiveMap ? "#define USE_EMISSIVEMAP" : "", a.bumpMap ? "#define USE_BUMPMAP" : "", a.normalMap ? "#define USE_NORMALMAP" : "", a.specularMap ? "#define USE_SPECULARMAP" : "", a.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", a.metalnessMap ? "#define USE_METALNESSMAP" : "", a.alphaMap ? "#define USE_ALPHAMAP" : "", a.vertexColors ? "#define USE_COLOR" : "", a.gradientMap ? "#define USE_GRADIENTMAP" : "", a.flatShading ? "#define FLAT_SHADED" : "", a.doubleSided ? "#define DOUBLE_SIDED" : "", a.flipSided ? "#define FLIP_SIDED" : "", a.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", a.shadowMapEnabled ? "#define " + l : "", a.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", a.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "", a.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", a.logarithmicDepthBuffer && e.get("EXT_frag_depth") ? "#define USE_LOGDEPTHBUF_EXT" : "", a.envMap && e.get("EXT_shader_texture_lod") ? "#define TEXTURE_LOD_EXT" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", a.toneMapping !== ct ? "#define TONE_MAPPING" : "", a.toneMapping !== ct ? tn.tonemapping_pars_fragment : "", a.toneMapping !== ct ? function(t, e) { | |
var n; | |
switch (e) { | |
case ht: | |
n = "Linear"; | |
break; | |
case lt: | |
n = "Reinhard"; | |
break; | |
case ut: | |
n = "Uncharted2"; | |
break; | |
case pt: | |
n = "OptimizedCineon"; | |
break; | |
default: | |
throw new Error("unsupported toneMapping: " + e) | |
} | |
return "vec3 " + t + "( vec3 color ) { return " + n + "ToneMapping( color ); }" | |
}("toneMapping", a.toneMapping) : "", a.dithering ? "#define DITHERING" : "", a.outputEncoding || a.mapEncoding || a.envMapEncoding || a.emissiveMapEncoding ? tn.encodings_pars_fragment : "", a.mapEncoding ? qi("mapTexelToLinear", a.mapEncoding) : "", a.envMapEncoding ? qi("envMapTexelToLinear", a.envMapEncoding) : "", a.emissiveMapEncoding ? qi("emissiveMapTexelToLinear", a.emissiveMapEncoding) : "", a.outputEncoding ? (g = "linearToOutputTexel", v = a.outputEncoding, y = Xi(v), "vec4 " + g + "( vec4 value ) { return LinearTo" + y[0] + y[1] + "; }") : "", a.depthPacking ? "#define DEPTH_PACKING " + i.depthPacking : "", "\n"].filter(Yi).join("\n")), c = Zi(c = Ji(c = Qi(c), a), a), h = Zi(h = Ji(h = Qi(h), a), a); | |
var E = f + (c = Ki(c)), | |
S = m + (h = Ki(h)), | |
T = ji(o, o.VERTEX_SHADER, E), | |
C = ji(o, o.FRAGMENT_SHADER, S); | |
o.attachShader(M, T), o.attachShader(M, C), void 0 !== i.index0AttributeName ? o.bindAttribLocation(M, 0, i.index0AttributeName) : !0 === a.morphTargets && o.bindAttribLocation(M, 0, "position"), o.linkProgram(M); | |
var I, L, R = o.getProgramInfoLog(M).trim(), | |
P = o.getShaderInfoLog(T).trim(), | |
O = o.getShaderInfoLog(C).trim(), | |
D = !0, | |
U = !0; | |
return !1 === o.getProgramParameter(M, o.LINK_STATUS) ? (D = !1, console.error("THREE.WebGLProgram: shader error: ", o.getError(), "gl.VALIDATE_STATUS", o.getProgramParameter(M, o.VALIDATE_STATUS), "gl.getProgramInfoLog", R, P, O)) : "" !== R ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", R) : "" !== P && "" !== O || (U = !1), U && (this.diagnostics = { | |
runnable: D, | |
material: i, | |
programLog: R, | |
vertexShader: { | |
log: P, | |
prefix: f | |
}, | |
fragmentShader: { | |
log: O, | |
prefix: m | |
} | |
}), o.deleteShader(T), o.deleteShader(C), this.getUniforms = function() { | |
return void 0 === I && (I = new Vi(o, M, t)), I | |
}, this.getAttributes = function() { | |
return void 0 === L && (L = function(t, e) { | |
for (var n = {}, i = t.getProgramParameter(e, t.ACTIVE_ATTRIBUTES), r = 0; r < i; r++) { | |
var a = t.getActiveAttrib(e, r).name; | |
n[a] = t.getAttribLocation(e, a) | |
} | |
return n | |
}(o, M)), L | |
}, this.destroy = function() { | |
o.deleteProgram(M), this.program = void 0 | |
}, Object.defineProperties(this, { | |
uniforms: { | |
get: function() { | |
return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."), this.getUniforms() | |
} | |
}, | |
attributes: { | |
get: function() { | |
return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."), this.getAttributes() | |
} | |
} | |
}), this.id = Wi++, this.code = n, this.usedTimes = 1, this.program = M, this.vertexShader = T, this.fragmentShader = C, this | |
} | |
function tr(t, e, n) { | |
var i = [], | |
r = { | |
MeshDepthMaterial: "depth", | |
MeshDistanceMaterial: "distanceRGBA", | |
MeshNormalMaterial: "normal", | |
MeshBasicMaterial: "basic", | |
MeshLambertMaterial: "lambert", | |
MeshPhongMaterial: "phong", | |
MeshToonMaterial: "phong", | |
MeshStandardMaterial: "physical", | |
MeshPhysicalMaterial: "physical", | |
LineBasicMaterial: "basic", | |
LineDashedMaterial: "dashed", | |
PointsMaterial: "points", | |
ShadowMaterial: "shadow" | |
}, | |
a = ["precision", "supportsVertexTextures", "map", "mapEncoding", "envMap", "envMapMode", "envMapEncoding", "lightMap", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "fog", "useFog", "fogExp", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", "maxBones", "useVertexTexture", "morphTargets", "morphNormals", "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha", "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", "shadowMapEnabled", "shadowMapType", "toneMapping", "physicallyCorrectLights", "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering"]; | |
function o(t, e) { | |
var n; | |
return t ? t.isTexture ? n = t.encoding : t.isWebGLRenderTarget && (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), n = t.texture.encoding) : n = be, n === be && e && (n = Me), n | |
} | |
this.getParameters = function(e, i, a, s, c, h, l) { | |
var u = r[e.type], | |
p = l.isSkinnedMesh ? function(t) { | |
var e = t.skeleton.bones; | |
if (n.floatVertexTextures) return 1024; | |
var i = n.maxVertexUniforms, | |
r = Math.floor((i - 20) / 4), | |
a = Math.min(r, e.length); | |
return a < e.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + e.length + " bones. This GPU supports " + a + "."), 0) : a | |
}(l) : 0, | |
d = n.precision; | |
null !== e.precision && (d = n.getMaxPrecision(e.precision)) !== e.precision && console.warn("THREE.WebGLProgram.getParameters:", e.precision, "not supported, using", d, "instead."); | |
var f = t.getRenderTarget(); | |
return { | |
shaderID: u, | |
precision: d, | |
supportsVertexTextures: n.vertexTextures, | |
outputEncoding: o(f ? f.texture : null, t.gammaOutput), | |
map: !!e.map, | |
mapEncoding: o(e.map, t.gammaInput), | |
envMap: !!e.envMap, | |
envMapMode: e.envMap && e.envMap.mapping, | |
envMapEncoding: o(e.envMap, t.gammaInput), | |
envMapCubeUV: !!e.envMap && (e.envMap.mapping === yt || e.envMap.mapping === xt), | |
lightMap: !!e.lightMap, | |
aoMap: !!e.aoMap, | |
emissiveMap: !!e.emissiveMap, | |
emissiveMapEncoding: o(e.emissiveMap, t.gammaInput), | |
bumpMap: !!e.bumpMap, | |
normalMap: !!e.normalMap, | |
displacementMap: !!e.displacementMap, | |
roughnessMap: !!e.roughnessMap, | |
metalnessMap: !!e.metalnessMap, | |
specularMap: !!e.specularMap, | |
alphaMap: !!e.alphaMap, | |
gradientMap: !!e.gradientMap, | |
combine: e.combine, | |
vertexColors: e.vertexColors, | |
fog: !!s, | |
useFog: e.fog, | |
fogExp: s && s.isFogExp2, | |
flatShading: e.flatShading, | |
sizeAttenuation: e.sizeAttenuation, | |
logarithmicDepthBuffer: n.logarithmicDepthBuffer, | |
skinning: e.skinning && p > 0, | |
maxBones: p, | |
useVertexTexture: n.floatVertexTextures, | |
morphTargets: e.morphTargets, | |
morphNormals: e.morphNormals, | |
maxMorphTargets: t.maxMorphTargets, | |
maxMorphNormals: t.maxMorphNormals, | |
numDirLights: i.directional.length, | |
numPointLights: i.point.length, | |
numSpotLights: i.spot.length, | |
numRectAreaLights: i.rectArea.length, | |
numHemiLights: i.hemi.length, | |
numClippingPlanes: c, | |
numClipIntersection: h, | |
dithering: e.dithering, | |
shadowMapEnabled: t.shadowMap.enabled && l.receiveShadow && a.length > 0, | |
shadowMapType: t.shadowMap.type, | |
toneMapping: t.toneMapping, | |
physicallyCorrectLights: t.physicallyCorrectLights, | |
premultipliedAlpha: e.premultipliedAlpha, | |
alphaTest: e.alphaTest, | |
doubleSided: e.side === E, | |
flipSided: e.side === M, | |
depthPacking: void 0 !== e.depthPacking && e.depthPacking | |
} | |
}, this.getProgramCode = function(e, n) { | |
var i = []; | |
if (n.shaderID ? i.push(n.shaderID) : (i.push(e.fragmentShader), i.push(e.vertexShader)), void 0 !== e.defines) | |
for (var r in e.defines) i.push(r), i.push(e.defines[r]); | |
for (var o = 0; o < a.length; o++) i.push(n[a[o]]); | |
return i.push(e.onBeforeCompile.toString()), i.push(t.gammaOutput), i.join() | |
}, this.acquireProgram = function(n, r, a, o) { | |
for (var s, c = 0, h = i.length; c < h; c++) { | |
var l = i[c]; | |
if (l.code === o) { | |
++(s = l).usedTimes; | |
break | |
} | |
} | |
return void 0 === s && (s = new $i(t, e, o, n, r, a), i.push(s)), s | |
}, this.releaseProgram = function(t) { | |
if (0 == --t.usedTimes) { | |
var e = i.indexOf(t); | |
i[e] = i[i.length - 1], i.pop(), t.destroy() | |
} | |
}, this.programs = i | |
} | |
function er(t, e) { | |
return t.renderOrder !== e.renderOrder ? t.renderOrder - e.renderOrder : t.program && e.program && t.program !== e.program ? t.program.id - e.program.id : t.material.id !== e.material.id ? t.material.id - e.material.id : t.z !== e.z ? t.z - e.z : t.id - e.id | |
} | |
function nr(t, e) { | |
return t.renderOrder !== e.renderOrder ? t.renderOrder - e.renderOrder : t.z !== e.z ? e.z - t.z : t.id - e.id | |
} | |
function ir() { | |
var t = {}; | |
return { | |
get: function(e, n) { | |
var i = e.id + "," + n.id, | |
r = t[i]; | |
return void 0 === r && (r = new function() { | |
var t = [], | |
e = 0, | |
n = [], | |
i = []; | |
return { | |
opaque: n, | |
transparent: i, | |
init: function() { | |
e = 0, n.length = 0, i.length = 0 | |
}, | |
push: function(r, a, o, s, c) { | |
var h = t[e]; | |
void 0 === h ? (h = { | |
id: r.id, | |
object: r, | |
geometry: a, | |
material: o, | |
program: o.program, | |
renderOrder: r.renderOrder, | |
z: s, | |
group: c | |
}, t[e] = h) : (h.id = r.id, h.object = r, h.geometry = a, h.material = o, h.program = o.program, h.renderOrder = r.renderOrder, h.z = s, h.group = c), (!0 === o.transparent ? i : n).push(h), e++ | |
}, | |
sort: function() { | |
n.length > 1 && n.sort(er), i.length > 1 && i.sort(nr) | |
} | |
} | |
}, t[i] = r), r | |
}, | |
dispose: function() { | |
t = {} | |
} | |
} | |
} | |
var rr, ar, or, sr, cr, hr, lr, ur, pr = 0; | |
function dr() { | |
var t = new function() { | |
var t = {}; | |
return { | |
get: function(e) { | |
if (void 0 !== t[e.id]) return t[e.id]; | |
var n; | |
switch (e.type) { | |
case "DirectionalLight": | |
n = { | |
direction: new Ue, | |
color: new rn, | |
shadow: !1, | |
shadowBias: 0, | |
shadowRadius: 1, | |
shadowMapSize: new Pe | |
}; | |
break; | |
case "SpotLight": | |
n = { | |
position: new Ue, | |
direction: new Ue, | |
color: new rn, | |
distance: 0, | |
coneCos: 0, | |
penumbraCos: 0, | |
decay: 0, | |
shadow: !1, | |
shadowBias: 0, | |
shadowRadius: 1, | |
shadowMapSize: new Pe | |
}; | |
break; | |
case "PointLight": | |
n = { | |
position: new Ue, | |
color: new rn, | |
distance: 0, | |
decay: 0, | |
shadow: !1, | |
shadowBias: 0, | |
shadowRadius: 1, | |
shadowMapSize: new Pe, | |
shadowCameraNear: 1, | |
shadowCameraFar: 1e3 | |
}; | |
break; | |
case "HemisphereLight": | |
n = { | |
direction: new Ue, | |
skyColor: new rn, | |
groundColor: new rn | |
}; | |
break; | |
case "RectAreaLight": | |
n = { | |
color: new rn, | |
position: new Ue, | |
halfWidth: new Ue, | |
halfHeight: new Ue | |
} | |
} | |
return t[e.id] = n, n | |
} | |
} | |
}, | |
e = { | |
id: pr++, | |
hash: "", | |
ambient: [0, 0, 0], | |
directional: [], | |
directionalShadowMap: [], | |
directionalShadowMatrix: [], | |
spot: [], | |
spotShadowMap: [], | |
spotShadowMatrix: [], | |
rectArea: [], | |
point: [], | |
pointShadowMap: [], | |
pointShadowMatrix: [], | |
hemi: [] | |
}, | |
n = new Ue, | |
i = new Oe, | |
r = new Oe; | |
return { | |
setup: function(a, o, s) { | |
for (var c = 0, h = 0, l = 0, u = 0, p = 0, d = 0, f = 0, m = 0, g = s.matrixWorldInverse, v = 0, y = a.length; v < y; v++) { | |
var x = a[v], | |
w = x.color, | |
_ = x.intensity, | |
b = x.distance, | |
A = x.shadow && x.shadow.map ? x.shadow.map.texture : null; | |
if (x.isAmbientLight) c += w.r * _, h += w.g * _, l += w.b * _; | |
else if (x.isDirectionalLight) { | |
if ((E = t.get(x)).color.copy(x.color).multiplyScalar(x.intensity), E.direction.setFromMatrixPosition(x.matrixWorld), n.setFromMatrixPosition(x.target.matrixWorld), E.direction.sub(n), E.direction.transformDirection(g), E.shadow = x.castShadow, x.castShadow) { | |
var M = x.shadow; | |
E.shadowBias = M.bias, E.shadowRadius = M.radius, E.shadowMapSize = M.mapSize | |
} | |
e.directionalShadowMap[u] = A, e.directionalShadowMatrix[u] = x.shadow.matrix, e.directional[u] = E, u++ | |
} else if (x.isSpotLight)(E = t.get(x)).position.setFromMatrixPosition(x.matrixWorld), E.position.applyMatrix4(g), E.color.copy(w).multiplyScalar(_), E.distance = b, E.direction.setFromMatrixPosition(x.matrixWorld), n.setFromMatrixPosition(x.target.matrixWorld), E.direction.sub(n), E.direction.transformDirection(g), E.coneCos = Math.cos(x.angle), E.penumbraCos = Math.cos(x.angle * (1 - x.penumbra)), E.decay = 0 === x.distance ? 0 : x.decay, E.shadow = x.castShadow, x.castShadow && (M = x.shadow, E.shadowBias = M.bias, E.shadowRadius = M.radius, E.shadowMapSize = M.mapSize), e.spotShadowMap[d] = A, e.spotShadowMatrix[d] = x.shadow.matrix, e.spot[d] = E, d++; | |
else if (x.isRectAreaLight)(E = t.get(x)).color.copy(w).multiplyScalar(_), E.position.setFromMatrixPosition(x.matrixWorld), E.position.applyMatrix4(g), r.identity(), i.copy(x.matrixWorld), i.premultiply(g), r.extractRotation(i), E.halfWidth.set(.5 * x.width, 0, 0), E.halfHeight.set(0, .5 * x.height, 0), E.halfWidth.applyMatrix4(r), E.halfHeight.applyMatrix4(r), e.rectArea[f] = E, f++; | |
else if (x.isPointLight)(E = t.get(x)).position.setFromMatrixPosition(x.matrixWorld), E.position.applyMatrix4(g), E.color.copy(x.color).multiplyScalar(x.intensity), E.distance = x.distance, E.decay = 0 === x.distance ? 0 : x.decay, E.shadow = x.castShadow, x.castShadow && (M = x.shadow, E.shadowBias = M.bias, E.shadowRadius = M.radius, E.shadowMapSize = M.mapSize, E.shadowCameraNear = M.camera.near, E.shadowCameraFar = M.camera.far), e.pointShadowMap[p] = A, e.pointShadowMatrix[p] = x.shadow.matrix, e.point[p] = E, p++; | |
else if (x.isHemisphereLight) { | |
var E; | |
(E = t.get(x)).direction.setFromMatrixPosition(x.matrixWorld), E.direction.transformDirection(g), E.direction.normalize(), E.skyColor.copy(x.color).multiplyScalar(_), E.groundColor.copy(x.groundColor).multiplyScalar(_), e.hemi[m] = E, m++ | |
} | |
} | |
e.ambient[0] = c, e.ambient[1] = h, e.ambient[2] = l, e.directional.length = u, e.spot.length = d, e.rectArea.length = f, e.point.length = p, e.hemi.length = m, e.hash = e.id + "," + u + "," + p + "," + d + "," + f + "," + m + "," + o.length | |
}, | |
state: e | |
} | |
} | |
function fr() { | |
var t = {}; | |
return { | |
get: function(e, n) { | |
var i = e.id + "," + n.id, | |
r = t[i]; | |
return void 0 === r && (r = new function() { | |
var t = new dr, | |
e = [], | |
n = [], | |
i = []; | |
return { | |
init: function() { | |
e.length = 0, n.length = 0, i.length = 0 | |
}, | |
state: { | |
lightsArray: e, | |
shadowsArray: n, | |
spritesArray: i, | |
lights: t | |
}, | |
setupLights: function(i) { | |
t.setup(e, n, i) | |
}, | |
pushLight: function(t) { | |
e.push(t) | |
}, | |
pushShadow: function(t) { | |
n.push(t) | |
}, | |
pushSprite: function(t) { | |
i.push(t) | |
} | |
} | |
}, t[i] = r), r | |
}, | |
dispose: function() { | |
t = {} | |
} | |
} | |
} | |
function mr(t) { | |
Zn.call(this), this.type = "MeshDepthMaterial", this.depthPacking = Ie, this.skinning = !1, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.setValues(t) | |
} | |
function gr(t) { | |
Zn.call(this), this.type = "MeshDistanceMaterial", this.referencePosition = new Ue, this.nearDistance = 1, this.farDistance = 1e3, this.skinning = !1, this.morphTargets = !1, this.map = null, this.alphaMap = null, this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.fog = !1, this.lights = !1, this.setValues(t) | |
} | |
function vr(t, e, n) { | |
for (var i = new Ke, r = new Oe, a = new Pe, o = new Pe(n, n), s = new Ue, c = new Ue, h = 1, l = 2, u = 1 + (h | l), p = new Array(u), d = new Array(u), f = {}, m = { | |
0: M, | |
1: A, | |
2: E | |
}, g = [new Ue(1, 0, 0), new Ue(-1, 0, 0), new Ue(0, 0, 1), new Ue(0, 0, -1), new Ue(0, 1, 0), new Ue(0, -1, 0)], v = [new Ue(0, 1, 0), new Ue(0, 1, 0), new Ue(0, 1, 0), new Ue(0, 1, 0), new Ue(0, 0, 1), new Ue(0, 0, -1)], y = [new We, new We, new We, new We, new We, new We], x = 0; x !== u; ++x) { | |
var w = 0 != (x & h), | |
b = 0 != (x & l), | |
S = new mr({ | |
depthPacking: Le, | |
morphTargets: w, | |
skinning: b | |
}); | |
p[x] = S; | |
var T = new gr({ | |
morphTargets: w, | |
skinning: b | |
}); | |
d[x] = T | |
} | |
var C = this; | |
function I(e, n, i, r, a, o) { | |
var s = e.geometry, | |
c = null, | |
u = p, | |
g = e.customDepthMaterial; | |
if (i && (u = d, g = e.customDistanceMaterial), g) c = g; | |
else { | |
var v = !1; | |
n.morphTargets && (s && s.isBufferGeometry ? v = s.morphAttributes && s.morphAttributes.position && s.morphAttributes.position.length > 0 : s && s.isGeometry && (v = s.morphTargets && s.morphTargets.length > 0)), e.isSkinnedMesh && !1 === n.skinning && console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:", e); | |
var y = e.isSkinnedMesh && n.skinning, | |
x = 0; | |
v && (x |= h), y && (x |= l), c = u[x] | |
} | |
if (t.localClippingEnabled && !0 === n.clipShadows && 0 !== n.clippingPlanes.length) { | |
var w = c.uuid, | |
_ = n.uuid, | |
b = f[w]; | |
void 0 === b && (b = {}, f[w] = b); | |
var A = b[_]; | |
void 0 === A && (A = c.clone(), b[_] = A), c = A | |
} | |
return c.visible = n.visible, c.wireframe = n.wireframe, c.side = null != n.shadowSide ? n.shadowSide : m[n.side], c.clipShadows = n.clipShadows, c.clippingPlanes = n.clippingPlanes, c.clipIntersection = n.clipIntersection, c.wireframeLinewidth = n.wireframeLinewidth, c.linewidth = n.linewidth, i && c.isMeshDistanceMaterial && (c.referencePosition.copy(r), c.nearDistance = a, c.farDistance = o), c | |
} | |
function L(n, r, a, o) { | |
if (!1 !== n.visible) { | |
if (n.layers.test(r.layers) && (n.isMesh || n.isLine || n.isPoints) && n.castShadow && (!n.frustumCulled || i.intersectsObject(n))) { | |
n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse, n.matrixWorld); | |
var s = e.update(n), | |
h = n.material; | |
if (Array.isArray(h)) | |
for (var l = s.groups, u = 0, p = l.length; u < p; u++) { | |
var d = l[u], | |
f = h[d.materialIndex]; | |
if (f && f.visible) { | |
var m = I(n, f, o, c, a.near, a.far); | |
t.renderBufferDirect(a, null, s, m, n, d) | |
} | |
} else if (h.visible) { | |
m = I(n, h, o, c, a.near, a.far); | |
t.renderBufferDirect(a, null, s, m, n, null) | |
} | |
} | |
for (var g = n.children, v = 0, y = g.length; v < y; v++) L(g[v], r, a, o) | |
} | |
} | |
this.enabled = !1, this.autoUpdate = !0, this.needsUpdate = !1, this.type = _, this.render = function(e, n, h) { | |
if (!1 !== C.enabled && (!1 !== C.autoUpdate || !1 !== C.needsUpdate) && 0 !== e.length) { | |
var l, u = t.context, | |
p = t.state; | |
p.disable(u.BLEND), p.buffers.color.setClear(1, 1, 1, 1), p.buffers.depth.setTest(!0), p.setScissorTest(!1); | |
for (var d = 0, f = e.length; d < f; d++) { | |
var m = e[d], | |
x = m.shadow, | |
w = m && m.isPointLight; | |
if (void 0 !== x) { | |
var _ = x.camera; | |
if (a.copy(x.mapSize), a.min(o), w) { | |
var b = a.x, | |
A = a.y; | |
y[0].set(2 * b, A, b, A), y[1].set(0, A, b, A), y[2].set(3 * b, A, b, A), y[3].set(b, A, b, A), y[4].set(3 * b, 0, b, A), y[5].set(b, 0, b, A), a.x *= 4, a.y *= 2 | |
} | |
if (null === x.map) { | |
var M = { | |
minFilter: At, | |
magFilter: At, | |
format: Vt | |
}; | |
x.map = new Xe(a.x, a.y, M), x.map.texture.name = m.name + ".shadowMap", _.updateProjectionMatrix() | |
} | |
x.isSpotLightShadow && x.update(m); | |
var E = x.map, | |
S = x.matrix; | |
c.setFromMatrixPosition(m.matrixWorld), _.position.copy(c), w ? (l = 6, S.makeTranslation(-c.x, -c.y, -c.z)) : (l = 1, s.setFromMatrixPosition(m.target.matrixWorld), _.lookAt(s), _.updateMatrixWorld(), S.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), S.multiply(_.projectionMatrix), S.multiply(_.matrixWorldInverse)), t.setRenderTarget(E), t.clear(); | |
for (var T = 0; T < l; T++) { | |
if (w) { | |
s.copy(_.position), s.add(g[T]), _.up.copy(v[T]), _.lookAt(s), _.updateMatrixWorld(); | |
var I = y[T]; | |
p.viewport(I) | |
} | |
r.multiplyMatrices(_.projectionMatrix, _.matrixWorldInverse), i.setFromMatrix(r), L(n, h, _, w) | |
} | |
} else console.warn("THREE.WebGLShadowMap:", m, "has no shadow.") | |
} | |
C.needsUpdate = !1 | |
} | |
} | |
} | |
function yr(t, e, n, i, r, a, o, s, c) { | |
je.call(this, t, e, n, i, r, a, o, s, c), this.needsUpdate = !0 | |
} | |
function xr(t, e, n, i, r) { | |
var a, o, s, c, h, l, u = new Ue, | |
p = new De, | |
d = new Ue; | |
function f() { | |
var t = new Float32Array([-.5, -.5, 0, 0, .5, -.5, 1, 0, .5, .5, 1, 1, -.5, .5, 0, 1]), | |
n = new Uint16Array([0, 1, 2, 0, 2, 3]); | |
a = e.createBuffer(), o = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, a), e.bufferData(e.ARRAY_BUFFER, t, e.STATIC_DRAW), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, o), e.bufferData(e.ELEMENT_ARRAY_BUFFER, n, e.STATIC_DRAW), s = function() { | |
var t = e.createProgram(), | |
n = e.createShader(e.VERTEX_SHADER), | |
i = e.createShader(e.FRAGMENT_SHADER); | |
return e.shaderSource(n, ["precision " + r.precision + " float;", "#define SHADER_NAME SpriteMaterial", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform float rotation;", "uniform vec2 center;", "uniform vec2 scale;", "uniform vec2 uvOffset;", "uniform vec2 uvScale;", "attribute vec2 position;", "attribute vec2 uv;", "varying vec2 vUV;", "varying float fogDepth;", "void main() {", "\tvUV = uvOffset + uv * uvScale;", "\tvec2 alignedPosition = ( position - center ) * scale;", "\tvec2 rotatedPosition;", "\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;", "\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;", "\tvec4 mvPosition;", "\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );", "\tmvPosition.xy += rotatedPosition;", "\tgl_Position = projectionMatrix * mvPosition;", "\tfogDepth = - mvPosition.z;", "}"].join("\n")), e.shaderSource(i, ["precision " + r.precision + " float;", "#define SHADER_NAME SpriteMaterial", "uniform vec3 color;", "uniform sampler2D map;", "uniform float opacity;", "uniform int fogType;", "uniform vec3 fogColor;", "uniform float fogDensity;", "uniform float fogNear;", "uniform float fogFar;", "uniform float alphaTest;", "varying vec2 vUV;", "varying float fogDepth;", "void main() {", "\tvec4 texture = texture2D( map, vUV );", "\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );", "\tif ( gl_FragColor.a < alphaTest ) discard;", "\tif ( fogType > 0 ) {", "\t\tfloat fogFactor = 0.0;", "\t\tif ( fogType == 1 ) {", "\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );", "\t\t} else {", "\t\t\tconst float LOG2 = 1.442695;", "\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );", "\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );", "\t\t}", "\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );", "\t}", "}"].join("\n")), e.compileShader(n), e.compileShader(i), e.attachShader(t, n), e.attachShader(t, i), e.linkProgram(t), t | |
}(), c = { | |
position: e.getAttribLocation(s, "position"), | |
uv: e.getAttribLocation(s, "uv") | |
}, h = { | |
uvOffset: e.getUniformLocation(s, "uvOffset"), | |
uvScale: e.getUniformLocation(s, "uvScale"), | |
rotation: e.getUniformLocation(s, "rotation"), | |
center: e.getUniformLocation(s, "center"), | |
scale: e.getUniformLocation(s, "scale"), | |
color: e.getUniformLocation(s, "color"), | |
map: e.getUniformLocation(s, "map"), | |
opacity: e.getUniformLocation(s, "opacity"), | |
modelViewMatrix: e.getUniformLocation(s, "modelViewMatrix"), | |
projectionMatrix: e.getUniformLocation(s, "projectionMatrix"), | |
fogType: e.getUniformLocation(s, "fogType"), | |
fogDensity: e.getUniformLocation(s, "fogDensity"), | |
fogNear: e.getUniformLocation(s, "fogNear"), | |
fogFar: e.getUniformLocation(s, "fogFar"), | |
fogColor: e.getUniformLocation(s, "fogColor"), | |
fogDepth: e.getUniformLocation(s, "fogDepth"), | |
alphaTest: e.getUniformLocation(s, "alphaTest") | |
}; | |
var i = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); | |
i.width = 8, i.height = 8; | |
var u = i.getContext("2d"); | |
u.fillStyle = "white", u.fillRect(0, 0, 8, 8), l = new yr(i) | |
} | |
function m(t, e) { | |
return t.renderOrder !== e.renderOrder ? t.renderOrder - e.renderOrder : t.z !== e.z ? e.z - t.z : e.id - t.id | |
} | |
this.render = function(r, g, v) { | |
if (0 !== r.length) { | |
void 0 === s && f(), n.useProgram(s), n.initAttributes(), n.enableAttribute(c.position), n.enableAttribute(c.uv), n.disableUnusedAttributes(), n.disable(e.CULL_FACE), n.enable(e.BLEND), e.bindBuffer(e.ARRAY_BUFFER, a), e.vertexAttribPointer(c.position, 2, e.FLOAT, !1, 16, 0), e.vertexAttribPointer(c.uv, 2, e.FLOAT, !1, 16, 8), e.bindBuffer(e.ELEMENT_ARRAY_BUFFER, o), e.uniformMatrix4fv(h.projectionMatrix, !1, v.projectionMatrix.elements), n.activeTexture(e.TEXTURE0), e.uniform1i(h.map, 0); | |
var y = 0, | |
x = 0, | |
w = g.fog; | |
w ? (e.uniform3f(h.fogColor, w.color.r, w.color.g, w.color.b), w.isFog ? (e.uniform1f(h.fogNear, w.near), e.uniform1f(h.fogFar, w.far), e.uniform1i(h.fogType, 1), y = 1, x = 1) : w.isFogExp2 && (e.uniform1f(h.fogDensity, w.density), e.uniform1i(h.fogType, 2), y = 2, x = 2)) : (e.uniform1i(h.fogType, 0), y = 0, x = 0); | |
for (var _ = 0, b = r.length; _ < b; _++) { | |
(E = r[_]).modelViewMatrix.multiplyMatrices(v.matrixWorldInverse, E.matrixWorld), E.z = -E.modelViewMatrix.elements[14] | |
} | |
r.sort(m); | |
var A = [], | |
M = []; | |
for (_ = 0, b = r.length; _ < b; _++) { | |
var E, S = (E = r[_]).material; | |
if (!1 !== S.visible) { | |
E.onBeforeRender(t, g, v, void 0, S, void 0), e.uniform1f(h.alphaTest, S.alphaTest), e.uniformMatrix4fv(h.modelViewMatrix, !1, E.modelViewMatrix.elements), E.matrixWorld.decompose(u, p, d), A[0] = d.x, A[1] = d.y, M[0] = E.center.x - .5, M[1] = E.center.y - .5; | |
var T = 0; | |
g.fog && S.fog && (T = x), y !== T && (e.uniform1i(h.fogType, T), y = T), null !== S.map ? (e.uniform2f(h.uvOffset, S.map.offset.x, S.map.offset.y), e.uniform2f(h.uvScale, S.map.repeat.x, S.map.repeat.y)) : (e.uniform2f(h.uvOffset, 0, 0), e.uniform2f(h.uvScale, 1, 1)), e.uniform1f(h.opacity, S.opacity), e.uniform3f(h.color, S.color.r, S.color.g, S.color.b), e.uniform1f(h.rotation, S.rotation), e.uniform2fv(h.center, M), e.uniform2fv(h.scale, A), n.setBlending(S.blending, S.blendEquation, S.blendSrc, S.blendDst, S.blendEquationAlpha, S.blendSrcAlpha, S.blendDstAlpha, S.premultipliedAlpha), n.buffers.depth.setTest(S.depthTest), n.buffers.depth.setMask(S.depthWrite), n.buffers.color.setMask(S.colorWrite), i.setTexture2D(S.map || l, 0), e.drawElements(e.TRIANGLES, 6, e.UNSIGNED_SHORT, 0), E.onAfterRender(t, g, v, void 0, S, void 0) | |
} | |
} | |
n.enable(e.CULL_FACE), n.reset() | |
} | |
} | |
} | |
function wr(t, e, n, i, r, a, o) { | |
var s, c = "undefined" != typeof WebGL2RenderingContext && t instanceof WebGL2RenderingContext, | |
h = {}; | |
function l(t, e) { | |
if (t.width > e || t.height > e) { | |
if ("data" in t) return void console.warn("THREE.WebGLRenderer: image in DataTexture is too big (" + t.width + "x" + t.height + ")."); | |
var n = e / Math.max(t.width, t.height), | |
i = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"); | |
return i.width = Math.floor(t.width * n), i.height = Math.floor(t.height * n), i.getContext("2d").drawImage(t, 0, 0, t.width, t.height, 0, 0, i.width, i.height), console.warn("THREE.WebGLRenderer: image is too big (" + t.width + "x" + t.height + "). Resized to " + i.width + "x" + i.height, t), i | |
} | |
return t | |
} | |
function u(t) { | |
return Re.isPowerOfTwo(t.width) && Re.isPowerOfTwo(t.height) | |
} | |
function p(t, e) { | |
return t.generateMipmaps && e && t.minFilter !== At && t.minFilter !== St | |
} | |
function d(e, n, r, a) { | |
t.generateMipmap(e), i.get(n).__maxMipLevel = Math.log2(Math.max(r, a)) | |
} | |
function f(e) { | |
return e === At || e === Mt || e === Et ? t.NEAREST : t.LINEAR | |
} | |
function m(e) { | |
var n = e.target; | |
n.removeEventListener("dispose", m), | |
function(e) { | |
var n = i.get(e); | |
if (e.image && n.__image__webglTextureCube) t.deleteTexture(n.__image__webglTextureCube); | |
else { | |
if (void 0 === n.__webglInit) return; | |
t.deleteTexture(n.__webglTexture) | |
} | |
i.remove(e) | |
}(n), n.isVideoTexture && delete h[n.id], o.memory.textures-- | |
} | |
function g(e) { | |
var n = e.target; | |
n.removeEventListener("dispose", g), | |
function(e) { | |
var n = i.get(e), | |
r = i.get(e.texture); | |
if (!e) return; | |
void 0 !== r.__webglTexture && t.deleteTexture(r.__webglTexture); | |
e.depthTexture && e.depthTexture.dispose(); | |
if (e.isWebGLRenderTargetCube) | |
for (var a = 0; a < 6; a++) t.deleteFramebuffer(n.__webglFramebuffer[a]), n.__webglDepthbuffer && t.deleteRenderbuffer(n.__webglDepthbuffer[a]); | |
else t.deleteFramebuffer(n.__webglFramebuffer), n.__webglDepthbuffer && t.deleteRenderbuffer(n.__webglDepthbuffer); | |
i.remove(e.texture), i.remove(e) | |
}(n), o.memory.textures-- | |
} | |
function v(e, f) { | |
var g = i.get(e); | |
if (e.isVideoTexture && function(t) { | |
var e = t.id, | |
n = o.render.frame; | |
h[e] !== n && (h[e] = n, t.update()) | |
}(e), e.version > 0 && g.__version !== e.version) { | |
var v = e.image; | |
if (void 0 === v) console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined", e); | |
else { | |
if (!1 !== v.complete) return void | |
function(e, i, h) { | |
void 0 === e.__webglInit && (e.__webglInit = !0, i.addEventListener("dispose", m), e.__webglTexture = t.createTexture(), o.memory.textures++); | |
n.activeTexture(t.TEXTURE0 + h), n.bindTexture(t.TEXTURE_2D, e.__webglTexture), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, i.flipY), t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL, i.premultiplyAlpha), t.pixelStorei(t.UNPACK_ALIGNMENT, i.unpackAlignment); | |
var f = l(i.image, r.maxTextureSize); | |
(function(t) { | |
return t.wrapS !== _t || t.wrapT !== _t || t.minFilter !== At && t.minFilter !== St | |
})(i) && !1 === u(f) && (f = function(t) { | |
return t instanceof HTMLImageElement || t instanceof HTMLCanvasElement || t instanceof ImageBitmap ? (void 0 === s && (s = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")), s.width = Re.floorPowerOfTwo(t.width), s.height = Re.floorPowerOfTwo(t.height), s.getContext("2d").drawImage(t, 0, 0, s.width, s.height), console.warn("THREE.WebGLRenderer: image is not power of two (" + t.width + "x" + t.height + "). Resized to " + s.width + "x" + s.height, t), s) : t | |
}(f)); | |
var g = u(f), | |
v = a.convert(i.format), | |
x = a.convert(i.type); | |
y(t.TEXTURE_2D, i, g); | |
var w, _ = i.mipmaps; | |
if (i.isDepthTexture) { | |
var b = t.DEPTH_COMPONENT; | |
if (i.type === Ut) { | |
if (!c) throw new Error("Float Depth Texture only supported in WebGL2.0"); | |
b = t.DEPTH_COMPONENT32F | |
} else c && (b = t.DEPTH_COMPONENT16); | |
i.format === Xt && b === t.DEPTH_COMPONENT && i.type !== Pt && i.type !== Dt && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), i.type = Pt, x = a.convert(i.type)), i.format === qt && (b = t.DEPTH_STENCIL, i.type !== Gt && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), i.type = Gt, x = a.convert(i.type))), n.texImage2D(t.TEXTURE_2D, 0, b, f.width, f.height, 0, v, x, null) | |
} else if (i.isDataTexture) | |
if (_.length > 0 && g) { | |
for (var A = 0, M = _.length; A < M; A++) w = _[A], n.texImage2D(t.TEXTURE_2D, A, v, w.width, w.height, 0, v, x, w.data); | |
i.generateMipmaps = !1, e.__maxMipLevel = _.length - 1 | |
} else n.texImage2D(t.TEXTURE_2D, 0, v, f.width, f.height, 0, v, x, f.data), e.__maxMipLevel = 0; | |
else if (i.isCompressedTexture) { | |
for (var A = 0, M = _.length; A < M; A++) w = _[A], i.format !== Vt && i.format !== Ht ? n.getCompressedTextureFormats().indexOf(v) > -1 ? n.compressedTexImage2D(t.TEXTURE_2D, A, v, w.width, w.height, 0, w.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : n.texImage2D(t.TEXTURE_2D, A, v, w.width, w.height, 0, v, x, w.data); | |
e.__maxMipLevel = _.length - 1 | |
} else if (_.length > 0 && g) { | |
for (var A = 0, M = _.length; A < M; A++) w = _[A], n.texImage2D(t.TEXTURE_2D, A, v, v, x, w); | |
i.generateMipmaps = !1, e.__maxMipLevel = _.length - 1 | |
} else n.texImage2D(t.TEXTURE_2D, 0, v, v, x, f), e.__maxMipLevel = 0; | |
p(i, g) && d(t.TEXTURE_2D, i, f.width, f.height); | |
e.__version = i.version, i.onUpdate && i.onUpdate(i) | |
}(g, e, f); | |
console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete", e) | |
} | |
} | |
n.activeTexture(t.TEXTURE0 + f), n.bindTexture(t.TEXTURE_2D, g.__webglTexture) | |
} | |
function y(n, o, s) { | |
var c; | |
if (s ? (t.texParameteri(n, t.TEXTURE_WRAP_S, a.convert(o.wrapS)), t.texParameteri(n, t.TEXTURE_WRAP_T, a.convert(o.wrapT)), t.texParameteri(n, t.TEXTURE_MAG_FILTER, a.convert(o.magFilter)), t.texParameteri(n, t.TEXTURE_MIN_FILTER, a.convert(o.minFilter))) : (t.texParameteri(n, t.TEXTURE_WRAP_S, t.CLAMP_TO_EDGE), t.texParameteri(n, t.TEXTURE_WRAP_T, t.CLAMP_TO_EDGE), o.wrapS === _t && o.wrapT === _t || console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.", o), t.texParameteri(n, t.TEXTURE_MAG_FILTER, f(o.magFilter)), t.texParameteri(n, t.TEXTURE_MIN_FILTER, f(o.minFilter)), o.minFilter !== At && o.minFilter !== St && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.", o)), c = e.get("EXT_texture_filter_anisotropic")) { | |
if (o.type === Ut && null === e.get("OES_texture_float_linear")) return; | |
if (o.type === Nt && null === e.get("OES_texture_half_float_linear")) return; | |
(o.anisotropy > 1 || i.get(o).__currentAnisotropy) && (t.texParameterf(n, c.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(o.anisotropy, r.getMaxAnisotropy())), i.get(o).__currentAnisotropy = o.anisotropy) | |
} | |
} | |
function x(e, r, o, s) { | |
var c = a.convert(r.texture.format), | |
h = a.convert(r.texture.type); | |
n.texImage2D(s, 0, c, r.width, r.height, 0, c, h, null), t.bindFramebuffer(t.FRAMEBUFFER, e), t.framebufferTexture2D(t.FRAMEBUFFER, o, s, i.get(r.texture).__webglTexture, 0), t.bindFramebuffer(t.FRAMEBUFFER, null) | |
} | |
function w(e, n) { | |
t.bindRenderbuffer(t.RENDERBUFFER, e), n.depthBuffer && !n.stencilBuffer ? (t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_COMPONENT16, n.width, n.height), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.RENDERBUFFER, e)) : n.depthBuffer && n.stencilBuffer ? (t.renderbufferStorage(t.RENDERBUFFER, t.DEPTH_STENCIL, n.width, n.height), t.framebufferRenderbuffer(t.FRAMEBUFFER, t.DEPTH_STENCIL_ATTACHMENT, t.RENDERBUFFER, e)) : t.renderbufferStorage(t.RENDERBUFFER, t.RGBA4, n.width, n.height), t.bindRenderbuffer(t.RENDERBUFFER, null) | |
} | |
function _(e) { | |
var n = i.get(e), | |
r = !0 === e.isWebGLRenderTargetCube; | |
if (e.depthTexture) { | |
if (r) throw new Error("target.depthTexture not supported in Cube render targets"); | |
! function(e, n) { | |
if (n && n.isWebGLRenderTargetCube) throw new Error("Depth Texture with cube render targets is not supported"); | |
if (t.bindFramebuffer(t.FRAMEBUFFER, e), !n.depthTexture || !n.depthTexture.isDepthTexture) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); | |
i.get(n.depthTexture).__webglTexture && n.depthTexture.image.width === n.width && n.depthTexture.image.height === n.height || (n.depthTexture.image.width = n.width, n.depthTexture.image.height = n.height, n.depthTexture.needsUpdate = !0), v(n.depthTexture, 0); | |
var r = i.get(n.depthTexture).__webglTexture; | |
if (n.depthTexture.format === Xt) t.framebufferTexture2D(t.FRAMEBUFFER, t.DEPTH_ATTACHMENT, t.TEXTURE_2D, r, 0); | |
else { | |
if (n.depthTexture.format !== qt) throw new Error("Unknown depthTexture format"); | |
t.framebufferTexture2D(t.FRAMEBUFFER, t.DEPTH_STENCIL_ATTACHMENT, t.TEXTURE_2D, r, 0) | |
} | |
}(n.__webglFramebuffer, e) | |
} else if (r) { | |
n.__webglDepthbuffer = []; | |
for (var a = 0; a < 6; a++) t.bindFramebuffer(t.FRAMEBUFFER, n.__webglFramebuffer[a]), n.__webglDepthbuffer[a] = t.createRenderbuffer(), w(n.__webglDepthbuffer[a], e) | |
} else t.bindFramebuffer(t.FRAMEBUFFER, n.__webglFramebuffer), n.__webglDepthbuffer = t.createRenderbuffer(), w(n.__webglDepthbuffer, e); | |
t.bindFramebuffer(t.FRAMEBUFFER, null) | |
} | |
this.setTexture2D = v, this.setTextureCube = function(e, s) { | |
var c = i.get(e); | |
if (6 === e.image.length) | |
if (e.version > 0 && c.__version !== e.version) { | |
c.__image__webglTextureCube || (e.addEventListener("dispose", m), c.__image__webglTextureCube = t.createTexture(), o.memory.textures++), n.activeTexture(t.TEXTURE0 + s), n.bindTexture(t.TEXTURE_CUBE_MAP, c.__image__webglTextureCube), t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL, e.flipY); | |
for (var h = e && e.isCompressedTexture, f = e.image[0] && e.image[0].isDataTexture, g = [], v = 0; v < 6; v++) g[v] = h || f ? f ? e.image[v].image : e.image[v] : l(e.image[v], r.maxCubemapSize); | |
var x = g[0], | |
w = u(x), | |
_ = a.convert(e.format), | |
b = a.convert(e.type); | |
for (y(t.TEXTURE_CUBE_MAP, e, w), v = 0; v < 6; v++) | |
if (h) | |
for (var A, M = g[v].mipmaps, E = 0, S = M.length; E < S; E++) A = M[E], e.format !== Vt && e.format !== Ht ? n.getCompressedTextureFormats().indexOf(_) > -1 ? n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X + v, E, _, A.width, A.height, 0, A.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X + v, E, _, A.width, A.height, 0, _, b, A.data); | |
else f ? n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X + v, 0, _, g[v].width, g[v].height, 0, _, b, g[v].data) : n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X + v, 0, _, _, b, g[v]); | |
c.__maxMipLevel = h ? M.length - 1 : 0, p(e, w) && d(t.TEXTURE_CUBE_MAP, e, x.width, x.height), c.__version = e.version, e.onUpdate && e.onUpdate(e) | |
} else n.activeTexture(t.TEXTURE0 + s), n.bindTexture(t.TEXTURE_CUBE_MAP, c.__image__webglTextureCube) | |
}, this.setTextureCubeDynamic = function(e, r) { | |
n.activeTexture(t.TEXTURE0 + r), n.bindTexture(t.TEXTURE_CUBE_MAP, i.get(e).__webglTexture) | |
}, this.setupRenderTarget = function(e) { | |
var r = i.get(e), | |
a = i.get(e.texture); | |
e.addEventListener("dispose", g), a.__webglTexture = t.createTexture(), o.memory.textures++; | |
var s = !0 === e.isWebGLRenderTargetCube, | |
c = u(e); | |
if (s) { | |
r.__webglFramebuffer = []; | |
for (var h = 0; h < 6; h++) r.__webglFramebuffer[h] = t.createFramebuffer() | |
} else r.__webglFramebuffer = t.createFramebuffer(); | |
if (s) { | |
for (n.bindTexture(t.TEXTURE_CUBE_MAP, a.__webglTexture), y(t.TEXTURE_CUBE_MAP, e.texture, c), h = 0; h < 6; h++) x(r.__webglFramebuffer[h], e, t.COLOR_ATTACHMENT0, t.TEXTURE_CUBE_MAP_POSITIVE_X + h); | |
p(e.texture, c) && d(t.TEXTURE_CUBE_MAP, e.texture, e.width, e.height), n.bindTexture(t.TEXTURE_CUBE_MAP, null) | |
} else n.bindTexture(t.TEXTURE_2D, a.__webglTexture), y(t.TEXTURE_2D, e.texture, c), x(r.__webglFramebuffer, e, t.COLOR_ATTACHMENT0, t.TEXTURE_2D), p(e.texture, c) && d(t.TEXTURE_2D, e.texture, e.width, e.height), n.bindTexture(t.TEXTURE_2D, null); | |
e.depthBuffer && _(e) | |
}, this.updateRenderTargetMipmap = function(e) { | |
var r = e.texture; | |
if (p(r, u(e))) { | |
var a = e.isWebGLRenderTargetCube ? t.TEXTURE_CUBE_MAP : t.TEXTURE_2D, | |
o = i.get(r).__webglTexture; | |
n.bindTexture(a, o), d(a, r, e.width, e.height), n.bindTexture(a, null) | |
} | |
} | |
} | |
function _r(t, e, n, i) { | |
vn.call(this), this.type = "PerspectiveCamera", this.fov = void 0 !== t ? t : 50, this.zoom = 1, this.near = void 0 !== n ? n : .1, this.far = void 0 !== i ? i : 2e3, this.focus = 10, this.aspect = void 0 !== e ? e : 1, this.view = null, this.filmGauge = 35, this.filmOffset = 0, this.updateProjectionMatrix() | |
} | |
function br(t) { | |
_r.call(this), this.cameras = t || [] | |
} | |
function Ar(t) { | |
var e = this, | |
n = null, | |
i = null, | |
r = null, | |
a = new Oe, | |
o = new Oe; | |
"undefined" != typeof window && "VRFrameData" in window && (i = new window.VRFrameData); | |
var s = new Oe, | |
c = new De, | |
h = new Ue, | |
l = new _r; | |
l.bounds = new We(0, 0, .5, 1), l.layers.enable(1); | |
var u = new _r; | |
u.bounds = new We(.5, 0, .5, 1), u.layers.enable(2); | |
var p, d, f = new br([l, u]); | |
function m() { | |
if (null !== n && n.isPresenting) { | |
var i = n.getEyeParameters("left"), | |
r = i.renderWidth, | |
a = i.renderHeight; | |
d = t.getPixelRatio(), p = t.getSize(), t.setDrawingBufferSize(2 * r, a, 1) | |
} else e.enabled && t.setDrawingBufferSize(p.width, p.height, d) | |
} | |
f.layers.enable(1), f.layers.enable(2), "undefined" != typeof window && window.addEventListener("vrdisplaypresentchange", m, !1), this.enabled = !1, this.userHeight = 1.6, this.getDevice = function() { | |
return n | |
}, this.setDevice = function(t) { | |
void 0 !== t && (n = t) | |
}, this.setPoseTarget = function(t) { | |
void 0 !== t && (r = t) | |
}, this.getCamera = function(t) { | |
if (null === n) return t; | |
n.depthNear = t.near, n.depthFar = t.far, n.getFrameData(i); | |
var p = n.stageParameters; | |
p ? a.fromArray(p.sittingToStandingTransform) : a.makeTranslation(0, e.userHeight, 0); | |
var d = i.pose, | |
m = null !== r ? r : t; | |
if (m.matrix.copy(a), m.matrix.decompose(m.position, m.quaternion, m.scale), null !== d.orientation && (c.fromArray(d.orientation), m.quaternion.multiply(c)), null !== d.position && (c.setFromRotationMatrix(a), h.fromArray(d.position), h.applyQuaternion(c), m.position.add(h)), m.updateMatrixWorld(), !1 === n.isPresenting) return t; | |
l.near = t.near, u.near = t.near, l.far = t.far, u.far = t.far, f.matrixWorld.copy(t.matrixWorld), f.matrixWorldInverse.copy(t.matrixWorldInverse), l.matrixWorldInverse.fromArray(i.leftViewMatrix), u.matrixWorldInverse.fromArray(i.rightViewMatrix), o.getInverse(a), l.matrixWorldInverse.multiply(o), u.matrixWorldInverse.multiply(o); | |
var g = m.parent; | |
null !== g && (s.getInverse(g.matrixWorld), l.matrixWorldInverse.multiply(s), u.matrixWorldInverse.multiply(s)), l.matrixWorld.getInverse(l.matrixWorldInverse), u.matrixWorld.getInverse(u.matrixWorldInverse), l.projectionMatrix.fromArray(i.leftProjectionMatrix), u.projectionMatrix.fromArray(i.rightProjectionMatrix), f.projectionMatrix.copy(l.projectionMatrix); | |
var v = n.getLayers(); | |
if (v.length) { | |
var y = v[0]; | |
null !== y.leftBounds && 4 === y.leftBounds.length && l.bounds.fromArray(y.leftBounds), null !== y.rightBounds && 4 === y.rightBounds.length && u.bounds.fromArray(y.rightBounds) | |
} | |
return f | |
}, this.getStandingMatrix = function() { | |
return a | |
}, this.submitFrame = function() { | |
n && n.isPresenting && n.submitFrame() | |
}, this.dispose = function() { | |
"undefined" != typeof window && window.removeEventListener("vrdisplaypresentchange", m) | |
} | |
} | |
function Mr(t) { | |
var e = void 0 !== (t = t || {}).canvas ? t.canvas : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"), | |
n = void 0 !== t.context ? t.context : null, | |
i = void 0 !== t.alpha && t.alpha, | |
r = void 0 === t.depth || t.depth, | |
a = void 0 === t.stencil || t.stencil, | |
o = void 0 !== t.antialias && t.antialias, | |
s = void 0 === t.premultipliedAlpha || t.premultipliedAlpha, | |
c = void 0 !== t.preserveDrawingBuffer && t.preserveDrawingBuffer, | |
h = void 0 !== t.powerPreference ? t.powerPreference : "default", | |
l = null, | |
u = null; | |
this.domElement = e, this.context = null, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.gammaFactor = 2, this.gammaInput = !1, this.gammaOutput = !1, this.physicallyCorrectLights = !1, this.toneMapping = ht, this.toneMappingExposure = 1, this.toneMappingWhitePoint = 1, this.maxMorphTargets = 8, this.maxMorphNormals = 4; | |
var p, d, f, m, g, v, _, b, A, T, C, at, ot, st, ct, lt, ut, pt, dt, ft = this, | |
mt = !1, | |
gt = null, | |
vt = null, | |
yt = -1, | |
xt = "", | |
ve = null, | |
ye = null, | |
be = new We, | |
Ae = new We, | |
Me = null, | |
Ee = 0, | |
Se = e.width, | |
Te = e.height, | |
Ce = 1, | |
Ie = new We(0, 0, Se, Te), | |
Le = new We(0, 0, Se, Te), | |
Pe = !1, | |
De = new Ke, | |
Be = new function() { | |
var t = this, | |
e = null, | |
n = 0, | |
i = !1, | |
r = !1, | |
a = new Qe, | |
o = new Ne, | |
s = { | |
value: null, | |
needsUpdate: !1 | |
}; | |
function c() { | |
s.value !== e && (s.value = e, s.needsUpdate = n > 0), t.numPlanes = n, t.numIntersection = 0 | |
} | |
function h(e, n, i, r) { | |
var c = null !== e ? e.length : 0, | |
h = null; | |
if (0 !== c) { | |
if (h = s.value, !0 !== r || null === h) { | |
var l = i + 4 * c, | |
u = n.matrixWorldInverse; | |
o.getNormalMatrix(u), (null === h || h.length < l) && (h = new Float32Array(l)); | |
for (var p = 0, d = i; p !== c; ++p, d += 4) a.copy(e[p]).applyMatrix4(u, o), a.normal.toArray(h, d), h[d + 3] = a.constant | |
} | |
s.value = h, s.needsUpdate = !0 | |
} | |
return t.numPlanes = c, h | |
} | |
this.uniform = s, this.numPlanes = 0, this.numIntersection = 0, this.init = function(t, r, a) { | |
var o = 0 !== t.length || r || 0 !== n || i; | |
return i = r, e = h(t, a, 0), n = t.length, o | |
}, this.beginShadows = function() { | |
r = !0, h(null) | |
}, this.endShadows = function() { | |
r = !1, c() | |
}, this.setState = function(t, a, o, l, u, p) { | |
if (!i || null === t || 0 === t.length || r && !o) r ? h(null) : c(); | |
else { | |
var d = r ? 0 : n, | |
f = 4 * d, | |
m = u.clippingState || null; | |
s.value = m, m = h(t, l, f, p); | |
for (var g = 0; g !== f; ++g) m[g] = e[g]; | |
u.clippingState = m, this.numIntersection = a ? this.numPlanes : 0, this.numPlanes += d | |
} | |
} | |
}, | |
ze = !1, | |
Fe = !1, | |
Ge = new Oe, | |
ke = new Ue; | |
function He() { | |
return null === gt ? Ce : 1 | |
} | |
try { | |
var Ve = { | |
alpha: i, | |
depth: r, | |
stencil: a, | |
antialias: o, | |
premultipliedAlpha: s, | |
preserveDrawingBuffer: c, | |
powerPreference: h | |
}; | |
if (e.addEventListener("webglcontextlost", Je, !1), e.addEventListener("webglcontextrestored", Ze, !1), null === (p = n || e.getContext("webgl", Ve) || e.getContext("experimental-webgl", Ve))) throw null !== e.getContext("webgl") ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context."); | |
void 0 === p.getShaderPrecisionFormat && (p.getShaderPrecisionFormat = function() { | |
return { | |
rangeMin: 1, | |
rangeMax: 1, | |
precision: 1 | |
} | |
}) | |
} catch (t) { | |
console.error("THREE.WebGLRenderer: " + t.message) | |
} | |
function je() { | |
(d = new function(t) { | |
var e = {}; | |
return { | |
get: function(n) { | |
if (void 0 !== e[n]) return e[n]; | |
var i; | |
switch (n) { | |
case "WEBGL_depth_texture": | |
i = t.getExtension("WEBGL_depth_texture") || t.getExtension("MOZ_WEBGL_depth_texture") || t.getExtension("WEBKIT_WEBGL_depth_texture"); | |
break; | |
case "EXT_texture_filter_anisotropic": | |
i = t.getExtension("EXT_texture_filter_anisotropic") || t.getExtension("MOZ_EXT_texture_filter_anisotropic") || t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); | |
break; | |
case "WEBGL_compressed_texture_s3tc": | |
i = t.getExtension("WEBGL_compressed_texture_s3tc") || t.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); | |
break; | |
case "WEBGL_compressed_texture_pvrtc": | |
i = t.getExtension("WEBGL_compressed_texture_pvrtc") || t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); | |
break; | |
case "WEBGL_compressed_texture_etc1": | |
i = t.getExtension("WEBGL_compressed_texture_etc1"); | |
break; | |
default: | |
i = t.getExtension(n) | |
} | |
return null === i && console.warn("THREE.WebGLRenderer: " + n + " extension not supported."), e[n] = i, i | |
} | |
} | |
}(p)).get("WEBGL_depth_texture"), d.get("OES_texture_float"), d.get("OES_texture_float_linear"), d.get("OES_texture_half_float"), d.get("OES_texture_half_float_linear"), d.get("OES_standard_derivatives"), d.get("OES_element_index_uint"), d.get("ANGLE_instanced_arrays"), dt = new function(t, e) { | |
return { | |
convert: function(n) { | |
var i; | |
if (n === wt) return t.REPEAT; | |
if (n === _t) return t.CLAMP_TO_EDGE; | |
if (n === bt) return t.MIRRORED_REPEAT; | |
if (n === At) return t.NEAREST; | |
if (n === Mt) return t.NEAREST_MIPMAP_NEAREST; | |
if (n === Et) return t.NEAREST_MIPMAP_LINEAR; | |
if (n === St) return t.LINEAR; | |
if (n === Tt) return t.LINEAR_MIPMAP_NEAREST; | |
if (n === Ct) return t.LINEAR_MIPMAP_LINEAR; | |
if (n === It) return t.UNSIGNED_BYTE; | |
if (n === Bt) return t.UNSIGNED_SHORT_4_4_4_4; | |
if (n === zt) return t.UNSIGNED_SHORT_5_5_5_1; | |
if (n === Ft) return t.UNSIGNED_SHORT_5_6_5; | |
if (n === Lt) return t.BYTE; | |
if (n === Rt) return t.SHORT; | |
if (n === Pt) return t.UNSIGNED_SHORT; | |
if (n === Ot) return t.INT; | |
if (n === Dt) return t.UNSIGNED_INT; | |
if (n === Ut) return t.FLOAT; | |
if (n === Nt && null !== (i = e.get("OES_texture_half_float"))) return i.HALF_FLOAT_OES; | |
if (n === kt) return t.ALPHA; | |
if (n === Ht) return t.RGB; | |
if (n === Vt) return t.RGBA; | |
if (n === jt) return t.LUMINANCE; | |
if (n === Wt) return t.LUMINANCE_ALPHA; | |
if (n === Xt) return t.DEPTH_COMPONENT; | |
if (n === qt) return t.DEPTH_STENCIL; | |
if (n === U) return t.FUNC_ADD; | |
if (n === N) return t.FUNC_SUBTRACT; | |
if (n === B) return t.FUNC_REVERSE_SUBTRACT; | |
if (n === G) return t.ZERO; | |
if (n === k) return t.ONE; | |
if (n === H) return t.SRC_COLOR; | |
if (n === V) return t.ONE_MINUS_SRC_COLOR; | |
if (n === j) return t.SRC_ALPHA; | |
if (n === W) return t.ONE_MINUS_SRC_ALPHA; | |
if (n === X) return t.DST_ALPHA; | |
if (n === q) return t.ONE_MINUS_DST_ALPHA; | |
if (n === Y) return t.DST_COLOR; | |
if (n === J) return t.ONE_MINUS_DST_COLOR; | |
if (n === Z) return t.SRC_ALPHA_SATURATE; | |
if ((n === Yt || n === Jt || n === Zt || n === Qt) && null !== (i = e.get("WEBGL_compressed_texture_s3tc"))) { | |
if (n === Yt) return i.COMPRESSED_RGB_S3TC_DXT1_EXT; | |
if (n === Jt) return i.COMPRESSED_RGBA_S3TC_DXT1_EXT; | |
if (n === Zt) return i.COMPRESSED_RGBA_S3TC_DXT3_EXT; | |
if (n === Qt) return i.COMPRESSED_RGBA_S3TC_DXT5_EXT | |
} | |
if ((n === Kt || n === $t || n === te || n === ee) && null !== (i = e.get("WEBGL_compressed_texture_pvrtc"))) { | |
if (n === Kt) return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; | |
if (n === $t) return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; | |
if (n === te) return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; | |
if (n === ee) return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG | |
} | |
if (n === ne && null !== (i = e.get("WEBGL_compressed_texture_etc1"))) return i.COMPRESSED_RGB_ETC1_WEBGL; | |
if ((n === ie || n === re || n === ae || n === oe || n === se || n === ce || n === he || n === le || n === ue || n === pe || n === de || n === fe || n === me || n === ge) && null !== (i = e.get("WEBGL_compressed_texture_astc"))) return n; | |
if ((n === z || n === F) && null !== (i = e.get("EXT_blend_minmax"))) { | |
if (n === z) return i.MIN_EXT; | |
if (n === F) return i.MAX_EXT | |
} | |
return n === Gt && null !== (i = e.get("WEBGL_depth_texture")) ? i.UNSIGNED_INT_24_8_WEBGL : 0 | |
} | |
} | |
}(p, d), f = new function(t, e, n) { | |
var i; | |
function r(e) { | |
if ("highp" === e) { | |
if (t.getShaderPrecisionFormat(t.VERTEX_SHADER, t.HIGH_FLOAT).precision > 0 && t.getShaderPrecisionFormat(t.FRAGMENT_SHADER, t.HIGH_FLOAT).precision > 0) return "highp"; | |
e = "mediump" | |
} | |
return "mediump" === e && t.getShaderPrecisionFormat(t.VERTEX_SHADER, t.MEDIUM_FLOAT).precision > 0 && t.getShaderPrecisionFormat(t.FRAGMENT_SHADER, t.MEDIUM_FLOAT).precision > 0 ? "mediump" : "lowp" | |
} | |
var a = void 0 !== n.precision ? n.precision : "highp", | |
o = r(a); | |
o !== a && (console.warn("THREE.WebGLRenderer:", a, "not supported, using", o, "instead."), a = o); | |
var s = !0 === n.logarithmicDepthBuffer, | |
c = t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS), | |
h = t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS), | |
l = t.getParameter(t.MAX_TEXTURE_SIZE), | |
u = t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE), | |
p = t.getParameter(t.MAX_VERTEX_ATTRIBS), | |
d = t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS), | |
f = t.getParameter(t.MAX_VARYING_VECTORS), | |
m = t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS), | |
g = h > 0, | |
v = !!e.get("OES_texture_float"); | |
return { | |
getMaxAnisotropy: function() { | |
if (void 0 !== i) return i; | |
var n = e.get("EXT_texture_filter_anisotropic"); | |
return i = null !== n ? t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0 | |
}, | |
getMaxPrecision: r, | |
precision: a, | |
logarithmicDepthBuffer: s, | |
maxTextures: c, | |
maxVertexTextures: h, | |
maxTextureSize: l, | |
maxCubemapSize: u, | |
maxAttributes: p, | |
maxVertexUniforms: d, | |
maxVaryings: f, | |
maxFragmentUniforms: m, | |
vertexTextures: g, | |
floatFragmentTextures: v, | |
floatVertexTextures: g && v | |
} | |
}(p, d, t), (m = new function(t, e, n) { | |
var i = new function() { | |
var e = !1, | |
n = new We, | |
i = null, | |
r = new We(0, 0, 0, 0); | |
return { | |
setMask: function(n) { | |
i === n || e || (t.colorMask(n, n, n, n), i = n) | |
}, | |
setLocked: function(t) { | |
e = t | |
}, | |
setClear: function(e, i, a, o, s) { | |
!0 === s && (e *= o, i *= o, a *= o), n.set(e, i, a, o), !1 === r.equals(n) && (t.clearColor(e, i, a, o), r.copy(n)) | |
}, | |
reset: function() { | |
e = !1, i = null, r.set(-1, 0, 0, 0) | |
} | |
} | |
}, | |
r = new function() { | |
var e = !1, | |
n = null, | |
i = null, | |
r = null; | |
return { | |
setTest: function(e) { | |
e ? q(t.DEPTH_TEST) : Y(t.DEPTH_TEST) | |
}, | |
setMask: function(i) { | |
n === i || e || (t.depthMask(i), n = i) | |
}, | |
setFunc: function(e) { | |
if (i !== e) { | |
if (e) switch (e) { | |
case Q: | |
t.depthFunc(t.NEVER); | |
break; | |
case K: | |
t.depthFunc(t.ALWAYS); | |
break; | |
case $: | |
t.depthFunc(t.LESS); | |
break; | |
case tt: | |
t.depthFunc(t.LEQUAL); | |
break; | |
case et: | |
t.depthFunc(t.EQUAL); | |
break; | |
case nt: | |
t.depthFunc(t.GEQUAL); | |
break; | |
case it: | |
t.depthFunc(t.GREATER); | |
break; | |
case rt: | |
t.depthFunc(t.NOTEQUAL); | |
break; | |
default: | |
t.depthFunc(t.LEQUAL) | |
} else t.depthFunc(t.LEQUAL); | |
i = e | |
} | |
}, | |
setLocked: function(t) { | |
e = t | |
}, | |
setClear: function(e) { | |
r !== e && (t.clearDepth(e), r = e) | |
}, | |
reset: function() { | |
e = !1, n = null, i = null, r = null | |
} | |
} | |
}, | |
a = new function() { | |
var e = !1, | |
n = null, | |
i = null, | |
r = null, | |
a = null, | |
o = null, | |
s = null, | |
c = null, | |
h = null; | |
return { | |
setTest: function(e) { | |
e ? q(t.STENCIL_TEST) : Y(t.STENCIL_TEST) | |
}, | |
setMask: function(i) { | |
n === i || e || (t.stencilMask(i), n = i) | |
}, | |
setFunc: function(e, n, o) { | |
i === e && r === n && a === o || (t.stencilFunc(e, n, o), i = e, r = n, a = o) | |
}, | |
setOp: function(e, n, i) { | |
o === e && s === n && c === i || (t.stencilOp(e, n, i), o = e, s = n, c = i) | |
}, | |
setLocked: function(t) { | |
e = t | |
}, | |
setClear: function(e) { | |
h !== e && (t.clearStencil(e), h = e) | |
}, | |
reset: function() { | |
e = !1, n = null, i = null, r = null, a = null, o = null, s = null, c = null, h = null | |
} | |
} | |
}, | |
o = t.getParameter(t.MAX_VERTEX_ATTRIBS), | |
s = new Uint8Array(o), | |
c = new Uint8Array(o), | |
h = new Uint8Array(o), | |
l = {}, | |
u = null, | |
p = null, | |
d = null, | |
f = null, | |
m = null, | |
g = null, | |
v = null, | |
_ = null, | |
b = null, | |
A = !1, | |
S = null, | |
T = null, | |
C = null, | |
U = null, | |
N = null, | |
B = t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS), | |
z = !1, | |
F = 0, | |
G = t.getParameter(t.VERSION); - 1 !== G.indexOf("WebGL") ? (F = parseFloat(/^WebGL\ ([0-9])/.exec(G)[1]), z = F >= 1) : -1 !== G.indexOf("OpenGL ES") && (F = parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(G)[1]), z = F >= 2); | |
var k = null, | |
H = {}, | |
V = new We, | |
j = new We; | |
function W(e, n, i) { | |
var r = new Uint8Array(4), | |
a = t.createTexture(); | |
t.bindTexture(e, a), t.texParameteri(e, t.TEXTURE_MIN_FILTER, t.NEAREST), t.texParameteri(e, t.TEXTURE_MAG_FILTER, t.NEAREST); | |
for (var o = 0; o < i; o++) t.texImage2D(n + o, 0, t.RGBA, 1, 1, 0, t.RGBA, t.UNSIGNED_BYTE, r); | |
return a | |
} | |
var X = {}; | |
function q(e) { | |
!0 !== l[e] && (t.enable(e), l[e] = !0) | |
} | |
function Y(e) { | |
!1 !== l[e] && (t.disable(e), l[e] = !1) | |
} | |
function J(e, i, r, a, o, s, c, h) { | |
if (e !== I ? q(t.BLEND) : Y(t.BLEND), e !== D) { | |
if (e !== d || h !== A) switch (e) { | |
case R: | |
h ? (t.blendEquationSeparate(t.FUNC_ADD, t.FUNC_ADD), t.blendFuncSeparate(t.ONE, t.ONE, t.ONE, t.ONE)) : (t.blendEquation(t.FUNC_ADD), t.blendFunc(t.SRC_ALPHA, t.ONE)); | |
break; | |
case P: | |
h ? (t.blendEquationSeparate(t.FUNC_ADD, t.FUNC_ADD), t.blendFuncSeparate(t.ZERO, t.ZERO, t.ONE_MINUS_SRC_COLOR, t.ONE_MINUS_SRC_ALPHA)) : (t.blendEquation(t.FUNC_ADD), t.blendFunc(t.ZERO, t.ONE_MINUS_SRC_COLOR)); | |
break; | |
case O: | |
h ? (t.blendEquationSeparate(t.FUNC_ADD, t.FUNC_ADD), t.blendFuncSeparate(t.ZERO, t.SRC_COLOR, t.ZERO, t.SRC_ALPHA)) : (t.blendEquation(t.FUNC_ADD), t.blendFunc(t.ZERO, t.SRC_COLOR)); | |
break; | |
default: | |
h ? (t.blendEquationSeparate(t.FUNC_ADD, t.FUNC_ADD), t.blendFuncSeparate(t.ONE, t.ONE_MINUS_SRC_ALPHA, t.ONE, t.ONE_MINUS_SRC_ALPHA)) : (t.blendEquationSeparate(t.FUNC_ADD, t.FUNC_ADD), t.blendFuncSeparate(t.SRC_ALPHA, t.ONE_MINUS_SRC_ALPHA, t.ONE, t.ONE_MINUS_SRC_ALPHA)) | |
} | |
f = null, m = null, g = null, v = null, _ = null, b = null | |
} else o = o || i, s = s || r, c = c || a, i === f && o === v || (t.blendEquationSeparate(n.convert(i), n.convert(o)), f = i, v = o), r === m && a === g && s === _ && c === b || (t.blendFuncSeparate(n.convert(r), n.convert(a), n.convert(s), n.convert(c)), m = r, g = a, _ = s, b = c); | |
d = e, A = h | |
} | |
function Z(e) { | |
S !== e && (e ? t.frontFace(t.CW) : t.frontFace(t.CCW), S = e) | |
} | |
function at(e) { | |
e !== y ? (q(t.CULL_FACE), e !== T && (e === x ? t.cullFace(t.BACK) : e === w ? t.cullFace(t.FRONT) : t.cullFace(t.FRONT_AND_BACK))) : Y(t.CULL_FACE), T = e | |
} | |
function ot(e, n, i) { | |
e ? (q(t.POLYGON_OFFSET_FILL), U === n && N === i || (t.polygonOffset(n, i), U = n, N = i)) : Y(t.POLYGON_OFFSET_FILL) | |
} | |
function st(e) { | |
void 0 === e && (e = t.TEXTURE0 + B - 1), k !== e && (t.activeTexture(e), k = e) | |
} | |
return X[t.TEXTURE_2D] = W(t.TEXTURE_2D, t.TEXTURE_2D, 1), X[t.TEXTURE_CUBE_MAP] = W(t.TEXTURE_CUBE_MAP, t.TEXTURE_CUBE_MAP_POSITIVE_X, 6), i.setClear(0, 0, 0, 1), r.setClear(1), a.setClear(0), q(t.DEPTH_TEST), r.setFunc(tt), Z(!1), at(x), q(t.CULL_FACE), q(t.BLEND), J(L), { | |
buffers: { | |
color: i, | |
depth: r, | |
stencil: a | |
}, | |
initAttributes: function() { | |
for (var t = 0, e = s.length; t < e; t++) s[t] = 0 | |
}, | |
enableAttribute: function(n) { | |
s[n] = 1, 0 === c[n] && (t.enableVertexAttribArray(n), c[n] = 1), 0 !== h[n] && (e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n, 0), h[n] = 0) | |
}, | |
enableAttributeAndDivisor: function(n, i) { | |
s[n] = 1, 0 === c[n] && (t.enableVertexAttribArray(n), c[n] = 1), h[n] !== i && (e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n, i), h[n] = i) | |
}, | |
disableUnusedAttributes: function() { | |
for (var e = 0, n = c.length; e !== n; ++e) c[e] !== s[e] && (t.disableVertexAttribArray(e), c[e] = 0) | |
}, | |
enable: q, | |
disable: Y, | |
getCompressedTextureFormats: function() { | |
if (null === u && (u = [], e.get("WEBGL_compressed_texture_pvrtc") || e.get("WEBGL_compressed_texture_s3tc") || e.get("WEBGL_compressed_texture_etc1") || e.get("WEBGL_compressed_texture_astc"))) | |
for (var n = t.getParameter(t.COMPRESSED_TEXTURE_FORMATS), i = 0; i < n.length; i++) u.push(n[i]); | |
return u | |
}, | |
useProgram: function(e) { | |
return p !== e && (t.useProgram(e), p = e, !0) | |
}, | |
setBlending: J, | |
setMaterial: function(e, n) { | |
e.side === E ? Y(t.CULL_FACE) : q(t.CULL_FACE); | |
var a = e.side === M; | |
n && (a = !a), Z(a), !0 === e.transparent ? J(e.blending, e.blendEquation, e.blendSrc, e.blendDst, e.blendEquationAlpha, e.blendSrcAlpha, e.blendDstAlpha, e.premultipliedAlpha) : J(I), r.setFunc(e.depthFunc), r.setTest(e.depthTest), r.setMask(e.depthWrite), i.setMask(e.colorWrite), ot(e.polygonOffset, e.polygonOffsetFactor, e.polygonOffsetUnits) | |
}, | |
setFlipSided: Z, | |
setCullFace: at, | |
setLineWidth: function(e) { | |
e !== C && (z && t.lineWidth(e), C = e) | |
}, | |
setPolygonOffset: ot, | |
setScissorTest: function(e) { | |
e ? q(t.SCISSOR_TEST) : Y(t.SCISSOR_TEST) | |
}, | |
activeTexture: st, | |
bindTexture: function(e, n) { | |
null === k && st(); | |
var i = H[k]; | |
void 0 === i && (i = { | |
type: void 0, | |
texture: void 0 | |
}, H[k] = i), i.type === e && i.texture === n || (t.bindTexture(e, n || X[e]), i.type = e, i.texture = n) | |
}, | |
compressedTexImage2D: function() { | |
try { | |
t.compressedTexImage2D.apply(t, arguments) | |
} catch (t) { | |
console.error("THREE.WebGLState:", t) | |
} | |
}, | |
texImage2D: function() { | |
try { | |
t.texImage2D.apply(t, arguments) | |
} catch (t) { | |
console.error("THREE.WebGLState:", t) | |
} | |
}, | |
scissor: function(e) { | |
!1 === V.equals(e) && (t.scissor(e.x, e.y, e.z, e.w), V.copy(e)) | |
}, | |
viewport: function(e) { | |
!1 === j.equals(e) && (t.viewport(e.x, e.y, e.z, e.w), j.copy(e)) | |
}, | |
reset: function() { | |
for (var e = 0; e < c.length; e++) 1 === c[e] && (t.disableVertexAttribArray(e), c[e] = 0); | |
l = {}, u = null, k = null, H = {}, p = null, d = null, S = null, T = null, i.reset(), r.reset(), a.reset() | |
} | |
} | |
}(p, d, dt)).scissor(Ae.copy(Le).multiplyScalar(Ce)), m.viewport(be.copy(Ie).multiplyScalar(Ce)), g = new function(t) { | |
var e = { | |
frame: 0, | |
calls: 0, | |
triangles: 0, | |
points: 0, | |
lines: 0 | |
}; | |
return { | |
memory: { | |
geometries: 0, | |
textures: 0 | |
}, | |
render: e, | |
programs: null, | |
autoReset: !0, | |
reset: function() { | |
e.frame++, e.calls = 0, e.triangles = 0, e.points = 0, e.lines = 0 | |
}, | |
update: function(n, i, r) { | |
switch (r = r || 1, e.calls++, i) { | |
case t.TRIANGLES: | |
e.triangles += r * (n / 3); | |
break; | |
case t.TRIANGLE_STRIP: | |
case t.TRIANGLE_FAN: | |
e.triangles += r * (n - 2); | |
break; | |
case t.LINES: | |
e.lines += r * (n / 2); | |
break; | |
case t.LINE_STRIP: | |
e.lines += r * (n - 1); | |
break; | |
case t.LINE_LOOP: | |
e.lines += r * n; | |
break; | |
case t.POINTS: | |
e.points += r * n; | |
break; | |
default: | |
console.error("THREE.WebGLInfo: Unknown draw mode:", i) | |
} | |
} | |
} | |
}(p), v = new function() { | |
var t = new WeakMap; | |
return { | |
get: function(e) { | |
var n = t.get(e); | |
return void 0 === n && (n = {}, t.set(e, n)), n | |
}, | |
remove: function(e) { | |
t.delete(e) | |
}, | |
update: function(e, n, i) { | |
t.get(e)[n] = i | |
}, | |
dispose: function() { | |
t = new WeakMap | |
} | |
} | |
}, _ = new wr(p, d, m, v, f, dt, g), b = new cn(p), A = new function(t, e, n) { | |
var i = {}, | |
r = {}; | |
function a(t) { | |
var o = t.target, | |
s = i[o.id]; | |
for (var c in null !== s.index && e.remove(s.index), s.attributes) e.remove(s.attributes[c]); | |
o.removeEventListener("dispose", a), delete i[o.id]; | |
var h = r[o.id]; | |
h && (e.remove(h), delete r[o.id]), (h = r[s.id]) && (e.remove(h), delete r[s.id]), n.memory.geometries-- | |
} | |
return { | |
get: function(t, e) { | |
var r = i[e.id]; | |
return r || (e.addEventListener("dispose", a), e.isBufferGeometry ? r = e : e.isGeometry && (void 0 === e._bufferGeometry && (e._bufferGeometry = (new Bn).setFromObject(t)), r = e._bufferGeometry), i[e.id] = r, n.memory.geometries++, r) | |
}, | |
update: function(n) { | |
var i = n.index, | |
r = n.attributes; | |
for (var a in null !== i && e.update(i, t.ELEMENT_ARRAY_BUFFER), r) e.update(r[a], t.ARRAY_BUFFER); | |
var o = n.morphAttributes; | |
for (var a in o) | |
for (var s = o[a], c = 0, h = s.length; c < h; c++) e.update(s[c], t.ARRAY_BUFFER) | |
}, | |
getWireframeAttribute: function(n) { | |
var i = r[n.id]; | |
if (i) return i; | |
var a, o = [], | |
s = n.index, | |
c = n.attributes; | |
if (null !== s) | |
for (var h = 0, l = (a = s.array).length; h < l; h += 3) { | |
var u = a[h + 0], | |
p = a[h + 1], | |
d = a[h + 2]; | |
o.push(u, p, p, d, d, u) | |
} else | |
for (h = 0, l = (a = c.position.array).length / 3 - 1; h < l; h += 3) u = h + 0, p = h + 1, d = h + 2, o.push(u, p, p, d, d, u); | |
return i = new(Un(o) > 65535 ? Rn : In)(o, 1), e.update(i, t.ELEMENT_ARRAY_BUFFER), r[n.id] = i, i | |
} | |
} | |
}(p, b, g), T = new function(t, e) { | |
var n = {}; | |
return { | |
update: function(i) { | |
var r = e.render.frame, | |
a = i.geometry, | |
o = t.get(i, a); | |
return n[o.id] !== r && (a.isGeometry && o.updateFromObject(i), t.update(o), n[o.id] = r), o | |
}, | |
dispose: function() { | |
n = {} | |
} | |
} | |
}(A, g), ct = new function(t) { | |
var e = {}, | |
n = new Float32Array(8); | |
return { | |
update: function(i, r, a, o) { | |
var s = i.morphTargetInfluences, | |
c = s.length, | |
h = e[r.id]; | |
if (void 0 === h) { | |
h = []; | |
for (var l = 0; l < c; l++) h[l] = [l, 0]; | |
e[r.id] = h | |
} | |
var u = a.morphTargets && r.morphAttributes.position, | |
p = a.morphNormals && r.morphAttributes.normal; | |
for (l = 0; l < c; l++) 0 !== (d = h[l])[1] && (u && r.removeAttribute("morphTarget" + l), p && r.removeAttribute("morphNormal" + l)); | |
for (l = 0; l < c; l++)(d = h[l])[0] = l, d[1] = s[l]; | |
for (h.sort(ii), l = 0; l < 8; l++) { | |
var d; | |
if (d = h[l]) { | |
var f = d[0], | |
m = d[1]; | |
if (m) { | |
u && r.addAttribute("morphTarget" + l, u[f]), p && r.addAttribute("morphNormal" + l, p[f]), n[l] = m; | |
continue | |
} | |
} | |
n[l] = 0 | |
} | |
o.getUniforms().setValue(t, "morphTargetInfluences", n) | |
} | |
} | |
}(p), C = new tr(ft, d, f), at = new ir, ot = new fr, st = new function(t, e, n, i) { | |
var r, a, o, s = new rn(0), | |
c = 0; | |
function h(t, n) { | |
e.buffers.color.setClear(t.r, t.g, t.b, n, i) | |
} | |
return { | |
getClearColor: function() { | |
return s | |
}, | |
setClearColor: function(t, e) { | |
s.set(t), h(s, c = void 0 !== e ? e : 1) | |
}, | |
getClearAlpha: function() { | |
return c | |
}, | |
setClearAlpha: function(t) { | |
h(s, c = t) | |
}, | |
render: function(e, i, l, u) { | |
var p = i.background; | |
null === p ? h(s, c) : p && p.isColor && (h(p, 1), u = !0), (t.autoClear || u) && t.clear(t.autoClearColor, t.autoClearDepth, t.autoClearStencil), p && p.isCubeTexture ? (void 0 === o && ((o = new ni(new Fn(1, 1, 1), new Kn({ | |
uniforms: sn.cube.uniforms, | |
vertexShader: sn.cube.vertexShader, | |
fragmentShader: sn.cube.fragmentShader, | |
side: M, | |
depthTest: !0, | |
depthWrite: !1, | |
fog: !1 | |
}))).geometry.removeAttribute("normal"), o.geometry.removeAttribute("uv"), o.onBeforeRender = function(t, e, n) { | |
this.matrixWorld.copyPosition(n.matrixWorld) | |
}, n.update(o.geometry)), o.material.uniforms.tCube.value = p, e.push(o, o.geometry, o.material, 0, null)) : p && p.isTexture && (void 0 === r && (r = new yn(-1, 1, 1, -1, 0, 1), a = new ni(new kn(2, 2), new Qn({ | |
depthTest: !1, | |
depthWrite: !1, | |
fog: !1 | |
})), n.update(a.geometry)), a.material.map = p, t.renderBufferDirect(r, null, a.geometry, a.material, a, null)) | |
} | |
} | |
}(ft, m, A, s), lt = new function(t, e, n) { | |
var i; | |
this.setMode = function(t) { | |
i = t | |
}, this.render = function(e, r) { | |
t.drawArrays(i, e, r), n.update(r, i) | |
}, this.renderInstances = function(t, r, a) { | |
var o = e.get("ANGLE_instanced_arrays"); | |
if (null !== o) { | |
var s = t.attributes.position; | |
s.isInterleavedBufferAttribute ? (a = s.data.count, o.drawArraysInstancedANGLE(i, 0, a, t.maxInstancedCount)) : o.drawArraysInstancedANGLE(i, r, a, t.maxInstancedCount), n.update(a, i, t.maxInstancedCount) | |
} else console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.") | |
} | |
}(p, d, g), ut = new function(t, e, n) { | |
var i, r, a; | |
this.setMode = function(t) { | |
i = t | |
}, this.setIndex = function(t) { | |
r = t.type, a = t.bytesPerElement | |
}, this.render = function(e, o) { | |
t.drawElements(i, o, r, e * a), n.update(o, i) | |
}, this.renderInstances = function(t, o, s) { | |
var c = e.get("ANGLE_instanced_arrays"); | |
null !== c ? (c.drawElementsInstancedANGLE(i, s, r, o * a, t.maxInstancedCount), n.update(s, i, t.maxInstancedCount)) : console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.") | |
} | |
}(p, d, g), pt = new xr(ft, p, m, _, f), g.programs = C.programs, ft.context = p, ft.capabilities = f, ft.extensions = d, ft.properties = v, ft.renderLists = at, ft.state = m, ft.info = g | |
} | |
je(); | |
var Xe = new Ar(ft); | |
this.vr = Xe; | |
var qe = new vr(ft, T, f.maxTextureSize); | |
function Je(t) { | |
t.preventDefault(), mt = !0 | |
} | |
function Ze() { | |
mt = !1, je() | |
} | |
function $e(t) { | |
var e = t.target; | |
e.removeEventListener("dispose", $e), | |
function(t) { | |
tn(t), v.remove(t) | |
}(e) | |
} | |
function tn(t) { | |
var e = v.get(t).program; | |
t.program = void 0, void 0 !== e && C.releaseProgram(e) | |
} | |
this.shadowMap = qe, this.getContext = function() { | |
return p | |
}, this.getContextAttributes = function() { | |
return p.getContextAttributes() | |
}, this.forceContextLoss = function() { | |
var t = d.get("WEBGL_lose_context"); | |
t && t.loseContext() | |
}, this.forceContextRestore = function() { | |
var t = d.get("WEBGL_lose_context"); | |
t && t.restoreContext() | |
}, this.getPixelRatio = function() { | |
return Ce | |
}, this.setPixelRatio = function(t) { | |
void 0 !== t && (Ce = t, this.setSize(Se, Te, !1)) | |
}, this.getSize = function() { | |
return { | |
width: Se, | |
height: Te | |
} | |
}, this.setSize = function(t, n, i) { | |
var r = Xe.getDevice(); | |
r && r.isPresenting ? console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.") : (Se = t, Te = n, e.width = t * Ce, e.height = n * Ce, !1 !== i && (e.style.width = t + "px", e.style.height = n + "px"), this.setViewport(0, 0, t, n)) | |
}, this.getDrawingBufferSize = function() { | |
return { | |
width: Se * Ce, | |
height: Te * Ce | |
} | |
}, this.setDrawingBufferSize = function(t, n, i) { | |
Se = t, Te = n, Ce = i, e.width = t * i, e.height = n * i, this.setViewport(0, 0, t, n) | |
}, this.getCurrentViewport = function() { | |
return be | |
}, this.setViewport = function(t, e, n, i) { | |
Ie.set(t, Te - e - i, n, i), m.viewport(be.copy(Ie).multiplyScalar(Ce)) | |
}, this.setScissor = function(t, e, n, i) { | |
Le.set(t, Te - e - i, n, i), m.scissor(Ae.copy(Le).multiplyScalar(Ce)) | |
}, this.setScissorTest = function(t) { | |
m.setScissorTest(Pe = t) | |
}, this.getClearColor = function() { | |
return st.getClearColor() | |
}, this.setClearColor = function() { | |
st.setClearColor.apply(st, arguments) | |
}, this.getClearAlpha = function() { | |
return st.getClearAlpha() | |
}, this.setClearAlpha = function() { | |
st.setClearAlpha.apply(st, arguments) | |
}, this.clear = function(t, e, n) { | |
var i = 0; | |
(void 0 === t || t) && (i |= p.COLOR_BUFFER_BIT), (void 0 === e || e) && (i |= p.DEPTH_BUFFER_BIT), (void 0 === n || n) && (i |= p.STENCIL_BUFFER_BIT), p.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.clearTarget = function(t, e, n, i) { | |
this.setRenderTarget(t), this.clear(e, n, i) | |
}, this.dispose = function() { | |
e.removeEventListener("webglcontextlost", Je, !1), e.removeEventListener("webglcontextrestored", Ze, !1), at.dispose(), ot.dispose(), v.dispose(), T.dispose(), Xe.dispose(), ln() | |
}, this.renderBufferImmediate = function(t, e, n) { | |
m.initAttributes(); | |
var i = v.get(t); | |
t.hasPositions && !i.position && (i.position = p.createBuffer()), t.hasNormals && !i.normal && (i.normal = p.createBuffer()), t.hasUvs && !i.uv && (i.uv = p.createBuffer()), t.hasColors && !i.color && (i.color = p.createBuffer()); | |
var r = e.getAttributes(); | |
if (t.hasPositions && (p.bindBuffer(p.ARRAY_BUFFER, i.position), p.bufferData(p.ARRAY_BUFFER, t.positionArray, p.DYNAMIC_DRAW), m.enableAttribute(r.position), p.vertexAttribPointer(r.position, 3, p.FLOAT, !1, 0, 0)), t.hasNormals) { | |
if (p.bindBuffer(p.ARRAY_BUFFER, i.normal), !n.isMeshPhongMaterial && !n.isMeshStandardMaterial && !n.isMeshNormalMaterial && !0 === n.flatShading) | |
for (var a = 0, o = 3 * t.count; a < o; a += 9) { | |
var s = t.normalArray, | |
c = (s[a + 0] + s[a + 3] + s[a + 6]) / 3, | |
h = (s[a + 1] + s[a + 4] + s[a + 7]) / 3, | |
l = (s[a + 2] + s[a + 5] + s[a + 8]) / 3; | |
s[a + 0] = c, s[a + 1] = h, s[a + 2] = l, s[a + 3] = c, s[a + 4] = h, s[a + 5] = l, s[a + 6] = c, s[a + 7] = h, s[a + 8] = l | |
} | |
p.bufferData(p.ARRAY_BUFFER, t.normalArray, p.DYNAMIC_DRAW), m.enableAttribute(r.normal), p.vertexAttribPointer(r.normal, 3, p.FLOAT, !1, 0, 0) | |
} | |
t.hasUvs && n.map && (p.bindBuffer(p.ARRAY_BUFFER, i.uv), p.bufferData(p.ARRAY_BUFFER, t.uvArray, p.DYNAMIC_DRAW), m.enableAttribute(r.uv), p.vertexAttribPointer(r.uv, 2, p.FLOAT, !1, 0, 0)), t.hasColors && n.vertexColors !== S && (p.bindBuffer(p.ARRAY_BUFFER, i.color), p.bufferData(p.ARRAY_BUFFER, t.colorArray, p.DYNAMIC_DRAW), m.enableAttribute(r.color), p.vertexAttribPointer(r.color, 3, p.FLOAT, !1, 0, 0)), m.disableUnusedAttributes(), p.drawArrays(p.TRIANGLES, 0, t.count), t.count = 0 | |
}, this.renderBufferDirect = function(t, e, n, i, r, a) { | |
var o = r.isMesh && r.matrixWorld.determinant() < 0; | |
m.setMaterial(i, o); | |
var s = gn(t, e, i, r), | |
c = n.id + "_" + s.id + "_" + (!0 === i.wireframe), | |
h = !1; | |
c !== xt && (xt = c, h = !0), r.morphTargetInfluences && (ct.update(r, n, i, s), h = !0); | |
var l, u = n.index, | |
f = n.attributes.position, | |
g = 1; | |
!0 === i.wireframe && (u = A.getWireframeAttribute(n), g = 2); | |
var v = lt; | |
null !== u && (l = b.get(u), (v = ut).setIndex(l)), h && (! function(t, e, n, i) { | |
if (n && n.isInstancedBufferGeometry && null === d.get("ANGLE_instanced_arrays")) return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); | |
void 0 === i && (i = 0); | |
m.initAttributes(); | |
var r = n.attributes, | |
a = e.getAttributes(), | |
o = t.defaultAttributeValues; | |
for (var s in a) { | |
var c = a[s]; | |
if (c >= 0) { | |
var h = r[s]; | |
if (void 0 !== h) { | |
var l = h.normalized, | |
u = h.itemSize, | |
f = b.get(h); | |
if (void 0 === f) continue; | |
var g = f.buffer, | |
v = f.type, | |
y = f.bytesPerElement; | |
if (h.isInterleavedBufferAttribute) { | |
var x = h.data, | |
w = x.stride, | |
_ = h.offset; | |
x && x.isInstancedInterleavedBuffer ? (m.enableAttributeAndDivisor(c, x.meshPerAttribute), void 0 === n.maxInstancedCount && (n.maxInstancedCount = x.meshPerAttribute * x.count)) : m.enableAttribute(c), p.bindBuffer(p.ARRAY_BUFFER, g), p.vertexAttribPointer(c, u, v, l, w * y, (i * w + _) * y) | |
} else h.isInstancedBufferAttribute ? (m.enableAttributeAndDivisor(c, h.meshPerAttribute), void 0 === n.maxInstancedCount && (n.maxInstancedCount = h.meshPerAttribute * h.count)) : m.enableAttribute(c), p.bindBuffer(p.ARRAY_BUFFER, g), p.vertexAttribPointer(c, u, v, l, 0, i * u * y) | |
} else if (void 0 !== o) { | |
var A = o[s]; | |
if (void 0 !== A) switch (A.length) { | |
case 2: | |
p.vertexAttrib2fv(c, A); | |
break; | |
case 3: | |
p.vertexAttrib3fv(c, A); | |
break; | |
case 4: | |
p.vertexAttrib4fv(c, A); | |
break; | |
default: | |
p.vertexAttrib1fv(c, A) | |
} | |
} | |
} | |
} | |
m.disableUnusedAttributes() | |
}(i, s, n), null !== u && p.bindBuffer(p.ELEMENT_ARRAY_BUFFER, l.buffer)); | |
var y = Infinity; | |
null !== u ? y = u.count : void 0 !== f && (y = f.count); | |
var x = n.drawRange.start * g, | |
w = n.drawRange.count * g, | |
_ = null !== a ? a.start * g : 0, | |
M = null !== a ? a.count * g : Infinity, | |
E = Math.max(x, _), | |
S = Math.min(y, x + w, _ + M) - 1, | |
T = Math.max(0, S - E + 1); | |
if (0 !== T) { | |
if (r.isMesh) | |
if (!0 === i.wireframe) m.setLineWidth(i.wireframeLinewidth * He()), v.setMode(p.LINES); | |
else switch (r.drawMode) { | |
case xe: | |
v.setMode(p.TRIANGLES); | |
break; | |
case we: | |
v.setMode(p.TRIANGLE_STRIP); | |
break; | |
case _e: | |
v.setMode(p.TRIANGLE_FAN) | |
} else if (r.isLine) { | |
var C = i.linewidth; | |
void 0 === C && (C = 1), m.setLineWidth(C * He()), r.isLineSegments ? v.setMode(p.LINES) : r.isLineLoop ? v.setMode(p.LINE_LOOP) : v.setMode(p.LINE_STRIP) | |
} else r.isPoints && v.setMode(p.POINTS); | |
n && n.isInstancedBufferGeometry ? n.maxInstancedCount > 0 && v.renderInstances(n, E, T) : v.render(E, T) | |
} | |
}, this.compile = function(t, e) { | |
(u = ot.get(t, e)).init(), t.traverse(function(t) { | |
t.isLight && (u.pushLight(t), t.castShadow && u.pushShadow(t)) | |
}), u.setupLights(e), t.traverse(function(e) { | |
if (e.material) | |
if (Array.isArray(e.material)) | |
for (var n = 0; n < e.material.length; n++) mn(e.material[n], t.fog, e); | |
else mn(e.material, t.fog, e) | |
}) | |
}; | |
var nn, an = !1, | |
hn = null; | |
function ln() { | |
an = !1 | |
} | |
function un() { | |
var t = Xe.getDevice(); | |
t && t.isPresenting ? t.requestAnimationFrame(pn) : window.requestAnimationFrame(pn) | |
} | |
function pn(t) { | |
!1 !== an && (hn(t), un()) | |
} | |
function dn(t, e, n, i) { | |
for (var r = 0, a = t.length; r < a; r++) { | |
var o = t[r], | |
s = o.object, | |
c = o.geometry, | |
h = void 0 === i ? o.material : i, | |
l = o.group; | |
if (n.isArrayCamera) { | |
ye = n; | |
for (var u = n.cameras, p = 0, d = u.length; p < d; p++) { | |
var f = u[p]; | |
if (s.layers.test(f.layers)) { | |
var g = f.bounds, | |
v = g.x * Se, | |
y = g.y * Te, | |
x = g.z * Se, | |
w = g.w * Te; | |
m.viewport(be.set(v, y, x, w).multiplyScalar(Ce)), fn(s, e, f, c, h, l) | |
} | |
} | |
} else ye = null, fn(s, e, n, c, h, l) | |
} | |
} | |
function fn(t, e, n, i, r, a) { | |
if (t.onBeforeRender(ft, e, n, i, r, a), u = ot.get(e, ye || n), t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, t.matrixWorld), t.normalMatrix.getNormalMatrix(t.modelViewMatrix), t.isImmediateRenderObject) { | |
var o = t.isMesh && t.matrixWorld.determinant() < 0; | |
m.setMaterial(r, o); | |
var s = gn(n, e.fog, r, t); | |
xt = "", | |
function(t, e, n) { | |
t.render(function(t) { | |
ft.renderBufferImmediate(t, e, n) | |
}) | |
}(t, s, r) | |
} else ft.renderBufferDirect(n, e.fog, i, r, t, a); | |
t.onAfterRender(ft, e, n, i, r, a), u = ot.get(e, ye || n) | |
} | |
function mn(t, e, n) { | |
var i = v.get(t), | |
r = u.state.lights, | |
a = u.state.shadowsArray, | |
o = C.getParameters(t, r.state, a, e, Be.numPlanes, Be.numIntersection, n), | |
s = C.getProgramCode(t, o), | |
c = i.program, | |
h = !0; | |
if (void 0 === c) t.addEventListener("dispose", $e); | |
else if (c.code !== s) tn(t); | |
else if (i.lightsHash !== r.state.hash) v.update(t, "lightsHash", r.state.hash), h = !1; | |
else { | |
if (void 0 !== o.shaderID) return; | |
h = !1 | |
} | |
if (h) { | |
if (o.shaderID) { | |
var l = sn[o.shaderID]; | |
i.shader = { | |
name: t.type, | |
uniforms: en.clone(l.uniforms), | |
vertexShader: l.vertexShader, | |
fragmentShader: l.fragmentShader | |
} | |
} else i.shader = { | |
name: t.type, | |
uniforms: t.uniforms, | |
vertexShader: t.vertexShader, | |
fragmentShader: t.fragmentShader | |
}; | |
t.onBeforeCompile(i.shader, ft), c = C.acquireProgram(t, i.shader, o, s), i.program = c, t.program = c | |
} | |
var p = c.getAttributes(); | |
if (t.morphTargets) { | |
t.numSupportedMorphTargets = 0; | |
for (var d = 0; d < ft.maxMorphTargets; d++) p["morphTarget" + d] >= 0 && t.numSupportedMorphTargets++ | |
} | |
if (t.morphNormals) { | |
t.numSupportedMorphNormals = 0; | |
for (d = 0; d < ft.maxMorphNormals; d++) p["morphNormal" + d] >= 0 && t.numSupportedMorphNormals++ | |
} | |
var f = i.shader.uniforms; | |
(t.isShaderMaterial || t.isRawShaderMaterial) && !0 !== t.clipping || (i.numClippingPlanes = Be.numPlanes, i.numIntersection = Be.numIntersection, f.clippingPlanes = Be.uniform), i.fog = e, i.lightsHash = r.state.hash, t.lights && (f.ambientLightColor.value = r.state.ambient, f.directionalLights.value = r.state.directional, f.spotLights.value = r.state.spot, f.rectAreaLights.value = r.state.rectArea, f.pointLights.value = r.state.point, f.hemisphereLights.value = r.state.hemi, f.directionalShadowMap.value = r.state.directionalShadowMap, f.directionalShadowMatrix.value = r.state.directionalShadowMatrix, f.spotShadowMap.value = r.state.spotShadowMap, f.spotShadowMatrix.value = r.state.spotShadowMatrix, f.pointShadowMap.value = r.state.pointShadowMap, f.pointShadowMatrix.value = r.state.pointShadowMatrix); | |
var m = i.program.getUniforms(), | |
g = Vi.seqWithValue(m.seq, f); | |
i.uniformsList = g | |
} | |
function gn(t, e, n, i) { | |
Ee = 0; | |
var r = v.get(n), | |
a = u.state.lights; | |
if (ze && (Fe || t !== ve)) { | |
var o = t === ve && n.id === yt; | |
Be.setState(n.clippingPlanes, n.clipIntersection, n.clipShadows, t, r, o) | |
}!1 === n.needsUpdate && (void 0 === r.program ? n.needsUpdate = !0 : n.fog && r.fog !== e ? n.needsUpdate = !0 : n.lights && r.lightsHash !== a.state.hash ? n.needsUpdate = !0 : void 0 === r.numClippingPlanes || r.numClippingPlanes === Be.numPlanes && r.numIntersection === Be.numIntersection || (n.needsUpdate = !0)), n.needsUpdate && (mn(n, e, i), n.needsUpdate = !1); | |
var s, c, h = !1, | |
l = !1, | |
d = !1, | |
g = r.program, | |
y = g.getUniforms(), | |
x = r.shader.uniforms; | |
if (m.useProgram(g.program) && (h = !0, l = !0, d = !0), n.id !== yt && (yt = n.id, l = !0), h || t !== ve) { | |
if (y.setValue(p, "projectionMatrix", t.projectionMatrix), f.logarithmicDepthBuffer && y.setValue(p, "logDepthBufFC", 2 / (Math.log(t.far + 1) / Math.LN2)), ve !== (ye || t) && (ve = ye || t, l = !0, d = !0), n.isShaderMaterial || n.isMeshPhongMaterial || n.isMeshStandardMaterial || n.envMap) { | |
var w = y.map.cameraPosition; | |
void 0 !== w && w.setValue(p, ke.setFromMatrixPosition(t.matrixWorld)) | |
}(n.isMeshPhongMaterial || n.isMeshLambertMaterial || n.isMeshBasicMaterial || n.isMeshStandardMaterial || n.isShaderMaterial || n.skinning) && y.setValue(p, "viewMatrix", t.matrixWorldInverse) | |
} | |
if (n.skinning) { | |
y.setOptional(p, i, "bindMatrix"), y.setOptional(p, i, "bindMatrixInverse"); | |
var _ = i.skeleton; | |
if (_) { | |
var b = _.bones; | |
if (f.floatVertexTextures) { | |
if (void 0 === _.boneTexture) { | |
var A = Math.sqrt(4 * b.length); | |
A = Re.ceilPowerOfTwo(A), A = Math.max(A, 4); | |
var M = new Float32Array(A * A * 4); | |
M.set(_.boneMatrices); | |
var E = new Ye(M, A, A, Vt, Ut); | |
E.needsUpdate = !0, _.boneMatrices = M, _.boneTexture = E, _.boneTextureSize = A | |
} | |
y.setValue(p, "boneTexture", _.boneTexture), y.setValue(p, "boneTextureSize", _.boneTextureSize) | |
} else y.setOptional(p, _, "boneMatrices") | |
} | |
} | |
return l && (y.setValue(p, "toneMappingExposure", ft.toneMappingExposure), y.setValue(p, "toneMappingWhitePoint", ft.toneMappingWhitePoint), n.lights && (c = d, (s = x).ambientLightColor.needsUpdate = c, s.directionalLights.needsUpdate = c, s.pointLights.needsUpdate = c, s.spotLights.needsUpdate = c, s.rectAreaLights.needsUpdate = c, s.hemisphereLights.needsUpdate = c), e && n.fog && function(t, e) { | |
t.fogColor.value = e.color, e.isFog ? (t.fogNear.value = e.near, t.fogFar.value = e.far) : e.isFogExp2 && (t.fogDensity.value = e.density) | |
}(x, e), n.isMeshBasicMaterial ? vn(x, n) : n.isMeshLambertMaterial ? (vn(x, n), function(t, e) { | |
e.emissiveMap && (t.emissiveMap.value = e.emissiveMap) | |
}(x, n)) : n.isMeshPhongMaterial ? (vn(x, n), n.isMeshToonMaterial ? function(t, e) { | |
xn(t, e), e.gradientMap && (t.gradientMap.value = e.gradientMap) | |
}(x, n) : xn(x, n)) : n.isMeshStandardMaterial ? (vn(x, n), n.isMeshPhysicalMaterial ? function(t, e) { | |
t.clearCoat.value = e.clearCoat, t.clearCoatRoughness.value = e.clearCoatRoughness, wn(t, e) | |
}(x, n) : wn(x, n)) : n.isMeshDepthMaterial ? (vn(x, n), function(t, e) { | |
e.displacementMap && (t.displacementMap.value = e.displacementMap, t.displacementScale.value = e.displacementScale, t.displacementBias.value = e.displacementBias) | |
}(x, n)) : n.isMeshDistanceMaterial ? (vn(x, n), function(t, e) { | |
e.displacementMap && (t.displacementMap.value = e.displacementMap, t.displacementScale.value = e.displacementScale, t.displacementBias.value = e.displacementBias); | |
t.referencePosition.value.copy(e.referencePosition), t.nearDistance.value = e.nearDistance, t.farDistance.value = e.farDistance | |
}(x, n)) : n.isMeshNormalMaterial ? (vn(x, n), function(t, e) { | |
e.bumpMap && (t.bumpMap.value = e.bumpMap, t.bumpScale.value = e.bumpScale); | |
e.normalMap && (t.normalMap.value = e.normalMap, t.normalScale.value.copy(e.normalScale)); | |
e.displacementMap && (t.displacementMap.value = e.displacementMap, t.displacementScale.value = e.displacementScale, t.displacementBias.value = e.displacementBias) | |
}(x, n)) : n.isLineBasicMaterial ? (function(t, e) { | |
t.diffuse.value = e.color, t.opacity.value = e.opacity | |
}(x, n), n.isLineDashedMaterial && function(t, e) { | |
t.dashSize.value = e.dashSize, t.totalSize.value = e.dashSize + e.gapSize, t.scale.value = e.scale | |
}(x, n)) : n.isPointsMaterial ? function(t, e) { | |
if (t.diffuse.value = e.color, t.opacity.value = e.opacity, t.size.value = e.size * Ce, t.scale.value = .5 * Te, t.map.value = e.map, null !== e.map) { | |
if (!0 === e.map.matrixAutoUpdate) { | |
var n = e.map.offset, | |
i = e.map.repeat, | |
r = e.map.rotation, | |
a = e.map.center; | |
e.map.matrix.setUvTransform(n.x, n.y, i.x, i.y, r, a.x, a.y) | |
} | |
t.uvTransform.value.copy(e.map.matrix) | |
} | |
}(x, n) : n.isShadowMaterial && (x.color.value = n.color, x.opacity.value = n.opacity), void 0 !== x.ltc_1 && (x.ltc_1.value = on.LTC_1), void 0 !== x.ltc_2 && (x.ltc_2.value = on.LTC_2), Vi.upload(p, r.uniformsList, x, ft)), n.isShaderMaterial && !0 === n.uniformsNeedUpdate && (Vi.upload(p, r.uniformsList, x, ft), n.uniformsNeedUpdate = !1), y.setValue(p, "modelViewMatrix", i.modelViewMatrix), y.setValue(p, "normalMatrix", i.normalMatrix), y.setValue(p, "modelMatrix", i.matrixWorld), g | |
} | |
function vn(t, e) { | |
var n; | |
if (t.opacity.value = e.opacity, e.color && (t.diffuse.value = e.color), e.emissive && t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity), e.map && (t.map.value = e.map), e.alphaMap && (t.alphaMap.value = e.alphaMap), e.specularMap && (t.specularMap.value = e.specularMap), e.envMap && (t.envMap.value = e.envMap, t.flipEnvMap.value = e.envMap && e.envMap.isCubeTexture ? -1 : 1, t.reflectivity.value = e.reflectivity, t.refractionRatio.value = e.refractionRatio, t.maxMipLevel.value = v.get(e.envMap).__maxMipLevel), e.lightMap && (t.lightMap.value = e.lightMap, t.lightMapIntensity.value = e.lightMapIntensity), e.aoMap && (t.aoMap.value = e.aoMap, t.aoMapIntensity.value = e.aoMapIntensity), e.map ? n = e.map : e.specularMap ? n = e.specularMap : e.displacementMap ? n = e.displacementMap : e.normalMap ? n = e.normalMap : e.bumpMap ? n = e.bumpMap : e.roughnessMap ? n = e.roughnessMap : e.metalnessMap ? n = e.metalnessMap : e.alphaMap ? n = e.alphaMap : e.emissiveMap && (n = e.emissiveMap), void 0 !== n) { | |
if (n.isWebGLRenderTarget && (n = n.texture), !0 === n.matrixAutoUpdate) { | |
var i = n.offset, | |
r = n.repeat, | |
a = n.rotation, | |
o = n.center; | |
n.matrix.setUvTransform(i.x, i.y, r.x, r.y, a, o.x, o.y) | |
} | |
t.uvTransform.value.copy(n.matrix) | |
} | |
} | |
function xn(t, e) { | |
t.specular.value = e.specular, t.shininess.value = Math.max(e.shininess, 1e-4), e.emissiveMap && (t.emissiveMap.value = e.emissiveMap), e.bumpMap && (t.bumpMap.value = e.bumpMap, t.bumpScale.value = e.bumpScale), e.normalMap && (t.normalMap.value = e.normalMap, t.normalScale.value.copy(e.normalScale)), e.displacementMap && (t.displacementMap.value = e.displacementMap, t.displacementScale.value = e.displacementScale, t.displacementBias.value = e.displacementBias) | |
} | |
function wn(t, e) { | |
t.roughness.value = e.roughness, t.metalness.value = e.metalness, e.roughnessMap && (t.roughnessMap.value = e.roughnessMap), e.metalnessMap && (t.metalnessMap.value = e.metalnessMap), e.emissiveMap && (t.emissiveMap.value = e.emissiveMap), e.bumpMap && (t.bumpMap.value = e.bumpMap, t.bumpScale.value = e.bumpScale), e.normalMap && (t.normalMap.value = e.normalMap, t.normalScale.value.copy(e.normalScale)), e.displacementMap && (t.displacementMap.value = e.displacementMap, t.displacementScale.value = e.displacementScale, t.displacementBias.value = e.displacementBias), e.envMap && (t.envMapIntensity.value = e.envMapIntensity) | |
} | |
this.animate = function(t) { | |
null !== (hn = t) ? an || (un(), an = !0) : ln() | |
}, this.render = function(t, e, n, i) { | |
if (e && e.isCamera) { | |
if (!mt) { | |
xt = "", yt = -1, ve = null, !0 === t.autoUpdate && t.updateMatrixWorld(), null === e.parent && e.updateMatrixWorld(), Xe.enabled && (e = Xe.getCamera(e)), (u = ot.get(t, e)).init(), t.onBeforeRender(ft, t, e, n), Ge.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse), De.setFromMatrix(Ge), Fe = this.localClippingEnabled, ze = Be.init(this.clippingPlanes, Fe, e), (l = at.get(t, e)).init(), | |
function t(e, n, i) { | |
if (!1 === e.visible) return; | |
var r = e.layers.test(n.layers); | |
if (r) | |
if (e.isLight) u.pushLight(e), e.castShadow && u.pushShadow(e); | |
else if (e.isSprite) e.frustumCulled && !De.intersectsSprite(e) || u.pushSprite(e); | |
else if (e.isImmediateRenderObject) i && ke.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ge), l.push(e, null, e.material, ke.z, null); | |
else if ((e.isMesh || e.isLine || e.isPoints) && (e.isSkinnedMesh && e.skeleton.update(), !e.frustumCulled || De.intersectsObject(e))) { | |
i && ke.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ge); | |
var a = T.update(e), | |
o = e.material; | |
if (Array.isArray(o)) | |
for (var s = a.groups, c = 0, h = s.length; c < h; c++) { | |
var p = s[c], | |
d = o[p.materialIndex]; | |
d && d.visible && l.push(e, a, d, ke.z, p) | |
} else o.visible && l.push(e, a, o, ke.z, null) | |
} | |
var f = e.children; | |
for (var c = 0, h = f.length; c < h; c++) t(f[c], n, i) | |
}(t, e, ft.sortObjects), !0 === ft.sortObjects && l.sort(), ze && Be.beginShadows(); | |
var r = u.state.shadowsArray; | |
qe.render(r, t, e), u.setupLights(e), ze && Be.endShadows(), this.info.autoReset && this.info.reset(), void 0 === n && (n = null), this.setRenderTarget(n), st.render(l, t, e, i); | |
var a = l.opaque, | |
o = l.transparent; | |
if (t.overrideMaterial) { | |
var s = t.overrideMaterial; | |
a.length && dn(a, t, e, s), o.length && dn(o, t, e, s) | |
} else a.length && dn(a, t, e), o.length && dn(o, t, e); | |
var c = u.state.spritesArray; | |
pt.render(c, t, e), n && _.updateRenderTargetMipmap(n), m.buffers.depth.setTest(!0), m.buffers.depth.setMask(!0), m.buffers.color.setMask(!0), m.setPolygonOffset(!1), t.onAfterRender(ft, t, e), Xe.enabled && Xe.submitFrame(), l = null, u = null | |
} | |
} else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.") | |
}, this.allocTextureUnit = function() { | |
var t = Ee; | |
return t >= f.maxTextures && console.warn("THREE.WebGLRenderer: Trying to use " + t + " texture units while this GPU supports only " + f.maxTextures), Ee += 1, t | |
}, this.setTexture2D = (nn = !1, function(t, e) { | |
t && t.isWebGLRenderTarget && (nn || (console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), nn = !0), t = t.texture), _.setTexture2D(t, e) | |
}), this.setTexture = function() { | |
var t = !1; | |
return function(e, n) { | |
t || (console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."), t = !0), _.setTexture2D(e, n) | |
} | |
}(), this.setTextureCube = function() { | |
var t = !1; | |
return function(e, n) { | |
e && e.isWebGLRenderTargetCube && (t || (console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."), t = !0), e = e.texture), e && e.isCubeTexture || Array.isArray(e.image) && 6 === e.image.length ? _.setTextureCube(e, n) : _.setTextureCubeDynamic(e, n) | |
} | |
}(), this.getRenderTarget = function() { | |
return gt | |
}, this.setRenderTarget = function(t) { | |
gt = t, t && void 0 === v.get(t).__webglFramebuffer && _.setupRenderTarget(t); | |
var e = null, | |
n = !1; | |
if (t) { | |
var i = v.get(t).__webglFramebuffer; | |
t.isWebGLRenderTargetCube ? (e = i[t.activeCubeFace], n = !0) : e = i, be.copy(t.viewport), Ae.copy(t.scissor), Me = t.scissorTest | |
} else be.copy(Ie).multiplyScalar(Ce), Ae.copy(Le).multiplyScalar(Ce), Me = Pe; | |
if (vt !== e && (p.bindFramebuffer(p.FRAMEBUFFER, e), vt = e), m.viewport(be), m.scissor(Ae), m.setScissorTest(Me), n) { | |
var r = v.get(t.texture); | |
p.framebufferTexture2D(p.FRAMEBUFFER, p.COLOR_ATTACHMENT0, p.TEXTURE_CUBE_MAP_POSITIVE_X + t.activeCubeFace, r.__webglTexture, t.activeMipMapLevel) | |
} | |
}, this.readRenderTargetPixels = function(t, e, n, i, r, a) { | |
if (t && t.isWebGLRenderTarget) { | |
var o = v.get(t).__webglFramebuffer; | |
if (o) { | |
var s = !1; | |
o !== vt && (p.bindFramebuffer(p.FRAMEBUFFER, o), s = !0); | |
try { | |
var c = t.texture, | |
h = c.format, | |
l = c.type; | |
if (h !== Vt && dt.convert(h) !== p.getParameter(p.IMPLEMENTATION_COLOR_READ_FORMAT)) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); | |
if (!(l === It || dt.convert(l) === p.getParameter(p.IMPLEMENTATION_COLOR_READ_TYPE) || l === Ut && (d.get("OES_texture_float") || d.get("WEBGL_color_buffer_float")) || l === Nt && d.get("EXT_color_buffer_half_float"))) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); | |
p.checkFramebufferStatus(p.FRAMEBUFFER) === p.FRAMEBUFFER_COMPLETE ? e >= 0 && e <= t.width - i && n >= 0 && n <= t.height - r && p.readPixels(e, n, i, r, dt.convert(h), dt.convert(l), a) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.") | |
} finally { | |
s && p.bindFramebuffer(p.FRAMEBUFFER, vt) | |
} | |
} | |
} else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.") | |
}, this.copyFramebufferToTexture = function(t, e, n) { | |
var i = e.image.width, | |
r = e.image.height, | |
a = dt.convert(e.format); | |
this.setTexture2D(e, 0), p.copyTexImage2D(p.TEXTURE_2D, n || 0, a, t.x, t.y, i, r, 0) | |
}, this.copyTextureToTexture = function(t, e, n, i) { | |
var r = e.image.width, | |
a = e.image.height, | |
o = dt.convert(n.format), | |
s = dt.convert(n.type), | |
c = e.isDataTexture ? e.image.data : e.image; | |
this.setTexture2D(n, 0), p.texSubImage2D(p.TEXTURE_2D, i || 0, t.x, t.y, r, a, o, s, c) | |
} | |
} | |
function Er(t, e) { | |
this.name = "", this.color = new rn(t), this.density = void 0 !== e ? e : 25e-5 | |
} | |
function Sr(t, e, n) { | |
this.name = "", this.color = new rn(t), this.near = void 0 !== e ? e : 1, this.far = void 0 !== n ? n : 1e3 | |
} | |
function Tr() { | |
gn.call(this), this.type = "Scene", this.background = null, this.fog = null, this.overrideMaterial = null, this.autoUpdate = !0 | |
} | |
function Cr(t) { | |
Zn.call(this), this.type = "SpriteMaterial", this.color = new rn(16777215), this.map = null, this.rotation = 0, this.fog = !1, this.lights = !1, this.setValues(t) | |
} | |
function Ir(t) { | |
gn.call(this), this.type = "Sprite", this.material = void 0 !== t ? t : new Cr, this.center = new Pe(.5, .5) | |
} | |
function Lr() { | |
gn.call(this), this.type = "LOD", Object.defineProperties(this, { | |
levels: { | |
enumerable: !0, | |
value: [] | |
} | |
}) | |
} | |
function Rr(t, e) { | |
if (t = t || [], this.bones = t.slice(0), this.boneMatrices = new Float32Array(16 * this.bones.length), void 0 === e) this.calculateInverses(); | |
else if (this.bones.length === e.length) this.boneInverses = e.slice(0); | |
else { | |
console.warn("THREE.Skeleton boneInverses is the wrong length."), this.boneInverses = []; | |
for (var n = 0, i = this.bones.length; n < i; n++) this.boneInverses.push(new Oe) | |
} | |
} | |
function Pr() { | |
gn.call(this), this.type = "Bone" | |
} | |
function Or(t, e) { | |
ni.call(this, t, e), this.type = "SkinnedMesh", this.bindMode = "attached", this.bindMatrix = new Oe, this.bindMatrixInverse = new Oe; | |
var n = new Rr(this.initBones()); | |
this.bind(n, this.matrixWorld), this.normalizeSkinWeights() | |
} | |
function Dr(t) { | |
Zn.call(this), this.type = "LineBasicMaterial", this.color = new rn(16777215), this.linewidth = 1, this.linecap = "round", this.linejoin = "round", this.lights = !1, this.setValues(t) | |
} | |
function Ur(t, e, n) { | |
if (1 === n) return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."), new Nr(t, e); | |
gn.call(this), this.type = "Line", this.geometry = void 0 !== t ? t : new Bn, this.material = void 0 !== e ? e : new Dr({ | |
color: 16777215 * Math.random() | |
}) | |
} | |
function Nr(t, e) { | |
Ur.call(this, t, e), this.type = "LineSegments" | |
} | |
function Br(t, e) { | |
Ur.call(this, t, e), this.type = "LineLoop" | |
} | |
function zr(t) { | |
Zn.call(this), this.type = "PointsMaterial", this.color = new rn(16777215), this.map = null, this.size = 1, this.sizeAttenuation = !0, this.lights = !1, this.setValues(t) | |
} | |
function Fr(t, e) { | |
gn.call(this), this.type = "Points", this.geometry = void 0 !== t ? t : new Bn, this.material = void 0 !== e ? e : new zr({ | |
color: 16777215 * Math.random() | |
}) | |
} | |
function Gr() { | |
gn.call(this), this.type = "Group" | |
} | |
function kr(t, e, n, i, r, a, o, s, c) { | |
je.call(this, t, e, n, i, r, a, o, s, c), this.generateMipmaps = !1 | |
} | |
function Hr(t, e, n, i, r, a, o, s, c, h, l, u) { | |
je.call(this, null, a, o, s, c, h, i, r, l, u), this.image = { | |
width: e, | |
height: n | |
}, this.mipmaps = t, this.flipY = !1, this.generateMipmaps = !1 | |
} | |
function Vr(t, e, n, i, r, a, o, s, c, h) { | |
if ((h = void 0 !== h ? h : Xt) !== Xt && h !== qt) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat"); | |
void 0 === n && h === Xt && (n = Pt), void 0 === n && h === qt && (n = Gt), je.call(this, null, i, r, a, o, s, h, n, c), this.image = { | |
width: t, | |
height: e | |
}, this.magFilter = void 0 !== o ? o : At, this.minFilter = void 0 !== s ? s : At, this.flipY = !1, this.generateMipmaps = !1 | |
} | |
function jr(t) { | |
Bn.call(this), this.type = "WireframeGeometry"; | |
var e, n, i, r, a, o, s, c, h, l, u = [], | |
p = [0, 0], | |
d = {}, | |
f = ["a", "b", "c"]; | |
if (t && t.isGeometry) { | |
var m = t.faces; | |
for (e = 0, i = m.length; e < i; e++) { | |
var g = m[e]; | |
for (n = 0; n < 3; n++) s = g[f[n]], c = g[f[(n + 1) % 3]], p[0] = Math.min(s, c), p[1] = Math.max(s, c), void 0 === d[h = p[0] + "," + p[1]] && (d[h] = { | |
index1: p[0], | |
index2: p[1] | |
}) | |
} | |
for (h in d) o = d[h], l = t.vertices[o.index1], u.push(l.x, l.y, l.z), l = t.vertices[o.index2], u.push(l.x, l.y, l.z) | |
} else if (t && t.isBufferGeometry) { | |
var v, y, x, w, _, b, A; | |
if (l = new Ue, null !== t.index) { | |
for (v = t.attributes.position, y = t.index, 0 === (x = t.groups).length && (x = [{ | |
start: 0, | |
count: y.count, | |
materialIndex: 0 | |
}]), r = 0, a = x.length; r < a; ++r) | |
for (e = _ = (w = x[r]).start, i = _ + w.count; e < i; e += 3) | |
for (n = 0; n < 3; n++) s = y.getX(e + n), c = y.getX(e + (n + 1) % 3), p[0] = Math.min(s, c), p[1] = Math.max(s, c), void 0 === d[h = p[0] + "," + p[1]] && (d[h] = { | |
index1: p[0], | |
index2: p[1] | |
}); | |
for (h in d) o = d[h], l.fromBufferAttribute(v, o.index1), u.push(l.x, l.y, l.z), l.fromBufferAttribute(v, o.index2), u.push(l.x, l.y, l.z) | |
} else | |
for (e = 0, i = (v = t.attributes.position).count / 3; e < i; e++) | |
for (n = 0; n < 3; n++) b = 3 * e + n, l.fromBufferAttribute(v, b), u.push(l.x, l.y, l.z), A = 3 * e + (n + 1) % 3, l.fromBufferAttribute(v, A), u.push(l.x, l.y, l.z) | |
} | |
this.addAttribute("position", new Pn(u, 3)) | |
} | |
function Wr(t, e, n) { | |
An.call(this), this.type = "ParametricGeometry", this.parameters = { | |
func: t, | |
slices: e, | |
stacks: n | |
}, this.fromBufferGeometry(new Xr(t, e, n)), this.mergeVertices() | |
} | |
function Xr(t, e, n) { | |
Bn.call(this), this.type = "ParametricBufferGeometry", this.parameters = { | |
func: t, | |
slices: e, | |
stacks: n | |
}; | |
var i, r, a = [], | |
o = [], | |
s = [], | |
c = [], | |
h = new Ue, | |
l = new Ue, | |
u = new Ue, | |
p = new Ue, | |
d = new Ue, | |
f = e + 1; | |
for (i = 0; i <= n; i++) { | |
var m = i / n; | |
for (r = 0; r <= e; r++) { | |
var g = r / e; | |
t(g, m, l), o.push(l.x, l.y, l.z), g - 1e-5 >= 0 ? (t(g - 1e-5, m, u), p.subVectors(l, u)) : (t(g + 1e-5, m, u), p.subVectors(u, l)), m - 1e-5 >= 0 ? (t(g, m - 1e-5, u), d.subVectors(l, u)) : (t(g, m + 1e-5, u), d.subVectors(u, l)), h.crossVectors(p, d).normalize(), s.push(h.x, h.y, h.z), c.push(g, m) | |
} | |
} | |
for (i = 0; i < n; i++) | |
for (r = 0; r < e; r++) { | |
var v = i * f + r, | |
y = i * f + r + 1, | |
x = (i + 1) * f + r + 1, | |
w = (i + 1) * f + r; | |
a.push(v, y, w), a.push(y, x, w) | |
} | |
this.setIndex(a), this.addAttribute("position", new Pn(o, 3)), this.addAttribute("normal", new Pn(s, 3)), this.addAttribute("uv", new Pn(c, 2)) | |
} | |
function qr(t, e, n, i) { | |
An.call(this), this.type = "PolyhedronGeometry", this.parameters = { | |
vertices: t, | |
indices: e, | |
radius: n, | |
detail: i | |
}, this.fromBufferGeometry(new Yr(t, e, n, i)), this.mergeVertices() | |
} | |
function Yr(t, e, n, i) { | |
Bn.call(this), this.type = "PolyhedronBufferGeometry", this.parameters = { | |
vertices: t, | |
indices: e, | |
radius: n, | |
detail: i | |
}, n = n || 1; | |
var r = [], | |
a = []; | |
function o(t, e, n, i) { | |
var r, a, o = Math.pow(2, i), | |
c = []; | |
for (r = 0; r <= o; r++) { | |
c[r] = []; | |
var h = t.clone().lerp(n, r / o), | |
l = e.clone().lerp(n, r / o), | |
u = o - r; | |
for (a = 0; a <= u; a++) c[r][a] = 0 === a && r === o ? h : h.clone().lerp(l, a / u) | |
} | |
for (r = 0; r < o; r++) | |
for (a = 0; a < 2 * (o - r) - 1; a++) { | |
var p = Math.floor(a / 2); | |
a % 2 == 0 ? (s(c[r][p + 1]), s(c[r + 1][p]), s(c[r][p])) : (s(c[r][p + 1]), s(c[r + 1][p + 1]), s(c[r + 1][p])) | |
} | |
} | |
function s(t) { | |
r.push(t.x, t.y, t.z) | |
} | |
function c(e, n) { | |
var i = 3 * e; | |
n.x = t[i + 0], n.y = t[i + 1], n.z = t[i + 2] | |
} | |
function h(t, e, n, i) { | |
i < 0 && 1 === t.x && (a[e] = t.x - 1), 0 === n.x && 0 === n.z && (a[e] = i / 2 / Math.PI + .5) | |
} | |
function l(t) { | |
return Math.atan2(t.z, -t.x) | |
}! function(t) { | |
for (var n = new Ue, i = new Ue, r = new Ue, a = 0; a < e.length; a += 3) c(e[a + 0], n), c(e[a + 1], i), c(e[a + 2], r), o(n, i, r, t) | |
}(i = i || 0), | |
function(t) { | |
for (var e = new Ue, n = 0; n < r.length; n += 3) e.x = r[n + 0], e.y = r[n + 1], e.z = r[n + 2], e.normalize().multiplyScalar(t), r[n + 0] = e.x, r[n + 1] = e.y, r[n + 2] = e.z | |
}(n), | |
function() { | |
for (var t = new Ue, e = 0; e < r.length; e += 3) { | |
t.x = r[e + 0], t.y = r[e + 1], t.z = r[e + 2]; | |
var n = l(t) / 2 / Math.PI + .5, | |
i = (o = t, Math.atan2(-o.y, Math.sqrt(o.x * o.x + o.z * o.z)) / Math.PI + .5); | |
a.push(n, 1 - i) | |
} | |
var o; | |
(function() { | |
for (var t = new Ue, e = new Ue, n = new Ue, i = new Ue, o = new Pe, s = new Pe, c = new Pe, u = 0, p = 0; u < r.length; u += 9, p += 6) { | |
t.set(r[u + 0], r[u + 1], r[u + 2]), e.set(r[u + 3], r[u + 4], r[u + 5]), n.set(r[u + 6], r[u + 7], r[u + 8]), o.set(a[p + 0], a[p + 1]), s.set(a[p + 2], a[p + 3]), c.set(a[p + 4], a[p + 5]), i.copy(t).add(e).add(n).divideScalar(3); | |
var d = l(i); | |
h(o, p + 0, t, d), h(s, p + 2, e, d), h(c, p + 4, n, d) | |
} | |
})(), | |
function() { | |
for (var t = 0; t < a.length; t += 6) { | |
var e = a[t + 0], | |
n = a[t + 2], | |
i = a[t + 4], | |
r = Math.max(e, n, i), | |
o = Math.min(e, n, i); | |
r > .9 && o < .1 && (e < .2 && (a[t + 0] += 1), n < .2 && (a[t + 2] += 1), i < .2 && (a[t + 4] += 1)) | |
} | |
}() | |
}(), this.addAttribute("position", new Pn(r, 3)), this.addAttribute("normal", new Pn(r.slice(), 3)), this.addAttribute("uv", new Pn(a, 2)), 0 === i ? this.computeVertexNormals() : this.normalizeNormals() | |
} | |
function Jr(t, e) { | |
An.call(this), this.type = "TetrahedronGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
}, this.fromBufferGeometry(new Zr(t, e)), this.mergeVertices() | |
} | |
function Zr(t, e) { | |
Yr.call(this, [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1], [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1], t, e), this.type = "TetrahedronBufferGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
} | |
} | |
function Qr(t, e) { | |
An.call(this), this.type = "OctahedronGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
}, this.fromBufferGeometry(new Kr(t, e)), this.mergeVertices() | |
} | |
function Kr(t, e) { | |
Yr.call(this, [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1], [0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2], t, e), this.type = "OctahedronBufferGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
} | |
} | |
function $r(t, e) { | |
An.call(this), this.type = "IcosahedronGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
}, this.fromBufferGeometry(new ta(t, e)), this.mergeVertices() | |
} | |
function ta(t, e) { | |
var n = (1 + Math.sqrt(5)) / 2, | |
i = [-1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, 0, 0, -1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, n, 0, -1, n, 0, 1, -n, 0, -1, -n, 0, 1]; | |
Yr.call(this, i, [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1], t, e), this.type = "IcosahedronBufferGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
} | |
} | |
function ea(t, e) { | |
An.call(this), this.type = "DodecahedronGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
}, this.fromBufferGeometry(new na(t, e)), this.mergeVertices() | |
} | |
function na(t, e) { | |
var n = (1 + Math.sqrt(5)) / 2, | |
i = 1 / n, | |
r = [-1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 0, -i, -n, 0, -i, n, 0, i, -n, 0, i, n, -i, -n, 0, -i, n, 0, i, -n, 0, i, n, 0, -n, 0, -i, n, 0, -i, -n, 0, i, n, 0, i]; | |
Yr.call(this, r, [3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9], t, e), this.type = "DodecahedronBufferGeometry", this.parameters = { | |
radius: t, | |
detail: e | |
} | |
} | |
function ia(t, e, n, i, r, a) { | |
An.call(this), this.type = "TubeGeometry", this.parameters = { | |
path: t, | |
tubularSegments: e, | |
radius: n, | |
radialSegments: i, | |
closed: r | |
}, void 0 !== a && console.warn("THREE.TubeGeometry: taper has been removed."); | |
var o = new ra(t, e, n, i, r); | |
this.tangents = o.tangents, this.normals = o.normals, this.binormals = o.binormals, this.fromBufferGeometry(o), this.mergeVertices() | |
} | |
function ra(t, e, n, i, r) { | |
Bn.call(this), this.type = "TubeBufferGeometry", this.parameters = { | |
path: t, | |
tubularSegments: e, | |
radius: n, | |
radialSegments: i, | |
closed: r | |
}, e = e || 64, n = n || 1, i = i || 8, r = r || !1; | |
var a = t.computeFrenetFrames(e, r); | |
this.tangents = a.tangents, this.normals = a.normals, this.binormals = a.binormals; | |
var o, s, c = new Ue, | |
h = new Ue, | |
l = new Pe, | |
u = new Ue, | |
p = [], | |
d = [], | |
f = [], | |
m = []; | |
function g(r) { | |
u = t.getPointAt(r / e, u); | |
var o = a.normals[r], | |
l = a.binormals[r]; | |
for (s = 0; s <= i; s++) { | |
var f = s / i * Math.PI * 2, | |
m = Math.sin(f), | |
g = -Math.cos(f); | |
h.x = g * o.x + m * l.x, h.y = g * o.y + m * l.y, h.z = g * o.z + m * l.z, h.normalize(), d.push(h.x, h.y, h.z), c.x = u.x + n * h.x, c.y = u.y + n * h.y, c.z = u.z + n * h.z, p.push(c.x, c.y, c.z) | |
} | |
}! function() { | |
for (o = 0; o < e; o++) g(o); | |
g(!1 === r ? e : 0), | |
function() { | |
for (o = 0; o <= e; o++) | |
for (s = 0; s <= i; s++) l.x = o / e, l.y = s / i, f.push(l.x, l.y) | |
}(), | |
function() { | |
for (s = 1; s <= e; s++) | |
for (o = 1; o <= i; o++) { | |
var t = (i + 1) * (s - 1) + (o - 1), | |
n = (i + 1) * s + (o - 1), | |
r = (i + 1) * s + o, | |
a = (i + 1) * (s - 1) + o; | |
m.push(t, n, a), m.push(n, r, a) | |
} | |
}() | |
}(), this.setIndex(m), this.addAttribute("position", new Pn(p, 3)), this.addAttribute("normal", new Pn(d, 3)), this.addAttribute("uv", new Pn(f, 2)) | |
} | |
function aa(t, e, n, i, r, a, o) { | |
An.call(this), this.type = "TorusKnotGeometry", this.parameters = { | |
radius: t, | |
tube: e, | |
tubularSegments: n, | |
radialSegments: i, | |
p: r, | |
q: a | |
}, void 0 !== o && console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."), this.fromBufferGeometry(new oa(t, e, n, i, r, a)), this.mergeVertices() | |
} | |
function oa(t, e, n, i, r, a) { | |
Bn.call(this), this.type = "TorusKnotBufferGeometry", this.parameters = { | |
radius: t, | |
tube: e, | |
tubularSegments: n, | |
radialSegments: i, | |
p: r, | |
q: a | |
}, t = t || 1, e = e || .4, n = Math.floor(n) || 64, i = Math.floor(i) || 8, r = r || 2, a = a || 3; | |
var o, s, c = [], | |
h = [], | |
l = [], | |
u = [], | |
p = new Ue, | |
d = new Ue, | |
f = new Ue, | |
m = new Ue, | |
g = new Ue, | |
v = new Ue, | |
y = new Ue; | |
for (o = 0; o <= n; ++o) { | |
var x = o / n * r * Math.PI * 2; | |
for (T(x, r, a, t, f), T(x + .01, r, a, t, m), v.subVectors(m, f), y.addVectors(m, f), g.crossVectors(v, y), y.crossVectors(g, v), g.normalize(), y.normalize(), s = 0; s <= i; ++s) { | |
var w = s / i * Math.PI * 2, | |
_ = -e * Math.cos(w), | |
b = e * Math.sin(w); | |
p.x = f.x + (_ * y.x + b * g.x), p.y = f.y + (_ * y.y + b * g.y), p.z = f.z + (_ * y.z + b * g.z), h.push(p.x, p.y, p.z), d.subVectors(p, f).normalize(), l.push(d.x, d.y, d.z), u.push(o / n), u.push(s / i) | |
} | |
} | |
for (s = 1; s <= n; s++) | |
for (o = 1; o <= i; o++) { | |
var A = (i + 1) * (s - 1) + (o - 1), | |
M = (i + 1) * s + (o - 1), | |
E = (i + 1) * s + o, | |
S = (i + 1) * (s - 1) + o; | |
c.push(A, M, S), c.push(M, E, S) | |
} | |
function T(t, e, n, i, r) { | |
var a = Math.cos(t), | |
o = Math.sin(t), | |
s = n / e * t, | |
c = Math.cos(s); | |
r.x = i * (2 + c) * .5 * a, r.y = i * (2 + c) * o * .5, r.z = i * Math.sin(s) * .5 | |
} | |
this.setIndex(c), this.addAttribute("position", new Pn(h, 3)), this.addAttribute("normal", new Pn(l, 3)), this.addAttribute("uv", new Pn(u, 2)) | |
} | |
function sa(t, e, n, i, r) { | |
An.call(this), this.type = "TorusGeometry", this.parameters = { | |
radius: t, | |
tube: e, | |
radialSegments: n, | |
tubularSegments: i, | |
arc: r | |
}, this.fromBufferGeometry(new ca(t, e, n, i, r)), this.mergeVertices() | |
} | |
function ca(t, e, n, i, r) { | |
Bn.call(this), this.type = "TorusBufferGeometry", this.parameters = { | |
radius: t, | |
tube: e, | |
radialSegments: n, | |
tubularSegments: i, | |
arc: r | |
}, t = t || 1, e = e || .4, n = Math.floor(n) || 8, i = Math.floor(i) || 6, r = r || 2 * Math.PI; | |
var a, o, s = [], | |
c = [], | |
h = [], | |
l = [], | |
u = new Ue, | |
p = new Ue, | |
d = new Ue; | |
for (a = 0; a <= n; a++) | |
for (o = 0; o <= i; o++) { | |
var f = o / i * r, | |
m = a / n * Math.PI * 2; | |
p.x = (t + e * Math.cos(m)) * Math.cos(f), p.y = (t + e * Math.cos(m)) * Math.sin(f), p.z = e * Math.sin(m), c.push(p.x, p.y, p.z), u.x = t * Math.cos(f), u.y = t * Math.sin(f), d.subVectors(p, u).normalize(), h.push(d.x, d.y, d.z), l.push(o / i), l.push(a / n) | |
} | |
for (a = 1; a <= n; a++) | |
for (o = 1; o <= i; o++) { | |
var g = (i + 1) * a + o - 1, | |
v = (i + 1) * (a - 1) + o - 1, | |
y = (i + 1) * (a - 1) + o, | |
x = (i + 1) * a + o; | |
s.push(g, v, x), s.push(v, y, x) | |
} | |
this.setIndex(s), this.addAttribute("position", new Pn(c, 3)), this.addAttribute("normal", new Pn(h, 3)), this.addAttribute("uv", new Pn(l, 2)) | |
} | |
mr.prototype = Object.create(Zn.prototype), mr.prototype.constructor = mr, mr.prototype.isMeshDepthMaterial = !0, mr.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.depthPacking = t.depthPacking, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this.map = t.map, this.alphaMap = t.alphaMap, this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this | |
}, gr.prototype = Object.create(Zn.prototype), gr.prototype.constructor = gr, gr.prototype.isMeshDistanceMaterial = !0, gr.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.referencePosition.copy(t.referencePosition), this.nearDistance = t.nearDistance, this.farDistance = t.farDistance, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this.map = t.map, this.alphaMap = t.alphaMap, this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this | |
}, yr.prototype = Object.create(je.prototype), yr.prototype.constructor = yr, _r.prototype = Object.assign(Object.create(vn.prototype), { | |
constructor: _r, | |
isPerspectiveCamera: !0, | |
copy: function(t, e) { | |
return vn.prototype.copy.call(this, t, e), this.fov = t.fov, this.zoom = t.zoom, this.near = t.near, this.far = t.far, this.focus = t.focus, this.aspect = t.aspect, this.view = null === t.view ? null : Object.assign({}, t.view), this.filmGauge = t.filmGauge, this.filmOffset = t.filmOffset, this | |
}, | |
setFocalLength: function(t) { | |
var e = .5 * this.getFilmHeight() / t; | |
this.fov = 2 * Re.RAD2DEG * Math.atan(e), this.updateProjectionMatrix() | |
}, | |
getFocalLength: function() { | |
var t = Math.tan(.5 * Re.DEG2RAD * this.fov); | |
return .5 * this.getFilmHeight() / t | |
}, | |
getEffectiveFOV: function() { | |
return 2 * Re.RAD2DEG * Math.atan(Math.tan(.5 * Re.DEG2RAD * this.fov) / this.zoom) | |
}, | |
getFilmWidth: function() { | |
return this.filmGauge * Math.min(this.aspect, 1) | |
}, | |
getFilmHeight: function() { | |
return this.filmGauge / Math.max(this.aspect, 1) | |
}, | |
setViewOffset: function(t, e, n, i, r, a) { | |
this.aspect = t / e, 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 = t, this.view.fullHeight = e, this.view.offsetX = n, this.view.offsetY = i, this.view.width = r, this.view.height = a, this.updateProjectionMatrix() | |
}, | |
clearViewOffset: function() { | |
null !== this.view && (this.view.enabled = !1), this.updateProjectionMatrix() | |
}, | |
updateProjectionMatrix: function() { | |
var t = this.near, | |
e = t * Math.tan(.5 * Re.DEG2RAD * this.fov) / this.zoom, | |
n = 2 * e, | |
i = this.aspect * n, | |
r = -.5 * i, | |
a = this.view; | |
if (null !== this.view && this.view.enabled) { | |
var o = a.fullWidth, | |
s = a.fullHeight; | |
r += a.offsetX * i / o, e -= a.offsetY * n / s, i *= a.width / o, n *= a.height / s | |
} | |
var c = this.filmOffset; | |
0 !== c && (r += t * c / this.getFilmWidth()), this.projectionMatrix.makePerspective(r, r + i, e, e - n, t, this.far) | |
}, | |
toJSON: function(t) { | |
var e = gn.prototype.toJSON.call(this, t); | |
return e.object.fov = this.fov, e.object.zoom = this.zoom, e.object.near = this.near, e.object.far = this.far, e.object.focus = this.focus, e.object.aspect = this.aspect, null !== this.view && (e.object.view = Object.assign({}, this.view)), e.object.filmGauge = this.filmGauge, e.object.filmOffset = this.filmOffset, e | |
} | |
}), br.prototype = Object.assign(Object.create(_r.prototype), { | |
constructor: br, | |
isArrayCamera: !0 | |
}), Er.prototype.isFogExp2 = !0, Er.prototype.clone = function() { | |
return new Er(this.color.getHex(), this.density) | |
}, Er.prototype.toJSON = function() { | |
return { | |
type: "FogExp2", | |
color: this.color.getHex(), | |
density: this.density | |
} | |
}, Sr.prototype.isFog = !0, Sr.prototype.clone = function() { | |
return new Sr(this.color.getHex(), this.near, this.far) | |
}, Sr.prototype.toJSON = function() { | |
return { | |
type: "Fog", | |
color: this.color.getHex(), | |
near: this.near, | |
far: this.far | |
} | |
}, Tr.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Tr, | |
copy: function(t, e) { | |
return gn.prototype.copy.call(this, t, e), null !== t.background && (this.background = t.background.clone()), null !== t.fog && (this.fog = t.fog.clone()), null !== t.overrideMaterial && (this.overrideMaterial = t.overrideMaterial.clone()), this.autoUpdate = t.autoUpdate, this.matrixAutoUpdate = t.matrixAutoUpdate, this | |
}, | |
toJSON: function(t) { | |
var e = gn.prototype.toJSON.call(this, t); | |
return null !== this.background && (e.object.background = this.background.toJSON(t)), null !== this.fog && (e.object.fog = this.fog.toJSON()), e | |
} | |
}), Cr.prototype = Object.create(Zn.prototype), Cr.prototype.constructor = Cr, Cr.prototype.isSpriteMaterial = !0, Cr.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.color.copy(t.color), this.map = t.map, this.rotation = t.rotation, this | |
}, Ir.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Ir, | |
isSprite: !0, | |
raycast: (rr = new Ue, ar = new Ue, or = new Ue, function(t, e) { | |
ar.setFromMatrixPosition(this.matrixWorld), t.ray.closestPointToPoint(ar, rr), or.setFromMatrixScale(this.matrixWorld); | |
var n = or.x * or.y / 4; | |
if (!(ar.distanceToSquared(rr) > n)) { | |
var i = t.ray.origin.distanceTo(rr); | |
i < t.near || i > t.far || e.push({ | |
distance: i, | |
point: rr.clone(), | |
face: null, | |
object: this | |
}) | |
} | |
}), | |
clone: function() { | |
return new this.constructor(this.material).copy(this) | |
}, | |
copy: function(t) { | |
return gn.prototype.copy.call(this, t), void 0 !== t.center && this.center.copy(t.center), this | |
} | |
}), Lr.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Lr, | |
copy: function(t) { | |
gn.prototype.copy.call(this, t, !1); | |
for (var e = t.levels, n = 0, i = e.length; n < i; n++) { | |
var r = e[n]; | |
this.addLevel(r.object.clone(), r.distance) | |
} | |
return this | |
}, | |
addLevel: function(t, e) { | |
void 0 === e && (e = 0), e = Math.abs(e); | |
for (var n = this.levels, i = 0; i < n.length && !(e < n[i].distance); i++); | |
n.splice(i, 0, { | |
distance: e, | |
object: t | |
}), this.add(t) | |
}, | |
getObjectForDistance: function(t) { | |
for (var e = this.levels, n = 1, i = e.length; n < i && !(t < e[n].distance); n++); | |
return e[n - 1].object | |
}, | |
raycast: (sr = new Ue, function(t, e) { | |
sr.setFromMatrixPosition(this.matrixWorld); | |
var n = t.ray.origin.distanceTo(sr); | |
this.getObjectForDistance(n).raycast(t, e) | |
}), | |
update: function() { | |
var t = new Ue, | |
e = new Ue; | |
return function(n) { | |
var i = this.levels; | |
if (i.length > 1) { | |
t.setFromMatrixPosition(n.matrixWorld), e.setFromMatrixPosition(this.matrixWorld); | |
var r = t.distanceTo(e); | |
i[0].object.visible = !0; | |
for (var a = 1, o = i.length; a < o && r >= i[a].distance; a++) i[a - 1].object.visible = !1, i[a].object.visible = !0; | |
for (; a < o; a++) i[a].object.visible = !1 | |
} | |
} | |
}(), | |
toJSON: function(t) { | |
var e = gn.prototype.toJSON.call(this, t); | |
e.object.levels = []; | |
for (var n = this.levels, i = 0, r = n.length; i < r; i++) { | |
var a = n[i]; | |
e.object.levels.push({ | |
object: a.object.uuid, | |
distance: a.distance | |
}) | |
} | |
return e | |
} | |
}), Object.assign(Rr.prototype, { | |
calculateInverses: function() { | |
this.boneInverses = []; | |
for (var t = 0, e = this.bones.length; t < e; t++) { | |
var n = new Oe; | |
this.bones[t] && n.getInverse(this.bones[t].matrixWorld), this.boneInverses.push(n) | |
} | |
}, | |
pose: function() { | |
var t, e, n; | |
for (e = 0, n = this.bones.length; e < n; e++)(t = this.bones[e]) && t.matrixWorld.getInverse(this.boneInverses[e]); | |
for (e = 0, n = this.bones.length; e < n; e++)(t = this.bones[e]) && (t.parent && t.parent.isBone ? (t.matrix.getInverse(t.parent.matrixWorld), t.matrix.multiply(t.matrixWorld)) : t.matrix.copy(t.matrixWorld), t.matrix.decompose(t.position, t.quaternion, t.scale)) | |
}, | |
update: (cr = new Oe, hr = new Oe, function() { | |
for (var t = this.bones, e = this.boneInverses, n = this.boneMatrices, i = this.boneTexture, r = 0, a = t.length; r < a; r++) { | |
var o = t[r] ? t[r].matrixWorld : hr; | |
cr.multiplyMatrices(o, e[r]), cr.toArray(n, 16 * r) | |
} | |
void 0 !== i && (i.needsUpdate = !0) | |
}), | |
clone: function() { | |
return new Rr(this.bones, this.boneInverses) | |
}, | |
getBoneByName: function(t) { | |
for (var e = 0, n = this.bones.length; e < n; e++) { | |
var i = this.bones[e]; | |
if (i.name === t) return i | |
} | |
} | |
}), Pr.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Pr, | |
isBone: !0 | |
}), Or.prototype = Object.assign(Object.create(ni.prototype), { | |
constructor: Or, | |
isSkinnedMesh: !0, | |
initBones: function() { | |
var t, e, n, i, r = []; | |
if (this.geometry && void 0 !== this.geometry.bones) { | |
for (n = 0, i = this.geometry.bones.length; n < i; n++) e = this.geometry.bones[n], t = new Pr, r.push(t), t.name = e.name, t.position.fromArray(e.pos), t.quaternion.fromArray(e.rotq), void 0 !== e.scl && t.scale.fromArray(e.scl); | |
for (n = 0, i = this.geometry.bones.length; n < i; n++) - 1 !== (e = this.geometry.bones[n]).parent && null !== e.parent && void 0 !== r[e.parent] ? r[e.parent].add(r[n]) : this.add(r[n]) | |
} | |
return this.updateMatrixWorld(!0), r | |
}, | |
bind: function(t, e) { | |
this.skeleton = t, void 0 === e && (this.updateMatrixWorld(!0), this.skeleton.calculateInverses(), e = this.matrixWorld), this.bindMatrix.copy(e), this.bindMatrixInverse.getInverse(e) | |
}, | |
pose: function() { | |
this.skeleton.pose() | |
}, | |
normalizeSkinWeights: function() { | |
var t, e; | |
if (this.geometry && this.geometry.isGeometry) | |
for (e = 0; e < this.geometry.skinWeights.length; e++) { | |
var n = this.geometry.skinWeights[e]; | |
Infinity !== (t = 1 / n.manhattanLength()) ? n.multiplyScalar(t) : n.set(1, 0, 0, 0) | |
} else if (this.geometry && this.geometry.isBufferGeometry) { | |
var i = new We, | |
r = this.geometry.attributes.skinWeight; | |
for (e = 0; e < r.count; e++) i.x = r.getX(e), i.y = r.getY(e), i.z = r.getZ(e), i.w = r.getW(e), Infinity !== (t = 1 / i.manhattanLength()) ? i.multiplyScalar(t) : i.set(1, 0, 0, 0), r.setXYZW(e, i.x, i.y, i.z, i.w) | |
} | |
}, | |
updateMatrixWorld: function(t) { | |
ni.prototype.updateMatrixWorld.call(this, t), "attached" === this.bindMode ? this.bindMatrixInverse.getInverse(this.matrixWorld) : "detached" === this.bindMode ? this.bindMatrixInverse.getInverse(this.bindMatrix) : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode) | |
}, | |
clone: function() { | |
return new this.constructor(this.geometry, this.material).copy(this) | |
} | |
}), Dr.prototype = Object.create(Zn.prototype), Dr.prototype.constructor = Dr, Dr.prototype.isLineBasicMaterial = !0, Dr.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.color.copy(t.color), this.linewidth = t.linewidth, this.linecap = t.linecap, this.linejoin = t.linejoin, this | |
}, Ur.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Ur, | |
isLine: !0, | |
computeLineDistances: (lr = new Ue, ur = new Ue, function() { | |
var t = this.geometry; | |
if (t.isBufferGeometry) | |
if (null === t.index) { | |
for (var e = t.attributes.position, n = [0], i = 1, r = e.count; i < r; i++) lr.fromBufferAttribute(e, i - 1), ur.fromBufferAttribute(e, i), n[i] = n[i - 1], n[i] += lr.distanceTo(ur); | |
t.addAttribute("lineDistance", new THREE.Float32BufferAttribute(n, 1)) | |
} else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); | |
else if (t.isGeometry) { | |
var a = t.vertices; | |
for ((n = t.lineDistances)[0] = 0, i = 1, r = a.length; i < r; i++) n[i] = n[i - 1], n[i] += a[i - 1].distanceTo(a[i]) | |
} | |
return this | |
}), | |
raycast: function() { | |
var t = new Oe, | |
e = new $n, | |
n = new Ze; | |
return function(i, r) { | |
var a = i.linePrecision, | |
o = a * a, | |
s = this.geometry, | |
c = this.matrixWorld; | |
if (null === s.boundingSphere && s.computeBoundingSphere(), n.copy(s.boundingSphere), n.applyMatrix4(c), !1 !== i.ray.intersectsSphere(n)) { | |
t.getInverse(c), e.copy(i.ray).applyMatrix4(t); | |
var h = new Ue, | |
l = new Ue, | |
u = new Ue, | |
p = new Ue, | |
d = this && this.isLineSegments ? 2 : 1; | |
if (s.isBufferGeometry) { | |
var f = s.index, | |
m = s.attributes.position.array; | |
if (null !== f) | |
for (var g = f.array, v = 0, y = g.length - 1; v < y; v += d) { | |
var x = g[v], | |
w = g[v + 1]; | |
if (h.fromArray(m, 3 * x), l.fromArray(m, 3 * w), !(e.distanceSqToSegment(h, l, p, u) > o)) p.applyMatrix4(this.matrixWorld), (A = i.ray.origin.distanceTo(p)) < i.near || A > i.far || r.push({ | |
distance: A, | |
point: u.clone().applyMatrix4(this.matrixWorld), | |
index: v, | |
face: null, | |
faceIndex: null, | |
object: this | |
}) | |
} else | |
for (v = 0, y = m.length / 3 - 1; v < y; v += d) { | |
if (h.fromArray(m, 3 * v), l.fromArray(m, 3 * v + 3), !(e.distanceSqToSegment(h, l, p, u) > o)) p.applyMatrix4(this.matrixWorld), (A = i.ray.origin.distanceTo(p)) < i.near || A > i.far || r.push({ | |
distance: A, | |
point: u.clone().applyMatrix4(this.matrixWorld), | |
index: v, | |
face: null, | |
faceIndex: null, | |
object: this | |
}) | |
} | |
} else if (s.isGeometry) { | |
var _ = s.vertices, | |
b = _.length; | |
for (v = 0; v < b - 1; v += d) { | |
var A; | |
if (!(e.distanceSqToSegment(_[v], _[v + 1], p, u) > o)) p.applyMatrix4(this.matrixWorld), (A = i.ray.origin.distanceTo(p)) < i.near || A > i.far || r.push({ | |
distance: A, | |
point: u.clone().applyMatrix4(this.matrixWorld), | |
index: v, | |
face: null, | |
faceIndex: null, | |
object: this | |
}) | |
} | |
} | |
} | |
} | |
}(), | |
clone: function() { | |
return new this.constructor(this.geometry, this.material).copy(this) | |
} | |
}), Nr.prototype = Object.assign(Object.create(Ur.prototype), { | |
constructor: Nr, | |
isLineSegments: !0, | |
computeLineDistances: function() { | |
var t = new Ue, | |
e = new Ue; | |
return function() { | |
var n = this.geometry; | |
if (n.isBufferGeometry) | |
if (null === n.index) { | |
for (var i = n.attributes.position, r = [], a = 0, o = i.count; a < o; a += 2) t.fromBufferAttribute(i, a), e.fromBufferAttribute(i, a + 1), r[a] = 0 === a ? 0 : r[a - 1], r[a + 1] = r[a] + t.distanceTo(e); | |
n.addAttribute("lineDistance", new THREE.Float32BufferAttribute(r, 1)) | |
} else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry."); | |
else if (n.isGeometry) { | |
var s = n.vertices; | |
for (r = n.lineDistances, a = 0, o = s.length; a < o; a += 2) t.copy(s[a]), e.copy(s[a + 1]), r[a] = 0 === a ? 0 : r[a - 1], r[a + 1] = r[a] + t.distanceTo(e) | |
} | |
return this | |
} | |
}() | |
}), Br.prototype = Object.assign(Object.create(Ur.prototype), { | |
constructor: Br, | |
isLineLoop: !0 | |
}), zr.prototype = Object.create(Zn.prototype), zr.prototype.constructor = zr, zr.prototype.isPointsMaterial = !0, zr.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.color.copy(t.color), this.map = t.map, this.size = t.size, this.sizeAttenuation = t.sizeAttenuation, this | |
}, Fr.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Fr, | |
isPoints: !0, | |
raycast: function() { | |
var t = new Oe, | |
e = new $n, | |
n = new Ze; | |
return function(i, r) { | |
var a = this, | |
o = this.geometry, | |
s = this.matrixWorld, | |
c = i.params.Points.threshold; | |
if (null === o.boundingSphere && o.computeBoundingSphere(), n.copy(o.boundingSphere), n.applyMatrix4(s), n.radius += c, !1 !== i.ray.intersectsSphere(n)) { | |
t.getInverse(s), e.copy(i.ray).applyMatrix4(t); | |
var h = c / ((this.scale.x + this.scale.y + this.scale.z) / 3), | |
l = h * h, | |
u = new Ue, | |
p = new Ue; | |
if (o.isBufferGeometry) { | |
var d = o.index, | |
f = o.attributes.position.array; | |
if (null !== d) | |
for (var m = d.array, g = 0, v = m.length; g < v; g++) { | |
var y = m[g]; | |
u.fromArray(f, 3 * y), _(u, y) | |
} else { | |
g = 0; | |
for (var x = f.length / 3; g < x; g++) u.fromArray(f, 3 * g), _(u, g) | |
} | |
} else { | |
var w = o.vertices; | |
for (g = 0, x = w.length; g < x; g++) _(w[g], g) | |
} | |
} | |
function _(t, n) { | |
var o = e.distanceSqToPoint(t); | |
if (o < l) { | |
e.closestPointToPoint(t, p), p.applyMatrix4(s); | |
var c = i.ray.origin.distanceTo(p); | |
if (c < i.near || c > i.far) return; | |
r.push({ | |
distance: c, | |
distanceToRay: Math.sqrt(o), | |
point: p.clone(), | |
index: n, | |
face: null, | |
object: a | |
}) | |
} | |
} | |
} | |
}(), | |
clone: function() { | |
return new this.constructor(this.geometry, this.material).copy(this) | |
} | |
}), Gr.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Gr, | |
isGroup: !0 | |
}), kr.prototype = Object.assign(Object.create(je.prototype), { | |
constructor: kr, | |
isVideoTexture: !0, | |
update: function() { | |
var t = this.image; | |
t.readyState >= t.HAVE_CURRENT_DATA && (this.needsUpdate = !0) | |
} | |
}), Hr.prototype = Object.create(je.prototype), Hr.prototype.constructor = Hr, Hr.prototype.isCompressedTexture = !0, Vr.prototype = Object.create(je.prototype), Vr.prototype.constructor = Vr, Vr.prototype.isDepthTexture = !0, jr.prototype = Object.create(Bn.prototype), jr.prototype.constructor = jr, Wr.prototype = Object.create(An.prototype), Wr.prototype.constructor = Wr, Xr.prototype = Object.create(Bn.prototype), Xr.prototype.constructor = Xr, qr.prototype = Object.create(An.prototype), qr.prototype.constructor = qr, Yr.prototype = Object.create(Bn.prototype), Yr.prototype.constructor = Yr, Jr.prototype = Object.create(An.prototype), Jr.prototype.constructor = Jr, Zr.prototype = Object.create(Yr.prototype), Zr.prototype.constructor = Zr, Qr.prototype = Object.create(An.prototype), Qr.prototype.constructor = Qr, Kr.prototype = Object.create(Yr.prototype), Kr.prototype.constructor = Kr, $r.prototype = Object.create(An.prototype), $r.prototype.constructor = $r, ta.prototype = Object.create(Yr.prototype), ta.prototype.constructor = ta, ea.prototype = Object.create(An.prototype), ea.prototype.constructor = ea, na.prototype = Object.create(Yr.prototype), na.prototype.constructor = na, ia.prototype = Object.create(An.prototype), ia.prototype.constructor = ia, ra.prototype = Object.create(Bn.prototype), ra.prototype.constructor = ra, aa.prototype = Object.create(An.prototype), aa.prototype.constructor = aa, oa.prototype = Object.create(Bn.prototype), oa.prototype.constructor = oa, sa.prototype = Object.create(An.prototype), sa.prototype.constructor = sa, ca.prototype = Object.create(Bn.prototype), ca.prototype.constructor = ca; | |
var ha = function(t, e, n) { | |
n = n || 2; | |
var i, r, a, o, s, c, h, l = e && e.length, | |
u = l ? e[0] * n : t.length, | |
p = la(t, 0, u, n, !0), | |
d = []; | |
if (!p) return d; | |
if (l && (p = function(t, e, n, i) { | |
var r, a, o, s, c, h = []; | |
for (r = 0, a = e.length; r < a; r++) o = e[r] * i, s = r < a - 1 ? e[r + 1] * i : t.length, (c = la(t, o, s, i, !1)) === c.next && (c.steiner = !0), h.push(wa(c)); | |
for (h.sort(va), r = 0; r < h.length; r++) ya(h[r], n), n = ua(n, n.next); | |
return n | |
}(t, e, p, n)), t.length > 80 * n) { | |
i = a = t[0], r = o = t[1]; | |
for (var f = n; f < u; f += n)(s = t[f]) < i && (i = s), (c = t[f + 1]) < r && (r = c), s > a && (a = s), c > o && (o = c); | |
h = 0 !== (h = Math.max(a - i, o - r)) ? 1 / h : 0 | |
} | |
return pa(p, d, n, i, r, h), d | |
}; | |
function la(t, e, n, i, r) { | |
var a, o; | |
if (r === function(t, e, n, i) { | |
for (var r = 0, a = e, o = n - i; a < n; a += i) r += (t[o] - t[a]) * (t[a + 1] + t[o + 1]), o = a; | |
return r | |
}(t, e, n, i) > 0) | |
for (a = e; a < n; a += i) o = Ca(a, t[a], t[a + 1], o); | |
else | |
for (a = n - i; a >= e; a -= i) o = Ca(a, t[a], t[a + 1], o); | |
return o && Ma(o, o.next) && (Ia(o), o = o.next), o | |
} | |
function ua(t, e) { | |
if (!t) return t; | |
e || (e = t); | |
var n, i = t; | |
do { | |
if (n = !1, i.steiner || !Ma(i, i.next) && 0 !== Aa(i.prev, i, i.next)) i = i.next; | |
else { | |
if (Ia(i), (i = e = i.prev) === i.next) break; | |
n = !0 | |
} | |
} while (n || i !== e); | |
return e | |
} | |
function pa(t, e, n, i, r, a, o) { | |
if (t) { | |
!o && a && function(t, e, n, i) { | |
var r = t; | |
do { | |
null === r.z && (r.z = xa(r.x, r.y, e, n, i)), r.prevZ = r.prev, r.nextZ = r.next, r = r.next | |
} while (r !== t); | |
r.prevZ.nextZ = null, r.prevZ = null, | |
function(t) { | |
var e, n, i, r, a, o, s, c, h = 1; | |
do { | |
for (n = t, t = null, a = null, o = 0; n;) { | |
for (o++, i = n, s = 0, e = 0; e < h && (s++, i = i.nextZ); e++); | |
for (c = h; s > 0 || c > 0 && i;) 0 !== s && (0 === c || !i || n.z <= i.z) ? (r = n, n = n.nextZ, s--) : (r = i, i = i.nextZ, c--), a ? a.nextZ = r : t = r, r.prevZ = a, a = r; | |
n = i | |
} | |
a.nextZ = null, h *= 2 | |
} while (o > 1) | |
}(r) | |
}(t, i, r, a); | |
for (var s, c, h = t; t.prev !== t.next;) | |
if (s = t.prev, c = t.next, a ? fa(t, i, r, a) : da(t)) e.push(s.i / n), e.push(t.i / n), e.push(c.i / n), Ia(t), t = c.next, h = c.next; | |
else if ((t = c) === h) { | |
o ? 1 === o ? pa(t = ma(t, e, n), e, n, i, r, a, 2) : 2 === o && ga(t, e, n, i, r, a) : pa(ua(t), e, n, i, r, a, 1); | |
break | |
} | |
} | |
} | |
function da(t) { | |
var e = t.prev, | |
n = t, | |
i = t.next; | |
if (Aa(e, n, i) >= 0) return !1; | |
for (var r = t.next.next; r !== t.prev;) { | |
if (_a(e.x, e.y, n.x, n.y, i.x, i.y, r.x, r.y) && Aa(r.prev, r, r.next) >= 0) return !1; | |
r = r.next | |
} | |
return !0 | |
} | |
function fa(t, e, n, i) { | |
var r = t.prev, | |
a = t, | |
o = t.next; | |
if (Aa(r, a, o) >= 0) return !1; | |
for (var s = r.x < a.x ? r.x < o.x ? r.x : o.x : a.x < o.x ? a.x : o.x, c = r.y < a.y ? r.y < o.y ? r.y : o.y : a.y < o.y ? a.y : o.y, h = r.x > a.x ? r.x > o.x ? r.x : o.x : a.x > o.x ? a.x : o.x, l = r.y > a.y ? r.y > o.y ? r.y : o.y : a.y > o.y ? a.y : o.y, u = xa(s, c, e, n, i), p = xa(h, l, e, n, i), d = t.nextZ; d && d.z <= p;) { | |
if (d !== t.prev && d !== t.next && _a(r.x, r.y, a.x, a.y, o.x, o.y, d.x, d.y) && Aa(d.prev, d, d.next) >= 0) return !1; | |
d = d.nextZ | |
} | |
for (d = t.prevZ; d && d.z >= u;) { | |
if (d !== t.prev && d !== t.next && _a(r.x, r.y, a.x, a.y, o.x, o.y, d.x, d.y) && Aa(d.prev, d, d.next) >= 0) return !1; | |
d = d.prevZ | |
} | |
return !0 | |
} | |
function ma(t, e, n) { | |
var i = t; | |
do { | |
var r = i.prev, | |
a = i.next.next; | |
!Ma(r, a) && Ea(r, i, i.next, a) && Sa(r, a) && Sa(a, r) && (e.push(r.i / n), e.push(i.i / n), e.push(a.i / n), Ia(i), Ia(i.next), i = t = a), i = i.next | |
} while (i !== t); | |
return i | |
} | |
function ga(t, e, n, i, r, a) { | |
var o = t; | |
do { | |
for (var s = o.next.next; s !== o.prev;) { | |
if (o.i !== s.i && ba(o, s)) { | |
var c = Ta(o, s); | |
return o = ua(o, o.next), c = ua(c, c.next), pa(o, e, n, i, r, a), void pa(c, e, n, i, r, a) | |
} | |
s = s.next | |
} | |
o = o.next | |
} while (o !== t) | |
} | |
function va(t, e) { | |
return t.x - e.x | |
} | |
function ya(t, e) { | |
if (e = function(t, e) { | |
var n, i = e, | |
r = t.x, | |
a = t.y, | |
o = -Infinity; | |
do { | |
if (a <= i.y && a >= i.next.y && i.next.y !== i.y) { | |
var s = i.x + (a - i.y) * (i.next.x - i.x) / (i.next.y - i.y); | |
if (s <= r && s > o) { | |
if (o = s, s === r) { | |
if (a === i.y) return i; | |
if (a === i.next.y) return i.next | |
} | |
n = i.x < i.next.x ? i : i.next | |
} | |
} | |
i = i.next | |
} while (i !== e); | |
if (!n) return null; | |
if (r === o) return n.prev; | |
var c, h = n, | |
l = n.x, | |
u = n.y, | |
p = Infinity; | |
i = n.next; | |
for (; i !== h;) r >= i.x && i.x >= l && r !== i.x && _a(a < u ? r : o, a, l, u, a < u ? o : r, a, i.x, i.y) && ((c = Math.abs(a - i.y) / (r - i.x)) < p || c === p && i.x > n.x) && Sa(i, t) && (n = i, p = c), i = i.next; | |
return n | |
}(t, e)) { | |
var n = Ta(e, t); | |
ua(n, n.next) | |
} | |
} | |
function xa(t, e, n, i, r) { | |
return (t = 1431655765 & ((t = 858993459 & ((t = 252645135 & ((t = 16711935 & ((t = 32767 * (t - n) * r) | t << 8)) | t << 4)) | t << 2)) | t << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - i) * r) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1 | |
} | |
function wa(t) { | |
var e = t, | |
n = t; | |
do { | |
e.x < n.x && (n = e), e = e.next | |
} while (e !== t); | |
return n | |
} | |
function _a(t, e, n, i, r, a, o, s) { | |
return (r - o) * (e - s) - (t - o) * (a - s) >= 0 && (t - o) * (i - s) - (n - o) * (e - s) >= 0 && (n - o) * (a - s) - (r - o) * (i - s) >= 0 | |
} | |
function ba(t, e) { | |
return t.next.i !== e.i && t.prev.i !== e.i && ! function(t, e) { | |
var n = t; | |
do { | |
if (n.i !== t.i && n.next.i !== t.i && n.i !== e.i && n.next.i !== e.i && Ea(n, n.next, t, e)) return !0; | |
n = n.next | |
} while (n !== t); | |
return !1 | |
}(t, e) && Sa(t, e) && Sa(e, t) && function(t, e) { | |
var n = t, | |
i = !1, | |
r = (t.x + e.x) / 2, | |
a = (t.y + e.y) / 2; | |
do { | |
n.y > a != n.next.y > a && n.next.y !== n.y && r < (n.next.x - n.x) * (a - n.y) / (n.next.y - n.y) + n.x && (i = !i), n = n.next | |
} while (n !== t); | |
return i | |
}(t, e) | |
} | |
function Aa(t, e, n) { | |
return (e.y - t.y) * (n.x - e.x) - (e.x - t.x) * (n.y - e.y) | |
} | |
function Ma(t, e) { | |
return t.x === e.x && t.y === e.y | |
} | |
function Ea(t, e, n, i) { | |
return !!(Ma(t, e) && Ma(n, i) || Ma(t, i) && Ma(n, e)) || Aa(t, e, n) > 0 != Aa(t, e, i) > 0 && Aa(n, i, t) > 0 != Aa(n, i, e) > 0 | |
} | |
function Sa(t, e) { | |
return Aa(t.prev, t, t.next) < 0 ? Aa(t, e, t.next) >= 0 && Aa(t, t.prev, e) >= 0 : Aa(t, e, t.prev) < 0 || Aa(t, t.next, e) < 0 | |
} | |
function Ta(t, e) { | |
var n = new La(t.i, t.x, t.y), | |
i = new La(e.i, e.x, e.y), | |
r = t.next, | |
a = e.prev; | |
return t.next = e, e.prev = t, n.next = r, r.prev = n, i.next = n, n.prev = i, a.next = i, i.prev = a, i | |
} | |
function Ca(t, e, n, i) { | |
var r = new La(t, e, n); | |
return i ? (r.next = i.next, r.prev = i, i.next.prev = r, i.next = r) : (r.prev = r, r.next = r), r | |
} | |
function Ia(t) { | |
t.next.prev = t.prev, t.prev.next = t.next, t.prevZ && (t.prevZ.nextZ = t.nextZ), t.nextZ && (t.nextZ.prevZ = t.prevZ) | |
} | |
function La(t, e, n) { | |
this.i = t, this.x = e, this.y = n, this.prev = null, this.next = null, this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = !1 | |
} | |
var Ra = { | |
area: function(t) { | |
for (var e = t.length, n = 0, i = e - 1, r = 0; r < e; i = r++) n += t[i].x * t[r].y - t[r].x * t[i].y; | |
return .5 * n | |
}, | |
isClockWise: function(t) { | |
return Ra.area(t) < 0 | |
}, | |
triangulateShape: function(t, e) { | |
var n = [], | |
i = [], | |
r = []; | |
Pa(t), Oa(n, t); | |
var a = t.length; | |
e.forEach(Pa); | |
for (var o = 0; o < e.length; o++) i.push(a), a += e[o].length, Oa(n, e[o]); | |
var s = ha(n, i); | |
for (o = 0; o < s.length; o += 3) r.push(s.slice(o, o + 3)); | |
return r | |
} | |
}; | |
function Pa(t) { | |
var e = t.length; | |
e > 2 && t[e - 1].equals(t[0]) && t.pop() | |
} | |
function Oa(t, e) { | |
for (var n = 0; n < e.length; n++) t.push(e[n].x), t.push(e[n].y) | |
} | |
function Da(t, e) { | |
An.call(this), this.type = "ExtrudeGeometry", this.parameters = { | |
shapes: t, | |
options: e | |
}, this.fromBufferGeometry(new Ua(t, e)), this.mergeVertices() | |
} | |
function Ua(t, e) { | |
void 0 !== t && (Bn.call(this), this.type = "ExtrudeBufferGeometry", t = Array.isArray(t) ? t : [t], this.addShapeList(t, e), this.computeVertexNormals()) | |
} | |
function Na(t, e) { | |
An.call(this), this.type = "TextGeometry", this.parameters = { | |
text: t, | |
parameters: e | |
}, this.fromBufferGeometry(new Ba(t, e)), this.mergeVertices() | |
} | |
function Ba(t, e) { | |
var n = (e = e || {}).font; | |
if (!n || !n.isFont) return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), new An; | |
var i = n.generateShapes(t, e.size, e.curveSegments); | |
e.amount = void 0 !== e.height ? e.height : 50, void 0 === e.bevelThickness && (e.bevelThickness = 10), void 0 === e.bevelSize && (e.bevelSize = 8), void 0 === e.bevelEnabled && (e.bevelEnabled = !1), Ua.call(this, i, e), this.type = "TextBufferGeometry" | |
} | |
function za(t, e, n, i, r, a, o) { | |
An.call(this), this.type = "SphereGeometry", this.parameters = { | |
radius: t, | |
widthSegments: e, | |
heightSegments: n, | |
phiStart: i, | |
phiLength: r, | |
thetaStart: a, | |
thetaLength: o | |
}, this.fromBufferGeometry(new Fa(t, e, n, i, r, a, o)), this.mergeVertices() | |
} | |
function Fa(t, e, n, i, r, a, o) { | |
Bn.call(this), this.type = "SphereBufferGeometry", this.parameters = { | |
radius: t, | |
widthSegments: e, | |
heightSegments: n, | |
phiStart: i, | |
phiLength: r, | |
thetaStart: a, | |
thetaLength: o | |
}, t = t || 1, e = Math.max(3, Math.floor(e) || 8), n = Math.max(2, Math.floor(n) || 6), i = void 0 !== i ? i : 0, r = void 0 !== r ? r : 2 * Math.PI; | |
var s, c, h = (a = void 0 !== a ? a : 0) + (o = void 0 !== o ? o : Math.PI), | |
l = 0, | |
u = [], | |
p = new Ue, | |
d = new Ue, | |
f = [], | |
m = [], | |
g = [], | |
v = []; | |
for (c = 0; c <= n; c++) { | |
var y = [], | |
x = c / n; | |
for (s = 0; s <= e; s++) { | |
var w = s / e; | |
p.x = -t * Math.cos(i + w * r) * Math.sin(a + x * o), p.y = t * Math.cos(a + x * o), p.z = t * Math.sin(i + w * r) * Math.sin(a + x * o), m.push(p.x, p.y, p.z), d.set(p.x, p.y, p.z).normalize(), g.push(d.x, d.y, d.z), v.push(w, 1 - x), y.push(l++) | |
} | |
u.push(y) | |
} | |
for (c = 0; c < n; c++) | |
for (s = 0; s < e; s++) { | |
var _ = u[c][s + 1], | |
b = u[c][s], | |
A = u[c + 1][s], | |
M = u[c + 1][s + 1]; | |
(0 !== c || a > 0) && f.push(_, b, M), (c !== n - 1 || h < Math.PI) && f.push(b, A, M) | |
} | |
this.setIndex(f), this.addAttribute("position", new Pn(m, 3)), this.addAttribute("normal", new Pn(g, 3)), this.addAttribute("uv", new Pn(v, 2)) | |
} | |
function Ga(t, e, n, i, r, a) { | |
An.call(this), this.type = "RingGeometry", this.parameters = { | |
innerRadius: t, | |
outerRadius: e, | |
thetaSegments: n, | |
phiSegments: i, | |
thetaStart: r, | |
thetaLength: a | |
}, this.fromBufferGeometry(new ka(t, e, n, i, r, a)), this.mergeVertices() | |
} | |
function ka(t, e, n, i, r, a) { | |
Bn.call(this), this.type = "RingBufferGeometry", this.parameters = { | |
innerRadius: t, | |
outerRadius: e, | |
thetaSegments: n, | |
phiSegments: i, | |
thetaStart: r, | |
thetaLength: a | |
}, t = t || .5, e = e || 1, r = void 0 !== r ? r : 0, a = void 0 !== a ? a : 2 * Math.PI, n = void 0 !== n ? Math.max(3, n) : 8; | |
var o, s, c, h = [], | |
l = [], | |
u = [], | |
p = [], | |
d = t, | |
f = (e - t) / (i = void 0 !== i ? Math.max(1, i) : 1), | |
m = new Ue, | |
g = new Pe; | |
for (s = 0; s <= i; s++) { | |
for (c = 0; c <= n; c++) o = r + c / n * a, m.x = d * Math.cos(o), m.y = d * Math.sin(o), l.push(m.x, m.y, m.z), u.push(0, 0, 1), g.x = (m.x / e + 1) / 2, g.y = (m.y / e + 1) / 2, p.push(g.x, g.y); | |
d += f | |
} | |
for (s = 0; s < i; s++) { | |
var v = s * (n + 1); | |
for (c = 0; c < n; c++) { | |
var y = o = c + v, | |
x = o + n + 1, | |
w = o + n + 2, | |
_ = o + 1; | |
h.push(y, x, _), h.push(x, w, _) | |
} | |
} | |
this.setIndex(h), this.addAttribute("position", new Pn(l, 3)), this.addAttribute("normal", new Pn(u, 3)), this.addAttribute("uv", new Pn(p, 2)) | |
} | |
function Ha(t, e, n, i) { | |
An.call(this), this.type = "LatheGeometry", this.parameters = { | |
points: t, | |
segments: e, | |
phiStart: n, | |
phiLength: i | |
}, this.fromBufferGeometry(new Va(t, e, n, i)), this.mergeVertices() | |
} | |
function Va(t, e, n, i) { | |
Bn.call(this), this.type = "LatheBufferGeometry", this.parameters = { | |
points: t, | |
segments: e, | |
phiStart: n, | |
phiLength: i | |
}, e = Math.floor(e) || 12, n = n || 0, i = i || 2 * Math.PI, i = Re.clamp(i, 0, 2 * Math.PI); | |
var r, a, o, s = [], | |
c = [], | |
h = [], | |
l = 1 / e, | |
u = new Ue, | |
p = new Pe; | |
for (a = 0; a <= e; a++) { | |
var d = n + a * l * i, | |
f = Math.sin(d), | |
m = Math.cos(d); | |
for (o = 0; o <= t.length - 1; o++) u.x = t[o].x * f, u.y = t[o].y, u.z = t[o].x * m, c.push(u.x, u.y, u.z), p.x = a / e, p.y = o / (t.length - 1), h.push(p.x, p.y) | |
} | |
for (a = 0; a < e; a++) | |
for (o = 0; o < t.length - 1; o++) { | |
var g = r = o + a * t.length, | |
v = r + t.length, | |
y = r + t.length + 1, | |
x = r + 1; | |
s.push(g, v, x), s.push(v, y, x) | |
} | |
if (this.setIndex(s), this.addAttribute("position", new Pn(c, 3)), this.addAttribute("uv", new Pn(h, 2)), this.computeVertexNormals(), i === 2 * Math.PI) { | |
var w = this.attributes.normal.array, | |
_ = new Ue, | |
b = new Ue, | |
A = new Ue; | |
for (r = e * t.length * 3, a = 0, o = 0; a < t.length; a++, o += 3) _.x = w[o + 0], _.y = w[o + 1], _.z = w[o + 2], b.x = w[r + o + 0], b.y = w[r + o + 1], b.z = w[r + o + 2], A.addVectors(_, b).normalize(), w[o + 0] = w[r + o + 0] = A.x, w[o + 1] = w[r + o + 1] = A.y, w[o + 2] = w[r + o + 2] = A.z | |
} | |
} | |
function ja(t, e) { | |
An.call(this), this.type = "ShapeGeometry", "object" == typeof e && (console.warn("THREE.ShapeGeometry: Options parameter has been removed."), e = e.curveSegments), this.parameters = { | |
shapes: t, | |
curveSegments: e | |
}, this.fromBufferGeometry(new Wa(t, e)), this.mergeVertices() | |
} | |
function Wa(t, e) { | |
Bn.call(this), this.type = "ShapeBufferGeometry", this.parameters = { | |
shapes: t, | |
curveSegments: e | |
}, e = e || 12; | |
var n = [], | |
i = [], | |
r = [], | |
a = [], | |
o = 0, | |
s = 0; | |
if (!1 === Array.isArray(t)) h(t); | |
else | |
for (var c = 0; c < t.length; c++) h(t[c]), this.addGroup(o, s, c), o += s, s = 0; | |
function h(t) { | |
var o, c, h, l = i.length / 3, | |
u = t.extractPoints(e), | |
p = u.shape, | |
d = u.holes; | |
if (!1 === Ra.isClockWise(p)) | |
for (p = p.reverse(), o = 0, c = d.length; o < c; o++) h = d[o], !0 === Ra.isClockWise(h) && (d[o] = h.reverse()); | |
var f = Ra.triangulateShape(p, d); | |
for (o = 0, c = d.length; o < c; o++) h = d[o], p = p.concat(h); | |
for (o = 0, c = p.length; o < c; o++) { | |
var m = p[o]; | |
i.push(m.x, m.y, 0), r.push(0, 0, 1), a.push(m.x, m.y) | |
} | |
for (o = 0, c = f.length; o < c; o++) { | |
var g = f[o], | |
v = g[0] + l, | |
y = g[1] + l, | |
x = g[2] + l; | |
n.push(v, y, x), s += 3 | |
} | |
} | |
this.setIndex(n), this.addAttribute("position", new Pn(i, 3)), this.addAttribute("normal", new Pn(r, 3)), this.addAttribute("uv", new Pn(a, 2)) | |
} | |
function Xa(t, e) { | |
if (e.shapes = [], Array.isArray(t)) | |
for (var n = 0, i = t.length; n < i; n++) { | |
var r = t[n]; | |
e.shapes.push(r.uuid) | |
} else e.shapes.push(t.uuid); | |
return e | |
} | |
function qa(t, e) { | |
Bn.call(this), this.type = "EdgesGeometry", this.parameters = { | |
thresholdAngle: e | |
}, e = void 0 !== e ? e : 1; | |
var n, i, r, a, o = [], | |
s = Math.cos(Re.DEG2RAD * e), | |
c = [0, 0], | |
h = {}, | |
l = ["a", "b", "c"]; | |
t.isBufferGeometry ? (a = new An).fromBufferGeometry(t) : a = t.clone(), a.mergeVertices(), a.computeFaceNormals(); | |
for (var u = a.vertices, p = a.faces, d = 0, f = p.length; d < f; d++) | |
for (var m = p[d], g = 0; g < 3; g++) n = m[l[g]], i = m[l[(g + 1) % 3]], c[0] = Math.min(n, i), c[1] = Math.max(n, i), void 0 === h[r = c[0] + "," + c[1]] ? h[r] = { | |
index1: c[0], | |
index2: c[1], | |
face1: d, | |
face2: void 0 | |
} : h[r].face2 = d; | |
for (r in h) { | |
var v = h[r]; | |
if (void 0 === v.face2 || p[v.face1].normal.dot(p[v.face2].normal) <= s) { | |
var y = u[v.index1]; | |
o.push(y.x, y.y, y.z), y = u[v.index2], o.push(y.x, y.y, y.z) | |
} | |
} | |
this.addAttribute("position", new Pn(o, 3)) | |
} | |
function Ya(t, e, n, i, r, a, o, s) { | |
An.call(this), this.type = "CylinderGeometry", this.parameters = { | |
radiusTop: t, | |
radiusBottom: e, | |
height: n, | |
radialSegments: i, | |
heightSegments: r, | |
openEnded: a, | |
thetaStart: o, | |
thetaLength: s | |
}, this.fromBufferGeometry(new Ja(t, e, n, i, r, a, o, s)), this.mergeVertices() | |
} | |
function Ja(t, e, n, i, r, a, o, s) { | |
Bn.call(this), this.type = "CylinderBufferGeometry", this.parameters = { | |
radiusTop: t, | |
radiusBottom: e, | |
height: n, | |
radialSegments: i, | |
heightSegments: r, | |
openEnded: a, | |
thetaStart: o, | |
thetaLength: s | |
}; | |
var c = this; | |
t = void 0 !== t ? t : 1, e = void 0 !== e ? e : 1, n = n || 1, i = Math.floor(i) || 8, r = Math.floor(r) || 1, a = void 0 !== a && a, o = void 0 !== o ? o : 0, s = void 0 !== s ? s : 2 * Math.PI; | |
var h = [], | |
l = [], | |
u = [], | |
p = [], | |
d = 0, | |
f = [], | |
m = n / 2, | |
g = 0; | |
function v(n) { | |
var r, a, f, v = new Pe, | |
y = new Ue, | |
x = 0, | |
w = !0 === n ? t : e, | |
_ = !0 === n ? 1 : -1; | |
for (a = d, r = 1; r <= i; r++) l.push(0, m * _, 0), u.push(0, _, 0), p.push(.5, .5), d++; | |
for (f = d, r = 0; r <= i; r++) { | |
var b = r / i * s + o, | |
A = Math.cos(b), | |
M = Math.sin(b); | |
y.x = w * M, y.y = m * _, y.z = w * A, l.push(y.x, y.y, y.z), u.push(0, _, 0), v.x = .5 * A + .5, v.y = .5 * M * _ + .5, p.push(v.x, v.y), d++ | |
} | |
for (r = 0; r < i; r++) { | |
var E = a + r, | |
S = f + r; | |
!0 === n ? h.push(S, S + 1, E) : h.push(S + 1, S, E), x += 3 | |
} | |
c.addGroup(g, x, !0 === n ? 1 : 2), g += x | |
}! function() { | |
var a, v, y = new Ue, | |
x = new Ue, | |
w = 0, | |
_ = (e - t) / n; | |
for (v = 0; v <= r; v++) { | |
var b = [], | |
A = v / r, | |
M = A * (e - t) + t; | |
for (a = 0; a <= i; a++) { | |
var E = a / i, | |
S = E * s + o, | |
T = Math.sin(S), | |
C = Math.cos(S); | |
x.x = M * T, x.y = -A * n + m, x.z = M * C, l.push(x.x, x.y, x.z), y.set(T, _, C).normalize(), u.push(y.x, y.y, y.z), p.push(E, 1 - A), b.push(d++) | |
} | |
f.push(b) | |
} | |
for (a = 0; a < i; a++) | |
for (v = 0; v < r; v++) { | |
var I = f[v][a], | |
L = f[v + 1][a], | |
R = f[v + 1][a + 1], | |
P = f[v][a + 1]; | |
h.push(I, L, P), h.push(L, R, P), w += 6 | |
} | |
c.addGroup(g, w, 0), g += w | |
}(), !1 === a && (t > 0 && v(!0), e > 0 && v(!1)), this.setIndex(h), this.addAttribute("position", new Pn(l, 3)), this.addAttribute("normal", new Pn(u, 3)), this.addAttribute("uv", new Pn(p, 2)) | |
} | |
function Za(t, e, n, i, r, a, o) { | |
Ya.call(this, 0, t, e, n, i, r, a, o), this.type = "ConeGeometry", this.parameters = { | |
radius: t, | |
height: e, | |
radialSegments: n, | |
heightSegments: i, | |
openEnded: r, | |
thetaStart: a, | |
thetaLength: o | |
} | |
} | |
function Qa(t, e, n, i, r, a, o) { | |
Ja.call(this, 0, t, e, n, i, r, a, o), this.type = "ConeBufferGeometry", this.parameters = { | |
radius: t, | |
height: e, | |
radialSegments: n, | |
heightSegments: i, | |
openEnded: r, | |
thetaStart: a, | |
thetaLength: o | |
} | |
} | |
function Ka(t, e, n, i) { | |
An.call(this), this.type = "CircleGeometry", this.parameters = { | |
radius: t, | |
segments: e, | |
thetaStart: n, | |
thetaLength: i | |
}, this.fromBufferGeometry(new $a(t, e, n, i)), this.mergeVertices() | |
} | |
function $a(t, e, n, i) { | |
Bn.call(this), this.type = "CircleBufferGeometry", this.parameters = { | |
radius: t, | |
segments: e, | |
thetaStart: n, | |
thetaLength: i | |
}, t = t || 1, e = void 0 !== e ? Math.max(3, e) : 8, n = void 0 !== n ? n : 0, i = void 0 !== i ? i : 2 * Math.PI; | |
var r, a, o = [], | |
s = [], | |
c = [], | |
h = [], | |
l = new Ue, | |
u = new Pe; | |
for (s.push(0, 0, 0), c.push(0, 0, 1), h.push(.5, .5), a = 0, r = 3; a <= e; a++, r += 3) { | |
var p = n + a / e * i; | |
l.x = t * Math.cos(p), l.y = t * Math.sin(p), s.push(l.x, l.y, l.z), c.push(0, 0, 1), u.x = (s[r] / t + 1) / 2, u.y = (s[r + 1] / t + 1) / 2, h.push(u.x, u.y) | |
} | |
for (r = 1; r <= e; r++) o.push(r, r + 1, 0); | |
this.setIndex(o), this.addAttribute("position", new Pn(s, 3)), this.addAttribute("normal", new Pn(c, 3)), this.addAttribute("uv", new Pn(h, 2)) | |
} | |
Da.prototype = Object.create(An.prototype), Da.prototype.constructor = Da, Ua.prototype = Object.create(Bn.prototype), Ua.prototype.constructor = Ua, Ua.prototype.getArrays = function() { | |
var t = this.getAttribute("position"), | |
e = t ? Array.prototype.slice.call(t.array) : [], | |
n = this.getAttribute("uv"), | |
i = n ? Array.prototype.slice.call(n.array) : [], | |
r = this.index; | |
return { | |
position: e, | |
uv: i, | |
index: r ? Array.prototype.slice.call(r.array) : [] | |
} | |
}, Ua.prototype.addShapeList = function(t, e) { | |
var n = t.length; | |
e.arrays = this.getArrays(); | |
for (var i = 0; i < n; i++) { | |
var r = t[i]; | |
this.addShape(r, e) | |
} | |
this.setIndex(e.arrays.index), this.addAttribute("position", new Pn(e.arrays.position, 3)), this.addAttribute("uv", new Pn(e.arrays.uv, 2)) | |
}, Ua.prototype.addShape = function(t, e) { | |
var n, i, r, a, o, s, c, h, l = e.arrays ? e.arrays : this.getArrays(), | |
u = l.position, | |
p = l.index, | |
d = l.uv, | |
f = [], | |
m = void 0 !== e.amount ? e.amount : 100, | |
g = void 0 !== e.bevelThickness ? e.bevelThickness : 6, | |
v = void 0 !== e.bevelSize ? e.bevelSize : g - 2, | |
y = void 0 !== e.bevelSegments ? e.bevelSegments : 3, | |
x = void 0 === e.bevelEnabled || e.bevelEnabled, | |
w = void 0 !== e.curveSegments ? e.curveSegments : 12, | |
_ = void 0 !== e.steps ? e.steps : 1, | |
b = e.extrudePath, | |
A = !1, | |
M = void 0 !== e.UVGenerator ? e.UVGenerator : Da.WorldUVGenerator; | |
b && (n = b.getSpacedPoints(_), A = !0, x = !1, i = void 0 !== e.frames ? e.frames : b.computeFrenetFrames(_, !1), r = new Ue, a = new Ue, o = new Ue), x || (y = 0, g = 0, v = 0); | |
var E = this, | |
S = t.extractPoints(w), | |
T = S.shape, | |
C = S.holes; | |
if (!Ra.isClockWise(T)) | |
for (T = T.reverse(), c = 0, h = C.length; c < h; c++) s = C[c], Ra.isClockWise(s) && (C[c] = s.reverse()); | |
var I = Ra.triangulateShape(T, C), | |
L = T; | |
for (c = 0, h = C.length; c < h; c++) s = C[c], T = T.concat(s); | |
function R(t, e, n) { | |
return e || console.error("THREE.ExtrudeGeometry: vec does not exist"), e.clone().multiplyScalar(n).add(t) | |
} | |
var P, O, D, U, N, B, z = T.length, | |
F = I.length; | |
function G(t, e, n) { | |
var i, r, a, o = t.x - e.x, | |
s = t.y - e.y, | |
c = n.x - t.x, | |
h = n.y - t.y, | |
l = o * o + s * s, | |
u = o * h - s * c; | |
if (Math.abs(u) > Number.EPSILON) { | |
var p = Math.sqrt(l), | |
d = Math.sqrt(c * c + h * h), | |
f = e.x - s / p, | |
m = e.y + o / p, | |
g = ((n.x - h / d - f) * h - (n.y + c / d - m) * c) / (o * h - s * c), | |
v = (i = f + o * g - t.x) * i + (r = m + s * g - t.y) * r; | |
if (v <= 2) return new Pe(i, r); | |
a = Math.sqrt(v / 2) | |
} else { | |
var y = !1; | |
o > Number.EPSILON ? c > Number.EPSILON && (y = !0) : o < -Number.EPSILON ? c < -Number.EPSILON && (y = !0) : Math.sign(s) === Math.sign(h) && (y = !0), y ? (i = -s, r = o, a = Math.sqrt(l)) : (i = o, r = s, a = Math.sqrt(l / 2)) | |
} | |
return new Pe(i / a, r / a) | |
} | |
for (var k = [], H = 0, V = L.length, j = V - 1, W = H + 1; H < V; H++, j++, W++) j === V && (j = 0), W === V && (W = 0), k[H] = G(L[H], L[j], L[W]); | |
var X, q, Y = [], | |
J = k.concat(); | |
for (c = 0, h = C.length; c < h; c++) { | |
for (s = C[c], X = [], H = 0, j = (V = s.length) - 1, W = H + 1; H < V; H++, j++, W++) j === V && (j = 0), W === V && (W = 0), X[H] = G(s[H], s[j], s[W]); | |
Y.push(X), J = J.concat(X) | |
} | |
for (P = 0; P < y; P++) { | |
for (D = P / y, U = g * Math.cos(D * Math.PI / 2), O = v * Math.sin(D * Math.PI / 2), H = 0, V = L.length; H < V; H++) Q((N = R(L[H], k[H], O)).x, N.y, -U); | |
for (c = 0, h = C.length; c < h; c++) | |
for (s = C[c], X = Y[c], H = 0, V = s.length; H < V; H++) Q((N = R(s[H], X[H], O)).x, N.y, -U) | |
} | |
for (O = v, H = 0; H < z; H++) N = x ? R(T[H], J[H], O) : T[H], A ? (a.copy(i.normals[0]).multiplyScalar(N.x), r.copy(i.binormals[0]).multiplyScalar(N.y), o.copy(n[0]).add(a).add(r), Q(o.x, o.y, o.z)) : Q(N.x, N.y, 0); | |
for (q = 1; q <= _; q++) | |
for (H = 0; H < z; H++) N = x ? R(T[H], J[H], O) : T[H], A ? (a.copy(i.normals[q]).multiplyScalar(N.x), r.copy(i.binormals[q]).multiplyScalar(N.y), o.copy(n[q]).add(a).add(r), Q(o.x, o.y, o.z)) : Q(N.x, N.y, m / _ * q); | |
for (P = y - 1; P >= 0; P--) { | |
for (D = P / y, U = g * Math.cos(D * Math.PI / 2), O = v * Math.sin(D * Math.PI / 2), H = 0, V = L.length; H < V; H++) Q((N = R(L[H], k[H], O)).x, N.y, m + U); | |
for (c = 0, h = C.length; c < h; c++) | |
for (s = C[c], X = Y[c], H = 0, V = s.length; H < V; H++) N = R(s[H], X[H], O), A ? Q(N.x, N.y + n[_ - 1].y, n[_ - 1].x + U) : Q(N.x, N.y, m + U) | |
} | |
function Z(t, e) { | |
var n, i; | |
for (H = t.length; --H >= 0;) { | |
n = H, (i = H - 1) < 0 && (i = t.length - 1); | |
var r = 0, | |
a = _ + 2 * y; | |
for (r = 0; r < a; r++) { | |
var o = z * r, | |
s = z * (r + 1); | |
$(e + n + o, e + i + o, e + i + s, e + n + s) | |
} | |
} | |
} | |
function Q(t, e, n) { | |
f.push(t), f.push(e), f.push(n) | |
} | |
function K(t, e, n) { | |
tt(t), tt(e), tt(n); | |
var i = u.length / 3, | |
r = M.generateTopUV(E, u, i - 3, i - 2, i - 1); | |
et(r[0]), et(r[1]), et(r[2]) | |
} | |
function $(t, e, n, i) { | |
tt(t), tt(e), tt(i), tt(e), tt(n), tt(i); | |
var r = u.length / 3, | |
a = M.generateSideWallUV(E, u, r - 6, r - 3, r - 2, r - 1); | |
et(a[0]), et(a[1]), et(a[3]), et(a[1]), et(a[2]), et(a[3]) | |
} | |
function tt(t) { | |
p.push(u.length / 3), u.push(f[3 * t + 0]), u.push(f[3 * t + 1]), u.push(f[3 * t + 2]) | |
} | |
function et(t) { | |
d.push(t.x), d.push(t.y) | |
}! function() { | |
var t = u.length / 3; | |
if (x) { | |
var e = 0, | |
n = z * e; | |
for (H = 0; H < F; H++) K((B = I[H])[2] + n, B[1] + n, B[0] + n); | |
for (n = z * (e = _ + 2 * y), H = 0; H < F; H++) K((B = I[H])[0] + n, B[1] + n, B[2] + n) | |
} else { | |
for (H = 0; H < F; H++) K((B = I[H])[2], B[1], B[0]); | |
for (H = 0; H < F; H++) K((B = I[H])[0] + z * _, B[1] + z * _, B[2] + z * _) | |
} | |
E.addGroup(t, u.length / 3 - t, 0) | |
}(), | |
function() { | |
var t = u.length / 3, | |
e = 0; | |
for (Z(L, e), e += L.length, c = 0, h = C.length; c < h; c++) Z(s = C[c], e), e += s.length; | |
E.addGroup(t, u.length / 3 - t, 1) | |
}(), e.arrays || (this.setIndex(p), this.addAttribute("position", new Pn(u, 3)), this.addAttribute("uv", new Pn(d, 2))) | |
}, Da.WorldUVGenerator = { | |
generateTopUV: function(t, e, n, i, r) { | |
var a = e[3 * n], | |
o = e[3 * n + 1], | |
s = e[3 * i], | |
c = e[3 * i + 1], | |
h = e[3 * r], | |
l = e[3 * r + 1]; | |
return [new Pe(a, o), new Pe(s, c), new Pe(h, l)] | |
}, | |
generateSideWallUV: function(t, e, n, i, r, a) { | |
var o = e[3 * n], | |
s = e[3 * n + 1], | |
c = e[3 * n + 2], | |
h = e[3 * i], | |
l = e[3 * i + 1], | |
u = e[3 * i + 2], | |
p = e[3 * r], | |
d = e[3 * r + 1], | |
f = e[3 * r + 2], | |
m = e[3 * a], | |
g = e[3 * a + 1], | |
v = e[3 * a + 2]; | |
return Math.abs(s - l) < .01 ? [new Pe(o, 1 - c), new Pe(h, 1 - u), new Pe(p, 1 - f), new Pe(m, 1 - v)] : [new Pe(s, 1 - c), new Pe(l, 1 - u), new Pe(d, 1 - f), new Pe(g, 1 - v)] | |
} | |
}, Na.prototype = Object.create(An.prototype), Na.prototype.constructor = Na, Ba.prototype = Object.create(Ua.prototype), Ba.prototype.constructor = Ba, za.prototype = Object.create(An.prototype), za.prototype.constructor = za, Fa.prototype = Object.create(Bn.prototype), Fa.prototype.constructor = Fa, Ga.prototype = Object.create(An.prototype), Ga.prototype.constructor = Ga, ka.prototype = Object.create(Bn.prototype), ka.prototype.constructor = ka, Ha.prototype = Object.create(An.prototype), Ha.prototype.constructor = Ha, Va.prototype = Object.create(Bn.prototype), Va.prototype.constructor = Va, ja.prototype = Object.create(An.prototype), ja.prototype.constructor = ja, ja.prototype.toJSON = function() { | |
var t = An.prototype.toJSON.call(this); | |
return Xa(this.parameters.shapes, t) | |
}, Wa.prototype = Object.create(Bn.prototype), Wa.prototype.constructor = Wa, Wa.prototype.toJSON = function() { | |
var t = Bn.prototype.toJSON.call(this); | |
return Xa(this.parameters.shapes, t) | |
}, qa.prototype = Object.create(Bn.prototype), qa.prototype.constructor = qa, Ya.prototype = Object.create(An.prototype), Ya.prototype.constructor = Ya, Ja.prototype = Object.create(Bn.prototype), Ja.prototype.constructor = Ja, Za.prototype = Object.create(Ya.prototype), Za.prototype.constructor = Za, Qa.prototype = Object.create(Ja.prototype), Qa.prototype.constructor = Qa, Ka.prototype = Object.create(An.prototype), Ka.prototype.constructor = Ka, $a.prototype = Object.create(Bn.prototype), $a.prototype.constructor = $a; | |
var to = Object.freeze({ | |
WireframeGeometry: jr, | |
ParametricGeometry: Wr, | |
ParametricBufferGeometry: Xr, | |
TetrahedronGeometry: Jr, | |
TetrahedronBufferGeometry: Zr, | |
OctahedronGeometry: Qr, | |
OctahedronBufferGeometry: Kr, | |
IcosahedronGeometry: $r, | |
IcosahedronBufferGeometry: ta, | |
DodecahedronGeometry: ea, | |
DodecahedronBufferGeometry: na, | |
PolyhedronGeometry: qr, | |
PolyhedronBufferGeometry: Yr, | |
TubeGeometry: ia, | |
TubeBufferGeometry: ra, | |
TorusKnotGeometry: aa, | |
TorusKnotBufferGeometry: oa, | |
TorusGeometry: sa, | |
TorusBufferGeometry: ca, | |
TextGeometry: Na, | |
TextBufferGeometry: Ba, | |
SphereGeometry: za, | |
SphereBufferGeometry: Fa, | |
RingGeometry: Ga, | |
RingBufferGeometry: ka, | |
PlaneGeometry: Gn, | |
PlaneBufferGeometry: kn, | |
LatheGeometry: Ha, | |
LatheBufferGeometry: Va, | |
ShapeGeometry: ja, | |
ShapeBufferGeometry: Wa, | |
ExtrudeGeometry: Da, | |
ExtrudeBufferGeometry: Ua, | |
EdgesGeometry: qa, | |
ConeGeometry: Za, | |
ConeBufferGeometry: Qa, | |
CylinderGeometry: Ya, | |
CylinderBufferGeometry: Ja, | |
CircleGeometry: Ka, | |
CircleBufferGeometry: $a, | |
BoxGeometry: zn, | |
BoxBufferGeometry: Fn | |
}); | |
function eo(t) { | |
Zn.call(this), this.type = "ShadowMaterial", this.color = new rn(0), this.transparent = !0, this.setValues(t) | |
} | |
function no(t) { | |
Kn.call(this, t), this.type = "RawShaderMaterial" | |
} | |
function io(t) { | |
Zn.call(this), this.defines = { | |
STANDARD: "" | |
}, this.type = "MeshStandardMaterial", this.color = new rn(16777215), this.roughness = .5, this.metalness = .5, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new rn(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.roughnessMap = null, this.metalnessMap = null, this.alphaMap = null, this.envMap = null, this.envMapIntensity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(t) | |
} | |
function ro(t) { | |
io.call(this), this.defines = { | |
PHYSICAL: "" | |
}, this.type = "MeshPhysicalMaterial", this.reflectivity = .5, this.clearCoat = 0, this.clearCoatRoughness = 0, this.setValues(t) | |
} | |
function ao(t) { | |
Zn.call(this), this.type = "MeshPhongMaterial", this.color = new rn(16777215), this.specular = new rn(1118481), this.shininess = 30, this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new rn(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = at, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(t) | |
} | |
function oo(t) { | |
ao.call(this), this.defines = { | |
TOON: "" | |
}, this.type = "MeshToonMaterial", this.gradientMap = null, this.setValues(t) | |
} | |
function so(t) { | |
Zn.call(this), this.type = "MeshNormalMaterial", this.bumpMap = null, this.bumpScale = 1, this.normalMap = null, this.normalScale = new Pe(1, 1), this.displacementMap = null, this.displacementScale = 1, this.displacementBias = 0, this.wireframe = !1, this.wireframeLinewidth = 1, this.fog = !1, this.lights = !1, this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(t) | |
} | |
function co(t) { | |
Zn.call(this), this.type = "MeshLambertMaterial", this.color = new rn(16777215), this.map = null, this.lightMap = null, this.lightMapIntensity = 1, this.aoMap = null, this.aoMapIntensity = 1, this.emissive = new rn(0), this.emissiveIntensity = 1, this.emissiveMap = null, this.specularMap = null, this.alphaMap = null, this.envMap = null, this.combine = at, this.reflectivity = 1, this.refractionRatio = .98, this.wireframe = !1, this.wireframeLinewidth = 1, this.wireframeLinecap = "round", this.wireframeLinejoin = "round", this.skinning = !1, this.morphTargets = !1, this.morphNormals = !1, this.setValues(t) | |
} | |
function ho(t) { | |
Dr.call(this), this.type = "LineDashedMaterial", this.scale = 1, this.dashSize = 3, this.gapSize = 1, this.setValues(t) | |
} | |
eo.prototype = Object.create(Zn.prototype), eo.prototype.constructor = eo, eo.prototype.isShadowMaterial = !0, eo.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.color.copy(t.color), this | |
}, no.prototype = Object.create(Kn.prototype), no.prototype.constructor = no, no.prototype.isRawShaderMaterial = !0, io.prototype = Object.create(Zn.prototype), io.prototype.constructor = io, io.prototype.isMeshStandardMaterial = !0, io.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.defines = { | |
STANDARD: "" | |
}, this.color.copy(t.color), this.roughness = t.roughness, this.metalness = t.metalness, this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.roughnessMap = t.roughnessMap, this.metalnessMap = t.metalnessMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.envMapIntensity = t.envMapIntensity, this.refractionRatio = t.refractionRatio, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this.morphNormals = t.morphNormals, this | |
}, ro.prototype = Object.create(io.prototype), ro.prototype.constructor = ro, ro.prototype.isMeshPhysicalMaterial = !0, ro.prototype.copy = function(t) { | |
return io.prototype.copy.call(this, t), this.defines = { | |
PHYSICAL: "" | |
}, this.reflectivity = t.reflectivity, this.clearCoat = t.clearCoat, this.clearCoatRoughness = t.clearCoatRoughness, this | |
}, ao.prototype = Object.create(Zn.prototype), ao.prototype.constructor = ao, ao.prototype.isMeshPhongMaterial = !0, ao.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.color.copy(t.color), this.specular.copy(t.specular), this.shininess = t.shininess, this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.specularMap = t.specularMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.combine = t.combine, this.reflectivity = t.reflectivity, this.refractionRatio = t.refractionRatio, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this.morphNormals = t.morphNormals, this | |
}, oo.prototype = Object.create(ao.prototype), oo.prototype.constructor = oo, oo.prototype.isMeshToonMaterial = !0, oo.prototype.copy = function(t) { | |
return ao.prototype.copy.call(this, t), this.gradientMap = t.gradientMap, this | |
}, so.prototype = Object.create(Zn.prototype), so.prototype.constructor = so, so.prototype.isMeshNormalMaterial = !0, so.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.bumpMap = t.bumpMap, this.bumpScale = t.bumpScale, this.normalMap = t.normalMap, this.normalScale.copy(t.normalScale), this.displacementMap = t.displacementMap, this.displacementScale = t.displacementScale, this.displacementBias = t.displacementBias, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this.morphNormals = t.morphNormals, this | |
}, co.prototype = Object.create(Zn.prototype), co.prototype.constructor = co, co.prototype.isMeshLambertMaterial = !0, co.prototype.copy = function(t) { | |
return Zn.prototype.copy.call(this, t), this.color.copy(t.color), this.map = t.map, this.lightMap = t.lightMap, this.lightMapIntensity = t.lightMapIntensity, this.aoMap = t.aoMap, this.aoMapIntensity = t.aoMapIntensity, this.emissive.copy(t.emissive), this.emissiveMap = t.emissiveMap, this.emissiveIntensity = t.emissiveIntensity, this.specularMap = t.specularMap, this.alphaMap = t.alphaMap, this.envMap = t.envMap, this.combine = t.combine, this.reflectivity = t.reflectivity, this.refractionRatio = t.refractionRatio, this.wireframe = t.wireframe, this.wireframeLinewidth = t.wireframeLinewidth, this.wireframeLinecap = t.wireframeLinecap, this.wireframeLinejoin = t.wireframeLinejoin, this.skinning = t.skinning, this.morphTargets = t.morphTargets, this.morphNormals = t.morphNormals, this | |
}, ho.prototype = Object.create(Dr.prototype), ho.prototype.constructor = ho, ho.prototype.isLineDashedMaterial = !0, ho.prototype.copy = function(t) { | |
return Dr.prototype.copy.call(this, t), this.scale = t.scale, this.dashSize = t.dashSize, this.gapSize = t.gapSize, this | |
}; | |
var lo = Object.freeze({ | |
ShadowMaterial: eo, | |
SpriteMaterial: Cr, | |
RawShaderMaterial: no, | |
ShaderMaterial: Kn, | |
PointsMaterial: zr, | |
MeshPhysicalMaterial: ro, | |
MeshStandardMaterial: io, | |
MeshPhongMaterial: ao, | |
MeshToonMaterial: oo, | |
MeshNormalMaterial: so, | |
MeshLambertMaterial: co, | |
MeshDepthMaterial: mr, | |
MeshDistanceMaterial: gr, | |
MeshBasicMaterial: Qn, | |
LineDashedMaterial: ho, | |
LineBasicMaterial: Dr, | |
Material: Zn | |
}), | |
uo = { | |
enabled: !1, | |
files: {}, | |
add: function(t, e) { | |
!1 !== this.enabled && (this.files[t] = e) | |
}, | |
get: function(t) { | |
if (!1 !== this.enabled) return this.files[t] | |
}, | |
remove: function(t) { | |
delete this.files[t] | |
}, | |
clear: function() { | |
this.files = {} | |
} | |
}; | |
function po(t, e, n) { | |
var i = this, | |
r = !1, | |
a = 0, | |
o = 0, | |
s = void 0; | |
this.onStart = void 0, this.onLoad = t, this.onProgress = e, this.onError = n, this.itemStart = function(t) { | |
o++, !1 === r && void 0 !== i.onStart && i.onStart(t, a, o), r = !0 | |
}, this.itemEnd = function(t) { | |
a++, void 0 !== i.onProgress && i.onProgress(t, a, o), a === o && (r = !1, void 0 !== i.onLoad && i.onLoad()) | |
}, this.itemError = function(t) { | |
void 0 !== i.onError && i.onError(t) | |
}, this.resolveURL = function(t) { | |
return s ? s(t) : t | |
}, this.setURLModifier = function(t) { | |
return s = t, this | |
} | |
} | |
var fo = new po, | |
mo = {}; | |
function go(t) { | |
this.manager = void 0 !== t ? t : fo | |
} | |
function vo(t) { | |
this.manager = void 0 !== t ? t : fo, this._parser = null | |
} | |
function yo(t) { | |
this.manager = void 0 !== t ? t : fo | |
} | |
function xo(t) { | |
this.manager = void 0 !== t ? t : fo | |
} | |
function wo(t) { | |
this.manager = void 0 !== t ? t : fo | |
} | |
function _o() { | |
this.type = "Curve", this.arcLengthDivisions = 200 | |
} | |
function bo(t, e, n, i, r, a, o, s) { | |
_o.call(this), this.type = "EllipseCurve", this.aX = t || 0, this.aY = e || 0, this.xRadius = n || 1, this.yRadius = i || 1, this.aStartAngle = r || 0, this.aEndAngle = a || 2 * Math.PI, this.aClockwise = o || !1, this.aRotation = s || 0 | |
} | |
function Ao(t, e, n, i, r, a) { | |
bo.call(this, t, e, n, n, i, r, a), this.type = "ArcCurve" | |
} | |
function Mo() { | |
var t = 0, | |
e = 0, | |
n = 0, | |
i = 0; | |
function r(r, a, o, s) { | |
t = r, e = o, n = -3 * r + 3 * a - 2 * o - s, i = 2 * r - 2 * a + o + s | |
} | |
return { | |
initCatmullRom: function(t, e, n, i, a) { | |
r(e, n, a * (n - t), a * (i - e)) | |
}, | |
initNonuniformCatmullRom: function(t, e, n, i, a, o, s) { | |
var c = (e - t) / a - (n - t) / (a + o) + (n - e) / o, | |
h = (n - e) / o - (i - e) / (o + s) + (i - n) / s; | |
r(e, n, c *= o, h *= o) | |
}, | |
calc: function(r) { | |
var a = r * r; | |
return t + e * r + n * a + i * (a * r) | |
} | |
} | |
} | |
Object.assign(go.prototype, { | |
load: function(t, e, n, i) { | |
void 0 === t && (t = ""), void 0 !== this.path && (t = this.path + t), t = this.manager.resolveURL(t); | |
var r = this, | |
a = uo.get(t); | |
if (void 0 !== a) return r.manager.itemStart(t), setTimeout(function() { | |
e && e(a), r.manager.itemEnd(t) | |
}, 0), a; | |
if (void 0 === mo[t]) { | |
var o = t.match(/^data:(.*?)(;base64)?,(.*)$/); | |
if (o) { | |
var s = o[1], | |
c = !!o[2], | |
h = o[3]; | |
h = window.decodeURIComponent(h), c && (h = window.atob(h)); | |
try { | |
var l, u = (this.responseType || "").toLowerCase(); | |
switch (u) { | |
case "arraybuffer": | |
case "blob": | |
for (var p = new Uint8Array(h.length), d = 0; d < h.length; d++) p[d] = h.charCodeAt(d); | |
l = "blob" === u ? new Blob([p.buffer], { | |
type: s | |
}) : p.buffer; | |
break; | |
case "document": | |
var f = new DOMParser; | |
l = f.parseFromString(h, s); | |
break; | |
case "json": | |
l = JSON.parse(h); | |
break; | |
default: | |
l = h | |
} | |
window.setTimeout(function() { | |
e && e(l), r.manager.itemEnd(t) | |
}, 0) | |
} catch (e) { | |
window.setTimeout(function() { | |
i && i(e), r.manager.itemEnd(t), r.manager.itemError(t) | |
}, 0) | |
} | |
} else { | |
mo[t] = [], mo[t].push({ | |
onLoad: e, | |
onProgress: n, | |
onError: i | |
}); | |
var m = new XMLHttpRequest; | |
for (var g in m.open("GET", t, !0), m.addEventListener("load", function(e) { | |
var n = this.response; | |
uo.add(t, n); | |
var i = mo[t]; | |
if (delete mo[t], 200 === this.status) { | |
for (var a = 0, o = i.length; a < o; a++) { | |
(s = i[a]).onLoad && s.onLoad(n) | |
} | |
r.manager.itemEnd(t) | |
} else if (0 === this.status) { | |
console.warn("THREE.FileLoader: HTTP Status 0 received."); | |
for (a = 0, o = i.length; a < o; a++) { | |
(s = i[a]).onLoad && s.onLoad(n) | |
} | |
r.manager.itemEnd(t) | |
} else { | |
for (a = 0, o = i.length; a < o; a++) { | |
var s; | |
(s = i[a]).onError && s.onError(e) | |
} | |
r.manager.itemEnd(t), r.manager.itemError(t) | |
} | |
}, !1), m.addEventListener("progress", function(e) { | |
for (var n = mo[t], i = 0, r = n.length; i < r; i++) { | |
var a = n[i]; | |
a.onProgress && a.onProgress(e) | |
} | |
}, !1), m.addEventListener("error", function(e) { | |
var n = mo[t]; | |
delete mo[t]; | |
for (var i = 0, a = n.length; i < a; i++) { | |
var o = n[i]; | |
o.onError && o.onError(e) | |
} | |
r.manager.itemEnd(t), r.manager.itemError(t) | |
}, !1), void 0 !== this.responseType && (m.responseType = this.responseType), void 0 !== this.withCredentials && (m.withCredentials = this.withCredentials), m.overrideMimeType && m.overrideMimeType(void 0 !== this.mimeType ? this.mimeType : "text/plain"), this.requestHeader) m.setRequestHeader(g, this.requestHeader[g]); | |
m.send(null) | |
} | |
return r.manager.itemStart(t), m | |
} | |
mo[t].push({ | |
onLoad: e, | |
onProgress: n, | |
onError: i | |
}) | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
}, | |
setResponseType: function(t) { | |
return this.responseType = t, this | |
}, | |
setWithCredentials: function(t) { | |
return this.withCredentials = t, this | |
}, | |
setMimeType: function(t) { | |
return this.mimeType = t, this | |
}, | |
setRequestHeader: function(t) { | |
return this.requestHeader = t, this | |
} | |
}), Object.assign(function(t) { | |
this.manager = void 0 !== t ? t : fo, this._parser = null | |
}.prototype, { | |
load: function(t, e, n, i) { | |
var r = this, | |
a = [], | |
o = new Hr; | |
o.image = a; | |
var s = new go(this.manager); | |
function c(c) { | |
s.load(t[c], function(t) { | |
var n = r._parser(t, !0); | |
a[c] = { | |
width: n.width, | |
height: n.height, | |
format: n.format, | |
mipmaps: n.mipmaps | |
}, 6 === (h += 1) && (1 === n.mipmapCount && (o.minFilter = St), o.format = n.format, o.needsUpdate = !0, e && e(o)) | |
}, n, i) | |
} | |
if (s.setPath(this.path), s.setResponseType("arraybuffer"), Array.isArray(t)) | |
for (var h = 0, l = 0, u = t.length; l < u; ++l) c(l); | |
else s.load(t, function(t) { | |
var n = r._parser(t, !0); | |
if (n.isCubemap) | |
for (var i = n.mipmaps.length / n.mipmapCount, s = 0; s < i; s++) { | |
a[s] = { | |
mipmaps: [] | |
}; | |
for (var c = 0; c < n.mipmapCount; c++) a[s].mipmaps.push(n.mipmaps[s * n.mipmapCount + c]), a[s].format = n.format, a[s].width = n.width, a[s].height = n.height | |
} else o.image.width = n.width, o.image.height = n.height, o.mipmaps = n.mipmaps; | |
1 === n.mipmapCount && (o.minFilter = St), o.format = n.format, o.needsUpdate = !0, e && e(o) | |
}, n, i); | |
return o | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
} | |
}), Object.assign(vo.prototype, { | |
load: function(t, e, n, i) { | |
var r = this, | |
a = new Ye, | |
o = new go(this.manager); | |
return o.setResponseType("arraybuffer"), o.load(t, function(t) { | |
var n = r._parser(t); | |
n && (void 0 !== n.image ? a.image = n.image : void 0 !== n.data && (a.image.width = n.width, a.image.height = n.height, a.image.data = n.data), a.wrapS = void 0 !== n.wrapS ? n.wrapS : _t, a.wrapT = void 0 !== n.wrapT ? n.wrapT : _t, a.magFilter = void 0 !== n.magFilter ? n.magFilter : St, a.minFilter = void 0 !== n.minFilter ? n.minFilter : Ct, a.anisotropy = void 0 !== n.anisotropy ? n.anisotropy : 1, void 0 !== n.format && (a.format = n.format), void 0 !== n.type && (a.type = n.type), void 0 !== n.mipmaps && (a.mipmaps = n.mipmaps), 1 === n.mipmapCount && (a.minFilter = St), a.needsUpdate = !0, e && e(a, n)) | |
}, n, i), a | |
} | |
}), Object.assign(yo.prototype, { | |
crossOrigin: "Anonymous", | |
load: function(t, e, n, i) { | |
void 0 === t && (t = ""), void 0 !== this.path && (t = this.path + t), t = this.manager.resolveURL(t); | |
var r = this, | |
a = uo.get(t); | |
if (void 0 !== a) return r.manager.itemStart(t), setTimeout(function() { | |
e && e(a), r.manager.itemEnd(t) | |
}, 0), a; | |
var o = document.createElementNS("http://www.w3.org/1999/xhtml", "img"); | |
return o.addEventListener("load", function() { | |
uo.add(t, this), e && e(this), r.manager.itemEnd(t) | |
}, !1), o.addEventListener("error", function(e) { | |
i && i(e), r.manager.itemEnd(t), r.manager.itemError(t) | |
}, !1), "data:" !== t.substr(0, 5) && void 0 !== this.crossOrigin && (o.crossOrigin = this.crossOrigin), r.manager.itemStart(t), o.src = t, o | |
}, | |
setCrossOrigin: function(t) { | |
return this.crossOrigin = t, this | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
} | |
}), Object.assign(xo.prototype, { | |
crossOrigin: "Anonymous", | |
load: function(t, e, n, i) { | |
var r = new ri, | |
a = new yo(this.manager); | |
a.setCrossOrigin(this.crossOrigin), a.setPath(this.path); | |
var o = 0; | |
function s(n) { | |
a.load(t[n], function(t) { | |
r.images[n] = t, 6 === ++o && (r.needsUpdate = !0, e && e(r)) | |
}, void 0, i) | |
} | |
for (var c = 0; c < t.length; ++c) s(c); | |
return r | |
}, | |
setCrossOrigin: function(t) { | |
return this.crossOrigin = t, this | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
} | |
}), Object.assign(wo.prototype, { | |
crossOrigin: "Anonymous", | |
load: function(t, e, n, i) { | |
var r = new je, | |
a = new yo(this.manager); | |
return a.setCrossOrigin(this.crossOrigin), a.setPath(this.path), a.load(t, function(n) { | |
r.image = n; | |
var i = t.search(/\.(jpg|jpeg)$/) > 0 || 0 === t.search(/^data\:image\/jpeg/); | |
r.format = i ? Ht : Vt, r.needsUpdate = !0, void 0 !== e && e(r) | |
}, n, i), r | |
}, | |
setCrossOrigin: function(t) { | |
return this.crossOrigin = t, this | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
} | |
}), Object.assign(_o.prototype, { | |
getPoint: function() { | |
return console.warn("THREE.Curve: .getPoint() not implemented."), null | |
}, | |
getPointAt: function(t, e) { | |
var n = this.getUtoTmapping(t); | |
return this.getPoint(n, e) | |
}, | |
getPoints: function(t) { | |
void 0 === t && (t = 5); | |
for (var e = [], n = 0; n <= t; n++) e.push(this.getPoint(n / t)); | |
return e | |
}, | |
getSpacedPoints: function(t) { | |
void 0 === t && (t = 5); | |
for (var e = [], n = 0; n <= t; n++) e.push(this.getPointAt(n / t)); | |
return e | |
}, | |
getLength: function() { | |
var t = this.getLengths(); | |
return t[t.length - 1] | |
}, | |
getLengths: function(t) { | |
if (void 0 === t && (t = this.arcLengthDivisions), this.cacheArcLengths && this.cacheArcLengths.length === t + 1 && !this.needsUpdate) return this.cacheArcLengths; | |
this.needsUpdate = !1; | |
var e, n, i = [], | |
r = this.getPoint(0), | |
a = 0; | |
for (i.push(0), n = 1; n <= t; n++) a += (e = this.getPoint(n / t)).distanceTo(r), i.push(a), r = e; | |
return this.cacheArcLengths = i, i | |
}, | |
updateArcLengths: function() { | |
this.needsUpdate = !0, this.getLengths() | |
}, | |
getUtoTmapping: function(t, e) { | |
var n, i = this.getLengths(), | |
r = 0, | |
a = i.length; | |
n = e || t * i[a - 1]; | |
for (var o, s = 0, c = a - 1; s <= c;) | |
if ((o = i[r = Math.floor(s + (c - s) / 2)] - n) < 0) s = r + 1; | |
else { | |
if (!(o > 0)) { | |
c = r; | |
break | |
} | |
c = r - 1 | |
} | |
if (i[r = c] === n) return r / (a - 1); | |
var h = i[r]; | |
return (r + (n - h) / (i[r + 1] - h)) / (a - 1) | |
}, | |
getTangent: function(t) { | |
var e = t - 1e-4, | |
n = t + 1e-4; | |
e < 0 && (e = 0), n > 1 && (n = 1); | |
var i = this.getPoint(e); | |
return this.getPoint(n).clone().sub(i).normalize() | |
}, | |
getTangentAt: function(t) { | |
var e = this.getUtoTmapping(t); | |
return this.getTangent(e) | |
}, | |
computeFrenetFrames: function(t, e) { | |
var n, i, r, a = new Ue, | |
o = [], | |
s = [], | |
c = [], | |
h = new Ue, | |
l = new Oe; | |
for (n = 0; n <= t; n++) i = n / t, o[n] = this.getTangentAt(i), o[n].normalize(); | |
s[0] = new Ue, c[0] = new Ue; | |
var u = Number.MAX_VALUE, | |
p = Math.abs(o[0].x), | |
d = Math.abs(o[0].y), | |
f = Math.abs(o[0].z); | |
for (p <= u && (u = p, a.set(1, 0, 0)), d <= u && (u = d, a.set(0, 1, 0)), f <= u && a.set(0, 0, 1), h.crossVectors(o[0], a).normalize(), s[0].crossVectors(o[0], h), c[0].crossVectors(o[0], s[0]), n = 1; n <= t; n++) s[n] = s[n - 1].clone(), c[n] = c[n - 1].clone(), h.crossVectors(o[n - 1], o[n]), h.length() > Number.EPSILON && (h.normalize(), r = Math.acos(Re.clamp(o[n - 1].dot(o[n]), -1, 1)), s[n].applyMatrix4(l.makeRotationAxis(h, r))), c[n].crossVectors(o[n], s[n]); | |
if (!0 === e) | |
for (r = Math.acos(Re.clamp(s[0].dot(s[t]), -1, 1)), r /= t, o[0].dot(h.crossVectors(s[0], s[t])) > 0 && (r = -r), n = 1; n <= t; n++) s[n].applyMatrix4(l.makeRotationAxis(o[n], r * n)), c[n].crossVectors(o[n], s[n]); | |
return { | |
tangents: o, | |
normals: s, | |
binormals: c | |
} | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.arcLengthDivisions = t.arcLengthDivisions, this | |
}, | |
toJSON: function() { | |
var t = { | |
metadata: { | |
version: 4.5, | |
type: "Curve", | |
generator: "Curve.toJSON" | |
} | |
}; | |
return t.arcLengthDivisions = this.arcLengthDivisions, t.type = this.type, t | |
}, | |
fromJSON: function(t) { | |
return this.arcLengthDivisions = t.arcLengthDivisions, this | |
} | |
}), bo.prototype = Object.create(_o.prototype), bo.prototype.constructor = bo, bo.prototype.isEllipseCurve = !0, bo.prototype.getPoint = function(t, e) { | |
for (var n = e || new Pe, i = 2 * Math.PI, r = this.aEndAngle - this.aStartAngle, a = Math.abs(r) < Number.EPSILON; r < 0;) r += i; | |
for (; r > i;) r -= i; | |
r < Number.EPSILON && (r = a ? 0 : i), !0 !== this.aClockwise || a || (r === i ? r = -i : r -= i); | |
var o = this.aStartAngle + t * r, | |
s = this.aX + this.xRadius * Math.cos(o), | |
c = this.aY + this.yRadius * Math.sin(o); | |
if (0 !== this.aRotation) { | |
var h = Math.cos(this.aRotation), | |
l = Math.sin(this.aRotation), | |
u = s - this.aX, | |
p = c - this.aY; | |
s = u * h - p * l + this.aX, c = u * l + p * h + this.aY | |
} | |
return n.set(s, c) | |
}, bo.prototype.copy = function(t) { | |
return _o.prototype.copy.call(this, t), this.aX = t.aX, this.aY = t.aY, this.xRadius = t.xRadius, this.yRadius = t.yRadius, this.aStartAngle = t.aStartAngle, this.aEndAngle = t.aEndAngle, this.aClockwise = t.aClockwise, this.aRotation = t.aRotation, this | |
}, bo.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
return t.aX = this.aX, t.aY = this.aY, t.xRadius = this.xRadius, t.yRadius = this.yRadius, t.aStartAngle = this.aStartAngle, t.aEndAngle = this.aEndAngle, t.aClockwise = this.aClockwise, t.aRotation = this.aRotation, t | |
}, bo.prototype.fromJSON = function(t) { | |
return _o.prototype.fromJSON.call(this, t), this.aX = t.aX, this.aY = t.aY, this.xRadius = t.xRadius, this.yRadius = t.yRadius, this.aStartAngle = t.aStartAngle, this.aEndAngle = t.aEndAngle, this.aClockwise = t.aClockwise, this.aRotation = t.aRotation, this | |
}, Ao.prototype = Object.create(bo.prototype), Ao.prototype.constructor = Ao, Ao.prototype.isArcCurve = !0; | |
var Eo = new Ue, | |
So = new Mo, | |
To = new Mo, | |
Co = new Mo; | |
function Io(t, e, n, i) { | |
_o.call(this), this.type = "CatmullRomCurve3", this.points = t || [], this.closed = e || !1, this.curveType = n || "centripetal", this.tension = i || .5 | |
} | |
function Lo(t, e, n, i, r) { | |
var a = .5 * (i - e), | |
o = .5 * (r - n), | |
s = t * t; | |
return (2 * n - 2 * i + a + o) * (t * s) + (-3 * n + 3 * i - 2 * a - o) * s + a * t + n | |
} | |
function Ro(t, e, n, i) { | |
return function(t, e) { | |
var n = 1 - t; | |
return n * n * e | |
}(t, e) + function(t, e) { | |
return 2 * (1 - t) * t * e | |
}(t, n) + function(t, e) { | |
return t * t * e | |
}(t, i) | |
} | |
function Po(t, e, n, i, r) { | |
return function(t, e) { | |
var n = 1 - t; | |
return n * n * n * e | |
}(t, e) + function(t, e) { | |
var n = 1 - t; | |
return 3 * n * n * t * e | |
}(t, n) + function(t, e) { | |
return 3 * (1 - t) * t * t * e | |
}(t, i) + function(t, e) { | |
return t * t * t * e | |
}(t, r) | |
} | |
function Oo(t, e, n, i) { | |
_o.call(this), this.type = "CubicBezierCurve", this.v0 = t || new Pe, this.v1 = e || new Pe, this.v2 = n || new Pe, this.v3 = i || new Pe | |
} | |
function Do(t, e, n, i) { | |
_o.call(this), this.type = "CubicBezierCurve3", this.v0 = t || new Ue, this.v1 = e || new Ue, this.v2 = n || new Ue, this.v3 = i || new Ue | |
} | |
function Uo(t, e) { | |
_o.call(this), this.type = "LineCurve", this.v1 = t || new Pe, this.v2 = e || new Pe | |
} | |
function No(t, e) { | |
_o.call(this), this.type = "LineCurve3", this.v1 = t || new Ue, this.v2 = e || new Ue | |
} | |
function Bo(t, e, n) { | |
_o.call(this), this.type = "QuadraticBezierCurve", this.v0 = t || new Pe, this.v1 = e || new Pe, this.v2 = n || new Pe | |
} | |
function zo(t, e, n) { | |
_o.call(this), this.type = "QuadraticBezierCurve3", this.v0 = t || new Ue, this.v1 = e || new Ue, this.v2 = n || new Ue | |
} | |
function Fo(t) { | |
_o.call(this), this.type = "SplineCurve", this.points = t || [] | |
} | |
Io.prototype = Object.create(_o.prototype), Io.prototype.constructor = Io, Io.prototype.isCatmullRomCurve3 = !0, Io.prototype.getPoint = function(t, e) { | |
var n, i, r, a, o = e || new Ue, | |
s = this.points, | |
c = s.length, | |
h = (c - (this.closed ? 0 : 1)) * t, | |
l = Math.floor(h), | |
u = h - l; | |
if (this.closed ? l += l > 0 ? 0 : (Math.floor(Math.abs(l) / s.length) + 1) * s.length : 0 === u && l === c - 1 && (l = c - 2, u = 1), this.closed || l > 0 ? n = s[(l - 1) % c] : (Eo.subVectors(s[0], s[1]).add(s[0]), n = Eo), i = s[l % c], r = s[(l + 1) % c], this.closed || l + 2 < c ? a = s[(l + 2) % c] : (Eo.subVectors(s[c - 1], s[c - 2]).add(s[c - 1]), a = Eo), "centripetal" === this.curveType || "chordal" === this.curveType) { | |
var p = "chordal" === this.curveType ? .5 : .25, | |
d = Math.pow(n.distanceToSquared(i), p), | |
f = Math.pow(i.distanceToSquared(r), p), | |
m = Math.pow(r.distanceToSquared(a), p); | |
f < 1e-4 && (f = 1), d < 1e-4 && (d = f), m < 1e-4 && (m = f), So.initNonuniformCatmullRom(n.x, i.x, r.x, a.x, d, f, m), To.initNonuniformCatmullRom(n.y, i.y, r.y, a.y, d, f, m), Co.initNonuniformCatmullRom(n.z, i.z, r.z, a.z, d, f, m) | |
} else "catmullrom" === this.curveType && (So.initCatmullRom(n.x, i.x, r.x, a.x, this.tension), To.initCatmullRom(n.y, i.y, r.y, a.y, this.tension), Co.initCatmullRom(n.z, i.z, r.z, a.z, this.tension)); | |
return o.set(So.calc(u), To.calc(u), Co.calc(u)), o | |
}, Io.prototype.copy = function(t) { | |
_o.prototype.copy.call(this, t), this.points = []; | |
for (var e = 0, n = t.points.length; e < n; e++) { | |
var i = t.points[e]; | |
this.points.push(i.clone()) | |
} | |
return this.closed = t.closed, this.curveType = t.curveType, this.tension = t.tension, this | |
}, Io.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
t.points = []; | |
for (var e = 0, n = this.points.length; e < n; e++) { | |
var i = this.points[e]; | |
t.points.push(i.toArray()) | |
} | |
return t.closed = this.closed, t.curveType = this.curveType, t.tension = this.tension, t | |
}, Io.prototype.fromJSON = function(t) { | |
_o.prototype.fromJSON.call(this, t), this.points = []; | |
for (var e = 0, n = t.points.length; e < n; e++) { | |
var i = t.points[e]; | |
this.points.push((new Ue).fromArray(i)) | |
} | |
return this.closed = t.closed, this.curveType = t.curveType, this.tension = t.tension, this | |
}, Oo.prototype = Object.create(_o.prototype), Oo.prototype.constructor = Oo, Oo.prototype.isCubicBezierCurve = !0, Oo.prototype.getPoint = function(t, e) { | |
var n = e || new Pe, | |
i = this.v0, | |
r = this.v1, | |
a = this.v2, | |
o = this.v3; | |
return n.set(Po(t, i.x, r.x, a.x, o.x), Po(t, i.y, r.y, a.y, o.y)), n | |
}, Oo.prototype.copy = function(t) { | |
return _o.prototype.copy.call(this, t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this.v3.copy(t.v3), this | |
}, Oo.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t.v3 = this.v3.toArray(), t | |
}, Oo.prototype.fromJSON = function(t) { | |
return _o.prototype.fromJSON.call(this, t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this.v3.fromArray(t.v3), this | |
}, Do.prototype = Object.create(_o.prototype), Do.prototype.constructor = Do, Do.prototype.isCubicBezierCurve3 = !0, Do.prototype.getPoint = function(t, e) { | |
var n = e || new Ue, | |
i = this.v0, | |
r = this.v1, | |
a = this.v2, | |
o = this.v3; | |
return n.set(Po(t, i.x, r.x, a.x, o.x), Po(t, i.y, r.y, a.y, o.y), Po(t, i.z, r.z, a.z, o.z)), n | |
}, Do.prototype.copy = function(t) { | |
return _o.prototype.copy.call(this, t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this.v3.copy(t.v3), this | |
}, Do.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t.v3 = this.v3.toArray(), t | |
}, Do.prototype.fromJSON = function(t) { | |
return _o.prototype.fromJSON.call(this, t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this.v3.fromArray(t.v3), this | |
}, Uo.prototype = Object.create(_o.prototype), Uo.prototype.constructor = Uo, Uo.prototype.isLineCurve = !0, Uo.prototype.getPoint = function(t, e) { | |
var n = e || new Pe; | |
return 1 === t ? n.copy(this.v2) : (n.copy(this.v2).sub(this.v1), n.multiplyScalar(t).add(this.v1)), n | |
}, Uo.prototype.getPointAt = function(t, e) { | |
return this.getPoint(t, e) | |
}, Uo.prototype.getTangent = function() { | |
return this.v2.clone().sub(this.v1).normalize() | |
}, Uo.prototype.copy = function(t) { | |
return _o.prototype.copy.call(this, t), this.v1.copy(t.v1), this.v2.copy(t.v2), this | |
}, Uo.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
return t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t | |
}, Uo.prototype.fromJSON = function(t) { | |
return _o.prototype.fromJSON.call(this, t), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this | |
}, No.prototype = Object.create(_o.prototype), No.prototype.constructor = No, No.prototype.isLineCurve3 = !0, No.prototype.getPoint = function(t, e) { | |
var n = e || new Ue; | |
return 1 === t ? n.copy(this.v2) : (n.copy(this.v2).sub(this.v1), n.multiplyScalar(t).add(this.v1)), n | |
}, No.prototype.getPointAt = function(t, e) { | |
return this.getPoint(t, e) | |
}, No.prototype.copy = function(t) { | |
return _o.prototype.copy.call(this, t), this.v1.copy(t.v1), this.v2.copy(t.v2), this | |
}, No.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
return t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t | |
}, No.prototype.fromJSON = function(t) { | |
return _o.prototype.fromJSON.call(this, t), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this | |
}, Bo.prototype = Object.create(_o.prototype), Bo.prototype.constructor = Bo, Bo.prototype.isQuadraticBezierCurve = !0, Bo.prototype.getPoint = function(t, e) { | |
var n = e || new Pe, | |
i = this.v0, | |
r = this.v1, | |
a = this.v2; | |
return n.set(Ro(t, i.x, r.x, a.x), Ro(t, i.y, r.y, a.y)), n | |
}, Bo.prototype.copy = function(t) { | |
return _o.prototype.copy.call(this, t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this | |
}, Bo.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t | |
}, Bo.prototype.fromJSON = function(t) { | |
return _o.prototype.fromJSON.call(this, t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this | |
}, zo.prototype = Object.create(_o.prototype), zo.prototype.constructor = zo, zo.prototype.isQuadraticBezierCurve3 = !0, zo.prototype.getPoint = function(t, e) { | |
var n = e || new Ue, | |
i = this.v0, | |
r = this.v1, | |
a = this.v2; | |
return n.set(Ro(t, i.x, r.x, a.x), Ro(t, i.y, r.y, a.y), Ro(t, i.z, r.z, a.z)), n | |
}, zo.prototype.copy = function(t) { | |
return _o.prototype.copy.call(this, t), this.v0.copy(t.v0), this.v1.copy(t.v1), this.v2.copy(t.v2), this | |
}, zo.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
return t.v0 = this.v0.toArray(), t.v1 = this.v1.toArray(), t.v2 = this.v2.toArray(), t | |
}, zo.prototype.fromJSON = function(t) { | |
return _o.prototype.fromJSON.call(this, t), this.v0.fromArray(t.v0), this.v1.fromArray(t.v1), this.v2.fromArray(t.v2), this | |
}, Fo.prototype = Object.create(_o.prototype), Fo.prototype.constructor = Fo, Fo.prototype.isSplineCurve = !0, Fo.prototype.getPoint = function(t, e) { | |
var n = e || new Pe, | |
i = this.points, | |
r = (i.length - 1) * t, | |
a = Math.floor(r), | |
o = r - a, | |
s = i[0 === a ? a : a - 1], | |
c = i[a], | |
h = i[a > i.length - 2 ? i.length - 1 : a + 1], | |
l = i[a > i.length - 3 ? i.length - 1 : a + 2]; | |
return n.set(Lo(o, s.x, c.x, h.x, l.x), Lo(o, s.y, c.y, h.y, l.y)), n | |
}, Fo.prototype.copy = function(t) { | |
_o.prototype.copy.call(this, t), this.points = []; | |
for (var e = 0, n = t.points.length; e < n; e++) { | |
var i = t.points[e]; | |
this.points.push(i.clone()) | |
} | |
return this | |
}, Fo.prototype.toJSON = function() { | |
var t = _o.prototype.toJSON.call(this); | |
t.points = []; | |
for (var e = 0, n = this.points.length; e < n; e++) { | |
var i = this.points[e]; | |
t.points.push(i.toArray()) | |
} | |
return t | |
}, Fo.prototype.fromJSON = function(t) { | |
_o.prototype.fromJSON.call(this, t), this.points = []; | |
for (var e = 0, n = t.points.length; e < n; e++) { | |
var i = t.points[e]; | |
this.points.push((new Pe).fromArray(i)) | |
} | |
return this | |
}; | |
var Go = Object.freeze({ | |
ArcCurve: Ao, | |
CatmullRomCurve3: Io, | |
CubicBezierCurve: Oo, | |
CubicBezierCurve3: Do, | |
EllipseCurve: bo, | |
LineCurve: Uo, | |
LineCurve3: No, | |
QuadraticBezierCurve: Bo, | |
QuadraticBezierCurve3: zo, | |
SplineCurve: Fo | |
}); | |
function ko() { | |
_o.call(this), this.type = "CurvePath", this.curves = [], this.autoClose = !1 | |
} | |
function Ho(t) { | |
ko.call(this), this.type = "Path", this.currentPoint = new Pe, t && this.setFromPoints(t) | |
} | |
function Vo(t) { | |
Ho.call(this, t), this.uuid = Re.generateUUID(), this.type = "Shape", this.holes = [] | |
} | |
function jo(t, e) { | |
gn.call(this), this.type = "Light", this.color = new rn(t), this.intensity = void 0 !== e ? e : 1, this.receiveShadow = void 0 | |
} | |
function Wo(t, e, n) { | |
jo.call(this, t, n), this.type = "HemisphereLight", this.castShadow = void 0, this.position.copy(gn.DefaultUp), this.updateMatrix(), this.groundColor = new rn(e) | |
} | |
function Xo(t) { | |
this.camera = t, this.bias = 0, this.radius = 1, this.mapSize = new Pe(512, 512), this.map = null, this.matrix = new Oe | |
} | |
function qo() { | |
Xo.call(this, new _r(50, 1, .5, 500)) | |
} | |
function Yo(t, e, n, i, r, a) { | |
jo.call(this, t, e), this.type = "SpotLight", this.position.copy(gn.DefaultUp), this.updateMatrix(), this.target = new gn, Object.defineProperty(this, "power", { | |
get: function() { | |
return this.intensity * Math.PI | |
}, | |
set: function(t) { | |
this.intensity = t / Math.PI | |
} | |
}), this.distance = void 0 !== n ? n : 0, this.angle = void 0 !== i ? i : Math.PI / 3, this.penumbra = void 0 !== r ? r : 0, this.decay = void 0 !== a ? a : 1, this.shadow = new qo | |
} | |
function Jo(t, e, n, i) { | |
jo.call(this, t, e), this.type = "PointLight", Object.defineProperty(this, "power", { | |
get: function() { | |
return 4 * this.intensity * Math.PI | |
}, | |
set: function(t) { | |
this.intensity = t / (4 * Math.PI) | |
} | |
}), this.distance = void 0 !== n ? n : 0, this.decay = void 0 !== i ? i : 1, this.shadow = new Xo(new _r(90, 1, .5, 500)) | |
} | |
function Zo() { | |
Xo.call(this, new yn(-5, 5, 5, -5, .5, 500)) | |
} | |
function Qo(t, e) { | |
jo.call(this, t, e), this.type = "DirectionalLight", this.position.copy(gn.DefaultUp), this.updateMatrix(), this.target = new gn, this.shadow = new Zo | |
} | |
function Ko(t, e) { | |
jo.call(this, t, e), this.type = "AmbientLight", this.castShadow = void 0 | |
} | |
function $o(t, e, n, i) { | |
jo.call(this, t, e), this.type = "RectAreaLight", this.width = void 0 !== n ? n : 10, this.height = void 0 !== i ? i : 10 | |
} | |
function ts(t, e, n, i) { | |
us.call(this, t, e, n, i) | |
} | |
function es(t, e, n) { | |
us.call(this, t, e, n) | |
} | |
function ns(t, e, n, i) { | |
this.parameterPositions = t, this._cachedIndex = 0, this.resultBuffer = void 0 !== i ? i : new e.constructor(n), this.sampleValues = e, this.valueSize = n | |
} | |
function is(t, e, n, i) { | |
ns.call(this, t, e, n, i) | |
} | |
function rs(t, e, n, i) { | |
us.call(this, t, e, n, i) | |
} | |
function as(t, e, n, i) { | |
us.call(this, t, e, n, i) | |
} | |
function os(t, e, n, i) { | |
us.call(this, t, e, n, i) | |
} | |
function ss(t, e, n, i) { | |
ns.call(this, t, e, n, i), this._weightPrev = -0, this._offsetPrev = -0, this._weightNext = -0, this._offsetNext = -0 | |
} | |
function cs(t, e, n, i) { | |
ns.call(this, t, e, n, i) | |
} | |
function hs(t, e, n, i) { | |
ns.call(this, t, e, n, i) | |
} | |
ko.prototype = Object.assign(Object.create(_o.prototype), { | |
constructor: ko, | |
add: function(t) { | |
this.curves.push(t) | |
}, | |
closePath: function() { | |
var t = this.curves[0].getPoint(0), | |
e = this.curves[this.curves.length - 1].getPoint(1); | |
t.equals(e) || this.curves.push(new Uo(e, t)) | |
}, | |
getPoint: function(t) { | |
for (var e = t * this.getLength(), n = this.getCurveLengths(), i = 0; i < n.length;) { | |
if (n[i] >= e) { | |
var r = n[i] - e, | |
a = this.curves[i], | |
o = a.getLength(), | |
s = 0 === o ? 0 : 1 - r / o; | |
return a.getPointAt(s) | |
} | |
i++ | |
} | |
return null | |
}, | |
getLength: function() { | |
var t = this.getCurveLengths(); | |
return t[t.length - 1] | |
}, | |
updateArcLengths: function() { | |
this.needsUpdate = !0, this.cacheLengths = null, this.getCurveLengths() | |
}, | |
getCurveLengths: function() { | |
if (this.cacheLengths && this.cacheLengths.length === this.curves.length) return this.cacheLengths; | |
for (var t = [], e = 0, n = 0, i = this.curves.length; n < i; n++) e += this.curves[n].getLength(), t.push(e); | |
return this.cacheLengths = t, t | |
}, | |
getSpacedPoints: function(t) { | |
void 0 === t && (t = 40); | |
for (var e = [], n = 0; n <= t; n++) e.push(this.getPoint(n / t)); | |
return this.autoClose && e.push(e[0]), e | |
}, | |
getPoints: function(t) { | |
t = t || 12; | |
for (var e, n = [], i = 0, r = this.curves; i < r.length; i++) | |
for (var a = r[i], o = a && a.isEllipseCurve ? 2 * t : a && a.isLineCurve ? 1 : a && a.isSplineCurve ? t * a.points.length : t, s = a.getPoints(o), c = 0; c < s.length; c++) { | |
var h = s[c]; | |
e && e.equals(h) || (n.push(h), e = h) | |
} | |
return this.autoClose && n.length > 1 && !n[n.length - 1].equals(n[0]) && n.push(n[0]), n | |
}, | |
copy: function(t) { | |
_o.prototype.copy.call(this, t), this.curves = []; | |
for (var e = 0, n = t.curves.length; e < n; e++) { | |
var i = t.curves[e]; | |
this.curves.push(i.clone()) | |
} | |
return this.autoClose = t.autoClose, this | |
}, | |
toJSON: function() { | |
var t = _o.prototype.toJSON.call(this); | |
t.autoClose = this.autoClose, t.curves = []; | |
for (var e = 0, n = this.curves.length; e < n; e++) { | |
var i = this.curves[e]; | |
t.curves.push(i.toJSON()) | |
} | |
return t | |
}, | |
fromJSON: function(t) { | |
_o.prototype.fromJSON.call(this, t), this.autoClose = t.autoClose, this.curves = []; | |
for (var e = 0, n = t.curves.length; e < n; e++) { | |
var i = t.curves[e]; | |
this.curves.push((new Go[i.type]).fromJSON(i)) | |
} | |
return this | |
} | |
}), Ho.prototype = Object.assign(Object.create(ko.prototype), { | |
constructor: Ho, | |
setFromPoints: function(t) { | |
this.moveTo(t[0].x, t[0].y); | |
for (var e = 1, n = t.length; e < n; e++) this.lineTo(t[e].x, t[e].y) | |
}, | |
moveTo: function(t, e) { | |
this.currentPoint.set(t, e) | |
}, | |
lineTo: function(t, e) { | |
var n = new Uo(this.currentPoint.clone(), new Pe(t, e)); | |
this.curves.push(n), this.currentPoint.set(t, e) | |
}, | |
quadraticCurveTo: function(t, e, n, i) { | |
var r = new Bo(this.currentPoint.clone(), new Pe(t, e), new Pe(n, i)); | |
this.curves.push(r), this.currentPoint.set(n, i) | |
}, | |
bezierCurveTo: function(t, e, n, i, r, a) { | |
var o = new Oo(this.currentPoint.clone(), new Pe(t, e), new Pe(n, i), new Pe(r, a)); | |
this.curves.push(o), this.currentPoint.set(r, a) | |
}, | |
splineThru: function(t) { | |
var e = new Fo([this.currentPoint.clone()].concat(t)); | |
this.curves.push(e), this.currentPoint.copy(t[t.length - 1]) | |
}, | |
arc: function(t, e, n, i, r, a) { | |
var o = this.currentPoint.x, | |
s = this.currentPoint.y; | |
this.absarc(t + o, e + s, n, i, r, a) | |
}, | |
absarc: function(t, e, n, i, r, a) { | |
this.absellipse(t, e, n, n, i, r, a) | |
}, | |
ellipse: function(t, e, n, i, r, a, o, s) { | |
var c = this.currentPoint.x, | |
h = this.currentPoint.y; | |
this.absellipse(t + c, e + h, n, i, r, a, o, s) | |
}, | |
absellipse: function(t, e, n, i, r, a, o, s) { | |
var c = new bo(t, e, n, i, r, a, o, s); | |
if (this.curves.length > 0) { | |
var h = c.getPoint(0); | |
h.equals(this.currentPoint) || this.lineTo(h.x, h.y) | |
} | |
this.curves.push(c); | |
var l = c.getPoint(1); | |
this.currentPoint.copy(l) | |
}, | |
copy: function(t) { | |
return ko.prototype.copy.call(this, t), this.currentPoint.copy(t.currentPoint), this | |
}, | |
toJSON: function() { | |
var t = ko.prototype.toJSON.call(this); | |
return t.currentPoint = this.currentPoint.toArray(), t | |
}, | |
fromJSON: function(t) { | |
return ko.prototype.fromJSON.call(this, t), this.currentPoint.fromArray(t.currentPoint), this | |
} | |
}), Vo.prototype = Object.assign(Object.create(Ho.prototype), { | |
constructor: Vo, | |
getPointsHoles: function(t) { | |
for (var e = [], n = 0, i = this.holes.length; n < i; n++) e[n] = this.holes[n].getPoints(t); | |
return e | |
}, | |
extractPoints: function(t) { | |
return { | |
shape: this.getPoints(t), | |
holes: this.getPointsHoles(t) | |
} | |
}, | |
copy: function(t) { | |
Ho.prototype.copy.call(this, t), this.holes = []; | |
for (var e = 0, n = t.holes.length; e < n; e++) { | |
var i = t.holes[e]; | |
this.holes.push(i.clone()) | |
} | |
return this | |
}, | |
toJSON: function() { | |
var t = Ho.prototype.toJSON.call(this); | |
t.uuid = this.uuid, t.holes = []; | |
for (var e = 0, n = this.holes.length; e < n; e++) { | |
var i = this.holes[e]; | |
t.holes.push(i.toJSON()) | |
} | |
return t | |
}, | |
fromJSON: function(t) { | |
Ho.prototype.fromJSON.call(this, t), this.uuid = t.uuid, this.holes = []; | |
for (var e = 0, n = t.holes.length; e < n; e++) { | |
var i = t.holes[e]; | |
this.holes.push((new Ho).fromJSON(i)) | |
} | |
return this | |
} | |
}), jo.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: jo, | |
isLight: !0, | |
copy: function(t) { | |
return gn.prototype.copy.call(this, t), this.color.copy(t.color), this.intensity = t.intensity, this | |
}, | |
toJSON: function(t) { | |
var e = gn.prototype.toJSON.call(this, t); | |
return e.object.color = this.color.getHex(), e.object.intensity = this.intensity, void 0 !== this.groundColor && (e.object.groundColor = this.groundColor.getHex()), void 0 !== this.distance && (e.object.distance = this.distance), void 0 !== this.angle && (e.object.angle = this.angle), void 0 !== this.decay && (e.object.decay = this.decay), void 0 !== this.penumbra && (e.object.penumbra = this.penumbra), void 0 !== this.shadow && (e.object.shadow = this.shadow.toJSON()), e | |
} | |
}), Wo.prototype = Object.assign(Object.create(jo.prototype), { | |
constructor: Wo, | |
isHemisphereLight: !0, | |
copy: function(t) { | |
return jo.prototype.copy.call(this, t), this.groundColor.copy(t.groundColor), this | |
} | |
}), Object.assign(Xo.prototype, { | |
copy: function(t) { | |
return this.camera = t.camera.clone(), this.bias = t.bias, this.radius = t.radius, this.mapSize.copy(t.mapSize), this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
toJSON: function() { | |
var t = {}; | |
return 0 !== this.bias && (t.bias = this.bias), 1 !== this.radius && (t.radius = this.radius), 512 === this.mapSize.x && 512 === this.mapSize.y || (t.mapSize = this.mapSize.toArray()), t.camera = this.camera.toJSON(!1).object, delete t.camera.matrix, t | |
} | |
}), qo.prototype = Object.assign(Object.create(Xo.prototype), { | |
constructor: qo, | |
isSpotLightShadow: !0, | |
update: function(t) { | |
var e = this.camera, | |
n = 2 * Re.RAD2DEG * t.angle, | |
i = this.mapSize.width / this.mapSize.height, | |
r = t.distance || e.far; | |
n === e.fov && i === e.aspect && r === e.far || (e.fov = n, e.aspect = i, e.far = r, e.updateProjectionMatrix()) | |
} | |
}), Yo.prototype = Object.assign(Object.create(jo.prototype), { | |
constructor: Yo, | |
isSpotLight: !0, | |
copy: function(t) { | |
return jo.prototype.copy.call(this, t), this.distance = t.distance, this.angle = t.angle, this.penumbra = t.penumbra, this.decay = t.decay, this.target = t.target.clone(), this.shadow = t.shadow.clone(), this | |
} | |
}), Jo.prototype = Object.assign(Object.create(jo.prototype), { | |
constructor: Jo, | |
isPointLight: !0, | |
copy: function(t) { | |
return jo.prototype.copy.call(this, t), this.distance = t.distance, this.decay = t.decay, this.shadow = t.shadow.clone(), this | |
} | |
}), Zo.prototype = Object.assign(Object.create(Xo.prototype), { | |
constructor: Zo | |
}), Qo.prototype = Object.assign(Object.create(jo.prototype), { | |
constructor: Qo, | |
isDirectionalLight: !0, | |
copy: function(t) { | |
return jo.prototype.copy.call(this, t), this.target = t.target.clone(), this.shadow = t.shadow.clone(), this | |
} | |
}), Ko.prototype = Object.assign(Object.create(jo.prototype), { | |
constructor: Ko, | |
isAmbientLight: !0 | |
}), $o.prototype = Object.assign(Object.create(jo.prototype), { | |
constructor: $o, | |
isRectAreaLight: !0, | |
copy: function(t) { | |
return jo.prototype.copy.call(this, t), this.width = t.width, this.height = t.height, this | |
}, | |
toJSON: function(t) { | |
var e = jo.prototype.toJSON.call(this, t); | |
return e.object.width = this.width, e.object.height = this.height, e | |
} | |
}), ts.prototype = Object.assign(Object.create(us.prototype), { | |
constructor: ts, | |
ValueTypeName: "string", | |
ValueBufferType: Array, | |
DefaultInterpolation: 2300, | |
InterpolantFactoryMethodLinear: void 0, | |
InterpolantFactoryMethodSmooth: void 0 | |
}), es.prototype = Object.assign(Object.create(us.prototype), { | |
constructor: es, | |
ValueTypeName: "bool", | |
ValueBufferType: Array, | |
DefaultInterpolation: 2300, | |
InterpolantFactoryMethodLinear: void 0, | |
InterpolantFactoryMethodSmooth: void 0 | |
}), Object.assign(ns.prototype, { | |
evaluate: function(t) { | |
var e = this.parameterPositions, | |
n = this._cachedIndex, | |
i = e[n], | |
r = e[n - 1]; | |
t: { | |
e: { | |
var a;n: { | |
i: if (!(t < i)) { | |
for (var o = n + 2;;) { | |
if (void 0 === i) { | |
if (t < r) break i; | |
return n = e.length, this._cachedIndex = n, this.afterEnd_(n - 1, t, r) | |
} | |
if (n === o) break; | |
if (r = i, t < (i = e[++n])) break e | |
} | |
a = e.length; | |
break n | |
}if (t >= r) break t; | |
var s = e[1];t < s && (n = 2, r = s); | |
for (o = n - 2;;) { | |
if (void 0 === r) return this._cachedIndex = 0, this.beforeStart_(0, t, i); | |
if (n === o) break; | |
if (i = r, t >= (r = e[--n - 1])) break e | |
} | |
a = n, | |
n = 0 | |
} | |
for (; n < a;) { | |
var c = n + a >>> 1; | |
t < e[c] ? a = c : n = c + 1 | |
} | |
if (i = e[n], void 0 === (r = e[n - 1])) return this._cachedIndex = 0, this.beforeStart_(0, t, i); | |
if (void 0 === i) return n = e.length, this._cachedIndex = n, this.afterEnd_(n - 1, r, t) | |
} | |
this._cachedIndex = n, | |
this.intervalChanged_(n, r, i) | |
} | |
return this.interpolate_(n, r, t, i) | |
}, | |
settings: null, | |
DefaultSettings_: {}, | |
getSettings_: function() { | |
return this.settings || this.DefaultSettings_ | |
}, | |
copySampleValue_: function(t) { | |
for (var e = this.resultBuffer, n = this.sampleValues, i = this.valueSize, r = t * i, a = 0; a !== i; ++a) e[a] = n[r + a]; | |
return e | |
}, | |
interpolate_: function() { | |
throw new Error("call to abstract method") | |
}, | |
intervalChanged_: function() {} | |
}), Object.assign(ns.prototype, { | |
beforeStart_: ns.prototype.copySampleValue_, | |
afterEnd_: ns.prototype.copySampleValue_ | |
}), is.prototype = Object.assign(Object.create(ns.prototype), { | |
constructor: is, | |
interpolate_: function(t, e, n, i) { | |
for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = t * o, c = (n - e) / (i - e), h = s + o; s !== h; s += 4) De.slerpFlat(r, 0, a, s - o, a, s, c); | |
return r | |
} | |
}), rs.prototype = Object.assign(Object.create(us.prototype), { | |
constructor: rs, | |
ValueTypeName: "quaternion", | |
DefaultInterpolation: 2301, | |
InterpolantFactoryMethodLinear: function(t) { | |
return new is(this.times, this.values, this.getValueSize(), t) | |
}, | |
InterpolantFactoryMethodSmooth: void 0 | |
}), as.prototype = Object.assign(Object.create(us.prototype), { | |
constructor: as, | |
ValueTypeName: "color" | |
}), os.prototype = Object.assign(Object.create(us.prototype), { | |
constructor: os, | |
ValueTypeName: "number" | |
}), ss.prototype = Object.assign(Object.create(ns.prototype), { | |
constructor: ss, | |
DefaultSettings_: { | |
endingStart: ye, | |
endingEnd: ye | |
}, | |
intervalChanged_: function(t, e, n) { | |
var i = this.parameterPositions, | |
r = t - 2, | |
a = t + 1, | |
o = i[r], | |
s = i[a]; | |
if (void 0 === o) switch (this.getSettings_().endingStart) { | |
case 2401: | |
r = t, o = 2 * e - n; | |
break; | |
case 2402: | |
o = e + i[r = i.length - 2] - i[r + 1]; | |
break; | |
default: | |
r = t, o = n | |
} | |
if (void 0 === s) switch (this.getSettings_().endingEnd) { | |
case 2401: | |
a = t, s = 2 * n - e; | |
break; | |
case 2402: | |
a = 1, s = n + i[1] - i[0]; | |
break; | |
default: | |
a = t - 1, s = e | |
} | |
var c = .5 * (n - e), | |
h = this.valueSize; | |
this._weightPrev = c / (e - o), this._weightNext = c / (s - n), this._offsetPrev = r * h, this._offsetNext = a * h | |
}, | |
interpolate_: function(t, e, n, i) { | |
for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = t * o, c = s - o, h = this._offsetPrev, l = this._offsetNext, u = this._weightPrev, p = this._weightNext, d = (n - e) / (i - e), f = d * d, m = f * d, g = -u * m + 2 * u * f - u * d, v = (1 + u) * m + (-1.5 - 2 * u) * f + (-.5 + u) * d + 1, y = (-1 - p) * m + (1.5 + p) * f + .5 * d, x = p * m - p * f, w = 0; w !== o; ++w) r[w] = g * a[h + w] + v * a[c + w] + y * a[s + w] + x * a[l + w]; | |
return r | |
} | |
}), cs.prototype = Object.assign(Object.create(ns.prototype), { | |
constructor: cs, | |
interpolate_: function(t, e, n, i) { | |
for (var r = this.resultBuffer, a = this.sampleValues, o = this.valueSize, s = t * o, c = s - o, h = (n - e) / (i - e), l = 1 - h, u = 0; u !== o; ++u) r[u] = a[c + u] * l + a[s + u] * h; | |
return r | |
} | |
}), hs.prototype = Object.assign(Object.create(ns.prototype), { | |
constructor: hs, | |
interpolate_: function(t) { | |
return this.copySampleValue_(t - 1) | |
} | |
}); | |
var ls = { | |
arraySlice: function(t, e, n) { | |
return ls.isTypedArray(t) ? new t.constructor(t.subarray(e, void 0 !== n ? n : t.length)) : t.slice(e, n) | |
}, | |
convertArray: function(t, e, n) { | |
return !t || !n && t.constructor === e ? t : "number" == typeof e.BYTES_PER_ELEMENT ? new e(t) : Array.prototype.slice.call(t) | |
}, | |
isTypedArray: function(t) { | |
return ArrayBuffer.isView(t) && !(t instanceof DataView) | |
}, | |
getKeyframeOrder: function(t) { | |
for (var e = t.length, n = new Array(e), i = 0; i !== e; ++i) n[i] = i; | |
return n.sort(function(e, n) { | |
return t[e] - t[n] | |
}), n | |
}, | |
sortedArray: function(t, e, n) { | |
for (var i = t.length, r = new t.constructor(i), a = 0, o = 0; o !== i; ++a) | |
for (var s = n[a] * e, c = 0; c !== e; ++c) r[o++] = t[s + c]; | |
return r | |
}, | |
flattenJSON: function(t, e, n, i) { | |
for (var r = 1, a = t[0]; void 0 !== a && void 0 === a[i];) a = t[r++]; | |
if (void 0 !== a) { | |
var o = a[i]; | |
if (void 0 !== o) | |
if (Array.isArray(o)) | |
do { | |
void 0 !== (o = a[i]) && (e.push(a.time), n.push.apply(n, o)), a = t[r++] | |
} while (void 0 !== a); | |
else if (void 0 !== o.toArray) | |
do { | |
void 0 !== (o = a[i]) && (e.push(a.time), o.toArray(n, n.length)), a = t[r++] | |
} while (void 0 !== a); | |
else | |
do { | |
void 0 !== (o = a[i]) && (e.push(a.time), n.push(o)), a = t[r++] | |
} while (void 0 !== a) | |
} | |
} | |
}; | |
function us(t, e, n, i) { | |
if (void 0 === t) throw new Error("THREE.KeyframeTrack: track name is undefined"); | |
if (void 0 === e || 0 === e.length) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + t); | |
this.name = t, this.times = ls.convertArray(e, this.TimeBufferType), this.values = ls.convertArray(n, this.ValueBufferType), this.setInterpolation(i || this.DefaultInterpolation), this.validate(), this.optimize() | |
} | |
function ps(t, e, n, i) { | |
us.call(this, t, e, n, i) | |
} | |
function ds(t, e, n) { | |
this.name = t, this.tracks = n, this.duration = void 0 !== e ? e : -1, this.uuid = Re.generateUUID(), this.duration < 0 && this.resetDuration(), this.optimize() | |
} | |
function fs(t) { | |
this.manager = void 0 !== t ? t : fo, this.textures = {} | |
} | |
function ms(t) { | |
this.manager = void 0 !== t ? t : fo | |
} | |
Object.assign(us, { | |
parse: function(t) { | |
if (void 0 === t.type) throw new Error("THREE.KeyframeTrack: track type undefined, can not parse"); | |
var e = us._getTrackTypeForValueTypeName(t.type); | |
if (void 0 === t.times) { | |
var n = [], | |
i = []; | |
ls.flattenJSON(t.keys, n, i, "value"), t.times = n, t.values = i | |
} | |
return void 0 !== e.parse ? e.parse(t) : new e(t.name, t.times, t.values, t.interpolation) | |
}, | |
toJSON: function(t) { | |
var e, n = t.constructor; | |
if (void 0 !== n.toJSON) e = n.toJSON(t); | |
else { | |
e = { | |
name: t.name, | |
times: ls.convertArray(t.times, Array), | |
values: ls.convertArray(t.values, Array) | |
}; | |
var i = t.getInterpolation(); | |
i !== t.DefaultInterpolation && (e.interpolation = i) | |
} | |
return e.type = t.ValueTypeName, e | |
}, | |
_getTrackTypeForValueTypeName: function(t) { | |
switch (t.toLowerCase()) { | |
case "scalar": | |
case "double": | |
case "float": | |
case "number": | |
case "integer": | |
return os; | |
case "vector": | |
case "vector2": | |
case "vector3": | |
case "vector4": | |
return ps; | |
case "color": | |
return as; | |
case "quaternion": | |
return rs; | |
case "bool": | |
case "boolean": | |
return es; | |
case "string": | |
return ts | |
} | |
throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + t) | |
} | |
}), Object.assign(us.prototype, { | |
constructor: us, | |
TimeBufferType: Float32Array, | |
ValueBufferType: Float32Array, | |
DefaultInterpolation: 2301, | |
InterpolantFactoryMethodDiscrete: function(t) { | |
return new hs(this.times, this.values, this.getValueSize(), t) | |
}, | |
InterpolantFactoryMethodLinear: function(t) { | |
return new cs(this.times, this.values, this.getValueSize(), t) | |
}, | |
InterpolantFactoryMethodSmooth: function(t) { | |
return new ss(this.times, this.values, this.getValueSize(), t) | |
}, | |
setInterpolation: function(t) { | |
var e; | |
switch (t) { | |
case 2300: | |
e = this.InterpolantFactoryMethodDiscrete; | |
break; | |
case 2301: | |
e = this.InterpolantFactoryMethodLinear; | |
break; | |
case 2302: | |
e = this.InterpolantFactoryMethodSmooth | |
} | |
if (void 0 !== e) this.createInterpolant = e; | |
else { | |
var n = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name; | |
if (void 0 === this.createInterpolant) { | |
if (t === this.DefaultInterpolation) throw new Error(n); | |
this.setInterpolation(this.DefaultInterpolation) | |
} | |
console.warn("THREE.KeyframeTrack:", n) | |
} | |
}, | |
getInterpolation: function() { | |
switch (this.createInterpolant) { | |
case this.InterpolantFactoryMethodDiscrete: | |
return 2300; | |
case this.InterpolantFactoryMethodLinear: | |
return 2301; | |
case this.InterpolantFactoryMethodSmooth: | |
return 2302 | |
} | |
}, | |
getValueSize: function() { | |
return this.values.length / this.times.length | |
}, | |
shift: function(t) { | |
if (0 !== t) | |
for (var e = this.times, n = 0, i = e.length; n !== i; ++n) e[n] += t; | |
return this | |
}, | |
scale: function(t) { | |
if (1 !== t) | |
for (var e = this.times, n = 0, i = e.length; n !== i; ++n) e[n] *= t; | |
return this | |
}, | |
trim: function(t, e) { | |
for (var n = this.times, i = n.length, r = 0, a = i - 1; r !== i && n[r] < t;) ++r; | |
for (; - 1 !== a && n[a] > e;) --a; | |
if (++a, 0 !== r || a !== i) { | |
r >= a && (r = (a = Math.max(a, 1)) - 1); | |
var o = this.getValueSize(); | |
this.times = ls.arraySlice(n, r, a), this.values = ls.arraySlice(this.values, r * o, a * o) | |
} | |
return this | |
}, | |
validate: function() { | |
var t = !0, | |
e = this.getValueSize(); | |
e - Math.floor(e) != 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this), t = !1); | |
var n = this.times, | |
i = this.values, | |
r = n.length; | |
0 === r && (console.error("THREE.KeyframeTrack: Track is empty.", this), t = !1); | |
for (var a = null, o = 0; o !== r; o++) { | |
var s = n[o]; | |
if ("number" == typeof s && isNaN(s)) { | |
console.error("THREE.KeyframeTrack: Time is not a valid number.", this, o, s), t = !1; | |
break | |
} | |
if (null !== a && a > s) { | |
console.error("THREE.KeyframeTrack: Out of order keys.", this, o, s, a), t = !1; | |
break | |
} | |
a = s | |
} | |
if (void 0 !== i && ls.isTypedArray(i)) { | |
o = 0; | |
for (var c = i.length; o !== c; ++o) { | |
var h = i[o]; | |
if (isNaN(h)) { | |
console.error("THREE.KeyframeTrack: Value is not a valid number.", this, o, h), t = !1; | |
break | |
} | |
} | |
} | |
return t | |
}, | |
optimize: function() { | |
for (var t = this.times, e = this.values, n = this.getValueSize(), i = 2302 === this.getInterpolation(), r = 1, a = t.length - 1, o = 1; o < a; ++o) { | |
var s = !1, | |
c = t[o]; | |
if (c !== t[o + 1] && (1 !== o || c !== c[0])) | |
if (i) s = !0; | |
else | |
for (var h = o * n, l = h - n, u = h + n, p = 0; p !== n; ++p) { | |
var d = e[h + p]; | |
if (d !== e[l + p] || d !== e[u + p]) { | |
s = !0; | |
break | |
} | |
} | |
if (s) { | |
if (o !== r) { | |
t[r] = t[o]; | |
var f = o * n, | |
m = r * n; | |
for (p = 0; p !== n; ++p) e[m + p] = e[f + p] | |
}++r | |
} | |
} | |
if (a > 0) { | |
t[r] = t[a]; | |
for (f = a * n, m = r * n, p = 0; p !== n; ++p) e[m + p] = e[f + p]; | |
++r | |
} | |
return r !== t.length && (this.times = ls.arraySlice(t, 0, r), this.values = ls.arraySlice(e, 0, r * n)), this | |
} | |
}), ps.prototype = Object.assign(Object.create(us.prototype), { | |
constructor: ps, | |
ValueTypeName: "vector" | |
}), Object.assign(ds, { | |
parse: function(t) { | |
for (var e = [], n = t.tracks, i = 1 / (t.fps || 1), r = 0, a = n.length; r !== a; ++r) e.push(us.parse(n[r]).scale(i)); | |
return new ds(t.name, t.duration, e) | |
}, | |
toJSON: function(t) { | |
for (var e = [], n = t.tracks, i = { | |
name: t.name, | |
duration: t.duration, | |
tracks: e | |
}, r = 0, a = n.length; r !== a; ++r) e.push(us.toJSON(n[r])); | |
return i | |
}, | |
CreateFromMorphTargetSequence: function(t, e, n, i) { | |
for (var r = e.length, a = [], o = 0; o < r; o++) { | |
var s = [], | |
c = []; | |
s.push((o + r - 1) % r, o, (o + 1) % r), c.push(0, 1, 0); | |
var h = ls.getKeyframeOrder(s); | |
s = ls.sortedArray(s, 1, h), c = ls.sortedArray(c, 1, h), i || 0 !== s[0] || (s.push(r), c.push(c[0])), a.push(new os(".morphTargetInfluences[" + e[o].name + "]", s, c).scale(1 / n)) | |
} | |
return new ds(t, -1, a) | |
}, | |
findByName: function(t, e) { | |
var n = t; | |
if (!Array.isArray(t)) { | |
var i = t; | |
n = i.geometry && i.geometry.animations || i.animations | |
} | |
for (var r = 0; r < n.length; r++) | |
if (n[r].name === e) return n[r]; | |
return null | |
}, | |
CreateClipsFromMorphTargetSequences: function(t, e, n) { | |
for (var i = {}, r = /^([\w-]*?)([\d]+)$/, a = 0, o = t.length; a < o; a++) { | |
var s = t[a], | |
c = s.name.match(r); | |
if (c && c.length > 1) { | |
var h = i[u = c[1]]; | |
h || (i[u] = h = []), h.push(s) | |
} | |
} | |
var l = []; | |
for (var u in i) l.push(ds.CreateFromMorphTargetSequence(u, i[u], e, n)); | |
return l | |
}, | |
parseAnimation: function(t, e) { | |
if (!t) return console.error("THREE.AnimationClip: No animation in JSONLoader data."), null; | |
for (var n = function(t, e, n, i, r) { | |
if (0 !== n.length) { | |
var a = [], | |
o = []; | |
ls.flattenJSON(n, a, o, i), 0 !== a.length && r.push(new t(e, a, o)) | |
} | |
}, i = [], r = t.name || "default", a = t.length || -1, o = t.fps || 30, s = t.hierarchy || [], c = 0; c < s.length; c++) { | |
var h = s[c].keys; | |
if (h && 0 !== h.length) | |
if (h[0].morphTargets) { | |
for (var l = {}, u = 0; u < h.length; u++) | |
if (h[u].morphTargets) | |
for (var p = 0; p < h[u].morphTargets.length; p++) l[h[u].morphTargets[p]] = -1; | |
for (var d in l) { | |
var f = [], | |
m = []; | |
for (p = 0; p !== h[u].morphTargets.length; ++p) { | |
var g = h[u]; | |
f.push(g.time), m.push(g.morphTarget === d ? 1 : 0) | |
} | |
i.push(new os(".morphTargetInfluence[" + d + "]", f, m)) | |
} | |
a = l.length * (o || 1) | |
} else { | |
var v = ".bones[" + e[c].name + "]"; | |
n(ps, v + ".position", h, "pos", i), n(rs, v + ".quaternion", h, "rot", i), n(ps, v + ".scale", h, "scl", i) | |
} | |
} | |
return 0 === i.length ? null : new ds(r, a, i) | |
} | |
}), Object.assign(ds.prototype, { | |
resetDuration: function() { | |
for (var t = 0, e = 0, n = this.tracks.length; e !== n; ++e) { | |
var i = this.tracks[e]; | |
t = Math.max(t, i.times[i.times.length - 1]) | |
} | |
this.duration = t | |
}, | |
trim: function() { | |
for (var t = 0; t < this.tracks.length; t++) this.tracks[t].trim(0, this.duration); | |
return this | |
}, | |
optimize: function() { | |
for (var t = 0; t < this.tracks.length; t++) this.tracks[t].optimize(); | |
return this | |
} | |
}), Object.assign(fs.prototype, { | |
load: function(t, e, n, i) { | |
var r = this; | |
new go(r.manager).load(t, function(t) { | |
e(r.parse(JSON.parse(t))) | |
}, n, i) | |
}, | |
setTextures: function(t) { | |
this.textures = t | |
}, | |
parse: function(t) { | |
var e = this.textures; | |
function n(t) { | |
return void 0 === e[t] && console.warn("THREE.MaterialLoader: Undefined texture", t), e[t] | |
} | |
var i = new lo[t.type]; | |
if (void 0 !== t.uuid && (i.uuid = t.uuid), void 0 !== t.name && (i.name = t.name), void 0 !== t.color && i.color.setHex(t.color), void 0 !== t.roughness && (i.roughness = t.roughness), void 0 !== t.metalness && (i.metalness = t.metalness), void 0 !== t.emissive && i.emissive.setHex(t.emissive), void 0 !== t.specular && i.specular.setHex(t.specular), void 0 !== t.shininess && (i.shininess = t.shininess), void 0 !== t.clearCoat && (i.clearCoat = t.clearCoat), void 0 !== t.clearCoatRoughness && (i.clearCoatRoughness = t.clearCoatRoughness), void 0 !== t.uniforms && (i.uniforms = t.uniforms), void 0 !== t.vertexShader && (i.vertexShader = t.vertexShader), void 0 !== t.fragmentShader && (i.fragmentShader = t.fragmentShader), void 0 !== t.vertexColors && (i.vertexColors = t.vertexColors), void 0 !== t.fog && (i.fog = t.fog), void 0 !== t.flatShading && (i.flatShading = t.flatShading), void 0 !== t.blending && (i.blending = t.blending), void 0 !== t.side && (i.side = t.side), void 0 !== t.opacity && (i.opacity = t.opacity), void 0 !== t.transparent && (i.transparent = t.transparent), void 0 !== t.alphaTest && (i.alphaTest = t.alphaTest), void 0 !== t.depthTest && (i.depthTest = t.depthTest), void 0 !== t.depthWrite && (i.depthWrite = t.depthWrite), void 0 !== t.colorWrite && (i.colorWrite = t.colorWrite), void 0 !== t.wireframe && (i.wireframe = t.wireframe), void 0 !== t.wireframeLinewidth && (i.wireframeLinewidth = t.wireframeLinewidth), void 0 !== t.wireframeLinecap && (i.wireframeLinecap = t.wireframeLinecap), void 0 !== t.wireframeLinejoin && (i.wireframeLinejoin = t.wireframeLinejoin), void 0 !== t.rotation && (i.rotation = t.rotation), 1 !== t.linewidth && (i.linewidth = t.linewidth), void 0 !== t.dashSize && (i.dashSize = t.dashSize), void 0 !== t.gapSize && (i.gapSize = t.gapSize), void 0 !== t.scale && (i.scale = t.scale), void 0 !== t.polygonOffset && (i.polygonOffset = t.polygonOffset), void 0 !== t.polygonOffsetFactor && (i.polygonOffsetFactor = t.polygonOffsetFactor), void 0 !== t.polygonOffsetUnits && (i.polygonOffsetUnits = t.polygonOffsetUnits), void 0 !== t.skinning && (i.skinning = t.skinning), void 0 !== t.morphTargets && (i.morphTargets = t.morphTargets), void 0 !== t.dithering && (i.dithering = t.dithering), void 0 !== t.visible && (i.visible = t.visible), void 0 !== t.userData && (i.userData = t.userData), void 0 !== t.shading && (i.flatShading = 1 === t.shading), void 0 !== t.size && (i.size = t.size), void 0 !== t.sizeAttenuation && (i.sizeAttenuation = t.sizeAttenuation), void 0 !== t.map && (i.map = n(t.map)), void 0 !== t.alphaMap && (i.alphaMap = n(t.alphaMap), i.transparent = !0), void 0 !== t.bumpMap && (i.bumpMap = n(t.bumpMap)), void 0 !== t.bumpScale && (i.bumpScale = t.bumpScale), void 0 !== t.normalMap && (i.normalMap = n(t.normalMap)), void 0 !== t.normalScale) { | |
var r = t.normalScale; | |
!1 === Array.isArray(r) && (r = [r, r]), i.normalScale = (new Pe).fromArray(r) | |
} | |
return void 0 !== t.displacementMap && (i.displacementMap = n(t.displacementMap)), void 0 !== t.displacementScale && (i.displacementScale = t.displacementScale), void 0 !== t.displacementBias && (i.displacementBias = t.displacementBias), void 0 !== t.roughnessMap && (i.roughnessMap = n(t.roughnessMap)), void 0 !== t.metalnessMap && (i.metalnessMap = n(t.metalnessMap)), void 0 !== t.emissiveMap && (i.emissiveMap = n(t.emissiveMap)), void 0 !== t.emissiveIntensity && (i.emissiveIntensity = t.emissiveIntensity), void 0 !== t.specularMap && (i.specularMap = n(t.specularMap)), void 0 !== t.envMap && (i.envMap = n(t.envMap)), void 0 !== t.reflectivity && (i.reflectivity = t.reflectivity), void 0 !== t.lightMap && (i.lightMap = n(t.lightMap)), void 0 !== t.lightMapIntensity && (i.lightMapIntensity = t.lightMapIntensity), void 0 !== t.aoMap && (i.aoMap = n(t.aoMap)), void 0 !== t.aoMapIntensity && (i.aoMapIntensity = t.aoMapIntensity), void 0 !== t.gradientMap && (i.gradientMap = n(t.gradientMap)), i | |
} | |
}), Object.assign(ms.prototype, { | |
load: function(t, e, n, i) { | |
var r = this; | |
new go(r.manager).load(t, function(t) { | |
e(r.parse(JSON.parse(t))) | |
}, n, i) | |
}, | |
parse: function(t) { | |
var e = new Bn, | |
n = t.data.index; | |
if (void 0 !== n) { | |
var i = new ws[n.type](n.array); | |
e.setIndex(new Mn(i, 1)) | |
} | |
var r = t.data.attributes; | |
for (var a in r) { | |
var o = r[a]; | |
i = new ws[o.type](o.array); | |
e.addAttribute(a, new Mn(i, o.itemSize, o.normalized)) | |
} | |
var s = t.data.groups || t.data.drawcalls || t.data.offsets; | |
if (void 0 !== s) | |
for (var c = 0, h = s.length; c !== h; ++c) { | |
var l = s[c]; | |
e.addGroup(l.start, l.count, l.materialIndex) | |
} | |
var u = t.data.boundingSphere; | |
if (void 0 !== u) { | |
var p = new Ue; | |
void 0 !== u.center && p.fromArray(u.center), e.boundingSphere = new Ze(p, u.radius) | |
} | |
return e | |
} | |
}); | |
var gs, vs, ys, xs, ws = { | |
Int8Array: Int8Array, | |
Uint8Array: Uint8Array, | |
Uint8ClampedArray: "undefined" != typeof Uint8ClampedArray ? Uint8ClampedArray : Uint8Array, | |
Int16Array: Int16Array, | |
Uint16Array: Uint16Array, | |
Int32Array: Int32Array, | |
Uint32Array: Uint32Array, | |
Float32Array: Float32Array, | |
Float64Array: Float64Array | |
}; | |
function _s() {} | |
_s.Handlers = { | |
handlers: [], | |
add: function(t, e) { | |
this.handlers.push(t, e) | |
}, | |
get: function(t) { | |
for (var e = this.handlers, n = 0, i = e.length; n < i; n += 2) { | |
var r = e[n], | |
a = e[n + 1]; | |
if (r.test(t)) return a | |
} | |
return null | |
} | |
}, Object.assign(_s.prototype, { | |
crossOrigin: void 0, | |
onLoadStart: function() {}, | |
onLoadProgress: function() {}, | |
onLoadComplete: function() {}, | |
initMaterials: function(t, e, n) { | |
for (var i = [], r = 0; r < t.length; ++r) i[r] = this.createMaterial(t[r], e, n); | |
return i | |
}, | |
createMaterial: (gs = { | |
NoBlending: I, | |
NormalBlending: L, | |
AdditiveBlending: R, | |
SubtractiveBlending: P, | |
MultiplyBlending: O, | |
CustomBlending: D | |
}, vs = new rn, ys = new wo, xs = new fs, function(t, e, n) { | |
var i = {}; | |
function r(t, r, a, o, s) { | |
var c, h = e + t, | |
l = _s.Handlers.get(h); | |
null !== l ? c = l.load(h) : (ys.setCrossOrigin(n), c = ys.load(h)), void 0 !== r && (c.repeat.fromArray(r), 1 !== r[0] && (c.wrapS = wt), 1 !== r[1] && (c.wrapT = wt)), void 0 !== a && c.offset.fromArray(a), void 0 !== o && ("repeat" === o[0] && (c.wrapS = wt), "mirror" === o[0] && (c.wrapS = bt), "repeat" === o[1] && (c.wrapT = wt), "mirror" === o[1] && (c.wrapT = bt)), void 0 !== s && (c.anisotropy = s); | |
var u = Re.generateUUID(); | |
return i[u] = c, u | |
} | |
var a = { | |
uuid: Re.generateUUID(), | |
type: "MeshLambertMaterial" | |
}; | |
for (var o in t) { | |
var s = t[o]; | |
switch (o) { | |
case "DbgColor": | |
case "DbgIndex": | |
case "opticalDensity": | |
case "illumination": | |
break; | |
case "DbgName": | |
a.name = s; | |
break; | |
case "blending": | |
a.blending = gs[s]; | |
break; | |
case "colorAmbient": | |
case "mapAmbient": | |
console.warn("THREE.Loader.createMaterial:", o, "is no longer supported."); | |
break; | |
case "colorDiffuse": | |
a.color = vs.fromArray(s).getHex(); | |
break; | |
case "colorSpecular": | |
a.specular = vs.fromArray(s).getHex(); | |
break; | |
case "colorEmissive": | |
a.emissive = vs.fromArray(s).getHex(); | |
break; | |
case "specularCoef": | |
a.shininess = s; | |
break; | |
case "shading": | |
"basic" === s.toLowerCase() && (a.type = "MeshBasicMaterial"), "phong" === s.toLowerCase() && (a.type = "MeshPhongMaterial"), "standard" === s.toLowerCase() && (a.type = "MeshStandardMaterial"); | |
break; | |
case "mapDiffuse": | |
a.map = r(s, t.mapDiffuseRepeat, t.mapDiffuseOffset, t.mapDiffuseWrap, t.mapDiffuseAnisotropy); | |
break; | |
case "mapDiffuseRepeat": | |
case "mapDiffuseOffset": | |
case "mapDiffuseWrap": | |
case "mapDiffuseAnisotropy": | |
break; | |
case "mapEmissive": | |
a.emissiveMap = r(s, t.mapEmissiveRepeat, t.mapEmissiveOffset, t.mapEmissiveWrap, t.mapEmissiveAnisotropy); | |
break; | |
case "mapEmissiveRepeat": | |
case "mapEmissiveOffset": | |
case "mapEmissiveWrap": | |
case "mapEmissiveAnisotropy": | |
break; | |
case "mapLight": | |
a.lightMap = r(s, t.mapLightRepeat, t.mapLightOffset, t.mapLightWrap, t.mapLightAnisotropy); | |
break; | |
case "mapLightRepeat": | |
case "mapLightOffset": | |
case "mapLightWrap": | |
case "mapLightAnisotropy": | |
break; | |
case "mapAO": | |
a.aoMap = r(s, t.mapAORepeat, t.mapAOOffset, t.mapAOWrap, t.mapAOAnisotropy); | |
break; | |
case "mapAORepeat": | |
case "mapAOOffset": | |
case "mapAOWrap": | |
case "mapAOAnisotropy": | |
break; | |
case "mapBump": | |
a.bumpMap = r(s, t.mapBumpRepeat, t.mapBumpOffset, t.mapBumpWrap, t.mapBumpAnisotropy); | |
break; | |
case "mapBumpScale": | |
a.bumpScale = s; | |
break; | |
case "mapBumpRepeat": | |
case "mapBumpOffset": | |
case "mapBumpWrap": | |
case "mapBumpAnisotropy": | |
break; | |
case "mapNormal": | |
a.normalMap = r(s, t.mapNormalRepeat, t.mapNormalOffset, t.mapNormalWrap, t.mapNormalAnisotropy); | |
break; | |
case "mapNormalFactor": | |
a.normalScale = s; | |
break; | |
case "mapNormalRepeat": | |
case "mapNormalOffset": | |
case "mapNormalWrap": | |
case "mapNormalAnisotropy": | |
break; | |
case "mapSpecular": | |
a.specularMap = r(s, t.mapSpecularRepeat, t.mapSpecularOffset, t.mapSpecularWrap, t.mapSpecularAnisotropy); | |
break; | |
case "mapSpecularRepeat": | |
case "mapSpecularOffset": | |
case "mapSpecularWrap": | |
case "mapSpecularAnisotropy": | |
break; | |
case "mapMetalness": | |
a.metalnessMap = r(s, t.mapMetalnessRepeat, t.mapMetalnessOffset, t.mapMetalnessWrap, t.mapMetalnessAnisotropy); | |
break; | |
case "mapMetalnessRepeat": | |
case "mapMetalnessOffset": | |
case "mapMetalnessWrap": | |
case "mapMetalnessAnisotropy": | |
break; | |
case "mapRoughness": | |
a.roughnessMap = r(s, t.mapRoughnessRepeat, t.mapRoughnessOffset, t.mapRoughnessWrap, t.mapRoughnessAnisotropy); | |
break; | |
case "mapRoughnessRepeat": | |
case "mapRoughnessOffset": | |
case "mapRoughnessWrap": | |
case "mapRoughnessAnisotropy": | |
break; | |
case "mapAlpha": | |
a.alphaMap = r(s, t.mapAlphaRepeat, t.mapAlphaOffset, t.mapAlphaWrap, t.mapAlphaAnisotropy); | |
break; | |
case "mapAlphaRepeat": | |
case "mapAlphaOffset": | |
case "mapAlphaWrap": | |
case "mapAlphaAnisotropy": | |
break; | |
case "flipSided": | |
a.side = M; | |
break; | |
case "doubleSided": | |
a.side = E; | |
break; | |
case "transparency": | |
console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"), a.opacity = s; | |
break; | |
case "depthTest": | |
case "depthWrite": | |
case "colorWrite": | |
case "opacity": | |
case "reflectivity": | |
case "transparent": | |
case "visible": | |
case "wireframe": | |
a[o] = s; | |
break; | |
case "vertexColors": | |
!0 === s && (a.vertexColors = C), "face" === s && (a.vertexColors = T); | |
break; | |
default: | |
console.error("THREE.Loader.createMaterial: Unsupported", o, s) | |
} | |
} | |
return "MeshBasicMaterial" === a.type && delete a.emissive, "MeshPhongMaterial" !== a.type && delete a.specular, a.opacity < 1 && (a.transparent = !0), xs.setTextures(i), xs.parse(a) | |
}) | |
}); | |
var bs = { | |
decodeText: function(t) { | |
if ("undefined" != typeof TextDecoder) return (new TextDecoder).decode(t); | |
for (var e = "", n = 0, i = t.length; n < i; n++) e += String.fromCharCode(t[n]); | |
return decodeURIComponent(escape(e)) | |
}, | |
extractUrlBase: function(t) { | |
var e = t.split("/"); | |
return 1 === e.length ? "./" : (e.pop(), e.join("/") + "/") | |
} | |
}; | |
function As(t) { | |
"boolean" == typeof t && (console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), t = void 0), this.manager = void 0 !== t ? t : fo, this.withCredentials = !1 | |
} | |
Object.assign(As.prototype, { | |
load: function(t, e, n, i) { | |
var r = this, | |
a = this.texturePath && "string" == typeof this.texturePath ? this.texturePath : bs.extractUrlBase(t), | |
o = new go(this.manager); | |
o.setWithCredentials(this.withCredentials), o.load(t, function(n) { | |
var i = JSON.parse(n), | |
o = i.metadata; | |
if (void 0 !== o) { | |
var s = o.type; | |
if (void 0 !== s && "object" === s.toLowerCase()) return void console.error("THREE.JSONLoader: " + t + " should be loaded with THREE.ObjectLoader instead.") | |
} | |
var c = r.parse(i, a); | |
e(c.geometry, c.materials) | |
}, n, i) | |
}, | |
setTexturePath: function(t) { | |
this.texturePath = t | |
}, | |
parse: function() { | |
return function(t, e) { | |
void 0 !== t.data && (t = t.data), void 0 !== t.scale ? t.scale = 1 / t.scale : t.scale = 1; | |
var n = new An; | |
return function(t, e) { | |
function n(t, e) { | |
return t & 1 << e | |
} | |
var i, r, a, o, s, c, h, l, u, p, d, f, m, g, v, y, x, w, _, b, A, M, E, S, T, C = t.faces, | |
I = t.vertices, | |
L = t.normals, | |
R = t.colors, | |
P = t.scale, | |
O = 0; | |
if (void 0 !== t.uvs) { | |
for (i = 0; i < t.uvs.length; i++) t.uvs[i].length && O++; | |
for (i = 0; i < O; i++) e.faceVertexUvs[i] = [] | |
} | |
for (o = 0, s = I.length; o < s;)(w = new Ue).x = I[o++] * P, w.y = I[o++] * P, w.z = I[o++] * P, e.vertices.push(w); | |
for (o = 0, s = C.length; o < s;) | |
if (d = n(p = C[o++], 0), f = n(p, 1), m = n(p, 3), g = n(p, 4), v = n(p, 5), y = n(p, 6), x = n(p, 7), d) { | |
if ((b = new xn).a = C[o], b.b = C[o + 1], b.c = C[o + 3], (A = new xn).a = C[o + 1], A.b = C[o + 2], A.c = C[o + 3], o += 4, f && (u = C[o++], b.materialIndex = u, A.materialIndex = u), a = e.faces.length, m) | |
for (i = 0; i < O; i++) | |
for (S = t.uvs[i], e.faceVertexUvs[i][a] = [], e.faceVertexUvs[i][a + 1] = [], r = 0; r < 4; r++) T = new Pe(S[2 * (l = C[o++])], S[2 * l + 1]), 2 !== r && e.faceVertexUvs[i][a].push(T), 0 !== r && e.faceVertexUvs[i][a + 1].push(T); | |
if (g && (h = 3 * C[o++], b.normal.set(L[h++], L[h++], L[h]), A.normal.copy(b.normal)), v) | |
for (i = 0; i < 4; i++) h = 3 * C[o++], E = new Ue(L[h++], L[h++], L[h]), 2 !== i && b.vertexNormals.push(E), 0 !== i && A.vertexNormals.push(E); | |
if (y && (M = R[c = C[o++]], b.color.setHex(M), A.color.setHex(M)), x) | |
for (i = 0; i < 4; i++) M = R[c = C[o++]], 2 !== i && b.vertexColors.push(new rn(M)), 0 !== i && A.vertexColors.push(new rn(M)); | |
e.faces.push(b), e.faces.push(A) | |
} else { | |
if ((_ = new xn).a = C[o++], _.b = C[o++], _.c = C[o++], f && (u = C[o++], _.materialIndex = u), a = e.faces.length, m) | |
for (i = 0; i < O; i++) | |
for (S = t.uvs[i], e.faceVertexUvs[i][a] = [], r = 0; r < 3; r++) T = new Pe(S[2 * (l = C[o++])], S[2 * l + 1]), e.faceVertexUvs[i][a].push(T); | |
if (g && (h = 3 * C[o++], _.normal.set(L[h++], L[h++], L[h])), v) | |
for (i = 0; i < 3; i++) h = 3 * C[o++], E = new Ue(L[h++], L[h++], L[h]), _.vertexNormals.push(E); | |
if (y && (c = C[o++], _.color.setHex(R[c])), x) | |
for (i = 0; i < 3; i++) c = C[o++], _.vertexColors.push(new rn(R[c])); | |
e.faces.push(_) | |
} | |
}(t, n), | |
function(t, e) { | |
var n = void 0 !== t.influencesPerVertex ? t.influencesPerVertex : 2; | |
if (t.skinWeights) | |
for (var i = 0, r = t.skinWeights.length; i < r; i += n) { | |
var a = t.skinWeights[i], | |
o = n > 1 ? t.skinWeights[i + 1] : 0, | |
s = n > 2 ? t.skinWeights[i + 2] : 0, | |
c = n > 3 ? t.skinWeights[i + 3] : 0; | |
e.skinWeights.push(new We(a, o, s, c)) | |
} | |
if (t.skinIndices) | |
for (i = 0, r = t.skinIndices.length; i < r; i += n) { | |
var h = t.skinIndices[i], | |
l = n > 1 ? t.skinIndices[i + 1] : 0, | |
u = n > 2 ? t.skinIndices[i + 2] : 0, | |
p = n > 3 ? t.skinIndices[i + 3] : 0; | |
e.skinIndices.push(new We(h, l, u, p)) | |
} | |
e.bones = t.bones, e.bones && e.bones.length > 0 && (e.skinWeights.length !== e.skinIndices.length || e.skinIndices.length !== e.vertices.length) && console.warn("When skinning, number of vertices (" + e.vertices.length + "), skinIndices (" + e.skinIndices.length + "), and skinWeights (" + e.skinWeights.length + ") should match.") | |
}(t, n), | |
function(t, e) { | |
var n = t.scale; | |
if (void 0 !== t.morphTargets) | |
for (var i = 0, r = t.morphTargets.length; i < r; i++) { | |
e.morphTargets[i] = {}, e.morphTargets[i].name = t.morphTargets[i].name, e.morphTargets[i].vertices = []; | |
for (var a = e.morphTargets[i].vertices, o = t.morphTargets[i].vertices, s = 0, c = o.length; s < c; s += 3) { | |
var h = new Ue; | |
h.x = o[s] * n, h.y = o[s + 1] * n, h.z = o[s + 2] * n, a.push(h) | |
} | |
} | |
if (void 0 !== t.morphColors && t.morphColors.length > 0) { | |
console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.'); | |
var l = e.faces, | |
u = t.morphColors[0].colors; | |
for (i = 0, r = l.length; i < r; i++) l[i].color.fromArray(u, 3 * i) | |
} | |
}(t, n), | |
function(t, e) { | |
var n = [], | |
i = []; | |
void 0 !== t.animation && i.push(t.animation), void 0 !== t.animations && (t.animations.length ? i = i.concat(t.animations) : i.push(t.animations)); | |
for (var r = 0; r < i.length; r++) { | |
var a = ds.parseAnimation(i[r], e.bones); | |
a && n.push(a) | |
} | |
if (e.morphTargets) { | |
var o = ds.CreateClipsFromMorphTargetSequences(e.morphTargets, 10); | |
n = n.concat(o) | |
} | |
n.length > 0 && (e.animations = n) | |
}(t, n), n.computeFaceNormals(), n.computeBoundingSphere(), void 0 === t.materials || 0 === t.materials.length ? { | |
geometry: n | |
} : { | |
geometry: n, | |
materials: _s.prototype.initMaterials(t.materials, e, this.crossOrigin) | |
} | |
} | |
}() | |
}), Object.assign(function(t) { | |
this.manager = void 0 !== t ? t : fo, this.texturePath = "" | |
}.prototype, { | |
load: function(t, e, n, i) { | |
"" === this.texturePath && (this.texturePath = t.substring(0, t.lastIndexOf("/") + 1)); | |
var r = this; | |
new go(r.manager).load(t, function(n) { | |
var a = null; | |
try { | |
a = JSON.parse(n) | |
} catch (e) { | |
return void 0 !== i && i(e), void console.error("THREE:ObjectLoader: Can't parse " + t + ".", e.message) | |
} | |
var o = a.metadata; | |
void 0 !== o && void 0 !== o.type && "geometry" !== o.type.toLowerCase() ? r.parse(a, e) : console.error("THREE.ObjectLoader: Can't load " + t + ". Use THREE.JSONLoader instead.") | |
}, n, i) | |
}, | |
setTexturePath: function(t) { | |
this.texturePath = t | |
}, | |
setCrossOrigin: function(t) { | |
this.crossOrigin = t | |
}, | |
parse: function(t, e) { | |
var n = this.parseShape(t.shapes), | |
i = this.parseGeometries(t.geometries, n), | |
r = this.parseImages(t.images, function() { | |
void 0 !== e && e(s) | |
}), | |
a = this.parseTextures(t.textures, r), | |
o = this.parseMaterials(t.materials, a), | |
s = this.parseObject(t.object, i, o); | |
return t.animations && (s.animations = this.parseAnimations(t.animations)), void 0 !== t.images && 0 !== t.images.length || void 0 !== e && e(s), s | |
}, | |
parseShape: function(t) { | |
var e = {}; | |
if (void 0 !== t) | |
for (var n = 0, i = t.length; n < i; n++) { | |
var r = (new Vo).fromJSON(t[n]); | |
e[r.uuid] = r | |
} | |
return e | |
}, | |
parseGeometries: function(t, e) { | |
var n = {}; | |
if (void 0 !== t) | |
for (var i = new As, r = new ms, a = 0, o = t.length; a < o; a++) { | |
var s, c = t[a]; | |
switch (c.type) { | |
case "PlaneGeometry": | |
case "PlaneBufferGeometry": | |
s = new to[c.type](c.width, c.height, c.widthSegments, c.heightSegments); | |
break; | |
case "BoxGeometry": | |
case "BoxBufferGeometry": | |
case "CubeGeometry": | |
s = new to[c.type](c.width, c.height, c.depth, c.widthSegments, c.heightSegments, c.depthSegments); | |
break; | |
case "CircleGeometry": | |
case "CircleBufferGeometry": | |
s = new to[c.type](c.radius, c.segments, c.thetaStart, c.thetaLength); | |
break; | |
case "CylinderGeometry": | |
case "CylinderBufferGeometry": | |
s = new to[c.type](c.radiusTop, c.radiusBottom, c.height, c.radialSegments, c.heightSegments, c.openEnded, c.thetaStart, c.thetaLength); | |
break; | |
case "ConeGeometry": | |
case "ConeBufferGeometry": | |
s = new to[c.type](c.radius, c.height, c.radialSegments, c.heightSegments, c.openEnded, c.thetaStart, c.thetaLength); | |
break; | |
case "SphereGeometry": | |
case "SphereBufferGeometry": | |
s = new to[c.type](c.radius, c.widthSegments, c.heightSegments, c.phiStart, c.phiLength, c.thetaStart, c.thetaLength); | |
break; | |
case "DodecahedronGeometry": | |
case "DodecahedronBufferGeometry": | |
case "IcosahedronGeometry": | |
case "IcosahedronBufferGeometry": | |
case "OctahedronGeometry": | |
case "OctahedronBufferGeometry": | |
case "TetrahedronGeometry": | |
case "TetrahedronBufferGeometry": | |
s = new to[c.type](c.radius, c.detail); | |
break; | |
case "RingGeometry": | |
case "RingBufferGeometry": | |
s = new to[c.type](c.innerRadius, c.outerRadius, c.thetaSegments, c.phiSegments, c.thetaStart, c.thetaLength); | |
break; | |
case "TorusGeometry": | |
case "TorusBufferGeometry": | |
s = new to[c.type](c.radius, c.tube, c.radialSegments, c.tubularSegments, c.arc); | |
break; | |
case "TorusKnotGeometry": | |
case "TorusKnotBufferGeometry": | |
s = new to[c.type](c.radius, c.tube, c.tubularSegments, c.radialSegments, c.p, c.q); | |
break; | |
case "LatheGeometry": | |
case "LatheBufferGeometry": | |
s = new to[c.type](c.points, c.segments, c.phiStart, c.phiLength); | |
break; | |
case "PolyhedronGeometry": | |
case "PolyhedronBufferGeometry": | |
s = new to[c.type](c.vertices, c.indices, c.radius, c.details); | |
break; | |
case "ShapeGeometry": | |
case "ShapeBufferGeometry": | |
var h = []; | |
for (a = 0, o = c.shapes.length; a < o; a++) { | |
var l = e[c.shapes[a]]; | |
h.push(l) | |
} | |
s = new to[c.type](h, c.curveSegments); | |
break; | |
case "BufferGeometry": | |
s = r.parse(c); | |
break; | |
case "Geometry": | |
s = i.parse(c, this.texturePath).geometry; | |
break; | |
default: | |
console.warn('THREE.ObjectLoader: Unsupported geometry type "' + c.type + '"'); | |
continue | |
} | |
s.uuid = c.uuid, void 0 !== c.name && (s.name = c.name), n[c.uuid] = s | |
} | |
return n | |
}, | |
parseMaterials: function(t, e) { | |
var n = {}; | |
if (void 0 !== t) { | |
var i = new fs; | |
i.setTextures(e); | |
for (var r = 0, a = t.length; r < a; r++) { | |
var o = t[r]; | |
if ("MultiMaterial" === o.type) { | |
for (var s = [], c = 0; c < o.materials.length; c++) s.push(i.parse(o.materials[c])); | |
n[o.uuid] = s | |
} else n[o.uuid] = i.parse(o) | |
} | |
} | |
return n | |
}, | |
parseAnimations: function(t) { | |
for (var e = [], n = 0; n < t.length; n++) { | |
var i = ds.parse(t[n]); | |
e.push(i) | |
} | |
return e | |
}, | |
parseImages: function(t, e) { | |
var n = this, | |
i = {}; | |
function r(t) { | |
return n.manager.itemStart(t), a.load(t, function() { | |
n.manager.itemEnd(t) | |
}, void 0, function() { | |
n.manager.itemEnd(t), n.manager.itemError(t) | |
}) | |
} | |
if (void 0 !== t && t.length > 0) { | |
var a = new yo(new po(e)); | |
a.setCrossOrigin(this.crossOrigin); | |
for (var o = 0, s = t.length; o < s; o++) { | |
var c = t[o], | |
h = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url) ? c.url : n.texturePath + c.url; | |
i[c.uuid] = r(h) | |
} | |
} | |
return i | |
}, | |
parseTextures: function(t, e) { | |
function n(t, e) { | |
return "number" == typeof t ? t : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", t), e[t]) | |
} | |
var i = {}; | |
if (void 0 !== t) | |
for (var r = 0, a = t.length; r < a; r++) { | |
var o = t[r]; | |
void 0 === o.image && console.warn('THREE.ObjectLoader: No "image" specified for', o.uuid), void 0 === e[o.image] && console.warn("THREE.ObjectLoader: Undefined image", o.image); | |
var s = new je(e[o.image]); | |
s.needsUpdate = !0, s.uuid = o.uuid, void 0 !== o.name && (s.name = o.name), void 0 !== o.mapping && (s.mapping = n(o.mapping, Es)), void 0 !== o.offset && s.offset.fromArray(o.offset), void 0 !== o.repeat && s.repeat.fromArray(o.repeat), void 0 !== o.center && s.center.fromArray(o.center), void 0 !== o.rotation && (s.rotation = o.rotation), void 0 !== o.wrap && (s.wrapS = n(o.wrap[0], Ss), s.wrapT = n(o.wrap[1], Ss)), void 0 !== o.format && (s.format = o.format), void 0 !== o.minFilter && (s.minFilter = n(o.minFilter, Ts)), void 0 !== o.magFilter && (s.magFilter = n(o.magFilter, Ts)), void 0 !== o.anisotropy && (s.anisotropy = o.anisotropy), void 0 !== o.flipY && (s.flipY = o.flipY), i[o.uuid] = s | |
} | |
return i | |
}, | |
parseObject: function(t, e, n) { | |
var i; | |
function r(t) { | |
return void 0 === e[t] && console.warn("THREE.ObjectLoader: Undefined geometry", t), e[t] | |
} | |
function a(t) { | |
if (void 0 !== t) { | |
if (Array.isArray(t)) { | |
for (var e = [], i = 0, r = t.length; i < r; i++) { | |
var a = t[i]; | |
void 0 === n[a] && console.warn("THREE.ObjectLoader: Undefined material", a), e.push(n[a]) | |
} | |
return e | |
} | |
return void 0 === n[t] && console.warn("THREE.ObjectLoader: Undefined material", t), n[t] | |
} | |
} | |
switch (t.type) { | |
case "Scene": | |
i = new Tr, void 0 !== t.background && Number.isInteger(t.background) && (i.background = new rn(t.background)), void 0 !== t.fog && ("Fog" === t.fog.type ? i.fog = new Sr(t.fog.color, t.fog.near, t.fog.far) : "FogExp2" === t.fog.type && (i.fog = new Er(t.fog.color, t.fog.density))); | |
break; | |
case "PerspectiveCamera": | |
i = new _r(t.fov, t.aspect, t.near, t.far), void 0 !== t.focus && (i.focus = t.focus), void 0 !== t.zoom && (i.zoom = t.zoom), void 0 !== t.filmGauge && (i.filmGauge = t.filmGauge), void 0 !== t.filmOffset && (i.filmOffset = t.filmOffset), void 0 !== t.view && (i.view = Object.assign({}, t.view)); | |
break; | |
case "OrthographicCamera": | |
i = new yn(t.left, t.right, t.top, t.bottom, t.near, t.far), void 0 !== t.zoom && (i.zoom = t.zoom), void 0 !== t.view && (i.view = Object.assign({}, t.view)); | |
break; | |
case "AmbientLight": | |
i = new Ko(t.color, t.intensity); | |
break; | |
case "DirectionalLight": | |
i = new Qo(t.color, t.intensity); | |
break; | |
case "PointLight": | |
i = new Jo(t.color, t.intensity, t.distance, t.decay); | |
break; | |
case "RectAreaLight": | |
i = new $o(t.color, t.intensity, t.width, t.height); | |
break; | |
case "SpotLight": | |
i = new Yo(t.color, t.intensity, t.distance, t.angle, t.penumbra, t.decay); | |
break; | |
case "HemisphereLight": | |
i = new Wo(t.color, t.groundColor, t.intensity); | |
break; | |
case "SkinnedMesh": | |
console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet."); | |
case "Mesh": | |
var o = r(t.geometry), | |
s = a(t.material); | |
i = o.bones && o.bones.length > 0 ? new Or(o, s) : new ni(o, s); | |
break; | |
case "LOD": | |
i = new Lr; | |
break; | |
case "Line": | |
i = new Ur(r(t.geometry), a(t.material), t.mode); | |
break; | |
case "LineLoop": | |
i = new Br(r(t.geometry), a(t.material)); | |
break; | |
case "LineSegments": | |
i = new Nr(r(t.geometry), a(t.material)); | |
break; | |
case "PointCloud": | |
case "Points": | |
i = new Fr(r(t.geometry), a(t.material)); | |
break; | |
case "Sprite": | |
i = new Ir(a(t.material)); | |
break; | |
case "Group": | |
i = new Gr; | |
break; | |
default: | |
i = new gn | |
} | |
if (i.uuid = t.uuid, void 0 !== t.name && (i.name = t.name), void 0 !== t.matrix ? (i.matrix.fromArray(t.matrix), i.matrix.decompose(i.position, i.quaternion, i.scale)) : (void 0 !== t.position && i.position.fromArray(t.position), void 0 !== t.rotation && i.rotation.fromArray(t.rotation), void 0 !== t.quaternion && i.quaternion.fromArray(t.quaternion), void 0 !== t.scale && i.scale.fromArray(t.scale)), void 0 !== t.castShadow && (i.castShadow = t.castShadow), void 0 !== t.receiveShadow && (i.receiveShadow = t.receiveShadow), t.shadow && (void 0 !== t.shadow.bias && (i.shadow.bias = t.shadow.bias), void 0 !== t.shadow.radius && (i.shadow.radius = t.shadow.radius), void 0 !== t.shadow.mapSize && i.shadow.mapSize.fromArray(t.shadow.mapSize), void 0 !== t.shadow.camera && (i.shadow.camera = this.parseObject(t.shadow.camera))), void 0 !== t.visible && (i.visible = t.visible), void 0 !== t.frustumCulled && (i.frustumCulled = t.frustumCulled), void 0 !== t.renderOrder && (i.renderOrder = t.renderOrder), void 0 !== t.userData && (i.userData = t.userData), void 0 !== t.children) | |
for (var c = t.children, h = 0; h < c.length; h++) i.add(this.parseObject(c[h], e, n)); | |
if ("LOD" === t.type) | |
for (var l = t.levels, u = 0; u < l.length; u++) { | |
var p = l[u], | |
d = i.getObjectByProperty("uuid", p.object); | |
void 0 !== d && i.addLevel(d, p.distance) | |
} | |
return i | |
} | |
}); | |
var Ms, Es = { | |
UVMapping: 300, | |
CubeReflectionMapping: dt, | |
CubeRefractionMapping: ft, | |
EquirectangularReflectionMapping: mt, | |
EquirectangularRefractionMapping: gt, | |
SphericalReflectionMapping: vt, | |
CubeUVReflectionMapping: yt, | |
CubeUVRefractionMapping: xt | |
}, | |
Ss = { | |
RepeatWrapping: wt, | |
ClampToEdgeWrapping: _t, | |
MirroredRepeatWrapping: bt | |
}, | |
Ts = { | |
NearestFilter: At, | |
NearestMipMapNearestFilter: Mt, | |
NearestMipMapLinearFilter: Et, | |
LinearFilter: St, | |
LinearMipMapNearestFilter: Tt, | |
LinearMipMapLinearFilter: Ct | |
}; | |
function Cs(t) { | |
"undefined" == typeof createImageBitmap && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."), "undefined" == typeof fetch && console.warn("THREE.ImageBitmapLoader: fetch() not supported."), this.manager = void 0 !== t ? t : fo, this.options = void 0 | |
} | |
function Is() { | |
this.type = "ShapePath", this.subPaths = [], this.currentPath = null | |
} | |
function Ls(t) { | |
this.type = "Font", this.data = t | |
} | |
function Rs(t, e, n, i, r, a) { | |
var o = a.glyphs[t] || a.glyphs["?"]; | |
if (o) { | |
var s, c, h, l, u, p, d, f, m = new Is; | |
if (o.o) | |
for (var g = o._cachedOutline || (o._cachedOutline = o.o.split(" ")), v = 0, y = g.length; v < y;) { | |
switch (g[v++]) { | |
case "m": | |
s = g[v++] * n + i, c = g[v++] * n + r, m.moveTo(s, c); | |
break; | |
case "l": | |
s = g[v++] * n + i, c = g[v++] * n + r, m.lineTo(s, c); | |
break; | |
case "q": | |
h = g[v++] * n + i, l = g[v++] * n + r, u = g[v++] * n + i, p = g[v++] * n + r, m.quadraticCurveTo(u, p, h, l); | |
break; | |
case "b": | |
h = g[v++] * n + i, l = g[v++] * n + r, u = g[v++] * n + i, p = g[v++] * n + r, d = g[v++] * n + i, f = g[v++] * n + r, m.bezierCurveTo(u, p, d, f, h, l) | |
} | |
} | |
return { | |
offsetX: o.ha * n, | |
path: m | |
} | |
} | |
} | |
Cs.prototype = { | |
constructor: Cs, | |
setOptions: function(t) { | |
return this.options = t, this | |
}, | |
load: function(t, e, n, i) { | |
void 0 === t && (t = ""), void 0 !== this.path && (t = this.path + t); | |
var r = this, | |
a = uo.get(t); | |
if (void 0 !== a) return r.manager.itemStart(t), setTimeout(function() { | |
e && e(a), r.manager.itemEnd(t) | |
}, 0), a; | |
fetch(t).then(function(t) { | |
return t.blob() | |
}).then(function(t) { | |
return createImageBitmap(t, r.options) | |
}).then(function(n) { | |
uo.add(t, n), e && e(n), r.manager.itemEnd(t) | |
}).catch(function(e) { | |
i && i(e), r.manager.itemEnd(t), r.manager.itemError(t) | |
}) | |
}, | |
setCrossOrigin: function() { | |
return this | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
} | |
}, Object.assign(Is.prototype, { | |
moveTo: function(t, e) { | |
this.currentPath = new Ho, this.subPaths.push(this.currentPath), this.currentPath.moveTo(t, e) | |
}, | |
lineTo: function(t, e) { | |
this.currentPath.lineTo(t, e) | |
}, | |
quadraticCurveTo: function(t, e, n, i) { | |
this.currentPath.quadraticCurveTo(t, e, n, i) | |
}, | |
bezierCurveTo: function(t, e, n, i, r, a) { | |
this.currentPath.bezierCurveTo(t, e, n, i, r, a) | |
}, | |
splineThru: function(t) { | |
this.currentPath.splineThru(t) | |
}, | |
toShapes: function(t, e) { | |
function n(t) { | |
for (var e = [], n = 0, i = t.length; n < i; n++) { | |
var r = t[n], | |
a = new Vo; | |
a.curves = r.curves, e.push(a) | |
} | |
return e | |
} | |
function i(t, e) { | |
for (var n = e.length, i = !1, r = n - 1, a = 0; a < n; r = a++) { | |
var o = e[r], | |
s = e[a], | |
c = s.x - o.x, | |
h = s.y - o.y; | |
if (Math.abs(h) > Number.EPSILON) { | |
if (h < 0 && (o = e[a], c = -c, s = e[r], h = -h), t.y < o.y || t.y > s.y) continue; | |
if (t.y === o.y) { | |
if (t.x === o.x) return !0 | |
} else { | |
var l = h * (t.x - o.x) - c * (t.y - o.y); | |
if (0 === l) return !0; | |
if (l < 0) continue; | |
i = !i | |
} | |
} else { | |
if (t.y !== o.y) continue; | |
if (s.x <= t.x && t.x <= o.x || o.x <= t.x && t.x <= s.x) return !0 | |
} | |
} | |
return i | |
} | |
var r = Ra.isClockWise, | |
a = this.subPaths; | |
if (0 === a.length) return []; | |
if (!0 === e) return n(a); | |
var o, s, c, h = []; | |
if (1 === a.length) return s = a[0], (c = new Vo).curves = s.curves, h.push(c), h; | |
var l = !r(a[0].getPoints()); | |
l = t ? !l : l; | |
var u, p, d = [], | |
f = [], | |
m = [], | |
g = 0; | |
f[g] = void 0, m[g] = []; | |
for (var v = 0, y = a.length; v < y; v++) o = r(u = (s = a[v]).getPoints()), (o = t ? !o : o) ? (!l && f[g] && g++, f[g] = { | |
s: new Vo, | |
p: u | |
}, f[g].s.curves = s.curves, l && g++, m[g] = []) : m[g].push({ | |
h: s, | |
p: u[0] | |
}); | |
if (!f[0]) return n(a); | |
if (f.length > 1) { | |
for (var x = !1, w = [], _ = 0, b = f.length; _ < b; _++) d[_] = []; | |
for (_ = 0, b = f.length; _ < b; _++) | |
for (var A = m[_], M = 0; M < A.length; M++) { | |
for (var E = A[M], S = !0, T = 0; T < f.length; T++) i(E.p, f[T].p) && (_ !== T && w.push({ | |
froms: _, | |
tos: T, | |
hole: M | |
}), S ? (S = !1, d[T].push(E)) : x = !0); | |
S && d[_].push(E) | |
} | |
w.length > 0 && (x || (m = d)) | |
} | |
v = 0; | |
for (var C = f.length; v < C; v++) { | |
c = f[v].s, h.push(c); | |
for (var I = 0, L = (p = m[v]).length; I < L; I++) c.holes.push(p[I].h) | |
} | |
return h | |
} | |
}), Object.assign(Ls.prototype, { | |
isFont: !0, | |
generateShapes: function(t, e, n) { | |
void 0 === e && (e = 100), void 0 === n && (n = 4); | |
for (var i = [], r = function(t, e, n, i) { | |
for (var r = String(t).split(""), a = e / i.resolution, o = (i.boundingBox.yMax - i.boundingBox.yMin + i.underlineThickness) * a, s = [], c = 0, h = 0, l = 0; l < r.length; l++) { | |
var u = r[l]; | |
if ("\n" === u) c = 0, h -= o; | |
else { | |
var p = Rs(u, n, a, c, h, i); | |
c += p.offsetX, s.push(p.path) | |
} | |
} | |
return s | |
}(t, e, n, this.data), a = 0, o = r.length; a < o; a++) Array.prototype.push.apply(i, r[a].toShapes()); | |
return i | |
} | |
}), Object.assign(function(t) { | |
this.manager = void 0 !== t ? t : fo | |
}.prototype, { | |
load: function(t, e, n, i) { | |
var r = this, | |
a = new go(this.manager); | |
a.setPath(this.path), a.load(t, function(t) { | |
var n; | |
try { | |
n = JSON.parse(t) | |
} catch (e) { | |
console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."), n = JSON.parse(t.substring(65, t.length - 2)) | |
} | |
var i = r.parse(n); | |
e && e(i) | |
}, n, i) | |
}, | |
parse: function(t) { | |
return new Ls(t) | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
} | |
}); | |
var Ps, Os, Ds, Us, Ns, Bs, zs, Fs, Gs, ks, Hs = { | |
getContext: function() { | |
return void 0 === Ms && (Ms = new(window.AudioContext || window.webkitAudioContext)), Ms | |
}, | |
setContext: function(t) { | |
Ms = t | |
} | |
}; | |
function Vs(t) { | |
this.manager = void 0 !== t ? t : fo | |
} | |
function js(t, e, n) { | |
gn.call(this), this.type = "CubeCamera"; | |
var i = new _r(90, 1, t, e); | |
i.up.set(0, -1, 0), i.lookAt(new Ue(1, 0, 0)), this.add(i); | |
var r = new _r(90, 1, t, e); | |
r.up.set(0, -1, 0), r.lookAt(new Ue(-1, 0, 0)), this.add(r); | |
var a = new _r(90, 1, t, e); | |
a.up.set(0, 0, 1), a.lookAt(new Ue(0, 1, 0)), this.add(a); | |
var o = new _r(90, 1, t, e); | |
o.up.set(0, 0, -1), o.lookAt(new Ue(0, -1, 0)), this.add(o); | |
var s = new _r(90, 1, t, e); | |
s.up.set(0, -1, 0), s.lookAt(new Ue(0, 0, 1)), this.add(s); | |
var c = new _r(90, 1, t, e); | |
c.up.set(0, -1, 0), c.lookAt(new Ue(0, 0, -1)), this.add(c); | |
var h = { | |
format: Ht, | |
magFilter: St, | |
minFilter: St | |
}; | |
this.renderTarget = new qe(n, n, h), this.renderTarget.texture.name = "CubeCamera", this.update = function(t, e) { | |
null === this.parent && this.updateMatrixWorld(); | |
var n = this.renderTarget, | |
h = n.texture.generateMipmaps; | |
n.texture.generateMipmaps = !1, n.activeCubeFace = 0, t.render(e, i, n), n.activeCubeFace = 1, t.render(e, r, n), n.activeCubeFace = 2, t.render(e, a, n), n.activeCubeFace = 3, t.render(e, o, n), n.activeCubeFace = 4, t.render(e, s, n), n.texture.generateMipmaps = h, n.activeCubeFace = 5, t.render(e, c, n), t.setRenderTarget(null) | |
}, this.clear = function(t, e, n, i) { | |
for (var r = this.renderTarget, a = 0; a < 6; a++) r.activeCubeFace = a, t.setRenderTarget(r), t.clear(e, n, i); | |
t.setRenderTarget(null) | |
} | |
} | |
function Ws() { | |
gn.call(this), this.type = "AudioListener", this.context = Hs.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null | |
} | |
function Xs(t) { | |
gn.call(this), this.type = "Audio", this.context = t.context, this.gain = this.context.createGain(), this.gain.connect(t.getInput()), this.autoplay = !1, this.buffer = null, this.loop = !1, this.startTime = 0, this.offset = 0, this.playbackRate = 1, this.isPlaying = !1, this.hasPlaybackControl = !0, this.sourceType = "empty", this.filters = [] | |
} | |
function qs(t) { | |
Xs.call(this, t), this.panner = this.context.createPanner(), this.panner.connect(this.gain) | |
} | |
function Ys(t, e) { | |
this.analyser = t.context.createAnalyser(), this.analyser.fftSize = void 0 !== e ? e : 2048, this.data = new Uint8Array(this.analyser.frequencyBinCount), t.getOutput().connect(this.analyser) | |
} | |
function Js(t, e, n) { | |
this.binding = t, this.valueSize = n; | |
var i, r = Float64Array; | |
switch (e) { | |
case "quaternion": | |
i = this._slerp; | |
break; | |
case "string": | |
case "bool": | |
r = Array, i = this._select; | |
break; | |
default: | |
i = this._lerp | |
} | |
this.buffer = new r(4 * n), this._mixBufferRegion = i, this.cumulativeWeight = 0, this.useCount = 0, this.referenceCount = 0 | |
} | |
Object.assign(Vs.prototype, { | |
load: function(t, e, n, i) { | |
var r = new go(this.manager); | |
r.setResponseType("arraybuffer"), r.load(t, function(t) { | |
Hs.getContext().decodeAudioData(t, function(t) { | |
e(t) | |
}) | |
}, n, i) | |
} | |
}), Object.assign(function() { | |
this.type = "StereoCamera", this.aspect = 1, this.eyeSep = .064, this.cameraL = new _r, this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new _r, this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1 | |
}.prototype, { | |
update: (Gs = new Oe, ks = new Oe, function(t) { | |
if (Ps !== this || Os !== t.focus || Ds !== t.fov || Us !== t.aspect * this.aspect || Ns !== t.near || Bs !== t.far || zs !== t.zoom || Fs !== this.eyeSep) { | |
Ps = this, Os = t.focus, Ds = t.fov, Us = t.aspect * this.aspect, Ns = t.near, Bs = t.far, zs = t.zoom; | |
var e, n, i = t.projectionMatrix.clone(), | |
r = (Fs = this.eyeSep / 2) * Ns / Os, | |
a = Ns * Math.tan(Re.DEG2RAD * Ds * .5) / zs; | |
ks.elements[12] = -Fs, Gs.elements[12] = Fs, e = -a * Us + r, n = a * Us + r, i.elements[0] = 2 * Ns / (n - e), i.elements[8] = (n + e) / (n - e), this.cameraL.projectionMatrix.copy(i), e = -a * Us - r, n = a * Us - r, i.elements[0] = 2 * Ns / (n - e), i.elements[8] = (n + e) / (n - e), this.cameraR.projectionMatrix.copy(i) | |
} | |
this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(ks), this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Gs) | |
}) | |
}), js.prototype = Object.create(gn.prototype), js.prototype.constructor = js, Ws.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Ws, | |
getInput: function() { | |
return this.gain | |
}, | |
removeFilter: function() { | |
null !== this.filter && (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination), this.gain.connect(this.context.destination), this.filter = null) | |
}, | |
getFilter: function() { | |
return this.filter | |
}, | |
setFilter: function(t) { | |
null !== this.filter ? (this.gain.disconnect(this.filter), this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination), this.filter = t, this.gain.connect(this.filter), this.filter.connect(this.context.destination) | |
}, | |
getMasterVolume: function() { | |
return this.gain.gain.value | |
}, | |
setMasterVolume: function(t) { | |
this.gain.gain.value = t | |
}, | |
updateMatrixWorld: function() { | |
var t = new Ue, | |
e = new De, | |
n = new Ue, | |
i = new Ue; | |
return function(r) { | |
gn.prototype.updateMatrixWorld.call(this, r); | |
var a = this.context.listener, | |
o = this.up; | |
this.matrixWorld.decompose(t, e, n), i.set(0, 0, -1).applyQuaternion(e), a.positionX ? (a.positionX.setValueAtTime(t.x, this.context.currentTime), a.positionY.setValueAtTime(t.y, this.context.currentTime), a.positionZ.setValueAtTime(t.z, this.context.currentTime), a.forwardX.setValueAtTime(i.x, this.context.currentTime), a.forwardY.setValueAtTime(i.y, this.context.currentTime), a.forwardZ.setValueAtTime(i.z, this.context.currentTime), a.upX.setValueAtTime(o.x, this.context.currentTime), a.upY.setValueAtTime(o.y, this.context.currentTime), a.upZ.setValueAtTime(o.z, this.context.currentTime)) : (a.setPosition(t.x, t.y, t.z), a.setOrientation(i.x, i.y, i.z, o.x, o.y, o.z)) | |
} | |
}() | |
}), Xs.prototype = Object.assign(Object.create(gn.prototype), { | |
constructor: Xs, | |
getOutput: function() { | |
return this.gain | |
}, | |
setNodeSource: function(t) { | |
return this.hasPlaybackControl = !1, this.sourceType = "audioNode", this.source = t, this.connect(), this | |
}, | |
setBuffer: function(t) { | |
return this.buffer = t, this.sourceType = "buffer", this.autoplay && this.play(), this | |
}, | |
play: function() { | |
if (!0 !== this.isPlaying) { | |
if (!1 !== this.hasPlaybackControl) { | |
var t = this.context.createBufferSource(); | |
return t.buffer = this.buffer, t.loop = this.loop, t.onended = this.onEnded.bind(this), t.playbackRate.setValueAtTime(this.playbackRate, this.startTime), this.startTime = this.context.currentTime, t.start(this.startTime, this.offset), this.isPlaying = !0, this.source = t, this.connect() | |
} | |
console.warn("THREE.Audio: this Audio has no playback control.") | |
} else console.warn("THREE.Audio: Audio is already playing.") | |
}, | |
pause: function() { | |
if (!1 !== this.hasPlaybackControl) return !0 === this.isPlaying && (this.source.stop(), this.offset += (this.context.currentTime - this.startTime) * this.playbackRate, this.isPlaying = !1), this; | |
console.warn("THREE.Audio: this Audio has no playback control.") | |
}, | |
stop: function() { | |
if (!1 !== this.hasPlaybackControl) return this.source.stop(), this.offset = 0, this.isPlaying = !1, this; | |
console.warn("THREE.Audio: this Audio has no playback control.") | |
}, | |
connect: function() { | |
if (this.filters.length > 0) { | |
this.source.connect(this.filters[0]); | |
for (var t = 1, e = this.filters.length; t < e; t++) this.filters[t - 1].connect(this.filters[t]); | |
this.filters[this.filters.length - 1].connect(this.getOutput()) | |
} else this.source.connect(this.getOutput()); | |
return this | |
}, | |
disconnect: function() { | |
if (this.filters.length > 0) { | |
this.source.disconnect(this.filters[0]); | |
for (var t = 1, e = this.filters.length; t < e; t++) this.filters[t - 1].disconnect(this.filters[t]); | |
this.filters[this.filters.length - 1].disconnect(this.getOutput()) | |
} else this.source.disconnect(this.getOutput()); | |
return this | |
}, | |
getFilters: function() { | |
return this.filters | |
}, | |
setFilters: function(t) { | |
return t || (t = []), !0 === this.isPlaying ? (this.disconnect(), this.filters = t, this.connect()) : this.filters = t, this | |
}, | |
getFilter: function() { | |
return this.getFilters()[0] | |
}, | |
setFilter: function(t) { | |
return this.setFilters(t ? [t] : []) | |
}, | |
setPlaybackRate: function(t) { | |
if (!1 !== this.hasPlaybackControl) return this.playbackRate = t, !0 === this.isPlaying && this.source.playbackRate.setValueAtTime(this.playbackRate, this.context.currentTime), this; | |
console.warn("THREE.Audio: this Audio has no playback control.") | |
}, | |
getPlaybackRate: function() { | |
return this.playbackRate | |
}, | |
onEnded: function() { | |
this.isPlaying = !1 | |
}, | |
getLoop: function() { | |
return !1 === this.hasPlaybackControl ? (console.warn("THREE.Audio: this Audio has no playback control."), !1) : this.loop | |
}, | |
setLoop: function(t) { | |
if (!1 !== this.hasPlaybackControl) return this.loop = t, !0 === this.isPlaying && (this.source.loop = this.loop), this; | |
console.warn("THREE.Audio: this Audio has no playback control.") | |
}, | |
getVolume: function() { | |
return this.gain.gain.value | |
}, | |
setVolume: function(t) { | |
return this.gain.gain.value = t, this | |
} | |
}), qs.prototype = Object.assign(Object.create(Xs.prototype), { | |
constructor: qs, | |
getOutput: function() { | |
return this.panner | |
}, | |
getRefDistance: function() { | |
return this.panner.refDistance | |
}, | |
setRefDistance: function(t) { | |
this.panner.refDistance = t | |
}, | |
getRolloffFactor: function() { | |
return this.panner.rolloffFactor | |
}, | |
setRolloffFactor: function(t) { | |
this.panner.rolloffFactor = t | |
}, | |
getDistanceModel: function() { | |
return this.panner.distanceModel | |
}, | |
setDistanceModel: function(t) { | |
this.panner.distanceModel = t | |
}, | |
getMaxDistance: function() { | |
return this.panner.maxDistance | |
}, | |
setMaxDistance: function(t) { | |
this.panner.maxDistance = t | |
}, | |
updateMatrixWorld: function() { | |
var t = new Ue; | |
return function(e) { | |
gn.prototype.updateMatrixWorld.call(this, e), t.setFromMatrixPosition(this.matrixWorld), this.panner.setPosition(t.x, t.y, t.z) | |
} | |
}() | |
}), Object.assign(Ys.prototype, { | |
getFrequencyData: function() { | |
return this.analyser.getByteFrequencyData(this.data), this.data | |
}, | |
getAverageFrequency: function() { | |
for (var t = 0, e = this.getFrequencyData(), n = 0; n < e.length; n++) t += e[n]; | |
return t / e.length | |
} | |
}), Object.assign(Js.prototype, { | |
accumulate: function(t, e) { | |
var n = this.buffer, | |
i = this.valueSize, | |
r = t * i + i, | |
a = this.cumulativeWeight; | |
if (0 === a) { | |
for (var o = 0; o !== i; ++o) n[r + o] = n[o]; | |
a = e | |
} else { | |
var s = e / (a += e); | |
this._mixBufferRegion(n, r, 0, s, i) | |
} | |
this.cumulativeWeight = a | |
}, | |
apply: function(t) { | |
var e = this.valueSize, | |
n = this.buffer, | |
i = t * e + e, | |
r = this.cumulativeWeight, | |
a = this.binding; | |
if (this.cumulativeWeight = 0, r < 1) { | |
var o = 3 * e; | |
this._mixBufferRegion(n, i, o, 1 - r, e) | |
} | |
for (var s = e, c = e + e; s !== c; ++s) | |
if (n[s] !== n[s + e]) { | |
a.setValue(n, i); | |
break | |
} | |
}, | |
saveOriginalState: function() { | |
var t = this.binding, | |
e = this.buffer, | |
n = this.valueSize, | |
i = 3 * n; | |
t.getValue(e, i); | |
for (var r = n, a = i; r !== a; ++r) e[r] = e[i + r % n]; | |
this.cumulativeWeight = 0 | |
}, | |
restoreOriginalState: function() { | |
var t = 3 * this.valueSize; | |
this.binding.setValue(this.buffer, t) | |
}, | |
_select: function(t, e, n, i, r) { | |
if (i >= .5) | |
for (var a = 0; a !== r; ++a) t[e + a] = t[n + a] | |
}, | |
_slerp: function(t, e, n, i) { | |
De.slerpFlat(t, e, t, e, t, n, i) | |
}, | |
_lerp: function(t, e, n, i, r) { | |
for (var a = 1 - i, o = 0; o !== r; ++o) { | |
var s = e + o; | |
t[s] = t[s] * a + t[n + o] * i | |
} | |
} | |
}); | |
var Zs, Qs, Ks, $s, tc, ec, nc, ic, rc, ac, oc, sc, cc; | |
function hc(t, e, n) { | |
var i = n || lc.parseTrackName(e); | |
this._targetGroup = t, this._bindings = t.subscribe_(e, i) | |
} | |
function lc(t, e, n) { | |
this.path = e, this.parsedPath = n || lc.parseTrackName(e), this.node = lc.findNode(t, this.parsedPath.nodeName) || t, this.rootNode = t | |
} | |
function uc(t, e, n) { | |
this._mixer = t, this._clip = e, this._localRoot = n || null; | |
for (var i = e.tracks, r = i.length, a = new Array(r), o = { | |
endingStart: ye, | |
endingEnd: ye | |
}, s = 0; s !== r; ++s) { | |
var c = i[s].createInterpolant(null); | |
a[s] = c, c.settings = o | |
} | |
this._interpolantSettings = o, this._interpolants = a, this._propertyBindings = new Array(r), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = ve, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = Infinity, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0 | |
} | |
function pc(t) { | |
this._root = t, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1 | |
} | |
function dc(t) { | |
"string" == typeof t && (console.warn("THREE.Uniform: Type parameter is no longer needed."), t = arguments[1]), this.value = t | |
} | |
function fc() { | |
Bn.call(this), this.type = "InstancedBufferGeometry", this.maxInstancedCount = void 0 | |
} | |
function mc(t, e, n, i) { | |
this.data = t, this.itemSize = e, this.offset = n, this.normalized = !0 === i | |
} | |
function gc(t, e) { | |
this.array = t, this.stride = e, this.count = void 0 !== t ? t.length / e : 0, this.dynamic = !1, this.updateRange = { | |
offset: 0, | |
count: -1 | |
}, this.version = 0 | |
} | |
function vc(t, e, n) { | |
gc.call(this, t, e), this.meshPerAttribute = n || 1 | |
} | |
function yc(t, e, n) { | |
Mn.call(this, t, e), this.meshPerAttribute = n || 1 | |
} | |
function xc(t, e, n, i) { | |
this.ray = new $n(t, e), this.near = n || 0, this.far = i || Infinity, this.params = { | |
Mesh: {}, | |
Line: {}, | |
LOD: {}, | |
Points: { | |
threshold: 1 | |
}, | |
Sprite: {} | |
}, Object.defineProperties(this.params, { | |
PointCloud: { | |
get: function() { | |
return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."), this.Points | |
} | |
} | |
}) | |
} | |
function wc(t, e) { | |
return t.distance - e.distance | |
} | |
function _c(t, e, n, i) { | |
if (!1 !== t.visible && (t.raycast(e, n), !0 === i)) | |
for (var r = t.children, a = 0, o = r.length; a < o; a++) _c(r[a], e, n, !0) | |
} | |
function bc(t) { | |
this.autoStart = void 0 === t || t, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1 | |
} | |
function Ac(t, e) { | |
this.min = void 0 !== t ? t : new Pe(Infinity, Infinity), this.max = void 0 !== e ? e : new Pe(-Infinity, -Infinity) | |
} | |
function Mc(t) { | |
gn.call(this), this.material = t, this.render = function() {} | |
} | |
function Ec(t, e, n, i) { | |
this.object = t, this.size = void 0 !== e ? e : 1; | |
var r = void 0 !== n ? n : 16711680, | |
a = void 0 !== i ? i : 1, | |
o = 0, | |
s = this.object.geometry; | |
s && s.isGeometry ? o = 3 * s.faces.length : s && s.isBufferGeometry && (o = s.attributes.normal.count); | |
var c = new Bn, | |
h = new Pn(2 * o * 3, 3); | |
c.addAttribute("position", h), Nr.call(this, c, new Dr({ | |
color: r, | |
linewidth: a | |
})), this.matrixAutoUpdate = !1, this.update() | |
} | |
function Sc(t, e) { | |
gn.call(this), this.light = t, this.light.updateMatrixWorld(), this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.color = e; | |
for (var n = new Bn, i = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1], r = 0, a = 1; r < 32; r++, a++) { | |
var o = r / 32 * Math.PI * 2, | |
s = a / 32 * Math.PI * 2; | |
i.push(Math.cos(o), Math.sin(o), 1, Math.cos(s), Math.sin(s), 1) | |
} | |
n.addAttribute("position", new Pn(i, 3)); | |
var c = new Dr({ | |
fog: !1 | |
}); | |
this.cone = new Nr(n, c), this.add(this.cone), this.update() | |
} | |
function Tc(t) { | |
for (var e = function t(e) { | |
var n = []; | |
e && e.isBone && n.push(e); | |
for (var i = 0; i < e.children.length; i++) n.push.apply(n, t(e.children[i])); | |
return n | |
}(t), n = new Bn, i = [], r = [], a = new rn(0, 0, 1), o = new rn(0, 1, 0), s = 0; s < e.length; s++) { | |
var c = e[s]; | |
c.parent && c.parent.isBone && (i.push(0, 0, 0), i.push(0, 0, 0), r.push(a.r, a.g, a.b), r.push(o.r, o.g, o.b)) | |
} | |
n.addAttribute("position", new Pn(i, 3)), n.addAttribute("color", new Pn(r, 3)); | |
var h = new Dr({ | |
vertexColors: C, | |
depthTest: !1, | |
depthWrite: !1, | |
transparent: !0 | |
}); | |
Nr.call(this, n, h), this.root = t, this.bones = e, this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1 | |
} | |
function Cc(t, e, n) { | |
this.light = t, this.light.updateMatrixWorld(), this.color = n; | |
var i = new Fa(e, 4, 2), | |
r = new Qn({ | |
wireframe: !0, | |
fog: !1 | |
}); | |
ni.call(this, i, r), this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update() | |
} | |
function Ic(t, e) { | |
gn.call(this), this.light = t, this.light.updateMatrixWorld(), this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.color = e; | |
var n = new Dr({ | |
fog: !1 | |
}), | |
i = new Bn; | |
i.addAttribute("position", new Mn(new Float32Array(15), 3)), this.line = new Ur(i, n), this.add(this.line), this.update() | |
} | |
function Lc(t, e, n) { | |
gn.call(this), this.light = t, this.light.updateMatrixWorld(), this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.color = n; | |
var i = new Kr(e); | |
i.rotateY(.5 * Math.PI), this.material = new Qn({ | |
wireframe: !0, | |
fog: !1 | |
}), void 0 === this.color && (this.material.vertexColors = C); | |
var r = i.getAttribute("position"), | |
a = new Float32Array(3 * r.count); | |
i.addAttribute("color", new Mn(a, 3)), this.add(new ni(i, this.material)), this.update() | |
} | |
function Rc(t, e, n, i) { | |
t = t || 10, e = e || 10, n = new rn(void 0 !== n ? n : 4473924), i = new rn(void 0 !== i ? i : 8947848); | |
for (var r = e / 2, a = t / e, o = t / 2, s = [], c = [], h = 0, l = 0, u = -o; h <= e; h++, u += a) { | |
s.push(-o, 0, u, o, 0, u), s.push(u, 0, -o, u, 0, o); | |
var p = h === r ? n : i; | |
p.toArray(c, l), l += 3, p.toArray(c, l), l += 3, p.toArray(c, l), l += 3, p.toArray(c, l), l += 3 | |
} | |
var d = new Bn; | |
d.addAttribute("position", new Pn(s, 3)), d.addAttribute("color", new Pn(c, 3)); | |
var f = new Dr({ | |
vertexColors: C | |
}); | |
Nr.call(this, d, f) | |
} | |
function Pc(t, e, n, i, r, a) { | |
t = t || 10, e = e || 16, n = n || 8, i = i || 64, r = new rn(void 0 !== r ? r : 4473924), a = new rn(void 0 !== a ? a : 8947848); | |
var o, s, c, h, l, u, p, d = [], | |
f = []; | |
for (h = 0; h <= e; h++) c = h / e * (2 * Math.PI), o = Math.sin(c) * t, s = Math.cos(c) * t, d.push(0, 0, 0), d.push(o, 0, s), p = 1 & h ? r : a, f.push(p.r, p.g, p.b), f.push(p.r, p.g, p.b); | |
for (h = 0; h <= n; h++) | |
for (p = 1 & h ? r : a, u = t - t / n * h, l = 0; l < i; l++) c = l / i * (2 * Math.PI), o = Math.sin(c) * u, s = Math.cos(c) * u, d.push(o, 0, s), f.push(p.r, p.g, p.b), c = (l + 1) / i * (2 * Math.PI), o = Math.sin(c) * u, s = Math.cos(c) * u, d.push(o, 0, s), f.push(p.r, p.g, p.b); | |
var m = new Bn; | |
m.addAttribute("position", new Pn(d, 3)), m.addAttribute("color", new Pn(f, 3)); | |
var g = new Dr({ | |
vertexColors: C | |
}); | |
Nr.call(this, m, g) | |
} | |
function Oc(t, e, n, i) { | |
this.object = t, this.size = void 0 !== e ? e : 1; | |
var r = void 0 !== n ? n : 16776960, | |
a = void 0 !== i ? i : 1, | |
o = 0, | |
s = this.object.geometry; | |
s && s.isGeometry ? o = s.faces.length : console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead."); | |
var c = new Bn, | |
h = new Pn(2 * o * 3, 3); | |
c.addAttribute("position", h), Nr.call(this, c, new Dr({ | |
color: r, | |
linewidth: a | |
})), this.matrixAutoUpdate = !1, this.update() | |
} | |
function Dc(t, e, n) { | |
gn.call(this), this.light = t, this.light.updateMatrixWorld(), this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.color = n, void 0 === e && (e = 1); | |
var i = new Bn; | |
i.addAttribute("position", new Pn([-e, e, 0, e, e, 0, e, -e, 0, -e, -e, 0, -e, e, 0], 3)); | |
var r = new Dr({ | |
fog: !1 | |
}); | |
this.lightPlane = new Ur(i, r), this.add(this.lightPlane), (i = new Bn).addAttribute("position", new Pn([0, 0, 0, 0, 0, 1], 3)), this.targetLine = new Ur(i, r), this.add(this.targetLine), this.update() | |
} | |
function Uc(t) { | |
var e = new Bn, | |
n = new Dr({ | |
color: 16777215, | |
vertexColors: T | |
}), | |
i = [], | |
r = [], | |
a = {}, | |
o = new rn(16755200), | |
s = new rn(16711680), | |
c = new rn(43775), | |
h = new rn(16777215), | |
l = new rn(3355443); | |
function u(t, e, n) { | |
p(t, n), p(e, n) | |
} | |
function p(t, e) { | |
i.push(0, 0, 0), r.push(e.r, e.g, e.b), void 0 === a[t] && (a[t] = []), a[t].push(i.length / 3 - 1) | |
} | |
u("n1", "n2", o), u("n2", "n4", o), u("n4", "n3", o), u("n3", "n1", o), u("f1", "f2", o), u("f2", "f4", o), u("f4", "f3", o), u("f3", "f1", o), u("n1", "f1", o), u("n2", "f2", o), u("n3", "f3", o), u("n4", "f4", o), u("p", "n1", s), u("p", "n2", s), u("p", "n3", s), u("p", "n4", s), u("u1", "u2", c), u("u2", "u3", c), u("u3", "u1", c), u("c", "t", h), u("p", "c", l), u("cn1", "cn2", l), u("cn3", "cn4", l), u("cf1", "cf2", l), u("cf3", "cf4", l), e.addAttribute("position", new Pn(i, 3)), e.addAttribute("color", new Pn(r, 3)), Nr.call(this, e, n), this.camera = t, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = t.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = a, this.update() | |
} | |
function Nc(t, e) { | |
this.object = t, void 0 === e && (e = 16776960); | |
var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), | |
i = new Float32Array(24), | |
r = new Bn; | |
r.setIndex(new Mn(n, 1)), r.addAttribute("position", new Mn(i, 3)), Nr.call(this, r, new Dr({ | |
color: e | |
})), this.matrixAutoUpdate = !1, this.update() | |
} | |
function Bc(t, e) { | |
this.type = "Box3Helper", this.box = t; | |
var n = void 0 !== e ? e : 16776960, | |
i = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]), | |
r = new Bn; | |
r.setIndex(new Mn(i, 1)), r.addAttribute("position", new Pn([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1], 3)), Nr.call(this, r, new Dr({ | |
color: n | |
})), this.geometry.computeBoundingSphere() | |
} | |
function zc(t, e, n) { | |
this.type = "PlaneHelper", this.plane = t, this.size = void 0 === e ? 1 : e; | |
var i = void 0 !== n ? n : 16776960, | |
r = new Bn; | |
r.addAttribute("position", new Pn([1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0], 3)), r.computeBoundingSphere(), Ur.call(this, r, new Dr({ | |
color: i | |
})); | |
var a = new Bn; | |
a.addAttribute("position", new Pn([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1], 3)), a.computeBoundingSphere(), this.add(new ni(a, new Qn({ | |
color: i, | |
opacity: .2, | |
transparent: !0, | |
depthWrite: !1 | |
}))) | |
} | |
function Fc(t, e, n, i, r, a) { | |
gn.call(this), void 0 === i && (i = 16776960), void 0 === n && (n = 1), void 0 === r && (r = .2 * n), void 0 === a && (a = .2 * r), void 0 === ac && ((ac = new Bn).addAttribute("position", new Pn([0, 0, 0, 0, 1, 0], 3)), (oc = new Ja(0, .5, 1, 5, 1)).translate(0, -.5, 0)), this.position.copy(e), this.line = new Ur(ac, new Dr({ | |
color: i | |
})), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new ni(oc, new Qn({ | |
color: i | |
})), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(t), this.setLength(n, r, a) | |
} | |
function Gc(t) { | |
var e = [0, 0, 0, t = t || 1, 0, 0, 0, 0, 0, 0, t, 0, 0, 0, 0, 0, 0, t], | |
n = new Bn; | |
n.addAttribute("position", new Pn(e, 3)), n.addAttribute("color", new Pn([1, 0, 0, 1, .6, 0, 0, 1, 0, .6, 1, 0, 0, 0, 1, 0, .6, 1], 3)); | |
var i = new Dr({ | |
vertexColors: C | |
}); | |
Nr.call(this, n, i) | |
} | |
Object.assign(hc.prototype, { | |
getValue: function(t, e) { | |
this.bind(); | |
var n = this._targetGroup.nCachedObjects_, | |
i = this._bindings[n]; | |
void 0 !== i && i.getValue(t, e) | |
}, | |
setValue: function(t, e) { | |
for (var n = this._bindings, i = this._targetGroup.nCachedObjects_, r = n.length; i !== r; ++i) n[i].setValue(t, e) | |
}, | |
bind: function() { | |
for (var t = this._bindings, e = this._targetGroup.nCachedObjects_, n = t.length; e !== n; ++e) t[e].bind() | |
}, | |
unbind: function() { | |
for (var t = this._bindings, e = this._targetGroup.nCachedObjects_, n = t.length; e !== n; ++e) t[e].unbind() | |
} | |
}), Object.assign(lc, { | |
Composite: hc, | |
create: function(t, e, n) { | |
return t && t.isAnimationObjectGroup ? new lc.Composite(t, e, n) : new lc(t, e, n) | |
}, | |
sanitizeNodeName: (rc = new RegExp("[\\[\\]\\.:\\/]", "g"), function(t) { | |
return t.replace(/\s/g, "_").replace(rc, "") | |
}), | |
parseTrackName: (Zs = "[^\\[\\]\\.:\\/]", Qs = "[^" + "\\[\\]\\.:\\/".replace("\\.", "") + "]", Ks = /((?:WC+[\/:])*)/.source.replace("WC", Zs), $s = /(WCOD+)?/.source.replace("WCOD", Qs), tc = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", Zs), ec = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", Zs), nc = new RegExp("^" + Ks + $s + tc + ec + "$"), ic = ["material", "materials", "bones"], function(t) { | |
var e = nc.exec(t); | |
if (!e) throw new Error("PropertyBinding: Cannot parse trackName: " + t); | |
var n = { | |
nodeName: e[2], | |
objectName: e[3], | |
objectIndex: e[4], | |
propertyName: e[5], | |
propertyIndex: e[6] | |
}, | |
i = n.nodeName && n.nodeName.lastIndexOf("."); | |
if (void 0 !== i && -1 !== i) { | |
var r = n.nodeName.substring(i + 1); - 1 !== ic.indexOf(r) && (n.nodeName = n.nodeName.substring(0, i), n.objectName = r) | |
} | |
if (null === n.propertyName || 0 === n.propertyName.length) throw new Error("PropertyBinding: can not parse propertyName from trackName: " + t); | |
return n | |
}), | |
findNode: function(t, e) { | |
if (!e || "" === e || "root" === e || "." === e || -1 === e || e === t.name || e === t.uuid) return t; | |
if (t.skeleton) { | |
var n = t.skeleton.getBoneByName(e); | |
if (void 0 !== n) return n | |
} | |
if (t.children) { | |
var i = function(t) { | |
for (var n = 0; n < t.length; n++) { | |
var r = t[n]; | |
if (r.name === e || r.uuid === e) return r; | |
var a = i(r.children); | |
if (a) return a | |
} | |
return null | |
}, | |
r = i(t.children); | |
if (r) return r | |
} | |
return null | |
} | |
}), Object.assign(lc.prototype, { | |
_getValue_unavailable: function() {}, | |
_setValue_unavailable: function() {}, | |
BindingType: { | |
Direct: 0, | |
EntireArray: 1, | |
ArrayElement: 2, | |
HasFromToArray: 3 | |
}, | |
Versioning: { | |
None: 0, | |
NeedsUpdate: 1, | |
MatrixWorldNeedsUpdate: 2 | |
}, | |
GetterByBindingType: [function(t, e) { | |
t[e] = this.node[this.propertyName] | |
}, function(t, e) { | |
for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) t[e++] = n[i] | |
}, function(t, e) { | |
t[e] = this.resolvedProperty[this.propertyIndex] | |
}, function(t, e) { | |
this.resolvedProperty.toArray(t, e) | |
}], | |
SetterByBindingTypeAndVersioning: [ | |
[function(t, e) { | |
this.targetObject[this.propertyName] = t[e] | |
}, function(t, e) { | |
this.targetObject[this.propertyName] = t[e], this.targetObject.needsUpdate = !0 | |
}, function(t, e) { | |
this.targetObject[this.propertyName] = t[e], this.targetObject.matrixWorldNeedsUpdate = !0 | |
}], | |
[function(t, e) { | |
for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) n[i] = t[e++] | |
}, function(t, e) { | |
for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) n[i] = t[e++]; | |
this.targetObject.needsUpdate = !0 | |
}, function(t, e) { | |
for (var n = this.resolvedProperty, i = 0, r = n.length; i !== r; ++i) n[i] = t[e++]; | |
this.targetObject.matrixWorldNeedsUpdate = !0 | |
}], | |
[function(t, e) { | |
this.resolvedProperty[this.propertyIndex] = t[e] | |
}, function(t, e) { | |
this.resolvedProperty[this.propertyIndex] = t[e], this.targetObject.needsUpdate = !0 | |
}, function(t, e) { | |
this.resolvedProperty[this.propertyIndex] = t[e], this.targetObject.matrixWorldNeedsUpdate = !0 | |
}], | |
[function(t, e) { | |
this.resolvedProperty.fromArray(t, e) | |
}, function(t, e) { | |
this.resolvedProperty.fromArray(t, e), this.targetObject.needsUpdate = !0 | |
}, function(t, e) { | |
this.resolvedProperty.fromArray(t, e), this.targetObject.matrixWorldNeedsUpdate = !0 | |
}] | |
], | |
getValue: function(t, e) { | |
this.bind(), this.getValue(t, e) | |
}, | |
setValue: function(t, e) { | |
this.bind(), this.setValue(t, e) | |
}, | |
bind: function() { | |
var t = this.node, | |
e = this.parsedPath, | |
n = e.objectName, | |
i = e.propertyName, | |
r = e.propertyIndex; | |
if (t || (t = lc.findNode(this.rootNode, e.nodeName) || this.rootNode, this.node = t), this.getValue = this._getValue_unavailable, this.setValue = this._setValue_unavailable, t) { | |
if (n) { | |
var a = e.objectIndex; | |
switch (n) { | |
case "materials": | |
if (!t.material) return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this); | |
if (!t.material.materials) return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this); | |
t = t.material.materials; | |
break; | |
case "bones": | |
if (!t.skeleton) return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this); | |
t = t.skeleton.bones; | |
for (var o = 0; o < t.length; o++) | |
if (t[o].name === a) { | |
a = o; | |
break | |
} | |
break; | |
default: | |
if (void 0 === t[n]) return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this); | |
t = t[n] | |
} | |
if (void 0 !== a) { | |
if (void 0 === t[a]) return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, t); | |
t = t[a] | |
} | |
} | |
var s = t[i]; | |
if (void 0 !== s) { | |
var c = this.Versioning.None; | |
void 0 !== t.needsUpdate ? (c = this.Versioning.NeedsUpdate, this.targetObject = t) : void 0 !== t.matrixWorldNeedsUpdate && (c = this.Versioning.MatrixWorldNeedsUpdate, this.targetObject = t); | |
var h = this.BindingType.Direct; | |
if (void 0 !== r) { | |
if ("morphTargetInfluences" === i) { | |
if (!t.geometry) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this); | |
if (t.geometry.isBufferGeometry) { | |
if (!t.geometry.morphAttributes) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this); | |
for (o = 0; o < this.node.geometry.morphAttributes.position.length; o++) | |
if (t.geometry.morphAttributes.position[o].name === r) { | |
r = o; | |
break | |
} | |
} else { | |
if (!t.geometry.morphTargets) return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.", this); | |
for (o = 0; o < this.node.geometry.morphTargets.length; o++) | |
if (t.geometry.morphTargets[o].name === r) { | |
r = o; | |
break | |
} | |
} | |
} | |
h = this.BindingType.ArrayElement, this.resolvedProperty = s, this.propertyIndex = r | |
} else void 0 !== s.fromArray && void 0 !== s.toArray ? (h = this.BindingType.HasFromToArray, this.resolvedProperty = s) : Array.isArray(s) ? (h = this.BindingType.EntireArray, this.resolvedProperty = s) : this.propertyName = i; | |
this.getValue = this.GetterByBindingType[h], this.setValue = this.SetterByBindingTypeAndVersioning[h][c] | |
} else { | |
var l = e.nodeName; | |
console.error("THREE.PropertyBinding: Trying to update property for track: " + l + "." + i + " but it wasn't found.", t) | |
} | |
} else console.error("THREE.PropertyBinding: Trying to update node for track: " + this.path + " but it wasn't found.") | |
}, | |
unbind: function() { | |
this.node = null, this.getValue = this._getValue_unbound, this.setValue = this._setValue_unbound | |
} | |
}), Object.assign(lc.prototype, { | |
_getValue_unbound: lc.prototype.getValue, | |
_setValue_unbound: lc.prototype.setValue | |
}), Object.assign(function() { | |
this.uuid = Re.generateUUID(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0; | |
var t = {}; | |
this._indicesByUUID = t; | |
for (var e = 0, n = arguments.length; e !== n; ++e) t[arguments[e].uuid] = e; | |
this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {}; | |
var i = this; | |
this.stats = { | |
objects: { | |
get total() { | |
return i._objects.length | |
}, | |
get inUse() { | |
return this.total - i.nCachedObjects_ | |
} | |
}, | |
get bindingsPerObject() { | |
return i._bindings.length | |
} | |
} | |
}.prototype, { | |
isAnimationObjectGroup: !0, | |
add: function() { | |
for (var t = this._objects, e = t.length, n = this.nCachedObjects_, i = this._indicesByUUID, r = this._paths, a = this._parsedPaths, o = this._bindings, s = o.length, c = void 0, h = 0, l = arguments.length; h !== l; ++h) { | |
var u = arguments[h], | |
p = u.uuid, | |
d = i[p]; | |
if (void 0 === d) { | |
d = e++, i[p] = d, t.push(u); | |
for (var f = 0, m = s; f !== m; ++f) o[f].push(new lc(u, r[f], a[f])) | |
} else if (d < n) { | |
c = t[d]; | |
var g = --n, | |
v = t[g]; | |
i[v.uuid] = d, t[d] = v, i[p] = g, t[g] = u; | |
for (f = 0, m = s; f !== m; ++f) { | |
var y = o[f], | |
x = y[g], | |
w = y[d]; | |
y[d] = x, void 0 === w && (w = new lc(u, r[f], a[f])), y[g] = w | |
} | |
} else t[d] !== c && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.") | |
} | |
this.nCachedObjects_ = n | |
}, | |
remove: function() { | |
for (var t = this._objects, e = this.nCachedObjects_, n = this._indicesByUUID, i = this._bindings, r = i.length, a = 0, o = arguments.length; a !== o; ++a) { | |
var s = arguments[a], | |
c = s.uuid, | |
h = n[c]; | |
if (void 0 !== h && h >= e) { | |
var l = e++, | |
u = t[l]; | |
n[u.uuid] = h, t[h] = u, n[c] = l, t[l] = s; | |
for (var p = 0, d = r; p !== d; ++p) { | |
var f = i[p], | |
m = f[l], | |
g = f[h]; | |
f[h] = m, f[l] = g | |
} | |
} | |
} | |
this.nCachedObjects_ = e | |
}, | |
uncache: function() { | |
for (var t = this._objects, e = t.length, n = this.nCachedObjects_, i = this._indicesByUUID, r = this._bindings, a = r.length, o = 0, s = arguments.length; o !== s; ++o) { | |
var c = arguments[o].uuid, | |
h = i[c]; | |
if (void 0 !== h) | |
if (delete i[c], h < n) { | |
var l = --n, | |
u = t[l], | |
p = t[v = --e]; | |
i[u.uuid] = h, t[h] = u, i[p.uuid] = l, t[l] = p, t.pop(); | |
for (var d = 0, f = a; d !== f; ++d) { | |
var m = (y = r[d])[l], | |
g = y[v]; | |
y[h] = m, y[l] = g, y.pop() | |
} | |
} else { | |
var v; | |
i[(p = t[v = --e]).uuid] = h, t[h] = p, t.pop(); | |
for (d = 0, f = a; d !== f; ++d) { | |
var y; | |
(y = r[d])[h] = y[v], y.pop() | |
} | |
} | |
} | |
this.nCachedObjects_ = n | |
}, | |
subscribe_: function(t, e) { | |
var n = this._bindingsIndicesByPath, | |
i = n[t], | |
r = this._bindings; | |
if (void 0 !== i) return r[i]; | |
var a = this._paths, | |
o = this._parsedPaths, | |
s = this._objects, | |
c = s.length, | |
h = this.nCachedObjects_, | |
l = new Array(c); | |
i = r.length, n[t] = i, a.push(t), o.push(e), r.push(l); | |
for (var u = h, p = s.length; u !== p; ++u) { | |
var d = s[u]; | |
l[u] = new lc(d, t, e) | |
} | |
return l | |
}, | |
unsubscribe_: function(t) { | |
var e = this._bindingsIndicesByPath, | |
n = e[t]; | |
if (void 0 !== n) { | |
var i = this._paths, | |
r = this._parsedPaths, | |
a = this._bindings, | |
o = a.length - 1, | |
s = a[o]; | |
e[t[o]] = n, a[n] = s, a.pop(), r[n] = r[o], r.pop(), i[n] = i[o], i.pop() | |
} | |
} | |
}), Object.assign(uc.prototype, { | |
play: function() { | |
return this._mixer._activateAction(this), this | |
}, | |
stop: function() { | |
return this._mixer._deactivateAction(this), this.reset() | |
}, | |
reset: function() { | |
return this.paused = !1, this.enabled = !0, this.time = 0, this._loopCount = -1, this._startTime = null, this.stopFading().stopWarping() | |
}, | |
isRunning: function() { | |
return this.enabled && !this.paused && 0 !== this.timeScale && null === this._startTime && this._mixer._isActiveAction(this) | |
}, | |
isScheduled: function() { | |
return this._mixer._isActiveAction(this) | |
}, | |
startAt: function(t) { | |
return this._startTime = t, this | |
}, | |
setLoop: function(t, e) { | |
return this.loop = t, this.repetitions = e, this | |
}, | |
setEffectiveWeight: function(t) { | |
return this.weight = t, this._effectiveWeight = this.enabled ? t : 0, this.stopFading() | |
}, | |
getEffectiveWeight: function() { | |
return this._effectiveWeight | |
}, | |
fadeIn: function(t) { | |
return this._scheduleFading(t, 0, 1) | |
}, | |
fadeOut: function(t) { | |
return this._scheduleFading(t, 1, 0) | |
}, | |
crossFadeFrom: function(t, e, n) { | |
if (t.fadeOut(e), this.fadeIn(e), n) { | |
var i = this._clip.duration, | |
r = t._clip.duration, | |
a = r / i, | |
o = i / r; | |
t.warp(1, a, e), this.warp(o, 1, e) | |
} | |
return this | |
}, | |
crossFadeTo: function(t, e, n) { | |
return t.crossFadeFrom(this, e, n) | |
}, | |
stopFading: function() { | |
var t = this._weightInterpolant; | |
return null !== t && (this._weightInterpolant = null, this._mixer._takeBackControlInterpolant(t)), this | |
}, | |
setEffectiveTimeScale: function(t) { | |
return this.timeScale = t, this._effectiveTimeScale = this.paused ? 0 : t, this.stopWarping() | |
}, | |
getEffectiveTimeScale: function() { | |
return this._effectiveTimeScale | |
}, | |
setDuration: function(t) { | |
return this.timeScale = this._clip.duration / t, this.stopWarping() | |
}, | |
syncWith: function(t) { | |
return this.time = t.time, this.timeScale = t.timeScale, this.stopWarping() | |
}, | |
halt: function(t) { | |
return this.warp(this._effectiveTimeScale, 0, t) | |
}, | |
warp: function(t, e, n) { | |
var i = this._mixer, | |
r = i.time, | |
a = this._timeScaleInterpolant, | |
o = this.timeScale; | |
null === a && (a = i._lendControlInterpolant(), this._timeScaleInterpolant = a); | |
var s = a.parameterPositions, | |
c = a.sampleValues; | |
return s[0] = r, s[1] = r + n, c[0] = t / o, c[1] = e / o, this | |
}, | |
stopWarping: function() { | |
var t = this._timeScaleInterpolant; | |
return null !== t && (this._timeScaleInterpolant = null, this._mixer._takeBackControlInterpolant(t)), this | |
}, | |
getMixer: function() { | |
return this._mixer | |
}, | |
getClip: function() { | |
return this._clip | |
}, | |
getRoot: function() { | |
return this._localRoot || this._mixer._root | |
}, | |
_update: function(t, e, n, i) { | |
if (this.enabled) { | |
var r = this._startTime; | |
if (null !== r) { | |
var a = (t - r) * n; | |
if (a < 0 || 0 === n) return; | |
this._startTime = null, e = n * a | |
} | |
e *= this._updateTimeScale(t); | |
var o = this._updateTime(e), | |
s = this._updateWeight(t); | |
if (s > 0) | |
for (var c = this._interpolants, h = this._propertyBindings, l = 0, u = c.length; l !== u; ++l) c[l].evaluate(o), h[l].accumulate(i, s) | |
} else this._updateWeight(t) | |
}, | |
_updateWeight: function(t) { | |
var e = 0; | |
if (this.enabled) { | |
e = this.weight; | |
var n = this._weightInterpolant; | |
if (null !== n) { | |
var i = n.evaluate(t)[0]; | |
e *= i, t > n.parameterPositions[1] && (this.stopFading(), 0 === i && (this.enabled = !1)) | |
} | |
} | |
return this._effectiveWeight = e, e | |
}, | |
_updateTimeScale: function(t) { | |
var e = 0; | |
if (!this.paused) { | |
e = this.timeScale; | |
var n = this._timeScaleInterpolant; | |
if (null !== n) e *= n.evaluate(t)[0], t > n.parameterPositions[1] && (this.stopWarping(), 0 === e ? this.paused = !0 : this.timeScale = e) | |
} | |
return this._effectiveTimeScale = e, e | |
}, | |
_updateTime: function(t) { | |
var e = this.time + t; | |
if (0 === t) return e; | |
var n = this._clip.duration, | |
i = this.loop, | |
r = this._loopCount; | |
if (2200 === i) { | |
-1 === r && (this._loopCount = 0, this._setEndings(!0, !0, !1)); | |
t: { | |
if (e >= n) e = n; | |
else { | |
if (!(e < 0)) break t; | |
e = 0 | |
} | |
this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, | |
this._mixer.dispatchEvent({ | |
type: "finished", | |
action: this, | |
direction: t < 0 ? -1 : 1 | |
}) | |
} | |
} else { | |
var a = 2202 === i; | |
if (-1 === r && (t >= 0 ? (r = 0, this._setEndings(!0, 0 === this.repetitions, a)) : this._setEndings(0 === this.repetitions, !0, a)), e >= n || e < 0) { | |
var o = Math.floor(e / n); | |
e -= n * o, r += Math.abs(o); | |
var s = this.repetitions - r; | |
if (s <= 0) this.clampWhenFinished ? this.paused = !0 : this.enabled = !1, e = t > 0 ? n : 0, this._mixer.dispatchEvent({ | |
type: "finished", | |
action: this, | |
direction: t > 0 ? 1 : -1 | |
}); | |
else { | |
if (1 === s) { | |
var c = t < 0; | |
this._setEndings(c, !c, a) | |
} else this._setEndings(!1, !1, a); | |
this._loopCount = r, this._mixer.dispatchEvent({ | |
type: "loop", | |
action: this, | |
loopDelta: o | |
}) | |
} | |
} | |
if (a && 1 == (1 & r)) return this.time = e, n - e | |
} | |
return this.time = e, e | |
}, | |
_setEndings: function(t, e, n) { | |
var i = this._interpolantSettings; | |
n ? (i.endingStart = 2401, i.endingEnd = 2401) : (i.endingStart = t ? this.zeroSlopeAtStart ? 2401 : ye : 2402, i.endingEnd = e ? this.zeroSlopeAtEnd ? 2401 : ye : 2402) | |
}, | |
_scheduleFading: function(t, e, n) { | |
var i = this._mixer, | |
r = i.time, | |
a = this._weightInterpolant; | |
null === a && (a = i._lendControlInterpolant(), this._weightInterpolant = a); | |
var o = a.parameterPositions, | |
s = a.sampleValues; | |
return o[0] = r, s[0] = e, o[1] = r + t, s[1] = n, this | |
} | |
}), pc.prototype = Object.assign(Object.create(c.prototype), { | |
constructor: pc, | |
_bindAction: function(t, e) { | |
var n = t._localRoot || this._root, | |
i = t._clip.tracks, | |
r = i.length, | |
a = t._propertyBindings, | |
o = t._interpolants, | |
s = n.uuid, | |
c = this._bindingsByRootAndName, | |
h = c[s]; | |
void 0 === h && (h = {}, c[s] = h); | |
for (var l = 0; l !== r; ++l) { | |
var u = i[l], | |
p = u.name, | |
d = h[p]; | |
if (void 0 !== d) a[l] = d; | |
else { | |
if (void 0 !== (d = a[l])) { | |
null === d._cacheIndex && (++d.referenceCount, this._addInactiveBinding(d, s, p)); | |
continue | |
} | |
var f = e && e._propertyBindings[l].binding.parsedPath; | |
++(d = new Js(lc.create(n, p, f), u.ValueTypeName, u.getValueSize())).referenceCount, this._addInactiveBinding(d, s, p), a[l] = d | |
} | |
o[l].resultBuffer = d.buffer | |
} | |
}, | |
_activateAction: function(t) { | |
if (!this._isActiveAction(t)) { | |
if (null === t._cacheIndex) { | |
var e = (t._localRoot || this._root).uuid, | |
n = t._clip.uuid, | |
i = this._actionsByClip[n]; | |
this._bindAction(t, i && i.knownActions[0]), this._addInactiveAction(t, n, e) | |
} | |
for (var r = t._propertyBindings, a = 0, o = r.length; a !== o; ++a) { | |
var s = r[a]; | |
0 == s.useCount++ && (this._lendBinding(s), s.saveOriginalState()) | |
} | |
this._lendAction(t) | |
} | |
}, | |
_deactivateAction: function(t) { | |
if (this._isActiveAction(t)) { | |
for (var e = t._propertyBindings, n = 0, i = e.length; n !== i; ++n) { | |
var r = e[n]; | |
0 == --r.useCount && (r.restoreOriginalState(), this._takeBackBinding(r)) | |
} | |
this._takeBackAction(t) | |
} | |
}, | |
_initMemoryManager: function() { | |
this._actions = [], this._nActiveActions = 0, this._actionsByClip = {}, this._bindings = [], this._nActiveBindings = 0, this._bindingsByRootAndName = {}, this._controlInterpolants = [], this._nActiveControlInterpolants = 0; | |
var t = this; | |
this.stats = { | |
actions: { | |
get total() { | |
return t._actions.length | |
}, | |
get inUse() { | |
return t._nActiveActions | |
} | |
}, | |
bindings: { | |
get total() { | |
return t._bindings.length | |
}, | |
get inUse() { | |
return t._nActiveBindings | |
} | |
}, | |
controlInterpolants: { | |
get total() { | |
return t._controlInterpolants.length | |
}, | |
get inUse() { | |
return t._nActiveControlInterpolants | |
} | |
} | |
} | |
}, | |
_isActiveAction: function(t) { | |
var e = t._cacheIndex; | |
return null !== e && e < this._nActiveActions | |
}, | |
_addInactiveAction: function(t, e, n) { | |
var i = this._actions, | |
r = this._actionsByClip, | |
a = r[e]; | |
if (void 0 === a) a = { | |
knownActions: [t], | |
actionByRoot: {} | |
}, t._byClipCacheIndex = 0, r[e] = a; | |
else { | |
var o = a.knownActions; | |
t._byClipCacheIndex = o.length, o.push(t) | |
} | |
t._cacheIndex = i.length, i.push(t), a.actionByRoot[n] = t | |
}, | |
_removeInactiveAction: function(t) { | |
var e = this._actions, | |
n = e[e.length - 1], | |
i = t._cacheIndex; | |
n._cacheIndex = i, e[i] = n, e.pop(), t._cacheIndex = null; | |
var r = t._clip.uuid, | |
a = this._actionsByClip, | |
o = a[r], | |
s = o.knownActions, | |
c = s[s.length - 1], | |
h = t._byClipCacheIndex; | |
c._byClipCacheIndex = h, s[h] = c, s.pop(), t._byClipCacheIndex = null, delete o.actionByRoot[(t._localRoot || this._root).uuid], 0 === s.length && delete a[r], this._removeInactiveBindingsForAction(t) | |
}, | |
_removeInactiveBindingsForAction: function(t) { | |
for (var e = t._propertyBindings, n = 0, i = e.length; n !== i; ++n) { | |
var r = e[n]; | |
0 == --r.referenceCount && this._removeInactiveBinding(r) | |
} | |
}, | |
_lendAction: function(t) { | |
var e = this._actions, | |
n = t._cacheIndex, | |
i = this._nActiveActions++, | |
r = e[i]; | |
t._cacheIndex = i, e[i] = t, r._cacheIndex = n, e[n] = r | |
}, | |
_takeBackAction: function(t) { | |
var e = this._actions, | |
n = t._cacheIndex, | |
i = --this._nActiveActions, | |
r = e[i]; | |
t._cacheIndex = i, e[i] = t, r._cacheIndex = n, e[n] = r | |
}, | |
_addInactiveBinding: function(t, e, n) { | |
var i = this._bindingsByRootAndName, | |
r = i[e], | |
a = this._bindings; | |
void 0 === r && (r = {}, i[e] = r), r[n] = t, t._cacheIndex = a.length, a.push(t) | |
}, | |
_removeInactiveBinding: function(t) { | |
var e = this._bindings, | |
n = t.binding, | |
i = n.rootNode.uuid, | |
r = n.path, | |
a = this._bindingsByRootAndName, | |
o = a[i], | |
s = e[e.length - 1], | |
c = t._cacheIndex; | |
s._cacheIndex = c, e[c] = s, e.pop(), delete o[r]; | |
t: { | |
for (var h in o) break t;delete a[i] | |
} | |
}, | |
_lendBinding: function(t) { | |
var e = this._bindings, | |
n = t._cacheIndex, | |
i = this._nActiveBindings++, | |
r = e[i]; | |
t._cacheIndex = i, e[i] = t, r._cacheIndex = n, e[n] = r | |
}, | |
_takeBackBinding: function(t) { | |
var e = this._bindings, | |
n = t._cacheIndex, | |
i = --this._nActiveBindings, | |
r = e[i]; | |
t._cacheIndex = i, e[i] = t, r._cacheIndex = n, e[n] = r | |
}, | |
_lendControlInterpolant: function() { | |
var t = this._controlInterpolants, | |
e = this._nActiveControlInterpolants++, | |
n = t[e]; | |
return void 0 === n && ((n = new cs(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer)).__cacheIndex = e, t[e] = n), n | |
}, | |
_takeBackControlInterpolant: function(t) { | |
var e = this._controlInterpolants, | |
n = t.__cacheIndex, | |
i = --this._nActiveControlInterpolants, | |
r = e[i]; | |
t.__cacheIndex = i, e[i] = t, r.__cacheIndex = n, e[n] = r | |
}, | |
_controlInterpolantsResultBuffer: new Float32Array(1), | |
clipAction: function(t, e) { | |
var n = e || this._root, | |
i = n.uuid, | |
r = "string" == typeof t ? ds.findByName(n, t) : t, | |
a = null !== r ? r.uuid : t, | |
o = this._actionsByClip[a], | |
s = null; | |
if (void 0 !== o) { | |
var c = o.actionByRoot[i]; | |
if (void 0 !== c) return c; | |
s = o.knownActions[0], null === r && (r = s._clip) | |
} | |
if (null === r) return null; | |
var h = new uc(this, r, e); | |
return this._bindAction(h, s), this._addInactiveAction(h, a, i), h | |
}, | |
existingAction: function(t, e) { | |
var n = e || this._root, | |
i = n.uuid, | |
r = "string" == typeof t ? ds.findByName(n, t) : t, | |
a = r ? r.uuid : t, | |
o = this._actionsByClip[a]; | |
return void 0 !== o && o.actionByRoot[i] || null | |
}, | |
stopAllAction: function() { | |
var t = this._actions, | |
e = this._nActiveActions, | |
n = this._bindings, | |
i = this._nActiveBindings; | |
this._nActiveActions = 0, this._nActiveBindings = 0; | |
for (var r = 0; r !== e; ++r) t[r].reset(); | |
for (r = 0; r !== i; ++r) n[r].useCount = 0; | |
return this | |
}, | |
update: function(t) { | |
t *= this.timeScale; | |
for (var e = this._actions, n = this._nActiveActions, i = this.time += t, r = Math.sign(t), a = this._accuIndex ^= 1, o = 0; o !== n; ++o) { | |
e[o]._update(i, t, r, a) | |
} | |
var s = this._bindings, | |
c = this._nActiveBindings; | |
for (o = 0; o !== c; ++o) s[o].apply(a); | |
return this | |
}, | |
getRoot: function() { | |
return this._root | |
}, | |
uncacheClip: function(t) { | |
var e = this._actions, | |
n = t.uuid, | |
i = this._actionsByClip, | |
r = i[n]; | |
if (void 0 !== r) { | |
for (var a = r.knownActions, o = 0, s = a.length; o !== s; ++o) { | |
var c = a[o]; | |
this._deactivateAction(c); | |
var h = c._cacheIndex, | |
l = e[e.length - 1]; | |
c._cacheIndex = null, c._byClipCacheIndex = null, l._cacheIndex = h, e[h] = l, e.pop(), this._removeInactiveBindingsForAction(c) | |
} | |
delete i[n] | |
} | |
}, | |
uncacheRoot: function(t) { | |
var e = t.uuid, | |
n = this._actionsByClip; | |
for (var i in n) { | |
var r = n[i].actionByRoot[e]; | |
void 0 !== r && (this._deactivateAction(r), this._removeInactiveAction(r)) | |
} | |
var a = this._bindingsByRootAndName[e]; | |
if (void 0 !== a) | |
for (var o in a) { | |
var s = a[o]; | |
s.restoreOriginalState(), this._removeInactiveBinding(s) | |
} | |
}, | |
uncacheAction: function(t, e) { | |
var n = this.existingAction(t, e); | |
null !== n && (this._deactivateAction(n), this._removeInactiveAction(n)) | |
} | |
}), dc.prototype.clone = function() { | |
return new dc(void 0 === this.value.clone ? this.value : this.value.clone()) | |
}, fc.prototype = Object.assign(Object.create(Bn.prototype), { | |
constructor: fc, | |
isInstancedBufferGeometry: !0, | |
copy: function(t) { | |
return Bn.prototype.copy.call(this, t), this.maxInstancedCount = t.maxInstancedCount, this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
} | |
}), Object.defineProperties(mc.prototype, { | |
count: { | |
get: function() { | |
return this.data.count | |
} | |
}, | |
array: { | |
get: function() { | |
return this.data.array | |
} | |
} | |
}), Object.assign(mc.prototype, { | |
isInterleavedBufferAttribute: !0, | |
setX: function(t, e) { | |
return this.data.array[t * this.data.stride + this.offset] = e, this | |
}, | |
setY: function(t, e) { | |
return this.data.array[t * this.data.stride + this.offset + 1] = e, this | |
}, | |
setZ: function(t, e) { | |
return this.data.array[t * this.data.stride + this.offset + 2] = e, this | |
}, | |
setW: function(t, e) { | |
return this.data.array[t * this.data.stride + this.offset + 3] = e, this | |
}, | |
getX: function(t) { | |
return this.data.array[t * this.data.stride + this.offset] | |
}, | |
getY: function(t) { | |
return this.data.array[t * this.data.stride + this.offset + 1] | |
}, | |
getZ: function(t) { | |
return this.data.array[t * this.data.stride + this.offset + 2] | |
}, | |
getW: function(t) { | |
return this.data.array[t * this.data.stride + this.offset + 3] | |
}, | |
setXY: function(t, e, n) { | |
return t = t * this.data.stride + this.offset, this.data.array[t + 0] = e, this.data.array[t + 1] = n, this | |
}, | |
setXYZ: function(t, e, n, i) { | |
return t = t * this.data.stride + this.offset, this.data.array[t + 0] = e, this.data.array[t + 1] = n, this.data.array[t + 2] = i, this | |
}, | |
setXYZW: function(t, e, n, i, r) { | |
return t = t * this.data.stride + this.offset, this.data.array[t + 0] = e, this.data.array[t + 1] = n, this.data.array[t + 2] = i, this.data.array[t + 3] = r, this | |
} | |
}), Object.defineProperty(gc.prototype, "needsUpdate", { | |
set: function(t) { | |
!0 === t && this.version++ | |
} | |
}), Object.assign(gc.prototype, { | |
isInterleavedBuffer: !0, | |
onUploadCallback: function() {}, | |
setArray: function(t) { | |
if (Array.isArray(t)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); | |
this.count = void 0 !== t ? t.length / this.stride : 0, this.array = t | |
}, | |
setDynamic: function(t) { | |
return this.dynamic = t, this | |
}, | |
copy: function(t) { | |
return this.array = new t.array.constructor(t.array), this.count = t.count, this.stride = t.stride, this.dynamic = t.dynamic, this | |
}, | |
copyAt: function(t, e, n) { | |
t *= this.stride, n *= e.stride; | |
for (var i = 0, r = this.stride; i < r; i++) this.array[t + i] = e.array[n + i]; | |
return this | |
}, | |
set: function(t, e) { | |
return void 0 === e && (e = 0), this.array.set(t, e), this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
onUpload: function(t) { | |
return this.onUploadCallback = t, this | |
} | |
}), vc.prototype = Object.assign(Object.create(gc.prototype), { | |
constructor: vc, | |
isInstancedInterleavedBuffer: !0, | |
copy: function(t) { | |
return gc.prototype.copy.call(this, t), this.meshPerAttribute = t.meshPerAttribute, this | |
} | |
}), yc.prototype = Object.assign(Object.create(Mn.prototype), { | |
constructor: yc, | |
isInstancedBufferAttribute: !0, | |
copy: function(t) { | |
return Mn.prototype.copy.call(this, t), this.meshPerAttribute = t.meshPerAttribute, this | |
} | |
}), Object.assign(xc.prototype, { | |
linePrecision: 1, | |
set: function(t, e) { | |
this.ray.set(t, e) | |
}, | |
setFromCamera: function(t, e) { | |
e && e.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(e.matrixWorld), this.ray.direction.set(t.x, t.y, .5).unproject(e).sub(this.ray.origin).normalize()) : e && e.isOrthographicCamera ? (this.ray.origin.set(t.x, t.y, (e.near + e.far) / (e.near - e.far)).unproject(e), this.ray.direction.set(0, 0, -1).transformDirection(e.matrixWorld)) : console.error("THREE.Raycaster: Unsupported camera type.") | |
}, | |
intersectObject: function(t, e, n) { | |
var i = n || []; | |
return _c(t, this, i, e), i.sort(wc), i | |
}, | |
intersectObjects: function(t, e, n) { | |
var i = n || []; | |
if (!1 === Array.isArray(t)) return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."), i; | |
for (var r = 0, a = t.length; r < a; r++) _c(t[r], this, i, e); | |
return i.sort(wc), i | |
} | |
}), Object.assign(bc.prototype, { | |
start: function() { | |
this.startTime = ("undefined" == typeof performance ? Date : performance).now(), this.oldTime = this.startTime, this.elapsedTime = 0, this.running = !0 | |
}, | |
stop: function() { | |
this.getElapsedTime(), this.running = !1, this.autoStart = !1 | |
}, | |
getElapsedTime: function() { | |
return this.getDelta(), this.elapsedTime | |
}, | |
getDelta: function() { | |
var t = 0; | |
if (this.autoStart && !this.running) return this.start(), 0; | |
if (this.running) { | |
var e = ("undefined" == typeof performance ? Date : performance).now(); | |
t = (e - this.oldTime) / 1e3, this.oldTime = e, this.elapsedTime += t | |
} | |
return t | |
} | |
}), Object.assign(function(t, e, n) { | |
return this.radius = void 0 !== t ? t : 1, this.phi = void 0 !== e ? e : 0, this.theta = void 0 !== n ? n : 0, this | |
}.prototype, { | |
set: function(t, e, n) { | |
return this.radius = t, this.phi = e, this.theta = n, this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.radius = t.radius, this.phi = t.phi, this.theta = t.theta, this | |
}, | |
makeSafe: function() { | |
return this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi)), this | |
}, | |
setFromVector3: function(t) { | |
return this.radius = t.length(), 0 === this.radius ? (this.theta = 0, this.phi = 0) : (this.theta = Math.atan2(t.x, t.z), this.phi = Math.acos(Re.clamp(t.y / this.radius, -1, 1))), this | |
} | |
}), Object.assign(function(t, e, n) { | |
return this.radius = void 0 !== t ? t : 1, this.theta = void 0 !== e ? e : 0, this.y = void 0 !== n ? n : 0, this | |
}.prototype, { | |
set: function(t, e, n) { | |
return this.radius = t, this.theta = e, this.y = n, this | |
}, | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.radius = t.radius, this.theta = t.theta, this.y = t.y, this | |
}, | |
setFromVector3: function(t) { | |
return this.radius = Math.sqrt(t.x * t.x + t.z * t.z), this.theta = Math.atan2(t.x, t.z), this.y = t.y, this | |
} | |
}), Object.assign(Ac.prototype, { | |
set: function(t, e) { | |
return this.min.copy(t), this.max.copy(e), this | |
}, | |
setFromPoints: function(t) { | |
this.makeEmpty(); | |
for (var e = 0, n = t.length; e < n; e++) this.expandByPoint(t[e]); | |
return this | |
}, | |
setFromCenterAndSize: function() { | |
var t = new Pe; | |
return function(e, n) { | |
var i = t.copy(n).multiplyScalar(.5); | |
return this.min.copy(e).sub(i), this.max.copy(e).add(i), this | |
} | |
}(), | |
clone: function() { | |
return (new this.constructor).copy(this) | |
}, | |
copy: function(t) { | |
return this.min.copy(t.min), this.max.copy(t.max), this | |
}, | |
makeEmpty: function() { | |
return this.min.x = this.min.y = Infinity, this.max.x = this.max.y = -Infinity, this | |
}, | |
isEmpty: function() { | |
return this.max.x < this.min.x || this.max.y < this.min.y | |
}, | |
getCenter: function(t) { | |
return void 0 === t && (console.warn("THREE.Box2: .getCenter() target is now required"), t = new Pe), this.isEmpty() ? t.set(0, 0) : t.addVectors(this.min, this.max).multiplyScalar(.5) | |
}, | |
getSize: function(t) { | |
return void 0 === t && (console.warn("THREE.Box2: .getSize() target is now required"), t = new Pe), this.isEmpty() ? t.set(0, 0) : t.subVectors(this.max, this.min) | |
}, | |
expandByPoint: function(t) { | |
return this.min.min(t), this.max.max(t), this | |
}, | |
expandByVector: function(t) { | |
return this.min.sub(t), this.max.add(t), this | |
}, | |
expandByScalar: function(t) { | |
return this.min.addScalar(-t), this.max.addScalar(t), this | |
}, | |
containsPoint: function(t) { | |
return !(t.x < this.min.x || t.x > this.max.x || t.y < this.min.y || t.y > this.max.y) | |
}, | |
containsBox: function(t) { | |
return this.min.x <= t.min.x && t.max.x <= this.max.x && this.min.y <= t.min.y && t.max.y <= this.max.y | |
}, | |
getParameter: function(t, e) { | |
return void 0 === e && (console.warn("THREE.Box2: .getParameter() target is now required"), e = new Pe), e.set((t.x - this.min.x) / (this.max.x - this.min.x), (t.y - this.min.y) / (this.max.y - this.min.y)) | |
}, | |
intersectsBox: function(t) { | |
return !(t.max.x < this.min.x || t.min.x > this.max.x || t.max.y < this.min.y || t.min.y > this.max.y) | |
}, | |
clampPoint: function(t, e) { | |
return void 0 === e && (console.warn("THREE.Box2: .clampPoint() target is now required"), e = new Pe), e.copy(t).clamp(this.min, this.max) | |
}, | |
distanceToPoint: function() { | |
var t = new Pe; | |
return function(e) { | |
return t.copy(e).clamp(this.min, this.max).sub(e).length() | |
} | |
}(), | |
intersect: function(t) { | |
return this.min.max(t.min), this.max.min(t.max), this | |
}, | |
union: function(t) { | |
return this.min.min(t.min), this.max.max(t.max), this | |
}, | |
translate: function(t) { | |
return this.min.add(t), this.max.add(t), this | |
}, | |
equals: function(t) { | |
return t.min.equals(this.min) && t.max.equals(this.max) | |
} | |
}), Mc.prototype = Object.create(gn.prototype), Mc.prototype.constructor = Mc, Mc.prototype.isImmediateRenderObject = !0, Ec.prototype = Object.create(Nr.prototype), Ec.prototype.constructor = Ec, Ec.prototype.update = function() { | |
var t = new Ue, | |
e = new Ue, | |
n = new Ne; | |
return function() { | |
var i = ["a", "b", "c"]; | |
this.object.updateMatrixWorld(!0), n.getNormalMatrix(this.object.matrixWorld); | |
var r = this.object.matrixWorld, | |
a = this.geometry.attributes.position, | |
o = this.object.geometry; | |
if (o && o.isGeometry) | |
for (var s = o.vertices, c = o.faces, h = 0, l = 0, u = c.length; l < u; l++) | |
for (var p = c[l], d = 0, f = p.vertexNormals.length; d < f; d++) { | |
var m = s[p[i[d]]], | |
g = p.vertexNormals[d]; | |
t.copy(m).applyMatrix4(r), e.copy(g).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t), a.setXYZ(h, t.x, t.y, t.z), h += 1, a.setXYZ(h, e.x, e.y, e.z), h += 1 | |
} else if (o && o.isBufferGeometry) { | |
var v = o.attributes.position, | |
y = o.attributes.normal; | |
for (h = 0, d = 0, f = v.count; d < f; d++) t.set(v.getX(d), v.getY(d), v.getZ(d)).applyMatrix4(r), e.set(y.getX(d), y.getY(d), y.getZ(d)), e.applyMatrix3(n).normalize().multiplyScalar(this.size).add(t), a.setXYZ(h, t.x, t.y, t.z), h += 1, a.setXYZ(h, e.x, e.y, e.z), h += 1 | |
} | |
a.needsUpdate = !0 | |
} | |
}(), Sc.prototype = Object.create(gn.prototype), Sc.prototype.constructor = Sc, Sc.prototype.dispose = function() { | |
this.cone.geometry.dispose(), this.cone.material.dispose() | |
}, Sc.prototype.update = function() { | |
var t = new Ue, | |
e = new Ue; | |
return function() { | |
this.light.updateMatrixWorld(); | |
var n = this.light.distance ? this.light.distance : 1e3, | |
i = n * Math.tan(this.light.angle); | |
this.cone.scale.set(i, i, n), t.setFromMatrixPosition(this.light.matrixWorld), e.setFromMatrixPosition(this.light.target.matrixWorld), this.cone.lookAt(e.sub(t)), void 0 !== this.color ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color) | |
} | |
}(), Tc.prototype = Object.create(Nr.prototype), Tc.prototype.constructor = Tc, Tc.prototype.updateMatrixWorld = function() { | |
var t = new Ue, | |
e = new Oe, | |
n = new Oe; | |
return function(i) { | |
var r = this.bones, | |
a = this.geometry, | |
o = a.getAttribute("position"); | |
n.getInverse(this.root.matrixWorld); | |
for (var s = 0, c = 0; s < r.length; s++) { | |
var h = r[s]; | |
h.parent && h.parent.isBone && (e.multiplyMatrices(n, h.matrixWorld), t.setFromMatrixPosition(e), o.setXYZ(c, t.x, t.y, t.z), e.multiplyMatrices(n, h.parent.matrixWorld), t.setFromMatrixPosition(e), o.setXYZ(c + 1, t.x, t.y, t.z), c += 2) | |
} | |
a.getAttribute("position").needsUpdate = !0, gn.prototype.updateMatrixWorld.call(this, i) | |
} | |
}(), Cc.prototype = Object.create(ni.prototype), Cc.prototype.constructor = Cc, Cc.prototype.dispose = function() { | |
this.geometry.dispose(), this.material.dispose() | |
}, Cc.prototype.update = function() { | |
void 0 !== this.color ? this.material.color.set(this.color) : this.material.color.copy(this.light.color) | |
}, Ic.prototype = Object.create(gn.prototype), Ic.prototype.constructor = Ic, Ic.prototype.dispose = function() { | |
this.children[0].geometry.dispose(), this.children[0].material.dispose() | |
}, Ic.prototype.update = function() { | |
var t = .5 * this.light.width, | |
e = .5 * this.light.height, | |
n = this.line.geometry.attributes.position, | |
i = n.array; | |
i[0] = t, i[1] = -e, i[2] = 0, i[3] = t, i[4] = e, i[5] = 0, i[6] = -t, i[7] = e, i[8] = 0, i[9] = -t, i[10] = -e, i[11] = 0, i[12] = t, i[13] = -e, i[14] = 0, n.needsUpdate = !0, void 0 !== this.color ? this.line.material.color.set(this.color) : this.line.material.color.copy(this.light.color) | |
}, Lc.prototype = Object.create(gn.prototype), Lc.prototype.constructor = Lc, Lc.prototype.dispose = function() { | |
this.children[0].geometry.dispose(), this.children[0].material.dispose() | |
}, Lc.prototype.update = function() { | |
var t = new Ue, | |
e = new rn, | |
n = new rn; | |
return function() { | |
var i = this.children[0]; | |
if (void 0 !== this.color) this.material.color.set(this.color); | |
else { | |
var r = i.geometry.getAttribute("color"); | |
e.copy(this.light.color), n.copy(this.light.groundColor); | |
for (var a = 0, o = r.count; a < o; a++) { | |
var s = a < o / 2 ? e : n; | |
r.setXYZ(a, s.r, s.g, s.b) | |
} | |
r.needsUpdate = !0 | |
} | |
i.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()) | |
} | |
}(), Rc.prototype = Object.create(Nr.prototype), Rc.prototype.constructor = Rc, Pc.prototype = Object.create(Nr.prototype), Pc.prototype.constructor = Pc, Oc.prototype = Object.create(Nr.prototype), Oc.prototype.constructor = Oc, Oc.prototype.update = function() { | |
var t = new Ue, | |
e = new Ue, | |
n = new Ne; | |
return function() { | |
this.object.updateMatrixWorld(!0), n.getNormalMatrix(this.object.matrixWorld); | |
for (var i = this.object.matrixWorld, r = this.geometry.attributes.position, a = this.object.geometry, o = a.vertices, s = a.faces, c = 0, h = 0, l = s.length; h < l; h++) { | |
var u = s[h], | |
p = u.normal; | |
t.copy(o[u.a]).add(o[u.b]).add(o[u.c]).divideScalar(3).applyMatrix4(i), e.copy(p).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t), r.setXYZ(c, t.x, t.y, t.z), c += 1, r.setXYZ(c, e.x, e.y, e.z), c += 1 | |
} | |
r.needsUpdate = !0 | |
} | |
}(), Dc.prototype = Object.create(gn.prototype), Dc.prototype.constructor = Dc, Dc.prototype.dispose = function() { | |
this.lightPlane.geometry.dispose(), this.lightPlane.material.dispose(), this.targetLine.geometry.dispose(), this.targetLine.material.dispose() | |
}, Dc.prototype.update = function() { | |
var t = new Ue, | |
e = new Ue, | |
n = new Ue; | |
return function() { | |
t.setFromMatrixPosition(this.light.matrixWorld), e.setFromMatrixPosition(this.light.target.matrixWorld), n.subVectors(e, t), this.lightPlane.lookAt(n), void 0 !== this.color ? (this.lightPlane.material.color.set(this.color), this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color), this.targetLine.material.color.copy(this.light.color)), this.targetLine.lookAt(n), this.targetLine.scale.z = n.length() | |
} | |
}(), Uc.prototype = Object.create(Nr.prototype), Uc.prototype.constructor = Uc, Uc.prototype.update = function() { | |
var t, e, n = new Ue, | |
i = new vn; | |
function r(r, a, o, s) { | |
n.set(a, o, s).unproject(i); | |
var c = e[r]; | |
if (void 0 !== c) | |
for (var h = t.getAttribute("position"), l = 0, u = c.length; l < u; l++) h.setXYZ(c[l], n.x, n.y, n.z) | |
} | |
return function() { | |
t = this.geometry, e = this.pointMap; | |
i.projectionMatrix.copy(this.camera.projectionMatrix), r("c", 0, 0, -1), r("t", 0, 0, 1), r("n1", -1, -1, -1), r("n2", 1, -1, -1), r("n3", -1, 1, -1), r("n4", 1, 1, -1), r("f1", -1, -1, 1), r("f2", 1, -1, 1), r("f3", -1, 1, 1), r("f4", 1, 1, 1), r("u1", .7, 1.1, -1), r("u2", -.7, 1.1, -1), r("u3", 0, 2, -1), r("cf1", -1, 0, 1), r("cf2", 1, 0, 1), r("cf3", 0, -1, 1), r("cf4", 0, 1, 1), r("cn1", -1, 0, -1), r("cn2", 1, 0, -1), r("cn3", 0, -1, -1), r("cn4", 0, 1, -1), t.getAttribute("position").needsUpdate = !0 | |
} | |
}(), Nc.prototype = Object.create(Nr.prototype), Nc.prototype.constructor = Nc, Nc.prototype.update = function() { | |
var t = new Je; | |
return function(e) { | |
if (void 0 !== e && console.warn("THREE.BoxHelper: .update() has no longer arguments."), void 0 !== this.object && t.setFromObject(this.object), !t.isEmpty()) { | |
var n = t.min, | |
i = t.max, | |
r = this.geometry.attributes.position, | |
a = r.array; | |
a[0] = i.x, a[1] = i.y, a[2] = i.z, a[3] = n.x, a[4] = i.y, a[5] = i.z, a[6] = n.x, a[7] = n.y, a[8] = i.z, a[9] = i.x, a[10] = n.y, a[11] = i.z, a[12] = i.x, a[13] = i.y, a[14] = n.z, a[15] = n.x, a[16] = i.y, a[17] = n.z, a[18] = n.x, a[19] = n.y, a[20] = n.z, a[21] = i.x, a[22] = n.y, a[23] = n.z, r.needsUpdate = !0, this.geometry.computeBoundingSphere() | |
} | |
} | |
}(), Nc.prototype.setFromObject = function(t) { | |
return this.object = t, this.update(), this | |
}, Bc.prototype = Object.create(Nr.prototype), Bc.prototype.constructor = Bc, Bc.prototype.updateMatrixWorld = function(t) { | |
var e = this.box; | |
e.isEmpty() || (e.getCenter(this.position), e.getSize(this.scale), this.scale.multiplyScalar(.5), gn.prototype.updateMatrixWorld.call(this, t)) | |
}, zc.prototype = Object.create(Ur.prototype), zc.prototype.constructor = zc, zc.prototype.updateMatrixWorld = function(t) { | |
var e = -this.plane.constant; | |
Math.abs(e) < 1e-8 && (e = 1e-8), this.scale.set(.5 * this.size, .5 * this.size, e), this.lookAt(this.plane.normal), gn.prototype.updateMatrixWorld.call(this, t) | |
}, Fc.prototype = Object.create(gn.prototype), Fc.prototype.constructor = Fc, Fc.prototype.setDirection = (cc = new Ue, function(t) { | |
t.y > .99999 ? this.quaternion.set(0, 0, 0, 1) : t.y < -.99999 ? this.quaternion.set(1, 0, 0, 0) : (cc.set(t.z, 0, -t.x).normalize(), sc = Math.acos(t.y), this.quaternion.setFromAxisAngle(cc, sc)) | |
}), Fc.prototype.setLength = function(t, e, n) { | |
void 0 === e && (e = .2 * t), void 0 === n && (n = .2 * e), this.line.scale.set(1, Math.max(0, t - e), 1), this.line.updateMatrix(), this.cone.scale.set(n, e, n), this.cone.position.y = t, this.cone.updateMatrix() | |
}, Fc.prototype.setColor = function(t) { | |
this.line.material.color.copy(t), this.cone.material.color.copy(t) | |
}, Gc.prototype = Object.create(Nr.prototype), Gc.prototype.constructor = Gc; | |
function kc(t) { | |
console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."), Io.call(this, t), this.type = "catmullrom" | |
} | |
_o.create = function(t, e) { | |
return t.prototype = Object.create(_o.prototype), t.prototype.constructor = t, t.prototype.getPoint = e, t | |
}, Object.assign(ko.prototype, { | |
createPointsGeometry: function(t) { | |
console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); | |
var e = this.getPoints(t); | |
return this.createGeometry(e) | |
}, | |
createSpacedPointsGeometry: function(t) { | |
console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); | |
var e = this.getSpacedPoints(t); | |
return this.createGeometry(e) | |
}, | |
createGeometry: function(t) { | |
console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead."); | |
for (var e = new An, n = 0, i = t.length; n < i; n++) { | |
var r = t[n]; | |
e.vertices.push(new Ue(r.x, r.y, r.z || 0)) | |
} | |
return e | |
} | |
}), Object.assign(Ho.prototype, { | |
fromPoints: function(t) { | |
console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."), this.setFromPoints(t) | |
} | |
}), Object.create(Io.prototype), Object.create(Io.prototype), kc.prototype = Object.create(Io.prototype), Object.assign(kc.prototype, { | |
initFromArray: function() { | |
console.error("THREE.Spline: .initFromArray() has been removed.") | |
}, | |
getControlPointsArray: function() { | |
console.error("THREE.Spline: .getControlPointsArray() has been removed.") | |
}, | |
reparametrizeByArcLength: function() { | |
console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.") | |
} | |
}), Rc.prototype.setColors = function() { | |
console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.") | |
}, Tc.prototype.update = function() { | |
console.error("THREE.SkeletonHelper: update() no longer needs to be called.") | |
}, Object.assign(_s.prototype, { | |
extractUrlBase: function(t) { | |
return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."), bs.extractUrlBase(t) | |
} | |
}), Object.assign(Ac.prototype, { | |
center: function(t) { | |
return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."), this.getCenter(t) | |
}, | |
empty: function() { | |
return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."), this.isEmpty() | |
}, | |
isIntersectionBox: function(t) { | |
return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(t) | |
}, | |
size: function(t) { | |
return console.warn("THREE.Box2: .size() has been renamed to .getSize()."), this.getSize(t) | |
} | |
}), Object.assign(Je.prototype, { | |
center: function(t) { | |
return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."), this.getCenter(t) | |
}, | |
empty: function() { | |
return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."), this.isEmpty() | |
}, | |
isIntersectionBox: function(t) { | |
return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(t) | |
}, | |
isIntersectionSphere: function(t) { | |
return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(t) | |
}, | |
size: function(t) { | |
return console.warn("THREE.Box3: .size() has been renamed to .getSize()."), this.getSize(t) | |
} | |
}), ti.prototype.center = function(t) { | |
return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."), this.getCenter(t) | |
}, Object.assign(Re, { | |
random16: function() { | |
return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."), Math.random() | |
}, | |
nearestPowerOfTwo: function(t) { | |
return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."), Re.floorPowerOfTwo(t) | |
}, | |
nextPowerOfTwo: function(t) { | |
return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."), Re.ceilPowerOfTwo(t) | |
} | |
}), Object.assign(Ne.prototype, { | |
flattenToArrayOffset: function(t, e) { | |
return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(t, e) | |
}, | |
multiplyVector3: function(t) { | |
return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."), t.applyMatrix3(this) | |
}, | |
multiplyVector3Array: function() { | |
console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.") | |
}, | |
applyToBuffer: function(t) { | |
return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."), this.applyToBufferAttribute(t) | |
}, | |
applyToVector3Array: function() { | |
console.error("THREE.Matrix3: .applyToVector3Array() has been removed.") | |
} | |
}), Object.assign(Oe.prototype, { | |
extractPosition: function(t) { | |
return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."), this.copyPosition(t) | |
}, | |
flattenToArrayOffset: function(t, e) { | |
return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."), this.toArray(t, e) | |
}, | |
getPosition: function() { | |
var t; | |
return function() { | |
return void 0 === t && (t = new Ue), console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."), t.setFromMatrixColumn(this, 3) | |
} | |
}(), | |
setRotationFromQuaternion: function(t) { | |
return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."), this.makeRotationFromQuaternion(t) | |
}, | |
multiplyToArray: function() { | |
console.warn("THREE.Matrix4: .multiplyToArray() has been removed.") | |
}, | |
multiplyVector3: function(t) { | |
return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."), t.applyMatrix4(this) | |
}, | |
multiplyVector4: function(t) { | |
return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."), t.applyMatrix4(this) | |
}, | |
multiplyVector3Array: function() { | |
console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.") | |
}, | |
rotateAxis: function(t) { | |
console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."), t.transformDirection(this) | |
}, | |
crossVector: function(t) { | |
return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."), t.applyMatrix4(this) | |
}, | |
translate: function() { | |
console.error("THREE.Matrix4: .translate() has been removed.") | |
}, | |
rotateX: function() { | |
console.error("THREE.Matrix4: .rotateX() has been removed.") | |
}, | |
rotateY: function() { | |
console.error("THREE.Matrix4: .rotateY() has been removed.") | |
}, | |
rotateZ: function() { | |
console.error("THREE.Matrix4: .rotateZ() has been removed.") | |
}, | |
rotateByAxis: function() { | |
console.error("THREE.Matrix4: .rotateByAxis() has been removed.") | |
}, | |
applyToBuffer: function(t) { | |
return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."), this.applyToBufferAttribute(t) | |
}, | |
applyToVector3Array: function() { | |
console.error("THREE.Matrix4: .applyToVector3Array() has been removed.") | |
}, | |
makeFrustum: function(t, e, n, i, r, a) { | |
return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."), this.makePerspective(t, e, i, n, r, a) | |
} | |
}), Qe.prototype.isIntersectionLine = function(t) { | |
return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."), this.intersectsLine(t) | |
}, De.prototype.multiplyVector3 = function(t) { | |
return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."), t.applyQuaternion(this) | |
}, Object.assign($n.prototype, { | |
isIntersectionBox: function(t) { | |
return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."), this.intersectsBox(t) | |
}, | |
isIntersectionPlane: function(t) { | |
return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."), this.intersectsPlane(t) | |
}, | |
isIntersectionSphere: function(t) { | |
return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."), this.intersectsSphere(t) | |
} | |
}), Object.assign(ei.prototype, { | |
area: function() { | |
return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."), this.getArea() | |
}, | |
barycoordFromPoint: function(t, e) { | |
return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), this.getBarycoord(t, e) | |
}, | |
midpoint: function(t) { | |
return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."), this.getMidpoint(t) | |
}, | |
normal: function(t) { | |
return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), this.getNormal(t) | |
}, | |
plane: function(t) { | |
return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."), this.getPlane(t) | |
} | |
}), Object.assign(ei, { | |
barycoordFromPoint: function(t, e, n, i, r) { | |
return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."), ei.getBarycoord(t, e, n, i, r) | |
}, | |
normal: function(t, e, n, i) { | |
return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."), ei.getNormal(t, e, n, i) | |
} | |
}), Object.assign(Vo.prototype, { | |
extractAllPoints: function(t) { | |
return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."), this.extractPoints(t) | |
}, | |
extrude: function(t) { | |
return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."), new Da(this, t) | |
}, | |
makeGeometry: function(t) { | |
return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."), new ja(this, t) | |
} | |
}), Object.assign(Pe.prototype, { | |
fromAttribute: function(t, e, n) { | |
return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(t, e, n) | |
}, | |
distanceToManhattan: function(t) { | |
return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(t) | |
}, | |
lengthManhattan: function() { | |
return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength() | |
} | |
}), Object.assign(Ue.prototype, { | |
setEulerFromRotationMatrix: function() { | |
console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.") | |
}, | |
setEulerFromQuaternion: function() { | |
console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.") | |
}, | |
getPositionFromMatrix: function(t) { | |
return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."), this.setFromMatrixPosition(t) | |
}, | |
getScaleFromMatrix: function(t) { | |
return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."), this.setFromMatrixScale(t) | |
}, | |
getColumnFromMatrix: function(t, e) { | |
return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."), this.setFromMatrixColumn(e, t) | |
}, | |
applyProjection: function(t) { | |
return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."), this.applyMatrix4(t) | |
}, | |
fromAttribute: function(t, e, n) { | |
return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(t, e, n) | |
}, | |
distanceToManhattan: function(t) { | |
return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."), this.manhattanDistanceTo(t) | |
}, | |
lengthManhattan: function() { | |
return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength() | |
} | |
}), Object.assign(We.prototype, { | |
fromAttribute: function(t, e, n) { | |
return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."), this.fromBufferAttribute(t, e, n) | |
}, | |
lengthManhattan: function() { | |
return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."), this.manhattanLength() | |
} | |
}), Object.assign(An.prototype, { | |
computeTangents: function() { | |
console.error("THREE.Geometry: .computeTangents() has been removed.") | |
}, | |
computeLineDistances: function() { | |
console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.") | |
} | |
}), Object.assign(gn.prototype, { | |
getChildByName: function(t) { | |
return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."), this.getObjectByName(t) | |
}, | |
renderDepth: function() { | |
console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.") | |
}, | |
translate: function(t, e) { | |
return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."), this.translateOnAxis(e, t) | |
}, | |
getWorldRotation: function() { | |
console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.") | |
} | |
}), Object.defineProperties(gn.prototype, { | |
eulerOrder: { | |
get: function() { | |
return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order | |
}, | |
set: function(t) { | |
console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."), this.rotation.order = t | |
} | |
}, | |
useQuaternion: { | |
get: function() { | |
console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.") | |
}, | |
set: function() { | |
console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.") | |
} | |
} | |
}), Object.defineProperties(Lr.prototype, { | |
objects: { | |
get: function() { | |
return console.warn("THREE.LOD: .objects has been renamed to .levels."), this.levels | |
} | |
} | |
}), Object.defineProperty(Rr.prototype, "useVertexTexture", { | |
get: function() { | |
console.warn("THREE.Skeleton: useVertexTexture has been removed.") | |
}, | |
set: function() { | |
console.warn("THREE.Skeleton: useVertexTexture has been removed.") | |
} | |
}), Object.defineProperty(_o.prototype, "__arcLengthDivisions", { | |
get: function() { | |
return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."), this.arcLengthDivisions | |
}, | |
set: function(t) { | |
console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."), this.arcLengthDivisions = t | |
} | |
}), _r.prototype.setLens = function(t, e) { | |
console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."), void 0 !== e && (this.filmGauge = e), this.setFocalLength(t) | |
}, Object.defineProperties(jo.prototype, { | |
onlyShadow: { | |
set: function() { | |
console.warn("THREE.Light: .onlyShadow has been removed.") | |
} | |
}, | |
shadowCameraFov: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."), this.shadow.camera.fov = t | |
} | |
}, | |
shadowCameraLeft: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."), this.shadow.camera.left = t | |
} | |
}, | |
shadowCameraRight: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."), this.shadow.camera.right = t | |
} | |
}, | |
shadowCameraTop: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."), this.shadow.camera.top = t | |
} | |
}, | |
shadowCameraBottom: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."), this.shadow.camera.bottom = t | |
} | |
}, | |
shadowCameraNear: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."), this.shadow.camera.near = t | |
} | |
}, | |
shadowCameraFar: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."), this.shadow.camera.far = t | |
} | |
}, | |
shadowCameraVisible: { | |
set: function() { | |
console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.") | |
} | |
}, | |
shadowBias: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowBias is now .shadow.bias."), this.shadow.bias = t | |
} | |
}, | |
shadowDarkness: { | |
set: function() { | |
console.warn("THREE.Light: .shadowDarkness has been removed.") | |
} | |
}, | |
shadowMapWidth: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."), this.shadow.mapSize.width = t | |
} | |
}, | |
shadowMapHeight: { | |
set: function(t) { | |
console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."), this.shadow.mapSize.height = t | |
} | |
} | |
}), Object.defineProperties(Mn.prototype, { | |
length: { | |
get: function() { | |
return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."), this.array.length | |
} | |
}, | |
copyIndicesArray: function() { | |
console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.") | |
} | |
}), Object.assign(Bn.prototype, { | |
addIndex: function(t) { | |
console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."), this.setIndex(t) | |
}, | |
addDrawCall: function(t, e, n) { | |
void 0 !== n && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."), console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."), this.addGroup(t, e) | |
}, | |
clearDrawCalls: function() { | |
console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."), this.clearGroups() | |
}, | |
computeTangents: function() { | |
console.warn("THREE.BufferGeometry: .computeTangents() has been removed.") | |
}, | |
computeOffsets: function() { | |
console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.") | |
} | |
}), Object.defineProperties(Bn.prototype, { | |
drawcalls: { | |
get: function() { | |
return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."), this.groups | |
} | |
}, | |
offsets: { | |
get: function() { | |
return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."), this.groups | |
} | |
} | |
}), Object.defineProperties(dc.prototype, { | |
dynamic: { | |
set: function() { | |
console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.") | |
} | |
}, | |
onUpdate: { | |
value: function() { | |
return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."), this | |
} | |
} | |
}), Object.defineProperties(Zn.prototype, { | |
wrapAround: { | |
get: function() { | |
console.warn("THREE.Material: .wrapAround has been removed.") | |
}, | |
set: function() { | |
console.warn("THREE.Material: .wrapAround has been removed.") | |
} | |
}, | |
wrapRGB: { | |
get: function() { | |
return console.warn("THREE.Material: .wrapRGB has been removed."), new rn | |
} | |
}, | |
shading: { | |
get: function() { | |
console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead.") | |
}, | |
set: function(t) { | |
console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."), this.flatShading = 1 === t | |
} | |
} | |
}), Object.defineProperties(ao.prototype, { | |
metal: { | |
get: function() { | |
return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."), !1 | |
}, | |
set: function() { | |
console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead") | |
} | |
} | |
}), Object.defineProperties(Kn.prototype, { | |
derivatives: { | |
get: function() { | |
return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives | |
}, | |
set: function(t) { | |
console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."), this.extensions.derivatives = t | |
} | |
} | |
}), Object.assign(Mr.prototype, { | |
getCurrentRenderTarget: function() { | |
return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."), this.getRenderTarget() | |
}, | |
getMaxAnisotropy: function() { | |
return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."), this.capabilities.getMaxAnisotropy() | |
}, | |
getPrecision: function() { | |
return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."), this.capabilities.precision | |
}, | |
resetGLState: function() { | |
return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."), this.state.reset() | |
}, | |
supportsFloatTextures: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."), this.extensions.get("OES_texture_float") | |
}, | |
supportsHalfFloatTextures: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."), this.extensions.get("OES_texture_half_float") | |
}, | |
supportsStandardDerivatives: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."), this.extensions.get("OES_standard_derivatives") | |
}, | |
supportsCompressedTextureS3TC: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."), this.extensions.get("WEBGL_compressed_texture_s3tc") | |
}, | |
supportsCompressedTexturePVRTC: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."), this.extensions.get("WEBGL_compressed_texture_pvrtc") | |
}, | |
supportsBlendMinMax: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."), this.extensions.get("EXT_blend_minmax") | |
}, | |
supportsVertexTextures: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."), this.capabilities.vertexTextures | |
}, | |
supportsInstancedArrays: function() { | |
return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."), this.extensions.get("ANGLE_instanced_arrays") | |
}, | |
enableScissorTest: function(t) { | |
console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."), this.setScissorTest(t) | |
}, | |
initMaterial: function() { | |
console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.") | |
}, | |
addPrePlugin: function() { | |
console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.") | |
}, | |
addPostPlugin: function() { | |
console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.") | |
}, | |
updateShadowMap: function() { | |
console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.") | |
}, | |
setFaceCulling: function() { | |
console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.") | |
} | |
}), Object.defineProperties(Mr.prototype, { | |
shadowMapEnabled: { | |
get: function() { | |
return this.shadowMap.enabled | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."), this.shadowMap.enabled = t | |
} | |
}, | |
shadowMapType: { | |
get: function() { | |
return this.shadowMap.type | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."), this.shadowMap.type = t | |
} | |
}, | |
shadowMapCullFace: { | |
get: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.") | |
}, | |
set: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.") | |
} | |
} | |
}), Object.defineProperties(vr.prototype, { | |
cullFace: { | |
get: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.") | |
}, | |
set: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.") | |
} | |
}, | |
renderReverseSided: { | |
get: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.") | |
}, | |
set: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.") | |
} | |
}, | |
renderSingleSided: { | |
get: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.") | |
}, | |
set: function() { | |
console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.") | |
} | |
} | |
}), Object.defineProperties(Xe.prototype, { | |
wrapS: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."), this.texture.wrapS = t | |
} | |
}, | |
wrapT: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."), this.texture.wrapT = t | |
} | |
}, | |
magFilter: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."), this.texture.magFilter = t | |
} | |
}, | |
minFilter: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."), this.texture.minFilter = t | |
} | |
}, | |
anisotropy: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."), this.texture.anisotropy = t | |
} | |
}, | |
offset: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."), this.texture.offset = t | |
} | |
}, | |
repeat: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."), this.texture.repeat = t | |
} | |
}, | |
format: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."), this.texture.format = t | |
} | |
}, | |
type: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."), this.texture.type = t | |
} | |
}, | |
generateMipmaps: { | |
get: function() { | |
return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps | |
}, | |
set: function(t) { | |
console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."), this.texture.generateMipmaps = t | |
} | |
} | |
}), Object.defineProperties(Ar.prototype, { | |
standing: { | |
set: function() { | |
console.warn("THREE.WebVRManager: .standing has been removed.") | |
} | |
} | |
}), Xs.prototype.load = function(t) { | |
console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead."); | |
var e = this; | |
return (new Vs).load(t, function(t) { | |
e.setBuffer(t) | |
}), this | |
}, Ys.prototype.getData = function() { | |
return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."), this.getFrequencyData() | |
}, js.prototype.updateCubeMap = function(t, e) { | |
return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."), this.update(t, e) | |
}; | |
var Hc = function() { | |
function t(e, n) { | |
! function(t, e) { | |
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") | |
}(this, t), this.object = e, this.domElement = void 0 !== n ? n : document, n && this.domElement.setAttribute("tabindex", -1), this.movementSpeed = 1, this.rollSpeed = .005, this.dragToLook = !1, this.autoForward = !1, this.enabled = !0, this.object.totaldistance = new Ue(0, 0, 0), this.object.totalrotation = new Ue(0, 0, 0), this.tmpQuaternion = new De, this.mouseStatus = 0, this.moveState = { | |
up: 0, | |
down: 0, | |
left: 0, | |
right: 0, | |
forward: 0, | |
back: 0, | |
pitchUp: 0, | |
pitchDown: 0, | |
yawLeft: 0, | |
yawRight: 0, | |
rollLeft: 0, | |
rollRight: 0 | |
}, this.moveVector = new Ue(0, 0, 0), this.rotationVector = new Ue(0, 0, 0), this.mousemove = this.mousemove.bind(this), this.mousedown = this.mousedown.bind(this), this.mouseup = this.mouseup.bind(this), this.keydown = this.keydown.bind(this), this.keyup = this.keyup.bind(this), this.touchstart = this.touchstart.bind(this), this.touchend = this.touchend.bind(this), this.domElement.addEventListener("contextmenu", function(t) { | |
t.preventDefault() | |
}, !1), this.domElement.addEventListener("mousemove", this.mousemove, !1), this.domElement.addEventListener("mousedown", this.mousedown, !1), this.domElement.addEventListener("mouseup", this.mouseup, !1), this.domElement.addEventListener("touchmove", this.mousemove, !1), this.domElement.addEventListener("touchstart", this.touchstart, !1), this.domElement.addEventListener("touchend", this.touchend, !1), window.addEventListener("keydown", this.keydown, !1), window.addEventListener("keyup", this.keyup, !1), this.updateMovementVector(), this.updateRotationVector() | |
} | |
return t.prototype.resetMouseState = function() { | |
this.moveState = { | |
up: 0, | |
down: 0, | |
left: 0, | |
right: 0, | |
forward: 0, | |
back: 0, | |
pitchUp: 0, | |
pitchDown: 0, | |
yawLeft: 0, | |
yawRight: 0, | |
rollLeft: 0, | |
rollRight: 0 | |
}, this.moveVector = new Ue(0, 0, 0), this.rotationVector = new Ue(0, 0, 0) | |
}, t.prototype.handleEvent = function(t) { | |
"function" == typeof this[t.type] && this[t.type](t) | |
}, t.prototype.keydown = function(t) { | |
if (!1 !== this.enabled && !t.altKey) { | |
switch (t.keyCode) { | |
case 16: | |
this.movementSpeedMultiplier = .1; | |
break; | |
case 87: | |
this.moveState.forward = 1; | |
break; | |
case 83: | |
this.moveState.back = 1; | |
break; | |
case 65: | |
this.moveState.left = 1; | |
break; | |
case 68: | |
this.moveState.right = 1; | |
break; | |
case 82: | |
this.moveState.up = 1; | |
break; | |
case 70: | |
this.moveState.down = 1; | |
break; | |
case 38: | |
this.moveState.pitchUp = 1; | |
break; | |
case 40: | |
this.moveState.pitchDown = 1; | |
break; | |
case 37: | |
this.moveState.yawLeft = 1; | |
break; | |
case 39: | |
this.moveState.yawRight = 1; | |
break; | |
case 81: | |
this.moveState.rollLeft = 1; | |
break; | |
case 69: | |
this.moveState.rollRight = 1 | |
} | |
this.updateMovementVector(), this.updateRotationVector() | |
} | |
}, t.prototype.keyup = function(t) { | |
if (!1 !== this.enabled) { | |
switch (t.keyCode) { | |
case 16: | |
this.movementSpeedMultiplier = 1; | |
break; | |
case 87: | |
this.moveState.forward = 0; | |
break; | |
case 83: | |
this.moveState.back = 0; | |
break; | |
case 65: | |
this.moveState.left = 0; | |
break; | |
case 68: | |
this.moveState.right = 0; | |
break; | |
case 82: | |
this.moveState.up = 0; | |
break; | |
case 70: | |
this.moveState.down = 0; | |
break; | |
case 38: | |
this.moveState.pitchUp = 0; | |
break; | |
case 40: | |
this.moveState.pitchDown = 0; | |
break; | |
case 37: | |
this.moveState.yawLeft = 0; | |
break; | |
case 39: | |
this.moveState.yawRight = 0; | |
break; | |
case 81: | |
this.moveState.rollLeft = 0; | |
break; | |
case 69: | |
this.moveState.rollRight = 0 | |
} | |
this.updateMovementVector(), this.updateRotationVector() | |
} | |
}, t.prototype.mousedown = function(t) { | |
if (!1 !== this.enabled) | |
if (this.domElement !== document && this.domElement.focus(), t.preventDefault(), this.dragToLook) this.mouseStatus += 1; | |
else { | |
switch (t.button) { | |
case 0: | |
this.moveState.forward = 1; | |
break; | |
case 2: | |
this.moveState.back = 1 | |
} | |
this.updateMovementVector() | |
} | |
}, t.prototype.touchstart = function(t) { | |
!1 !== this.enabled && (this.domElement !== document && this.domElement.focus(), t.preventDefault(), t.stopPropagation(), this.dragToLook ? this.mouseStatus += 1 : (this.moveState.forward = 1, this.updateMovementVector())) | |
}, t.prototype.touchend = function(t) { | |
!1 !== this.enabled && (t.preventDefault(), t.stopPropagation(), this.dragToLook ? (this.mouseStatus -= 1, this.moveState.yawLeft = 0, this.moveState.pitchDown = 0) : (this.moveState.forward = 0, this.updateMovementVector()), this.updateRotationVector()) | |
}, t.prototype.mousemove = function(t) { | |
if (!1 !== this.enabled && (!this.dragToLook || this.mouseStatus > 0)) { | |
var e = this.getContainerDimensions(), | |
n = e.size[0] / 2, | |
i = e.size[1] / 2; | |
this.moveState.yawLeft = -(t.pageX - e.offset[0] - n) / n, this.moveState.pitchDown = (t.pageY - e.offset[1] - i) / i, this.updateRotationVector() | |
} | |
}, t.prototype.mouseup = function(t) { | |
if (!1 !== this.enabled) { | |
if (t.preventDefault(), t.stopPropagation(), this.dragToLook) this.mouseStatus -= 1, this.moveState.yawLeft = 0, this.moveState.pitchDown = 0; | |
else { | |
switch (t.button) { | |
case 0: | |
this.moveState.forward = 0; | |
break; | |
case 2: | |
this.moveState.back = 0 | |
} | |
this.updateMovementVector() | |
} | |
this.updateRotationVector() | |
} | |
}, t.prototype.update = function(t) { | |
if (!1 !== this.enabled) { | |
var e = t * this.movementSpeed, | |
n = t * this.rollSpeed; | |
this.object.totaldistance.add(new Ue(this.moveVector.x * e, this.moveVector.y * e, this.moveVector.z * e)), this.object.totalrotation.add(new Ue(this.rotationVector.x * n, this.rotationVector.y * n, this.rotationVector.z * n)), this.object.translateX(this.moveVector.x * e), this.object.translateY(this.moveVector.y * e), this.object.translateZ(this.moveVector.z * e), this.tmpQuaternion.set(this.rotationVector.x * n, this.rotationVector.y * n, this.rotationVector.z * n, 1).normalize(), this.object.quaternion.multiply(this.tmpQuaternion), this.object.rotation.setFromQuaternion(this.object.quaternion, this.object.rotation.order) | |
} | |
}, t.prototype.updateMovementVector = function() { | |
var t = this.moveState.forward || this.autoForward && !this.moveState.back ? 1 : 0; | |
this.moveVector.x = -this.moveState.left + this.moveState.right, this.moveVector.y = -this.moveState.down + this.moveState.up, this.moveVector.z = -t + this.moveState.back | |
}, t.prototype.updateRotationVector = function() { | |
this.rotationVector.x = -this.moveState.pitchDown + this.moveState.pitchUp, this.rotationVector.y = -this.moveState.yawRight + this.moveState.yawLeft, this.rotationVector.z = -this.moveState.rollRight + this.moveState.rollLeft | |
}, t.prototype.getContainerDimensions = function() { | |
return this.domElement !== document ? { | |
size: [this.domElement.offsetWidth, this.domElement.offsetHeight], | |
offset: [this.domElement.offsetLeft, this.domElement.offsetTop] | |
} : { | |
size: [window.innerWidth, window.innerHeight], | |
offset: [0, 0] | |
} | |
}, t.prototype.dispose = function() { | |
this.domElement.removeEventListener("mousedown", this.mousedown), this.domElement.removeEventListener("mousemove", this.mousemove), this.domElement.removeEventListener("mouseup", this.mouseup), this.domElement.removeEventListener("touchmove", this.mousemove), this.domElement.removeEventListener("touchstart", this.touchstart), this.domElement.removeEventListener("touchend", this.touchend), window.removeEventListener("keydown", this.keydown), window.removeEventListener("keyup", this.keyup) | |
}, t | |
}(); | |
function Vc(t, e, n, i) { | |
var r = Math.random(), | |
a = Math.random(), | |
o = 2 * Math.PI * r, | |
s = Math.acos(2 * a - 1); | |
return new Ue(t + i * Math.sin(s) * Math.cos(o), e + i * Math.sin(s) * Math.sin(o), n + i * Math.cos(s)) | |
} | |
var jc = function(t, e, n) { | |
return e[0] + (n - t[0]) * (e[1] - e[0]) / (t[1] - t[0]) | |
}; | |
function Wc(t, e) { | |
var n = t || 16, | |
i = e || 16, | |
r = new Ye(function(t, e) { | |
for (var n = t * e, i = new Uint8Array(3 * n), r = 0; r < n; r += 1) i[3 * r] = 255 * Math.random(), i[3 * r + 1] = 255 * Math.random(), i[3 * r + 2] = 255 * Math.random(); | |
return i | |
}(n, i), n, i, Ht); | |
return r.generateMipmaps = !0, r.wrapS = wt, r.wrapT = wt, r.minFilter = St, r.magFilter = St, r.needsUpdate = !0, r | |
} | |
function Xc(t, e) { | |
var n = 2 * Math.random() - 1, | |
i = 2 * Math.random() - 1, | |
r = 2 * Math.random() - 1, | |
a = 1 / Math.sqrt(Math.pow(n, 2) + Math.pow(i, 2) + Math.pow(r, 2)); | |
return i *= a, r *= a, new Ue((n *= a) * Math.floor(Math.random() * (e - t + 1)) + t, i * Math.floor(Math.random() * (e - t + 1)) + t, r * Math.floor(Math.random() * (e - t + 1)) + t) | |
} | |
function qc(t) { | |
t.traverse(function(t) { | |
t instanceof ni && (t.geometry && (t.geometry.dispose(), t.geometry = void 0), t.material && (t.material instanceof | |
function(t) { | |
return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), t | |
} || t.material instanceof | |
function(t) { | |
return void 0 === t && (t = []), console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), t.isMultiMaterial = !0, t.materials = t, t.clone = function() { | |
return t.slice() | |
}, t | |
} ? t.material.materials.forEach(function(t) { | |
t.map && t.map.dispose(), t.lightMap && t.lightMap.dispose(), t.bumpMap && t.bumpMap.dispose(), t.normalMap && t.normalMap.dispose(), t.specularMap && t.specularMap.dispose(), t.envMap && t.envMap.dispose(), t.dispose(), t = void 0 | |
}) : (t.material.map && t.material.map.dispose(), t.material.lightMap && t.material.lightMap.dispose(), t.material.bumpMap && t.material.bumpMap.dispose(), t.material.normalMap && t.material.normalMap.dispose(), t.material.specularMap && t.material.specularMap.dispose(), t.material.envMap && t.material.envMap.dispose(), t.material.dispose(), t.material = void 0))) | |
}), t = void 0 | |
} | |
function Yc(t, e, n, i, r, a) { | |
An.call(this), this.type = "RingGeometry", this.parameters = { | |
innerRadius: t, | |
outerRadius: e, | |
thetaSegments: n, | |
phiSegments: i, | |
thetaStart: r, | |
thetaLength: a | |
}, this.fromBufferGeometry(new ka(t, e, n, i, r, a)), this.mergeVertices() | |
} | |
function Jc(t, e, n, i, r, a) { | |
Bn.call(this), this.type = "RingBufferGeometry", this.parameters = { | |
innerRadius: t, | |
outerRadius: e, | |
thetaSegments: n, | |
phiSegments: i, | |
thetaStart: r, | |
thetaLength: a | |
}, t = t || .5, e = e || 1, r = void 0 !== r ? r : 0, a = void 0 !== a ? a : 2 * Math.PI, n = void 0 !== n ? Math.max(3, n) : 8; | |
var o = [], | |
s = [], | |
c = [], | |
h = [], | |
l = void 0, | |
u = t, | |
p = (e - t) / (i = void 0 !== i ? Math.max(1, i) : 1), | |
d = new Ue, | |
f = new Pe, | |
m = void 0, | |
g = void 0; | |
for (m = 0; m <= i; m += 1) { | |
for (g = 0; g <= n; g += 1) l = r + g / n * a, d.x = u * Math.cos(l), d.y = u * Math.sin(l), s.push(d.x, d.y, d.z), c.push(0, 0, 1), f.x = g / n, f.y = m / i, h.push(f.x, f.y); | |
u += p | |
} | |
for (m = 0; m < i; m += 1) { | |
var v = m * (n + 1); | |
for (g = 0; g < n; g += 1) { | |
var y = l = g + v, | |
x = l + n + 1, | |
w = l + n + 2, | |
_ = l + 1; | |
o.push(y, x, _), o.push(x, w, _) | |
} | |
} | |
this.setIndex(o), this.addAttribute("position", new Pn(s, 3)), this.addAttribute("normal", new Pn(c, 3)), this.addAttribute("uv", new Pn(h, 2)) | |
} | |
Yc.prototype = Object.create(An.prototype), Yc.prototype.constructor = Yc, Jc.prototype = Object.create(Bn.prototype), Jc.prototype.constructor = Jc; | |
var Zc = "\nprecision highp float;\nprecision highp int;\n\nuniform float u_time;\nuniform sampler2D t_noise;\n\nvarying vec2 vUv;\n\nvoid main () {\n\tfloat t = u_time * .01;\n\n\tvec2 uv = vUv * vec2(1., 3.);\n\tuv.y = sin(uv.y);\n\t\n\tfloat noise1 = texture2D(t_noise, uv + vec2(0., t)).r;\n\tfloat noise2 = texture2D(t_noise, uv + vec2(-t*2.0, -t*.35)).g;\n\n\tfloat v = max(.94, 0.25 + (noise1 + noise2) );\n\tgl_FragColor = vec4(v, v, v, pow(uv.y, 5.2) * v * 0.7);\n}\n", | |
Qc = "\nprecision highp float;\nprecision highp int;\n\nattribute vec4 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n// varying vec3 vPosition;\n\nvoid main () {\n\tvUv = uv;\n\t// vPosition = position.xyz;\n\tgl_Position = projectionMatrix * modelViewMatrix * position;\n}"; | |
var Kc = function() { | |
function t(e, n) { | |
! function(t, e) { | |
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") | |
}(this, t), this.renderer = e, this.camera = n, this.loader = new wo, this.scene = new Tr, this.disposed = !1, this.init() | |
} | |
return t.prototype.init = function() { | |
var t = new Jc(.6, 1, 64, 64), | |
e = new no({ | |
uniforms: { | |
u_time: { | |
value: 1 | |
}, | |
t_noise: { | |
value: Wc(16, 16) | |
} | |
}, | |
vertexShader: Qc, | |
fragmentShader: Zc, | |
transparent: !0, | |
depthTest: !1, | |
depthWrite: !1 | |
}); | |
this.ring = new ni(t, e), this.ring.position.z = .02, this.ring.scale.y = .001, this.ring.scale.x = .001, this.ring.visible = !1, this.scene.add(this.ring) | |
}, t.prototype.animatePortalActivated = function() { | |
s()({ | |
targets: this.ring.scale, | |
duration: 500, | |
x: 1.2, | |
y: 1.2 | |
}) | |
}, t.prototype.dispose = function() { | |
this.disposed = !0, qc(this.scene) | |
}, t.prototype.scaleHalo = function(t) { | |
t > 0 && this.ring.scale.set(t, t, 1) | |
}, t.prototype.animate = function() { | |
this.ring.material.uniforms.u_time.value += .1 | |
}, t.prototype.render = function() { | |
this.renderer.render(this.scene, this.camera) | |
}, t | |
}(); | |
new Float32Array([0, 0]), new Float32Array([0, 1, 1]), new Float32Array([0, 1, 1, 2]), new Float32Array([0, 1, 2, 2, 3]), new Float32Array([0, 1, 2, 3, 4, 4, 5]), new Float32Array([0, 1, 2, 3, 4, 5, 7, 8, 9, 10]); | |
const $c = "uniform sampler2D tDiffuse;\r\nuniform float opacity;\r\n\r\nvarying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvec4 texel = texture2D(tDiffuse, vUv);\r\n\tgl_FragColor = opacity * texel;\r\n\r\n}\r\n", | |
th = "varying vec2 vUv;\r\n\r\nvoid main() {\r\n\r\n\tvUv = uv;\r\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\r\n\r\n}\r\n"; | |
class eh extends Kn { | |
constructor() { | |
super({ | |
type: "CopyMaterial", | |
uniforms: { | |
tDiffuse: new dc(null), | |
opacity: new dc(1) | |
}, | |
fragmentShader: $c, | |
vertexShader: th, | |
depthWrite: !1, | |
depthTest: !1 | |
}) | |
} | |
} | |
class nh { | |
constructor(t = new Tr, e = new yn(-1, 1, 1, -1, 0, 1), n = new ni(new kn(2, 2), null)) { | |
this.name = "Pass", this.scene = t, this.camera = e, this.quad = n, null !== this.quad && (this.quad.frustumCulled = !1, null !== this.scene && this.scene.add(this.quad)), this.needsSwap = !1, this.enabled = !0, this.renderToScreen = !1 | |
} | |
render(t, e, n, i, r) { | |
throw new Error("Render method not implemented!") | |
} | |
setSize(t, e) {} | |
initialize(t, e) {} | |
dispose() { | |
let t; | |
for (t of Object.keys(this)) null !== this[t] && "function" == typeof this[t].dispose && (this[t].dispose(), this[t] = null) | |
} | |
} | |
class ih extends nh { | |
constructor() { | |
super(null, null, null), this.name = "ClearMaskPass" | |
} | |
render(t) { | |
t.state.buffers.stencil.setTest(!1) | |
} | |
} | |
const rh = new rn; | |
class ah extends nh { | |
constructor(t = {}) { | |
super(null, null, null), this.name = "ClearPass", this.clearColor = void 0 !== t.clearColor ? t.clearColor : null, this.clearAlpha = void 0 !== t.clearAlpha ? t.clearAlpha : 0 | |
} | |
render(t, e) { | |
const n = this.clearColor; | |
let i; | |
null !== n && (rh.copy(t.getClearColor()), i = t.getClearAlpha(), t.setClearColor(n, this.clearAlpha)), t.setRenderTarget(this.renderToScreen ? null : e), t.clear(), null !== n && t.setClearColor(rh, i) | |
} | |
} | |
class oh extends nh { | |
constructor(t, e, n = {}) { | |
super(t, e, null), this.name = "RenderPass", this.clearPass = new ah(n), this.overrideMaterial = void 0 !== n.overrideMaterial ? n.overrideMaterial : null, this.clearDepth = void 0 !== n.clearDepth && n.clearDepth, this.clear = void 0 === n.clear || n.clear | |
} | |
render(t, e) { | |
const n = this.scene, | |
i = this.renderToScreen ? null : e, | |
r = n.overrideMaterial; | |
this.clear ? this.clearPass.render(t, i) : this.clearDepth && (t.setRenderTarget(i), t.clearDepth()), n.overrideMaterial = this.overrideMaterial, t.render(n, this.camera, i), n.overrideMaterial = r | |
} | |
} | |
class sh extends nh { | |
constructor(t, e) { | |
super(t, e, null), this.name = "MaskPass", this.inverse = !1, this.clearStencil = !0 | |
} | |
render(t, e, n) { | |
const i = t.context, | |
r = t.state, | |
a = this.scene, | |
o = this.camera, | |
s = this.inverse ? 0 : 1, | |
c = 1 - s; | |
r.buffers.color.setMask(!1), r.buffers.depth.setMask(!1), r.buffers.color.setLocked(!0), r.buffers.depth.setLocked(!0), r.buffers.stencil.setTest(!0), r.buffers.stencil.setOp(i.REPLACE, i.REPLACE, i.REPLACE), r.buffers.stencil.setFunc(i.ALWAYS, s, 4294967295), r.buffers.stencil.setClear(c), this.clearStencil && (t.setRenderTarget(e), t.clearStencil(), t.setRenderTarget(this.renderToScreen ? null : n), t.clearStencil()), t.render(a, o, e), t.render(a, o, this.renderToScreen ? null : n), r.buffers.color.setLocked(!1), r.buffers.depth.setLocked(!1), r.buffers.stencil.setFunc(i.EQUAL, 1, 4294967295), r.buffers.stencil.setOp(i.KEEP, i.KEEP, i.KEEP) | |
} | |
} | |
class ch extends nh { | |
constructor(t, e = "tDiffuse") { | |
super(), this.name = "ShaderPass", this.needsSwap = !0, this.material = t, this.quad.material = this.material, this.textureID = e | |
} | |
render(t, e, n) { | |
void 0 !== this.material.uniforms[this.textureID] && (this.material.uniforms[this.textureID].value = e.texture), t.render(this.scene, this.camera, this.renderToScreen ? null : n) | |
} | |
} | |
Math.PI, new Ue, new Ue; | |
new Ac, new Ac, new Float32Array([0, -.25, .25, -.125, .125, -.375, .375]), new Float32Array([0, 0]), new Float32Array([.25, -.25]), new Float32Array([-.25, .25]), new Float32Array([.125, -.125]), new Float32Array([-.125, .125]), new Uint8Array([0, 0]), new Uint8Array([3, 0]), new Uint8Array([0, 3]), new Uint8Array([3, 3]), new Uint8Array([1, 0]), new Uint8Array([4, 0]), new Uint8Array([1, 3]), new Uint8Array([4, 3]), new Uint8Array([0, 1]), new Uint8Array([3, 1]), new Uint8Array([0, 4]), new Uint8Array([3, 4]), new Uint8Array([1, 1]), new Uint8Array([4, 1]), new Uint8Array([1, 4]), new Uint8Array([4, 4]), new Uint8Array([0, 0]), new Uint8Array([1, 0]), new Uint8Array([0, 2]), new Uint8Array([1, 2]), new Uint8Array([2, 0]), new Uint8Array([3, 0]), new Uint8Array([2, 2]), new Uint8Array([3, 2]), new Uint8Array([0, 1]), new Uint8Array([1, 1]), new Uint8Array([0, 3]), new Uint8Array([1, 3]), new Uint8Array([2, 1]), new Uint8Array([3, 1]), new Uint8Array([2, 3]), new Uint8Array([3, 3]); | |
new Map([ | |
[lh([0, 0, 0, 0]), [0, 0, 0, 0]], | |
[lh([0, 0, 0, 1]), [0, 0, 0, 1]], | |
[lh([0, 0, 1, 0]), [0, 0, 1, 0]], | |
[lh([0, 0, 1, 1]), [0, 0, 1, 1]], | |
[lh([0, 1, 0, 0]), [0, 1, 0, 0]], | |
[lh([0, 1, 0, 1]), [0, 1, 0, 1]], | |
[lh([0, 1, 1, 0]), [0, 1, 1, 0]], | |
[lh([0, 1, 1, 1]), [0, 1, 1, 1]], | |
[lh([1, 0, 0, 0]), [1, 0, 0, 0]], | |
[lh([1, 0, 0, 1]), [1, 0, 0, 1]], | |
[lh([1, 0, 1, 0]), [1, 0, 1, 0]], | |
[lh([1, 0, 1, 1]), [1, 0, 1, 1]], | |
[lh([1, 1, 0, 0]), [1, 1, 0, 0]], | |
[lh([1, 1, 0, 1]), [1, 1, 0, 1]], | |
[lh([1, 1, 1, 0]), [1, 1, 1, 0]], | |
[lh([1, 1, 1, 1]), [1, 1, 1, 1]] | |
]); | |
function hh(t, e, n) { | |
return t + (e - t) * n | |
} | |
function lh(t) { | |
return hh(hh(t[0], t[1], .75), hh(t[2], t[3], .75), .875) | |
} | |
var uh = new(function() { | |
function t(t) { | |
this.manager = void 0 !== t ? t : fo | |
} | |
t.prototype = { | |
constructor: t, | |
crossOrigin: "Anonymous", | |
load: function(t, e, n, i) { | |
var r = this, | |
a = void 0 !== this.path ? this.path : bs.extractUrlBase(t), | |
o = new go(r.manager); | |
o.setResponseType("arraybuffer"), o.load(t, function(t) { | |
try { | |
r.parse(t, a, e, i) | |
} catch (t) { | |
if (void 0 === i) throw t; | |
i(t) | |
} | |
}, n, i) | |
}, | |
setCrossOrigin: function(t) { | |
return this.crossOrigin = t, this | |
}, | |
setPath: function(t) { | |
return this.path = t, this | |
}, | |
parse: function(t, o, s, c) { | |
var h, l = {}; | |
if ("string" == typeof t) h = t; | |
else if (bs.decodeText(new Uint8Array(t, 0, 4)) === i) { | |
try { | |
l[e.KHR_BINARY_GLTF] = new function(t) { | |
this.name = e.KHR_BINARY_GLTF, this.content = null, this.body = null; | |
var n = new DataView(t, 0, r); | |
if (this.header = { | |
magic: bs.decodeText(new Uint8Array(t.slice(0, 4))), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment