Skip to content

Instantly share code, notes, and snippets.

Created April 2, 2014 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9941966 to your computer and use it in GitHub Desktop.
Save anonymous/9941966 to your computer and use it in GitHub Desktop.
/*! 31-03-2014 */
function pad(a, b) {
var c = "0" + a;
return c.substr(c.length - b)
}
function updateCountdown() {
var a = Date.now(),
b = (deadline - a) / 1e3;
b = Math.floor(b);
var c = b / 60;
c = Math.floor(c);
var d = c / 60;
d = Math.floor(d);
var e = d / 24;
e = Math.floor(e),
b -= 60 * c,
c -= 60 * d,
d -= 24 * e,
document.querySelector("#countdownDays .value").innerHTML = pad(e, 2),
document.querySelector("#countdownHours .value").innerHTML = pad(d, 2),
document.querySelector("#countdownMinutes .value").innerHTML = pad(c, 2),
document.querySelector("#countdownSeconds .value").innerHTML = pad(b, 2)
}
Function.prototype.bind || (Function.prototype.bind = function(a) {
if ("function" != typeof this)
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
var b = Array.prototype.slice.call(arguments, 1),
c = this,
d = function() {},
e = function() {
return c.apply(this instanceof d && a ? this: a, b.concat(Array.prototype.slice.call(arguments)))
};
return d.prototype = this.prototype,
e.prototype = new d,
e
});
var THREE = THREE || {
REVISION: "58"
};
self.console = self.console || {
info: function() {},
log: function() {},
debug: function() {},
warn: function() {},
error: function() {}
},
self.Int32Array = self.Int32Array || Array,
self.Float32Array = self.Float32Array || Array,
String.prototype.trim = String.prototype.trim || function() {
return this.replace(/^\s+|\s+$/g, "")
},
THREE.extend = function(a, b) {
if (Object.keys)
for (var c = Object.keys(b), d = 0, e = c.length; e > d; d++) {
var f = c[d];
Object.defineProperty(a, f, Object.getOwnPropertyDescriptor(b, f))
} else
for (f in c = {}.hasOwnProperty, b)
c.call(b, f) && (a[f] = b[f]);
return a
},
function() {
for (var a = 0, b = ["ms", "moz", "webkit", "o"], c = 0; c < b.length && !window.requestAnimationFrame;++c)
window.requestAnimationFrame = window[b[c] + "RequestAnimationFrame"],
window.cancelAnimationFrame = window[b[c] + "CancelAnimationFrame"] || window[b[c] + "CancelRequestAnimationFrame"];
void 0 === window.requestAnimationFrame && (window.requestAnimationFrame = function(b) {
var c = Date.now(),
d = Math.max(0, 16 - (c - a)),
e = window.setTimeout(function() {
b(c + d)
}, d);
return a = c + d,
e
}),
window.cancelAnimationFrame = window.cancelAnimationFrame || function(a) {
window.clearTimeout(a)
}
} (),
THREE.CullFaceNone = 0,
THREE.CullFaceBack = 1,
THREE.CullFaceFront = 2,
THREE.CullFaceFrontBack = 3,
THREE.FrontFaceDirectionCW = 0,
THREE.FrontFaceDirectionCCW = 1,
THREE.BasicShadowMap = 0,
THREE.PCFShadowMap = 1,
THREE.PCFSoftShadowMap = 2,
THREE.FrontSide = 0,
THREE.BackSide = 1,
THREE.DoubleSide = 2,
THREE.NoShading = 0,
THREE.FlatShading = 1,
THREE.SmoothShading = 2,
THREE.NoColors = 0,
THREE.FaceColors = 1,
THREE.VertexColors = 2,
THREE.NoBlending = 0,
THREE.NormalBlending = 1,
THREE.AdditiveBlending = 2,
THREE.SubtractiveBlending = 3,
THREE.MultiplyBlending = 4,
THREE.CustomBlending = 5,
THREE.AddEquation = 100,
THREE.SubtractEquation = 101,
THREE.ReverseSubtractEquation = 102,
THREE.ZeroFactor = 200,
THREE.OneFactor = 201,
THREE.SrcColorFactor = 202,
THREE.OneMinusSrcColorFactor = 203,
THREE.SrcAlphaFactor = 204,
THREE.OneMinusSrcAlphaFactor = 205,
THREE.DstAlphaFactor = 206,
THREE.OneMinusDstAlphaFactor = 207,
THREE.DstColorFactor = 208,
THREE.OneMinusDstColorFactor = 209,
THREE.SrcAlphaSaturateFactor = 210,
THREE.MultiplyOperation = 0,
THREE.MixOperation = 1,
THREE.AddOperation = 2,
THREE.UVMapping = function() {},
THREE.CubeReflectionMapping = function() {},
THREE.CubeRefractionMapping = function() {},
THREE.SphericalReflectionMapping = function() {},
THREE.SphericalRefractionMapping = function() {},
THREE.RepeatWrapping = 1e3,
THREE.ClampToEdgeWrapping = 1001,
THREE.MirroredRepeatWrapping = 1002,
THREE.NearestFilter = 1003,
THREE.NearestMipMapNearestFilter = 1004,
THREE.NearestMipMapLinearFilter = 1005,
THREE.LinearFilter = 1006,
THREE.LinearMipMapNearestFilter = 1007,
THREE.LinearMipMapLinearFilter = 1008,
THREE.UnsignedByteType = 1009,
THREE.ByteType = 1010,
THREE.ShortType = 1011,
THREE.UnsignedShortType = 1012,
THREE.IntType = 1013,
THREE.UnsignedIntType = 1014,
THREE.FloatType = 1015,
THREE.UnsignedShort4444Type = 1016,
THREE.UnsignedShort5551Type = 1017,
THREE.UnsignedShort565Type = 1018,
THREE.AlphaFormat = 1019,
THREE.RGBFormat = 1020,
THREE.RGBAFormat = 1021,
THREE.LuminanceFormat = 1022,
THREE.LuminanceAlphaFormat = 1023,
THREE.RGB_S3TC_DXT1_Format = 2001,
THREE.RGBA_S3TC_DXT1_Format = 2002,
THREE.RGBA_S3TC_DXT3_Format = 2003,
THREE.RGBA_S3TC_DXT5_Format = 2004,
THREE.Color = function(a) {
return void 0 !== a && this.set(a),
this
},
THREE.Color.prototype = {
constructor: THREE.Color,
r: 1,
g: 1,
b: 1,
set: function(a) {
return a instanceof THREE.Color ? this.copy(a) : "number" == typeof a ? this.setHex(a) : "string" == typeof a && this.setStyle(a),
this
},
setHex: function(a) {
return a = Math.floor(a),
this.r = (a >> 16 & 255) / 255,
this.g = (a >> 8 & 255) / 255,
this.b = (255 & a) / 255,
this
},
setRGB: function(a, b, c) {
return this.r = a,
this.g = b,
this.b = c,
this
},
setHSL: function(a, b, c) {
if (0 === b)
this.r = this.g = this.b = c;
else {
var d = function(a, b, c) {
return 0 > c && (c += 1),
c > 1 && (c -= 1),
1 / 6 > c ? a + 6 * (b - a) * c: .5 > c ? b: 2 / 3 > c ? a + 6 * (b - a) * (2 / 3 - c) : a
},
b = .5 >= c ? c * (1 + b) : c + b - c * b,
c = 2 * c - b;
this.r = d(c, b, a + 1 / 3),
this.g = d(c, b, a),
this.b = d(c, b, a - 1 / 3)
}
return this
},
setStyle: function(a) {
return / ^rgb\ ((\d + ), (\d + ), (\d + )\)
$ / i.test(a) ? (a = /^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a), this.r = Math.min(255, parseInt(a[1], 10)) / 255, this.g = Math.min(255, parseInt(a[2], 10)) / 255, this.b = Math.min(255, parseInt(a[3], 10)) / 255, this) : /^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a) ? (a = /^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a), this.r = Math.min(100, parseInt(a[1], 10)) / 100, this.g = Math.min(100, parseInt(a[2], 10)) / 100, this.b = Math.min(100, parseInt(a[3], 10)) / 100, this) : /^\#([0-9a-f]{6})$/i.test(a) ? (a = /^\#([0-9a-f]{6})$/i.exec(a), this.setHex(parseInt(a[1], 16)), this) : /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a) ? (a = /^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a), this.setHex(parseInt(a[1] + a[1] + a[2] + a[2] + a[3] + a[3], 16)), this) : /^(\w+)$/i.test(a) ? (this.setHex(THREE.ColorKeywords[a]), this) : void 0
},
copy: function(a) {
return this.r = a.r,
this.g = a.g,
this.b = a.b,
this
},
copyGammaToLinear: function(a) {
return this.r = a.r * a.r,
this.g = a.g * a.g,
this.b = a.b * a.b,
this
},
copyLinearToGamma: function(a) {
return this.r = Math.sqrt(a.r),
this.g = Math.sqrt(a.g),
this.b = Math.sqrt(a.b),
this
},
convertGammaToLinear: function() {
var a = this.r,
b = this.g,
c = this.b;
return this.r = a * a,
this.g = b * b,
this.b = c * c,
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() {
var a = {
h: 0,
s: 0,
l: 0
};
return function() {
var b,
c = this.r,
d = this.g,
e = this.b,
f = Math.max(c, d, e),
g = Math.min(c, d, e),
h = (g + f) / 2;
if (g === f)
g = b = 0;
else {
var i = f - g,
g = .5 >= h ? i / (f + g) : i / (2 - f - g);
switch (f) {
case c:
b = (d - e) / i + (e > d ? 6: 0);
break;
case d:
b = (e - c) / i + 2;
break;
case e:
b = (c - d) / i + 4
}
b /= 6
}
return a.h = b,
a.s = g,
a.l = h,
a
}
} (),
getStyle: function() {
return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")"
},
offsetHSL: function(a, b, c) {
var d = this.getHSL();
return d.h += a,
d.s += b,
d.l += c,
this.setHSL(d.h, d.s, d.l),
this
},
add: function(a) {
return this.r += a.r,
this.g += a.g,
this.b += a.b,
this
},
addColors: function(a, b) {
return this.r = a.r + b.r,
this.g = a.g + b.g,
this.b = a.b + b.b,
this
},
addScalar: function(a) {
return this.r += a,
this.g += a,
this.b += a,
this
},
multiply: function(a) {
return this.r *= a.r,
this.g *= a.g,
this.b *= a.b,
this
},
multiplyScalar: function(a) {
return this.r *= a,
this.g *= a,
this.b *= a,
this
},
lerp: function(a, b) {
return this.r += (a.r - this.r) * b,
this.g += (a.g - this.g) * b,
this.b += (a.b - this.b) * b,
this
},
equals: function(a) {
return a.r === this.r && a.g === this.g && a.b === this.b
},
clone: function() {
return (new THREE.Color).setRGB(this.r, this.g, this.b)
}
},
THREE.ColorKeywords = {
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,
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
},
THREE.Quaternion = function(a, b, c, d) {
this.x = a || 0,
this.y = b || 0,
this.z = c || 0,
this.w = void 0 !== d ? d: 1
},
THREE.Quaternion.prototype = {
constructor: THREE.Quaternion,
set: function(a, b, c, d) {
return this.x = a,
this.y = b,
this.z = c,
this.w = d,
this
},
copy: function(a) {
return this.x = a.x,
this.y = a.y,
this.z = a.z,
this.w = a.w,
this
},
setFromEuler: function(a, b) {
var c = Math.cos(a.x / 2),
d = Math.cos(a.y / 2),
e = Math.cos(a.z / 2),
f = Math.sin(a.x / 2),
g = Math.sin(a.y / 2),
h = Math.sin(a.z / 2);
return void 0 === b || "XYZ" === b ? (this.x = f * d * e + c * g * h, this.y = c * g * e - f * d * h, this.z = c * d * h + f * g * e, this.w = c * d * e - f * g * h) : "YXZ" === b ? (this.x = f * d * e + c * g * h, this.y = c * g * e - f * d * h, this.z = c * d * h - f * g * e, this.w = c * d * e + f * g * h) : "ZXY" === b ? (this.x = f * d * e - c * g * h, this.y = c * g * e + f * d * h, this.z = c * d * h + f * g * e, this.w = c * d * e - f * g * h) : "ZYX" === b ? (this.x = f * d * e - c * g * h, this.y = c * g * e + f * d * h, this.z = c * d * h - f * g * e, this.w = c * d * e + f * g * h) : "YZX" === b ? (this.x = f * d * e + c * g * h, this.y = c * g * e + f * d * h, this.z = c * d * h - f * g * e, this.w = c * d * e - f * g * h) : "XZY" === b && (this.x = f * d * e - c * g * h, this.y = c * g * e - f * d * h, this.z = c * d * h + f * g * e, this.w = c * d * e + f * g * h),
this
},
setFromAxisAngle: function(a, b) {
var c = b / 2,
d = Math.sin(c);
return this.x = a.x * d,
this.y = a.y * d,
this.z = a.z * d,
this.w = Math.cos(c),
this
},
setFromRotationMatrix: function(a) {
var b = a.elements,
c = b[0],
a = b[4],
d = b[8],
e = b[1],
f = b[5],
g = b[9],
h = b[2],
i = b[6],
b = b[10],
j = c + f + b;
return j > 0 ? (c = .5 / Math.sqrt(j + 1), this.w = .25 / c, this.x = (i - g) * c, this.y = (d - h) * c, this.z = (e - a) * c) : c > f && c > b ? (c = 2 * Math.sqrt(1 + c - f - b), this.w = (i - g) / c, this.x = .25 * c, this.y = (a + e) / c, this.z = (d + h) / c) : f > b ? (c = 2 * Math.sqrt(1 + f - c - b), this.w = (d - h) / c, this.x = (a + e) / c, this.y = .25 * c, this.z = (g + i) / c) : (c = 2 * Math.sqrt(1 + b - c - f), this.w = (e - a) / c, this.x = (d + h) / c, this.y = (g + i) / c, this.z = .25 * c),
this
},
inverse: function() {
return this.conjugate().normalize(),
this
},
conjugate: function() {
return this.x *= -1,
this.y *= -1,
this.z *= -1,
this
},
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 a = this.length();
return 0 === a ? (this.z = this.y = this.x = 0, this.w = 1) : (a = 1 / a, this.x *= a, this.y *= a, this.z *= a, this.w *= a),
this
},
multiply: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Quaternion's .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(a, b)) : this.multiplyQuaternions(this, a)
},
multiplyQuaternions: function(a, b) {
var c = a.x,
d = a.y,
e = a.z,
f = a.w,
g = b.x,
h = b.y,
i = b.z,
j = b.w;
return this.x = c * j + f * g + d * i - e * h,
this.y = d * j + f * h + e * g - c * i,
this.z = e * j + f * i + c * h - d * g,
this.w = f * j - c * g - d * h - e * i,
this
},
multiplyVector3: function(a) {
return console.warn("DEPRECATED: Quaternion's .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),
a.applyQuaternion(this)
},
slerp: function(a, b) {
var c = this.x,
d = this.y,
e = this.z,
f = this.w,
g = f * a.w + c * a.x + d * a.y + e * a.z;
if (0 > g ? (this.w = -a.w, this.x = -a.x, this.y = -a.y, this.z = -a.z, g = -g) : this.copy(a), g >= 1)
return this.w = f,
this.x = c,
this.y = d,
this.z = e,
this;
var h = Math.acos(g),
i = Math.sqrt(1 - g * g);
return.001 > Math.abs(i) ? (this.w = .5 * (f + this.w), this.x = .5 * (c + this.x), this.y = .5 * (d + this.y), this.z = .5 * (e + this.z), this) : (g = Math.sin((1 - b) * h) / i, h = Math.sin(b * h) / i, this.w = f * g + this.w * h, this.x = c * g + this.x * h, this.y = d * g + this.y * h, this.z = e * g + this.z * h, this)
},
equals: function(a) {
return a.x === this.x && a.y === this.y && a.z === this.z && a.w === this.w
},
fromArray: function(a) {
return this.x = a[0],
this.y = a[1],
this.z = a[2],
this.w = a[3],
this
},
toArray: function() {
return [this.x, this.y, this.z, this.w]
},
clone: function() {
return new THREE.Quaternion(this.x, this.y, this.z, this.w)
}
},
THREE.Quaternion.slerp = function(a, b, c, d) {
return c.copy(a).slerp(b, d)
},
THREE.Vector2 = function(a, b) {
this.x = a || 0,
this.y = b || 0
},
THREE.Vector2.prototype = {
constructor: THREE.Vector2,
set: function(a, b) {
return this.x = a,
this.y = b,
this
},
setX: function(a) {
return this.x = a,
this
},
setY: function(a) {
return this.y = a,
this
},
setComponent: function(a, b) {
switch (a) {
case 0:
this.x = b;
break;
case 1:
this.y = b;
break;
default:
throw Error("index is out of range: " + a)
}
},
getComponent: function(a) {
switch (a) {
case 0:
return this.x;
case 1:
return this.y;
default:
throw Error("index is out of range: " + a)
}
},
copy: function(a) {
return this.x = a.x,
this.y = a.y,
this
},
add: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Vector2's .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(a, b)) : (this.x += a.x, this.y += a.y, this)
},
addVectors: function(a, b) {
return this.x = a.x + b.x,
this.y = a.y + b.y,
this
},
addScalar: function(a) {
return this.x += a,
this.y += a,
this
},
sub: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Vector2's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a, b)) : (this.x -= a.x, this.y -= a.y, this)
},
subVectors: function(a, b) {
return this.x = a.x - b.x,
this.y = a.y - b.y,
this
},
multiplyScalar: function(a) {
return this.x *= a,
this.y *= a,
this
},
divideScalar: function(a) {
return 0 !== a ? (this.x /= a, this.y /= a) : this.set(0, 0),
this
},
min: function(a) {
return this.x > a.x && (this.x = a.x),
this.y > a.y && (this.y = a.y),
this
},
max: function(a) {
return this.x < a.x && (this.x = a.x),
this.y < a.y && (this.y = a.y),
this
},
clamp: function(a, b) {
return this.x < a.x ? this.x = a.x: this.x > b.x && (this.x = b.x),
this.y < a.y ? this.y = a.y: this.y > b.y && (this.y = b.y),
this
},
negate: function() {
return this.multiplyScalar( - 1)
},
dot: function(a) {
return this.x * a.x + this.y * a.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)
},
normalize: function() {
return this.divideScalar(this.length())
},
distanceTo: function(a) {
return Math.sqrt(this.distanceToSquared(a))
},
distanceToSquared: function(a) {
var b = this.x - a.x,
a = this.y - a.y;
return b * b + a * a
},
setLength: function(a) {
var b = this.length();
return 0 !== b && a !== b && this.multiplyScalar(a / b),
this
},
lerp: function(a, b) {
return this.x += (a.x - this.x) * b,
this.y += (a.y - this.y) * b,
this
},
equals: function(a) {
return a.x === this.x && a.y === this.y
},
fromArray: function(a) {
return this.x = a[0],
this.y = a[1],
this
},
toArray: function() {
return [this.x, this.y]
},
clone: function() {
return new THREE.Vector2(this.x, this.y)
}
},
THREE.Vector3 = function(a, b, c) {
this.x = a || 0,
this.y = b || 0,
this.z = c || 0
},
THREE.Vector3.prototype = {
constructor: THREE.Vector3,
set: function(a, b, c) {
return this.x = a,
this.y = b,
this.z = c,
this
},
setX: function(a) {
return this.x = a,
this
},
setY: function(a) {
return this.y = a,
this
},
setZ: function(a) {
return this.z = a,
this
},
setComponent: function(a, b) {
switch (a) {
case 0:
this.x = b;
break;
case 1:
this.y = b;
break;
case 2:
this.z = b;
break;
default:
throw Error("index is out of range: " + a)
}
},
getComponent: function(a) {
switch (a) {
case 0:
return this.x;
case 1:
return this.y;
case 2:
return this.z;
default:
throw Error("index is out of range: " + a)
}
},
copy: function(a) {
return this.x = a.x,
this.y = a.y,
this.z = a.z,
this
},
add: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Vector3's .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(a, b)) : (this.x += a.x, this.y += a.y, this.z += a.z, this)
},
addScalar: function(a) {
return this.x += a,
this.y += a,
this.z += a,
this
},
addVectors: function(a, b) {
return this.x = a.x + b.x,
this.y = a.y + b.y,
this.z = a.z + b.z,
this
},
sub: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Vector3's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a, b)) : (this.x -= a.x, this.y -= a.y, this.z -= a.z, this)
},
subVectors: function(a, b) {
return this.x = a.x - b.x,
this.y = a.y - b.y,
this.z = a.z - b.z,
this
},
multiply: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Vector3's .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(a, b)) : (this.x *= a.x, this.y *= a.y, this.z *= a.z, this)
},
multiplyScalar: function(a) {
return this.x *= a,
this.y *= a,
this.z *= a,
this
},
multiplyVectors: function(a, b) {
return this.x = a.x * b.x,
this.y = a.y * b.y,
this.z = a.z * b.z,
this
},
applyMatrix3: function(a) {
var b = this.x,
c = this.y,
d = this.z,
a = a.elements;
return this.x = a[0] * b + a[3] * c + a[6] * d,
this.y = a[1] * b + a[4] * c + a[7] * d,
this.z = a[2] * b + a[5] * c + a[8] * d,
this
},
applyMatrix4: function(a) {
var b = this.x,
c = this.y,
d = this.z,
a = a.elements;
return this.x = a[0] * b + a[4] * c + a[8] * d + a[12],
this.y = a[1] * b + a[5] * c + a[9] * d + a[13],
this.z = a[2] * b + a[6] * c + a[10] * d + a[14],
this
},
applyProjection: function(a) {
var b = this.x,
c = this.y,
d = this.z,
a = a.elements,
e = 1 / (a[3] * b + a[7] * c + a[11] * d + a[15]);
return this.x = (a[0] * b + a[4] * c + a[8] * d + a[12]) * e,
this.y = (a[1] * b + a[5] * c + a[9] * d + a[13]) * e,
this.z = (a[2] * b + a[6] * c + a[10] * d + a[14]) * e,
this
},
applyQuaternion: function(a) {
var b = this.x,
c = this.y,
d = this.z,
e = a.x,
f = a.y,
g = a.z,
a = a.w,
h = a * b + f * d - g * c,
i = a * c + g * b - e * d,
j = a * d + e * c - f * b,
b = -e * b - f * c - g * d;
return this.x = h * a + b * -e + i * -g - j * -f,
this.y = i * a + b * -f + j * -e - h * -g,
this.z = j * a + b * -g + h * -f - i * -e,
this
},
transformDirection: function(a) {
var b = this.x,
c = this.y,
d = this.z,
a = a.elements;
return this.x = a[0] * b + a[4] * c + a[8] * d,
this.y = a[1] * b + a[5] * c + a[9] * d,
this.z = a[2] * b + a[6] * c + a[10] * d,
this.normalize(),
this
},
divide: function(a) {
return this.x /= a.x,
this.y /= a.y,
this.z /= a.z,
this
},
divideScalar: function(a) {
return 0 !== a ? (this.x /= a, this.y /= a, this.z /= a) : this.z = this.y = this.x = 0,
this
},
min: function(a) {
return this.x > a.x && (this.x = a.x),
this.y > a.y && (this.y = a.y),
this.z > a.z && (this.z = a.z),
this
},
max: function(a) {
return this.x < a.x && (this.x = a.x),
this.y < a.y && (this.y = a.y),
this.z < a.z && (this.z = a.z),
this
},
clamp: function(a, b) {
return this.x < a.x ? this.x = a.x: this.x > b.x && (this.x = b.x),
this.y < a.y ? this.y = a.y: this.y > b.y && (this.y = b.y),
this.z < a.z ? this.z = a.z: this.z > b.z && (this.z = b.z),
this
},
negate: function() {
return this.multiplyScalar( - 1)
},
dot: function(a) {
return this.x * a.x + this.y * a.y + this.z * a.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)
},
lengthManhattan: function() {
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
},
normalize: function() {
return this.divideScalar(this.length())
},
setLength: function(a) {
var b = this.length();
return 0 !== b && a !== b && this.multiplyScalar(a / b),
this
},
lerp: function(a, b) {
return this.x += (a.x - this.x) * b,
this.y += (a.y - this.y) * b,
this.z += (a.z - this.z) * b,
this
},
cross: function(a, b) {
if (void 0 !== b)
return console.warn("DEPRECATED: Vector3's .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),
this.crossVectors(a, b);
var c = this.x,
d = this.y,
e = this.z;
return this.x = d * a.z - e * a.y,
this.y = e * a.x - c * a.z,
this.z = c * a.y - d * a.x,
this
},
crossVectors: function(a, b) {
return this.x = a.y * b.z - a.z * b.y,
this.y = a.z * b.x - a.x * b.z,
this.z = a.x * b.y - a.y * b.x,
this
},
angleTo: function(a) {
return a = this.dot(a) / (this.length() * a.length()),
Math.acos(THREE.Math.clamp(a, -1, 1))
},
distanceTo: function(a) {
return Math.sqrt(this.distanceToSquared(a))
},
distanceToSquared: function(a) {
var b = this.x - a.x,
c = this.y - a.y,
a = this.z - a.z;
return b * b + c * c + a * a
},
setEulerFromRotationMatrix: function(a, b) {
function c(a) {
return Math.min(Math.max(a, -1), 1)
}
var d = a.elements,
e = d[0],
f = d[4],
g = d[8],
h = d[1],
i = d[5],
j = d[9],
k = d[2],
l = d[6],
d = d[10];
return void 0 === b || "XYZ" === b ? (this.y = Math.asin(c(g)), .99999 > Math.abs(g) ? (this.x = Math.atan2( - j, d), this.z = Math.atan2( - f, e)) : (this.x = Math.atan2(l, i), this.z = 0)) : "YXZ" === b ? (this.x = Math.asin( - c(j)), .99999 > Math.abs(j) ? (this.y = Math.atan2(g, d), this.z = Math.atan2(h, i)) : (this.y = Math.atan2( - k, e), this.z = 0)) : "ZXY" === b ? (this.x = Math.asin(c(l)), .99999 > Math.abs(l) ? (this.y = Math.atan2( - k, d), this.z = Math.atan2( - f, i)) : (this.y = 0, this.z = Math.atan2(h, e))) : "ZYX" === b ? (this.y = Math.asin( - c(k)), .99999 > Math.abs(k) ? (this.x = Math.atan2(l, d), this.z = Math.atan2(h, e)) : (this.x = 0, this.z = Math.atan2( - f, i))) : "YZX" === b ? (this.z = Math.asin(c(h)), .99999 > Math.abs(h) ? (this.x = Math.atan2( - j, i), this.y = Math.atan2( - k, e)) : (this.x = 0, this.y = Math.atan2(g, d))) : "XZY" === b && (this.z = Math.asin( - c(f)), .99999 > Math.abs(f) ? (this.x = Math.atan2(l, i), this.y = Math.atan2(g, e)) : (this.x = Math.atan2( - j, d), this.y = 0)),
this
},
setEulerFromQuaternion: function(a, b) {
function c(a) {
return Math.min(Math.max(a, -1), 1)
}
var d = a.x * a.x,
e = a.y * a.y,
f = a.z * a.z,
g = a.w * a.w;
return void 0 === b || "XYZ" === b ? (this.x = Math.atan2(2 * (a.x * a.w - a.y * a.z), g - d - e + f), this.y = Math.asin(c(2 * (a.x * a.z + a.y * a.w))), this.z = Math.atan2(2 * (a.z * a.w - a.x * a.y), g + d - e - f)) : "YXZ" === b ? (this.x = Math.asin(c(2 * (a.x * a.w - a.y * a.z))), this.y = Math.atan2(2 * (a.x * a.z + a.y * a.w), g - d - e + f), this.z = Math.atan2(2 * (a.x * a.y + a.z * a.w), g - d + e - f)) : "ZXY" === b ? (this.x = Math.asin(c(2 * (a.x * a.w + a.y * a.z))), this.y = Math.atan2(2 * (a.y * a.w - a.z * a.x), g - d - e + f), this.z = Math.atan2(2 * (a.z * a.w - a.x * a.y), g - d + e - f)) : "ZYX" === b ? (this.x = Math.atan2(2 * (a.x * a.w + a.z * a.y), g - d - e + f), this.y = Math.asin(c(2 * (a.y * a.w - a.x * a.z))), this.z = Math.atan2(2 * (a.x * a.y + a.z * a.w), g + d - e - f)) : "YZX" === b ? (this.x = Math.atan2(2 * (a.x * a.w - a.z * a.y), g - d + e - f), this.y = Math.atan2(2 * (a.y * a.w - a.x * a.z), g + d - e - f), this.z = Math.asin(c(2 * (a.x * a.y + a.z * a.w)))) : "XZY" === b && (this.x = Math.atan2(2 * (a.x * a.w + a.y * a.z), g - d + e - f), this.y = Math.atan2(2 * (a.x * a.z + a.y * a.w), g + d - e - f), this.z = Math.asin(c(2 * (a.z * a.w - a.x * a.y)))),
this
},
getPositionFromMatrix: function(a) {
return this.x = a.elements[12],
this.y = a.elements[13],
this.z = a.elements[14],
this
},
getScaleFromMatrix: function(a) {
var b = this.set(a.elements[0], a.elements[1], a.elements[2]).length(),
c = this.set(a.elements[4], a.elements[5], a.elements[6]).length(),
a = this.set(a.elements[8], a.elements[9], a.elements[10]).length();
return this.x = b,
this.y = c,
this.z = a,
this
},
getColumnFromMatrix: function(a, b) {
var c = 4 * a,
d = b.elements;
return this.x = d[c],
this.y = d[c + 1],
this.z = d[c + 2],
this
},
equals: function(a) {
return a.x === this.x && a.y === this.y && a.z === this.z
},
fromArray: function(a) {
return this.x = a[0],
this.y = a[1],
this.z = a[2],
this
},
toArray: function() {
return [this.x, this.y, this.z]
},
clone: function() {
return new THREE.Vector3(this.x, this.y, this.z)
}
},
THREE.extend(THREE.Vector3.prototype, {
applyEuler: function() {
var a = new THREE.Quaternion;
return function(b, c) {
var d = a.setFromEuler(b, c);
return this.applyQuaternion(d),
this
}
} (),
applyAxisAngle: function() {
var a = new THREE.Quaternion;
return function(b, c) {
var d = a.setFromAxisAngle(b, c);
return this.applyQuaternion(d),
this
}
} (),
projectOnVector: function() {
var a = new THREE.Vector3;
return function(b) {
return a.copy(b).normalize(),
b = this.dot(a),
this.copy(a).multiplyScalar(b)
}
} (),
projectOnPlane: function() {
var a = new THREE.Vector3;
return function(b) {
return a.copy(this).projectOnVector(b),
this.sub(a)
}
} (),
reflect: function() {
var a = new THREE.Vector3;
return function(b) {
return a.copy(this).projectOnVector(b).multiplyScalar(2),
this.subVectors(a, this)
}
} ()
}),
THREE.Vector4 = function(a, b, c, d) {
this.x = a || 0,
this.y = b || 0,
this.z = c || 0,
this.w = void 0 !== d ? d: 1
},
THREE.Vector4.prototype = {
constructor: THREE.Vector4,
set: function(a, b, c, d) {
return this.x = a,
this.y = b,
this.z = c,
this.w = d,
this
},
setX: function(a) {
return this.x = a,
this
},
setY: function(a) {
return this.y = a,
this
},
setZ: function(a) {
return this.z = a,
this
},
setW: function(a) {
return this.w = a,
this
},
setComponent: function(a, b) {
switch (a) {
case 0:
this.x = b;
break;
case 1:
this.y = b;
break;
case 2:
this.z = b;
break;
case 3:
this.w = b;
break;
default:
throw Error("index is out of range: " + a)
}
},
getComponent: function(a) {
switch (a) {
case 0:
return this.x;
case 1:
return this.y;
case 2:
return this.z;
case 3:
return this.w;
default:
throw Error("index is out of range: " + a)
}
},
copy: function(a) {
return this.x = a.x,
this.y = a.y,
this.z = a.z,
this.w = void 0 !== a.w ? a.w: 1,
this
},
add: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Vector4's .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(a, b)) : (this.x += a.x, this.y += a.y, this.z += a.z, this.w += a.w, this)
},
addScalar: function(a) {
return this.x += a,
this.y += a,
this.z += a,
this.w += a,
this
},
addVectors: function(a, b) {
return this.x = a.x + b.x,
this.y = a.y + b.y,
this.z = a.z + b.z,
this.w = a.w + b.w,
this
},
sub: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Vector4's .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(a, b)) : (this.x -= a.x, this.y -= a.y, this.z -= a.z, this.w -= a.w, this)
},
subVectors: function(a, b) {
return this.x = a.x - b.x,
this.y = a.y - b.y,
this.z = a.z - b.z,
this.w = a.w - b.w,
this
},
multiplyScalar: function(a) {
return this.x *= a,
this.y *= a,
this.z *= a,
this.w *= a,
this
},
applyMatrix4: function(a) {
var b = this.x,
c = this.y,
d = this.z,
e = this.w,
a = a.elements;
return this.x = a[0] * b + a[4] * c + a[8] * d + a[12] * e,
this.y = a[1] * b + a[5] * c + a[9] * d + a[13] * e,
this.z = a[2] * b + a[6] * c + a[10] * d + a[14] * e,
this.w = a[3] * b + a[7] * c + a[11] * d + a[15] * e,
this
},
divideScalar: function(a) {
return 0 !== a ? (this.x /= a, this.y /= a, this.z /= a, this.w /= a) : (this.z = this.y = this.x = 0, this.w = 1),
this
},
setAxisAngleFromQuaternion: function(a) {
this.w = 2 * Math.acos(a.w);
var b = Math.sqrt(1 - a.w * a.w);
return 1e - 4 > b ? (this.x = 1, this.z = this.y = 0) : (this.x = a.x / b, this.y = a.y / b, this.z = a.z / b),
this
},
setAxisAngleFromRotationMatrix: function(a) {
var b,
c,
d,
a = a.elements,
e = a[0];
d = a[4];
var f = a[8],
g = a[1],
h = a[5],
i = a[9];
c = a[2],
b = a[6];
var j = a[10];
return.01 > Math.abs(d - g) && .01 > Math.abs(f - c) && .01 > Math.abs(i - b) ? .1 > Math.abs(d + g) && .1 > Math.abs(f + c) && .1 > Math.abs(i + b) && .1 > Math.abs(e + h + j - 3) ? (this.set(1, 0, 0, 0), this) : (a = Math.PI, e = (e + 1) / 2, h = (h + 1) / 2, j = (j + 1) / 2, d = (d + g) / 4, f = (f + c) / 4, i = (i + b) / 4, e > h && e > j ? .01 > e ? (b = 0, d = c = .707106781) : (b = Math.sqrt(e), c = d / b, d = f / b) : h > j ? .01 > h ? (b = .707106781, c = 0, d = .707106781) : (c = Math.sqrt(h), b = d / c, d = i / c) : .01 > j ? (c = b = .707106781, d = 0) : (d = Math.sqrt(j), b = f / d, c = i / d), this.set(b, c, d, a), this) : (a = Math.sqrt((b - i) * (b - i) + (f - c) * (f - c) + (g - d) * (g - d)), .001 > Math.abs(a) && (a = 1), this.x = (b - i) / a, this.y = (f - c) / a, this.z = (g - d) / a, this.w = Math.acos((e + h + j - 1) / 2), this)
},
min: function(a) {
return this.x > a.x && (this.x = a.x),
this.y > a.y && (this.y = a.y),
this.z > a.z && (this.z = a.z),
this.w > a.w && (this.w = a.w),
this
},
max: function(a) {
return this.x < a.x && (this.x = a.x),
this.y < a.y && (this.y = a.y),
this.z < a.z && (this.z = a.z),
this.w < a.w && (this.w = a.w),
this
},
clamp: function(a, b) {
return this.x < a.x ? this.x = a.x: this.x > b.x && (this.x = b.x),
this.y < a.y ? this.y = a.y: this.y > b.y && (this.y = b.y),
this.z < a.z ? this.z = a.z: this.z > b.z && (this.z = b.z),
this.w < a.w ? this.w = a.w: this.w > b.w && (this.w = b.w),
this
},
negate: function() {
return this.multiplyScalar( - 1)
},
dot: function(a) {
return this.x * a.x + this.y * a.y + this.z * a.z + this.w * a.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)
},
lengthManhattan: 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())
},
setLength: function(a) {
var b = this.length();
return 0 !== b && a !== b && this.multiplyScalar(a / b),
this
},
lerp: function(a, b) {
return this.x += (a.x - this.x) * b,
this.y += (a.y - this.y) * b,
this.z += (a.z - this.z) * b,
this.w += (a.w - this.w) * b,
this
},
equals: function(a) {
return a.x === this.x && a.y === this.y && a.z === this.z && a.w === this.w
},
fromArray: function(a) {
return this.x = a[0],
this.y = a[1],
this.z = a[2],
this.w = a[3],
this
},
toArray: function() {
return [this.x, this.y, this.z, this.w]
},
clone: function() {
return new THREE.Vector4(this.x, this.y, this.z, this.w)
}
},
THREE.Line3 = function(a, b) {
this.start = void 0 !== a ? a: new THREE.Vector3,
this.end = void 0 !== b ? b: new THREE.Vector3
},
THREE.Line3.prototype = {
constructor: THREE.Line3,
set: function(a, b) {
return this.start.copy(a),
this.end.copy(b),
this
},
copy: function(a) {
return this.start.copy(a.start),
this.end.copy(a.end),
this
},
center: function(a) {
return (a || new THREE.Vector3).addVectors(this.start, this.end).multiplyScalar(.5)
},
delta: function(a) {
return (a || new THREE.Vector3).subVectors(this.end, this.start)
},
distanceSq: function() {
return this.start.distanceToSquared(this.end)
},
distance: function() {
return this.start.distanceTo(this.end)
},
at: function(a, b) {
var c = b || new THREE.Vector3;
return this.delta(c).multiplyScalar(a).add(this.start)
},
closestPointToPointParameter: function() {
var a = new THREE.Vector3,
b = new THREE.Vector3;
return function(c, d) {
a.subVectors(c, this.start),
b.subVectors(this.end, this.start);
var e = b.dot(b),
e = b.dot(a) / e;
return d && (e = THREE.Math.clamp(e, 0, 1)),
e
}
} (),
closestPointToPoint: function(a, b, c) {
return a = this.closestPointToPointParameter(a, b),
c = c || new THREE.Vector3,
this.delta(c).multiplyScalar(a).add(this.start)
},
applyMatrix4: function(a) {
return this.start.applyMatrix4(a),
this.end.applyMatrix4(a),
this
},
equals: function(a) {
return a.start.equals(this.start) && a.end.equals(this.end)
},
clone: function() {
return (new THREE.Line3).copy(this)
}
},
THREE.Box2 = function(a, b) {
this.min = void 0 !== a ? a: new THREE.Vector2(1 / 0, 1 / 0),
this.max = void 0 !== b ? b: new THREE.Vector2( - 1 / 0, -1 / 0)
},
THREE.Box2.prototype = {
constructor: THREE.Box2,
set: function(a, b) {
return this.min.copy(a),
this.max.copy(b),
this
},
setFromPoints: function(a) {
if (0 < a.length) {
var b = a[0];
this.min.copy(b),
this.max.copy(b);
for (var c = 1, d = a.length; d > c; c++)
b = a[c],
b.x < this.min.x ? this.min.x = b.x: b.x > this.max.x && (this.max.x = b.x),
b.y < this.min.y ? this.min.y = b.y: b.y > this.max.y && (this.max.y = b.y)
} else
this.makeEmpty();
return this
},
setFromCenterAndSize: function() {
var a = new THREE.Vector2;
return function(b, c) {
var d = a.copy(c).multiplyScalar(.5);
return this.min.copy(b).sub(d),
this.max.copy(b).add(d),
this
}
} (),
copy: function(a) {
return this.min.copy(a.min),
this.max.copy(a.max),
this
},
makeEmpty: function() {
return this.min.x = this.min.y = 1 / 0,
this.max.x = this.max.y = -1 / 0,
this
},
empty: function() {
return this.max.x < this.min.x || this.max.y < this.min.y
},
center: function(a) {
return (a || new THREE.Vector2).addVectors(this.min, this.max).multiplyScalar(.5)
},
size: function(a) {
return (a || new THREE.Vector2).subVectors(this.max, this.min)
},
expandByPoint: function(a) {
return this.min.min(a),
this.max.max(a),
this
},
expandByVector: function(a) {
return this.min.sub(a),
this.max.add(a),
this
},
expandByScalar: function(a) {
return this.min.addScalar( - a),
this.max.addScalar(a),
this
},
containsPoint: function(a) {
return a.x < this.min.x || a.x > this.max.x || a.y < this.min.y || a.y > this.max.y ? !1: !0
},
containsBox: function(a) {
return this.min.x <= a.min.x && a.max.x <= this.max.x && this.min.y <= a.min.y && a.max.y <= this.max.y ? !0: !1
},
getParameter: function(a) {
return new THREE.Vector2((a.x - this.min.x) / (this.max.x - this.min.x), (a.y - this.min.y) / (this.max.y - this.min.y))
},
isIntersectionBox: function(a) {
return a.max.x < this.min.x || a.min.x > this.max.x || a.max.y < this.min.y || a.min.y > this.max.y ? !1: !0
},
clampPoint: function(a, b) {
return (b || new THREE.Vector2).copy(a).clamp(this.min, this.max)
},
distanceToPoint: function() {
var a = new THREE.Vector2;
return function(b) {
return a.copy(b).clamp(this.min, this.max).sub(b).length()
}
} (),
intersect: function(a) {
return this.min.max(a.min),
this.max.min(a.max),
this
},
union: function(a) {
return this.min.min(a.min),
this.max.max(a.max),
this
},
translate: function(a) {
return this.min.add(a),
this.max.add(a),
this
},
equals: function(a) {
return a.min.equals(this.min) && a.max.equals(this.max)
},
clone: function() {
return (new THREE.Box2).copy(this)
}
},
THREE.Box3 = function(a, b) {
this.min = void 0 !== a ? a: new THREE.Vector3(1 / 0, 1 / 0, 1 / 0),
this.max = void 0 !== b ? b: new THREE.Vector3( - 1 / 0, -1 / 0, -1 / 0)
},
THREE.Box3.prototype = {
constructor: THREE.Box3,
set: function(a, b) {
return this.min.copy(a),
this.max.copy(b),
this
},
setFromPoints: function(a) {
if (0 < a.length) {
var b = a[0];
this.min.copy(b),
this.max.copy(b);
for (var c = 1, d = a.length; d > c; c++)
b = a[c],
b.x < this.min.x ? this.min.x = b.x: b.x > this.max.x && (this.max.x = b.x),
b.y < this.min.y ? this.min.y = b.y: b.y > this.max.y && (this.max.y = b.y),
b.z < this.min.z ? this.min.z = b.z: b.z > this.max.z && (this.max.z = b.z)
} else
this.makeEmpty();
return this
},
setFromCenterAndSize: function() {
var a = new THREE.Vector3;
return function(b, c) {
var d = a.copy(c).multiplyScalar(.5);
return this.min.copy(b).sub(d),
this.max.copy(b).add(d),
this
}
} (),
copy: function(a) {
return this.min.copy(a.min),
this.max.copy(a.max),
this
},
makeEmpty: function() {
return this.min.x = this.min.y = this.min.z = 1 / 0,
this.max.x = this.max.y = this.max.z = -1 / 0,
this
},
empty: function() {
return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z
},
center: function(a) {
return (a || new THREE.Vector3).addVectors(this.min, this.max).multiplyScalar(.5)
},
size: function(a) {
return (a || new THREE.Vector3).subVectors(this.max, this.min)
},
expandByPoint: function(a) {
return this.min.min(a),
this.max.max(a),
this
},
expandByVector: function(a) {
return this.min.sub(a),
this.max.add(a),
this
},
expandByScalar: function(a) {
return this.min.addScalar( - a),
this.max.addScalar(a),
this
},
containsPoint: function(a) {
return a.x < this.min.x || a.x > this.max.x || a.y < this.min.y || a.y > this.max.y || a.z < this.min.z || a.z > this.max.z ? !1: !0
},
containsBox: function(a) {
return this.min.x <= a.min.x && a.max.x <= this.max.x && this.min.y <= a.min.y && a.max.y <= this.max.y && this.min.z <= a.min.z && a.max.z <= this.max.z ? !0: !1
},
getParameter: function(a) {
return new THREE.Vector3((a.x - this.min.x) / (this.max.x - this.min.x), (a.y - this.min.y) / (this.max.y - this.min.y), (a.z - this.min.z) / (this.max.z - this.min.z))
},
isIntersectionBox: function(a) {
return a.max.x < this.min.x || a.min.x > this.max.x || a.max.y < this.min.y || a.min.y > this.max.y || a.max.z < this.min.z || a.min.z > this.max.z ? !1: !0
},
clampPoint: function(a, b) {
return (b || new THREE.Vector3).copy(a).clamp(this.min, this.max)
},
distanceToPoint: function() {
var a = new THREE.Vector3;
return function(b) {
return a.copy(b).clamp(this.min, this.max).sub(b).length()
}
} (),
getBoundingSphere: function() {
var a = new THREE.Vector3;
return function(b) {
return b = b || new THREE.Sphere,
b.center = this.center(),
b.radius = .5 * this.size(a).length(),
b
}
} (),
intersect: function(a) {
return this.min.max(a.min),
this.max.min(a.max),
this
},
union: function(a) {
return this.min.min(a.min),
this.max.max(a.max),
this
},
applyMatrix4: function() {
var a = [new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3];
return function(b) {
return a[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(b),
a[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(b),
a[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(b),
a[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(b),
a[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(b),
a[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(b),
a[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(b),
a[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(b),
this.makeEmpty(),
this.setFromPoints(a),
this
}
} (),
translate: function(a) {
return this.min.add(a),
this.max.add(a),
this
},
equals: function(a) {
return a.min.equals(this.min) && a.max.equals(this.max)
},
clone: function() {
return (new THREE.Box3).copy(this)
}
},
THREE.Matrix3 = function(a, b, c, d, e, f, g, h, i) {
this.elements = new Float32Array(9),
this.set(void 0 !== a ? a: 1, b || 0, c || 0, d || 0, void 0 !== e ? e: 1, f || 0, g || 0, h || 0, void 0 !== i ? i: 1)
},
THREE.Matrix3.prototype = {
constructor: THREE.Matrix3,
set: function(a, b, c, d, e, f, g, h, i) {
var j = this.elements;
return j[0] = a,
j[3] = b,
j[6] = c,
j[1] = d,
j[4] = e,
j[7] = f,
j[2] = g,
j[5] = h,
j[8] = i,
this
},
identity: function() {
return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1),
this
},
copy: function(a) {
return a = a.elements,
this.set(a[0], a[3], a[6], a[1], a[4], a[7], a[2], a[5], a[8]),
this
},
multiplyVector3: function(a) {
return console.warn("DEPRECATED: Matrix3's .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),
a.applyMatrix3(this)
},
multiplyVector3Array: function() {
var a = new THREE.Vector3;
return function(b) {
for (var c = 0, d = b.length; d > c; c += 3)
a.x = b[c],
a.y = b[c + 1],
a.z = b[c + 2],
a.applyMatrix3(this),
b[c] = a.x,
b[c + 1] = a.y,
b[c + 2] = a.z;
return b
}
} (),
multiplyScalar: function(a) {
var b = this.elements;
return b[0] *= a,
b[3] *= a,
b[6] *= a,
b[1] *= a,
b[4] *= a,
b[7] *= a,
b[2] *= a,
b[5] *= a,
b[8] *= a,
this
},
determinant: function() {
var a = this.elements,
b = a[0],
c = a[1],
d = a[2],
e = a[3],
f = a[4],
g = a[5],
h = a[6],
i = a[7],
a = a[8];
return b * f * a - b * g * i - c * e * a + c * g * h + d * e * i - d * f * h
},
getInverse: function(a, b) {
var c = a.elements,
d = this.elements;
if (d[0] = c[10] * c[5] - c[6] * c[9], d[1] = -c[10] * c[1] + c[2] * c[9], d[2] = c[6] * c[1] - c[2] * c[5], d[3] = -c[10] * c[4] + c[6] * c[8], d[4] = c[10] * c[0] - c[2] * c[8], d[5] = -c[6] * c[0] + c[2] * c[4], d[6] = c[9] * c[4] - c[5] * c[8], d[7] = -c[9] * c[0] + c[1] * c[8], d[8] = c[5] * c[0] - c[1] * c[4], c = c[0] * d[0] + c[1] * d[3] + c[2] * d[6], 0 === c) {
if (b)
throw Error("Matrix3.getInverse(): can't invert matrix, determinant is 0");
return console.warn("Matrix3.getInverse(): can't invert matrix, determinant is 0"),
this.identity(),
this
}
return this.multiplyScalar(1 / c),
this
},
transpose: function() {
var a,
b = this.elements;
return a = b[1],
b[1] = b[3],
b[3] = a,
a = b[2],
b[2] = b[6],
b[6] = a,
a = b[5],
b[5] = b[7],
b[7] = a,
this
},
getNormalMatrix: function(a) {
return this.getInverse(a).transpose(),
this
},
transposeIntoArray: function(a) {
var b = this.elements;
return a[0] = b[0],
a[1] = b[3],
a[2] = b[6],
a[3] = b[1],
a[4] = b[4],
a[5] = b[7],
a[6] = b[2],
a[7] = b[5],
a[8] = b[8],
this
},
clone: function() {
var a = this.elements;
return new THREE.Matrix3(a[0], a[3], a[6], a[1], a[4], a[7], a[2], a[5], a[8])
}
},
THREE.Matrix4 = function(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
var q = this.elements = new Float32Array(16);
q[0] = void 0 !== a ? a: 1,
q[4] = b || 0,
q[8] = c || 0,
q[12] = d || 0,
q[1] = e || 0,
q[5] = void 0 !== f ? f: 1,
q[9] = g || 0,
q[13] = h || 0,
q[2] = i || 0,
q[6] = j || 0,
q[10] = void 0 !== k ? k: 1,
q[14] = l || 0,
q[3] = m || 0,
q[7] = n || 0,
q[11] = o || 0,
q[15] = void 0 !== p ? p: 1
},
THREE.Matrix4.prototype = {
constructor: THREE.Matrix4,
set: function(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
var q = this.elements;
return q[0] = a,
q[4] = b,
q[8] = c,
q[12] = d,
q[1] = e,
q[5] = f,
q[9] = g,
q[13] = h,
q[2] = i,
q[6] = j,
q[10] = k,
q[14] = l,
q[3] = m,
q[7] = n,
q[11] = o,
q[15] = p,
this
},
identity: function() {
return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
this
},
copy: function(a) {
return a = a.elements,
this.set(a[0], a[4], a[8], a[12], a[1], a[5], a[9], a[13], a[2], a[6], a[10], a[14], a[3], a[7], a[11], a[15]),
this
},
extractPosition: function(a) {
return console.warn("DEPRECATED: Matrix4's .extractPosition() has been renamed to .copyPosition()."),
this.copyPosition(a)
},
copyPosition: function(a) {
var b = this.elements,
a = a.elements;
return b[12] = a[12],
b[13] = a[13],
b[14] = a[14],
this
},
extractRotation: function() {
var a = new THREE.Vector3;
return function(b) {
var c = this.elements,
b = b.elements,
d = 1 / a.set(b[0], b[1], b[2]).length(),
e = 1 / a.set(b[4], b[5], b[6]).length(),
f = 1 / a.set(b[8], b[9], b[10]).length();
return c[0] = b[0] * d,
c[1] = b[1] * d,
c[2] = b[2] * d,
c[4] = b[4] * e,
c[5] = b[5] * e,
c[6] = b[6] * e,
c[8] = b[8] * f,
c[9] = b[9] * f,
c[10] = b[10] * f,
this
}
} (),
setRotationFromEuler: function(a, b) {
return console.warn("DEPRECATED: Matrix4's .setRotationFromEuler() has been deprecated in favor of makeRotationFromEuler. Please update your code."),
this.makeRotationFromEuler(a, b)
},
makeRotationFromEuler: function(a, b) {
var c = this.elements,
d = a.x,
e = a.y,
f = a.z,
g = Math.cos(d),
d = Math.sin(d),
h = Math.cos(e),
e = Math.sin(e),
i = Math.cos(f),
f = Math.sin(f);
if (void 0 === b || "XYZ" === b) {
var j = g * i,
k = g * f,
l = d * i,
m = d * f;
c[0] = h * i,
c[4] = -h * f,
c[8] = e,
c[1] = k + l * e,
c[5] = j - m * e,
c[9] = -d * h,
c[2] = m - j * e,
c[6] = l + k * e,
c[10] = g * h
} else "YXZ" === b ? (j = h * i, k = h * f, l = e * i, m = e * f, c[0] = j + m * d, c[4] = l * d - k, c[8] = g * e, c[1] = g * f, c[5] = g * i, c[9] = -d, c[2] = k * d - l, c[6] = m + j * d, c[10] = g * h) : "ZXY" === b ? (j = h * i, k = h * f, l = e * i, m = e * f, c[0] = j - m * d, c[4] = -g * f, c[8] = l + k * d, c[1] = k + l * d, c[5] = g * i, c[9] = m - j * d, c[2] = -g * e, c[6] = d, c[10] = g * h) : "ZYX" === b ? (j = g * i, k = g * f, l = d * i, m = d * f, c[0] = h * i, c[4] = l * e - k, c[8] = j * e + m, c[1] = h * f, c[5] = m * e + j, c[9] = k * e - l, c[2] = -e, c[6] = d * h, c[10] = g * h) : "YZX" === b ? (j = g * h, k = g * e, l = d * h, m = d * e, c[0] = h * i, c[4] = m - j * f, c[8] = l * f + k, c[1] = f, c[5] = g * i, c[9] = -d * i, c[2] = -e * i, c[6] = k * f + l, c[10] = j - m * f) : "XZY" === b && (j = g * h, k = g * e, l = d * h, m = d * e, c[0] = h * i, c[4] = -f, c[8] = e * i, c[1] = j * f + m, c[5] = g * i, c[9] = k * f - l, c[2] = l * f - k, c[6] = d * i, c[10] = m * f + j);
return c[3] = 0,
c[7] = 0,
c[11] = 0,
c[12] = 0,
c[13] = 0,
c[14] = 0,
c[15] = 1,
this
},
setRotationFromQuaternion: function(a) {
return console.warn("DEPRECATED: Matrix4's .setRotationFromQuaternion() has been deprecated in favor of makeRotationFromQuaternion. Please update your code."),
this.makeRotationFromQuaternion(a)
},
makeRotationFromQuaternion: function(a) {
var b = this.elements,
c = a.x,
d = a.y,
e = a.z,
f = a.w,
g = c + c,
h = d + d,
i = e + e,
a = c * g,
j = c * h,
c = c * i,
k = d * h,
d = d * i,
e = e * i,
g = f * g,
h = f * h,
f = f * i;
return b[0] = 1 - (k + e),
b[4] = j - f,
b[8] = c + h,
b[1] = j + f,
b[5] = 1 - (a + e),
b[9] = d - g,
b[2] = c - h,
b[6] = d + g,
b[10] = 1 - (a + k),
b[3] = 0,
b[7] = 0,
b[11] = 0,
b[12] = 0,
b[13] = 0,
b[14] = 0,
b[15] = 1,
this
},
lookAt: function() {
var a = new THREE.Vector3,
b = new THREE.Vector3,
c = new THREE.Vector3;
return function(d, e, f) {
var g = this.elements;
return c.subVectors(d, e).normalize(),
0 === c.length() && (c.z = 1),
a.crossVectors(f, c).normalize(),
0 === a.length() && (c.x += 1e - 4, a.crossVectors(f, c).normalize()),
b.crossVectors(c, a),
g[0] = a.x,
g[4] = b.x,
g[8] = c.x,
g[1] = a.y,
g[5] = b.y,
g[9] = c.y,
g[2] = a.z,
g[6] = b.z,
g[10] = c.z,
this
}
} (),
multiply: function(a, b) {
return void 0 !== b ? (console.warn("DEPRECATED: Matrix4's .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(a, b)) : this.multiplyMatrices(this, a)
},
multiplyMatrices: function(a, b) {
var c = a.elements,
d = b.elements,
e = this.elements,
f = c[0],
g = c[4],
h = c[8],
i = c[12],
j = c[1],
k = c[5],
l = c[9],
m = c[13],
n = c[2],
o = c[6],
p = c[10],
q = c[14],
r = c[3],
s = c[7],
t = c[11],
c = c[15],
u = d[0],
v = d[4],
w = d[8],
x = d[12],
y = d[1],
z = d[5],
A = d[9],
B = d[13],
C = d[2],
D = d[6],
E = d[10],
F = d[14],
G = d[3],
H = d[7],
I = d[11],
d = d[15];
return e[0] = f * u + g * y + h * C + i * G,
e[4] = f * v + g * z + h * D + i * H,
e[8] = f * w + g * A + h * E + i * I,
e[12] = f * x + g * B + h * F + i * d,
e[1] = j * u + k * y + l * C + m * G,
e[5] = j * v + k * z + l * D + m * H,
e[9] = j * w + k * A + l * E + m * I,
e[13] = j * x + k * B + l * F + m * d,
e[2] = n * u + o * y + p * C + q * G,
e[6] = n * v + o * z + p * D + q * H,
e[10] = n * w + o * A + p * E + q * I,
e[14] = n * x + o * B + p * F + q * d,
e[3] = r * u + s * y + t * C + c * G,
e[7] = r * v + s * z + t * D + c * H,
e[11] = r * w + s * A + t * E + c * I,
e[15] = r * x + s * B + t * F + c * d,
this
},
multiplyToArray: function(a, b, c) {
var d = this.elements;
return this.multiplyMatrices(a, b),
c[0] = d[0],
c[1] = d[1],
c[2] = d[2],
c[3] = d[3],
c[4] = d[4],
c[5] = d[5],
c[6] = d[6],
c[7] = d[7],
c[8] = d[8],
c[9] = d[9],
c[10] = d[10],
c[11] = d[11],
c[12] = d[12],
c[13] = d[13],
c[14] = d[14],
c[15] = d[15],
this
},
multiplyScalar: function(a) {
var b = this.elements;
return b[0] *= a,
b[4] *= a,
b[8] *= a,
b[12] *= a,
b[1] *= a,
b[5] *= a,
b[9] *= a,
b[13] *= a,
b[2] *= a,
b[6] *= a,
b[10] *= a,
b[14] *= a,
b[3] *= a,
b[7] *= a,
b[11] *= a,
b[15] *= a,
this
},
multiplyVector3: function(a) {
return console.warn("DEPRECATED: Matrix4's .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead."),
a.applyProjection(this)
},
multiplyVector4: function(a) {
return console.warn("DEPRECATED: Matrix4's .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),
a.applyMatrix4(this)
},
multiplyVector3Array: function() {
var a = new THREE.Vector3;
return function(b) {
for (var c = 0, d = b.length; d > c; c += 3)
a.x = b[c],
a.y = b[c + 1],
a.z = b[c + 2],
a.applyProjection(this),
b[c] = a.x,
b[c + 1] = a.y,
b[c + 2] = a.z;
return b
}
} (),
rotateAxis: function(a) {
console.warn("DEPRECATED: Matrix4's .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),
a.transformDirection(this)
},
crossVector: function(a) {
return console.warn("DEPRECATED: Matrix4's .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),
a.applyMatrix4(this)
},
determinant: function() {
var a = this.elements,
b = a[0],
c = a[4],
d = a[8],
e = a[12],
f = a[1],
g = a[5],
h = a[9],
i = a[13],
j = a[2],
k = a[6],
l = a[10],
m = a[14];
return a[3] * ( + e * h * k - d * i * k - e * g * l + c * i * l + d * g * m - c * h * m) + a[7] * ( + b * h * m - b * i * l + e * f * l - d * f * m + d * i * j - e * h * j) + a[11] * ( + b * i * k - b * g * m - e * f * k + c * f * m + e * g * j - c * i * j) + a[15] * ( - d * g * j - b * h * k + b * g * l + d * f * k - c * f * l + c * h * j)
},
transpose: function() {
var a,
b = this.elements;
return a = b[1],
b[1] = b[4],
b[4] = a,
a = b[2],
b[2] = b[8],
b[8] = a,
a = b[6],
b[6] = b[9],
b[9] = a,
a = b[3],
b[3] = b[12],
b[12] = a,
a = b[7],
b[7] = b[13],
b[13] = a,
a = b[11],
b[11] = b[14],
b[14] = a,
this
},
flattenToArray: function(a) {
var b = this.elements;
return a[0] = b[0],
a[1] = b[1],
a[2] = b[2],
a[3] = b[3],
a[4] = b[4],
a[5] = b[5],
a[6] = b[6],
a[7] = b[7],
a[8] = b[8],
a[9] = b[9],
a[10] = b[10],
a[11] = b[11],
a[12] = b[12],
a[13] = b[13],
a[14] = b[14],
a[15] = b[15],
a
},
flattenToArrayOffset: function(a, b) {
var c = this.elements;
return a[b] = c[0],
a[b + 1] = c[1],
a[b + 2] = c[2],
a[b + 3] = c[3],
a[b + 4] = c[4],
a[b + 5] = c[5],
a[b + 6] = c[6],
a[b + 7] = c[7],
a[b + 8] = c[8],
a[b + 9] = c[9],
a[b + 10] = c[10],
a[b + 11] = c[11],
a[b + 12] = c[12],
a[b + 13] = c[13],
a[b + 14] = c[14],
a[b + 15] = c[15],
a
},
getPosition: function() {
var a = new THREE.Vector3;
return function() {
console.warn("DEPRECATED: Matrix4's .getPosition() has been removed. Use Vector3.getPositionFromMatrix( matrix ) instead.");
var b = this.elements;
return a.set(b[12], b[13], b[14])
}
} (),
setPosition: function(a) {
var b = this.elements;
return b[12] = a.x,
b[13] = a.y,
b[14] = a.z,
this
},
getInverse: function(a, b) {
var c = this.elements,
d = a.elements,
e = d[0],
f = d[4],
g = d[8],
h = d[12],
i = d[1],
j = d[5],
k = d[9],
l = d[13],
m = d[2],
n = d[6],
o = d[10],
p = d[14],
q = d[3],
r = d[7],
s = d[11],
t = d[15];
if (c[0] = k * p * r - l * o * r + l * n * s - j * p * s - k * n * t + j * o * t, c[4] = h * o * r - g * p * r - h * n * s + f * p * s + g * n * t - f * o * t, c[8] = g * l * r - h * k * r + h * j * s - f * l * s - g * j * t + f * k * t, c[12] = h * k * n - g * l * n - h * j * o + f * l * o + g * j * p - f * k * p, c[1] = l * o * q - k * p * q - l * m * s + i * p * s + k * m * t - i * o * t, c[5] = g * p * q - h * o * q + h * m * s - e * p * s - g * m * t + e * o * t, c[9] = h * k * q - g * l * q - h * i * s + e * l * s + g * i * t - e * k * t, c[13] = g * l * m - h * k * m + h * i * o - e * l * o - g * i * p + e * k * p, c[2] = j * p * q - l * n * q + l * m * r - i * p * r - j * m * t + i * n * t, c[6] = h * n * q - f * p * q - h * m * r + e * p * r + f * m * t - e * n * t, c[10] = f * l * q - h * j * q + h * i * r - e * l * r - f * i * t + e * j * t, c[14] = h * j * m - f * l * m - h * i * n + e * l * n + f * i * p - e * j * p, c[3] = k * n * q - j * o * q - k * m * r + i * o * r + j * m * s - i * n * s, c[7] = f * o * q - g * n * q + g * m * r - e * o * r - f * m * s + e * n * s, c[11] = g * j * q - f * k * q - g * i * r + e * k * r + f * i * s - e * j * s, c[15] = f * k * m - g * j * m + g * i * n - e * k * n - f * i * o + e * j * o, c = d[0] * c[0] + d[1] * c[4] + d[2] * c[8] + d[3] * c[12], 0 == c) {
if (b)
throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");
return console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0"),
this.identity(),
this
}
return this.multiplyScalar(1 / c),
this
},
translate: function() {
console.warn("DEPRECATED: Matrix4's .translate() has been removed.")
},
rotateX: function() {
console.warn("DEPRECATED: Matrix4's .rotateX() has been removed.")
},
rotateY: function() {
console.warn("DEPRECATED: Matrix4's .rotateY() has been removed.")
},
rotateZ: function() {
console.warn("DEPRECATED: Matrix4's .rotateZ() has been removed.")
},
rotateByAxis: function() {
console.warn("DEPRECATED: Matrix4's .rotateByAxis() has been removed.")
},
scale: function(a) {
var b = this.elements,
c = a.x,
d = a.y,
a = a.z;
return b[0] *= c,
b[4] *= d,
b[8] *= a,
b[1] *= c,
b[5] *= d,
b[9] *= a,
b[2] *= c,
b[6] *= d,
b[10] *= a,
b[3] *= c,
b[7] *= d,
b[11] *= a,
this
},
getMaxScaleOnAxis: function() {
var a = this.elements;
return Math.sqrt(Math.max(a[0] * a[0] + a[1] * a[1] + a[2] * a[2], Math.max(a[4] * a[4] + a[5] * a[5] + a[6] * a[6], a[8] * a[8] + a[9] * a[9] + a[10] * a[10])))
},
makeTranslation: function(a, b, c) {
return this.set(1, 0, 0, a, 0, 1, 0, b, 0, 0, 1, c, 0, 0, 0, 1),
this
},
makeRotationX: function(a) {
var b = Math.cos(a),
a = Math.sin(a);
return this.set(1, 0, 0, 0, 0, b, -a, 0, 0, a, b, 0, 0, 0, 0, 1),
this
},
makeRotationY: function(a) {
var b = Math.cos(a),
a = Math.sin(a);
return this.set(b, 0, a, 0, 0, 1, 0, 0, -a, 0, b, 0, 0, 0, 0, 1),
this
},
makeRotationZ: function(a) {
var b = Math.cos(a),
a = Math.sin(a);
return this.set(b, -a, 0, 0, a, b, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
this
},
makeRotationAxis: function(a, b) {
var c = Math.cos(b),
d = Math.sin(b),
e = 1 - c,
f = a.x,
g = a.y,
h = a.z,
i = e * f,
j = e * g;
return this.set(i * f + c, i * g - d * h, i * h + d * g, 0, i * g + d * h, j * g + c, j * h - d * f, 0, i * h - d * g, j * h + d * f, e * h * h + c, 0, 0, 0, 0, 1),
this
},
makeScale: function(a, b, c) {
return this.set(a, 0, 0, 0, 0, b, 0, 0, 0, 0, c, 0, 0, 0, 0, 1),
this
},
compose: function(a, b, c) {
return console.warn("DEPRECATED: Matrix4's .compose() has been deprecated in favor of makeFromPositionQuaternionScale. Please update your code."),
this.makeFromPositionQuaternionScale(a, b, c)
},
makeFromPositionQuaternionScale: function(a, b, c) {
return this.makeRotationFromQuaternion(b),
this.scale(c),
this.setPosition(a),
this
},
makeFromPositionEulerScale: function(a, b, c, d) {
return this.makeRotationFromEuler(b, c),
this.scale(d),
this.setPosition(a),
this
},
makeFrustum: function(a, b, c, d, e, f) {
var g = this.elements;
return g[0] = 2 * e / (b - a),
g[4] = 0,
g[8] = (b + a) / (b - a),
g[12] = 0,
g[1] = 0,
g[5] = 2 * e / (d - c),
g[9] = (d + c) / (d - c),
g[13] = 0,
g[2] = 0,
g[6] = 0,
g[10] = -(f + e) / (f - e),
g[14] = -2 * f * e / (f - e),
g[3] = 0,
g[7] = 0,
g[11] = -1,
g[15] = 0,
this
},
makePerspective: function(a, b, c, d) {
var a = c * Math.tan(THREE.Math.degToRad(.5 * a)),
e = -a;
return this.makeFrustum(e * b, a * b, e, a, c, d)
},
makeOrthographic: function(a, b, c, d, e, f) {
var g = this.elements,
h = b - a,
i = c - d,
j = f - e;
return g[0] = 2 / h,
g[4] = 0,
g[8] = 0,
g[12] = -((b + a) / h),
g[1] = 0,
g[5] = 2 / i,
g[9] = 0,
g[13] = -((c + d) / i),
g[2] = 0,
g[6] = 0,
g[10] = -2 / j,
g[14] = -((f + e) / j),
g[3] = 0,
g[7] = 0,
g[11] = 0,
g[15] = 1,
this
},
clone: function() {
var a = this.elements;
return new THREE.Matrix4(a[0], a[4], a[8], a[12], a[1], a[5], a[9], a[13], a[2], a[6], a[10], a[14], a[3], a[7], a[11], a[15])
}
},
THREE.extend(THREE.Matrix4.prototype, {
decompose: function() {
var a = new THREE.Vector3,
b = new THREE.Vector3,
c = new THREE.Vector3,
d = new THREE.Matrix4;
return function(e, f, g) {
var h = this.elements;
return a.set(h[0], h[1], h[2]),
b.set(h[4], h[5], h[6]),
c.set(h[8], h[9], h[10]),
e = e instanceof THREE.Vector3 ? e: new THREE.Vector3,
f = f instanceof THREE.Quaternion ? f: new THREE.Quaternion,
g = g instanceof THREE.Vector3 ? g: new THREE.Vector3,
g.x = a.length(),
g.y = b.length(),
g.z = c.length(),
e.x = h[12],
e.y = h[13],
e.z = h[14],
d.copy(this),
d.elements[0] /= g.x,
d.elements[1] /= g.x,
d.elements[2] /= g.x,
d.elements[4] /= g.y,
d.elements[5] /= g.y,
d.elements[6] /= g.y,
d.elements[8] /= g.z,
d.elements[9] /= g.z,
d.elements[10] /= g.z,
f.setFromRotationMatrix(d),
[e, f, g]
}
} ()
}),
THREE.Ray = function(a, b) {
this.origin = void 0 !== a ? a: new THREE.Vector3,
this.direction = void 0 !== b ? b: new THREE.Vector3
},
THREE.Ray.prototype = {
constructor: THREE.Ray,
set: function(a, b) {
return this.origin.copy(a),
this.direction.copy(b),
this
},
copy: function(a) {
return this.origin.copy(a.origin),
this.direction.copy(a.direction),
this
},
at: function(a, b) {
return (b || new THREE.Vector3).copy(this.direction).multiplyScalar(a).add(this.origin)
},
recast: function() {
var a = new THREE.Vector3;
return function(b) {
return this.origin.copy(this.at(b, a)),
this
}
} (),
closestPointToPoint: function(a, b) {
var c = b || new THREE.Vector3;
c.subVectors(a, this.origin);
var d = c.dot(this.direction);
return c.copy(this.direction).multiplyScalar(d).add(this.origin)
},
distanceToPoint: function() {
var a = new THREE.Vector3;
return function(b) {
var c = a.subVectors(b, this.origin).dot(this.direction);
return a.copy(this.direction).multiplyScalar(c).add(this.origin),
a.distanceTo(b)
}
} (),
isIntersectionSphere: function(a) {
return this.distanceToPoint(a.center) <= a.radius
},
isIntersectionPlane: function(a) {
return 0 != a.normal.dot(this.direction) || 0 == a.distanceToPoint(this.origin) ? !0: !1
},
distanceToPlane: function(a) {
var b = a.normal.dot(this.direction);
return 0 != b ? -(this.origin.dot(a.normal) + a.constant) / b: 0 == a.distanceToPoint(this.origin) ? 0: void 0
},
intersectPlane: function(a, b) {
var c = this.distanceToPlane(a);
return void 0 === c ? void 0: this.at(c, b)
},
applyMatrix4: function(a) {
return this.direction.add(this.origin).applyMatrix4(a),
this.origin.applyMatrix4(a),
this.direction.sub(this.origin),
this
},
equals: function(a) {
return a.origin.equals(this.origin) && a.direction.equals(this.direction)
},
clone: function() {
return (new THREE.Ray).copy(this)
}
},
THREE.Sphere = function(a, b) {
this.center = void 0 !== a ? a: new THREE.Vector3,
this.radius = void 0 !== b ? b: 0
},
THREE.Sphere.prototype = {
constructor: THREE.Sphere,
set: function(a, b) {
return this.center.copy(a),
this.radius = b,
this
},
setFromCenterAndPoints: function(a, b) {
for (var c = 0, d = 0, e = b.length; e > d; d++)
var f = a.distanceToSquared(b[d]),
c = Math.max(c, f);
return this.center = a,
this.radius = Math.sqrt(c),
this
},
copy: function(a) {
return this.center.copy(a.center),
this.radius = a.radius,
this
},
empty: function() {
return 0 >= this.radius
},
containsPoint: function(a) {
return a.distanceToSquared(this.center) <= this.radius * this.radius
},
distanceToPoint: function(a) {
return a.distanceTo(this.center) - this.radius
},
intersectsSphere: function(a) {
var b = this.radius + a.radius;
return a.center.distanceToSquared(this.center) <= b * b
},
clampPoint: function(a, b) {
var c = this.center.distanceToSquared(a),
d = b || new THREE.Vector3;
return d.copy(a),
c > this.radius * this.radius && (d.sub(this.center).normalize(), d.multiplyScalar(this.radius).add(this.center)),
d
},
getBoundingBox: function(a) {
return a = a || new THREE.Box3,
a.set(this.center, this.center),
a.expandByScalar(this.radius),
a
},
applyMatrix4: function(a) {
return this.center.applyMatrix4(a),
this.radius *= a.getMaxScaleOnAxis(),
this
},
translate: function(a) {
return this.center.add(a),
this
},
equals: function(a) {
return a.center.equals(this.center) && a.radius === this.radius
},
clone: function() {
return (new THREE.Sphere).copy(this)
}
},
THREE.Frustum = function(a, b, c, d, e, f) {
this.planes = [void 0 !== a ? a: new THREE.Plane, void 0 !== b ? b: new THREE.Plane, void 0 !== c ? c: new THREE.Plane, void 0 !== d ? d: new THREE.Plane, void 0 !== e ? e: new THREE.Plane, void 0 !== f ? f: new THREE.Plane]
},
THREE.Frustum.prototype = {
constructor: THREE.Frustum,
set: function(a, b, c, d, e, f) {
var g = this.planes;
return g[0].copy(a),
g[1].copy(b),
g[2].copy(c),
g[3].copy(d),
g[4].copy(e),
g[5].copy(f),
this
},
copy: function(a) {
for (var b = this.planes, c = 0; 6 > c; c++)
b[c].copy(a.planes[c]);
return this
},
setFromMatrix: function(a) {
var b = this.planes,
c = a.elements,
a = c[0],
d = c[1],
e = c[2],
f = c[3],
g = c[4],
h = c[5],
i = c[6],
j = c[7],
k = c[8],
l = c[9],
m = c[10],
n = c[11],
o = c[12],
p = c[13],
q = c[14],
c = c[15];
return b[0].setComponents(f - a, j - g, n - k, c - o).normalize(),
b[1].setComponents(f + a, j + g, n + k, c + o).normalize(),
b[2].setComponents(f + d, j + h, n + l, c + p).normalize(),
b[3].setComponents(f - d, j - h, n - l, c - p).normalize(),
b[4].setComponents(f - e, j - i, n - m, c - q).normalize(),
b[5].setComponents(f + e, j + i, n + m, c + q).normalize(),
this
},
intersectsObject: function() {
var a = new THREE.Vector3;
return function(b) {
var c = b.matrixWorld,
d = this.planes,
b = -b.geometry.boundingSphere.radius * c.getMaxScaleOnAxis();
for (a.getPositionFromMatrix(c), c = 0; 6 > c; c++)
if (d[c].distanceToPoint(a) < b)
return ! 1;
return ! 0
}
} (),
intersectsSphere: function(a) {
for (var b = this.planes, c = a.center, a = -a.radius, d = 0; 6 > d; d++)
if (b[d].distanceToPoint(c) < a)
return ! 1;
return ! 0
},
containsPoint: function(a) {
for (var b = this.planes, c = 0; 6 > c; c++)
if (0 > b[c].distanceToPoint(a))
return ! 1;
return ! 0
},
clone: function() {
return (new THREE.Frustum).copy(this)
}
},
THREE.Plane = function(a, b) {
this.normal = void 0 !== a ? a: new THREE.Vector3(1, 0, 0),
this.constant = void 0 !== b ? b: 0
},
THREE.Plane.prototype = {
constructor: THREE.Plane,
set: function(a, b) {
return this.normal.copy(a),
this.constant = b,
this
},
setComponents: function(a, b, c, d) {
return this.normal.set(a, b, c),
this.constant = d,
this
},
setFromNormalAndCoplanarPoint: function(a, b) {
return this.normal.copy(a),
this.constant = -b.dot(this.normal),
this
},
setFromCoplanarPoints: function() {
var a = new THREE.Vector3,
b = new THREE.Vector3;
return function(c, d, e) {
return d = a.subVectors(e, d).cross(b.subVectors(c, d)).normalize(),
this.setFromNormalAndCoplanarPoint(d, c),
this
}
} (),
copy: function(a) {
return this.normal.copy(a.normal),
this.constant = a.constant,
this
},
normalize: function() {
var a = 1 / this.normal.length();
return this.normal.multiplyScalar(a),
this.constant *= a,
this
},
negate: function() {
return this.constant *= -1,
this.normal.negate(),
this
},
distanceToPoint: function(a) {
return this.normal.dot(a) + this.constant
},
distanceToSphere: function(a) {
return this.distanceToPoint(a.center) - a.radius
},
projectPoint: function(a, b) {
return this.orthoPoint(a, b).sub(a).negate()
},
orthoPoint: function(a, b) {
var c = this.distanceToPoint(a);
return (b || new THREE.Vector3).copy(this.normal).multiplyScalar(c)
},
isIntersectionLine: function(a) {
var b = this.distanceToPoint(a.start),
a = this.distanceToPoint(a.end);
return 0 > b && a > 0 || 0 > a && b > 0
},
intersectLine: function() {
var a = new THREE.Vector3;
return function(b, c) {
var d = c || new THREE.Vector3,
e = b.delta(a),
f = this.normal.dot(e);
return 0 != f ? (f = -(b.start.dot(this.normal) + this.constant) / f, 0 > f || f > 1 ? void 0: d.copy(e).multiplyScalar(f).add(b.start)) : 0 == this.distanceToPoint(b.start) ? d.copy(b.start) : void 0
}
} (),
coplanarPoint: function(a) {
return (a || new THREE.Vector3).copy(this.normal).multiplyScalar( - this.constant)
},
applyMatrix4: function() {
var a = new THREE.Vector3,
b = new THREE.Vector3;
return function(c, d) {
var d = d || (new THREE.Matrix3).getNormalMatrix(c),
e = a.copy(this.normal).applyMatrix3(d),
f = this.coplanarPoint(b);
return f.applyMatrix4(c),
this.setFromNormalAndCoplanarPoint(e, f),
this
}
} (),
translate: function(a) {
return this.constant -= a.dot(this.normal),
this
},
equals: function(a) {
return a.normal.equals(this.normal) && a.constant == this.constant
},
clone: function() {
return (new THREE.Plane).copy(this)
}
},
THREE.Math = {
clamp: function(a, b, c) {
return b > a ? b: a > c ? c: a
},
clampBottom: function(a, b) {
return b > a ? b: a
},
mapLinear: function(a, b, c, d, e) {
return d + (a - b) * (e - d) / (c - b)
},
smoothstep: function(a, b, c) {
return b >= a ? 0: a >= c ? 1: (a = (a - b) / (c - b), a * a * (3 - 2 * a))
},
smootherstep: function(a, b, c) {
return b >= a ? 0: a >= c ? 1: (a = (a - b) / (c - b), a * a * a * (a * (6 * a - 15) + 10))
},
random16: function() {
return (65280 * Math.random() + 255 * Math.random()) / 65535
},
randInt: function(a, b) {
return a + Math.floor(Math.random() * (b - a + 1))
},
randFloat: function(a, b) {
return a + Math.random() * (b - a)
},
randFloatSpread: function(a) {
return a * (.5 - Math.random())
},
sign: function(a) {
return 0 > a ? -1: a > 0 ? 1: 0
},
degToRad: function() {
var a = Math.PI / 180;
return function(b) {
return b * a
}
} (),
radToDeg: function() {
var a = 180 / Math.PI;
return function(b) {
return b * a
}
} ()
},
THREE.Spline = function(a) {
function b(a, b, c, d, e, f, g) {
return a = .5 * (c - a),
d = .5 * (d - b),
(2 * (b - c) + a + d) * g + ( - 3 * (b - c) - 2 * a - d) * f + a * e + b
}
this.points = a;
var c,
d,
e,
f,
g,
h,
i,
j,
k,
l = [],
m = {
x: 0,
y: 0,
z: 0
};
this.initFromArray = function(a) {
this.points = [];
for (var b = 0; b < a.length; b++)
this.points[b] = {
x: a[b][0],
y: a[b][1],
z: a[b][2]
}
},
this.getPoint = function(a) {
return c = (this.points.length - 1) * a,
d = Math.floor(c),
e = c - d,
l[0] = 0 === d ? d: d - 1,
l[1] = d,
l[2] = d > this.points.length - 2 ? this.points.length - 1: d + 1,
l[3] = d > this.points.length - 3 ? this.points.length - 1: d + 2,
h = this.points[l[0]],
i = this.points[l[1]],
j = this.points[l[2]],
k = this.points[l[3]],
f = e * e,
g = e * f,
m.x = b(h.x, i.x, j.x, k.x, e, f, g),
m.y = b(h.y, i.y, j.y, k.y, e, f, g),
m.z = b(h.z, i.z, j.z, k.z, e, f, g),
m
},
this.getControlPointsArray = function() {
var a,
b,
c = this.points.length,
d = [];
for (a = 0; c > a; a++)
b = this.points[a],
d[a] = [b.x, b.y, b.z];
return d
},
this.getLength = function(a) {
var b,
c,
d,
e = b = b = 0,
f = new THREE.Vector3,
g = new THREE.Vector3,
h = [],
i = 0;
for (h[0] = 0, a || (a = 100), c = this.points.length * a, f.copy(this.points[0]), a = 1; c > a; a++)
b = a / c,
d = this.getPoint(b),
g.copy(d),
i += g.distanceTo(f),
f.copy(d),
b *= this.points.length - 1,
b = Math.floor(b),
b != e && (h[b] = i, e = b);
return h[h.length] = i,
{
chunks: h,
total: i
}
},
this.reparametrizeByArcLength = function(a) {
var b,
c,
d,
e,
f,
g,
h = [],
i = new THREE.Vector3,
j = this.getLength();
for (h.push(i.copy(this.points[0]).clone()), b = 1; b < this.points.length; b++) {
for (c = j.chunks[b] - j.chunks[b - 1], g = Math.ceil(a * c / j.total), e = (b - 1) / (this.points.length - 1), f = b / (this.points.length - 1), c = 1; g - 1 > c; c++)
d = e + c * (1 / g) * (f - e),
d = this.getPoint(d),
h.push(i.copy(d).clone());
h.push(i.copy(this.points[b]).clone())
}
this.points = h
}
},
THREE.Triangle = function(a, b, c) {
this.a = void 0 !== a ? a: new THREE.Vector3,
this.b = void 0 !== b ? b: new THREE.Vector3,
this.c = void 0 !== c ? c: new THREE.Vector3
},
THREE.Triangle.normal = function() {
var a = new THREE.Vector3;
return function(b, c, d, e) {
return e = e || new THREE.Vector3,
e.subVectors(d, c),
a.subVectors(b, c),
e.cross(a),
b = e.lengthSq(),
b > 0 ? e.multiplyScalar(1 / Math.sqrt(b)) : e.set(0, 0, 0)
}
} (),
THREE.Triangle.barycoordFromPoint = function() {
var a = new THREE.Vector3,
b = new THREE.Vector3,
c = new THREE.Vector3;
return function(d, e, f, g, h) {
a.subVectors(g, e),
b.subVectors(f, e),
c.subVectors(d, e);
var d = a.dot(a),
e = a.dot(b),
f = a.dot(c),
i = b.dot(b),
g = b.dot(c),
j = d * i - e * e,
h = h || new THREE.Vector3;
return 0 == j ? h.set( - 2, -1, -1) : (j = 1 / j, i = (i * f - e * g) * j, d = (d * g - e * f) * j, h.set(1 - i - d, d, i))
}
} (),
THREE.Triangle.containsPoint = function() {
var a = new THREE.Vector3;
return function(b, c, d, e) {
return b = THREE.Triangle.barycoordFromPoint(b, c, d, e, a),
0 <= b.x && 0 <= b.y && 1 >= b.x + b.y
}
} (),
THREE.Triangle.prototype = {
constructor: THREE.Triangle,
set: function(a, b, c) {
return this.a.copy(a),
this.b.copy(b),
this.c.copy(c),
this
},
setFromPointsAndIndices: function(a, b, c, d) {
return this.a.copy(a[b]),
this.b.copy(a[c]),
this.c.copy(a[d]),
this
},
copy: function(a) {
return this.a.copy(a.a),
this.b.copy(a.b),
this.c.copy(a.c),
this
},
area: function() {
var a = new THREE.Vector3,
b = new THREE.Vector3;
return function() {
return a.subVectors(this.c, this.b),
b.subVectors(this.a, this.b),
.5 * a.cross(b).length()
}
} (),
midpoint: function(a) {
return (a || new THREE.Vector3).addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3)
},
normal: function(a) {
return THREE.Triangle.normal(this.a, this.b, this.c, a)
},
plane: function(a) {
return (a || new THREE.Plane).setFromCoplanarPoints(this.a, this.b, this.c)
},
barycoordFromPoint: function(a, b) {
return THREE.Triangle.barycoordFromPoint(a, this.a, this.b, this.c, b)
},
containsPoint: function(a) {
return THREE.Triangle.containsPoint(a, this.a, this.b, this.c)
},
equals: function(a) {
return a.a.equals(this.a) && a.b.equals(this.b) && a.c.equals(this.c)
},
clone: function() {
return (new THREE.Triangle).copy(this)
}
},
THREE.Vertex = function(a) {
return console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead."),
a
},
THREE.UV = function(a, b) {
return console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead."),
new THREE.Vector2(a, b)
},
THREE.Clock = function(a) {
this.autoStart = void 0 !== a ? a: !0,
this.elapsedTime = this.oldTime = this.startTime = 0,
this.running = !1
},
THREE.Clock.prototype = {
constructor: THREE.Clock,
start: function() {
this.oldTime = this.startTime = void 0 !== window.performance && void 0 !== window.performance.now ? window.performance.now() : Date.now(),
this.running = !0
},
stop: function() {
this.getElapsedTime(),
this.running = !1
},
getElapsedTime: function() {
return this.getDelta(),
this.elapsedTime
},
getDelta: function() {
var a = 0;
if (this.autoStart && !this.running && this.start(), this.running) {
var b = void 0 !== window.performance && void 0 !== window.performance.now ? window.performance.now() : Date.now(),
a = .001 * (b - this.oldTime);
this.oldTime = b,
this.elapsedTime += a
}
return a
}
},
THREE.EventDispatcher = function() {},
THREE.EventDispatcher.prototype = {
constructor: THREE.EventDispatcher,
addEventListener: function(a, b) {
void 0 === this._listeners && (this._listeners = {});
var c = this._listeners;
void 0 === c[a] && (c[a] = []),
-1 === c[a].indexOf(b) && c[a].push(b)
},
hasEventListener: function(a, b) {
if (void 0 === this._listeners)
return ! 1;
var c = this._listeners;
return void 0 !== c[a] && -1 !== c[a].indexOf(b) ? !0: !1
},
removeEventListener: function(a, b) {
if (void 0 !== this._listeners) {
var c = this._listeners,
d = c[a].indexOf(b); - 1 !== d && c[a].splice(d, 1)
}
},
dispatchEvent: function(a) {
if (void 0 !== this._listeners) {
var b = this._listeners[a.type];
if (void 0 !== b) {
a.target = this;
for (var c = 0, d = b.length; d > c; c++)
b[c].call(this, a)
}
}
}
},
function(a) {
a.Raycaster = function(b, c, d, e) {
this.ray = new a.Ray(b, c),
0 < this.ray.direction.lengthSq() && this.ray.direction.normalize(),
this.near = d || 0,
this.far = e || 1 / 0
};
var b = new a.Sphere,
c = new a.Ray,
d = new a.Plane,
e = new a.Vector3,
f = new a.Vector3,
g = new a.Matrix4,
h = function(a, b) {
return a.distance - b.distance
},
i = function(h, j, k) {
if (h instanceof a.Particle) {
f.getPositionFromMatrix(h.matrixWorld);
var l = j.ray.distanceToPoint(f);
if (l > h.scale.x)
return k;
k.push({
distance: l,
point: h.position,
face: null,
object: h
})
} else if (h instanceof a.LOD)
f.getPositionFromMatrix(h.matrixWorld),
l = j.ray.origin.distanceTo(f),
i(h.getObjectForDistance(l), j, k);
else if (h instanceof a.Mesh) {
if (f.getPositionFromMatrix(h.matrixWorld), b.set(f, h.geometry.boundingSphere.radius * h.matrixWorld.getMaxScaleOnAxis()), !j.ray.isIntersectionSphere(b))
return k;
var m,
n,
o,
l = h.geometry,
p = l.vertices,
q = h.material instanceof a.MeshFaceMaterial,
r = !0 === q ? h.material.materials: null,
s = h.material.side,
t = j.precision;
g.getInverse(h.matrixWorld),
c.copy(j.ray).applyMatrix4(g);
for (var u = 0, v = l.faces.length; v > u; u++) {
var w = l.faces[u],
s = !0 === q ? r[w.materialIndex] : h.material;
if (void 0 !== s) {
d.setFromNormalAndCoplanarPoint(w.normal, p[w.a]);
var x = c.distanceToPlane(d);
if (! (Math.abs(x) < t || 0 > x)) {
if (s = s.side, s !== a.DoubleSide && (m = c.direction.dot(d.normal), !(s === a.FrontSide ? 0 > m: m > 0)))
continue;
if (! (x < j.near || x > j.far)) {
if (e = c.at(x, e), w instanceof a.Face3) {
if (s = p[w.a], m = p[w.b], n = p[w.c], !a.Triangle.containsPoint(e, s, m, n))
continue
} else {
if (! (w instanceof a.Face4))
throw Error("face type not supported");
if (s = p[w.a], m = p[w.b], n = p[w.c], o = p[w.d], !a.Triangle.containsPoint(e, s, m, o) && !a.Triangle.containsPoint(e, m, n, o))
continue
}
k.push({
distance: x,
point: j.ray.at(x),
face: w,
faceIndex: u,
object: h
})
}
}
}
}
}
},
j = function(a, b, c) {
for (var a = a.getDescendants(), d = 0, e = a.length; e > d; d++)
i(a[d], b, c)
};
a.Raycaster.prototype.precision = 1e - 4,
a.Raycaster.prototype.set = function(a, b) {
this.ray.set(a, b),
0 < this.ray.direction.length() && this.ray.direction.normalize()
},
a.Raycaster.prototype.intersectObject = function(a, b) {
var c = [];
return ! 0 === b && j(a, this, c),
i(a, this, c),
c.sort(h),
c
},
a.Raycaster.prototype.intersectObjects = function(a, b) {
for (var c = [], d = 0, e = a.length; e > d; d++)
i(a[d], this, c),
!0 === b && j(a[d], this, c);
return c.sort(h),
c
}
} (THREE),
THREE.Object3D = function() {
this.id = THREE.Object3DIdCount++,
this.name = "",
this.parent = void 0,
this.children = [],
this.up = new THREE.Vector3(0, 1, 0),
this.position = new THREE.Vector3,
this.rotation = new THREE.Vector3,
this.eulerOrder = THREE.Object3D.defaultEulerOrder,
this.scale = new THREE.Vector3(1, 1, 1),
this.renderDepth = null,
this.rotationAutoUpdate = !0,
this.matrix = new THREE.Matrix4,
this.matrixWorld = new THREE.Matrix4,
this.matrixWorldNeedsUpdate = this.matrixAutoUpdate = !0,
this.quaternion = new THREE.Quaternion,
this.useQuaternion = !1,
this.visible = !0,
this.receiveShadow = this.castShadow = !1,
this.frustumCulled = !0,
this.userData = {}
},
THREE.Object3D.prototype = {
constructor: THREE.Object3D,
applyMatrix: function() {
var a = new THREE.Matrix4;
return function(b) {
this.matrix.multiplyMatrices(b, this.matrix),
this.position.getPositionFromMatrix(this.matrix),
this.scale.getScaleFromMatrix(this.matrix),
a.extractRotation(this.matrix),
!0 === this.useQuaternion ? this.quaternion.setFromRotationMatrix(a) : this.rotation.setEulerFromRotationMatrix(a, this.eulerOrder)
}
} (),
rotateOnAxis: function() {
var a = new THREE.Quaternion,
b = new THREE.Quaternion;
return function(c, d) {
return a.setFromAxisAngle(c, d),
!0 === this.useQuaternion ? this.quaternion.multiply(a) : (b.setFromEuler(this.rotation, this.eulerOrder), b.multiply(a), this.rotation.setEulerFromQuaternion(b, this.eulerOrder)),
this
}
} (),
translateOnAxis: function() {
var a = new THREE.Vector3;
return function(b, c) {
return a.copy(b),
!0 === this.useQuaternion ? a.applyQuaternion(this.quaternion) : a.applyEuler(this.rotation, this.eulerOrder),
this.position.add(a.multiplyScalar(c)),
this
}
} (),
translate: function(a, b) {
return console.warn("DEPRECATED: Object3D's .translate() has been removed. Use .translateOnAxis( axis, distance ) instead. Note args have been changed."),
this.translateOnAxis(b, a)
},
translateX: function() {
var a = new THREE.Vector3(1, 0, 0);
return function(b) {
return this.translateOnAxis(a, b)
}
} (),
translateY: function() {
var a = new THREE.Vector3(0, 1, 0);
return function(b) {
return this.translateOnAxis(a, b)
}
} (),
translateZ: function() {
var a = new THREE.Vector3(0, 0, 1);
return function(b) {
return this.translateOnAxis(a, b)
}
} (),
localToWorld: function(a) {
return a.applyMatrix4(this.matrixWorld)
},
worldToLocal: function() {
var a = new THREE.Matrix4;
return function(b) {
return b.applyMatrix4(a.getInverse(this.matrixWorld))
}
} (),
lookAt: function() {
var a = new THREE.Matrix4;
return function(b) {
a.lookAt(b, this.position, this.up),
!0 === this.useQuaternion ? this.quaternion.setFromRotationMatrix(a) : this.rotation.setEulerFromRotationMatrix(a, this.eulerOrder)
}
} (),
add: function(a) {
if (a === this)
console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");
else if (a instanceof THREE.Object3D) {
void 0 !== a.parent && a.parent.remove(a),
a.parent = this,
this.children.push(a);
for (var b = this; void 0 !== b.parent;)
b = b.parent;
void 0 !== b && b instanceof THREE.Scene && b.__addObject(a)
}
},
remove: function(a) {
var b = this.children.indexOf(a);
if ( - 1 !== b) {
for (a.parent = void 0, this.children.splice(b, 1), b = this; void 0 !== b.parent;)
b = b.parent;
void 0 !== b && b instanceof THREE.Scene && b.__removeObject(a)
}
},
traverse: function(a) {
a(this);
for (var b = 0, c = this.children.length; c > b; b++)
this.children[b].traverse(a)
},
getObjectById: function(a, b) {
for (var c = 0, d = this.children.length; d > c; c++) {
var e = this.children[c];
if (e.id === a || !0 === b && (e = e.getObjectById(a, b), void 0 !== e))
return e
}
},
getObjectByName: function(a, b) {
for (var c = 0, d = this.children.length; d > c; c++) {
var e = this.children[c];
if (e.name === a || !0 === b && (e = e.getObjectByName(a, b), void 0 !== e))
return e
}
},
getChildByName: function(a, b) {
return console.warn("DEPRECATED: Object3D's .getChildByName() has been renamed to .getObjectByName()."),
this.getObjectByName(a, b)
},
getDescendants: function(a) {
void 0 === a && (a = []),
Array.prototype.push.apply(a, this.children);
for (var b = 0, c = this.children.length; c > b; b++)
this.children[b].getDescendants(a);
return a
},
updateMatrix: function() { ! 1 === this.useQuaternion ? this.matrix.makeFromPositionEulerScale(this.position, this.rotation, this.eulerOrder, this.scale) : this.matrix.makeFromPositionQuaternionScale(this.position, this.quaternion, this.scale),
this.matrixWorldNeedsUpdate = !0
},
updateMatrixWorld: function(a) { ! 0 === this.matrixAutoUpdate && this.updateMatrix(),
(!0 === this.matrixWorldNeedsUpdate || !0 === a) && (void 0 === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate = !1, a = !0);
for (var b = 0, c = this.children.length; c > b; b++)
this.children[b].updateMatrixWorld(a)
},
clone: function(a) {
void 0 === a && (a = new THREE.Object3D),
a.name = this.name,
a.up.copy(this.up),
a.position.copy(this.position),
a.rotation instanceof THREE.Vector3 && a.rotation.copy(this.rotation),
a.eulerOrder = this.eulerOrder,
a.scale.copy(this.scale),
a.renderDepth = this.renderDepth,
a.rotationAutoUpdate = this.rotationAutoUpdate,
a.matrix.copy(this.matrix),
a.matrixWorld.copy(this.matrixWorld),
a.matrixAutoUpdate = this.matrixAutoUpdate,
a.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate,
a.quaternion.copy(this.quaternion),
a.useQuaternion = this.useQuaternion,
a.visible = this.visible,
a.castShadow = this.castShadow,
a.receiveShadow = this.receiveShadow,
a.frustumCulled = this.frustumCulled,
a.userData = JSON.parse(JSON.stringify(this.userData));
for (var b = 0; b < this.children.length; b++)
a.add(this.children[b].clone());
return a
}
},
THREE.Object3D.defaultEulerOrder = "XYZ",
THREE.Object3DIdCount = 0,
THREE.Projector = function() {
function a() {
if (f === r) {
var a = new THREE.RenderableObject;
return q.push(a),
r++,
f++,
a
}
return q[f++]
}
function b() {
if (h === t) {
var a = new THREE.RenderableVertex;
return s.push(a),
t++,
h++,
a
}
return s[h++]
}
function c(a, b) {
return b.z - a.z
}
function d(a, b) {
var c = 0,
d = 1,
e = a.z + a.w,
f = b.z + b.w,
g = -a.z + a.w,
h = -b.z + b.w;
return e >= 0 && f >= 0 && g >= 0 && h >= 0 ? !0: 0 > e && 0 > f || 0 > g && 0 > h ? !1: (0 > e ? c = Math.max(c, e / (e - f)) : 0 > f && (d = Math.min(d, e / (e - f))), 0 > g ? c = Math.max(c, g / (g - h)) : 0 > h && (d = Math.min(d, g / (g - h))), c > d ? !1: (a.lerp(b, c), b.lerp(a, 1 - d), !0))
}
var e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q = [],
r = 0,
s = [],
t = 0,
u = [],
v = 0,
w = [],
x = 0,
y = [],
z = 0,
A = [],
B = 0,
C = {
objects: [],
sprites: [],
lights: [],
elements: []
},
D = new THREE.Vector3,
E = new THREE.Vector4,
F = new THREE.Box3(new THREE.Vector3( - 1, -1, -1), new THREE.Vector3(1, 1, 1)),
G = new THREE.Box3,
H = Array(3),
I = Array(4),
J = new THREE.Matrix4,
K = new THREE.Matrix4,
L = new THREE.Matrix4,
M = new THREE.Matrix3,
N = new THREE.Matrix3,
O = new THREE.Vector3,
P = new THREE.Frustum,
Q = new THREE.Vector4,
R = new THREE.Vector4;
this.projectVector = function(a, b) {
return b.matrixWorldInverse.getInverse(b.matrixWorld),
K.multiplyMatrices(b.projectionMatrix, b.matrixWorldInverse),
a.applyProjection(K)
},
this.unprojectVector = function(a, b) {
return b.projectionMatrixInverse.getInverse(b.projectionMatrix),
K.multiplyMatrices(b.matrixWorld, b.projectionMatrixInverse),
a.applyProjection(K)
},
this.pickingRay = function(a, b) {
a.z = -1;
var c = new THREE.Vector3(a.x, a.y, 1);
return this.unprojectVector(a, b),
this.unprojectVector(c, b),
c.sub(a).normalize(),
new THREE.Raycaster(a, c)
},
this.projectScene = function(q, r, t, S) {
var T,
U,
V,
W,
X,
Y,
Z,
$,
_,
ab,
bb,
cb,
db,
eb = !1;
o = m = k = j = 0,
C.elements.length = 0,
!0 === q.autoUpdate && q.updateMatrixWorld(),
void 0 === r.parent && r.updateMatrixWorld(),
J.copy(r.matrixWorldInverse.getInverse(r.matrixWorld)),
K.multiplyMatrices(r.projectionMatrix, J),
N.getNormalMatrix(J),
P.setFromMatrix(K),
f = 0,
C.objects.length = 0,
C.sprites.length = 0,
C.lights.length = 0;
var fb = function(b) {
for (var c = 0, d = b.children.length; d > c; c++) {
var f = b.children[c]; ! 1 !== f.visible && (f instanceof THREE.Light ? C.lights.push(f) : f instanceof THREE.Mesh || f instanceof THREE.Line ? (!1 === f.frustumCulled || !0 === P.intersectsObject(f)) && (e = a(), e.object = f, null !== f.renderDepth ? e.z = f.renderDepth: (D.getPositionFromMatrix(f.matrixWorld), D.applyProjection(K), e.z = D.z), C.objects.push(e)) : f instanceof THREE.Sprite || f instanceof THREE.Particle ? (e = a(), e.object = f, null !== f.renderDepth ? e.z = f.renderDepth: (D.getPositionFromMatrix(f.matrixWorld), D.applyProjection(K), e.z = D.z), C.sprites.push(e)) : (e = a(), e.object = f, null !== f.renderDepth ? e.z = f.renderDepth: (D.getPositionFromMatrix(f.matrixWorld), D.applyProjection(K), e.z = D.z), C.objects.push(e)), fb(f))
}
};
for (fb(q), !0 === t && C.objects.sort(c), q = 0, t = C.objects.length; t > q; q++)
if ($ = C.objects[q].object, p = $.matrixWorld, h = 0, $ instanceof THREE.Mesh) {
for (_ = $.geometry, V = _.vertices, ab = _.faces, _ = _.faceVertexUvs, M.getNormalMatrix(p), cb = $.material instanceof THREE.MeshFaceMaterial, db = !0 === cb ? $.material: null, T = 0, U = V.length; U > T; T++)
g = b(),
g.positionWorld.copy(V[T]).applyMatrix4(p),
g.positionScreen.copy(g.positionWorld).applyMatrix4(K),
g.positionScreen.x /= g.positionScreen.w,
g.positionScreen.y /= g.positionScreen.w,
g.positionScreen.z /= g.positionScreen.w,
g.visible = !( - 1 > g.positionScreen.x || 1 < g.positionScreen.x || -1 > g.positionScreen.y || 1 < g.positionScreen.y || -1 > g.positionScreen.z || 1 < g.positionScreen.z);
for (V = 0, T = ab.length; T > V; V++) {
U = ab[V];
var gb = !0 === cb ? db.materials[U.materialIndex] : $.material;
if (void 0 !== gb) {
if (Y = gb.side, U instanceof THREE.Face3) {
if (W = s[U.a], X = s[U.b], Z = s[U.c], H[0] = W.positionScreen, H[1] = X.positionScreen, H[2] = Z.positionScreen, !0 !== W.visible && !0 !== X.visible && !0 !== Z.visible && !F.isIntersectionBox(G.setFromPoints(H)))
continue;
if (eb = 0 > (Z.positionScreen.x - W.positionScreen.x) * (X.positionScreen.y - W.positionScreen.y) - (Z.positionScreen.y - W.positionScreen.y) * (X.positionScreen.x - W.positionScreen.x), Y !== THREE.DoubleSide && eb !== (Y === THREE.FrontSide))
continue;
j === v ? (bb = new THREE.RenderableFace3, u.push(bb), v++, j++, i = bb) : i = u[j++],
i.v1.copy(W),
i.v2.copy(X),
i.v3.copy(Z)
} else if (U instanceof THREE.Face4) {
if (W = s[U.a], X = s[U.b], Z = s[U.c], bb = s[U.d], I[0] = W.positionScreen, I[1] = X.positionScreen, I[2] = Z.positionScreen, I[3] = bb.positionScreen, !0 !== W.visible && !0 !== X.visible && !0 !== Z.visible && !0 !== bb.visible && !F.isIntersectionBox(G.setFromPoints(I)))
continue;
if (eb = 0 > (bb.positionScreen.x - W.positionScreen.x) * (X.positionScreen.y - W.positionScreen.y) - (bb.positionScreen.y - W.positionScreen.y) * (X.positionScreen.x - W.positionScreen.x) || 0 > (X.positionScreen.x - Z.positionScreen.x) * (bb.positionScreen.y - Z.positionScreen.y) - (X.positionScreen.y - Z.positionScreen.y) * (bb.positionScreen.x - Z.positionScreen.x), Y !== THREE.DoubleSide && eb !== (Y === THREE.FrontSide))
continue;
if (k === x) {
var hb = new THREE.RenderableFace4;
w.push(hb),
x++,
k++,
i = hb
} else
i = w[k++];
i.v1.copy(W),
i.v2.copy(X),
i.v3.copy(Z),
i.v4.copy(bb)
}
for (i.normalModel.copy(U.normal), !1 === eb && (Y === THREE.BackSide || Y === THREE.DoubleSide) && i.normalModel.negate(), i.normalModel.applyMatrix3(M).normalize(), i.normalModelView.copy(i.normalModel).applyMatrix3(N), i.centroidModel.copy(U.centroid).applyMatrix4(p), Z = U.vertexNormals, W = 0, X = Z.length; X > W; W++)
bb = i.vertexNormalsModel[W],
bb.copy(Z[W]),
!1 === eb && (Y === THREE.BackSide || Y === THREE.DoubleSide) && bb.negate(),
bb.applyMatrix3(M).normalize(),
i.vertexNormalsModelView[W].copy(bb).applyMatrix3(N);
for (i.vertexNormalsLength = Z.length, W = 0, X = _.length; X > W; W++)
if (bb = _[W][V], void 0 !== bb)
for (Y = 0, Z = bb.length; Z > Y; Y++)
i.uvs[W][Y] = bb[Y];
i.color = U.color,
i.material = gb,
O.copy(i.centroidModel).applyProjection(K),
i.z = O.z,
C.elements.push(i)
}
}
} else if ($ instanceof THREE.Line)
for (L.multiplyMatrices(K, p), V = $.geometry.vertices, W = b(), W.positionScreen.copy(V[0]).applyMatrix4(L), ab = $.type === THREE.LinePieces ? 2: 1, T = 1, U = V.length; U > T; T++)
W = b(),
W.positionScreen.copy(V[T]).applyMatrix4(L),
(T + 1) % ab > 0 || (X = s[h - 2], Q.copy(W.positionScreen), R.copy(X.positionScreen), !0 === d(Q, R) && (Q.multiplyScalar(1 / Q.w), R.multiplyScalar(1 / R.w), m === z ? (_ = new THREE.RenderableLine, y.push(_), z++, m++, l = _) : l = y[m++], l.v1.positionScreen.copy(Q), l.v2.positionScreen.copy(R), l.z = Math.max(Q.z, R.z), l.material = $.material, $.material.vertexColors === THREE.VertexColors && (l.vertexColors[0].copy($.geometry.colors[T]), l.vertexColors[1].copy($.geometry.colors[T - 1])), C.elements.push(l)));
for (q = 0, t = C.sprites.length; t > q; q++)
$ = C.sprites[q].object,
p = $.matrixWorld,
$ instanceof THREE.Particle && (E.set(p.elements[12], p.elements[13], p.elements[14], 1), E.applyMatrix4(K), E.z /= E.w, 0 < E.z && 1 > E.z && (o === B ? (eb = new THREE.RenderableParticle, A.push(eb), B++, o++, n = eb) : n = A[o++], n.object = $, n.x = E.x / E.w, n.y = E.y / E.w, n.z = E.z, n.rotation = $.rotation.z, n.scale.x = $.scale.x * Math.abs(n.x - (E.x + r.projectionMatrix.elements[0]) / (E.w + r.projectionMatrix.elements[12])), n.scale.y = $.scale.y * Math.abs(n.y - (E.y + r.projectionMatrix.elements[5]) / (E.w + r.projectionMatrix.elements[13])), n.material = $.material, C.elements.push(n)));
return ! 0 === S && C.elements.sort(c),
C
}
},
THREE.Face3 = function(a, b, c, d, e, f) {
this.a = a,
this.b = b,
this.c = c,
this.normal = d instanceof THREE.Vector3 ? d: new THREE.Vector3,
this.vertexNormals = d instanceof Array ? d: [],
this.color = e instanceof THREE.Color ? e: new THREE.Color,
this.vertexColors = e instanceof Array ? e: [],
this.vertexTangents = [],
this.materialIndex = void 0 !== f ? f: 0,
this.centroid = new THREE.Vector3
},
THREE.Face3.prototype = {
constructor: THREE.Face3,
clone: function() {
var a = new THREE.Face3(this.a, this.b, this.c);
a.normal.copy(this.normal),
a.color.copy(this.color),
a.centroid.copy(this.centroid),
a.materialIndex = this.materialIndex;
var b,
c;
for (b = 0, c = this.vertexNormals.length; c > b; b++)
a.vertexNormals[b] = this.vertexNormals[b].clone();
for (b = 0, c = this.vertexColors.length; c > b; b++)
a.vertexColors[b] = this.vertexColors[b].clone();
for (b = 0, c = this.vertexTangents.length; c > b; b++)
a.vertexTangents[b] = this.vertexTangents[b].clone();
return a
}
},
THREE.Face4 = function(a, b, c, d, e, f, g) {
this.a = a,
this.b = b,
this.c = c,
this.d = d,
this.normal = e instanceof THREE.Vector3 ? e: new THREE.Vector3,
this.vertexNormals = e instanceof Array ? e: [],
this.color = f instanceof THREE.Color ? f: new THREE.Color,
this.vertexColors = f instanceof Array ? f: [],
this.vertexTangents = [],
this.materialIndex = void 0 !== g ? g: 0,
this.centroid = new THREE.Vector3
},
THREE.Face4.prototype = {
constructor: THREE.Face4,
clone: function() {
var a = new THREE.Face4(this.a, this.b, this.c, this.d);
a.normal.copy(this.normal),
a.color.copy(this.color),
a.centroid.copy(this.centroid),
a.materialIndex = this.materialIndex;
var b,
c;
for (b = 0, c = this.vertexNormals.length; c > b; b++)
a.vertexNormals[b] = this.vertexNormals[b].clone();
for (b = 0, c = this.vertexColors.length; c > b; b++)
a.vertexColors[b] = this.vertexColors[b].clone();
for (b = 0, c = this.vertexTangents.length; c > b; b++)
a.vertexTangents[b] = this.vertexTangents[b].clone();
return a
}
},
THREE.Geometry = function() {
this.id = THREE.GeometryIdCount++,
this.name = "",
this.vertices = [],
this.colors = [],
this.normals = [],
this.faces = [],
this.faceUvs = [[]],
this.faceVertexUvs = [[]],
this.morphTargets = [],
this.morphColors = [],
this.morphNormals = [],
this.skinWeights = [],
this.skinIndices = [],
this.lineDistances = [],
this.boundingSphere = this.boundingBox = null,
this.hasTangents = !1,
this.dynamic = !0,
this.buffersNeedUpdate = this.lineDistancesNeedUpdate = this.colorsNeedUpdate = this.tangentsNeedUpdate = this.normalsNeedUpdate = this.uvsNeedUpdate = this.elementsNeedUpdate = this.verticesNeedUpdate = !1
},
THREE.Geometry.prototype = {
constructor: THREE.Geometry,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
applyMatrix: function(a) {
for (var b = (new THREE.Matrix3).getNormalMatrix(a), c = 0, d = this.vertices.length; d > c; c++)
this.vertices[c].applyMatrix4(a);
for (c = 0, d = this.faces.length; d > c; c++) {
var e = this.faces[c];
e.normal.applyMatrix3(b).normalize();
for (var f = 0, g = e.vertexNormals.length; g > f; f++)
e.vertexNormals[f].applyMatrix3(b).normalize();
e.centroid.applyMatrix4(a)
}
},
computeCentroids: function() {
var a,
b,
c;
for (a = 0, b = this.faces.length; b > a; a++)
c = this.faces[a],
c.centroid.set(0, 0, 0),
c instanceof THREE.Face3 ? (c.centroid.add(this.vertices[c.a]), c.centroid.add(this.vertices[c.b]), c.centroid.add(this.vertices[c.c]), c.centroid.divideScalar(3)) : c instanceof THREE.Face4 && (c.centroid.add(this.vertices[c.a]), c.centroid.add(this.vertices[c.b]), c.centroid.add(this.vertices[c.c]), c.centroid.add(this.vertices[c.d]), c.centroid.divideScalar(4))
},
computeFaceNormals: function() {
for (var a = new THREE.Vector3, b = new THREE.Vector3, c = 0, d = this.faces.length; d > c; c++) {
var e = this.faces[c],
f = this.vertices[e.a],
g = this.vertices[e.b];
a.subVectors(this.vertices[e.c], g),
b.subVectors(f, g),
a.cross(b),
a.normalize(),
e.normal.copy(a)
}
},
computeVertexNormals: function(a) {
var b,
c,
d,
e;
if (void 0 === this.__tmpVertices) {
for (e = this.__tmpVertices = Array(this.vertices.length), b = 0, c = this.vertices.length; c > b; b++)
e[b] = new THREE.Vector3;
for (b = 0, c = this.faces.length; c > b; b++)
d = this.faces[b],
d instanceof THREE.Face3 ? d.vertexNormals = [new THREE.Vector3, new THREE.Vector3, new THREE.Vector3] : d instanceof THREE.Face4 && (d.vertexNormals = [new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3])
} else
for (e = this.__tmpVertices, b = 0, c = this.vertices.length; c > b; b++)
e[b].set(0, 0, 0);
if (a) {
var f,
g,
h,
i = new THREE.Vector3,
j = new THREE.Vector3,
k = new THREE.Vector3,
l = new THREE.Vector3,
m = new THREE.Vector3;
for (b = 0, c = this.faces.length; c > b; b++)
d = this.faces[b],
d instanceof THREE.Face3 ? (a = this.vertices[d.a], f = this.vertices[d.b], g = this.vertices[d.c], i.subVectors(g, f), j.subVectors(a, f), i.cross(j), e[d.a].add(i), e[d.b].add(i), e[d.c].add(i)) : d instanceof THREE.Face4 && (a = this.vertices[d.a], f = this.vertices[d.b], g = this.vertices[d.c], h = this.vertices[d.d], k.subVectors(h, f), j.subVectors(a, f), k.cross(j), e[d.a].add(k), e[d.b].add(k), e[d.d].add(k), l.subVectors(h, g), m.subVectors(f, g), l.cross(m), e[d.b].add(l), e[d.c].add(l), e[d.d].add(l))
} else
for (b = 0, c = this.faces.length; c > b; b++)
d = this.faces[b],
d instanceof THREE.Face3 ? (e[d.a].add(d.normal), e[d.b].add(d.normal), e[d.c].add(d.normal)) : d instanceof THREE.Face4 && (e[d.a].add(d.normal), e[d.b].add(d.normal), e[d.c].add(d.normal), e[d.d].add(d.normal));
for (b = 0, c = this.vertices.length; c > b; b++)
e[b].normalize();
for (b = 0, c = this.faces.length; c > b; b++)
d = this.faces[b],
d instanceof THREE.Face3 ? (d.vertexNormals[0].copy(e[d.a]), d.vertexNormals[1].copy(e[d.b]), d.vertexNormals[2].copy(e[d.c])) : d instanceof THREE.Face4 && (d.vertexNormals[0].copy(e[d.a]), d.vertexNormals[1].copy(e[d.b]), d.vertexNormals[2].copy(e[d.c]), d.vertexNormals[3].copy(e[d.d]))
},
computeMorphNormals: function() {
var a,
b,
c,
d,
e;
for (c = 0, d = this.faces.length; d > c; c++)
for (e = this.faces[c], e.__originalFaceNormal ? e.__originalFaceNormal.copy(e.normal) : e.__originalFaceNormal = e.normal.clone(), e.__originalVertexNormals || (e.__originalVertexNormals = []), a = 0, b = e.vertexNormals.length; b > a; a++)
e.__originalVertexNormals[a] ? e.__originalVertexNormals[a].copy(e.vertexNormals[a]) : e.__originalVertexNormals[a] = e.vertexNormals[a].clone();
var f = new THREE.Geometry;
for (f.faces = this.faces, a = 0, b = this.morphTargets.length; b > a; a++) {
if (!this.morphNormals[a]) {
this.morphNormals[a] = {},
this.morphNormals[a].faceNormals = [],
this.morphNormals[a].vertexNormals = [];
var g,
h,
i = this.morphNormals[a].faceNormals,
j = this.morphNormals[a].vertexNormals;
for (c = 0, d = this.faces.length; d > c; c++)
e = this.faces[c],
g = new THREE.Vector3,
h = e instanceof THREE.Face3 ? {
a: new THREE.Vector3,
b: new THREE.Vector3,
c: new THREE.Vector3
}: {
a: new THREE.Vector3,
b: new THREE.Vector3,
c: new THREE.Vector3,
d: new THREE.Vector3
},
i.push(g),
j.push(h)
}
for (i = this.morphNormals[a], f.vertices = this.morphTargets[a].vertices, f.computeFaceNormals(), f.computeVertexNormals(), c = 0, d = this.faces.length; d > c; c++)
e = this.faces[c],
g = i.faceNormals[c],
h = i.vertexNormals[c],
g.copy(e.normal),
e instanceof THREE.Face3 ? (h.a.copy(e.vertexNormals[0]), h.b.copy(e.vertexNormals[1]), h.c.copy(e.vertexNormals[2])) : (h.a.copy(e.vertexNormals[0]), h.b.copy(e.vertexNormals[1]), h.c.copy(e.vertexNormals[2]), h.d.copy(e.vertexNormals[3]))
}
for (c = 0, d = this.faces.length; d > c; c++)
e = this.faces[c],
e.normal = e.__originalFaceNormal,
e.vertexNormals = e.__originalVertexNormals
},
computeTangents: function() {
function a(a, b, c, d, e, f, y) {
h = a.vertices[b],
i = a.vertices[c],
j = a.vertices[d],
k = g[e],
l = g[f],
m = g[y],
n = i.x - h.x,
o = j.x - h.x,
p = i.y - h.y,
q = j.y - h.y,
r = i.z - h.z,
s = j.z - h.z,
t = l.x - k.x,
u = m.x - k.x,
v = l.y - k.y,
w = m.y - k.y,
x = 1 / (t * w - u * v),
B.set((w * n - v * o) * x, (w * p - v * q) * x, (w * r - v * s) * x),
C.set((t * o - u * n) * x, (t * q - u * p) * x, (t * s - u * r) * x),
z[b].add(B),
z[c].add(B),
z[d].add(B),
A[b].add(C),
A[c].add(C),
A[d].add(C)
}
var b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z = [],
A = [],
B = new THREE.Vector3,
C = new THREE.Vector3,
D = new THREE.Vector3,
E = new THREE.Vector3,
F = new THREE.Vector3;
for (b = 0, c = this.vertices.length; c > b; b++)
z[b] = new THREE.Vector3,
A[b] = new THREE.Vector3;
for (b = 0, c = this.faces.length; c > b; b++)
f = this.faces[b],
g = this.faceVertexUvs[0][b],
f instanceof THREE.Face3 ? a(this, f.a, f.b, f.c, 0, 1, 2) : f instanceof THREE.Face4 && (a(this, f.a, f.b, f.d, 0, 1, 3), a(this, f.b, f.c, f.d, 1, 2, 3));
var G = ["a", "b", "c", "d"];
for (b = 0, c = this.faces.length; c > b; b++)
for (f = this.faces[b], d = 0; d < f.vertexNormals.length; d++)
F.copy(f.vertexNormals[d]),
e = f[G[d]],
y = z[e],
D.copy(y),
D.sub(F.multiplyScalar(F.dot(y))).normalize(),
E.crossVectors(f.vertexNormals[d], y),
e = E.dot(A[e]),
e = 0 > e ? -1: 1,
f.vertexTangents[d] = new THREE.Vector4(D.x, D.y, D.z, e);
this.hasTangents = !0
},
computeLineDistances: function() {
for (var a = 0, b = this.vertices, c = 0, d = b.length; d > c; c++)
c > 0 && (a += b[c].distanceTo(b[c - 1])),
this.lineDistances[c] = a
},
computeBoundingBox: function() {
null === this.boundingBox && (this.boundingBox = new THREE.Box3),
this.boundingBox.setFromPoints(this.vertices)
},
computeBoundingSphere: function() {
null === this.boundingSphere && (this.boundingSphere = new THREE.Sphere),
this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center, this.vertices)
},
mergeVertices: function() {
var a,
b,
c,
d,
e,
f,
g = {},
h = [],
i = [],
j = Math.pow(10, 4);
for (this.__tmpVertices = void 0, b = 0, c = this.vertices.length; c > b; b++)
a = this.vertices[b],
a = [Math.round(a.x * j), Math.round(a.y * j), Math.round(a.z * j)].join("_"),
void 0 === g[a] ? (g[a] = b, h.push(this.vertices[b]), i[b] = h.length - 1) : i[b] = i[g[a]];
for (j = [], b = 0, c = this.faces.length; c > b; b++)
if (g = this.faces[b], g instanceof THREE.Face3) {
for (g.a = i[g.a], g.b = i[g.b], g.c = i[g.c], d = [g.a, g.b, g.c], a = -1, e = 0; 3 > e; e++)
if (d[e] == d[(e + 1) % 3]) {
j.push(b);
break
}
} else if (g instanceof THREE.Face4) {
for (g.a = i[g.a], g.b = i[g.b], g.c = i[g.c], g.d = i[g.d], d = [g.a, g.b, g.c, g.d], a = -1, e = 0; 4 > e; e++)
d[e] == d[(e + 1) % 4] && (a >= 0 && j.push(b), a = e);
if (a >= 0) {
d.splice(a, 1);
var k = new THREE.Face3(d[0], d[1], d[2], g.normal, g.color, g.materialIndex);
for (d = 0, e = this.faceVertexUvs.length; e > d; d++)(f = this.faceVertexUvs[d][b]) && f.splice(a, 1);
g.vertexNormals && 0 < g.vertexNormals.length && (k.vertexNormals = g.vertexNormals, k.vertexNormals.splice(a, 1)),
g.vertexColors && 0 < g.vertexColors.length && (k.vertexColors = g.vertexColors, k.vertexColors.splice(a, 1)),
this.faces[b] = k
}
}
for (b = j.length - 1; b >= 0; b--)
for (this.faces.splice(b, 1), d = 0, e = this.faceVertexUvs.length; e > d; d++)
this.faceVertexUvs[d].splice(b, 1);
return i = this.vertices.length - h.length,
this.vertices = h,
i
},
clone: function() {
for (var a = new THREE.Geometry, b = this.vertices, c = 0, d = b.length; d > c; c++)
a.vertices.push(b[c].clone());
for (b = this.faces, c = 0, d = b.length; d > c; c++)
a.faces.push(b[c].clone());
for (b = this.faceVertexUvs[0], c = 0, d = b.length; d > c; c++) {
for (var e = b[c], f = [], g = 0, h = e.length; h > g; g++)
f.push(new THREE.Vector2(e[g].x, e[g].y));
a.faceVertexUvs[0].push(f)
}
return a
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
}
},
THREE.GeometryIdCount = 0,
THREE.BufferGeometry = function() {
this.id = THREE.GeometryIdCount++,
this.attributes = {},
this.dynamic = !1,
this.offsets = [],
this.boundingSphere = this.boundingBox = null,
this.hasTangents = !1,
this.morphTargets = []
},
THREE.BufferGeometry.prototype = {
constructor: THREE.BufferGeometry,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
applyMatrix: function(a) {
var b,
c;
this.attributes.position && (b = this.attributes.position.array),
this.attributes.normal && (c = this.attributes.normal.array),
void 0 !== b && (a.multiplyVector3Array(b), this.verticesNeedUpdate = !0),
void 0 !== c && ((new THREE.Matrix3).getNormalMatrix(a).multiplyVector3Array(c), this.normalizeNormals(), this.normalsNeedUpdate = !0)
},
computeBoundingBox: function() {
null === this.boundingBox && (this.boundingBox = new THREE.Box3);
var a = this.attributes.position.array;
if (a) {
var b,
c,
d,
e = this.boundingBox;
3 <= a.length && (e.min.x = e.max.x = a[0], e.min.y = e.max.y = a[1], e.min.z = e.max.z = a[2]);
for (var f = 3, g = a.length; g > f; f += 3)
b = a[f],
c = a[f + 1],
d = a[f + 2],
b < e.min.x ? e.min.x = b: b > e.max.x && (e.max.x = b),
c < e.min.y ? e.min.y = c: c > e.max.y && (e.max.y = c),
d < e.min.z ? e.min.z = d: d > e.max.z && (e.max.z = d)
} (void 0 === a || 0 === a.length) && (this.boundingBox.min.set(0, 0, 0), this.boundingBox.max.set(0, 0, 0))
},
computeBoundingSphere: function() {
null === this.boundingSphere && (this.boundingSphere = new THREE.Sphere);
var a = this.attributes.position.array;
if (a) {
for (var b, c, d, e = 0, f = 0, g = a.length; g > f; f += 3)
b = a[f],
c = a[f + 1],
d = a[f + 2],
b = b * b + c * c + d * d,
b > e && (e = b);
this.boundingSphere.radius = Math.sqrt(e)
}
},
computeVertexNormals: function() {
if (this.attributes.position) {
var a,
b,
c,
d;
if (a = this.attributes.position.array.length, void 0 === this.attributes.normal)
this.attributes.normal = {
itemSize: 3,
array: new Float32Array(a),
numItems: a
};
else
for (a = 0, b = this.attributes.normal.array.length; b > a; a++)
this.attributes.normal.array[a] = 0;
var e,
f,
g,
h,
i,
j,
k = this.attributes.position.array,
l = this.attributes.normal.array,
m = new THREE.Vector3,
n = new THREE.Vector3,
o = new THREE.Vector3,
p = new THREE.Vector3,
q = new THREE.Vector3;
if (this.attributes.index) {
var r = this.attributes.index.array,
s = this.offsets;
for (c = 0, d = s.length; d > c;++c) {
b = s[c].start,
e = s[c].count;
var t = s[c].index;
for (a = b, b += e; b > a; a += 3)
e = t + r[a],
f = t + r[a + 1],
g = t + r[a + 2],
h = k[3 * e],
i = k[3 * e + 1],
j = k[3 * e + 2],
m.set(h, i, j),
h = k[3 * f],
i = k[3 * f + 1],
j = k[3 * f + 2],
n.set(h, i, j),
h = k[3 * g],
i = k[3 * g + 1],
j = k[3 * g + 2],
o.set(h, i, j),
p.subVectors(o, n),
q.subVectors(m, n),
p.cross(q),
l[3 * e] += p.x,
l[3 * e + 1] += p.y,
l[3 * e + 2] += p.z,
l[3 * f] += p.x,
l[3 * f + 1] += p.y,
l[3 * f + 2] += p.z,
l[3 * g] += p.x,
l[3 * g + 1] += p.y,
l[3 * g + 2] += p.z
}
} else
for (a = 0, b = k.length; b > a; a += 9)
h = k[a],
i = k[a + 1],
j = k[a + 2],
m.set(h, i, j),
h = k[a + 3],
i = k[a + 4],
j = k[a + 5],
n.set(h, i, j),
h = k[a + 6],
i = k[a + 7],
j = k[a + 8],
o.set(h, i, j),
p.subVectors(o, n),
q.subVectors(m, n),
p.cross(q),
l[a] = p.x,
l[a + 1] = p.y,
l[a + 2] = p.z,
l[a + 3] = p.x,
l[a + 4] = p.y,
l[a + 5] = p.z,
l[a + 6] = p.x,
l[a + 7] = p.y,
l[a + 8] = p.z;
this.normalizeNormals(),
this.normalsNeedUpdate = !0
}
},
normalizeNormals: function() {
for (var a, b, c, d = this.attributes.normal.array, e = 0, f = d.length; f > e; e += 3)
a = d[e],
b = d[e + 1],
c = d[e + 2],
a = 1 / Math.sqrt(a * a + b * b + c * c),
d[e] *= a,
d[e + 1] *= a,
d[e + 2] *= a
},
computeTangents: function() {
function a(a) {
N.x = d[3 * a],
N.y = d[3 * a + 1],
N.z = d[3 * a + 2],
O.copy(N),
J = i[a],
L.copy(J),
L.sub(N.multiplyScalar(N.dot(J))).normalize(),
M.crossVectors(O, J),
K = M.dot(j[a]),
I = 0 > K ? -1: 1,
h[4 * a] = L.x,
h[4 * a + 1] = L.y,
h[4 * a + 2] = L.z,
h[4 * a + 3] = I
}
if (void 0 === this.attributes.index || void 0 === this.attributes.position || void 0 === this.attributes.normal || void 0 === this.attributes.uv)
console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");
else {
var b = this.attributes.index.array,
c = this.attributes.position.array,
d = this.attributes.normal.array,
e = this.attributes.uv.array,
f = c.length / 3;
if (void 0 === this.attributes.tangent) {
var g = 4 * f;
this.attributes.tangent = {
itemSize: 4,
array: new Float32Array(g),
numItems: g
}
}
for (var h = this.attributes.tangent.array, i = [], j = [], g = 0; f > g; g++)
i[g] = new THREE.Vector3,
j[g] = new THREE.Vector3;
var k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z,
A,
B,
C,
D,
E,
F,
f = new THREE.Vector3,
g = new THREE.Vector3,
G = this.offsets;
for (B = 0, C = G.length; C > B;++B) {
A = G[B].start,
D = G[B].count;
var H = G[B].index;
for (z = A, A += D; A > z; z += 3)
D = H + b[z],
E = H + b[z + 1],
F = H + b[z + 2],
k = c[3 * D],
l = c[3 * D + 1],
m = c[3 * D + 2],
n = c[3 * E],
o = c[3 * E + 1],
p = c[3 * E + 2],
q = c[3 * F],
r = c[3 * F + 1],
s = c[3 * F + 2],
t = e[2 * D],
u = e[2 * D + 1],
v = e[2 * E],
w = e[2 * E + 1],
x = e[2 * F],
y = e[2 * F + 1],
n -= k,
k = q - k,
o -= l,
l = r - l,
p -= m,
m = s - m,
v -= t,
t = x - t,
w -= u,
u = y - u,
y = 1 / (v * u - t * w),
f.set((u * n - w * k) * y, (u * o - w * l) * y, (u * p - w * m) * y),
g.set((v * k - t * n) * y, (v * l - t * o) * y, (v * m - t * p) * y),
i[D].add(f),
i[E].add(f),
i[F].add(f),
j[D].add(g),
j[E].add(g),
j[F].add(g)
}
var I,
J,
K,
L = new THREE.Vector3,
M = new THREE.Vector3,
N = new THREE.Vector3,
O = new THREE.Vector3;
for (B = 0, C = G.length; C > B;++B)
for (A = G[B].start, D = G[B].count, H = G[B].index, z = A, A += D; A > z; z += 3)
D = H + b[z],
E = H + b[z + 1],
F = H + b[z + 2],
a(D),
a(E),
a(F);
this.tangentsNeedUpdate = this.hasTangents = !0
}
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
}
},
THREE.Camera = function() {
THREE.Object3D.call(this),
this.matrixWorldInverse = new THREE.Matrix4,
this.projectionMatrix = new THREE.Matrix4,
this.projectionMatrixInverse = new THREE.Matrix4
},
THREE.Camera.prototype = Object.create(THREE.Object3D.prototype),
THREE.Camera.prototype.lookAt = function() {
var a = new THREE.Matrix4;
return function(b) {
a.lookAt(this.position, b, this.up),
!0 === this.useQuaternion ? this.quaternion.setFromRotationMatrix(a) : this.rotation.setEulerFromRotationMatrix(a, this.eulerOrder)
}
} (),
THREE.OrthographicCamera = function(a, b, c, d, e, f) {
THREE.Camera.call(this),
this.left = a,
this.right = b,
this.top = c,
this.bottom = d,
this.near = void 0 !== e ? e: .1,
this.far = void 0 !== f ? f: 2e3,
this.updateProjectionMatrix()
},
THREE.OrthographicCamera.prototype = Object.create(THREE.Camera.prototype),
THREE.OrthographicCamera.prototype.updateProjectionMatrix = function() {
this.projectionMatrix.makeOrthographic(this.left, this.right, this.top, this.bottom, this.near, this.far)
},
THREE.PerspectiveCamera = function(a, b, c, d) {
THREE.Camera.call(this),
this.fov = void 0 !== a ? a: 50,
this.aspect = void 0 !== b ? b: 1,
this.near = void 0 !== c ? c: .1,
this.far = void 0 !== d ? d: 2e3,
this.updateProjectionMatrix()
},
THREE.PerspectiveCamera.prototype = Object.create(THREE.Camera.prototype),
THREE.PerspectiveCamera.prototype.setLens = function(a, b) {
void 0 === b && (b = 24),
this.fov = 2 * THREE.Math.radToDeg(Math.atan(b / (2 * a))),
this.updateProjectionMatrix()
},
THREE.PerspectiveCamera.prototype.setViewOffset = function(a, b, c, d, e, f) {
this.fullWidth = a,
this.fullHeight = b,
this.x = c,
this.y = d,
this.width = e,
this.height = f,
this.updateProjectionMatrix()
},
THREE.PerspectiveCamera.prototype.updateProjectionMatrix = function() {
if (this.fullWidth) {
var a = this.fullWidth / this.fullHeight,
b = Math.tan(THREE.Math.degToRad(.5 * this.fov)) * this.near,
c = -b,
d = a * c,
a = Math.abs(a * b - d),
c = Math.abs(b - c);
this.projectionMatrix.makeFrustum(d + this.x * a / this.fullWidth, d + (this.x + this.width) * a / this.fullWidth, b - (this.y + this.height) * c / this.fullHeight, b - this.y * c / this.fullHeight, this.near, this.far)
} else
this.projectionMatrix.makePerspective(this.fov, this.aspect, this.near, this.far)
},
THREE.Light = function(a) {
THREE.Object3D.call(this),
this.color = new THREE.Color(a)
},
THREE.Light.prototype = Object.create(THREE.Object3D.prototype),
THREE.Light.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.Light),
THREE.Object3D.prototype.clone.call(this, a),
a.color.copy(this.color),
a
},
THREE.AmbientLight = function(a) {
THREE.Light.call(this, a)
},
THREE.AmbientLight.prototype = Object.create(THREE.Light.prototype),
THREE.AmbientLight.prototype.clone = function() {
var a = new THREE.AmbientLight;
return THREE.Light.prototype.clone.call(this, a),
a
},
THREE.AreaLight = function(a, b) {
THREE.Light.call(this, a),
this.normal = new THREE.Vector3(0, -1, 0),
this.right = new THREE.Vector3(1, 0, 0),
this.intensity = void 0 !== b ? b: 1,
this.height = this.width = 1,
this.constantAttenuation = 1.5,
this.linearAttenuation = .5,
this.quadraticAttenuation = .1
},
THREE.AreaLight.prototype = Object.create(THREE.Light.prototype),
THREE.DirectionalLight = function(a, b) {
THREE.Light.call(this, a),
this.position.set(0, 1, 0),
this.target = new THREE.Object3D,
this.intensity = void 0 !== b ? b: 1,
this.onlyShadow = this.castShadow = !1,
this.shadowCameraNear = 50,
this.shadowCameraFar = 5e3,
this.shadowCameraLeft = -500,
this.shadowCameraTop = this.shadowCameraRight = 500,
this.shadowCameraBottom = -500,
this.shadowCameraVisible = !1,
this.shadowBias = 0,
this.shadowDarkness = .5,
this.shadowMapHeight = this.shadowMapWidth = 512,
this.shadowCascade = !1,
this.shadowCascadeOffset = new THREE.Vector3(0, 0, -1e3),
this.shadowCascadeCount = 2,
this.shadowCascadeBias = [0, 0, 0],
this.shadowCascadeWidth = [512, 512, 512],
this.shadowCascadeHeight = [512, 512, 512],
this.shadowCascadeNearZ = [ - 1, .99, .998],
this.shadowCascadeFarZ = [.99, .998, 1],
this.shadowCascadeArray = [],
this.shadowMatrix = this.shadowCamera = this.shadowMapSize = this.shadowMap = null
},
THREE.DirectionalLight.prototype = Object.create(THREE.Light.prototype),
THREE.DirectionalLight.prototype.clone = function() {
var a = new THREE.DirectionalLight;
return THREE.Light.prototype.clone.call(this, a),
a.target = this.target.clone(),
a.intensity = this.intensity,
a.castShadow = this.castShadow,
a.onlyShadow = this.onlyShadow,
a
},
THREE.HemisphereLight = function(a, b, c) {
THREE.Light.call(this, a),
this.position.set(0, 100, 0),
this.groundColor = new THREE.Color(b),
this.intensity = void 0 !== c ? c: 1
},
THREE.HemisphereLight.prototype = Object.create(THREE.Light.prototype),
THREE.HemisphereLight.prototype.clone = function() {
var a = new THREE.PointLight;
return THREE.Light.prototype.clone.call(this, a),
a.groundColor.copy(this.groundColor),
a.intensity = this.intensity,
a
},
THREE.PointLight = function(a, b, c) {
THREE.Light.call(this, a),
this.intensity = void 0 !== b ? b: 1,
this.distance = void 0 !== c ? c: 0
},
THREE.PointLight.prototype = Object.create(THREE.Light.prototype),
THREE.PointLight.prototype.clone = function() {
var a = new THREE.PointLight;
return THREE.Light.prototype.clone.call(this, a),
a.intensity = this.intensity,
a.distance = this.distance,
a
},
THREE.SpotLight = function(a, b, c, d, e) {
THREE.Light.call(this, a),
this.position.set(0, 1, 0),
this.target = new THREE.Object3D,
this.intensity = void 0 !== b ? b: 1,
this.distance = void 0 !== c ? c: 0,
this.angle = void 0 !== d ? d: Math.PI / 3,
this.exponent = void 0 !== e ? e: 10,
this.onlyShadow = this.castShadow = !1,
this.shadowCameraNear = 50,
this.shadowCameraFar = 5e3,
this.shadowCameraFov = 50,
this.shadowCameraVisible = !1,
this.shadowBias = 0,
this.shadowDarkness = .5,
this.shadowMapHeight = this.shadowMapWidth = 512,
this.shadowMatrix = this.shadowCamera = this.shadowMapSize = this.shadowMap = null
},
THREE.SpotLight.prototype = Object.create(THREE.Light.prototype),
THREE.SpotLight.prototype.clone = function() {
var a = new THREE.SpotLight;
return THREE.Light.prototype.clone.call(this, a),
a.target = this.target.clone(),
a.intensity = this.intensity,
a.distance = this.distance,
a.angle = this.angle,
a.exponent = this.exponent,
a.castShadow = this.castShadow,
a.onlyShadow = this.onlyShadow,
a
},
THREE.Loader = function(a) {
this.statusDomElement = (this.showStatus = a) ? THREE.Loader.prototype.addStatusElement() : null,
this.onLoadStart = function() {},
this.onLoadProgress = function() {},
this.onLoadComplete = function() {}
},
THREE.Loader.prototype = {
constructor: THREE.Loader,
crossOrigin: "anonymous",
addStatusElement: function() {
var a = document.createElement("div");
return a.style.position = "absolute",
a.style.right = "0px",
a.style.top = "0px",
a.style.fontSize = "0.8em",
a.style.textAlign = "left",
a.style.background = "rgba(0,0,0,0.25)",
a.style.color = "#fff",
a.style.width = "120px",
a.style.padding = "0.5em 0.5em 0.5em 0.5em",
a.style.zIndex = 1e3,
a.innerHTML = "Loading ...",
a
},
updateProgress: function(a) {
var b = "Loaded ",
b = a.total ? b + ((100 * a.loaded / a.total).toFixed(0) + "%") : b + ((a.loaded / 1e3).toFixed(2) + " KB");
this.statusDomElement.innerHTML = b
},
extractUrlBase: function(a) {
return a = a.split("/"),
a.pop(),
(1 > a.length ? ".": a.join("/")) + "/"
},
initMaterials: function(a, b) {
for (var c = [], d = 0; d < a.length;++d)
c[d] = THREE.Loader.prototype.createMaterial(a[d], b);
return c
},
needsTangents: function(a) {
for (var b = 0, c = a.length; c > b; b++)
if (a[b]
instanceof THREE.ShaderMaterial)
return ! 0;
return ! 1
},
createMaterial: function(a, b) {
function c(a) {
return a = Math.log(a) / Math.LN2,
Math.floor(a) == a
}
function d(a) {
return a = Math.log(a) / Math.LN2,
Math.pow(2, Math.round(a))
}
function e(a, e, f, h, i, j, k) {
var l = /\.dds$/i.test(f),
m = b + "/" + f;
if (l) {
var n = THREE.ImageUtils.loadCompressedTexture(m);
a[e] = n
} else
n = document.createElement("canvas"),
a[e] = new THREE.Texture(n);
if (a[e].sourceFile = f, h && (a[e].repeat.set(h[0], h[1]), 1 !== h[0] && (a[e].wrapS = THREE.RepeatWrapping), 1 !== h[1] && (a[e].wrapT = THREE.RepeatWrapping)), i && a[e].offset.set(i[0], i[1]), j && (f = {
repeat: THREE.RepeatWrapping,
mirror: THREE.MirroredRepeatWrapping
}, void 0 !== f[j[0]] && (a[e].wrapS = f[j[0]]), void 0 !== f[j[1]] && (a[e].wrapT = f[j[1]])), k && (a[e].anisotropy = k), !l) {
var o = a[e],
a = new Image;
a.onload = function() {
if (c(this.width) && c(this.height))
o.image = this;
else {
var a = d(this.width),
b = d(this.height);
o.image.width = a,
o.image.height = b,
o.image.getContext("2d").drawImage(this, 0, 0, a, b)
}
o.needsUpdate = !0
},
a.crossOrigin = g.crossOrigin,
a.src = m
}
}
function f(a) {
return (255 * a[0] << 16) + (255 * a[1] << 8) + 255 * a[2]
}
var g = this,
h = "MeshLambertMaterial",
i = {
color: 15658734,
opacity: 1,
map: null,
lightMap: null,
normalMap: null,
bumpMap: null,
wireframe: !1
};
if (a.shading) {
var j = a.shading.toLowerCase();
"phong" === j ? h = "MeshPhongMaterial": "basic" === j && (h = "MeshBasicMaterial")
}
return void 0 !== a.blending && void 0 !== THREE[a.blending] && (i.blending = THREE[a.blending]),
(void 0 !== a.transparent || 1 > a.opacity) && (i.transparent = a.transparent),
void 0 !== a.depthTest && (i.depthTest = a.depthTest),
void 0 !== a.depthWrite && (i.depthWrite = a.depthWrite),
void 0 !== a.visible && (i.visible = a.visible),
void 0 !== a.flipSided && (i.side = THREE.BackSide),
void 0 !== a.doubleSided && (i.side = THREE.DoubleSide),
void 0 !== a.wireframe && (i.wireframe = a.wireframe),
void 0 !== a.vertexColors && ("face" === a.vertexColors ? i.vertexColors = THREE.FaceColors: a.vertexColors && (i.vertexColors = THREE.VertexColors)),
a.colorDiffuse ? i.color = f(a.colorDiffuse) : a.DbgColor && (i.color = a.DbgColor),
a.colorSpecular && (i.specular = f(a.colorSpecular)),
a.colorAmbient && (i.ambient = f(a.colorAmbient)),
a.transparency && (i.opacity = a.transparency),
a.specularCoef && (i.shininess = a.specularCoef),
a.mapDiffuse && b && e(i, "map", a.mapDiffuse, a.mapDiffuseRepeat, a.mapDiffuseOffset, a.mapDiffuseWrap, a.mapDiffuseAnisotropy),
a.mapLight && b && e(i, "lightMap", a.mapLight, a.mapLightRepeat, a.mapLightOffset, a.mapLightWrap, a.mapLightAnisotropy),
a.mapBump && b && e(i, "bumpMap", a.mapBump, a.mapBumpRepeat, a.mapBumpOffset, a.mapBumpWrap, a.mapBumpAnisotropy),
a.mapNormal && b && e(i, "normalMap", a.mapNormal, a.mapNormalRepeat, a.mapNormalOffset, a.mapNormalWrap, a.mapNormalAnisotropy),
a.mapSpecular && b && e(i, "specularMap", a.mapSpecular, a.mapSpecularRepeat, a.mapSpecularOffset, a.mapSpecularWrap, a.mapSpecularAnisotropy),
a.mapBumpScale && (i.bumpScale = a.mapBumpScale),
a.mapNormal ? (h = THREE.ShaderLib.normalmap, j = THREE.UniformsUtils.clone(h.uniforms), j.tNormal.value = i.normalMap, a.mapNormalFactor && j.uNormalScale.value.set(a.mapNormalFactor, a.mapNormalFactor), i.map && (j.tDiffuse.value = i.map, j.enableDiffuse.value = !0), i.specularMap && (j.tSpecular.value = i.specularMap, j.enableSpecular.value = !0), i.lightMap && (j.tAO.value = i.lightMap, j.enableAO.value = !0), j.uDiffuseColor.value.setHex(i.color), j.uSpecularColor.value.setHex(i.specular), j.uAmbientColor.value.setHex(i.ambient), j.uShininess.value = i.shininess, void 0 !== i.opacity && (j.uOpacity.value = i.opacity), h = new THREE.ShaderMaterial({
fragmentShader: h.fragmentShader,
vertexShader: h.vertexShader,
uniforms: j,
lights: !0,
fog: !0
}), i.transparent && (h.transparent = !0)) : h = new THREE[h](i),
void 0 !== a.DbgName && (h.name = a.DbgName),
h
}
},
THREE.ImageLoader = function() {
this.crossOrigin = null
},
THREE.ImageLoader.prototype = {
constructor: THREE.ImageLoader,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function(a, b) {
var c = this;
void 0 === b && (b = new Image),
b.addEventListener("load", function() {
c.dispatchEvent({
type: "load",
content: b
})
}, !1),
b.addEventListener("error", function() {
c.dispatchEvent({
type: "error",
message: "Couldn't load URL [" + a + "]"
})
}, !1),
c.crossOrigin && (b.crossOrigin = c.crossOrigin),
b.src = a
}
},
THREE.JSONLoader = function(a) {
THREE.Loader.call(this, a),
this.withCredentials = !1
},
THREE.JSONLoader.prototype = Object.create(THREE.Loader.prototype),
THREE.JSONLoader.prototype.load = function(a, b, c) {
c = c && "string" == typeof c ? c: this.extractUrlBase(a),
this.onLoadStart(),
this.loadAjaxJSON(this, a, b, c)
},
THREE.JSONLoader.prototype.loadAjaxJSON = function(a, b, c, d, e) {
var f = new XMLHttpRequest,
g = 0;
f.onreadystatechange = function() {
if (f.readyState === f.DONE)
if (200 === f.status || 0 === f.status) {
if (f.responseText) {
var h = JSON.parse(f.responseText),
h = a.parse(h, d);
c(h.geometry, h.materials)
} else
console.warn("THREE.JSONLoader: [" + b + "] seems to be unreachable or file there is empty");
a.onLoadComplete()
} else
console.error("THREE.JSONLoader: Couldn't load [" + b + "] [" + f.status + "]");
else
f.readyState === f.LOADING ? e && (0 === g && (g = f.getResponseHeader("Content-Length")), e({
total: g,
loaded: f.responseText.length
})) : f.readyState === f.HEADERS_RECEIVED && void 0 !== e && (g = f.getResponseHeader("Content-Length"))
},
f.open("GET", b, !0),
f.withCredentials = this.withCredentials,
f.send(null)
},
THREE.JSONLoader.prototype.parse = function(a, b) {
var c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q,
r = new THREE.Geometry,
s = void 0 !== a.scale ? 1 / a.scale: 1,
t = a.faces;
l = a.vertices;
var u = a.normals,
v = a.colors,
w = 0;
for (c = 0; c < a.uvs.length; c++)
a.uvs[c].length && w++;
for (c = 0; w > c; c++)
r.faceUvs[c] = [],
r.faceVertexUvs[c] = [];
for (f = 0, g = l.length; g > f;)
h = new THREE.Vector3,
h.x = l[f++] * s,
h.y = l[f++] * s,
h.z = l[f++] * s,
r.vertices.push(h);
for (f = 0, g = t.length; g > f;) {
if (l = t[f++], h = 1 & l, e = 2 & l, c = 4 & l, d = 8 & l, j = 16 & l, i = 32 & l, m = 64 & l, l & =128, h ? (n = new THREE.Face4, n.a = t[f++], n.b = t[f++], n.c = t[f++], n.d = t[f++], h = 4) : (n = new THREE.Face3, n.a = t[f++], n.b = t[f++], n.c = t[f++], h = 3), e && (e = t[f++], n.materialIndex = e), e = r.faces.length, c)
for (c = 0; w > c; c++)
o = a.uvs[c],
k = t[f++],
q = o[2 * k],
k = o[2 * k + 1],
r.faceUvs[c][e] = new THREE.Vector2(q, k);
if (d)
for (c = 0; w > c; c++) {
for (o = a.uvs[c], p = [], d = 0; h > d; d++)
k = t[f++],
q = o[2 * k],
k = o[2 * k + 1],
p[d] = new THREE.Vector2(q, k);
r.faceVertexUvs[c][e] = p
}
if (j && (j = 3 * t[f++], d = new THREE.Vector3, d.x = u[j++], d.y = u[j++], d.z = u[j], n.normal = d), i)
for (c = 0; h > c; c++)
j = 3 * t[f++],
d = new THREE.Vector3,
d.x = u[j++],
d.y = u[j++],
d.z = u[j],
n.vertexNormals.push(d);
if (m && (i = t[f++], i = new THREE.Color(v[i]), n.color = i), l)
for (c = 0; h > c; c++)
i = t[f++],
i = new THREE.Color(v[i]),
n.vertexColors.push(i);
r.faces.push(n)
}
if (a.skinWeights)
for (f = 0, g = a.skinWeights.length; g > f; f += 2)
t = a.skinWeights[f],
u = a.skinWeights[f + 1],
r.skinWeights.push(new THREE.Vector4(t, u, 0, 0));
if (a.skinIndices)
for (f = 0, g = a.skinIndices.length; g > f; f += 2)
t = a.skinIndices[f],
u = a.skinIndices[f + 1],
r.skinIndices.push(new THREE.Vector4(t, u, 0, 0));
if (r.bones = a.bones, r.animation = a.animation, void 0 !== a.morphTargets)
for (f = 0, g = a.morphTargets.length; g > f; f++)
for (r.morphTargets[f] = {}, r.morphTargets[f].name = a.morphTargets[f].name, r.morphTargets[f].vertices = [], v = r.morphTargets[f].vertices, w = a.morphTargets[f].vertices, t = 0, u = w.length; u > t; t += 3)
l = new THREE.Vector3,
l.x = w[t] * s,
l.y = w[t + 1] * s,
l.z = w[t + 2] * s,
v.push(l);
if (void 0 !== a.morphColors)
for (f = 0, g = a.morphColors.length; g > f; f++)
for (r.morphColors[f] = {}, r.morphColors[f].name = a.morphColors[f].name, r.morphColors[f].colors = [], u = r.morphColors[f].colors, v = a.morphColors[f].colors, s = 0, t = v.length; t > s; s += 3)
w = new THREE.Color(16755200),
w.setRGB(v[s], v[s + 1], v[s + 2]),
u.push(w);
return r.computeCentroids(),
r.computeFaceNormals(),
void 0 === a.materials ? {
geometry: r
}: (s = this.initMaterials(a.materials, b), this.needsTangents(s) && r.computeTangents(), {
geometry: r,
materials: s
})
},
THREE.LoadingMonitor = function() {
var a = this,
b = 0,
c = 0,
d = function() {
b++,
a.dispatchEvent({
type: "progress",
loaded: b,
total: c
}),
b === c && a.dispatchEvent({
type: "load"
})
};
this.add = function(a) {
c++,
a.addEventListener("load", d, !1)
}
},
THREE.LoadingMonitor.prototype = {
constructor: THREE.LoadingMonitor,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent
},
THREE.GeometryLoader = function() {},
THREE.GeometryLoader.prototype = {
constructor: THREE.GeometryLoader,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function(a) {
var b = this,
c = new XMLHttpRequest;
c.addEventListener("load", function(a) {
a = b.parse(JSON.parse(a.target.responseText)),
b.dispatchEvent({
type: "load",
content: a
})
}, !1),
c.addEventListener("progress", function(a) {
b.dispatchEvent({
type: "progress",
loaded: a.loaded,
total: a.total
})
}, !1),
c.addEventListener("error", function() {
b.dispatchEvent({
type: "error",
message: "Couldn't load URL [" + a + "]"
})
}, !1),
c.open("GET", a, !0),
c.send(null)
},
parse: function() {}
},
THREE.MaterialLoader = function() {},
THREE.MaterialLoader.prototype = {
constructor: THREE.MaterialLoader,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function(a) {
var b = this,
c = new XMLHttpRequest;
c.addEventListener("load", function(a) {
a = b.parse(JSON.parse(a.target.responseText)),
b.dispatchEvent({
type: "load",
content: a
})
}, !1),
c.addEventListener("progress", function(a) {
b.dispatchEvent({
type: "progress",
loaded: a.loaded,
total: a.total
})
}, !1),
c.addEventListener("error", function() {
b.dispatchEvent({
type: "error",
message: "Couldn't load URL [" + a + "]"
})
}, !1),
c.open("GET", a, !0),
c.send(null)
},
parse: function(a) {
var b;
switch (a.type) {
case "MeshBasicMaterial":
b = new THREE.MeshBasicMaterial({
color: a.color,
opacity: a.opacity,
transparent: a.transparent,
wireframe: a.wireframe
});
break;
case "MeshLambertMaterial":
b = new THREE.MeshLambertMaterial({
color: a.color,
ambient: a.ambient,
emissive: a.emissive,
opacity: a.opacity,
transparent: a.transparent,
wireframe: a.wireframe
});
break;
case "MeshPhongMaterial":
b = new THREE.MeshPhongMaterial({
color: a.color,
ambient: a.ambient,
emissive: a.emissive,
specular: a.specular,
shininess: a.shininess,
opacity: a.opacity,
transparent: a.transparent,
wireframe: a.wireframe
});
break;
case "MeshNormalMaterial":
b = new THREE.MeshNormalMaterial({
opacity: a.opacity,
transparent: a.transparent,
wireframe: a.wireframe
});
break;
case "MeshDepthMaterial":
b = new THREE.MeshDepthMaterial({
opacity: a.opacity,
transparent: a.transparent,
wireframe: a.wireframe
})
}
return b
}
},
THREE.SceneLoader = function() {
this.onLoadStart = function() {},
this.onLoadProgress = function() {},
this.onLoadComplete = function() {},
this.callbackSync = function() {},
this.callbackProgress = function() {},
this.geometryHandlerMap = {},
this.hierarchyHandlerMap = {},
this.addGeometryHandler("ascii", THREE.JSONLoader)
},
THREE.SceneLoader.prototype.constructor = THREE.SceneLoader,
THREE.SceneLoader.prototype.load = function(a, b) {
var c = this,
d = new XMLHttpRequest;
d.onreadystatechange = function() {
if (4 === d.readyState)
if (200 === d.status || 0 === d.status) {
var e = JSON.parse(d.responseText);
c.parse(e, b, a)
} else
console.error("THREE.SceneLoader: Couldn't load [" + a + "] [" + d.status + "]")
},
d.open("GET", a, !0),
d.send(null)
},
THREE.SceneLoader.prototype.addGeometryHandler = function(a, b) {
this.geometryHandlerMap[a] = {
loaderClass: b
}
},
THREE.SceneLoader.prototype.addHierarchyHandler = function(a, b) {
this.hierarchyHandlerMap[a] = {
loaderClass: b
}
},
THREE.SceneLoader.prototype.parse = function(a, b, c) {
function d(a, b) {
return "relativeToHTML" == b ? a: z + "/" + a
}
function e() {
f(w.scene, B.objects)
}
function f(a, b) {
var c,
e,
g,
i,
j,
n,
o;
for (o in b)
if (void 0 === w.objects[o]) {
var s = b[o],
t = null;
if (s.type && s.type in y.hierarchyHandlerMap) {
if (void 0 === s.loading) {
e = {
type: 1,
url: 1,
material: 1,
position: 1,
rotation: 1,
scale: 1,
visible: 1,
children: 1,
userData: 1,
skin: 1,
morph: 1,
mirroredLoop: 1,
duration: 1
},
g = {};
for (var u in s)
u in e || (g[u] = s[u]);
l = w.materials[s.material],
s.loading = !0,
e = y.hierarchyHandlerMap[s.type].loaderObject,
e.options ? e.load(d(s.url, B.urlBaseType), h(o, a, l, s)) : e.load(d(s.url, B.urlBaseType), h(o, a, l, s), g)
}
} else if (void 0 !== s.geometry) {
if (k = w.geometries[s.geometry]) {
if (t = !1, l = w.materials[s.material], t = l instanceof THREE.ShaderMaterial, g = s.position, i = s.rotation, j = s.scale, c = s.matrix, n = s.quaternion, s.material || (l = new THREE.MeshFaceMaterial(w.face_materials[s.geometry])), l instanceof THREE.MeshFaceMaterial && 0 === l.materials.length && (l = new THREE.MeshFaceMaterial(w.face_materials[s.geometry])), l instanceof THREE.MeshFaceMaterial)
for (e = 0; e < l.materials.length; e++)
t = t || l.materials[e]
instanceof THREE.ShaderMaterial;
t && k.computeTangents(),
s.skin ? t = new THREE.SkinnedMesh(k, l) : s.morph ? (t = new THREE.MorphAnimMesh(k, l), void 0 !== s.duration && (t.duration = s.duration), void 0 !== s.time && (t.time = s.time), void 0 !== s.mirroredLoop && (t.mirroredLoop = s.mirroredLoop), l.morphNormals && k.computeMorphNormals()) : t = new THREE.Mesh(k, l),
t.name = o,
c ? (t.matrixAutoUpdate = !1, t.matrix.set(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8], c[9], c[10], c[11], c[12], c[13], c[14], c[15])) : (t.position.set(g[0], g[1], g[2]), n ? (t.quaternion.set(n[0], n[1], n[2], n[3]), t.useQuaternion = !0) : t.rotation.set(i[0], i[1], i[2]), t.scale.set(j[0], j[1], j[2])),
t.visible = s.visible,
t.castShadow = s.castShadow,
t.receiveShadow = s.receiveShadow,
a.add(t),
w.objects[o] = t
}
} else "DirectionalLight" === s.type || "PointLight" === s.type || "AmbientLight" === s.type ? (q = void 0 !== s.color ? s.color: 16777215, r = void 0 !== s.intensity ? s.intensity: 1, "DirectionalLight" === s.type ? (g = s.direction, p = new THREE.DirectionalLight(q, r), p.position.set(g[0], g[1], g[2]), s.target && (A.push({
object: p,
targetName: s.target
}), p.target = null)) : "PointLight" === s.type ? (g = s.position, e = s.distance, p = new THREE.PointLight(q, r, e), p.position.set(g[0], g[1], g[2])) : "AmbientLight" === s.type && (p = new THREE.AmbientLight(q)), a.add(p), p.name = o, w.lights[o] = p, w.objects[o] = p) : "PerspectiveCamera" === s.type || "OrthographicCamera" === s.type ? (g = s.position, i = s.rotation, n = s.quaternion, "PerspectiveCamera" === s.type ? m = new THREE.PerspectiveCamera(s.fov, s.aspect, s.near, s.far) : "OrthographicCamera" === s.type && (m = new THREE.OrthographicCamera(s.left, s.right, s.top, s.bottom, s.near, s.far)), m.name = o, m.position.set(g[0], g[1], g[2]), void 0 !== n ? (m.quaternion.set(n[0], n[1], n[2], n[3]), m.useQuaternion = !0) : void 0 !== i && m.rotation.set(i[0], i[1], i[2]), a.add(m), w.cameras[o] = m, w.objects[o] = m) : (g = s.position, i = s.rotation, j = s.scale, n = s.quaternion, t = new THREE.Object3D, t.name = o, t.position.set(g[0], g[1], g[2]), n ? (t.quaternion.set(n[0], n[1], n[2], n[3]), t.useQuaternion = !0) : t.rotation.set(i[0], i[1], i[2]), t.scale.set(j[0], j[1], j[2]), t.visible = void 0 !== s.visible ? s.visible: !1, a.add(t), w.objects[o] = t, w.empties[o] = t);
if (t) {
if (void 0 !== s.userData)
for (var v in s.userData)
t.userData[v] = s.userData[v];
if (void 0 !== s.groups)
for (e = 0; e < s.groups.length; e++)
g = s.groups[e],
void 0 === w.groups[g] && (w.groups[g] = []),
w.groups[g].push(o);
void 0 !== s.children && f(t, s.children)
}
}
}
function g(a) {
return function(b, c) {
b.name = a,
w.geometries[a] = b,
w.face_materials[a] = c,
e(),
s -= 1,
y.onLoadComplete(),
j()
}
}
function h(a, b, c, d) {
return function(f) {
var f = f.content ? f.content: f.dae ? f.scene: f,
g = d.position,
h = d.rotation,
i = d.quaternion,
k = d.scale;
f.position.set(g[0], g[1], g[2]),
i ? (f.quaternion.set(i[0], i[1], i[2], i[3]), f.useQuaternion = !0) : f.rotation.set(h[0], h[1], h[2]),
f.scale.set(k[0], k[1], k[2]),
c && f.traverse(function(a) {
a.material = c
});
var l = void 0 !== d.visible ? d.visible: !0;
f.traverse(function(a) {
a.visible = l
}),
b.add(f),
f.name = a,
w.objects[a] = f,
e(),
s -= 1,
y.onLoadComplete(),
j()
}
}
function i(a) {
return function(b, c) {
b.name = a,
w.geometries[a] = b,
w.face_materials[a] = c
}
}
function j() {
if (y.callbackProgress({
totalModels: u,
totalTextures: v,
loadedModels: u - s,
loadedTextures: v - t
}, w), y.onLoadProgress(), 0 === s && 0 === t) {
for (var a = 0; a < A.length; a++) {
var c = A[a],
d = w.objects[c.targetName];
d ? c.object.target = d: (c.object.target = new THREE.Object3D, w.scene.add(c.object.target)),
c.object.target.userData.targetInverse = c.object
}
b(w)
}
}
var k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y = this,
z = THREE.Loader.prototype.extractUrlBase(c),
A = [],
B = a;
for (x in this.geometryHandlerMap)
a = this.geometryHandlerMap[x].loaderClass,
this.geometryHandlerMap[x].loaderObject = new a;
for (x in this.hierarchyHandlerMap)
a = this.hierarchyHandlerMap[x].loaderClass,
this.hierarchyHandlerMap[x].loaderObject = new a;
t = s = 0,
w = {
scene: new THREE.Scene,
geometries: {},
face_materials: {},
materials: {},
textures: {},
objects: {},
cameras: {},
lights: {},
fogs: {},
empties: {},
groups: {}
},
B.transform && (x = B.transform.position, a = B.transform.rotation, c = B.transform.scale, x && w.scene.position.set(x[0], x[1], x[2]), a && w.scene.rotation.set(a[0], a[1], a[2]), c && w.scene.scale.set(c[0], c[1], c[2]), x || a || c) && (w.scene.updateMatrix(), w.scene.updateMatrixWorld()),
x = function(a) {
return function() {
t -= a,
j(),
y.onLoadComplete()
}
};
for (var C in B.fogs)
a = B.fogs[C],
"linear" === a.type ? n = new THREE.Fog(0, a.near, a.far) : "exp2" === a.type && (n = new THREE.FogExp2(0, a.density)),
a = a.color,
n.color.setRGB(a[0], a[1], a[2]),
w.fogs[C] = n;
for (var D in B.geometries)
n = B.geometries[D],
n.type in this.geometryHandlerMap && (s += 1, y.onLoadStart());
for (var E in B.objects)
n = B.objects[E],
n.type && n.type in this.hierarchyHandlerMap && (s += 1, y.onLoadStart());
u = s;
for (D in B.geometries)
if (n = B.geometries[D], "cube" === n.type)
k = new THREE.CubeGeometry(n.width, n.height, n.depth, n.widthSegments, n.heightSegments, n.depthSegments),
k.name = D,
w.geometries[D] = k;
else if ("plane" === n.type)
k = new THREE.PlaneGeometry(n.width, n.height, n.widthSegments, n.heightSegments),
k.name = D,
w.geometries[D] = k;
else if ("sphere" === n.type)
k = new THREE.SphereGeometry(n.radius, n.widthSegments, n.heightSegments),
k.name = D,
w.geometries[D] = k;
else if ("cylinder" === n.type)
k = new THREE.CylinderGeometry(n.topRad, n.botRad, n.height, n.radSegs, n.heightSegs),
k.name = D,
w.geometries[D] = k;
else if ("torus" === n.type)
k = new THREE.TorusGeometry(n.radius, n.tube, n.segmentsR, n.segmentsT),
k.name = D,
w.geometries[D] = k;
else if ("icosahedron" === n.type)
k = new THREE.IcosahedronGeometry(n.radius, n.subdivisions),
k.name = D,
w.geometries[D] = k;
else if (n.type in this.geometryHandlerMap) {
E = {};
for (o in n)"type" !== o && "url" !== o && (E[o] = n[o]);
this.geometryHandlerMap[n.type].loaderObject.load(d(n.url, B.urlBaseType), g(D), E)
} else "embedded" === n.type && (E = B.embeds[n.id], E.metadata = B.metadata, E && (E = this.geometryHandlerMap.ascii.loaderObject.parse(E, ""), i(D)(E.geometry, E.materials)));
for (var F in B.textures)
if (D = B.textures[F], D.url instanceof Array)
for (t += D.url.length, o = 0; o < D.url.length; o++)
y.onLoadStart();
else
t += 1,
y.onLoadStart();
v = t;
for (F in B.textures) {
if (D = B.textures[F], void 0 !== D.mapping && void 0 !== THREE[D.mapping] && (D.mapping = new THREE[D.mapping]), D.url instanceof Array) {
for (E = D.url.length, n = [], o = 0; E > o; o++)
n[o] = d(D.url[o], B.urlBaseType);
o = (o = /\.dds$/i.test(n[0])) ? THREE.ImageUtils.loadCompressedTextureCube(n, D.mapping, x(E)) : THREE.ImageUtils.loadTextureCube(n, D.mapping, x(E))
} else
o = /\.dds$/i.test(D.url),
E = d(D.url, B.urlBaseType),
n = x(1),
o = o ? THREE.ImageUtils.loadCompressedTexture(E, D.mapping, n) : THREE.ImageUtils.loadTexture(E, D.mapping, n),
void 0 !== THREE[D.minFilter] && (o.minFilter = THREE[D.minFilter]),
void 0 !== THREE[D.magFilter] && (o.magFilter = THREE[D.magFilter]),
D.anisotropy && (o.anisotropy = D.anisotropy),
D.repeat && (o.repeat.set(D.repeat[0], D.repeat[1]), 1 !== D.repeat[0] && (o.wrapS = THREE.RepeatWrapping), 1 !== D.repeat[1] && (o.wrapT = THREE.RepeatWrapping)),
D.offset && o.offset.set(D.offset[0], D.offset[1]),
D.wrap && (E = {
repeat: THREE.RepeatWrapping,
mirror: THREE.MirroredRepeatWrapping
}, void 0 !== E[D.wrap[0]] && (o.wrapS = E[D.wrap[0]]), void 0 !== E[D.wrap[1]] && (o.wrapT = E[D.wrap[1]]));
w.textures[F] = o
}
var G,
H;
for (G in B.materials) {
F = B.materials[G];
for (H in F.parameters)"envMap" === H || "map" === H || "lightMap" === H || "bumpMap" === H ? F.parameters[H] = w.textures[F.parameters[H]] : "shading" === H ? F.parameters[H] = "flat" === F.parameters[H] ? THREE.FlatShading: THREE.SmoothShading: "side" === H ? F.parameters[H] = "double" == F.parameters[H] ? THREE.DoubleSide: "back" == F.parameters[H] ? THREE.BackSide: THREE.FrontSide: "blending" === H ? F.parameters[H] = F.parameters[H] in THREE ? THREE[F.parameters[H]] : THREE.NormalBlending: "combine" === H ? F.parameters[H] = F.parameters[H] in THREE ? THREE[F.parameters[H]] : THREE.MultiplyOperation: "vertexColors" === H ? "face" == F.parameters[H] ? F.parameters[H] = THREE.FaceColors: F.parameters[H] && (F.parameters[H] = THREE.VertexColors) : "wrapRGB" === H && (x = F.parameters[H], F.parameters[H] = new THREE.Vector3(x[0], x[1], x[2]));
void 0 !== F.parameters.opacity && 1 > F.parameters.opacity && (F.parameters.transparent = !0),
F.parameters.normalMap ? (x = THREE.ShaderLib.normalmap, D = THREE.UniformsUtils.clone(x.uniforms), o = F.parameters.color, E = F.parameters.specular, n = F.parameters.ambient, C = F.parameters.shininess, D.tNormal.value = w.textures[F.parameters.normalMap], F.parameters.normalScale && D.uNormalScale.value.set(F.parameters.normalScale[0], F.parameters.normalScale[1]), F.parameters.map && (D.tDiffuse.value = F.parameters.map, D.enableDiffuse.value = !0), F.parameters.envMap && (D.tCube.value = F.parameters.envMap, D.enableReflection.value = !0, D.uReflectivity.value = F.parameters.reflectivity), F.parameters.lightMap && (D.tAO.value = F.parameters.lightMap, D.enableAO.value = !0), F.parameters.specularMap && (D.tSpecular.value = w.textures[F.parameters.specularMap], D.enableSpecular.value = !0), F.parameters.displacementMap && (D.tDisplacement.value = w.textures[F.parameters.displacementMap], D.enableDisplacement.value = !0, D.uDisplacementBias.value = F.parameters.displacementBias, D.uDisplacementScale.value = F.parameters.displacementScale), D.uDiffuseColor.value.setHex(o), D.uSpecularColor.value.setHex(E), D.uAmbientColor.value.setHex(n), D.uShininess.value = C, F.parameters.opacity && (D.uOpacity.value = F.parameters.opacity), l = new THREE.ShaderMaterial({
fragmentShader: x.fragmentShader,
vertexShader: x.vertexShader,
uniforms: D,
lights: !0,
fog: !0
})) : l = new THREE[F.type](F.parameters),
l.name = G,
w.materials[G] = l
}
for (G in B.materials)
if (F = B.materials[G], F.parameters.materials) {
for (H = [], o = 0; o < F.parameters.materials.length; o++)
H.push(w.materials[F.parameters.materials[o]]);
w.materials[G].materials = H
}
e(),
w.cameras && B.defaults.camera && (w.currentCamera = w.cameras[B.defaults.camera]),
w.fogs && B.defaults.fog && (w.scene.fog = w.fogs[B.defaults.fog]),
y.callbackSync(w),
j()
},
THREE.TextureLoader = function() {
this.crossOrigin = null
},
THREE.TextureLoader.prototype = {
constructor: THREE.TextureLoader,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
load: function(a) {
var b = this,
c = new Image;
c.addEventListener("load", function() {
var a = new THREE.Texture(c);
a.needsUpdate = !0,
b.dispatchEvent({
type: "load",
content: a
})
}, !1),
c.addEventListener("error", function() {
b.dispatchEvent({
type: "error",
message: "Couldn't load URL [" + a + "]"
})
}, !1),
b.crossOrigin && (c.crossOrigin = b.crossOrigin),
c.src = a
}
},
THREE.Material = function() {
this.id = THREE.MaterialIdCount++,
this.name = "",
this.side = THREE.FrontSide,
this.opacity = 1,
this.transparent = !1,
this.blending = THREE.NormalBlending,
this.blendSrc = THREE.SrcAlphaFactor,
this.blendDst = THREE.OneMinusSrcAlphaFactor,
this.blendEquation = THREE.AddEquation,
this.depthWrite = this.depthTest = !0,
this.polygonOffset = !1,
this.alphaTest = this.polygonOffsetUnits = this.polygonOffsetFactor = 0,
this.overdraw = !1,
this.needsUpdate = this.visible = !0
},
THREE.Material.prototype = {
constructor: THREE.Material,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
setValues: function(a) {
if (void 0 !== a)
for (var b in a) {
var c = a[b];
if (void 0 === c)
console.warn("THREE.Material: '" + b + "' parameter is undefined.");
else if (b in this) {
var d = this[b];
d instanceof THREE.Color ? d.set(c) : d instanceof THREE.Vector3 && c instanceof THREE.Vector3 ? d.copy(c) : this[b] = c
}
}
},
clone: function(a) {
return void 0 === a && (a = new THREE.Material),
a.name = this.name,
a.side = this.side,
a.opacity = this.opacity,
a.transparent = this.transparent,
a.blending = this.blending,
a.blendSrc = this.blendSrc,
a.blendDst = this.blendDst,
a.blendEquation = this.blendEquation,
a.depthTest = this.depthTest,
a.depthWrite = this.depthWrite,
a.polygonOffset = this.polygonOffset,
a.polygonOffsetFactor = this.polygonOffsetFactor,
a.polygonOffsetUnits = this.polygonOffsetUnits,
a.alphaTest = this.alphaTest,
a.overdraw = this.overdraw,
a.visible = this.visible,
a
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
}
},
THREE.MaterialIdCount = 0,
THREE.LineBasicMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.linewidth = 1,
this.linejoin = this.linecap = "round",
this.vertexColors = !1,
this.fog = !0,
this.setValues(a)
},
THREE.LineBasicMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.LineBasicMaterial.prototype.clone = function() {
var a = new THREE.LineBasicMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.linewidth = this.linewidth,
a.linecap = this.linecap,
a.linejoin = this.linejoin,
a.vertexColors = this.vertexColors,
a.fog = this.fog,
a
},
THREE.LineDashedMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.scale = this.linewidth = 1,
this.dashSize = 3,
this.gapSize = 1,
this.vertexColors = !1,
this.fog = !0,
this.setValues(a)
},
THREE.LineDashedMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.LineDashedMaterial.prototype.clone = function() {
var a = new THREE.LineDashedMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.linewidth = this.linewidth,
a.scale = this.scale,
a.dashSize = this.dashSize,
a.gapSize = this.gapSize,
a.vertexColors = this.vertexColors,
a.fog = this.fog,
a
},
THREE.MeshBasicMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.envMap = this.specularMap = this.lightMap = this.map = null,
this.combine = THREE.MultiplyOperation,
this.reflectivity = 1,
this.refractionRatio = .98,
this.fog = !0,
this.shading = THREE.SmoothShading,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.wireframeLinejoin = this.wireframeLinecap = "round",
this.vertexColors = THREE.NoColors,
this.morphTargets = this.skinning = !1,
this.setValues(a)
},
THREE.MeshBasicMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshBasicMaterial.prototype.clone = function() {
var a = new THREE.MeshBasicMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.map = this.map,
a.lightMap = this.lightMap,
a.specularMap = this.specularMap,
a.envMap = this.envMap,
a.combine = this.combine,
a.reflectivity = this.reflectivity,
a.refractionRatio = this.refractionRatio,
a.fog = this.fog,
a.shading = this.shading,
a.wireframe = this.wireframe,
a.wireframeLinewidth = this.wireframeLinewidth,
a.wireframeLinecap = this.wireframeLinecap,
a.wireframeLinejoin = this.wireframeLinejoin,
a.vertexColors = this.vertexColors,
a.skinning = this.skinning,
a.morphTargets = this.morphTargets,
a
},
THREE.MeshLambertMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.ambient = new THREE.Color(16777215),
this.emissive = new THREE.Color(0),
this.wrapAround = !1,
this.wrapRGB = new THREE.Vector3(1, 1, 1),
this.envMap = this.specularMap = this.lightMap = this.map = null,
this.combine = THREE.MultiplyOperation,
this.reflectivity = 1,
this.refractionRatio = .98,
this.fog = !0,
this.shading = THREE.SmoothShading,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.wireframeLinejoin = this.wireframeLinecap = "round",
this.vertexColors = THREE.NoColors,
this.morphNormals = this.morphTargets = this.skinning = !1,
this.setValues(a)
},
THREE.MeshLambertMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshLambertMaterial.prototype.clone = function() {
var a = new THREE.MeshLambertMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.ambient.copy(this.ambient),
a.emissive.copy(this.emissive),
a.wrapAround = this.wrapAround,
a.wrapRGB.copy(this.wrapRGB),
a.map = this.map,
a.lightMap = this.lightMap,
a.specularMap = this.specularMap,
a.envMap = this.envMap,
a.combine = this.combine,
a.reflectivity = this.reflectivity,
a.refractionRatio = this.refractionRatio,
a.fog = this.fog,
a.shading = this.shading,
a.wireframe = this.wireframe,
a.wireframeLinewidth = this.wireframeLinewidth,
a.wireframeLinecap = this.wireframeLinecap,
a.wireframeLinejoin = this.wireframeLinejoin,
a.vertexColors = this.vertexColors,
a.skinning = this.skinning,
a.morphTargets = this.morphTargets,
a.morphNormals = this.morphNormals,
a
},
THREE.MeshPhongMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.ambient = new THREE.Color(16777215),
this.emissive = new THREE.Color(0),
this.specular = new THREE.Color(1118481),
this.shininess = 30,
this.metal = !1,
this.perPixel = !0,
this.wrapAround = !1,
this.wrapRGB = new THREE.Vector3(1, 1, 1),
this.bumpMap = this.lightMap = this.map = null,
this.bumpScale = 1,
this.normalMap = null,
this.normalScale = new THREE.Vector2(1, 1),
this.envMap = this.specularMap = null,
this.combine = THREE.MultiplyOperation,
this.reflectivity = 1,
this.refractionRatio = .98,
this.fog = !0,
this.shading = THREE.SmoothShading,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.wireframeLinejoin = this.wireframeLinecap = "round",
this.vertexColors = THREE.NoColors,
this.morphNormals = this.morphTargets = this.skinning = !1,
this.setValues(a)
},
THREE.MeshPhongMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshPhongMaterial.prototype.clone = function() {
var a = new THREE.MeshPhongMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.ambient.copy(this.ambient),
a.emissive.copy(this.emissive),
a.specular.copy(this.specular),
a.shininess = this.shininess,
a.metal = this.metal,
a.perPixel = this.perPixel,
a.wrapAround = this.wrapAround,
a.wrapRGB.copy(this.wrapRGB),
a.map = this.map,
a.lightMap = this.lightMap,
a.bumpMap = this.bumpMap,
a.bumpScale = this.bumpScale,
a.normalMap = this.normalMap,
a.normalScale.copy(this.normalScale),
a.specularMap = this.specularMap,
a.envMap = this.envMap,
a.combine = this.combine,
a.reflectivity = this.reflectivity,
a.refractionRatio = this.refractionRatio,
a.fog = this.fog,
a.shading = this.shading,
a.wireframe = this.wireframe,
a.wireframeLinewidth = this.wireframeLinewidth,
a.wireframeLinecap = this.wireframeLinecap,
a.wireframeLinejoin = this.wireframeLinejoin,
a.vertexColors = this.vertexColors,
a.skinning = this.skinning,
a.morphTargets = this.morphTargets,
a.morphNormals = this.morphNormals,
a
},
THREE.MeshDepthMaterial = function(a) {
THREE.Material.call(this),
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.setValues(a)
},
THREE.MeshDepthMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshDepthMaterial.prototype.clone = function() {
var a = new THREE.MeshDepthMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.wireframe = this.wireframe,
a.wireframeLinewidth = this.wireframeLinewidth,
a
},
THREE.MeshNormalMaterial = function(a) {
THREE.Material.call(this, a),
this.shading = THREE.FlatShading,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.morphTargets = !1,
this.setValues(a)
},
THREE.MeshNormalMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.MeshNormalMaterial.prototype.clone = function() {
var a = new THREE.MeshNormalMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.shading = this.shading,
a.wireframe = this.wireframe,
a.wireframeLinewidth = this.wireframeLinewidth,
a
},
THREE.MeshFaceMaterial = function(a) {
this.materials = a instanceof Array ? a: []
},
THREE.MeshFaceMaterial.prototype.clone = function() {
return new THREE.MeshFaceMaterial(this.materials.slice(0))
},
THREE.ParticleBasicMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.map = null,
this.size = 1,
this.sizeAttenuation = !0,
this.vertexColors = !1,
this.fog = !0,
this.setValues(a)
},
THREE.ParticleBasicMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.ParticleBasicMaterial.prototype.clone = function() {
var a = new THREE.ParticleBasicMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.map = this.map,
a.size = this.size,
a.sizeAttenuation = this.sizeAttenuation,
a.vertexColors = this.vertexColors,
a.fog = this.fog,
a
},
THREE.ParticleCanvasMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.program = function() {},
this.setValues(a)
},
THREE.ParticleCanvasMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.ParticleCanvasMaterial.prototype.clone = function() {
var a = new THREE.ParticleCanvasMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.program = this.program,
a
},
THREE.ShaderMaterial = function(a) {
THREE.Material.call(this),
this.vertexShader = this.fragmentShader = "void main() {}",
this.uniforms = {},
this.defines = {},
this.attributes = null,
this.shading = THREE.SmoothShading,
this.linewidth = 1,
this.wireframe = !1,
this.wireframeLinewidth = 1,
this.lights = this.fog = !1,
this.vertexColors = THREE.NoColors,
this.morphNormals = this.morphTargets = this.skinning = !1,
this.setValues(a)
},
THREE.ShaderMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.ShaderMaterial.prototype.clone = function() {
var a = new THREE.ShaderMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.fragmentShader = this.fragmentShader,
a.vertexShader = this.vertexShader,
a.uniforms = THREE.UniformsUtils.clone(this.uniforms),
a.attributes = this.attributes,
a.defines = this.defines,
a.shading = this.shading,
a.wireframe = this.wireframe,
a.wireframeLinewidth = this.wireframeLinewidth,
a.fog = this.fog,
a.lights = this.lights,
a.vertexColors = this.vertexColors,
a.skinning = this.skinning,
a.morphTargets = this.morphTargets,
a.morphNormals = this.morphNormals,
a
},
THREE.SpriteMaterial = function(a) {
THREE.Material.call(this),
this.color = new THREE.Color(16777215),
this.map = new THREE.Texture,
this.useScreenCoordinates = !0,
this.depthTest = !this.useScreenCoordinates,
this.sizeAttenuation = !this.useScreenCoordinates,
this.scaleByViewport = !this.sizeAttenuation,
this.alignment = THREE.SpriteAlignment.center.clone(),
this.fog = !1,
this.uvOffset = new THREE.Vector2(0, 0),
this.uvScale = new THREE.Vector2(1, 1),
this.setValues(a),
a = a || {},
void 0 === a.depthTest && (this.depthTest = !this.useScreenCoordinates),
void 0 === a.sizeAttenuation && (this.sizeAttenuation = !this.useScreenCoordinates),
void 0 === a.scaleByViewport && (this.scaleByViewport = !this.sizeAttenuation)
},
THREE.SpriteMaterial.prototype = Object.create(THREE.Material.prototype),
THREE.SpriteMaterial.prototype.clone = function() {
var a = new THREE.SpriteMaterial;
return THREE.Material.prototype.clone.call(this, a),
a.color.copy(this.color),
a.map = this.map,
a.useScreenCoordinates = this.useScreenCoordinates,
a.sizeAttenuation = this.sizeAttenuation,
a.scaleByViewport = this.scaleByViewport,
a.alignment.copy(this.alignment),
a.uvOffset.copy(this.uvOffset),
a.uvScale.copy(this.uvScale),
a.fog = this.fog,
a
},
THREE.SpriteAlignment = {},
THREE.SpriteAlignment.topLeft = new THREE.Vector2(1, -1),
THREE.SpriteAlignment.topCenter = new THREE.Vector2(0, -1),
THREE.SpriteAlignment.topRight = new THREE.Vector2( - 1, -1),
THREE.SpriteAlignment.centerLeft = new THREE.Vector2(1, 0),
THREE.SpriteAlignment.center = new THREE.Vector2(0, 0),
THREE.SpriteAlignment.centerRight = new THREE.Vector2( - 1, 0),
THREE.SpriteAlignment.bottomLeft = new THREE.Vector2(1, 1),
THREE.SpriteAlignment.bottomCenter = new THREE.Vector2(0, 1),
THREE.SpriteAlignment.bottomRight = new THREE.Vector2( - 1, 1),
THREE.Texture = function(a, b, c, d, e, f, g, h, i) {
this.id = THREE.TextureIdCount++,
this.name = "",
this.image = a,
this.mipmaps = [],
this.mapping = void 0 !== b ? b: new THREE.UVMapping,
this.wrapS = void 0 !== c ? c: THREE.ClampToEdgeWrapping,
this.wrapT = void 0 !== d ? d: THREE.ClampToEdgeWrapping,
this.magFilter = void 0 !== e ? e: THREE.LinearFilter,
this.minFilter = void 0 !== f ? f: THREE.LinearMipMapLinearFilter,
this.anisotropy = void 0 !== i ? i: 1,
this.format = void 0 !== g ? g: THREE.RGBAFormat,
this.type = void 0 !== h ? h: THREE.UnsignedByteType,
this.offset = new THREE.Vector2(0, 0),
this.repeat = new THREE.Vector2(1, 1),
this.generateMipmaps = !0,
this.premultiplyAlpha = !1,
this.flipY = !0,
this.unpackAlignment = 4,
this.needsUpdate = !1,
this.onUpdate = null
},
THREE.Texture.prototype = {
constructor: THREE.Texture,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
clone: function(a) {
return void 0 === a && (a = new THREE.Texture),
a.image = this.image,
a.mipmaps = this.mipmaps.slice(0),
a.mapping = this.mapping,
a.wrapS = this.wrapS,
a.wrapT = this.wrapT,
a.magFilter = this.magFilter,
a.minFilter = this.minFilter,
a.anisotropy = this.anisotropy,
a.format = this.format,
a.type = this.type,
a.offset.copy(this.offset),
a.repeat.copy(this.repeat),
a.generateMipmaps = this.generateMipmaps,
a.premultiplyAlpha = this.premultiplyAlpha,
a.flipY = this.flipY,
a.unpackAlignment = this.unpackAlignment,
a
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
}
},
THREE.TextureIdCount = 0,
THREE.CompressedTexture = function(a, b, c, d, e, f, g, h, i, j, k) {
THREE.Texture.call(this, null, f, g, h, i, j, d, e, k),
this.image = {
width: b,
height: c
},
this.mipmaps = a,
this.generateMipmaps = !1
},
THREE.CompressedTexture.prototype = Object.create(THREE.Texture.prototype),
THREE.CompressedTexture.prototype.clone = function() {
var a = new THREE.CompressedTexture;
return THREE.Texture.prototype.clone.call(this, a),
a
},
THREE.DataTexture = function(a, b, c, d, e, f, g, h, i, j, k) {
THREE.Texture.call(this, null, f, g, h, i, j, d, e, k),
this.image = {
data: a,
width: b,
height: c
}
},
THREE.DataTexture.prototype = Object.create(THREE.Texture.prototype),
THREE.DataTexture.prototype.clone = function() {
var a = new THREE.DataTexture;
return THREE.Texture.prototype.clone.call(this, a),
a
},
THREE.Particle = function(a) {
THREE.Object3D.call(this),
this.material = a
},
THREE.Particle.prototype = Object.create(THREE.Object3D.prototype),
THREE.Particle.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.Particle(this.material)),
THREE.Object3D.prototype.clone.call(this, a),
a
},
THREE.ParticleSystem = function(a, b) {
THREE.Object3D.call(this),
this.geometry = a,
this.material = void 0 !== b ? b: new THREE.ParticleBasicMaterial({
color: 16777215 * Math.random()
}),
this.sortParticles = !1,
this.geometry && null === this.geometry.boundingSphere && this.geometry.computeBoundingSphere(),
this.frustumCulled = !1
},
THREE.ParticleSystem.prototype = Object.create(THREE.Object3D.prototype),
THREE.ParticleSystem.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.ParticleSystem(this.geometry, this.material)),
a.sortParticles = this.sortParticles,
THREE.Object3D.prototype.clone.call(this, a),
a
},
THREE.Line = function(a, b, c) {
THREE.Object3D.call(this),
this.geometry = a,
this.material = void 0 !== b ? b: new THREE.LineBasicMaterial({
color: 16777215 * Math.random()
}),
this.type = void 0 !== c ? c: THREE.LineStrip,
this.geometry && (this.geometry.boundingSphere || this.geometry.computeBoundingSphere())
},
THREE.LineStrip = 0,
THREE.LinePieces = 1,
THREE.Line.prototype = Object.create(THREE.Object3D.prototype),
THREE.Line.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.Line(this.geometry, this.material, this.type)),
THREE.Object3D.prototype.clone.call(this, a),
a
},
THREE.Mesh = function(a, b) {
THREE.Object3D.call(this),
this.material = this.geometry = null,
this.setGeometry(a),
this.setMaterial(b)
},
THREE.Mesh.prototype = Object.create(THREE.Object3D.prototype),
THREE.Mesh.prototype.setGeometry = function(a) {
void 0 !== a && (this.geometry = a, null === this.geometry.boundingSphere && this.geometry.computeBoundingSphere(), this.updateMorphTargets())
},
THREE.Mesh.prototype.setMaterial = function(a) {
this.material = void 0 !== a ? a: new THREE.MeshBasicMaterial({
color: 16777215 * Math.random(),
wireframe: !0
})
},
THREE.Mesh.prototype.updateMorphTargets = function() {
if (0 < this.geometry.morphTargets.length) {
this.morphTargetBase = -1,
this.morphTargetForcedOrder = [],
this.morphTargetInfluences = [],
this.morphTargetDictionary = {};
for (var a = 0, b = this.geometry.morphTargets.length; b > a; a++)
this.morphTargetInfluences.push(0),
this.morphTargetDictionary[this.geometry.morphTargets[a].name] = a
}
},
THREE.Mesh.prototype.getMorphTargetIndexByName = function(a) {
return void 0 !== this.morphTargetDictionary[a] ? this.morphTargetDictionary[a] : (console.log("THREE.Mesh.getMorphTargetIndexByName: morph target " + a + " does not exist. Returning 0."), 0)
},
THREE.Mesh.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.Mesh(this.geometry, this.material)),
THREE.Object3D.prototype.clone.call(this, a),
a
},
THREE.Bone = function(a) {
THREE.Object3D.call(this),
this.skin = a,
this.skinMatrix = new THREE.Matrix4
},
THREE.Bone.prototype = Object.create(THREE.Object3D.prototype),
THREE.Bone.prototype.update = function(a, b) {
this.matrixAutoUpdate && (b | =this.updateMatrix()),
(b || this.matrixWorldNeedsUpdate) && (a ? this.skinMatrix.multiplyMatrices(a, this.matrix) : this.skinMatrix.copy(this.matrix), this.matrixWorldNeedsUpdate = !1, b = !0);
var c,
d = this.children.length;
for (c = 0; d > c; c++)
this.children[c].update(this.skinMatrix, b)
},
THREE.SkinnedMesh = function(a, b, c) {
THREE.Mesh.call(this, a, b),
this.useVertexTexture = void 0 !== c ? c: !0,
this.identityMatrix = new THREE.Matrix4,
this.bones = [],
this.boneMatrices = [];
var d,
e,
f;
if (this.geometry && void 0 !== this.geometry.bones) {
for (a = 0; a < this.geometry.bones.length; a++)
c = this.geometry.bones[a],
d = c.pos,
e = c.rotq,
f = c.scl,
b = this.addBone(),
b.name = c.name,
b.position.set(d[0], d[1], d[2]),
b.quaternion.set(e[0], e[1], e[2], e[3]),
b.useQuaternion = !0,
void 0 !== f ? b.scale.set(f[0], f[1], f[2]) : b.scale.set(1, 1, 1);
for (a = 0; a < this.bones.length; a++)
c = this.geometry.bones[a],
b = this.bones[a],
-1 === c.parent ? this.add(b) : this.bones[c.parent].add(b);
a = this.bones.length,
this.useVertexTexture ? (this.boneTextureHeight = this.boneTextureWidth = a = a > 256 ? 64: a > 64 ? 32: a > 16 ? 16: 8, this.boneMatrices = new Float32Array(4 * this.boneTextureWidth * this.boneTextureHeight), this.boneTexture = new THREE.DataTexture(this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, THREE.RGBAFormat, THREE.FloatType), this.boneTexture.minFilter = THREE.NearestFilter, this.boneTexture.magFilter = THREE.NearestFilter, this.boneTexture.generateMipmaps = !1, this.boneTexture.flipY = !1) : this.boneMatrices = new Float32Array(16 * a),
this.pose()
}
},
THREE.SkinnedMesh.prototype = Object.create(THREE.Mesh.prototype),
THREE.SkinnedMesh.prototype.addBone = function(a) {
return void 0 === a && (a = new THREE.Bone(this)),
this.bones.push(a),
a
},
THREE.SkinnedMesh.prototype.updateMatrixWorld = function(a) {
this.matrixAutoUpdate && this.updateMatrix(),
(this.matrixWorldNeedsUpdate || a) && (this.parent ? this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix) : this.matrixWorld.copy(this.matrix), this.matrixWorldNeedsUpdate = !1);
for (var a = 0, b = this.children.length; b > a; a++) {
var c = this.children[a];
c instanceof THREE.Bone ? c.update(this.identityMatrix, !1) : c.updateMatrixWorld(!0)
}
if (void 0 == this.boneInverses)
for (this.boneInverses = [], a = 0, b = this.bones.length; b > a; a++)
c = new THREE.Matrix4,
c.getInverse(this.bones[a].skinMatrix),
this.boneInverses.push(c);
for (a = 0, b = this.bones.length; b > a; a++)
THREE.SkinnedMesh.offsetMatrix.multiplyMatrices(this.bones[a].skinMatrix, this.boneInverses[a]),
THREE.SkinnedMesh.offsetMatrix.flattenToArrayOffset(this.boneMatrices, 16 * a);
this.useVertexTexture && (this.boneTexture.needsUpdate = !0)
},
THREE.SkinnedMesh.prototype.pose = function() {
this.updateMatrixWorld(!0);
for (var a = 0; a < this.geometry.skinIndices.length; a++) {
var b = this.geometry.skinWeights[a],
c = 1 / b.lengthManhattan();
1 / 0 !== c ? b.multiplyScalar(c) : b.set(1)
}
},
THREE.SkinnedMesh.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.SkinnedMesh(this.geometry, this.material, this.useVertexTexture)),
THREE.Mesh.prototype.clone.call(this, a),
a
},
THREE.SkinnedMesh.offsetMatrix = new THREE.Matrix4,
THREE.MorphAnimMesh = function(a, b) {
THREE.Mesh.call(this, a, b),
this.duration = 1e3,
this.mirroredLoop = !1,
this.currentKeyframe = this.lastKeyframe = this.time = 0,
this.direction = 1,
this.directionBackwards = !1,
this.setFrameRange(0, this.geometry.morphTargets.length - 1)
},
THREE.MorphAnimMesh.prototype = Object.create(THREE.Mesh.prototype),
THREE.MorphAnimMesh.prototype.setFrameRange = function(a, b) {
this.startKeyframe = a,
this.endKeyframe = b,
this.length = this.endKeyframe - this.startKeyframe + 1
},
THREE.MorphAnimMesh.prototype.setDirectionForward = function() {
this.direction = 1,
this.directionBackwards = !1
},
THREE.MorphAnimMesh.prototype.setDirectionBackward = function() {
this.direction = -1,
this.directionBackwards = !0
},
THREE.MorphAnimMesh.prototype.parseAnimations = function() {
var a = this.geometry;
a.animations || (a.animations = {});
for (var b, c = a.animations, d = /([a-z]+)(\d+)/, e = 0, f = a.morphTargets.length; f > e; e++) {
var g = a.morphTargets[e].name.match(d);
if (g && 1 < g.length) {
g = g[1],
c[g] || (c[g] = {
start: 1 / 0,
end: -1 / 0
});
var h = c[g];
e < h.start && (h.start = e),
e > h.end && (h.end = e),
b || (b = g)
}
}
a.firstAnimation = b
},
THREE.MorphAnimMesh.prototype.setAnimationLabel = function(a, b, c) {
this.geometry.animations || (this.geometry.animations = {}),
this.geometry.animations[a] = {
start: b,
end: c
}
},
THREE.MorphAnimMesh.prototype.playAnimation = function(a, b) {
var c = this.geometry.animations[a];
c ? (this.setFrameRange(c.start, c.end), this.duration = 1e3 * ((c.end - c.start) / b), this.time = 0) : console.warn("animation[" + a + "] undefined")
},
THREE.MorphAnimMesh.prototype.updateAnimation = function(a) {
var b = this.duration / this.length;
this.time += this.direction * a,
this.mirroredLoop ? (this.time > this.duration || 0 > this.time) && (this.direction *= -1, this.time > this.duration && (this.time = this.duration, this.directionBackwards = !0), 0 > this.time && (this.time = 0, this.directionBackwards = !1)) : (this.time %= this.duration, 0 > this.time && (this.time += this.duration)),
a = this.startKeyframe + THREE.Math.clamp(Math.floor(this.time / b), 0, this.length - 1),
a !== this.currentKeyframe && (this.morphTargetInfluences[this.lastKeyframe] = 0, this.morphTargetInfluences[this.currentKeyframe] = 1, this.morphTargetInfluences[a] = 0, this.lastKeyframe = this.currentKeyframe, this.currentKeyframe = a),
b = this.time % b / b,
this.directionBackwards && (b = 1 - b),
this.morphTargetInfluences[this.currentKeyframe] = b,
this.morphTargetInfluences[this.lastKeyframe] = 1 - b
},
THREE.MorphAnimMesh.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.MorphAnimMesh(this.geometry, this.material)),
a.duration = this.duration,
a.mirroredLoop = this.mirroredLoop,
a.time = this.time,
a.lastKeyframe = this.lastKeyframe,
a.currentKeyframe = this.currentKeyframe,
a.direction = this.direction,
a.directionBackwards = this.directionBackwards,
THREE.Mesh.prototype.clone.call(this, a),
a
},
THREE.Ribbon = function(a, b) {
THREE.Object3D.call(this),
this.geometry = a,
this.material = b
},
THREE.Ribbon.prototype = Object.create(THREE.Object3D.prototype),
THREE.Ribbon.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.Ribbon(this.geometry, this.material)),
THREE.Object3D.prototype.clone.call(this, a),
a
},
THREE.LOD = function() {
THREE.Object3D.call(this),
this.objects = []
},
THREE.LOD.prototype = Object.create(THREE.Object3D.prototype),
THREE.LOD.prototype.addLevel = function(a, b) {
void 0 === b && (b = 0);
for (var b = Math.abs(b), c = 0; c < this.objects.length && !(b < this.objects[c].distance); c++);
this.objects.splice(c, 0, {
distance: b,
object: a
}),
this.add(a)
},
THREE.LOD.prototype.getObjectForDistance = function(a) {
for (var b = 1, c = this.objects.length; c > b && !(a < this.objects[b].distance); b++);
return this.objects[b - 1].object
},
THREE.LOD.prototype.update = function() {
var a = new THREE.Vector3,
b = new THREE.Vector3;
return function(c) {
if (1 < this.objects.length) {
a.getPositionFromMatrix(c.matrixWorld),
b.getPositionFromMatrix(this.matrixWorld),
c = a.distanceTo(b),
this.objects[0].object.visible = !0;
for (var d = 1, e = this.objects.length; e > d && c >= this.objects[d].distance; d++)
this.objects[d - 1].object.visible = !1,
this.objects[d].object.visible = !0;
for (; e > d; d++)
this.objects[d].object.visible = !1
}
}
} (),
THREE.LOD.prototype.clone = function() {},
THREE.Sprite = function(a) {
THREE.Object3D.call(this),
this.material = void 0 !== a ? a: new THREE.SpriteMaterial,
this.rotation3d = this.rotation,
this.rotation = 0
},
THREE.Sprite.prototype = Object.create(THREE.Object3D.prototype),
THREE.Sprite.prototype.updateMatrix = function() {
this.rotation3d.set(0, 0, this.rotation),
this.quaternion.setFromEuler(this.rotation3d, this.eulerOrder),
this.matrix.makeFromPositionQuaternionScale(this.position, this.quaternion, this.scale),
this.matrixWorldNeedsUpdate = !0
},
THREE.Sprite.prototype.clone = function(a) {
return void 0 === a && (a = new THREE.Sprite(this.material)),
THREE.Object3D.prototype.clone.call(this, a),
a
},
THREE.Scene = function() {
THREE.Object3D.call(this),
this.overrideMaterial = this.fog = null,
this.autoUpdate = !0,
this.matrixAutoUpdate = !1,
this.__objects = [],
this.__lights = [],
this.__objectsAdded = [],
this.__objectsRemoved = []
},
THREE.Scene.prototype = Object.create(THREE.Object3D.prototype),
THREE.Scene.prototype.__addObject = function(a) {
if (a instanceof THREE.Light) - 1 === this.__lights.indexOf(a) && this.__lights.push(a),
a.target && void 0 === a.target.parent && this.add(a.target);
else if (! (a instanceof THREE.Camera || a instanceof THREE.Bone) && -1 === this.__objects.indexOf(a)) {
this.__objects.push(a),
this.__objectsAdded.push(a);
var b = this.__objectsRemoved.indexOf(a); - 1 !== b && this.__objectsRemoved.splice(b, 1)
}
for (b = 0; b < a.children.length; b++)
this.__addObject(a.children[b])
},
THREE.Scene.prototype.__removeObject = function(a) {
if (a instanceof THREE.Light) {
var b = this.__lights.indexOf(a); - 1 !== b && this.__lights.splice(b, 1)
} else
a instanceof THREE.Camera || (b = this.__objects.indexOf(a), -1 !== b && (this.__objects.splice(b, 1), this.__objectsRemoved.push(a), b = this.__objectsAdded.indexOf(a), -1 !== b && this.__objectsAdded.splice(b, 1)));
for (b = 0; b < a.children.length; b++)
this.__removeObject(a.children[b])
},
THREE.Fog = function(a, b, c) {
this.name = "",
this.color = new THREE.Color(a),
this.near = void 0 !== b ? b: 1,
this.far = void 0 !== c ? c: 1e3
},
THREE.Fog.prototype.clone = function() {
return new THREE.Fog(this.color.getHex(), this.near, this.far)
},
THREE.FogExp2 = function(a, b) {
this.name = "",
this.color = new THREE.Color(a),
this.density = void 0 !== b ? b: 25e - 5
},
THREE.FogExp2.prototype.clone = function() {
return new THREE.FogExp2(this.color.getHex(), this.density)
},
THREE.CanvasRenderer = function(a) {
function b(a) {
bb !== a && (bb = $.globalAlpha = a)
}
function c(a) {
cb !== a && (a === THREE.NormalBlending ? $.globalCompositeOperation = "source-over": a === THREE.AdditiveBlending ? $.globalCompositeOperation = "lighter": a === THREE.SubtractiveBlending && ($.globalCompositeOperation = "darker"), cb = a)
}
function d(a) {
fb !== a && (fb = $.lineWidth = a)
}
function e(a) {
gb !== a && (gb = $.lineCap = a)
}
function f(a) {
hb !== a && (hb = $.lineJoin = a)
}
function g(a) {
db !== a && (db = $.strokeStyle = a)
}
function h(a) {
eb !== a && (eb = $.fillStyle = a)
}
function i(a, b) { (ib !== a || jb !== b) && ($.setLineDash([a, b]), ib = a, jb = b)
}
console.log("THREE.CanvasRenderer", THREE.REVISION);
var j,
k,
l,
m,
n,
o,
p,
q,
r,
s,
t,
u,
v,
w,
x,
y,
z,
A,
B,
C,
D,
E,
F,
G,
H,
I,
J,
K,
L,
M,
N,
O,
P,
Q,
R,
S,
T,
U,
V,
W = THREE.Math.smoothstep,
a = a || {},
X = this,
Y = new THREE.Projector,
Z = void 0 !== a.canvas ? a.canvas: document.createElement("canvas"),
$ = Z.getContext("2d"),
_ = new THREE.Color(0),
ab = 0,
bb = 1,
cb = 0,
db = null,
eb = null,
fb = null,
gb = null,
hb = null,
ib = null,
jb = 0,
kb = new THREE.RenderableVertex,
lb = new THREE.RenderableVertex,
mb = new THREE.Color,
nb = new THREE.Color,
ob = new THREE.Color,
pb = new THREE.Color,
qb = new THREE.Color,
rb = new THREE.Color,
sb = new THREE.Color,
tb = new THREE.Color,
ub = {},
vb = {},
wb = new THREE.Box2,
xb = new THREE.Box2,
yb = new THREE.Box2,
zb = new THREE.Color,
Ab = new THREE.Color,
Bb = new THREE.Color,
Cb = new THREE.Vector3,
Db = 16;
Q = document.createElement("canvas"),
Q.width = Q.height = 2,
R = Q.getContext("2d"),
R.fillStyle = "rgba(0,0,0,1)",
R.fillRect(0, 0, 2, 2),
S = R.getImageData(0, 0, 2, 2),
T = S.data,
U = document.createElement("canvas"),
U.width = U.height = Db,
V = U.getContext("2d"),
V.translate( - Db / 2, -Db / 2),
V.scale(Db, Db),
Db--,
void 0 === $.setLineDash && ($.setLineDash = void 0 !== $.mozDash ? function(a) {
$.mozDash = null !== a[0] ? a: null
}: function() {}),
this.domElement = Z,
this.devicePixelRatio = void 0 !== a.devicePixelRatio ? a.devicePixelRatio: void 0 !== window.devicePixelRatio ? window.devicePixelRatio: 1,
this.sortElements = this.sortObjects = this.autoClear = !0,
this.info = {
render: {
vertices: 0,
faces: 0
}
},
this.supportsVertexTextures = function() {},
this.setFaceCulling = function() {},
this.setSize = function(a, b, c) {
m = a * this.devicePixelRatio,
n = b * this.devicePixelRatio,
o = Math.floor(m / 2),
p = Math.floor(n / 2),
Z.width = m,
Z.height = n,
1 !== this.devicePixelRatio && !1 !== c && (Z.style.width = a + "px", Z.style.height = b + "px"),
wb.set(new THREE.Vector2( - o, -p), new THREE.Vector2(o, p)),
xb.set(new THREE.Vector2( - o, -p), new THREE.Vector2(o, p)),
bb = 1,
cb = 0,
hb = gb = fb = eb = db = null
},
this.setClearColor = function(a, b) {
_.set(a),
ab = void 0 !== b ? b: 1,
xb.set(new THREE.Vector2( - o, -p), new THREE.Vector2(o, p))
},
this.setClearColorHex = function(a, b) {
console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead."),
this.setClearColor(a, b)
},
this.getMaxAnisotropy = function() {
return 0
},
this.clear = function() {
$.setTransform(1, 0, 0, -1, o, p),
!1 === xb.empty() && (xb.intersect(wb), xb.expandByScalar(2), 1 > ab && $.clearRect(0 | xb.min.x, 0 | xb.min.y, xb.max.x - xb.min.x | 0, xb.max.y - xb.min.y | 0), ab > 0 && (c(THREE.NormalBlending), b(1), h("rgba(" + Math.floor(255 * _.r) + "," + Math.floor(255 * _.g) + "," + Math.floor(255 * _.b) + "," + ab + ")"), $.fillRect(0 | xb.min.x, 0 | xb.min.y, xb.max.x - xb.min.x | 0, xb.max.y - xb.min.y | 0)), xb.makeEmpty())
},
this.render = function(a, m) {
function n(a, b, c) {
for (var d = 0, e = l.length; e > d; d++) {
var f = l[d];
if (tb.copy(f.color), f instanceof THREE.DirectionalLight) {
var g = Cb.getPositionFromMatrix(f.matrixWorld).normalize(),
h = b.dot(g);
0 >= h || (h *= f.intensity, c.add(tb.multiplyScalar(h)))
} else
f instanceof THREE.PointLight && (g = Cb.getPositionFromMatrix(f.matrixWorld), h = b.dot(Cb.subVectors(g, a).normalize()), 0 >= h || (h *= 0 == f.distance ? 1: 1 - Math.min(a.distanceTo(g) / f.distance, 1), 0 != h && (h *= f.intensity, c.add(tb.multiplyScalar(h)))))
}
}
function Z(a, d, e, f, g, h, i, j) {
X.info.render.vertices += 3,
X.info.render.faces++,
b(j.opacity),
c(j.blending),
u = a.positionScreen.x,
v = a.positionScreen.y,
w = d.positionScreen.x,
x = d.positionScreen.y,
y = e.positionScreen.x,
z = e.positionScreen.y,
_(u, v, w, x, y, z),
(j instanceof THREE.MeshLambertMaterial || j instanceof THREE.MeshPhongMaterial) && null === j.map ? (rb.copy(j.color), sb.copy(j.emissive), j.vertexColors === THREE.FaceColors && rb.multiply(i.color), !1 === j.wireframe && j.shading == THREE.SmoothShading && 3 == i.vertexNormalsLength ? (nb.copy(zb), ob.copy(zb), pb.copy(zb), n(i.v1.positionWorld, i.vertexNormalsModel[0], nb), n(i.v2.positionWorld, i.vertexNormalsModel[1], ob), n(i.v3.positionWorld, i.vertexNormalsModel[2], pb), nb.multiply(rb).add(sb), ob.multiply(rb).add(sb), pb.multiply(rb).add(sb), qb.addColors(ob, pb).multiplyScalar(.5), I = fb(nb, ob, pb, qb), eb(u, v, w, x, y, z, 0, 0, 1, 0, 0, 1, I)) : (mb.copy(zb), n(i.centroidModel, i.normalModel, mb), mb.multiply(rb).add(sb), !0 === j.wireframe ? bb(mb, j.wireframeLinewidth, j.wireframeLinecap, j.wireframeLinejoin) : cb(mb))) : j instanceof THREE.MeshBasicMaterial || j instanceof THREE.MeshLambertMaterial || j instanceof THREE.MeshPhongMaterial ? null !== j.map ? j.map.mapping instanceof THREE.UVMapping && (J = i.uvs[0], db(u, v, w, x, y, z, J[f].x, J[f].y, J[g].x, J[g].y, J[h].x, J[h].y, j.map)) : null !== j.envMap ? j.envMap.mapping instanceof THREE.SphericalReflectionMapping && (Cb.copy(i.vertexNormalsModelView[f]), K = .5 * Cb.x + .5, L = .5 * Cb.y + .5, Cb.copy(i.vertexNormalsModelView[g]), M = .5 * Cb.x + .5, N = .5 * Cb.y + .5, Cb.copy(i.vertexNormalsModelView[h]), O = .5 * Cb.x + .5, P = .5 * Cb.y + .5, db(u, v, w, x, y, z, K, L, M, N, O, P, j.envMap)) : (mb.copy(j.color), j.vertexColors === THREE.FaceColors && mb.multiply(i.color), !0 === j.wireframe ? bb(mb, j.wireframeLinewidth, j.wireframeLinecap, j.wireframeLinejoin) : cb(mb)) : j instanceof THREE.MeshDepthMaterial ? (G = m.near, H = m.far, nb.r = nb.g = nb.b = 1 - W(a.positionScreen.z * a.positionScreen.w, G, H), ob.r = ob.g = ob.b = 1 - W(d.positionScreen.z * d.positionScreen.w, G, H), pb.r = pb.g = pb.b = 1 - W(e.positionScreen.z * e.positionScreen.w, G, H), qb.addColors(ob, pb).multiplyScalar(.5), I = fb(nb, ob, pb, qb), eb(u, v, w, x, y, z, 0, 0, 1, 0, 0, 1, I)) : j instanceof THREE.MeshNormalMaterial && (j.shading == THREE.FlatShading ? (a = i.normalModelView, mb.setRGB(a.x, a.y, a.z).multiplyScalar(.5).addScalar(.5), !0 === j.wireframe ? bb(mb, j.wireframeLinewidth, j.wireframeLinecap, j.wireframeLinejoin) : cb(mb)) : j.shading == THREE.SmoothShading && (a = i.vertexNormalsModelView[f], nb.setRGB(a.x, a.y, a.z).multiplyScalar(.5).addScalar(.5), a = i.vertexNormalsModelView[g], ob.setRGB(a.x, a.y, a.z).multiplyScalar(.5).addScalar(.5), a = i.vertexNormalsModelView[h], pb.setRGB(a.x, a.y, a.z).multiplyScalar(.5).addScalar(.5), qb.addColors(ob, pb).multiplyScalar(.5), I = fb(nb, ob, pb, qb), eb(u, v, w, x, y, z, 0, 0, 1, 0, 0, 1, I)))
}
function _(a, b, c, d, e, f) {
$.beginPath(),
$.moveTo(a, b),
$.lineTo(c, d),
$.lineTo(e, f),
$.closePath()
}
function ab(a, b, c, d, e, f, g, h) {
$.beginPath(),
$.moveTo(a, b),
$.lineTo(c, d),
$.lineTo(e, f),
$.lineTo(g, h),
$.closePath()
}
function bb(a, b, c, h) {
d(b),
e(c),
f(h),
g(a.getStyle()),
$.stroke(),
yb.expandByScalar(2 * b)
}
function cb(a) {
h(a.getStyle()),
$.fill()
}
function db(a, b, c, d, e, f, g, i, j, k, l, m, n) {
if (! (n instanceof THREE.DataTexture || void 0 === n.image || 0 == n.image.width)) {
if (!0 === n.needsUpdate) {
var o = n.wrapS == THREE.RepeatWrapping,
p = n.wrapT == THREE.RepeatWrapping;
ub[n.id] = $.createPattern(n.image, !0 === o && !0 === p ? "repeat": !0 === o && !1 === p ? "repeat-x": !1 === o && !0 === p ? "repeat-y": "no-repeat"),
n.needsUpdate = !1
}
h(void 0 === ub[n.id] ? "rgba(0,0,0,1)": ub[n.id]);
var o = n.offset.x / n.repeat.x,
p = n.offset.y / n.repeat.y,
q = n.image.width * n.repeat.x,
r = n.image.height * n.repeat.y,
g = (g + o) * q,
i = (1 - i + p) * r,
c = c - a,
d = d - b,
e = e - a,
f = f - b,
j = (j + o) * q - g,
k = (1 - k + p) * r - i,
l = (l + o) * q - g,
m = (1 - m + p) * r - i,
o = j * m - l * k;
0 === o ? (void 0 === vb[n.id] && (b = document.createElement("canvas"), b.width = n.image.width, b.height = n.image.height, b = b.getContext("2d"), b.drawImage(n.image, 0, 0), vb[n.id] = b.getImageData(0, 0, n.image.width, n.image.height).data), b = vb[n.id], g = 4 * (Math.floor(g) + Math.floor(i) * n.image.width), mb.setRGB(b[g] / 255, b[g + 1] / 255, b[g + 2] / 255), cb(mb)) : (o = 1 / o, n = (m * c - k * e) * o, k = (m * d - k * f) * o, c = (j * e - l * c) * o, d = (j * f - l * d) * o, a = a - n * g - c * i, g = b - k * g - d * i, $.save(), $.transform(n, k, c, d, a, g), $.fill(), $.restore())
}
}
function eb(a, b, c, d, e, f, g, h, i, j, k, l, m) {
var n,
o;
n = m.width - 1,
o = m.height - 1,
g *= n,
h *= o,
c -= a,
d -= b,
e -= a,
f -= b,
i = i * n - g,
j = j * o - h,
k = k * n - g,
l = l * o - h,
o = 1 / (i * l - k * j),
n = (l * c - j * e) * o,
j = (l * d - j * f) * o,
c = (i * e - k * c) * o,
d = (i * f - k * d) * o,
a = a - n * g - c * h,
b = b - j * g - d * h,
$.save(),
$.transform(n, j, c, d, a, b),
$.clip(),
$.drawImage(m, 0, 0),
$.restore()
}
function fb(a, b, c, d) {
return T[0] = 255 * a.r | 0,
T[1] = 255 * a.g | 0,
T[2] = 255 * a.b | 0,
T[4] = 255 * b.r | 0,
T[5] = 255 * b.g | 0,
T[6] = 255 * b.b | 0,
T[8] = 255 * c.r | 0,
T[9] = 255 * c.g | 0,
T[10] = 255 * c.b | 0,
T[12] = 255 * d.r | 0,
T[13] = 255 * d.g | 0,
T[14] = 255 * d.b | 0,
R.putImageData(S, 0, 0),
V.drawImage(Q, 0, 0),
U
}
function gb(a, b) {
var c = b.x - a.x,
d = b.y - a.y,
e = c * c + d * d;
0 !== e && (e = 1 / Math.sqrt(e), c *= e, d *= e, b.x += c, b.y += d, a.x -= c, a.y -= d)
}
if (!1 == m instanceof THREE.Camera)
console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
else { ! 0 === this.autoClear && this.clear(),
$.setTransform(1, 0, 0, -1, o, p),
X.info.render.vertices = 0,
X.info.render.faces = 0,
j = Y.projectScene(a, m, this.sortObjects, this.sortElements),
k = j.elements,
l = j.lights,
zb.setRGB(0, 0, 0),
Ab.setRGB(0, 0, 0),
Bb.setRGB(0, 0, 0);
for (var hb = 0, ib = l.length; ib > hb; hb++) {
var jb = l[hb],
Db = jb.color;
jb instanceof THREE.AmbientLight ? zb.add(Db) : jb instanceof THREE.DirectionalLight ? Ab.add(Db) : jb instanceof THREE.PointLight && Bb.add(Db)
}
for (hb = 0, ib = k.length; ib > hb; hb++) {
var Eb = k[hb],
jb = Eb.material;
if (void 0 !== jb && !1 !== jb.visible) {
if (yb.makeEmpty(), Eb instanceof THREE.RenderableParticle) {
q = Eb,
q.x *= o,
q.y *= p,
Db = q,
b(jb.opacity),
c(jb.blending);
var Fb = void 0,
Gb = void 0,
Hb = void 0,
Ib = void 0,
Jb = void 0,
Kb = void 0,
Lb = void 0;
jb instanceof THREE.ParticleBasicMaterial ? null === jb.map ? (Hb = Eb.object.scale.x, Ib = Eb.object.scale.y, Hb *= Eb.scale.x * o, Ib *= Eb.scale.y * p, yb.min.set(Db.x - Hb, Db.y - Ib), yb.max.set(Db.x + Hb, Db.y + Ib), !1 === wb.isIntersectionBox(yb) ? yb.makeEmpty() : (h(jb.color.getStyle()), $.save(), $.translate(Db.x, Db.y), $.rotate( - Eb.rotation), $.scale(Hb, Ib), $.fillRect( - 1, -1, 2, 2), $.restore())) : (Jb = jb.map.image, Kb = Jb.width >> 1, Lb = Jb.height >> 1, Hb = Eb.scale.x * o, Ib = Eb.scale.y * p, Fb = Hb * Kb, Gb = Ib * Lb, yb.min.set(Db.x - Fb, Db.y - Gb), yb.max.set(Db.x + Fb, Db.y + Gb), !1 === wb.isIntersectionBox(yb) ? yb.makeEmpty() : ($.save(), $.translate(Db.x, Db.y), $.rotate( - Eb.rotation), $.scale(Hb, -Ib), $.translate( - Kb, -Lb), $.drawImage(Jb, 0, 0), $.restore())) : jb instanceof THREE.ParticleCanvasMaterial && (Fb = Eb.scale.x * o, Gb = Eb.scale.y * p, yb.min.set(Db.x - Fb, Db.y - Gb), yb.max.set(Db.x + Fb, Db.y + Gb), !1 === wb.isIntersectionBox(yb) ? yb.makeEmpty() : (g(jb.color.getStyle()), h(jb.color.getStyle()), $.save(), $.translate(Db.x, Db.y), $.rotate( - Eb.rotation), $.scale(Fb, Gb), jb.program($), $.restore()))
} else if (Eb instanceof THREE.RenderableLine) {
if (q = Eb.v1, r = Eb.v2, q.positionScreen.x *= o, q.positionScreen.y *= p, r.positionScreen.x *= o, r.positionScreen.y *= p, yb.setFromPoints([q.positionScreen, r.positionScreen]), !0 === wb.isIntersectionBox(yb))
if (Db = q, Fb = r, b(jb.opacity), c(jb.blending), $.beginPath(), $.moveTo(Db.positionScreen.x, Db.positionScreen.y), $.lineTo(Fb.positionScreen.x, Fb.positionScreen.y), jb instanceof THREE.LineBasicMaterial) {
if (d(jb.linewidth), e(jb.linecap), f(jb.linejoin), jb.vertexColors !== THREE.VertexColors)
g(jb.color.getStyle());
else if (Gb = Eb.vertexColors[0].getStyle(), Eb = Eb.vertexColors[1].getStyle(), Gb === Eb)
g(Gb);
else {
try {
var Mb = $.createLinearGradient(Db.positionScreen.x, Db.positionScreen.y, Fb.positionScreen.x, Fb.positionScreen.y);
Mb.addColorStop(0, Gb),
Mb.addColorStop(1, Eb)
} catch(Nb) {
Mb = Gb
}
g(Mb)
}
$.stroke(),
yb.expandByScalar(2 * jb.linewidth)
} else
jb instanceof THREE.LineDashedMaterial && (d(jb.linewidth), e(jb.linecap), f(jb.linejoin), g(jb.color.getStyle()), i(jb.dashSize, jb.gapSize), $.stroke(), yb.expandByScalar(2 * jb.linewidth), i(null, null))
} else if (Eb instanceof THREE.RenderableFace3) {
if (q = Eb.v1, r = Eb.v2, s = Eb.v3, -1 > q.positionScreen.z || 1 < q.positionScreen.z)
continue;
if ( - 1 > r.positionScreen.z || 1 < r.positionScreen.z)
continue;
if ( - 1 > s.positionScreen.z || 1 < s.positionScreen.z)
continue;
q.positionScreen.x *= o,
q.positionScreen.y *= p,
r.positionScreen.x *= o,
r.positionScreen.y *= p,
s.positionScreen.x *= o,
s.positionScreen.y *= p,
!0 === jb.overdraw && (gb(q.positionScreen, r.positionScreen), gb(r.positionScreen, s.positionScreen), gb(s.positionScreen, q.positionScreen)),
yb.setFromPoints([q.positionScreen, r.positionScreen, s.positionScreen]),
!0 === wb.isIntersectionBox(yb) && Z(q, r, s, 0, 1, 2, Eb, jb)
} else if (Eb instanceof THREE.RenderableFace4) {
if (q = Eb.v1, r = Eb.v2, s = Eb.v3, t = Eb.v4, -1 > q.positionScreen.z || 1 < q.positionScreen.z)
continue;
if ( - 1 > r.positionScreen.z || 1 < r.positionScreen.z)
continue;
if ( - 1 > s.positionScreen.z || 1 < s.positionScreen.z)
continue;
if ( - 1 > t.positionScreen.z || 1 < t.positionScreen.z)
continue;
q.positionScreen.x *= o,
q.positionScreen.y *= p,
r.positionScreen.x *= o,
r.positionScreen.y *= p,
s.positionScreen.x *= o,
s.positionScreen.y *= p,
t.positionScreen.x *= o,
t.positionScreen.y *= p,
kb.positionScreen.copy(r.positionScreen),
lb.positionScreen.copy(t.positionScreen),
!0 === jb.overdraw && (gb(q.positionScreen, r.positionScreen), gb(r.positionScreen, t.positionScreen), gb(t.positionScreen, q.positionScreen), gb(s.positionScreen, kb.positionScreen), gb(s.positionScreen, lb.positionScreen)),
yb.setFromPoints([q.positionScreen, r.positionScreen, s.positionScreen, t.positionScreen]),
!0 === wb.isIntersectionBox(yb) && (Db = q, Fb = r, Gb = s, Hb = t, Ib = kb, Jb = lb, X.info.render.vertices += 4, X.info.render.faces++, b(jb.opacity), c(jb.blending), void 0 !== jb.map && null !== jb.map || void 0 !== jb.envMap && null !== jb.envMap ? (Z(Db, Fb, Hb, 0, 1, 3, Eb, jb), Z(Ib, Gb, Jb, 1, 2, 3, Eb, jb)) : (u = Db.positionScreen.x, v = Db.positionScreen.y, w = Fb.positionScreen.x, x = Fb.positionScreen.y, y = Gb.positionScreen.x, z = Gb.positionScreen.y, A = Hb.positionScreen.x, B = Hb.positionScreen.y, C = Ib.positionScreen.x, D = Ib.positionScreen.y, E = Jb.positionScreen.x, F = Jb.positionScreen.y, jb instanceof THREE.MeshLambertMaterial || jb instanceof THREE.MeshPhongMaterial ? (rb.copy(jb.color), sb.copy(jb.emissive), jb.vertexColors === THREE.FaceColors && rb.multiply(Eb.color), !1 === jb.wireframe && jb.shading == THREE.SmoothShading && 4 == Eb.vertexNormalsLength ? (nb.copy(zb), ob.copy(zb), pb.copy(zb), qb.copy(zb), n(Eb.v1.positionWorld, Eb.vertexNormalsModel[0], nb), n(Eb.v2.positionWorld, Eb.vertexNormalsModel[1], ob), n(Eb.v4.positionWorld, Eb.vertexNormalsModel[3], pb), n(Eb.v3.positionWorld, Eb.vertexNormalsModel[2], qb), nb.multiply(rb).add(sb), ob.multiply(rb).add(sb), pb.multiply(rb).add(sb), qb.multiply(rb).add(sb), I = fb(nb, ob, pb, qb), _(u, v, w, x, A, B), eb(u, v, w, x, A, B, 0, 0, 1, 0, 0, 1, I), _(C, D, y, z, E, F), eb(C, D, y, z, E, F, 1, 0, 1, 1, 0, 1, I)) : (mb.copy(zb), n(Eb.centroidModel, Eb.normalModel, mb), mb.multiply(rb).add(sb), ab(u, v, w, x, y, z, A, B), !0 === jb.wireframe ? bb(mb, jb.wireframeLinewidth, jb.wireframeLinecap, jb.wireframeLinejoin) : cb(mb))) : jb instanceof THREE.MeshBasicMaterial ? (mb.copy(jb.color), jb.vertexColors === THREE.FaceColors && mb.multiply(Eb.color), ab(u, v, w, x, y, z, A, B), !0 === jb.wireframe ? bb(mb, jb.wireframeLinewidth, jb.wireframeLinecap, jb.wireframeLinejoin) : cb(mb)) : jb instanceof THREE.MeshNormalMaterial ? (Db = void 0, jb.shading == THREE.FlatShading ? (Db = Eb.normalModelView, mb.setRGB(Db.x, Db.y, Db.z).multiplyScalar(.5).addScalar(.5), ab(u, v, w, x, y, z, A, B), !0 === jb.wireframe ? bb(mb, jb.wireframeLinewidth, jb.wireframeLinecap, jb.wireframeLinejoin) : cb(mb)) : jb.shading == THREE.SmoothShading && (Db = Eb.vertexNormalsModelView[0], nb.setRGB(Db.x, Db.y, Db.z).multiplyScalar(.5).addScalar(.5), Db = Eb.vertexNormalsModelView[1], ob.setRGB(Db.x, Db.y, Db.z).multiplyScalar(.5).addScalar(.5), Db = Eb.vertexNormalsModelView[3], pb.setRGB(Db.x, Db.y, Db.z).multiplyScalar(.5).addScalar(.5), Db = Eb.vertexNormalsModelView[2], qb.setRGB(Db.x, Db.y, Db.z).multiplyScalar(.5).addScalar(.5), I = fb(nb, ob, pb, qb), _(u, v, w, x, A, B), eb(u, v, w, x, A, B, 0, 0, 1, 0, 0, 1, I), _(C, D, y, z, E, F), eb(C, D, y, z, E, F, 1, 0, 1, 1, 0, 1, I))) : jb instanceof THREE.MeshDepthMaterial && (G = m.near, H = m.far, nb.r = nb.g = nb.b = 1 - W(Db.positionScreen.z * Db.positionScreen.w, G, H), ob.r = ob.g = ob.b = 1 - W(Fb.positionScreen.z * Fb.positionScreen.w, G, H), pb.r = pb.g = pb.b = 1 - W(Hb.positionScreen.z * Hb.positionScreen.w, G, H), qb.r = qb.g = qb.b = 1 - W(Gb.positionScreen.z * Gb.positionScreen.w, G, H), I = fb(nb, ob, pb, qb), _(u, v, w, x, A, B), eb(u, v, w, x, A, B, 0, 0, 1, 0, 0, 1, I), _(C, D, y, z, E, F), eb(C, D, y, z, E, F, 1, 0, 1, 1, 0, 1, I))))
}
xb.union(yb)
}
}
$.setTransform(1, 0, 0, 1, 0, 0)
}
}
},
THREE.ShaderChunk = {
fog_pars_fragment: "#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",
fog_fragment: "#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment: "#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",
envmap_fragment: "#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
envmap_pars_vertex: "#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
worldpos_vertex: "#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
envmap_vertex: "#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",
map_particle_pars_fragment: "#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
map_particle_fragment: "#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) );\n#endif",
map_pars_vertex: "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",
map_pars_fragment: "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
map_vertex: "#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP )\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",
map_fragment: "#ifdef USE_MAP\nvec4 texelColor = texture2D( map, vUv );\n#ifdef GAMMA_INPUT\ntexelColor.xyz *= texelColor.xyz;\n#endif\ngl_FragColor = gl_FragColor * texelColor;\n#endif",
lightmap_pars_fragment: "#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
lightmap_pars_vertex: "#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
lightmap_fragment: "#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",
lightmap_vertex: "#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",
bumpmap_pars_fragment: "#ifdef USE_BUMPMAP\nuniform sampler2D bumpMap;\nuniform float bumpScale;\nvec2 dHdxy_fwd() {\nvec2 dSTdx = dFdx( vUv );\nvec2 dSTdy = dFdy( vUv );\nfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\nfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\nfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\nreturn vec2( dBx, dBy );\n}\nvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\nvec3 vSigmaX = dFdx( surf_pos );\nvec3 vSigmaY = dFdy( surf_pos );\nvec3 vN = surf_norm;\nvec3 R1 = cross( vSigmaY, vN );\nvec3 R2 = cross( vN, vSigmaX );\nfloat fDet = dot( vSigmaX, R1 );\nvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\nreturn normalize( abs( fDet ) * surf_norm - vGrad );\n}\n#endif",
normalmap_pars_fragment: "#ifdef USE_NORMALMAP\nuniform sampler2D normalMap;\nuniform vec2 normalScale;\nvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\nvec3 q0 = dFdx( eye_pos.xyz );\nvec3 q1 = dFdy( eye_pos.xyz );\nvec2 st0 = dFdx( vUv.st );\nvec2 st1 = dFdy( vUv.st );\nvec3 S = normalize( q0 * st1.t - q1 * st0.t );\nvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\nvec3 N = normalize( surf_norm );\nvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\nmapN.xy = normalScale * mapN.xy;\nmat3 tsn = mat3( S, T, N );\nreturn normalize( tsn * mapN );\n}\n#endif",
specularmap_pars_fragment: "#ifdef USE_SPECULARMAP\nuniform sampler2D specularMap;\n#endif",
specularmap_fragment: "float specularStrength;\n#ifdef USE_SPECULARMAP\nvec4 texelSpecular = texture2D( specularMap, vUv );\nspecularStrength = texelSpecular.r;\n#else\nspecularStrength = 1.0;\n#endif",
lights_lambert_pars_vertex: "uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
lights_lambert_vertex: "vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\nspotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\nspotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += spotLightColor[ i ] * spotLightWeighting * lDistance * spotEffect;\n#ifdef DOUBLE_SIDED\nvLightBack += spotLightColor[ i ] * spotLightWeightingBack * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nfloat hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;\nvLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n#ifdef DOUBLE_SIDED\nvLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );\n#endif\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor + emissive;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor + emissive;\n#endif",
lights_phong_pars_vertex: "#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif",
lights_phong_vertex: "#ifndef PHONG_PER_PIXEL\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nfor( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nvSpotLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvWorldPosition = worldPosition.xyz;\n#endif",
lights_phong_pars_fragment: "uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#else\nvarying vec4 vSpotLight[ MAX_SPOT_LIGHTS ];\n#endif\n#endif\n#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP )\nvarying vec3 vWorldPosition;\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
lights_phong_fragment: "vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#ifdef USE_NORMALMAP\nnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\nnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / spotLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vSpotLight[ i ].xyz );\nfloat lDistance = vSpotLight[ i ].w;\n#endif\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dotProduct, 0.0 );\n#endif\nspotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * lDistance * spotEffect;\nvec3 spotHalfVector = normalize( lVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += specular * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += diffuse * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularStrength * max( pow( hemiDotNormalHalfGround, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( shininess + 2.0001 ) / 8.0;\nvec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += specular * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
color_pars_fragment: "#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",
color_fragment: "#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",
color_pars_vertex: "#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",
color_vertex: "#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",
skinning_pars_vertex: "#ifdef USE_SKINNING\n#ifdef BONE_TEXTURE\nuniform sampler2D boneTexture;\nmat4 getBoneMatrix( const in float i ) {\nfloat j = i * 4.0;\nfloat x = mod( j, N_BONE_PIXEL_X );\nfloat y = floor( j / N_BONE_PIXEL_X );\nconst float dx = 1.0 / N_BONE_PIXEL_X;\nconst float dy = 1.0 / N_BONE_PIXEL_Y;\ny = dy * ( y + 0.5 );\nvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\nvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\nvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\nvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\nmat4 bone = mat4( v1, v2, v3, v4 );\nreturn bone;\n}\n#else\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\nmat4 getBoneMatrix( const in float i ) {\nmat4 bone = boneGlobalMatrices[ int(i) ];\nreturn bone;\n}\n#endif\n#endif",
skinbase_vertex: "#ifdef USE_SKINNING\nmat4 boneMatX = getBoneMatrix( skinIndex.x );\nmat4 boneMatY = getBoneMatrix( skinIndex.y );\n#endif",
skinning_vertex: "#ifdef USE_SKINNING\n#ifdef USE_MORPHTARGETS\nvec4 skinVertex = vec4( morphed, 1.0 );\n#else\nvec4 skinVertex = vec4( position, 1.0 );\n#endif\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned += boneMatY * skinVertex * skinWeight.y;\n#endif",
morphtarget_pars_vertex: "#ifdef USE_MORPHTARGETS\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[ 8 ];\n#else\nuniform float morphTargetInfluences[ 4 ];\n#endif\n#endif",
morphtarget_vertex: "#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n#ifndef USE_MORPHNORMALS\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n#endif\nmorphed += position;\n#endif",
default_vertex: "vec4 mvPosition;\n#ifdef USE_SKINNING\nmvPosition = modelViewMatrix * skinned;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( morphed, 1.0 );\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHTARGETS )\nmvPosition = modelViewMatrix * vec4( position, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;",
morphnormal_vertex: "#ifdef USE_MORPHNORMALS\nvec3 morphedNormal = vec3( 0.0 );\nmorphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\nmorphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\nmorphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\nmorphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\nmorphedNormal += normal;\n#endif",
skinnormal_vertex: "#ifdef USE_SKINNING\nmat4 skinMatrix = skinWeight.x * boneMatX;\nskinMatrix += skinWeight.y * boneMatY;\n#ifdef USE_MORPHNORMALS\nvec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );\n#else\nvec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );\n#endif\n#endif",
defaultnormal_vertex: "vec3 objectNormal;\n#ifdef USE_SKINNING\nobjectNormal = skinnedNormal.xyz;\n#endif\n#if !defined( USE_SKINNING ) && defined( USE_MORPHNORMALS )\nobjectNormal = morphedNormal;\n#endif\n#if !defined( USE_SKINNING ) && ! defined( USE_MORPHNORMALS )\nobjectNormal = normal;\n#endif\n#ifdef FLIP_SIDED\nobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;",
shadowmap_pars_fragment: "#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
shadowmap_fragment: "#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#if defined( SHADOWMAP_TYPE_PCF )\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\nfloat shadow = 0.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.0 * xPixelOffset;\nfloat dy0 = -1.0 * yPixelOffset;\nfloat dx1 = 1.0 * xPixelOffset;\nfloat dy1 = 1.0 * yPixelOffset;\nmat3 shadowKernel;\nmat3 depthKernel;\ndepthKernel[0][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\ndepthKernel[0][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\ndepthKernel[0][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\ndepthKernel[1][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\ndepthKernel[1][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\ndepthKernel[1][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\ndepthKernel[2][0] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\ndepthKernel[2][1] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\ndepthKernel[2][2] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nvec3 shadowZ = vec3( shadowCoord.z );\nshadowKernel[0] = vec3(lessThan(depthKernel[0], shadowZ ));\nshadowKernel[0] *= vec3(0.25);\nshadowKernel[1] = vec3(lessThan(depthKernel[1], shadowZ ));\nshadowKernel[1] *= vec3(0.25);\nshadowKernel[2] = vec3(lessThan(depthKernel[2], shadowZ ));\nshadowKernel[2] *= vec3(0.25);\nvec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[i].xy );\nshadowKernel[0] = mix( shadowKernel[1], shadowKernel[0], fractionalCoord.x );\nshadowKernel[1] = mix( shadowKernel[2], shadowKernel[1], fractionalCoord.x );\nvec4 shadowValues;\nshadowValues.x = mix( shadowKernel[0][1], shadowKernel[0][0], fractionalCoord.y );\nshadowValues.y = mix( shadowKernel[0][2], shadowKernel[0][1], fractionalCoord.y );\nshadowValues.z = mix( shadowKernel[1][1], shadowKernel[1][0], fractionalCoord.y );\nshadowValues.w = mix( shadowKernel[1][2], shadowKernel[1][1], fractionalCoord.y );\nshadow = dot( shadowValues, vec4( 1.0 ) );\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
shadowmap_pars_vertex: "#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",
shadowmap_vertex: "#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif",
alphatest_fragment: "#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",
linear_to_gamma_fragment: "#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"
},
THREE.UniformsUtils = {
merge: function(a) {
var b,
c,
d,
e = {};
for (b = 0; b < a.length; b++)
for (c in d = this.clone(a[b]))
e[c] = d[c];
return e
},
clone: function(a) {
var b,
c,
d,
e = {};
for (b in a)
for (c in e[b] = {}, a[b])
d = a[b][c],
e[b][c] = d instanceof THREE.Color || d instanceof THREE.Vector2 || d instanceof THREE.Vector3 || d instanceof THREE.Vector4 || d instanceof THREE.Matrix4 || d instanceof THREE.Texture ? d.clone() : d instanceof Array ? d.slice() : d;
return e
}
},
THREE.UniformsLib = {
common: {
diffuse: {
type: "c",
value: new THREE.Color(15658734)
},
opacity: {
type: "f",
value: 1
},
map: {
type: "t",
value: null
},
offsetRepeat: {
type: "v4",
value: new THREE.Vector4(0, 0, 1, 1)
},
lightMap: {
type: "t",
value: null
},
specularMap: {
type: "t",
value: null
},
envMap: {
type: "t",
value: null
},
flipEnvMap: {
type: "f",
value: -1
},
useRefract: {
type: "i",
value: 0
},
reflectivity: {
type: "f",
value: 1
},
refractionRatio: {
type: "f",
value: .98
},
combine: {
type: "i",
value: 0
},
morphTargetInfluences: {
type: "f",
value: 0
}
},
bump: {
bumpMap: {
type: "t",
value: null
},
bumpScale: {
type: "f",
value: 1
}
},
normalmap: {
normalMap: {
type: "t",
value: null
},
normalScale: {
type: "v2",
value: new THREE.Vector2(1, 1)
}
},
fog: {
fogDensity: {
type: "f",
value: 25e - 5
},
fogNear: {
type: "f",
value: 1
},
fogFar: {
type: "f",
value: 2e3
},
fogColor: {
type: "c",
value: new THREE.Color(16777215)
}
},
lights: {
ambientLightColor: {
type: "fv",
value: []
},
directionalLightDirection: {
type: "fv",
value: []
},
directionalLightColor: {
type: "fv",
value: []
},
hemisphereLightDirection: {
type: "fv",
value: []
},
hemisphereLightSkyColor: {
type: "fv",
value: []
},
hemisphereLightGroundColor: {
type: "fv",
value: []
},
pointLightColor: {
type: "fv",
value: []
},
pointLightPosition: {
type: "fv",
value: []
},
pointLightDistance: {
type: "fv1",
value: []
},
spotLightColor: {
type: "fv",
value: []
},
spotLightPosition: {
type: "fv",
value: []
},
spotLightDirection: {
type: "fv",
value: []
},
spotLightDistance: {
type: "fv1",
value: []
},
spotLightAngleCos: {
type: "fv1",
value: []
},
spotLightExponent: {
type: "fv1",
value: []
}
},
particle: {
psColor: {
type: "c",
value: new THREE.Color(15658734)
},
opacity: {
type: "f",
value: 1
},
size: {
type: "f",
value: 1
},
scale: {
type: "f",
value: 1
},
map: {
type: "t",
value: null
},
fogDensity: {
type: "f",
value: 25e - 5
},
fogNear: {
type: "f",
value: 1
},
fogFar: {
type: "f",
value: 2e3
},
fogColor: {
type: "c",
value: new THREE.Color(16777215)
}
},
shadowmap: {
shadowMap: {
type: "tv",
value: []
},
shadowMapSize: {
type: "v2v",
value: []
},
shadowBias: {
type: "fv1",
value: []
},
shadowDarkness: {
type: "fv1",
value: []
},
shadowMatrix: {
type: "m4v",
value: []
}
}
},
THREE.ShaderLib = {
basic: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common, THREE.UniformsLib.fog, THREE.UniformsLib.shadowmap]),
vertexShader: [THREE.ShaderChunk.map_pars_vertex, THREE.ShaderChunk.lightmap_pars_vertex, THREE.ShaderChunk.envmap_pars_vertex, THREE.ShaderChunk.color_pars_vertex, THREE.ShaderChunk.morphtarget_pars_vertex, THREE.ShaderChunk.skinning_pars_vertex, THREE.ShaderChunk.shadowmap_pars_vertex, "void main() {", THREE.ShaderChunk.map_vertex, THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.color_vertex, THREE.ShaderChunk.skinbase_vertex, "#ifdef USE_ENVMAP", THREE.ShaderChunk.morphnormal_vertex, THREE.ShaderChunk.skinnormal_vertex, THREE.ShaderChunk.defaultnormal_vertex, "#endif", THREE.ShaderChunk.morphtarget_vertex, THREE.ShaderChunk.skinning_vertex, THREE.ShaderChunk.default_vertex, THREE.ShaderChunk.worldpos_vertex, THREE.ShaderChunk.envmap_vertex, THREE.ShaderChunk.shadowmap_vertex, "}"].join("\n"),
fragmentShader: ["uniform vec3 diffuse;\nuniform float opacity;", THREE.ShaderChunk.color_pars_fragment, THREE.ShaderChunk.map_pars_fragment, THREE.ShaderChunk.lightmap_pars_fragment, THREE.ShaderChunk.envmap_pars_fragment, THREE.ShaderChunk.fog_pars_fragment, THREE.ShaderChunk.shadowmap_pars_fragment, THREE.ShaderChunk.specularmap_pars_fragment, "void main() {\ngl_FragColor = vec4( diffuse, opacity );", THREE.ShaderChunk.map_fragment, THREE.ShaderChunk.alphatest_fragment, THREE.ShaderChunk.specularmap_fragment, THREE.ShaderChunk.lightmap_fragment, THREE.ShaderChunk.color_fragment, THREE.ShaderChunk.envmap_fragment, THREE.ShaderChunk.shadowmap_fragment, THREE.ShaderChunk.linear_to_gamma_fragment, THREE.ShaderChunk.fog_fragment, "}"].join("\n")
},
lambert: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common, THREE.UniformsLib.fog, THREE.UniformsLib.lights, THREE.UniformsLib.shadowmap, {
ambient: {
type: "c",
value: new THREE.Color(16777215)
},
emissive: {
type: "c",
value: new THREE.Color(0)
},
wrapRGB: {
type: "v3",
value: new THREE.Vector3(1, 1, 1)
}
}]),
vertexShader: ["#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif", THREE.ShaderChunk.map_pars_vertex, THREE.ShaderChunk.lightmap_pars_vertex, THREE.ShaderChunk.envmap_pars_vertex, THREE.ShaderChunk.lights_lambert_pars_vertex, THREE.ShaderChunk.color_pars_vertex, THREE.ShaderChunk.morphtarget_pars_vertex, THREE.ShaderChunk.skinning_pars_vertex, THREE.ShaderChunk.shadowmap_pars_vertex, "void main() {", THREE.ShaderChunk.map_vertex, THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.color_vertex, THREE.ShaderChunk.morphnormal_vertex, THREE.ShaderChunk.skinbase_vertex, THREE.ShaderChunk.skinnormal_vertex, THREE.ShaderChunk.defaultnormal_vertex, THREE.ShaderChunk.morphtarget_vertex, THREE.ShaderChunk.skinning_vertex, THREE.ShaderChunk.default_vertex, THREE.ShaderChunk.worldpos_vertex, THREE.ShaderChunk.envmap_vertex, THREE.ShaderChunk.lights_lambert_vertex, THREE.ShaderChunk.shadowmap_vertex, "}"].join("\n"),
fragmentShader: ["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif", THREE.ShaderChunk.color_pars_fragment, THREE.ShaderChunk.map_pars_fragment, THREE.ShaderChunk.lightmap_pars_fragment, THREE.ShaderChunk.envmap_pars_fragment, THREE.ShaderChunk.fog_pars_fragment, THREE.ShaderChunk.shadowmap_pars_fragment, THREE.ShaderChunk.specularmap_pars_fragment, "void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );", THREE.ShaderChunk.map_fragment, THREE.ShaderChunk.alphatest_fragment, THREE.ShaderChunk.specularmap_fragment, "#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif", THREE.ShaderChunk.lightmap_fragment, THREE.ShaderChunk.color_fragment, THREE.ShaderChunk.envmap_fragment, THREE.ShaderChunk.shadowmap_fragment, THREE.ShaderChunk.linear_to_gamma_fragment, THREE.ShaderChunk.fog_fragment, "}"].join("\n")
},
phong: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common, THREE.UniformsLib.bump, THREE.UniformsLib.normalmap, THREE.UniformsLib.fog, THREE.UniformsLib.lights, THREE.UniformsLib.shadowmap, {
ambient: {
type: "c",
value: new THREE.Color(16777215)
},
emissive: {
type: "c",
value: new THREE.Color(0)
},
specular: {
type: "c",
value: new THREE.Color(1118481)
},
shininess: {
type: "f",
value: 30
},
wrapRGB: {
type: "v3",
value: new THREE.Vector3(1, 1, 1)
}
}]),
vertexShader: ["#define PHONG\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;", THREE.ShaderChunk.map_pars_vertex, THREE.ShaderChunk.lightmap_pars_vertex, THREE.ShaderChunk.envmap_pars_vertex, THREE.ShaderChunk.lights_phong_pars_vertex, THREE.ShaderChunk.color_pars_vertex, THREE.ShaderChunk.morphtarget_pars_vertex, THREE.ShaderChunk.skinning_pars_vertex, THREE.ShaderChunk.shadowmap_pars_vertex, "void main() {", THREE.ShaderChunk.map_vertex, THREE.ShaderChunk.lightmap_vertex, THREE.ShaderChunk.color_vertex, THREE.ShaderChunk.morphnormal_vertex, THREE.ShaderChunk.skinbase_vertex, THREE.ShaderChunk.skinnormal_vertex, THREE.ShaderChunk.defaultnormal_vertex, "vNormal = normalize( transformedNormal );", THREE.ShaderChunk.morphtarget_vertex, THREE.ShaderChunk.skinning_vertex, THREE.ShaderChunk.default_vertex, "vViewPosition = -mvPosition.xyz;", THREE.ShaderChunk.worldpos_vertex, THREE.ShaderChunk.envmap_vertex, THREE.ShaderChunk.lights_phong_vertex, THREE.ShaderChunk.shadowmap_vertex, "}"].join("\n"),
fragmentShader: ["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;", THREE.ShaderChunk.color_pars_fragment, THREE.ShaderChunk.map_pars_fragment, THREE.ShaderChunk.lightmap_pars_fragment, THREE.ShaderChunk.envmap_pars_fragment, THREE.ShaderChunk.fog_pars_fragment, THREE.ShaderChunk.lights_phong_pars_fragment, THREE.ShaderChunk.shadowmap_pars_fragment, THREE.ShaderChunk.bumpmap_pars_fragment, THREE.ShaderChunk.normalmap_pars_fragment, THREE.ShaderChunk.specularmap_pars_fragment, "void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );", THREE.ShaderChunk.map_fragment, THREE.ShaderChunk.alphatest_fragment, THREE.ShaderChunk.specularmap_fragment, THREE.ShaderChunk.lights_phong_fragment, THREE.ShaderChunk.lightmap_fragment, THREE.ShaderChunk.color_fragment, THREE.ShaderChunk.envmap_fragment, THREE.ShaderChunk.shadowmap_fragment, THREE.ShaderChunk.linear_to_gamma_fragment, THREE.ShaderChunk.fog_fragment, "}"].join("\n")
},
particle_basic: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.particle, THREE.UniformsLib.shadowmap]),
vertexShader: ["uniform float size;\nuniform float scale;", THREE.ShaderChunk.color_pars_vertex, THREE.ShaderChunk.shadowmap_pars_vertex, "void main() {", THREE.ShaderChunk.color_vertex, "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;", THREE.ShaderChunk.worldpos_vertex, THREE.ShaderChunk.shadowmap_vertex, "}"].join("\n"),
fragmentShader: ["uniform vec3 psColor;\nuniform float opacity;", THREE.ShaderChunk.color_pars_fragment, THREE.ShaderChunk.map_particle_pars_fragment, THREE.ShaderChunk.fog_pars_fragment, THREE.ShaderChunk.shadowmap_pars_fragment, "void main() {\ngl_FragColor = vec4( psColor, opacity );", THREE.ShaderChunk.map_particle_fragment, THREE.ShaderChunk.alphatest_fragment, THREE.ShaderChunk.color_fragment, THREE.ShaderChunk.shadowmap_fragment, THREE.ShaderChunk.fog_fragment, "}"].join("\n")
},
dashed: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.common, THREE.UniformsLib.fog, {
scale: {
type: "f",
value: 1
},
dashSize: {
type: "f",
value: 1
},
totalSize: {
type: "f",
value: 2
}
}]),
vertexShader: ["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;", THREE.ShaderChunk.color_pars_vertex, "void main() {", THREE.ShaderChunk.color_vertex, "vLineDistance = scale * lineDistance;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
fragmentShader: ["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;", THREE.ShaderChunk.color_pars_fragment, THREE.ShaderChunk.fog_pars_fragment, "void main() {\nif ( mod( vLineDistance, totalSize ) > dashSize ) {\ndiscard;\n}\ngl_FragColor = vec4( diffuse, opacity );", THREE.ShaderChunk.color_fragment, THREE.ShaderChunk.fog_fragment, "}"].join("\n")
},
depth: {
uniforms: {
mNear: {
type: "f",
value: 1
},
mFar: {
type: "f",
value: 2e3
},
opacity: {
type: "f",
value: 1
}
},
vertexShader: "void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
fragmentShader: "uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"
},
normal: {
uniforms: {
opacity: {
type: "f",
value: 1
}
},
vertexShader: ["varying vec3 vNormal;", THREE.ShaderChunk.morphtarget_pars_vertex, "void main() {\nvNormal = normalize( normalMatrix * normal );", THREE.ShaderChunk.morphtarget_vertex, THREE.ShaderChunk.default_vertex, "}"].join("\n"),
fragmentShader: "uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"
},
normalmap: {
uniforms: THREE.UniformsUtils.merge([THREE.UniformsLib.fog, THREE.UniformsLib.lights, THREE.UniformsLib.shadowmap, {
enableAO: {
type: "i",
value: 0
},
enableDiffuse: {
type: "i",
value: 0
},
enableSpecular: {
type: "i",
value: 0
},
enableReflection: {
type: "i",
value: 0
},
enableDisplacement: {
type: "i",
value: 0
},
tDisplacement: {
type: "t",
value: null
},
tDiffuse: {
type: "t",
value: null
},
tCube: {
type: "t",
value: null
},
tNormal: {
type: "t",
value: null
},
tSpecular: {
type: "t",
value: null
},
tAO: {
type: "t",
value: null
},
uNormalScale: {
type: "v2",
value: new THREE.Vector2(1, 1)
},
uDisplacementBias: {
type: "f",
value: 0
},
uDisplacementScale: {
type: "f",
value: 1
},
uDiffuseColor: {
type: "c",
value: new THREE.Color(16777215)
},
uSpecularColor: {
type: "c",
value: new THREE.Color(1118481)
},
uAmbientColor: {
type: "c",
value: new THREE.Color(16777215)
},
uShininess: {
type: "f",
value: 30
},
uOpacity: {
type: "f",
value: 1
},
useRefract: {
type: "i",
value: 0
},
uRefractionRatio: {
type: "f",
value: .98
},
uReflectivity: {
type: "f",
value: .5
},
uOffset: {
type: "v2",
value: new THREE.Vector2(0, 0)
},
uRepeat: {
type: "v2",
value: new THREE.Vector2(1, 1)
},
wrapRGB: {
type: "v3",
value: new THREE.Vector3(1, 1, 1)
}
}]),
fragmentShader: ["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform vec2 uNormalScale;\nuniform bool useRefract;\nuniform float uRefractionRatio;\nuniform float uReflectivity;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_HEMI_LIGHTS > 0\nuniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\nuniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#if MAX_SPOT_LIGHTS > 0\nuniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];\nuniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];\nuniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];\nuniform float spotLightExponent[ MAX_SPOT_LIGHTS ];\nuniform float spotLightDistance[ MAX_SPOT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;", THREE.ShaderChunk.shadowmap_pars_fragment, THREE.ShaderChunk.fog_pars_fragment, "void main() {\ngl_FragColor = vec4( vec3( 1.0 ), uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse ) {\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( tDiffuse, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\n#endif\n}\nif( enableAO ) {\n#ifdef GAMMA_INPUT\nvec4 aoColor = texture2D( tAO, vUv );\naoColor.xyz *= aoColor.xyz;\ngl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\n#endif\n}\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );\nvec3 finalNormal = tsb * normalTex;\n#ifdef FLIP_SIDED\nfinalNormal = -finalNormal;\n#endif\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointVector = lPosition.xyz + vViewPosition.xyz;\nfloat pointDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\npointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );\npointVector = normalize( pointVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\n#endif\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\nvec3 pointHalfVector = normalize( pointVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;\n#else\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_SPOT_LIGHTS > 0\nvec3 spotDiffuse = vec3( 0.0 );\nvec3 spotSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\nvec3 spotVector = lPosition.xyz + vViewPosition.xyz;\nfloat spotDistance = 1.0;\nif ( spotLightDistance[ i ] > 0.0 )\nspotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );\nspotVector = normalize( spotVector );\nfloat spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\nif ( spotEffect > spotLightAngleCos[ i ] ) {\nspotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );\n#ifdef WRAP_AROUND\nfloat spotDiffuseWeightFull = max( dot( normal, spotVector ), 0.0 );\nfloat spotDiffuseWeightHalf = max( 0.5 * dot( normal, spotVector ) + 0.5, 0.0 );\nvec3 spotDiffuseWeight = mix( vec3 ( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n#else\nfloat spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );\n#endif\nspotDiffuse += spotDistance * spotLightColor[ i ] * uDiffuseColor * spotDiffuseWeight * spotEffect;\nvec3 spotHalfVector = normalize( spotVector + viewPosition );\nfloat spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\nfloat spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );\nspotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;\n#else\nspotSpecular += spotDistance * spotLightColor[ i ] * uSpecularColor * spotSpecularWeight * spotDiffuseWeight * spotEffect;\n#endif\n}\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );\nfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n#endif\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlick = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n#else\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\n#if MAX_HEMI_LIGHTS > 0\nvec3 hemiDiffuse = vec3( 0.0 );\nvec3 hemiSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );\nvec3 lVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, lVector );\nfloat hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\nvec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\nhemiDiffuse += uDiffuseColor * hemiColor;\nvec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\nfloat hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\nfloat hemiSpecularWeightSky = specularTex.r * max( pow( hemiDotNormalHalfSky, uShininess ), 0.0 );\nvec3 lVectorGround = -lVector;\nvec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\nfloat hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\nfloat hemiSpecularWeightGround = specularTex.r * max( pow( hemiDotNormalHalfGround, uShininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nfloat dotProductGround = dot( normal, lVectorGround );\nfloat specularNormalization = ( uShininess + 2.0001 ) / 8.0;\nvec3 schlickSky = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );\nvec3 schlickGround = uSpecularColor + vec3( 1.0 - uSpecularColor ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );\nhemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n#else\nhemiSpecular += uSpecularColor * hemiColor * ( hemiSpecularWeightSky + hemiSpecularWeightGround ) * hemiDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_HEMI_LIGHTS > 0\ntotalDiffuse += hemiDiffuse;\ntotalSpecular += hemiSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#if MAX_SPOT_LIGHTS > 0\ntotalDiffuse += spotDiffuse;\ntotalSpecular += spotSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor ) + totalSpecular;\n#endif\nif ( enableReflection ) {\nvec3 vReflect;\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, normal, uRefractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, normal );\n}\nvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );\n}", THREE.ShaderChunk.shadowmap_fragment, THREE.ShaderChunk.linear_to_gamma_fragment, THREE.ShaderChunk.fog_fragment, "}"].join("\n"),
vertexShader: ["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;", THREE.ShaderChunk.skinning_pars_vertex, THREE.ShaderChunk.shadowmap_pars_vertex, "void main() {", THREE.ShaderChunk.skinbase_vertex, THREE.ShaderChunk.skinnormal_vertex, "#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")
},
cube: {
uniforms: {
tCube: {
type: "t",
value: null
},
tFlip: {
type: "f",
value: -1
}
},
vertexShader: "varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
fragmentShader: "uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"
},
depthRGBA: {
uniforms: {},
vertexShader: [THREE.ShaderChunk.morphtarget_pars_vertex, THREE.ShaderChunk.skinning_pars_vertex, "void main() {", THREE.ShaderChunk.skinbase_vertex, THREE.ShaderChunk.morphtarget_vertex, THREE.ShaderChunk.skinning_vertex, THREE.ShaderChunk.default_vertex, "}"].join("\n"),
fragmentShader: "vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"
}
},
THREE.WebGLRenderer = function(a) {
function b(a) {
if (a.__webglCustomAttributesList)
for (var b in a.__webglCustomAttributesList)
Q.deleteBuffer(a.__webglCustomAttributesList[b].buffer)
}
function c(a, b) {
var c = a.vertices.length,
d = b.material;
if (d.attributes) {
void 0 === a.__webglCustomAttributesList && (a.__webglCustomAttributesList = []);
for (var e in d.attributes) {
var f = d.attributes[e];
if (!f.__webglInitialized || f.createUniqueBuffers) {
f.__webglInitialized = !0;
var g = 1;
"v2" === f.type ? g = 2: "v3" === f.type ? g = 3: "v4" === f.type ? g = 4: "c" === f.type && (g = 3),
f.size = g,
f.array = new Float32Array(c * g),
f.buffer = Q.createBuffer(),
f.buffer.belongsToAttribute = e,
f.needsUpdate = !0
}
a.__webglCustomAttributesList.push(f)
}
}
}
function d(a, b) {
var c = b.geometry,
d = a.faces3,
h = a.faces4,
i = 3 * d.length + 4 * h.length,
j = 1 * d.length + 2 * h.length,
h = 3 * d.length + 4 * h.length,
d = e(b, a),
k = g(d),
l = f(d),
m = d.vertexColors ? d.vertexColors: !1;
if (a.__vertexArray = new Float32Array(3 * i), l && (a.__normalArray = new Float32Array(3 * i)), c.hasTangents && (a.__tangentArray = new Float32Array(4 * i)), m && (a.__colorArray = new Float32Array(3 * i)), k && ((0 < c.faceUvs.length || 0 < c.faceVertexUvs.length) && (a.__uvArray = new Float32Array(2 * i)), (1 < c.faceUvs.length || 1 < c.faceVertexUvs.length) && (a.__uv2Array = new Float32Array(2 * i))), b.geometry.skinWeights.length && b.geometry.skinIndices.length && (a.__skinIndexArray = new Float32Array(4 * i), a.__skinWeightArray = new Float32Array(4 * i)), a.__faceArray = new Uint16Array(3 * j), a.__lineArray = new Uint16Array(2 * h), a.numMorphTargets)
for (a.__morphTargetsArrays = [], c = 0, k = a.numMorphTargets; k > c; c++)
a.__morphTargetsArrays.push(new Float32Array(3 * i));
if (a.numMorphNormals)
for (a.__morphNormalsArrays = [], c = 0, k = a.numMorphNormals; k > c; c++)
a.__morphNormalsArrays.push(new Float32Array(3 * i));
if (a.__webglFaceCount = 3 * j, a.__webglLineCount = 2 * h, d.attributes) {
void 0 === a.__webglCustomAttributesList && (a.__webglCustomAttributesList = []);
for (var n in d.attributes) {
var o,
j = d.attributes[n],
c = {};
for (o in j)
c[o] = j[o]; (!c.__webglInitialized || c.createUniqueBuffers) && (c.__webglInitialized = !0, h = 1, "v2" === c.type ? h = 2: "v3" === c.type ? h = 3: "v4" === c.type ? h = 4: "c" === c.type && (h = 3), c.size = h, c.array = new Float32Array(i * h), c.buffer = Q.createBuffer(), c.buffer.belongsToAttribute = n, j.needsUpdate = !0, c.__original = j),
a.__webglCustomAttributesList.push(c)
}
}
a.__inittedArrays = !0
}
function e(a, b) {
return a.material instanceof THREE.MeshFaceMaterial ? a.material.materials[b.materialIndex] : a.material
}
function f(a) {
return a instanceof THREE.MeshBasicMaterial && !a.envMap || a instanceof THREE.MeshDepthMaterial ? !1: a && void 0 !== a.shading && a.shading === THREE.SmoothShading ? THREE.SmoothShading: THREE.FlatShading
}
function g(a) {
return a.map || a.lightMap || a.bumpMap || a.normalMap || a.specularMap || a instanceof THREE.ShaderMaterial ? !0: !1
}
function h(a) {
vb[a] || (Q.enableVertexAttribArray(a), vb[a] = !0)
}
function i() {
for (var a in vb)
vb[a] && (Q.disableVertexAttribArray(a), vb[a] = !1)
}
function j(a, b) {
return a.z !== b.z ? b.z - a.z: a.id - b.id
}
function k(a, b) {
return b[0] - a[0]
}
function l(a, b, c) {
if (a.length)
for (var d = 0, e = a.length; e > d; d++)
ab = Y = null,
$ = _ = eb = db = kb = jb = fb = -1,
Bb = !0,
a[d].render(b, c, tb, ub),
ab = Y = null,
$ = _ = eb = db = kb = jb = fb = -1,
Bb = !0
}
function m(a, b, c, d, e, f, g, h) {
var i,
j,
k,
l;
b ? (j = a.length - 1, l = b = -1) : (j = 0, b = a.length, l = 1);
for (var m = j; m !== b; m += l)
if (i = a[m], i.render) {
if (j = i.object, k = i.buffer, h)
i = h;
else {
if (i = i[c], !i)
continue;
g && V.setBlending(i.blending, i.blendEquation, i.blendSrc, i.blendDst),
V.setDepthTest(i.depthTest),
V.setDepthWrite(i.depthWrite),
A(i.polygonOffset, i.polygonOffsetFactor, i.polygonOffsetUnits)
}
V.setMaterialFaces(i),
k instanceof THREE.BufferGeometry ? V.renderBufferDirect(d, e, f, i, k, j) : V.renderBuffer(d, e, f, i, k, j)
}
}
function n(a, b, c, d, e, f, g) {
for (var h, i, j = 0, k = a.length; k > j; j++)
if (h = a[j], i = h.object, i.visible) {
if (g)
h = g;
else {
if (h = h[b], !h)
continue;
f && V.setBlending(h.blending, h.blendEquation, h.blendSrc, h.blendDst),
V.setDepthTest(h.depthTest),
V.setDepthWrite(h.depthWrite),
A(h.polygonOffset, h.polygonOffsetFactor, h.polygonOffsetUnits)
}
V.renderImmediateObject(c, d, e, h, i)
}
}
function o(a, b) {
var e,
f,
g,
h;
if (void 0 === a.__webglInit && (a.__webglInit = !0, a._modelViewMatrix = new THREE.Matrix4, a._normalMatrix = new THREE.Matrix3, void 0 !== a.geometry && void 0 === a.geometry.__webglInit && (a.geometry.__webglInit = !0, a.geometry.addEventListener("dispose", Qb)), f = a.geometry, void 0 !== f))
if (f instanceof THREE.BufferGeometry) {
var i,
j;
for (i in f.attributes)
j = "index" === i ? Q.ELEMENT_ARRAY_BUFFER: Q.ARRAY_BUFFER,
h = f.attributes[i],
h.buffer = Q.createBuffer(),
Q.bindBuffer(j, h.buffer),
Q.bufferData(j, h.array, Q.STATIC_DRAW)
} else if (a instanceof THREE.Mesh) {
if (g = a.material, void 0 === f.geometryGroups) {
i = f;
var k,
l,
m,
n,
o;
j = {};
var q = i.morphTargets.length,
r = i.morphNormals.length,
s = g instanceof THREE.MeshFaceMaterial;
for (i.geometryGroups = {}, g = 0, k = i.faces.length; k > g; g++)
l = i.faces[g],
m = s ? l.materialIndex: 0,
void 0 === j[m] && (j[m] = {
hash: m,
counter: 0
}),
o = j[m].hash + "_" + j[m].counter,
void 0 === i.geometryGroups[o] && (i.geometryGroups[o] = {
faces3: [],
faces4: [],
materialIndex: m,
vertices: 0,
numMorphTargets: q,
numMorphNormals: r
}),
n = l instanceof THREE.Face3 ? 3: 4,
65535 < i.geometryGroups[o].vertices + n && (j[m].counter += 1, o = j[m].hash + "_" + j[m].counter, void 0 === i.geometryGroups[o] && (i.geometryGroups[o] = {
faces3: [],
faces4: [],
materialIndex: m,
vertices: 0,
numMorphTargets: q,
numMorphNormals: r
})),
l instanceof THREE.Face3 ? i.geometryGroups[o].faces3.push(g) : i.geometryGroups[o].faces4.push(g),
i.geometryGroups[o].vertices += n;
i.geometryGroupsList = [];
for (h in i.geometryGroups)
i.geometryGroups[h].id = bb++,
i.geometryGroupsList.push(i.geometryGroups[h])
}
for (e in f.geometryGroups)
if (h = f.geometryGroups[e], !h.__webglVertexBuffer) {
if (i = h, i.__webglVertexBuffer = Q.createBuffer(), i.__webglNormalBuffer = Q.createBuffer(), i.__webglTangentBuffer = Q.createBuffer(), i.__webglColorBuffer = Q.createBuffer(), i.__webglUVBuffer = Q.createBuffer(), i.__webglUV2Buffer = Q.createBuffer(), i.__webglSkinIndicesBuffer = Q.createBuffer(), i.__webglSkinWeightsBuffer = Q.createBuffer(), i.__webglFaceBuffer = Q.createBuffer(), i.__webglLineBuffer = Q.createBuffer(), q = j = void 0, i.numMorphTargets)
for (i.__webglMorphTargetsBuffers = [], j = 0, q = i.numMorphTargets; q > j; j++)
i.__webglMorphTargetsBuffers.push(Q.createBuffer());
if (i.numMorphNormals)
for (i.__webglMorphNormalsBuffers = [], j = 0, q = i.numMorphNormals; q > j; j++)
i.__webglMorphNormalsBuffers.push(Q.createBuffer());
V.info.memory.geometries++,
d(h, a),
f.verticesNeedUpdate = !0,
f.morphTargetsNeedUpdate = !0,
f.elementsNeedUpdate = !0,
f.uvsNeedUpdate = !0,
f.normalsNeedUpdate = !0,
f.tangentsNeedUpdate = !0,
f.colorsNeedUpdate = !0
}
} else
a instanceof THREE.Ribbon ? f.__webglVertexBuffer || (h = f, h.__webglVertexBuffer = Q.createBuffer(), h.__webglColorBuffer = Q.createBuffer(), h.__webglNormalBuffer = Q.createBuffer(), V.info.memory.geometries++, h = f, i = h.vertices.length, h.__vertexArray = new Float32Array(3 * i), h.__colorArray = new Float32Array(3 * i), h.__normalArray = new Float32Array(3 * i), h.__webglVertexCount = i, c(h, a), f.verticesNeedUpdate = !0, f.colorsNeedUpdate = !0, f.normalsNeedUpdate = !0) : a instanceof THREE.Line ? f.__webglVertexBuffer || (h = f, h.__webglVertexBuffer = Q.createBuffer(), h.__webglColorBuffer = Q.createBuffer(), h.__webglLineDistanceBuffer = Q.createBuffer(), V.info.memory.geometries++, h = f, i = h.vertices.length, h.__vertexArray = new Float32Array(3 * i), h.__colorArray = new Float32Array(3 * i), h.__lineDistanceArray = new Float32Array(1 * i), h.__webglLineCount = i, c(h, a), f.verticesNeedUpdate = !0, f.colorsNeedUpdate = !0, f.lineDistancesNeedUpdate = !0) : a instanceof THREE.ParticleSystem && !f.__webglVertexBuffer && (h = f, h.__webglVertexBuffer = Q.createBuffer(), h.__webglColorBuffer = Q.createBuffer(), V.info.memory.geometries++, h = f, i = h.vertices.length, h.__vertexArray = new Float32Array(3 * i), h.__colorArray = new Float32Array(3 * i), h.__sortArray = [], h.__webglParticleCount = i, c(h, a), f.verticesNeedUpdate = !0, f.colorsNeedUpdate = !0);
if (void 0 === a.__webglActive) {
if (a instanceof THREE.Mesh) {
if (f = a.geometry, f instanceof THREE.BufferGeometry)
p(b.__webglObjects, f, a);
else if (f instanceof THREE.Geometry)
for (e in f.geometryGroups)
h = f.geometryGroups[e],
p(b.__webglObjects, h, a)
} else
a instanceof THREE.Ribbon || a instanceof THREE.Line || a instanceof THREE.ParticleSystem ? (f = a.geometry, p(b.__webglObjects, f, a)) : a instanceof THREE.ImmediateRenderObject || a.immediateRenderCallback ? b.__webglObjectsImmediate.push({
object: a,
opaque: null,
transparent: null
}) : a instanceof THREE.Sprite ? b.__webglSprites.push(a) : a instanceof THREE.LensFlare && b.__webglFlares.push(a);
a.__webglActive = !0
}
}
function p(a, b, c) {
a.push({
buffer: b,
object: c,
opaque: null,
transparent: null
})
}
function q(a) {
for (var b in a.attributes)
if (a.attributes[b].needsUpdate)
return ! 0;
return ! 1
}
function r(a) {
for (var b in a.attributes)
a.attributes[b].needsUpdate = !1
}
function s(a, b) {
a instanceof THREE.Mesh || a instanceof THREE.ParticleSystem || a instanceof THREE.Ribbon || a instanceof THREE.Line ? t(b.__webglObjects, a) : a instanceof THREE.Sprite ? u(b.__webglSprites, a) : a instanceof THREE.LensFlare ? u(b.__webglFlares, a) : (a instanceof THREE.ImmediateRenderObject || a.immediateRenderCallback) && t(b.__webglObjectsImmediate, a),
delete a.__webglActive
}
function t(a, b) {
for (var c = a.length - 1; c >= 0; c--)
a[c].object === b && a.splice(c, 1)
}
function u(a, b) {
for (var c = a.length - 1; c >= 0; c--)
a[c] === b && a.splice(c, 1)
}
function v(a, b, c, d, e) {
cb = 0,
d.needsUpdate && (d.program && Ub(d), V.initMaterial(d, b, c, e), d.needsUpdate = !1),
d.morphTargets && !e.__webglMorphTargetInfluences && (e.__webglMorphTargetInfluences = new Float32Array(V.maxMorphTargets));
var f = !1,
g = d.program,
h = g.uniforms,
i = d.uniforms;
if (g !== Y && (Q.useProgram(g), Y = g, f = !0), d.id !== $ && ($ = d.id, f = !0), (f || a !== ab) && (Q.uniformMatrix4fv(h.projectionMatrix, !1, a.projectionMatrix.elements), a !== ab && (ab = a)), d.skinning)
if (Jb && e.useVertexTexture) {
if (null !== h.boneTexture) {
var j = w();
Q.uniform1i(h.boneTexture, j),
V.setTexture(e.boneTexture, j)
}
} else
null !== h.boneGlobalMatrices && Q.uniformMatrix4fv(h.boneGlobalMatrices, !1, e.boneMatrices);
if (f) {
if (c && d.fog && (i.fogColor.value = c.color, c instanceof THREE.Fog ? (i.fogNear.value = c.near, i.fogFar.value = c.far) : c instanceof THREE.FogExp2 && (i.fogDensity.value = c.density)), d instanceof THREE.MeshPhongMaterial || d instanceof THREE.MeshLambertMaterial || d.lights) {
if (Bb) {
for (var k, l, m, n, o = j = 0, p = 0, q = Cb, r = q.directional.colors, s = q.directional.positions, t = q.point.colors, u = q.point.positions, v = q.point.distances, z = q.spot.colors, A = q.spot.positions, B = q.spot.distances, C = q.spot.directions, E = q.spot.anglesCos, F = q.spot.exponents, I = q.hemi.skyColors, J = q.hemi.groundColors, K = q.hemi.positions, L = 0, M = 0, N = 0, O = 0, P = 0, R = 0, S = 0, T = 0, U = k = 0, c = n = U = 0, f = b.length; f > c; c++)
k = b[c],
k.onlyShadow || (l = k.color, m = k.intensity, n = k.distance, k instanceof THREE.AmbientLight ? k.visible && (V.gammaInput ? (j += l.r * l.r, o += l.g * l.g, p += l.b * l.b) : (j += l.r, o += l.g, p += l.b)) : k instanceof THREE.DirectionalLight ? (P += 1, k.visible && (Ab.getPositionFromMatrix(k.matrixWorld), zb.getPositionFromMatrix(k.target.matrixWorld), Ab.sub(zb), Ab.normalize(), 0 === Ab.x && 0 === Ab.y && 0 === Ab.z || (k = 3 * L, s[k] = Ab.x, s[k + 1] = Ab.y, s[k + 2] = Ab.z, V.gammaInput ? x(r, k, l, m * m) : y(r, k, l, m), L += 1))) : k instanceof THREE.PointLight ? (R += 1, k.visible && (U = 3 * M, V.gammaInput ? x(t, U, l, m * m) : y(t, U, l, m), zb.getPositionFromMatrix(k.matrixWorld), u[U] = zb.x, u[U + 1] = zb.y, u[U + 2] = zb.z, v[M] = n, M += 1)) : k instanceof THREE.SpotLight ? (S += 1, k.visible && (U = 3 * N, V.gammaInput ? x(z, U, l, m * m) : y(z, U, l, m), zb.getPositionFromMatrix(k.matrixWorld), A[U] = zb.x, A[U + 1] = zb.y, A[U + 2] = zb.z, B[N] = n, Ab.copy(zb), zb.getPositionFromMatrix(k.target.matrixWorld), Ab.sub(zb), Ab.normalize(), C[U] = Ab.x, C[U + 1] = Ab.y, C[U + 2] = Ab.z, E[N] = Math.cos(k.angle), F[N] = k.exponent, N += 1)) : k instanceof THREE.HemisphereLight && (T += 1, k.visible && (Ab.getPositionFromMatrix(k.matrixWorld), Ab.normalize(), 0 === Ab.x && 0 === Ab.y && 0 === Ab.z || (n = 3 * O, K[n] = Ab.x, K[n + 1] = Ab.y, K[n + 2] = Ab.z, l = k.color, k = k.groundColor, V.gammaInput ? (m *= m, x(I, n, l, m), x(J, n, k, m)) : (y(I, n, l, m), y(J, n, k, m)), O += 1))));
for (c = 3 * L, f = Math.max(r.length, 3 * P); f > c; c++)
r[c] = 0;
for (c = 3 * M, f = Math.max(t.length, 3 * R); f > c; c++)
t[c] = 0;
for (c = 3 * N, f = Math.max(z.length, 3 * S); f > c; c++)
z[c] = 0;
for (c = 3 * O, f = Math.max(I.length, 3 * T); f > c; c++)
I[c] = 0;
for (c = 3 * O, f = Math.max(J.length, 3 * T); f > c; c++)
J[c] = 0;
q.directional.length = L,
q.point.length = M,
q.spot.length = N,
q.hemi.length = O,
q.ambient[0] = j,
q.ambient[1] = o,
q.ambient[2] = p,
Bb = !1
}
c = Cb,
i.ambientLightColor.value = c.ambient,
i.directionalLightColor.value = c.directional.colors,
i.directionalLightDirection.value = c.directional.positions,
i.pointLightColor.value = c.point.colors,
i.pointLightPosition.value = c.point.positions,
i.pointLightDistance.value = c.point.distances,
i.spotLightColor.value = c.spot.colors,
i.spotLightPosition.value = c.spot.positions,
i.spotLightDistance.value = c.spot.distances,
i.spotLightDirection.value = c.spot.directions,
i.spotLightAngleCos.value = c.spot.anglesCos,
i.spotLightExponent.value = c.spot.exponents,
i.hemisphereLightSkyColor.value = c.hemi.skyColors,
i.hemisphereLightGroundColor.value = c.hemi.groundColors,
i.hemisphereLightDirection.value = c.hemi.positions
}
if (d instanceof THREE.MeshBasicMaterial || d instanceof THREE.MeshLambertMaterial || d instanceof THREE.MeshPhongMaterial) {
i.opacity.value = d.opacity,
V.gammaInput ? i.diffuse.value.copyGammaToLinear(d.color) : i.diffuse.value = d.color,
i.map.value = d.map,
i.lightMap.value = d.lightMap,
i.specularMap.value = d.specularMap,
d.bumpMap && (i.bumpMap.value = d.bumpMap, i.bumpScale.value = d.bumpScale),
d.normalMap && (i.normalMap.value = d.normalMap, i.normalScale.value.copy(d.normalScale));
var W;
d.map ? W = d.map: d.specularMap ? W = d.specularMap: d.normalMap ? W = d.normalMap: d.bumpMap && (W = d.bumpMap),
void 0 !== W && (c = W.offset, W = W.repeat, i.offsetRepeat.value.set(c.x, c.y, W.x, W.y)),
i.envMap.value = d.envMap,
i.flipEnvMap.value = d.envMap instanceof THREE.WebGLRenderTargetCube ? 1: -1,
i.reflectivity.value = d.reflectivity,
i.refractionRatio.value = d.refractionRatio,
i.combine.value = d.combine,
i.useRefract.value = d.envMap && d.envMap.mapping instanceof THREE.CubeRefractionMapping
}
if (d instanceof THREE.LineBasicMaterial ? (i.diffuse.value = d.color, i.opacity.value = d.opacity) : d instanceof THREE.LineDashedMaterial ? (i.diffuse.value = d.color, i.opacity.value = d.opacity, i.dashSize.value = d.dashSize, i.totalSize.value = d.dashSize + d.gapSize, i.scale.value = d.scale) : d instanceof THREE.ParticleBasicMaterial ? (i.psColor.value = d.color, i.opacity.value = d.opacity, i.size.value = d.size, i.scale.value = H.height / 2, i.map.value = d.map) : d instanceof THREE.MeshPhongMaterial ? (i.shininess.value = d.shininess, V.gammaInput ? (i.ambient.value.copyGammaToLinear(d.ambient), i.emissive.value.copyGammaToLinear(d.emissive), i.specular.value.copyGammaToLinear(d.specular)) : (i.ambient.value = d.ambient, i.emissive.value = d.emissive, i.specular.value = d.specular), d.wrapAround && i.wrapRGB.value.copy(d.wrapRGB)) : d instanceof THREE.MeshLambertMaterial ? (V.gammaInput ? (i.ambient.value.copyGammaToLinear(d.ambient), i.emissive.value.copyGammaToLinear(d.emissive)) : (i.ambient.value = d.ambient, i.emissive.value = d.emissive), d.wrapAround && i.wrapRGB.value.copy(d.wrapRGB)) : d instanceof THREE.MeshDepthMaterial ? (i.mNear.value = a.near, i.mFar.value = a.far, i.opacity.value = d.opacity) : d instanceof THREE.MeshNormalMaterial && (i.opacity.value = d.opacity), e.receiveShadow && !d._shadowPass && i.shadowMatrix)
for (c = W = 0, f = b.length; f > c; c++)
j = b[c],
j.castShadow && (j instanceof THREE.SpotLight || j instanceof THREE.DirectionalLight && !j.shadowCascade) && (i.shadowMap.value[W] = j.shadowMap, i.shadowMapSize.value[W] = j.shadowMapSize, i.shadowMatrix.value[W] = j.shadowMatrix, i.shadowDarkness.value[W] = j.shadowDarkness, i.shadowBias.value[W] = j.shadowBias, W++);
for (b = d.uniformsList, i = 0, W = b.length; W > i; i++)
if (f = g.uniforms[b[i][1]])
if (c = b[i][0], o = c.type, j = c.value, "i" === o)
Q.uniform1i(f, j);
else if ("f" === o)
Q.uniform1f(f, j);
else if ("v2" === o)
Q.uniform2f(f, j.x, j.y);
else if ("v3" === o)
Q.uniform3f(f, j.x, j.y, j.z);
else if ("v4" === o)
Q.uniform4f(f, j.x, j.y, j.z, j.w);
else if ("c" === o)
Q.uniform3f(f, j.r, j.g, j.b);
else if ("iv1" === o)
Q.uniform1iv(f, j);
else if ("iv" === o)
Q.uniform3iv(f, j);
else if ("fv1" === o)
Q.uniform1fv(f, j);
else if ("fv" === o)
Q.uniform3fv(f, j);
else if ("v2v" === o) {
for (void 0 === c._array && (c._array = new Float32Array(2 * j.length)), o = 0, p = j.length; p > o; o++)
q = 2 * o,
c._array[q] = j[o].x,
c._array[q + 1] = j[o].y;
Q.uniform2fv(f, c._array)
} else if ("v3v" === o) {
for (void 0 === c._array && (c._array = new Float32Array(3 * j.length)), o = 0, p = j.length; p > o; o++)
q = 3 * o,
c._array[q] = j[o].x,
c._array[q + 1] = j[o].y,
c._array[q + 2] = j[o].z;
Q.uniform3fv(f, c._array)
} else if ("v4v" === o) {
for (void 0 === c._array && (c._array = new Float32Array(4 * j.length)), o = 0, p = j.length; p > o; o++)
q = 4 * o,
c._array[q] = j[o].x,
c._array[q + 1] = j[o].y,
c._array[q + 2] = j[o].z,
c._array[q + 3] = j[o].w;
Q.uniform4fv(f, c._array)
} else if ("m4" === o)
void 0 === c._array && (c._array = new Float32Array(16)),
j.flattenToArray(c._array),
Q.uniformMatrix4fv(f, !1, c._array);
else if ("m4v" === o) {
for (void 0 === c._array && (c._array = new Float32Array(16 * j.length)), o = 0, p = j.length; p > o; o++)
j[o].flattenToArrayOffset(c._array, 16 * o);
Q.uniformMatrix4fv(f, !1, c._array)
} else if ("t" === o) {
if (q = j, j = w(), Q.uniform1i(f, j), q)
if (q.image instanceof Array && 6 === q.image.length) {
if (c = q, f = j, 6 === c.image.length)
if (c.needsUpdate) {
for (c.image.__webglTextureCube || (c.image.__webglTextureCube = Q.createTexture(), V.info.memory.textures++), Q.activeTexture(Q.TEXTURE0 + f), Q.bindTexture(Q.TEXTURE_CUBE_MAP, c.image.__webglTextureCube), Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL, c.flipY), f = c instanceof THREE.CompressedTexture, j = [], o = 0; 6 > o; o++)
V.autoScaleCubemaps && !f ? (p = j, q = o, r = c.image[o], t = Gb, r.width <= t && r.height <= t || (u = Math.max(r.width, r.height), s = Math.floor(r.width * t / u), t = Math.floor(r.height * t / u), u = document.createElement("canvas"), u.width = s, u.height = t, u.getContext("2d").drawImage(r, 0, 0, r.width, r.height, 0, 0, s, t), r = u), p[q] = r) : j[o] = c.image[o];
for (o = j[0], p = 0 === (o.width & o.width - 1) && 0 === (o.height & o.height - 1), q = G(c.format), r = G(c.type), D(Q.TEXTURE_CUBE_MAP, c, p), o = 0; 6 > o; o++)
if (f)
for (t = j[o].mipmaps, u = 0, v = t.length; v > u; u++)
s = t[u],
Q.compressedTexImage2D(Q.TEXTURE_CUBE_MAP_POSITIVE_X + o, u, q, s.width, s.height, 0, s.data);
else
Q.texImage2D(Q.TEXTURE_CUBE_MAP_POSITIVE_X + o, 0, q, q, r, j[o]);
c.generateMipmaps && p && Q.generateMipmap(Q.TEXTURE_CUBE_MAP),
c.needsUpdate = !1,
c.onUpdate && c.onUpdate()
} else
Q.activeTexture(Q.TEXTURE0 + f),
Q.bindTexture(Q.TEXTURE_CUBE_MAP, c.image.__webglTextureCube)
} else
q instanceof THREE.WebGLRenderTargetCube ? (c = q, Q.activeTexture(Q.TEXTURE0 + j), Q.bindTexture(Q.TEXTURE_CUBE_MAP, c.__webglTexture)) : V.setTexture(q, j)
} else if ("tv" === o) {
for (void 0 === c._array && (c._array = []), o = 0, p = c.value.length; p > o; o++)
c._array[o] = w();
for (Q.uniform1iv(f, c._array), o = 0, p = c.value.length; p > o; o++)
q = c.value[o],
j = c._array[o],
q && V.setTexture(q, j)
} (d instanceof THREE.ShaderMaterial || d instanceof THREE.MeshPhongMaterial || d.envMap) && null !== h.cameraPosition && (zb.getPositionFromMatrix(a.matrixWorld), Q.uniform3f(h.cameraPosition, zb.x, zb.y, zb.z)),
(d instanceof THREE.MeshPhongMaterial || d instanceof THREE.MeshLambertMaterial || d instanceof THREE.ShaderMaterial || d.skinning) && null !== h.viewMatrix && Q.uniformMatrix4fv(h.viewMatrix, !1, a.matrixWorldInverse.elements)
}
return Q.uniformMatrix4fv(h.modelViewMatrix, !1, e._modelViewMatrix.elements),
h.normalMatrix && Q.uniformMatrix3fv(h.normalMatrix, !1, e._normalMatrix.elements),
null !== h.modelMatrix && Q.uniformMatrix4fv(h.modelMatrix, !1, e.matrixWorld.elements),
g
}
function w() {
var a = cb;
return a >= Eb && console.warn("WebGLRenderer: trying to use " + a + " texture units while this GPU supports only " + Eb),
cb += 1,
a
}
function x(a, b, c, d) {
a[b] = c.r * c.r * d,
a[b + 1] = c.g * c.g * d,
a[b + 2] = c.b * c.b * d
}
function y(a, b, c, d) {
a[b] = c.r * d,
a[b + 1] = c.g * d,
a[b + 2] = c.b * d
}
function z(a) {
a !== ob && (Q.lineWidth(a), ob = a)
}
function A(a, b, c) {
lb !== a && (a ? Q.enable(Q.POLYGON_OFFSET_FILL) : Q.disable(Q.POLYGON_OFFSET_FILL), lb = a),
!a || mb === b && nb === c || (Q.polygonOffset(b, c), mb = b, nb = c)
}
function B(a) {
for (var a = a.split("\n"), b = 0, c = a.length; c > b; b++)
a[b] = b + 1 + ": " + a[b];
return a.join("\n")
}
function C(a, b) {
var c;
return "fragment" === a ? c = Q.createShader(Q.FRAGMENT_SHADER) : "vertex" === a && (c = Q.createShader(Q.VERTEX_SHADER)),
Q.shaderSource(c, b),
Q.compileShader(c),
Q.getShaderParameter(c, Q.COMPILE_STATUS) ? c: (console.error(Q.getShaderInfoLog(c)), console.error(B(b)), null)
}
function D(a, b, c) {
c ? (Q.texParameteri(a, Q.TEXTURE_WRAP_S, G(b.wrapS)), Q.texParameteri(a, Q.TEXTURE_WRAP_T, G(b.wrapT)), Q.texParameteri(a, Q.TEXTURE_MAG_FILTER, G(b.magFilter)), Q.texParameteri(a, Q.TEXTURE_MIN_FILTER, G(b.minFilter))) : (Q.texParameteri(a, Q.TEXTURE_WRAP_S, Q.CLAMP_TO_EDGE), Q.texParameteri(a, Q.TEXTURE_WRAP_T, Q.CLAMP_TO_EDGE), Q.texParameteri(a, Q.TEXTURE_MAG_FILTER, F(b.magFilter)), Q.texParameteri(a, Q.TEXTURE_MIN_FILTER, F(b.minFilter))),
T && b.type !== THREE.FloatType && (1 < b.anisotropy || b.__oldAnisotropy) && (Q.texParameterf(a, T.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(b.anisotropy, Hb)), b.__oldAnisotropy = b.anisotropy)
}
function E(a, b) {
Q.bindRenderbuffer(Q.RENDERBUFFER, a),
b.depthBuffer && !b.stencilBuffer ? (Q.renderbufferStorage(Q.RENDERBUFFER, Q.DEPTH_COMPONENT16, b.width, b.height), Q.framebufferRenderbuffer(Q.FRAMEBUFFER, Q.DEPTH_ATTACHMENT, Q.RENDERBUFFER, a)) : b.depthBuffer && b.stencilBuffer ? (Q.renderbufferStorage(Q.RENDERBUFFER, Q.DEPTH_STENCIL, b.width, b.height), Q.framebufferRenderbuffer(Q.FRAMEBUFFER, Q.DEPTH_STENCIL_ATTACHMENT, Q.RENDERBUFFER, a)) : Q.renderbufferStorage(Q.RENDERBUFFER, Q.RGBA4, b.width, b.height)
}
function F(a) {
return a === THREE.NearestFilter || a === THREE.NearestMipMapNearestFilter || a === THREE.NearestMipMapLinearFilter ? Q.NEAREST: Q.LINEAR
}
function G(a) {
if (a === THREE.RepeatWrapping)
return Q.REPEAT;
if (a === THREE.ClampToEdgeWrapping)
return Q.CLAMP_TO_EDGE;
if (a === THREE.MirroredRepeatWrapping)
return Q.MIRRORED_REPEAT;
if (a === THREE.NearestFilter)
return Q.NEAREST;
if (a === THREE.NearestMipMapNearestFilter)
return Q.NEAREST_MIPMAP_NEAREST;
if (a === THREE.NearestMipMapLinearFilter)
return Q.NEAREST_MIPMAP_LINEAR;
if (a === THREE.LinearFilter)
return Q.LINEAR;
if (a === THREE.LinearMipMapNearestFilter)
return Q.LINEAR_MIPMAP_NEAREST;
if (a === THREE.LinearMipMapLinearFilter)
return Q.LINEAR_MIPMAP_LINEAR;
if (a === THREE.UnsignedByteType)
return Q.UNSIGNED_BYTE;
if (a === THREE.UnsignedShort4444Type)
return Q.UNSIGNED_SHORT_4_4_4_4;
if (a === THREE.UnsignedShort5551Type)
return Q.UNSIGNED_SHORT_5_5_5_1;
if (a === THREE.UnsignedShort565Type)
return Q.UNSIGNED_SHORT_5_6_5;
if (a === THREE.ByteType)
return Q.BYTE;
if (a === THREE.ShortType)
return Q.SHORT;
if (a === THREE.UnsignedShortType)
return Q.UNSIGNED_SHORT;
if (a === THREE.IntType)
return Q.INT;
if (a === THREE.UnsignedIntType)
return Q.UNSIGNED_INT;
if (a === THREE.FloatType)
return Q.FLOAT;
if (a === THREE.AlphaFormat)
return Q.ALPHA;
if (a === THREE.RGBFormat)
return Q.RGB;
if (a === THREE.RGBAFormat)
return Q.RGBA;
if (a === THREE.LuminanceFormat)
return Q.LUMINANCE;
if (a === THREE.LuminanceAlphaFormat)
return Q.LUMINANCE_ALPHA;
if (a === THREE.AddEquation)
return Q.FUNC_ADD;
if (a === THREE.SubtractEquation)
return Q.FUNC_SUBTRACT;
if (a === THREE.ReverseSubtractEquation)
return Q.FUNC_REVERSE_SUBTRACT;
if (a === THREE.ZeroFactor)
return Q.ZERO;
if (a === THREE.OneFactor)
return Q.ONE;
if (a === THREE.SrcColorFactor)
return Q.SRC_COLOR;
if (a === THREE.OneMinusSrcColorFactor)
return Q.ONE_MINUS_SRC_COLOR;
if (a === THREE.SrcAlphaFactor)
return Q.SRC_ALPHA;
if (a === THREE.OneMinusSrcAlphaFactor)
return Q.ONE_MINUS_SRC_ALPHA;
if (a === THREE.DstAlphaFactor)
return Q.DST_ALPHA;
if (a === THREE.OneMinusDstAlphaFactor)
return Q.ONE_MINUS_DST_ALPHA;
if (a === THREE.DstColorFactor)
return Q.DST_COLOR;
if (a === THREE.OneMinusDstColorFactor)
return Q.ONE_MINUS_DST_COLOR;
if (a === THREE.SrcAlphaSaturateFactor)
return Q.SRC_ALPHA_SATURATE;
if (void 0 !== U) {
if (a === THREE.RGB_S3TC_DXT1_Format)
return U.COMPRESSED_RGB_S3TC_DXT1_EXT;
if (a === THREE.RGBA_S3TC_DXT1_Format)
return U.COMPRESSED_RGBA_S3TC_DXT1_EXT;
if (a === THREE.RGBA_S3TC_DXT3_Format)
return U.COMPRESSED_RGBA_S3TC_DXT3_EXT;
if (a === THREE.RGBA_S3TC_DXT5_Format)
return U.COMPRESSED_RGBA_S3TC_DXT5_EXT
}
return 0
}
console.log("THREE.WebGLRenderer", THREE.REVISION);
var a = a || {},
H = void 0 !== a.canvas ? a.canvas: document.createElement("canvas"),
I = void 0 !== a.precision ? a.precision: "highp",
J = void 0 !== a.alpha ? a.alpha: !0,
K = void 0 !== a.premultipliedAlpha ? a.premultipliedAlpha: !0,
L = void 0 !== a.antialias ? a.antialias: !1,
M = void 0 !== a.stencil ? a.stencil: !0,
N = void 0 !== a.preserveDrawingBuffer ? a.preserveDrawingBuffer: !1,
O = new THREE.Color(0),
P = 0;
void 0 !== a.clearColor && (console.warn("DEPRECATED: clearColor in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."), O.setHex(a.clearColor)),
void 0 !== a.clearAlpha && (console.warn("DEPRECATED: clearAlpha in WebGLRenderer constructor parameters is being removed. Use .setClearColor() instead."), P = a.clearAlpha),
this.domElement = H,
this.context = null,
this.devicePixelRatio = void 0 !== a.devicePixelRatio ? a.devicePixelRatio: void 0 !== window.devicePixelRatio ? window.devicePixelRatio: 1,
this.autoUpdateObjects = this.sortObjects = this.autoClearStencil = this.autoClearDepth = this.autoClearColor = this.autoClear = !0,
this.shadowMapEnabled = this.physicallyBasedShading = this.gammaOutput = this.gammaInput = !1,
this.shadowMapAutoUpdate = !0,
this.shadowMapType = THREE.PCFShadowMap,
this.shadowMapCullFace = THREE.CullFaceFront,
this.shadowMapCascade = this.shadowMapDebug = !1,
this.maxMorphTargets = 8,
this.maxMorphNormals = 4,
this.autoScaleCubemaps = !0,
this.renderPluginsPre = [],
this.renderPluginsPost = [],
this.info = {
memory: {
programs: 0,
geometries: 0,
textures: 0
},
render: {
calls: 0,
vertices: 0,
faces: 0,
points: 0
}
};
var Q,
R,
S,
T,
U,
V = this,
W = [],
X = 0,
Y = null,
Z = null,
$ = -1,
_ = null,
ab = null,
bb = 0,
cb = 0,
db = -1,
eb = -1,
fb = -1,
gb = -1,
hb = -1,
ib = -1,
jb = -1,
kb = -1,
lb = null,
mb = null,
nb = null,
ob = null,
pb = 0,
qb = 0,
rb = 0,
sb = 0,
tb = 0,
ub = 0,
vb = {},
wb = new THREE.Frustum,
xb = new THREE.Matrix4,
yb = new THREE.Matrix4,
zb = new THREE.Vector3,
Ab = new THREE.Vector3,
Bb = !0,
Cb = {
ambient: [0, 0, 0],
directional: {
length: 0,
colors: [],
positions: []
},
point: {
length: 0,
colors: [],
positions: [],
distances: []
},
spot: {
length: 0,
colors: [],
positions: [],
distances: [],
directions: [],
anglesCos: [],
exponents: []
},
hemi: {
length: 0,
skyColors: [],
groundColors: [],
positions: []
}
};
try {
if (! (Q = H.getContext("experimental-webgl", {
alpha: J,
premultipliedAlpha: K,
antialias: L,
stencil: M,
preserveDrawingBuffer: N
})))
throw "Error creating WebGL context."
} catch(Db) {
console.error(Db)
}
R = Q.getExtension("OES_texture_float"),
S = Q.getExtension("OES_standard_derivatives"),
T = Q.getExtension("EXT_texture_filter_anisotropic") || Q.getExtension("MOZ_EXT_texture_filter_anisotropic") || Q.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),
U = Q.getExtension("WEBGL_compressed_texture_s3tc") || Q.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || Q.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),
R || console.log("THREE.WebGLRenderer: Float textures not supported."),
S || console.log("THREE.WebGLRenderer: Standard derivatives not supported."),
T || console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported."),
U || console.log("THREE.WebGLRenderer: S3TC compressed textures not supported."),
void 0 === Q.getShaderPrecisionFormat && (Q.getShaderPrecisionFormat = function() {
return {
rangeMin: 1,
rangeMax: 1,
precision: 1
}
}),
Q.clearColor(0, 0, 0, 1),
Q.clearDepth(1),
Q.clearStencil(0),
Q.enable(Q.DEPTH_TEST),
Q.depthFunc(Q.LEQUAL),
Q.frontFace(Q.CCW),
Q.cullFace(Q.BACK),
Q.enable(Q.CULL_FACE),
Q.enable(Q.BLEND),
Q.blendEquation(Q.FUNC_ADD),
Q.blendFunc(Q.SRC_ALPHA, Q.ONE_MINUS_SRC_ALPHA),
Q.clearColor(O.r, O.g, O.b, P),
this.context = Q;
var Eb = Q.getParameter(Q.MAX_TEXTURE_IMAGE_UNITS),
Fb = Q.getParameter(Q.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
Q.getParameter(Q.MAX_TEXTURE_SIZE);
var Gb = Q.getParameter(Q.MAX_CUBE_MAP_TEXTURE_SIZE),
Hb = T ? Q.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0,
Ib = Fb > 0,
Jb = Ib && R;
U && Q.getParameter(Q.COMPRESSED_TEXTURE_FORMATS);
var Kb = Q.getShaderPrecisionFormat(Q.VERTEX_SHADER, Q.HIGH_FLOAT),
Lb = Q.getShaderPrecisionFormat(Q.VERTEX_SHADER, Q.MEDIUM_FLOAT);
Q.getShaderPrecisionFormat(Q.VERTEX_SHADER, Q.LOW_FLOAT);
var Mb = Q.getShaderPrecisionFormat(Q.FRAGMENT_SHADER, Q.HIGH_FLOAT),
Nb = Q.getShaderPrecisionFormat(Q.FRAGMENT_SHADER, Q.MEDIUM_FLOAT);
Q.getShaderPrecisionFormat(Q.FRAGMENT_SHADER, Q.LOW_FLOAT),
Q.getShaderPrecisionFormat(Q.VERTEX_SHADER, Q.HIGH_INT),
Q.getShaderPrecisionFormat(Q.VERTEX_SHADER, Q.MEDIUM_INT),
Q.getShaderPrecisionFormat(Q.VERTEX_SHADER, Q.LOW_INT),
Q.getShaderPrecisionFormat(Q.FRAGMENT_SHADER, Q.HIGH_INT),
Q.getShaderPrecisionFormat(Q.FRAGMENT_SHADER, Q.MEDIUM_INT),
Q.getShaderPrecisionFormat(Q.FRAGMENT_SHADER, Q.LOW_INT);
var Ob = 0 < Kb.precision && 0 < Mb.precision,
Pb = 0 < Lb.precision && 0 < Nb.precision;
"highp" === I && !Ob && (Pb ? (I = "mediump", console.warn("WebGLRenderer: highp not supported, using mediump")) : (I = "lowp", console.warn("WebGLRenderer: highp and mediump not supported, using lowp"))),
"mediump" === I && !Pb && (I = "lowp", console.warn("WebGLRenderer: mediump not supported, using lowp")),
this.getContext = function() {
return Q
},
this.supportsVertexTextures = function() {
return Ib
},
this.supportsFloatTextures = function() {
return R
},
this.supportsStandardDerivatives = function() {
return S
},
this.supportsCompressedTextureS3TC = function() {
return U
},
this.getMaxAnisotropy = function() {
return Hb
},
this.getPrecision = function() {
return I
},
this.setSize = function(a, b, c) {
H.width = a * this.devicePixelRatio,
H.height = b * this.devicePixelRatio,
1 !== this.devicePixelRatio && !1 !== c && (H.style.width = a + "px", H.style.height = b + "px"),
this.setViewport(0, 0, H.width, H.height)
},
this.setViewport = function(a, b, c, d) {
pb = void 0 !== a ? a: 0,
qb = void 0 !== b ? b: 0,
rb = void 0 !== c ? c: H.width,
sb = void 0 !== d ? d: H.height,
Q.viewport(pb, qb, rb, sb)
},
this.setScissor = function(a, b, c, d) {
Q.scissor(a, b, c, d)
},
this.enableScissorTest = function(a) {
a ? Q.enable(Q.SCISSOR_TEST) : Q.disable(Q.SCISSOR_TEST)
},
this.setClearColor = function(a, b) {
O.set(a),
P = void 0 !== b ? b: 1,
Q.clearColor(O.r, O.g, O.b, P)
},
this.setClearColorHex = function(a, b) {
console.warn("DEPRECATED: .setClearColorHex() is being removed. Use .setClearColor() instead."),
this.setClearColor(a, b)
},
this.getClearColor = function() {
return O
},
this.getClearAlpha = function() {
return P
},
this.clear = function(a, b, c) {
var d = 0; (void 0 === a || a) && (d | =Q.COLOR_BUFFER_BIT),
(void 0 === b || b) && (d | =Q.DEPTH_BUFFER_BIT),
(void 0 === c || c) && (d | =Q.STENCIL_BUFFER_BIT),
Q.clear(d)
},
this.clearTarget = function(a, b, c, d) {
this.setRenderTarget(a),
this.clear(b, c, d)
},
this.addPostPlugin = function(a) {
a.init(this),
this.renderPluginsPost.push(a)
},
this.addPrePlugin = function(a) {
a.init(this),
this.renderPluginsPre.push(a)
},
this.updateShadowMap = function(a, b) {
Y = null,
$ = _ = kb = jb = fb = -1,
Bb = !0,
eb = db = -1,
this.shadowMapPlugin.update(a, b)
};
var Qb = function(a) {
if (a = a.target, a.removeEventListener("dispose", Qb), a.__webglInit = void 0, void 0 !== a.__webglVertexBuffer && Q.deleteBuffer(a.__webglVertexBuffer), void 0 !== a.__webglNormalBuffer && Q.deleteBuffer(a.__webglNormalBuffer), void 0 !== a.__webglTangentBuffer && Q.deleteBuffer(a.__webglTangentBuffer), void 0 !== a.__webglColorBuffer && Q.deleteBuffer(a.__webglColorBuffer), void 0 !== a.__webglUVBuffer && Q.deleteBuffer(a.__webglUVBuffer), void 0 !== a.__webglUV2Buffer && Q.deleteBuffer(a.__webglUV2Buffer), void 0 !== a.__webglSkinIndicesBuffer && Q.deleteBuffer(a.__webglSkinIndicesBuffer), void 0 !== a.__webglSkinWeightsBuffer && Q.deleteBuffer(a.__webglSkinWeightsBuffer), void 0 !== a.__webglFaceBuffer && Q.deleteBuffer(a.__webglFaceBuffer), void 0 !== a.__webglLineBuffer && Q.deleteBuffer(a.__webglLineBuffer), void 0 !== a.__webglLineDistanceBuffer && Q.deleteBuffer(a.__webglLineDistanceBuffer), void 0 !== a.geometryGroups)
for (var c in a.geometryGroups) {
var d = a.geometryGroups[c];
if (void 0 !== d.numMorphTargets)
for (var e = 0, f = d.numMorphTargets; f > e; e++)
Q.deleteBuffer(d.__webglMorphTargetsBuffers[e]);
if (void 0 !== d.numMorphNormals)
for (e = 0, f = d.numMorphNormals; f > e; e++)
Q.deleteBuffer(d.__webglMorphNormalsBuffers[e]);
b(d)
}
b(a),
V.info.memory.geometries--
},
Rb = function(a) {
a = a.target,
a.removeEventListener("dispose", Rb),
a.image && a.image.__webglTextureCube ? Q.deleteTexture(a.image.__webglTextureCube) : a.__webglInit && (a.__webglInit = !1, Q.deleteTexture(a.__webglTexture)),
V.info.memory.textures--
},
Sb = function(a) {
if (a = a.target, a.removeEventListener("dispose", Sb), a && a.__webglTexture)
if (Q.deleteTexture(a.__webglTexture), a instanceof THREE.WebGLRenderTargetCube)
for (var b = 0; 6 > b; b++)
Q.deleteFramebuffer(a.__webglFramebuffer[b]),
Q.deleteRenderbuffer(a.__webglRenderbuffer[b]);
else
Q.deleteFramebuffer(a.__webglFramebuffer),
Q.deleteRenderbuffer(a.__webglRenderbuffer);
V.info.memory.textures--
},
Tb = function(a) {
a = a.target,
a.removeEventListener("dispose", Tb),
Ub(a)
},
Ub = function(a) {
var b = a.program;
if (void 0 !== b) {
a.program = void 0;
var c,
d,
e = !1,
a = 0;
for (c = W.length; c > a; a++)
if (d = W[a], d.program === b) {
d.usedTimes--,
0 === d.usedTimes && (e = !0);
break
}
if (!0 === e) {
for (e = [], a = 0, c = W.length; c > a; a++)
d = W[a],
d.program !== b && e.push(d);
W = e,
Q.deleteProgram(b),
V.info.memory.programs--
}
}
};
this.renderBufferImmediate = function(a, b, c) {
if (a.hasPositions && !a.__webglVertexBuffer && (a.__webglVertexBuffer = Q.createBuffer()), a.hasNormals && !a.__webglNormalBuffer && (a.__webglNormalBuffer = Q.createBuffer()), a.hasUvs && !a.__webglUvBuffer && (a.__webglUvBuffer = Q.createBuffer()), a.hasColors && !a.__webglColorBuffer && (a.__webglColorBuffer = Q.createBuffer()), a.hasPositions && (Q.bindBuffer(Q.ARRAY_BUFFER, a.__webglVertexBuffer), Q.bufferData(Q.ARRAY_BUFFER, a.positionArray, Q.DYNAMIC_DRAW), Q.enableVertexAttribArray(b.attributes.position), Q.vertexAttribPointer(b.attributes.position, 3, Q.FLOAT, !1, 0, 0)), a.hasNormals) {
if (Q.bindBuffer(Q.ARRAY_BUFFER, a.__webglNormalBuffer), c.shading === THREE.FlatShading) {
var d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o = 3 * a.count;
for (n = 0; o > n; n += 9)
m = a.normalArray,
d = m[n],
e = m[n + 1],
f = m[n + 2],
g = m[n + 3],
i = m[n + 4],
k = m[n + 5],
h = m[n + 6],
j = m[n + 7],
l = m[n + 8],
d = (d + g + h) / 3,
e = (e + i + j) / 3,
f = (f + k + l) / 3,
m[n] = d,
m[n + 1] = e,
m[n + 2] = f,
m[n + 3] = d,
m[n + 4] = e,
m[n + 5] = f,
m[n + 6] = d,
m[n + 7] = e,
m[n + 8] = f
}
Q.bufferData(Q.ARRAY_BUFFER, a.normalArray, Q.DYNAMIC_DRAW),
Q.enableVertexAttribArray(b.attributes.normal),
Q.vertexAttribPointer(b.attributes.normal, 3, Q.FLOAT, !1, 0, 0)
}
a.hasUvs && c.map && (Q.bindBuffer(Q.ARRAY_BUFFER, a.__webglUvBuffer), Q.bufferData(Q.ARRAY_BUFFER, a.uvArray, Q.DYNAMIC_DRAW), Q.enableVertexAttribArray(b.attributes.uv), Q.vertexAttribPointer(b.attributes.uv, 2, Q.FLOAT, !1, 0, 0)),
a.hasColors && c.vertexColors !== THREE.NoColors && (Q.bindBuffer(Q.ARRAY_BUFFER, a.__webglColorBuffer), Q.bufferData(Q.ARRAY_BUFFER, a.colorArray, Q.DYNAMIC_DRAW), Q.enableVertexAttribArray(b.attributes.color), Q.vertexAttribPointer(b.attributes.color, 3, Q.FLOAT, !1, 0, 0)),
Q.drawArrays(Q.TRIANGLES, 0, a.count),
a.count = 0
},
this.renderBufferDirect = function(a, b, c, d, e, f) {
if (!1 !== d.visible) {
var g,
j,
k;
if (g = v(a, b, c, d, f), a = g.attributes, b = e.attributes, c = !1, g = 16777215 * e.id + 2 * g.id + (d.wireframe ? 1: 0), g !== _ && (_ = g, c = !0), c && i(), f instanceof THREE.Mesh)
if (d = b.index) {
e = e.offsets,
1 < e.length && (c = !0);
for (var l = 0, m = e.length; m > l; l++) {
var n = e[l].index;
if (c) {
for (j in b)"index" !== j && (g = a[j], f = b[j], k = f.itemSize, g >= 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, f.buffer), h(g), Q.vertexAttribPointer(g, k, Q.FLOAT, !1, 0, 4 * n * k)));
Q.bindBuffer(Q.ELEMENT_ARRAY_BUFFER, d.buffer)
}
Q.drawElements(Q.TRIANGLES, e[l].count, Q.UNSIGNED_SHORT, 2 * e[l].start),
V.info.render.calls++,
V.info.render.vertices += e[l].count,
V.info.render.faces += e[l].count / 3
}
} else {
if (c)
for (j in b)"index" !== j && (g = a[j], f = b[j], k = f.itemSize, g >= 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, f.buffer), h(g), Q.vertexAttribPointer(g, k, Q.FLOAT, !1, 0, 0)));
j = e.attributes.position,
Q.drawArrays(Q.TRIANGLES, 0, j.numItems / 3),
V.info.render.calls++,
V.info.render.vertices += j.numItems / 3,
V.info.render.faces += j.numItems / 3 / 3
} else if (f instanceof THREE.ParticleSystem) {
if (c) {
for (j in b)
g = a[j],
f = b[j],
k = f.itemSize,
g >= 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, f.buffer), h(g), Q.vertexAttribPointer(g, k, Q.FLOAT, !1, 0, 0));
j = b.position,
Q.drawArrays(Q.POINTS, 0, j.numItems / 3),
V.info.render.calls++,
V.info.render.points += j.numItems / 3
}
} else if (f instanceof THREE.Line && c) {
for (j in b)
g = a[j],
f = b[j],
k = f.itemSize,
g >= 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, f.buffer), h(g), Q.vertexAttribPointer(g, k, Q.FLOAT, !1, 0, 0));
z(d.linewidth),
j = b.position,
Q.drawArrays(Q.LINE_STRIP, 0, j.numItems / 3),
V.info.render.calls++,
V.info.render.points += j.numItems
}
}
},
this.renderBuffer = function(a, b, c, d, e, f) {
if (!1 !== d.visible) {
var g,
j,
c = v(a, b, c, d, f),
a = c.attributes,
b = !1,
c = 16777215 * e.id + 2 * c.id + (d.wireframe ? 1: 0);
if (c !== _ && (_ = c, b = !0), b && i(), !d.morphTargets && 0 <= a.position)
b && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglVertexBuffer), h(a.position), Q.vertexAttribPointer(a.position, 3, Q.FLOAT, !1, 0, 0));
else if (f.morphTargetBase) {
if (c = d.program.attributes, -1 !== f.morphTargetBase && 0 <= c.position ? (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglMorphTargetsBuffers[f.morphTargetBase]), h(c.position), Q.vertexAttribPointer(c.position, 3, Q.FLOAT, !1, 0, 0)) : 0 <= c.position && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglVertexBuffer), h(c.position), Q.vertexAttribPointer(c.position, 3, Q.FLOAT, !1, 0, 0)), f.morphTargetForcedOrder.length) {
var l = 0;
for (j = f.morphTargetForcedOrder, g = f.morphTargetInfluences; l < d.numSupportedMorphTargets && l < j.length;)
0 <= c["morphTarget" + l] && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglMorphTargetsBuffers[j[l]]), h(c["morphTarget" + l]), Q.vertexAttribPointer(c["morphTarget" + l], 3, Q.FLOAT, !1, 0, 0)),
0 <= c["morphNormal" + l] && d.morphNormals && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglMorphNormalsBuffers[j[l]]), h(c["morphNormal" + l]), Q.vertexAttribPointer(c["morphNormal" + l], 3, Q.FLOAT, !1, 0, 0)),
f.__webglMorphTargetInfluences[l] = g[j[l]],
l++
} else {
j = [],
g = f.morphTargetInfluences;
var m,
n = g.length;
for (m = 0; n > m; m++)
l = g[m],
l > 0 && j.push([l, m]);
for (j.length > d.numSupportedMorphTargets ? (j.sort(k), j.length = d.numSupportedMorphTargets) : j.length > d.numSupportedMorphNormals ? j.sort(k) : 0 === j.length && j.push([0, 0]), l = 0; l < d.numSupportedMorphTargets;)
j[l] ? (m = j[l][1], 0 <= c["morphTarget" + l] && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglMorphTargetsBuffers[m]), h(c["morphTarget" + l]), Q.vertexAttribPointer(c["morphTarget" + l], 3, Q.FLOAT, !1, 0, 0)), 0 <= c["morphNormal" + l] && d.morphNormals && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglMorphNormalsBuffers[m]), h(c["morphNormal" + l]), Q.vertexAttribPointer(c["morphNormal" + l], 3, Q.FLOAT, !1, 0, 0)), f.__webglMorphTargetInfluences[l] = g[m]) : f.__webglMorphTargetInfluences[l] = 0,
l++
}
null !== d.program.uniforms.morphTargetInfluences && Q.uniform1fv(d.program.uniforms.morphTargetInfluences, f.__webglMorphTargetInfluences)
}
if (b) {
if (e.__webglCustomAttributesList)
for (g = 0, j = e.__webglCustomAttributesList.length; j > g; g++)
c = e.__webglCustomAttributesList[g],
0 <= a[c.buffer.belongsToAttribute] && (Q.bindBuffer(Q.ARRAY_BUFFER, c.buffer), h(a[c.buffer.belongsToAttribute]), Q.vertexAttribPointer(a[c.buffer.belongsToAttribute], c.size, Q.FLOAT, !1, 0, 0));
0 <= a.color && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglColorBuffer), h(a.color), Q.vertexAttribPointer(a.color, 3, Q.FLOAT, !1, 0, 0)),
0 <= a.normal && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglNormalBuffer), h(a.normal), Q.vertexAttribPointer(a.normal, 3, Q.FLOAT, !1, 0, 0)),
0 <= a.tangent && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglTangentBuffer), h(a.tangent), Q.vertexAttribPointer(a.tangent, 4, Q.FLOAT, !1, 0, 0)),
0 <= a.uv && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglUVBuffer), h(a.uv), Q.vertexAttribPointer(a.uv, 2, Q.FLOAT, !1, 0, 0)),
0 <= a.uv2 && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglUV2Buffer), h(a.uv2), Q.vertexAttribPointer(a.uv2, 2, Q.FLOAT, !1, 0, 0)),
d.skinning && 0 <= a.skinIndex && 0 <= a.skinWeight && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglSkinIndicesBuffer), h(a.skinIndex), Q.vertexAttribPointer(a.skinIndex, 4, Q.FLOAT, !1, 0, 0), Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglSkinWeightsBuffer), h(a.skinWeight), Q.vertexAttribPointer(a.skinWeight, 4, Q.FLOAT, !1, 0, 0)),
0 <= a.lineDistance && (Q.bindBuffer(Q.ARRAY_BUFFER, e.__webglLineDistanceBuffer), h(a.lineDistance), Q.vertexAttribPointer(a.lineDistance, 1, Q.FLOAT, !1, 0, 0))
}
f instanceof THREE.Mesh ? (d.wireframe ? (z(d.wireframeLinewidth), b && Q.bindBuffer(Q.ELEMENT_ARRAY_BUFFER, e.__webglLineBuffer), Q.drawElements(Q.LINES, e.__webglLineCount, Q.UNSIGNED_SHORT, 0)) : (b && Q.bindBuffer(Q.ELEMENT_ARRAY_BUFFER, e.__webglFaceBuffer), Q.drawElements(Q.TRIANGLES, e.__webglFaceCount, Q.UNSIGNED_SHORT, 0)), V.info.render.calls++, V.info.render.vertices += e.__webglFaceCount, V.info.render.faces += e.__webglFaceCount / 3) : f instanceof THREE.Line ? (f = f.type === THREE.LineStrip ? Q.LINE_STRIP: Q.LINES, z(d.linewidth), Q.drawArrays(f, 0, e.__webglLineCount), V.info.render.calls++) : f instanceof THREE.ParticleSystem ? (Q.drawArrays(Q.POINTS, 0, e.__webglParticleCount), V.info.render.calls++, V.info.render.points += e.__webglParticleCount) : f instanceof THREE.Ribbon && (Q.drawArrays(Q.TRIANGLE_STRIP, 0, e.__webglVertexCount), V.info.render.calls++)
}
},
this.render = function(a, b, c, d) {
if (!1 == b instanceof THREE.Camera)
console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
else {
var e,
f,
g,
h,
i = a.__lights,
k = a.fog;
for ($ = -1, Bb = !0, !0 === a.autoUpdate && a.updateMatrixWorld(), void 0 === b.parent && b.updateMatrixWorld(), b.matrixWorldInverse.getInverse(b.matrixWorld), xb.multiplyMatrices(b.projectionMatrix, b.matrixWorldInverse), wb.setFromMatrix(xb), this.autoUpdateObjects && this.initWebGLObjects(a), l(this.renderPluginsPre, a, b), V.info.render.calls = 0, V.info.render.vertices = 0, V.info.render.faces = 0, V.info.render.points = 0, this.setRenderTarget(c), (this.autoClear || d) && this.clear(this.autoClearColor, this.autoClearDepth, this.autoClearStencil), h = a.__webglObjects, d = 0, e = h.length; e > d; d++)
if (f = h[d], g = f.object, f.id = d, f.render = !1, g.visible && (!(g instanceof THREE.Mesh || g instanceof THREE.ParticleSystem) || !g.frustumCulled || wb.intersectsObject(g))) {
var o = g;
o._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse, o.matrixWorld),
o._normalMatrix.getNormalMatrix(o._modelViewMatrix);
var o = f,
p = o.buffer,
q = void 0,
r = q = void 0,
r = o.object.material;
r instanceof THREE.MeshFaceMaterial ? (q = p.materialIndex, q = r.materials[q], q.transparent ? (o.transparent = q, o.opaque = null) : (o.opaque = q, o.transparent = null)) : (q = r) && (q.transparent ? (o.transparent = q, o.opaque = null) : (o.opaque = q, o.transparent = null)),
f.render = !0,
!0 === this.sortObjects && (null !== g.renderDepth ? f.z = g.renderDepth: (zb.getPositionFromMatrix(g.matrixWorld), zb.applyProjection(xb), f.z = zb.z))
}
for (this.sortObjects && h.sort(j), h = a.__webglObjectsImmediate, d = 0, e = h.length; e > d; d++)
f = h[d],
g = f.object,
g.visible && (g._modelViewMatrix.multiplyMatrices(b.matrixWorldInverse, g.matrixWorld), g._normalMatrix.getNormalMatrix(g._modelViewMatrix), g = f.object.material, g.transparent ? (f.transparent = g, f.opaque = null) : (f.opaque = g, f.transparent = null));
a.overrideMaterial ? (d = a.overrideMaterial, this.setBlending(d.blending, d.blendEquation, d.blendSrc, d.blendDst), this.setDepthTest(d.depthTest), this.setDepthWrite(d.depthWrite), A(d.polygonOffset, d.polygonOffsetFactor, d.polygonOffsetUnits), m(a.__webglObjects, !1, "", b, i, k, !0, d), n(a.__webglObjectsImmediate, "", b, i, k, !1, d)) : (d = null, this.setBlending(THREE.NoBlending), m(a.__webglObjects, !0, "opaque", b, i, k, !1, d), n(a.__webglObjectsImmediate, "opaque", b, i, k, !1, d), m(a.__webglObjects, !1, "transparent", b, i, k, !0, d), n(a.__webglObjectsImmediate, "transparent", b, i, k, !0, d)),
l(this.renderPluginsPost, a, b),
c && c.generateMipmaps && c.minFilter !== THREE.NearestFilter && c.minFilter !== THREE.LinearFilter && (c instanceof THREE.WebGLRenderTargetCube ? (Q.bindTexture(Q.TEXTURE_CUBE_MAP, c.__webglTexture), Q.generateMipmap(Q.TEXTURE_CUBE_MAP), Q.bindTexture(Q.TEXTURE_CUBE_MAP, null)) : (Q.bindTexture(Q.TEXTURE_2D, c.__webglTexture), Q.generateMipmap(Q.TEXTURE_2D), Q.bindTexture(Q.TEXTURE_2D, null))),
this.setDepthTest(!0),
this.setDepthWrite(!0)
}
},
this.renderImmediateObject = function(a, b, c, d, e) {
var f = v(a, b, c, d, e);
_ = -1,
V.setMaterialFaces(d),
e.immediateRenderCallback ? e.immediateRenderCallback(f, Q, wb) : e.render(function(a) {
V.renderBufferImmediate(a, f, d)
})
},
this.initWebGLObjects = function(a) {
for (a.__webglObjects || (a.__webglObjects = [], a.__webglObjectsImmediate = [], a.__webglSprites = [], a.__webglFlares = []); a.__objectsAdded.length;)
o(a.__objectsAdded[0], a),
a.__objectsAdded.splice(0, 1);
for (; a.__objectsRemoved.length;)
s(a.__objectsRemoved[0], a),
a.__objectsRemoved.splice(0, 1);
for (var b = 0, c = a.__webglObjects.length; c > b; b++) {
var h = a.__webglObjects[b].object;
void 0 === h.__webglInit && (void 0 !== h.__webglActive && s(h, a), o(h, a));
var i = h,
j = i.geometry,
l = void 0,
m = void 0,
n = void 0;
if (j instanceof THREE.BufferGeometry) {
var p = Q.DYNAMIC_DRAW,
t = !j.dynamic,
u = j.attributes,
v = void 0,
w = void 0;
for (v in u)
w = u[v],
w.needsUpdate && ("index" === v ? (Q.bindBuffer(Q.ELEMENT_ARRAY_BUFFER, w.buffer), Q.bufferData(Q.ELEMENT_ARRAY_BUFFER, w.array, p)) : (Q.bindBuffer(Q.ARRAY_BUFFER, w.buffer), Q.bufferData(Q.ARRAY_BUFFER, w.array, p)), w.needsUpdate = !1),
t && !w.dynamic && delete w.array
} else if (i instanceof THREE.Mesh) {
for (var x = 0, y = j.geometryGroupsList.length; y > x; x++)
if (l = j.geometryGroupsList[x], n = e(i, l), j.buffersNeedUpdate && d(l, i), m = n.attributes && q(n), j.verticesNeedUpdate || j.morphTargetsNeedUpdate || j.elementsNeedUpdate || j.uvsNeedUpdate || j.normalsNeedUpdate || j.colorsNeedUpdate || j.tangentsNeedUpdate || m) {
var z = l,
A = i,
B = Q.DYNAMIC_DRAW,
C = !j.dynamic,
D = n;
if (z.__inittedArrays) {
var E = f(D),
F = D.vertexColors ? D.vertexColors: !1,
G = g(D),
H = E === THREE.SmoothShading,
I = void 0,
J = void 0,
K = void 0,
L = void 0,
M = void 0,
N = void 0,
O = void 0,
P = void 0,
R = void 0,
S = void 0,
T = void 0,
U = void 0,
V = void 0,
W = void 0,
X = void 0,
Y = void 0,
Z = void 0,
$ = void 0,
_ = void 0,
ab = void 0,
bb = void 0,
cb = void 0,
db = void 0,
eb = void 0,
fb = void 0,
gb = void 0,
hb = void 0,
ib = void 0,
jb = void 0,
kb = void 0,
lb = void 0,
mb = void 0,
nb = void 0,
ob = void 0,
pb = void 0,
qb = void 0,
rb = void 0,
sb = void 0,
tb = void 0,
ub = void 0,
vb = void 0,
wb = void 0,
Ab = void 0,
Bb = void 0,
Cb = void 0,
Db = void 0,
Eb = 0,
Fb = 0,
Gb = 0,
Hb = 0,
Ib = 0,
Jb = 0,
Kb = 0,
Lb = 0,
Mb = 0,
Nb = 0,
Ob = 0,
Pb = 0,
Qb = void 0,
Rb = z.__vertexArray,
Sb = z.__uvArray,
Tb = z.__uv2Array,
Ub = z.__normalArray,
Vb = z.__tangentArray,
Wb = z.__colorArray,
Xb = z.__skinIndexArray,
Yb = z.__skinWeightArray,
Zb = z.__morphTargetsArrays,
$b = z.__morphNormalsArrays,
_b = z.__webglCustomAttributesList,
ac = void 0,
bc = z.__faceArray,
cc = z.__lineArray,
dc = A.geometry,
ec = dc.elementsNeedUpdate,
fc = dc.uvsNeedUpdate,
gc = dc.normalsNeedUpdate,
hc = dc.tangentsNeedUpdate,
ic = dc.colorsNeedUpdate,
jc = dc.morphTargetsNeedUpdate,
kc = dc.vertices,
lc = z.faces3,
mc = z.faces4,
nc = dc.faces,
oc = dc.faceVertexUvs[0],
pc = dc.faceVertexUvs[1],
qc = dc.skinIndices,
rc = dc.skinWeights,
sc = dc.morphTargets,
tc = dc.morphNormals;
if (dc.verticesNeedUpdate) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
U = kc[L.a],
V = kc[L.b],
W = kc[L.c],
Rb[Fb] = U.x,
Rb[Fb + 1] = U.y,
Rb[Fb + 2] = U.z,
Rb[Fb + 3] = V.x,
Rb[Fb + 4] = V.y,
Rb[Fb + 5] = V.z,
Rb[Fb + 6] = W.x,
Rb[Fb + 7] = W.y,
Rb[Fb + 8] = W.z,
Fb += 9;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
U = kc[L.a],
V = kc[L.b],
W = kc[L.c],
X = kc[L.d],
Rb[Fb] = U.x,
Rb[Fb + 1] = U.y,
Rb[Fb + 2] = U.z,
Rb[Fb + 3] = V.x,
Rb[Fb + 4] = V.y,
Rb[Fb + 5] = V.z,
Rb[Fb + 6] = W.x,
Rb[Fb + 7] = W.y,
Rb[Fb + 8] = W.z,
Rb[Fb + 9] = X.x,
Rb[Fb + 10] = X.y,
Rb[Fb + 11] = X.z,
Fb += 12;
Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglVertexBuffer),
Q.bufferData(Q.ARRAY_BUFFER, Rb, B)
}
if (jc)
for (vb = 0, wb = sc.length; wb > vb; vb++) {
for (I = Ob = 0, J = lc.length; J > I; I++)
Cb = lc[I],
L = nc[Cb],
U = sc[vb].vertices[L.a],
V = sc[vb].vertices[L.b],
W = sc[vb].vertices[L.c],
Ab = Zb[vb],
Ab[Ob] = U.x,
Ab[Ob + 1] = U.y,
Ab[Ob + 2] = U.z,
Ab[Ob + 3] = V.x,
Ab[Ob + 4] = V.y,
Ab[Ob + 5] = V.z,
Ab[Ob + 6] = W.x,
Ab[Ob + 7] = W.y,
Ab[Ob + 8] = W.z,
D.morphNormals && (H ? (Db = tc[vb].vertexNormals[Cb], ab = Db.a, bb = Db.b, cb = Db.c) : cb = bb = ab = tc[vb].faceNormals[Cb], Bb = $b[vb], Bb[Ob] = ab.x, Bb[Ob + 1] = ab.y, Bb[Ob + 2] = ab.z, Bb[Ob + 3] = bb.x, Bb[Ob + 4] = bb.y, Bb[Ob + 5] = bb.z, Bb[Ob + 6] = cb.x, Bb[Ob + 7] = cb.y, Bb[Ob + 8] = cb.z),
Ob += 9;
for (I = 0, J = mc.length; J > I; I++)
Cb = mc[I],
L = nc[Cb],
U = sc[vb].vertices[L.a],
V = sc[vb].vertices[L.b],
W = sc[vb].vertices[L.c],
X = sc[vb].vertices[L.d],
Ab = Zb[vb],
Ab[Ob] = U.x,
Ab[Ob + 1] = U.y,
Ab[Ob + 2] = U.z,
Ab[Ob + 3] = V.x,
Ab[Ob + 4] = V.y,
Ab[Ob + 5] = V.z,
Ab[Ob + 6] = W.x,
Ab[Ob + 7] = W.y,
Ab[Ob + 8] = W.z,
Ab[Ob + 9] = X.x,
Ab[Ob + 10] = X.y,
Ab[Ob + 11] = X.z,
D.morphNormals && (H ? (Db = tc[vb].vertexNormals[Cb], ab = Db.a, bb = Db.b, cb = Db.c, db = Db.d) : db = cb = bb = ab = tc[vb].faceNormals[Cb], Bb = $b[vb], Bb[Ob] = ab.x, Bb[Ob + 1] = ab.y, Bb[Ob + 2] = ab.z, Bb[Ob + 3] = bb.x, Bb[Ob + 4] = bb.y, Bb[Ob + 5] = bb.z, Bb[Ob + 6] = cb.x, Bb[Ob + 7] = cb.y, Bb[Ob + 8] = cb.z, Bb[Ob + 9] = db.x, Bb[Ob + 10] = db.y, Bb[Ob + 11] = db.z),
Ob += 12;
Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglMorphTargetsBuffers[vb]),
Q.bufferData(Q.ARRAY_BUFFER, Zb[vb], B),
D.morphNormals && (Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglMorphNormalsBuffers[vb]), Q.bufferData(Q.ARRAY_BUFFER, $b[vb], B))
}
if (rc.length) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
ib = rc[L.a],
jb = rc[L.b],
kb = rc[L.c],
Yb[Nb] = ib.x,
Yb[Nb + 1] = ib.y,
Yb[Nb + 2] = ib.z,
Yb[Nb + 3] = ib.w,
Yb[Nb + 4] = jb.x,
Yb[Nb + 5] = jb.y,
Yb[Nb + 6] = jb.z,
Yb[Nb + 7] = jb.w,
Yb[Nb + 8] = kb.x,
Yb[Nb + 9] = kb.y,
Yb[Nb + 10] = kb.z,
Yb[Nb + 11] = kb.w,
mb = qc[L.a],
nb = qc[L.b],
ob = qc[L.c],
Xb[Nb] = mb.x,
Xb[Nb + 1] = mb.y,
Xb[Nb + 2] = mb.z,
Xb[Nb + 3] = mb.w,
Xb[Nb + 4] = nb.x,
Xb[Nb + 5] = nb.y,
Xb[Nb + 6] = nb.z,
Xb[Nb + 7] = nb.w,
Xb[Nb + 8] = ob.x,
Xb[Nb + 9] = ob.y,
Xb[Nb + 10] = ob.z,
Xb[Nb + 11] = ob.w,
Nb += 12;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
ib = rc[L.a],
jb = rc[L.b],
kb = rc[L.c],
lb = rc[L.d],
Yb[Nb] = ib.x,
Yb[Nb + 1] = ib.y,
Yb[Nb + 2] = ib.z,
Yb[Nb + 3] = ib.w,
Yb[Nb + 4] = jb.x,
Yb[Nb + 5] = jb.y,
Yb[Nb + 6] = jb.z,
Yb[Nb + 7] = jb.w,
Yb[Nb + 8] = kb.x,
Yb[Nb + 9] = kb.y,
Yb[Nb + 10] = kb.z,
Yb[Nb + 11] = kb.w,
Yb[Nb + 12] = lb.x,
Yb[Nb + 13] = lb.y,
Yb[Nb + 14] = lb.z,
Yb[Nb + 15] = lb.w,
mb = qc[L.a],
nb = qc[L.b],
ob = qc[L.c],
pb = qc[L.d],
Xb[Nb] = mb.x,
Xb[Nb + 1] = mb.y,
Xb[Nb + 2] = mb.z,
Xb[Nb + 3] = mb.w,
Xb[Nb + 4] = nb.x,
Xb[Nb + 5] = nb.y,
Xb[Nb + 6] = nb.z,
Xb[Nb + 7] = nb.w,
Xb[Nb + 8] = ob.x,
Xb[Nb + 9] = ob.y,
Xb[Nb + 10] = ob.z,
Xb[Nb + 11] = ob.w,
Xb[Nb + 12] = pb.x,
Xb[Nb + 13] = pb.y,
Xb[Nb + 14] = pb.z,
Xb[Nb + 15] = pb.w,
Nb += 16;
Nb > 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglSkinIndicesBuffer), Q.bufferData(Q.ARRAY_BUFFER, Xb, B), Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglSkinWeightsBuffer), Q.bufferData(Q.ARRAY_BUFFER, Yb, B))
}
if (ic && F) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
O = L.vertexColors,
P = L.color,
3 === O.length && F === THREE.VertexColors ? (eb = O[0], fb = O[1], gb = O[2]) : gb = fb = eb = P,
Wb[Mb] = eb.r,
Wb[Mb + 1] = eb.g,
Wb[Mb + 2] = eb.b,
Wb[Mb + 3] = fb.r,
Wb[Mb + 4] = fb.g,
Wb[Mb + 5] = fb.b,
Wb[Mb + 6] = gb.r,
Wb[Mb + 7] = gb.g,
Wb[Mb + 8] = gb.b,
Mb += 9;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
O = L.vertexColors,
P = L.color,
4 === O.length && F === THREE.VertexColors ? (eb = O[0], fb = O[1], gb = O[2], hb = O[3]) : hb = gb = fb = eb = P,
Wb[Mb] = eb.r,
Wb[Mb + 1] = eb.g,
Wb[Mb + 2] = eb.b,
Wb[Mb + 3] = fb.r,
Wb[Mb + 4] = fb.g,
Wb[Mb + 5] = fb.b,
Wb[Mb + 6] = gb.r,
Wb[Mb + 7] = gb.g,
Wb[Mb + 8] = gb.b,
Wb[Mb + 9] = hb.r,
Wb[Mb + 10] = hb.g,
Wb[Mb + 11] = hb.b,
Mb += 12;
Mb > 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglColorBuffer), Q.bufferData(Q.ARRAY_BUFFER, Wb, B))
}
if (hc && dc.hasTangents) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
R = L.vertexTangents,
Y = R[0],
Z = R[1],
$ = R[2],
Vb[Kb] = Y.x,
Vb[Kb + 1] = Y.y,
Vb[Kb + 2] = Y.z,
Vb[Kb + 3] = Y.w,
Vb[Kb + 4] = Z.x,
Vb[Kb + 5] = Z.y,
Vb[Kb + 6] = Z.z,
Vb[Kb + 7] = Z.w,
Vb[Kb + 8] = $.x,
Vb[Kb + 9] = $.y,
Vb[Kb + 10] = $.z,
Vb[Kb + 11] = $.w,
Kb += 12;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
R = L.vertexTangents,
Y = R[0],
Z = R[1],
$ = R[2],
_ = R[3],
Vb[Kb] = Y.x,
Vb[Kb + 1] = Y.y,
Vb[Kb + 2] = Y.z,
Vb[Kb + 3] = Y.w,
Vb[Kb + 4] = Z.x,
Vb[Kb + 5] = Z.y,
Vb[Kb + 6] = Z.z,
Vb[Kb + 7] = Z.w,
Vb[Kb + 8] = $.x,
Vb[Kb + 9] = $.y,
Vb[Kb + 10] = $.z,
Vb[Kb + 11] = $.w,
Vb[Kb + 12] = _.x,
Vb[Kb + 13] = _.y,
Vb[Kb + 14] = _.z,
Vb[Kb + 15] = _.w,
Kb += 16;
Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglTangentBuffer),
Q.bufferData(Q.ARRAY_BUFFER, Vb, B)
}
if (gc && E) {
for (I = 0, J = lc.length; J > I; I++)
if (L = nc[lc[I]], M = L.vertexNormals, N = L.normal, 3 === M.length && H)
for (qb = 0; 3 > qb; qb++)
sb = M[qb],
Ub[Jb] = sb.x,
Ub[Jb + 1] = sb.y,
Ub[Jb + 2] = sb.z,
Jb += 3;
else
for (qb = 0; 3 > qb; qb++)
Ub[Jb] = N.x,
Ub[Jb + 1] = N.y,
Ub[Jb + 2] = N.z,
Jb += 3;
for (I = 0, J = mc.length; J > I; I++)
if (L = nc[mc[I]], M = L.vertexNormals, N = L.normal, 4 === M.length && H)
for (qb = 0; 4 > qb; qb++)
sb = M[qb],
Ub[Jb] = sb.x,
Ub[Jb + 1] = sb.y,
Ub[Jb + 2] = sb.z,
Jb += 3;
else
for (qb = 0; 4 > qb; qb++)
Ub[Jb] = N.x,
Ub[Jb + 1] = N.y,
Ub[Jb + 2] = N.z,
Jb += 3;
Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglNormalBuffer),
Q.bufferData(Q.ARRAY_BUFFER, Ub, B)
}
if (fc && oc && G) {
for (I = 0, J = lc.length; J > I; I++)
if (K = lc[I], S = oc[K], void 0 !== S)
for (qb = 0; 3 > qb; qb++)
tb = S[qb],
Sb[Gb] = tb.x,
Sb[Gb + 1] = tb.y,
Gb += 2;
for (I = 0, J = mc.length; J > I; I++)
if (K = mc[I], S = oc[K], void 0 !== S)
for (qb = 0; 4 > qb; qb++)
tb = S[qb],
Sb[Gb] = tb.x,
Sb[Gb + 1] = tb.y,
Gb += 2;
Gb > 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglUVBuffer), Q.bufferData(Q.ARRAY_BUFFER, Sb, B))
}
if (fc && pc && G) {
for (I = 0, J = lc.length; J > I; I++)
if (K = lc[I], T = pc[K], void 0 !== T)
for (qb = 0; 3 > qb; qb++)
ub = T[qb],
Tb[Hb] = ub.x,
Tb[Hb + 1] = ub.y,
Hb += 2;
for (I = 0, J = mc.length; J > I; I++)
if (K = mc[I], T = pc[K], void 0 !== T)
for (qb = 0; 4 > qb; qb++)
ub = T[qb],
Tb[Hb] = ub.x,
Tb[Hb + 1] = ub.y,
Hb += 2;
Hb > 0 && (Q.bindBuffer(Q.ARRAY_BUFFER, z.__webglUV2Buffer), Q.bufferData(Q.ARRAY_BUFFER, Tb, B))
}
if (ec) {
for (I = 0, J = lc.length; J > I; I++)
bc[Ib] = Eb,
bc[Ib + 1] = Eb + 1,
bc[Ib + 2] = Eb + 2,
Ib += 3,
cc[Lb] = Eb,
cc[Lb + 1] = Eb + 1,
cc[Lb + 2] = Eb,
cc[Lb + 3] = Eb + 2,
cc[Lb + 4] = Eb + 1,
cc[Lb + 5] = Eb + 2,
Lb += 6,
Eb += 3;
for (I = 0, J = mc.length; J > I; I++)
bc[Ib] = Eb,
bc[Ib + 1] = Eb + 1,
bc[Ib + 2] = Eb + 3,
bc[Ib + 3] = Eb + 1,
bc[Ib + 4] = Eb + 2,
bc[Ib + 5] = Eb + 3,
Ib += 6,
cc[Lb] = Eb,
cc[Lb + 1] = Eb + 1,
cc[Lb + 2] = Eb,
cc[Lb + 3] = Eb + 3,
cc[Lb + 4] = Eb + 1,
cc[Lb + 5] = Eb + 2,
cc[Lb + 6] = Eb + 2,
cc[Lb + 7] = Eb + 3,
Lb += 8,
Eb += 4;
Q.bindBuffer(Q.ELEMENT_ARRAY_BUFFER, z.__webglFaceBuffer),
Q.bufferData(Q.ELEMENT_ARRAY_BUFFER, bc, B),
Q.bindBuffer(Q.ELEMENT_ARRAY_BUFFER, z.__webglLineBuffer),
Q.bufferData(Q.ELEMENT_ARRAY_BUFFER, cc, B)
}
if (_b)
for (qb = 0, rb = _b.length; rb > qb; qb++)
if (ac = _b[qb], ac.__original.needsUpdate) {
if (Pb = 0, 1 === ac.size) {
if (void 0 === ac.boundTo || "vertices" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
ac.array[Pb] = ac.value[L.a],
ac.array[Pb + 1] = ac.value[L.b],
ac.array[Pb + 2] = ac.value[L.c],
Pb += 3;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
ac.array[Pb] = ac.value[L.a],
ac.array[Pb + 1] = ac.value[L.b],
ac.array[Pb + 2] = ac.value[L.c],
ac.array[Pb + 3] = ac.value[L.d],
Pb += 4
} else if ("faces" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
Qb = ac.value[lc[I]],
ac.array[Pb] = Qb,
ac.array[Pb + 1] = Qb,
ac.array[Pb + 2] = Qb,
Pb += 3;
for (I = 0, J = mc.length; J > I; I++)
Qb = ac.value[mc[I]],
ac.array[Pb] = Qb,
ac.array[Pb + 1] = Qb,
ac.array[Pb + 2] = Qb,
ac.array[Pb + 3] = Qb,
Pb += 4
}
} else if (2 === ac.size) {
if (void 0 === ac.boundTo || "vertices" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
U = ac.value[L.a],
V = ac.value[L.b],
W = ac.value[L.c],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = V.x,
ac.array[Pb + 3] = V.y,
ac.array[Pb + 4] = W.x,
ac.array[Pb + 5] = W.y,
Pb += 6;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
U = ac.value[L.a],
V = ac.value[L.b],
W = ac.value[L.c],
X = ac.value[L.d],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = V.x,
ac.array[Pb + 3] = V.y,
ac.array[Pb + 4] = W.x,
ac.array[Pb + 5] = W.y,
ac.array[Pb + 6] = X.x,
ac.array[Pb + 7] = X.y,
Pb += 8
} else if ("faces" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
W = V = U = Qb = ac.value[lc[I]],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = V.x,
ac.array[Pb + 3] = V.y,
ac.array[Pb + 4] = W.x,
ac.array[Pb + 5] = W.y,
Pb += 6;
for (I = 0, J = mc.length; J > I; I++)
X = W = V = U = Qb = ac.value[mc[I]],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = V.x,
ac.array[Pb + 3] = V.y,
ac.array[Pb + 4] = W.x,
ac.array[Pb + 5] = W.y,
ac.array[Pb + 6] = X.x,
ac.array[Pb + 7] = X.y,
Pb += 8
}
} else if (3 === ac.size) {
var uc;
if (uc = "c" === ac.type ? ["r", "g", "b"] : ["x", "y", "z"], void 0 === ac.boundTo || "vertices" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
U = ac.value[L.a],
V = ac.value[L.b],
W = ac.value[L.c],
ac.array[Pb] = U[uc[0]],
ac.array[Pb + 1] = U[uc[1]],
ac.array[Pb + 2] = U[uc[2]],
ac.array[Pb + 3] = V[uc[0]],
ac.array[Pb + 4] = V[uc[1]],
ac.array[Pb + 5] = V[uc[2]],
ac.array[Pb + 6] = W[uc[0]],
ac.array[Pb + 7] = W[uc[1]],
ac.array[Pb + 8] = W[uc[2]],
Pb += 9;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
U = ac.value[L.a],
V = ac.value[L.b],
W = ac.value[L.c],
X = ac.value[L.d],
ac.array[Pb] = U[uc[0]],
ac.array[Pb + 1] = U[uc[1]],
ac.array[Pb + 2] = U[uc[2]],
ac.array[Pb + 3] = V[uc[0]],
ac.array[Pb + 4] = V[uc[1]],
ac.array[Pb + 5] = V[uc[2]],
ac.array[Pb + 6] = W[uc[0]],
ac.array[Pb + 7] = W[uc[1]],
ac.array[Pb + 8] = W[uc[2]],
ac.array[Pb + 9] = X[uc[0]],
ac.array[Pb + 10] = X[uc[1]],
ac.array[Pb + 11] = X[uc[2]],
Pb += 12
} else if ("faces" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
W = V = U = Qb = ac.value[lc[I]],
ac.array[Pb] = U[uc[0]],
ac.array[Pb + 1] = U[uc[1]],
ac.array[Pb + 2] = U[uc[2]],
ac.array[Pb + 3] = V[uc[0]],
ac.array[Pb + 4] = V[uc[1]],
ac.array[Pb + 5] = V[uc[2]],
ac.array[Pb + 6] = W[uc[0]],
ac.array[Pb + 7] = W[uc[1]],
ac.array[Pb + 8] = W[uc[2]],
Pb += 9;
for (I = 0, J = mc.length; J > I; I++)
X = W = V = U = Qb = ac.value[mc[I]],
ac.array[Pb] = U[uc[0]],
ac.array[Pb + 1] = U[uc[1]],
ac.array[Pb + 2] = U[uc[2]],
ac.array[Pb + 3] = V[uc[0]],
ac.array[Pb + 4] = V[uc[1]],
ac.array[Pb + 5] = V[uc[2]],
ac.array[Pb + 6] = W[uc[0]],
ac.array[Pb + 7] = W[uc[1]],
ac.array[Pb + 8] = W[uc[2]],
ac.array[Pb + 9] = X[uc[0]],
ac.array[Pb + 10] = X[uc[1]],
ac.array[Pb + 11] = X[uc[2]],
Pb += 12
} else if ("faceVertices" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
Qb = ac.value[lc[I]],
U = Qb[0],
V = Qb[1],
W = Qb[2],
ac.array[Pb] = U[uc[0]],
ac.array[Pb + 1] = U[uc[1]],
ac.array[Pb + 2] = U[uc[2]],
ac.array[Pb + 3] = V[uc[0]],
ac.array[Pb + 4] = V[uc[1]],
ac.array[Pb + 5] = V[uc[2]],
ac.array[Pb + 6] = W[uc[0]],
ac.array[Pb + 7] = W[uc[1]],
ac.array[Pb + 8] = W[uc[2]],
Pb += 9;
for (I = 0, J = mc.length; J > I; I++)
Qb = ac.value[mc[I]],
U = Qb[0],
V = Qb[1],
W = Qb[2],
X = Qb[3],
ac.array[Pb] = U[uc[0]],
ac.array[Pb + 1] = U[uc[1]],
ac.array[Pb + 2] = U[uc[2]],
ac.array[Pb + 3] = V[uc[0]],
ac.array[Pb + 4] = V[uc[1]],
ac.array[Pb + 5] = V[uc[2]],
ac.array[Pb + 6] = W[uc[0]],
ac.array[Pb + 7] = W[uc[1]],
ac.array[Pb + 8] = W[uc[2]],
ac.array[Pb + 9] = X[uc[0]],
ac.array[Pb + 10] = X[uc[1]],
ac.array[Pb + 11] = X[uc[2]],
Pb += 12
}
} else if (4 === ac.size)
if (void 0 === ac.boundTo || "vertices" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
L = nc[lc[I]],
U = ac.value[L.a],
V = ac.value[L.b],
W = ac.value[L.c],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = U.z,
ac.array[Pb + 3] = U.w,
ac.array[Pb + 4] = V.x,
ac.array[Pb + 5] = V.y,
ac.array[Pb + 6] = V.z,
ac.array[Pb + 7] = V.w,
ac.array[Pb + 8] = W.x,
ac.array[Pb + 9] = W.y,
ac.array[Pb + 10] = W.z,
ac.array[Pb + 11] = W.w,
Pb += 12;
for (I = 0, J = mc.length; J > I; I++)
L = nc[mc[I]],
U = ac.value[L.a],
V = ac.value[L.b],
W = ac.value[L.c],
X = ac.value[L.d],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = U.z,
ac.array[Pb + 3] = U.w,
ac.array[Pb + 4] = V.x,
ac.array[Pb + 5] = V.y,
ac.array[Pb + 6] = V.z,
ac.array[Pb + 7] = V.w,
ac.array[Pb + 8] = W.x,
ac.array[Pb + 9] = W.y,
ac.array[Pb + 10] = W.z,
ac.array[Pb + 11] = W.w,
ac.array[Pb + 12] = X.x,
ac.array[Pb + 13] = X.y,
ac.array[Pb + 14] = X.z,
ac.array[Pb + 15] = X.w,
Pb += 16
} else if ("faces" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
W = V = U = Qb = ac.value[lc[I]],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = U.z,
ac.array[Pb + 3] = U.w,
ac.array[Pb + 4] = V.x,
ac.array[Pb + 5] = V.y,
ac.array[Pb + 6] = V.z,
ac.array[Pb + 7] = V.w,
ac.array[Pb + 8] = W.x,
ac.array[Pb + 9] = W.y,
ac.array[Pb + 10] = W.z,
ac.array[Pb + 11] = W.w,
Pb += 12;
for (I = 0, J = mc.length; J > I; I++)
X = W = V = U = Qb = ac.value[mc[I]],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = U.z,
ac.array[Pb + 3] = U.w,
ac.array[Pb + 4] = V.x,
ac.array[Pb + 5] = V.y,
ac.array[Pb + 6] = V.z,
ac.array[Pb + 7] = V.w,
ac.array[Pb + 8] = W.x,
ac.array[Pb + 9] = W.y,
ac.array[Pb + 10] = W.z,
ac.array[Pb + 11] = W.w,
ac.array[Pb + 12] = X.x,
ac.array[Pb + 13] = X.y,
ac.array[Pb + 14] = X.z,
ac.array[Pb + 15] = X.w,
Pb += 16
} else if ("faceVertices" === ac.boundTo) {
for (I = 0, J = lc.length; J > I; I++)
Qb = ac.value[lc[I]],
U = Qb[0],
V = Qb[1],
W = Qb[2],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = U.z,
ac.array[Pb + 3] = U.w,
ac.array[Pb + 4] = V.x,
ac.array[Pb + 5] = V.y,
ac.array[Pb + 6] = V.z,
ac.array[Pb + 7] = V.w,
ac.array[Pb + 8] = W.x,
ac.array[Pb + 9] = W.y,
ac.array[Pb + 10] = W.z,
ac.array[Pb + 11] = W.w,
Pb += 12;
for (I = 0, J = mc.length; J > I; I++)
Qb = ac.value[mc[I]],
U = Qb[0],
V = Qb[1],
W = Qb[2],
X = Qb[3],
ac.array[Pb] = U.x,
ac.array[Pb + 1] = U.y,
ac.array[Pb + 2] = U.z,
ac.array[Pb + 3] = U.w,
ac.array[Pb + 4] = V.x,
ac.array[Pb + 5] = V.y,
ac.array[Pb + 6] = V.z,
ac.array[Pb + 7] = V.w,
ac.array[Pb + 8] = W.x,
ac.array[Pb + 9] = W.y,
ac.array[Pb + 10] = W.z,
ac.array[Pb + 11] = W.w,
ac.array[Pb + 12] = X.x,
ac.array[Pb + 13] = X.y,
ac.array[Pb + 14] = X.z,
ac.array[Pb + 15] = X.w,
Pb += 16
}
Q.bindBuffer(Q.ARRAY_BUFFER, ac.buffer),
Q.bufferData(Q.ARRAY_BUFFER, ac.array, B)
}
C && (delete z.__inittedArrays, delete z.__colorArray, delete z.__normalArray, delete z.__tangentArray, delete z.__uvArray, delete z.__uv2Array, delete z.__faceArray, delete z.__vertexArray, delete z.__lineArray, delete z.__skinIndexArray, delete z.__skinWeightArray)
}
}
j.verticesNeedUpdate = !1,
j.morphTargetsNeedUpdate = !1,
j.elementsNeedUpdate = !1,
j.uvsNeedUpdate = !1,
j.normalsNeedUpdate = !1,
j.colorsNeedUpdate = !1,
j.tangentsNeedUpdate = !1,
j.buffersNeedUpdate = !1,
n.attributes && r(n)
} else if (i instanceof THREE.Ribbon) {
if (n = e(i, j), m = n.attributes && q(n), j.verticesNeedUpdate || j.colorsNeedUpdate || j.normalsNeedUpdate || m) {
var vc = j,
wc = Q.DYNAMIC_DRAW,
xc = void 0,
yc = void 0,
zc = void 0,
Ac = void 0,
Bc = void 0,
Cc = void 0,
Dc = void 0,
Ec = void 0,
Fc = void 0,
Gc = void 0,
Hc = void 0,
Ic = void 0,
Jc = void 0,
Kc = vc.vertices,
Lc = vc.colors,
Mc = vc.normals,
Nc = Kc.length,
Oc = Lc.length,
Pc = Mc.length,
Qc = vc.__vertexArray,
Rc = vc.__colorArray,
Sc = vc.__normalArray,
Tc = vc.colorsNeedUpdate,
Uc = vc.normalsNeedUpdate,
Vc = vc.__webglCustomAttributesList;
if (vc.verticesNeedUpdate) {
for (xc = 0; Nc > xc; xc++)
Ac = Kc[xc],
Bc = 3 * xc,
Qc[Bc] = Ac.x,
Qc[Bc + 1] = Ac.y,
Qc[Bc + 2] = Ac.z;
Q.bindBuffer(Q.ARRAY_BUFFER, vc.__webglVertexBuffer),
Q.bufferData(Q.ARRAY_BUFFER, Qc, wc)
}
if (Tc) {
for (yc = 0; Oc > yc; yc++)
Cc = Lc[yc],
Bc = 3 * yc,
Rc[Bc] = Cc.r,
Rc[Bc + 1] = Cc.g,
Rc[Bc + 2] = Cc.b;
Q.bindBuffer(Q.ARRAY_BUFFER, vc.__webglColorBuffer),
Q.bufferData(Q.ARRAY_BUFFER, Rc, wc)
}
if (Uc) {
for (zc = 0; Pc > zc; zc++)
Dc = Mc[zc],
Bc = 3 * zc,
Sc[Bc] = Dc.x,
Sc[Bc + 1] = Dc.y,
Sc[Bc + 2] = Dc.z;
Q.bindBuffer(Q.ARRAY_BUFFER, vc.__webglNormalBuffer),
Q.bufferData(Q.ARRAY_BUFFER, Sc, wc)
}
if (Vc)
for (Ec = 0, Fc = Vc.length; Fc > Ec; Ec++)
if (Ic = Vc[Ec], Ic.needsUpdate && (void 0 === Ic.boundTo || "vertices" === Ic.boundTo)) {
if (Bc = 0, Hc = Ic.value.length, 1 === Ic.size)
for (Gc = 0; Hc > Gc; Gc++)
Ic.array[Gc] = Ic.value[Gc];
else if (2 === Ic.size)
for (Gc = 0; Hc > Gc; Gc++)
Jc = Ic.value[Gc],
Ic.array[Bc] = Jc.x,
Ic.array[Bc + 1] = Jc.y,
Bc += 2;
else if (3 === Ic.size)
if ("c" === Ic.type)
for (Gc = 0; Hc > Gc; Gc++)
Jc = Ic.value[Gc],
Ic.array[Bc] = Jc.r,
Ic.array[Bc + 1] = Jc.g,
Ic.array[Bc + 2] = Jc.b,
Bc += 3;
else
for (Gc = 0; Hc > Gc; Gc++)
Jc = Ic.value[Gc],
Ic.array[Bc] = Jc.x,
Ic.array[Bc + 1] = Jc.y,
Ic.array[Bc + 2] = Jc.z,
Bc += 3;
else if (4 === Ic.size)
for (Gc = 0; Hc > Gc; Gc++)
Jc = Ic.value[Gc],
Ic.array[Bc] = Jc.x,
Ic.array[Bc + 1] = Jc.y,
Ic.array[Bc + 2] = Jc.z,
Ic.array[Bc + 3] = Jc.w,
Bc += 4;
Q.bindBuffer(Q.ARRAY_BUFFER, Ic.buffer),
Q.bufferData(Q.ARRAY_BUFFER, Ic.array, wc)
}
}
j.verticesNeedUpdate = !1,
j.colorsNeedUpdate = !1,
j.normalsNeedUpdate = !1,
n.attributes && r(n)
} else if (i instanceof THREE.Line) {
if (n = e(i, j), m = n.attributes && q(n), j.verticesNeedUpdate || j.colorsNeedUpdate || j.lineDistancesNeedUpdate || m) {
var Wc = j,
Xc = Q.DYNAMIC_DRAW,
Yc = void 0,
Zc = void 0,
$c = void 0,
_c = void 0,
ad = void 0,
bd = void 0,
cd = Wc.vertices,
dd = Wc.colors,
ed = Wc.lineDistances,
fd = cd.length,
gd = dd.length,
hd = ed.length,
id = Wc.__vertexArray,
jd = Wc.__colorArray,
kd = Wc.__lineDistanceArray,
ld = Wc.colorsNeedUpdate,
md = Wc.lineDistancesNeedUpdate,
nd = Wc.__webglCustomAttributesList,
od = void 0,
pd = void 0,
qd = void 0,
rd = void 0,
sd = void 0,
td = void 0;
if (Wc.verticesNeedUpdate) {
for (Yc = 0; fd > Yc; Yc++)
_c = cd[Yc],
ad = 3 * Yc,
id[ad] = _c.x,
id[ad + 1] = _c.y,
id[ad + 2] = _c.z;
Q.bindBuffer(Q.ARRAY_BUFFER, Wc.__webglVertexBuffer),
Q.bufferData(Q.ARRAY_BUFFER, id, Xc)
}
if (ld) {
for (Zc = 0; gd > Zc; Zc++)
bd = dd[Zc],
ad = 3 * Zc,
jd[ad] = bd.r,
jd[ad + 1] = bd.g,
jd[ad + 2] = bd.b;
Q.bindBuffer(Q.ARRAY_BUFFER, Wc.__webglColorBuffer),
Q.bufferData(Q.ARRAY_BUFFER, jd, Xc)
}
if (md) {
for ($c = 0; hd > $c; $c++)
kd[$c] = ed[$c];
Q.bindBuffer(Q.ARRAY_BUFFER, Wc.__webglLineDistanceBuffer),
Q.bufferData(Q.ARRAY_BUFFER, kd, Xc)
}
if (nd)
for (od = 0, pd = nd.length; pd > od; od++)
if (td = nd[od], td.needsUpdate && (void 0 === td.boundTo || "vertices" === td.boundTo)) {
if (ad = 0, rd = td.value.length, 1 === td.size)
for (qd = 0; rd > qd; qd++)
td.array[qd] = td.value[qd];
else if (2 === td.size)
for (qd = 0; rd > qd; qd++)
sd = td.value[qd],
td.array[ad] = sd.x,
td.array[ad + 1] = sd.y,
ad += 2;
else if (3 === td.size)
if ("c" === td.type)
for (qd = 0; rd > qd; qd++)
sd = td.value[qd],
td.array[ad] = sd.r,
td.array[ad + 1] = sd.g,
td.array[ad + 2] = sd.b,
ad += 3;
else
for (qd = 0; rd > qd; qd++)
sd = td.value[qd],
td.array[ad] = sd.x,
td.array[ad + 1] = sd.y,
td.array[ad + 2] = sd.z,
ad += 3;
else if (4 === td.size)
for (qd = 0; rd > qd; qd++)
sd = td.value[qd],
td.array[ad] = sd.x,
td.array[ad + 1] = sd.y,
td.array[ad + 2] = sd.z,
td.array[ad + 3] = sd.w,
ad += 4;
Q.bindBuffer(Q.ARRAY_BUFFER, td.buffer),
Q.bufferData(Q.ARRAY_BUFFER, td.array, Xc)
}
}
j.verticesNeedUpdate = !1,
j.colorsNeedUpdate = !1,
j.lineDistancesNeedUpdate = !1,
n.attributes && r(n)
} else if (i instanceof THREE.ParticleSystem) {
if (n = e(i, j), m = n.attributes && q(n), j.verticesNeedUpdate || j.colorsNeedUpdate || i.sortParticles || m) {
var ud = j,
vd = Q.DYNAMIC_DRAW,
wd = i,
xd = void 0,
yd = void 0,
zd = void 0,
Ad = void 0,
Bd = void 0,
Cd = void 0,
Dd = ud.vertices,
Ed = Dd.length,
Fd = ud.colors,
Gd = Fd.length,
Hd = ud.__vertexArray,
Id = ud.__colorArray,
Jd = ud.__sortArray,
Kd = ud.verticesNeedUpdate,
Ld = ud.colorsNeedUpdate,
Md = ud.__webglCustomAttributesList,
Nd = void 0,
Od = void 0,
Pd = void 0,
Qd = void 0,
Rd = void 0,
Sd = void 0;
if (wd.sortParticles) {
for (yb.copy(xb), yb.multiply(wd.matrixWorld), xd = 0; Ed > xd; xd++)
zd = Dd[xd],
zb.copy(zd),
zb.applyProjection(yb),
Jd[xd] = [zb.z, xd];
for (Jd.sort(k), xd = 0; Ed > xd; xd++)
zd = Dd[Jd[xd][1]],
Ad = 3 * xd,
Hd[Ad] = zd.x,
Hd[Ad + 1] = zd.y,
Hd[Ad + 2] = zd.z;
for (yd = 0; Gd > yd; yd++)
Ad = 3 * yd,
Cd = Fd[Jd[yd][1]],
Id[Ad] = Cd.r,
Id[Ad + 1] = Cd.g,
Id[Ad + 2] = Cd.b;
if (Md)
for (Nd = 0, Od = Md.length; Od > Nd; Nd++)
if (Sd = Md[Nd], void 0 === Sd.boundTo || "vertices" === Sd.boundTo)
if (Ad = 0, Qd = Sd.value.length, 1 === Sd.size)
for (Pd = 0; Qd > Pd; Pd++)
Bd = Jd[Pd][1],
Sd.array[Pd] = Sd.value[Bd];
else if (2 === Sd.size)
for (Pd = 0; Qd > Pd; Pd++)
Bd = Jd[Pd][1],
Rd = Sd.value[Bd],
Sd.array[Ad] = Rd.x,
Sd.array[Ad + 1] = Rd.y,
Ad += 2;
else if (3 === Sd.size)
if ("c" === Sd.type)
for (Pd = 0; Qd > Pd; Pd++)
Bd = Jd[Pd][1],
Rd = Sd.value[Bd],
Sd.array[Ad] = Rd.r,
Sd.array[Ad + 1] = Rd.g,
Sd.array[Ad + 2] = Rd.b,
Ad += 3;
else
for (Pd = 0; Qd > Pd; Pd++)
Bd = Jd[Pd][1],
Rd = Sd.value[Bd],
Sd.array[Ad] = Rd.x,
Sd.array[Ad + 1] = Rd.y,
Sd.array[Ad + 2] = Rd.z,
Ad += 3;
else if (4 === Sd.size)
for (Pd = 0; Qd > Pd; Pd++)
Bd = Jd[Pd][1],
Rd = Sd.value[Bd],
Sd.array[Ad] = Rd.x,
Sd.array[Ad + 1] = Rd.y,
Sd.array[Ad + 2] = Rd.z,
Sd.array[Ad + 3] = Rd.w,
Ad += 4
} else {
if (Kd)
for (xd = 0; Ed > xd; xd++)
zd = Dd[xd],
Ad = 3 * xd,
Hd[Ad] = zd.x,
Hd[Ad + 1] = zd.y,
Hd[Ad + 2] = zd.z;
if (Ld)
for (yd = 0; Gd > yd; yd++)
Cd = Fd[yd],
Ad = 3 * yd,
Id[Ad] = Cd.r,
Id[Ad + 1] = Cd.g,
Id[Ad + 2] = Cd.b;
if (Md)
for (Nd = 0, Od = Md.length; Od > Nd; Nd++)
if (Sd = Md[Nd], Sd.needsUpdate && (void 0 === Sd.boundTo || "vertices" === Sd.boundTo))
if (Qd = Sd.value.length, Ad = 0, 1 === Sd.size)
for (Pd = 0; Qd > Pd; Pd++)
Sd.array[Pd] = Sd.value[Pd];
else if (2 === Sd.size)
for (Pd = 0; Qd > Pd; Pd++)
Rd = Sd.value[Pd],
Sd.array[Ad] = Rd.x,
Sd.array[Ad + 1] = Rd.y,
Ad += 2;
else if (3 === Sd.size)
if ("c" === Sd.type)
for (Pd = 0; Qd > Pd; Pd++)
Rd = Sd.value[Pd],
Sd.array[Ad] = Rd.r,
Sd.array[Ad + 1] = Rd.g,
Sd.array[Ad + 2] = Rd.b,
Ad += 3;
else
for (Pd = 0; Qd > Pd; Pd++)
Rd = Sd.value[Pd],
Sd.array[Ad] = Rd.x,
Sd.array[Ad + 1] = Rd.y,
Sd.array[Ad + 2] = Rd.z,
Ad += 3;
else if (4 === Sd.size)
for (Pd = 0; Qd > Pd; Pd++)
Rd = Sd.value[Pd],
Sd.array[Ad] = Rd.x,
Sd.array[Ad + 1] = Rd.y,
Sd.array[Ad + 2] = Rd.z,
Sd.array[Ad + 3] = Rd.w,
Ad += 4
}
if ((Kd || wd.sortParticles) && (Q.bindBuffer(Q.ARRAY_BUFFER, ud.__webglVertexBuffer), Q.bufferData(Q.ARRAY_BUFFER, Hd, vd)), (Ld || wd.sortParticles) && (Q.bindBuffer(Q.ARRAY_BUFFER, ud.__webglColorBuffer), Q.bufferData(Q.ARRAY_BUFFER, Id, vd)), Md)
for (Nd = 0, Od = Md.length; Od > Nd; Nd++)
Sd = Md[Nd],
(Sd.needsUpdate || wd.sortParticles) && (Q.bindBuffer(Q.ARRAY_BUFFER, Sd.buffer), Q.bufferData(Q.ARRAY_BUFFER, Sd.array, vd))
}
j.verticesNeedUpdate = !1,
j.colorsNeedUpdate = !1,
n.attributes && r(n)
}
}
},
this.initMaterial = function(a, b, c, d) {
var e,
f,
g,
h;
a.addEventListener("dispose", Tb);
var i,
j,
k,
l,
m;
if (a instanceof THREE.MeshDepthMaterial ? m = "depth": a instanceof THREE.MeshNormalMaterial ? m = "normal": a instanceof THREE.MeshBasicMaterial ? m = "basic": a instanceof THREE.MeshLambertMaterial ? m = "lambert": a instanceof THREE.MeshPhongMaterial ? m = "phong": a instanceof THREE.LineBasicMaterial ? m = "basic": a instanceof THREE.LineDashedMaterial ? m = "dashed": a instanceof THREE.ParticleBasicMaterial && (m = "particle_basic"), m) {
var n = THREE.ShaderLib[m];
a.uniforms = THREE.UniformsUtils.clone(n.uniforms),
a.vertexShader = n.vertexShader,
a.fragmentShader = n.fragmentShader
}
var o,
p,
q;
for (e = g = p = q = n = 0, f = b.length; f > e; e++)
o = b[e],
o.onlyShadow || (o instanceof THREE.DirectionalLight && g++, o instanceof THREE.PointLight && p++, o instanceof THREE.SpotLight && q++, o instanceof THREE.HemisphereLight && n++);
for (e = g, f = p, g = q, h = n, n = o = 0, q = b.length; q > n; n++)
p = b[n],
p.castShadow && (p instanceof THREE.SpotLight && o++, p instanceof THREE.DirectionalLight && !p.shadowCascade && o++);
l = o,
Jb && d && d.useVertexTexture ? k = 1024: (b = Q.getParameter(Q.MAX_VERTEX_UNIFORM_VECTORS), b = Math.floor((b - 20) / 4), void 0 !== d && d instanceof THREE.SkinnedMesh && (b = Math.min(d.bones.length, b), b < d.bones.length && console.warn("WebGLRenderer: too many bones - " + d.bones.length + ", this GPU supports just " + b + " (try OpenGL instead of ANGLE)")), k = b);
a: {
q = a.fragmentShader,
p = a.vertexShader,
n = a.uniforms,
b = a.attributes,
o = a.defines;
var r,
s,
t,
c = {
map: !!a.map,
envMap: !!a.envMap,
lightMap: !!a.lightMap,
bumpMap: !!a.bumpMap,
normalMap: !!a.normalMap,
specularMap: !!a.specularMap,
vertexColors: a.vertexColors,
fog: c,
useFog: a.fog,
fogExp: c instanceof THREE.FogExp2,
sizeAttenuation: a.sizeAttenuation,
skinning: a.skinning,
maxBones: k,
useVertexTexture: Jb && d && d.useVertexTexture,
boneTextureWidth: d && d.boneTextureWidth,
boneTextureHeight: d && d.boneTextureHeight,
morphTargets: a.morphTargets,
morphNormals: a.morphNormals,
maxMorphTargets: this.maxMorphTargets,
maxMorphNormals: this.maxMorphNormals,
maxDirLights: e,
maxPointLights: f,
maxSpotLights: g,
maxHemiLights: h,
maxShadows: l,
shadowMapEnabled: this.shadowMapEnabled && d.receiveShadow,
shadowMapType: this.shadowMapType,
shadowMapDebug: this.shadowMapDebug,
shadowMapCascade: this.shadowMapCascade,
alphaTest: a.alphaTest,
metal: a.metal,
perPixel: a.perPixel,
wrapAround: a.wrapAround,
doubleSided: a.side === THREE.DoubleSide,
flipSided: a.side === THREE.BackSide
},
d = [];
m ? d.push(m) : (d.push(q), d.push(p));
for (s in o)
d.push(s),
d.push(o[s]);
for (r in c)
d.push(r),
d.push(c[r]);
for (m = d.join(), r = 0, s = W.length; s > r; r++)
if (d = W[r], d.code === m) {
d.usedTimes++,
j = d.program;
break a
}
r = "SHADOWMAP_TYPE_BASIC",
c.shadowMapType === THREE.PCFShadowMap ? r = "SHADOWMAP_TYPE_PCF": c.shadowMapType === THREE.PCFSoftShadowMap && (r = "SHADOWMAP_TYPE_PCF_SOFT"),
s = [];
for (t in o)
d = o[t],
!1 !== d && (d = "#define " + t + " " + d, s.push(d));
d = s.join("\n"),
t = Q.createProgram(),
s = ["precision " + I + " float;", d, Ib ? "#define VERTEX_TEXTURES": "", V.gammaInput ? "#define GAMMA_INPUT": "", V.gammaOutput ? "#define GAMMA_OUTPUT": "", V.physicallyBasedShading ? "#define PHYSICALLY_BASED_SHADING": "", "#define MAX_DIR_LIGHTS " + c.maxDirLights, "#define MAX_POINT_LIGHTS " + c.maxPointLights, "#define MAX_SPOT_LIGHTS " + c.maxSpotLights, "#define MAX_HEMI_LIGHTS " + c.maxHemiLights, "#define MAX_SHADOWS " + c.maxShadows, "#define MAX_BONES " + c.maxBones, c.map ? "#define USE_MAP": "", c.envMap ? "#define USE_ENVMAP": "", c.lightMap ? "#define USE_LIGHTMAP": "", c.bumpMap ? "#define USE_BUMPMAP": "", c.normalMap ? "#define USE_NORMALMAP": "", c.specularMap ? "#define USE_SPECULARMAP": "", c.vertexColors ? "#define USE_COLOR": "", c.skinning ? "#define USE_SKINNING": "", c.useVertexTexture ? "#define BONE_TEXTURE": "", c.boneTextureWidth ? "#define N_BONE_PIXEL_X " + c.boneTextureWidth.toFixed(1) : "", c.boneTextureHeight ? "#define N_BONE_PIXEL_Y " + c.boneTextureHeight.toFixed(1) : "", c.morphTargets ? "#define USE_MORPHTARGETS": "", c.morphNormals ? "#define USE_MORPHNORMALS": "", c.perPixel ? "#define PHONG_PER_PIXEL": "", c.wrapAround ? "#define WRAP_AROUND": "", c.doubleSided ? "#define DOUBLE_SIDED": "", c.flipSided ? "#define FLIP_SIDED": "", c.shadowMapEnabled ? "#define USE_SHADOWMAP": "", c.shadowMapEnabled ? "#define " + r: "", c.shadowMapDebug ? "#define SHADOWMAP_DEBUG": "", c.shadowMapCascade ? "#define SHADOWMAP_CASCADE": "", c.sizeAttenuation ? "#define USE_SIZEATTENUATION": "", "uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n"),
r = ["precision " + I + " float;", c.bumpMap || c.normalMap ? "#extension GL_OES_standard_derivatives : enable": "", d, "#define MAX_DIR_LIGHTS " + c.maxDirLights, "#define MAX_POINT_LIGHTS " + c.maxPointLights, "#define MAX_SPOT_LIGHTS " + c.maxSpotLights, "#define MAX_HEMI_LIGHTS " + c.maxHemiLights, "#define MAX_SHADOWS " + c.maxShadows, c.alphaTest ? "#define ALPHATEST " + c.alphaTest: "", V.gammaInput ? "#define GAMMA_INPUT": "", V.gammaOutput ? "#define GAMMA_OUTPUT": "", V.physicallyBasedShading ? "#define PHYSICALLY_BASED_SHADING": "", c.useFog && c.fog ? "#define USE_FOG": "", c.useFog && c.fogExp ? "#define FOG_EXP2": "", c.map ? "#define USE_MAP": "", c.envMap ? "#define USE_ENVMAP": "", c.lightMap ? "#define USE_LIGHTMAP": "", c.bumpMap ? "#define USE_BUMPMAP": "", c.normalMap ? "#define USE_NORMALMAP": "", c.specularMap ? "#define USE_SPECULARMAP": "", c.vertexColors ? "#define USE_COLOR": "", c.metal ? "#define METAL": "", c.perPixel ? "#define PHONG_PER_PIXEL": "", c.wrapAround ? "#define WRAP_AROUND": "", c.doubleSided ? "#define DOUBLE_SIDED": "", c.flipSided ? "#define FLIP_SIDED": "", c.shadowMapEnabled ? "#define USE_SHADOWMAP": "", c.shadowMapEnabled ? "#define " + r: "", c.shadowMapDebug ? "#define SHADOWMAP_DEBUG": "", c.shadowMapCascade ? "#define SHADOWMAP_CASCADE": "", "uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n"),
s = C("vertex", s + p),
r = C("fragment", r + q),
Q.attachShader(t, s),
Q.attachShader(t, r),
Q.linkProgram(t),
Q.getProgramParameter(t, Q.LINK_STATUS) || console.error("Could not initialise shader\nVALIDATE_STATUS: " + Q.getProgramParameter(t, Q.VALIDATE_STATUS) + ", gl error [" + Q.getError() + "]"),
Q.deleteShader(r),
Q.deleteShader(s),
t.uniforms = {},
t.attributes = {};
var u;
r = "viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" "),
r.push(c.useVertexTexture ? "boneTexture": "boneGlobalMatrices");
for (u in n)
r.push(u);
for (u = r, r = 0, s = u.length; s > r; r++)
n = u[r],
t.uniforms[n] = Q.getUniformLocation(t, n);
for (r = "position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" "), u = 0; u < c.maxMorphTargets; u++)
r.push("morphTarget" + u);
for (u = 0; u < c.maxMorphNormals; u++)
r.push("morphNormal" + u);
for (j in b)
r.push(j);
for (j = r, u = 0, b = j.length; b > u; u++)
r = j[u],
t.attributes[r] = Q.getAttribLocation(t, r);
t.id = X++,
W.push({
program: t,
code: m,
usedTimes: 1
}),
V.info.memory.programs = W.length,
j = t
}
if (a.program = j, u = a.program.attributes, a.morphTargets)
for (a.numSupportedMorphTargets = 0, b = "morphTarget", j = 0; j < this.maxMorphTargets; j++)
t = b + j,
0 <= u[t] && a.numSupportedMorphTargets++;
if (a.morphNormals)
for (a.numSupportedMorphNormals = 0, b = "morphNormal", j = 0; j < this.maxMorphNormals; j++)
t = b + j,
0 <= u[t] && a.numSupportedMorphNormals++;
a.uniformsList = [];
for (i in a.uniforms)
a.uniformsList.push([a.uniforms[i], i])
},
this.setFaceCulling = function(a, b) {
a === THREE.CullFaceNone ? Q.disable(Q.CULL_FACE) : (Q.frontFace(b === THREE.FrontFaceDirectionCW ? Q.CW: Q.CCW), Q.cullFace(a === THREE.CullFaceBack ? Q.BACK: a === THREE.CullFaceFront ? Q.FRONT: Q.FRONT_AND_BACK), Q.enable(Q.CULL_FACE))
},
this.setMaterialFaces = function(a) {
var b = a.side === THREE.DoubleSide,
a = a.side === THREE.BackSide;
db !== b && (b ? Q.disable(Q.CULL_FACE) : Q.enable(Q.CULL_FACE), db = b),
eb !== a && (Q.frontFace(a ? Q.CW: Q.CCW), eb = a)
},
this.setDepthTest = function(a) {
jb !== a && (a ? Q.enable(Q.DEPTH_TEST) : Q.disable(Q.DEPTH_TEST), jb = a)
},
this.setDepthWrite = function(a) {
kb !== a && (Q.depthMask(a), kb = a)
},
this.setBlending = function(a, b, c, d) {
a !== fb && (a === THREE.NoBlending ? Q.disable(Q.BLEND) : a === THREE.AdditiveBlending ? (Q.enable(Q.BLEND), Q.blendEquation(Q.FUNC_ADD), Q.blendFunc(Q.SRC_ALPHA, Q.ONE)) : a === THREE.SubtractiveBlending ? (Q.enable(Q.BLEND), Q.blendEquation(Q.FUNC_ADD), Q.blendFunc(Q.ZERO, Q.ONE_MINUS_SRC_COLOR)) : a === THREE.MultiplyBlending ? (Q.enable(Q.BLEND), Q.blendEquation(Q.FUNC_ADD), Q.blendFunc(Q.ZERO, Q.SRC_COLOR)) : a === THREE.CustomBlending ? Q.enable(Q.BLEND) : (Q.enable(Q.BLEND), Q.blendEquationSeparate(Q.FUNC_ADD, Q.FUNC_ADD), Q.blendFuncSeparate(Q.SRC_ALPHA, Q.ONE_MINUS_SRC_ALPHA, Q.ONE, Q.ONE_MINUS_SRC_ALPHA)), fb = a),
a === THREE.CustomBlending ? (b !== gb && (Q.blendEquation(G(b)), gb = b), (c !== hb || d !== ib) && (Q.blendFunc(G(c), G(d)), hb = c, ib = d)) : ib = hb = gb = null
},
this.setTexture = function(a, b) {
if (a.needsUpdate) {
a.__webglInit || (a.__webglInit = !0, a.addEventListener("dispose", Rb), a.__webglTexture = Q.createTexture(), V.info.memory.textures++),
Q.activeTexture(Q.TEXTURE0 + b),
Q.bindTexture(Q.TEXTURE_2D, a.__webglTexture),
Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL, a.flipY),
Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL, a.premultiplyAlpha),
Q.pixelStorei(Q.UNPACK_ALIGNMENT, a.unpackAlignment);
var c = a.image,
d = 0 === (c.width & c.width - 1) && 0 === (c.height & c.height - 1),
e = G(a.format),
f = G(a.type);
D(Q.TEXTURE_2D, a, d);
var g = a.mipmaps;
if (a instanceof THREE.DataTexture)
if (0 < g.length && d) {
for (var h = 0, i = g.length; i > h; h++)
c = g[h],
Q.texImage2D(Q.TEXTURE_2D, h, e, c.width, c.height, 0, e, f, c.data);
a.generateMipmaps = !1
} else
Q.texImage2D(Q.TEXTURE_2D, 0, e, c.width, c.height, 0, e, f, c.data);
else if (a instanceof THREE.CompressedTexture)
for (h = 0, i = g.length; i > h; h++)
c = g[h],
Q.compressedTexImage2D(Q.TEXTURE_2D, h, e, c.width, c.height, 0, c.data);
else if (0 < g.length && d) {
for (h = 0, i = g.length; i > h; h++)
c = g[h],
Q.texImage2D(Q.TEXTURE_2D, h, e, e, f, c);
a.generateMipmaps = !1
} else
Q.texImage2D(Q.TEXTURE_2D, 0, e, e, f, a.image);
a.generateMipmaps && d && Q.generateMipmap(Q.TEXTURE_2D),
a.needsUpdate = !1,
a.onUpdate && a.onUpdate()
} else
Q.activeTexture(Q.TEXTURE0 + b),
Q.bindTexture(Q.TEXTURE_2D, a.__webglTexture)
},
this.setRenderTarget = function(a) {
var b = a instanceof THREE.WebGLRenderTargetCube;
if (a && !a.__webglFramebuffer) {
void 0 === a.depthBuffer && (a.depthBuffer = !0),
void 0 === a.stencilBuffer && (a.stencilBuffer = !0),
a.addEventListener("dispose", Sb),
a.__webglTexture = Q.createTexture(),
V.info.memory.textures++;
var c = 0 === (a.width & a.width - 1) && 0 === (a.height & a.height - 1),
d = G(a.format),
e = G(a.type);
if (b) {
a.__webglFramebuffer = [],
a.__webglRenderbuffer = [],
Q.bindTexture(Q.TEXTURE_CUBE_MAP, a.__webglTexture),
D(Q.TEXTURE_CUBE_MAP, a, c);
for (var f = 0; 6 > f; f++) {
a.__webglFramebuffer[f] = Q.createFramebuffer(),
a.__webglRenderbuffer[f] = Q.createRenderbuffer(),
Q.texImage2D(Q.TEXTURE_CUBE_MAP_POSITIVE_X + f, 0, d, a.width, a.height, 0, d, e, null);
var g = a,
h = Q.TEXTURE_CUBE_MAP_POSITIVE_X + f;
Q.bindFramebuffer(Q.FRAMEBUFFER, a.__webglFramebuffer[f]),
Q.framebufferTexture2D(Q.FRAMEBUFFER, Q.COLOR_ATTACHMENT0, h, g.__webglTexture, 0),
E(a.__webglRenderbuffer[f], a)
}
c && Q.generateMipmap(Q.TEXTURE_CUBE_MAP)
} else
a.__webglFramebuffer = Q.createFramebuffer(),
a.__webglRenderbuffer = a.shareDepthFrom ? a.shareDepthFrom.__webglRenderbuffer: Q.createRenderbuffer(),
Q.bindTexture(Q.TEXTURE_2D, a.__webglTexture),
D(Q.TEXTURE_2D, a, c),
Q.texImage2D(Q.TEXTURE_2D, 0, d, a.width, a.height, 0, d, e, null),
d = Q.TEXTURE_2D,
Q.bindFramebuffer(Q.FRAMEBUFFER, a.__webglFramebuffer),
Q.framebufferTexture2D(Q.FRAMEBUFFER, Q.COLOR_ATTACHMENT0, d, a.__webglTexture, 0),
a.shareDepthFrom ? a.depthBuffer && !a.stencilBuffer ? Q.framebufferRenderbuffer(Q.FRAMEBUFFER, Q.DEPTH_ATTACHMENT, Q.RENDERBUFFER, a.__webglRenderbuffer) : a.depthBuffer && a.stencilBuffer && Q.framebufferRenderbuffer(Q.FRAMEBUFFER, Q.DEPTH_STENCIL_ATTACHMENT, Q.RENDERBUFFER, a.__webglRenderbuffer) : E(a.__webglRenderbuffer, a),
c && Q.generateMipmap(Q.TEXTURE_2D);
b ? Q.bindTexture(Q.TEXTURE_CUBE_MAP, null) : Q.bindTexture(Q.TEXTURE_2D, null),
Q.bindRenderbuffer(Q.RENDERBUFFER, null),
Q.bindFramebuffer(Q.FRAMEBUFFER, null)
}
a ? (b = b ? a.__webglFramebuffer[a.activeCubeFace] : a.__webglFramebuffer, c = a.width, a = a.height, e = d = 0) : (b = null, c = rb, a = sb, d = pb, e = qb),
b !== Z && (Q.bindFramebuffer(Q.FRAMEBUFFER, b), Q.viewport(d, e, c, a), Z = b),
tb = c,
ub = a
},
this.shadowMapPlugin = new THREE.ShadowMapPlugin,
this.addPrePlugin(this.shadowMapPlugin),
this.addPostPlugin(new THREE.SpritePlugin),
this.addPostPlugin(new THREE.LensFlarePlugin)
},
THREE.WebGLRenderTarget = function(a, b, c) {
this.width = a,
this.height = b,
c = c || {},
this.wrapS = void 0 !== c.wrapS ? c.wrapS: THREE.ClampToEdgeWrapping,
this.wrapT = void 0 !== c.wrapT ? c.wrapT: THREE.ClampToEdgeWrapping,
this.magFilter = void 0 !== c.magFilter ? c.magFilter: THREE.LinearFilter,
this.minFilter = void 0 !== c.minFilter ? c.minFilter: THREE.LinearMipMapLinearFilter,
this.anisotropy = void 0 !== c.anisotropy ? c.anisotropy: 1,
this.offset = new THREE.Vector2(0, 0),
this.repeat = new THREE.Vector2(1, 1),
this.format = void 0 !== c.format ? c.format: THREE.RGBAFormat,
this.type = void 0 !== c.type ? c.type: THREE.UnsignedByteType,
this.depthBuffer = void 0 !== c.depthBuffer ? c.depthBuffer: !0,
this.stencilBuffer = void 0 !== c.stencilBuffer ? c.stencilBuffer: !0,
this.generateMipmaps = !0,
this.shareDepthFrom = null
},
THREE.WebGLRenderTarget.prototype = {
constructor: THREE.WebGLRenderTarget,
addEventListener: THREE.EventDispatcher.prototype.addEventListener,
hasEventListener: THREE.EventDispatcher.prototype.hasEventListener,
removeEventListener: THREE.EventDispatcher.prototype.removeEventListener,
dispatchEvent: THREE.EventDispatcher.prototype.dispatchEvent,
clone: function() {
var a = new THREE.WebGLRenderTarget(this.width, this.height);
return a.wrapS = this.wrapS,
a.wrapT = this.wrapT,
a.magFilter = this.magFilter,
a.minFilter = this.minFilter,
a.anisotropy = this.anisotropy,
a.offset.copy(this.offset),
a.repeat.copy(this.repeat),
a.format = this.format,
a.type = this.type,
a.depthBuffer = this.depthBuffer,
a.stencilBuffer = this.stencilBuffer,
a.generateMipmaps = this.generateMipmaps,
a.shareDepthFrom = this.shareDepthFrom,
a
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
}
},
THREE.WebGLRenderTargetCube = function(a, b, c) {
THREE.WebGLRenderTarget.call(this, a, b, c),
this.activeCubeFace = 0
},
THREE.WebGLRenderTargetCube.prototype = Object.create(THREE.WebGLRenderTarget.prototype),
THREE.RenderableVertex = function() {
this.positionWorld = new THREE.Vector3,
this.positionScreen = new THREE.Vector4,
this.visible = !0
},
THREE.RenderableVertex.prototype.copy = function(a) {
this.positionWorld.copy(a.positionWorld),
this.positionScreen.copy(a.positionScreen)
},
THREE.RenderableFace3 = function() {
this.v1 = new THREE.RenderableVertex,
this.v2 = new THREE.RenderableVertex,
this.v3 = new THREE.RenderableVertex,
this.centroidModel = new THREE.Vector3,
this.normalModel = new THREE.Vector3,
this.normalModelView = new THREE.Vector3,
this.vertexNormalsLength = 0,
this.vertexNormalsModel = [new THREE.Vector3, new THREE.Vector3, new THREE.Vector3],
this.vertexNormalsModelView = [new THREE.Vector3, new THREE.Vector3, new THREE.Vector3],
this.material = this.color = null,
this.uvs = [[]],
this.z = null
},
THREE.RenderableFace4 = function() {
this.v1 = new THREE.RenderableVertex,
this.v2 = new THREE.RenderableVertex,
this.v3 = new THREE.RenderableVertex,
this.v4 = new THREE.RenderableVertex,
this.centroidModel = new THREE.Vector3,
this.normalModel = new THREE.Vector3,
this.normalModelView = new THREE.Vector3,
this.vertexNormalsLength = 0,
this.vertexNormalsModel = [new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3],
this.vertexNormalsModelView = [new THREE.Vector3, new THREE.Vector3, new THREE.Vector3, new THREE.Vector3],
this.material = this.color = null,
this.uvs = [[]],
this.z = null
},
THREE.RenderableObject = function() {
this.z = this.object = null
},
THREE.RenderableParticle = function() {
this.rotation = this.z = this.y = this.x = this.object = null,
this.scale = new THREE.Vector2,
this.material = null
},
THREE.RenderableLine = function() {
this.z = null,
this.v1 = new THREE.RenderableVertex,
this.v2 = new THREE.RenderableVertex,
this.vertexColors = [new THREE.Color, new THREE.Color],
this.material = null
},
THREE.GeometryUtils = {
merge: function(a, b, c) {
var d,
e,
f = a.vertices.length,
g = b instanceof THREE.Mesh ? b.geometry: b,
h = a.vertices,
i = g.vertices,
j = a.faces,
k = g.faces,
a = a.faceVertexUvs[0],
g = g.faceVertexUvs[0];
void 0 === c && (c = 0),
b instanceof THREE.Mesh && (b.matrixAutoUpdate && b.updateMatrix(), d = b.matrix, e = (new THREE.Matrix3).getNormalMatrix(d));
for (var b = 0, l = i.length; l > b; b++) {
var m = i[b].clone();
d && m.applyMatrix4(d),
h.push(m)
}
for (b = 0, l = k.length; l > b; b++) {
var n,
o,
m = k[b],
p = m.vertexNormals,
q = m.vertexColors;
for (m instanceof THREE.Face3 ? n = new THREE.Face3(m.a + f, m.b + f, m.c + f) : m instanceof THREE.Face4 && (n = new THREE.Face4(m.a + f, m.b + f, m.c + f, m.d + f)), n.normal.copy(m.normal), e && n.normal.applyMatrix3(e).normalize(), h = 0, i = p.length; i > h; h++)
o = p[h].clone(),
e && o.applyMatrix3(e).normalize(),
n.vertexNormals.push(o);
for (n.color.copy(m.color), h = 0, i = q.length; i > h; h++)
o = q[h],
n.vertexColors.push(o.clone());
n.materialIndex = m.materialIndex + c,
n.centroid.copy(m.centroid),
d && n.centroid.applyMatrix4(d),
j.push(n)
}
for (b = 0, l = g.length; l > b; b++) {
for (c = g[b], d = [], h = 0, i = c.length; i > h; h++)
d.push(new THREE.Vector2(c[h].x, c[h].y));
a.push(d)
}
},
removeMaterials: function(a, b) {
for (var c = {}, d = 0, e = b.length; e > d; d++)
c[b[d]] = !0;
for (var f, g = [], d = 0, e = a.faces.length; e > d; d++)
f = a.faces[d],
f.materialIndex in c || g.push(f);
a.faces = g
},
randomPointInTriangle: function(a, b, c) {
var d,
e,
f,
g = new THREE.Vector3,
h = THREE.GeometryUtils.__v1;
return d = THREE.GeometryUtils.random(),
e = THREE.GeometryUtils.random(),
d + e > 1 && (d = 1 - d, e = 1 - e),
f = 1 - d - e,
g.copy(a),
g.multiplyScalar(d),
h.copy(b),
h.multiplyScalar(e),
g.add(h),
h.copy(c),
h.multiplyScalar(f),
g.add(h),
g
},
randomPointInFace: function(a, b, c) {
var d,
e,
f;
if (a instanceof THREE.Face3)
return d = b.vertices[a.a],
e = b.vertices[a.b],
f = b.vertices[a.c],
THREE.GeometryUtils.randomPointInTriangle(d, e, f);
if (a instanceof THREE.Face4) {
d = b.vertices[a.a],
e = b.vertices[a.b],
f = b.vertices[a.c];
var g,
b = b.vertices[a.d];
return c ? a._area1 && a._area2 ? (c = a._area1, g = a._area2) : (c = THREE.GeometryUtils.triangleArea(d, e, b), g = THREE.GeometryUtils.triangleArea(e, f, b), a._area1 = c, a._area2 = g) : (c = THREE.GeometryUtils.triangleArea(d, e, b), g = THREE.GeometryUtils.triangleArea(e, f, b)),
THREE.GeometryUtils.random() * (c + g) < c ? THREE.GeometryUtils.randomPointInTriangle(d, e, b) : THREE.GeometryUtils.randomPointInTriangle(e, f, b)
}
},
randomPointsInGeometry: function(a, b) {
function c(a) {
function b(c, d) {
if (c > d)
return c;
var e = c + Math.floor((d - c) / 2);
return n[e] > a ? b(c, e - 1) : n[e] < a ? b(e + 1, d) : e
}
return b(0, n.length - 1)
}
var d,
e,
f,
g,
h,
i,
j = a.faces,
k = a.vertices,
l = j.length,
m = 0,
n = [];
for (e = 0; l > e; e++)
d = j[e],
d instanceof THREE.Face3 ? (f = k[d.a], g = k[d.b], h = k[d.c], d._area = THREE.GeometryUtils.triangleArea(f, g, h)) : d instanceof THREE.Face4 && (f = k[d.a], g = k[d.b], h = k[d.c], i = k[d.d], d._area1 = THREE.GeometryUtils.triangleArea(f, g, i), d._area2 = THREE.GeometryUtils.triangleArea(g, h, i), d._area = d._area1 + d._area2),
m += d._area,
n[e] = m;
for (d = [], e = 0; b > e; e++)
k = THREE.GeometryUtils.random() * m,
k = c(k),
d[e] = THREE.GeometryUtils.randomPointInFace(j[k], a, !0);
return d
},
triangleArea: function(a, b, c) {
var d = THREE.GeometryUtils.__v1,
e = THREE.GeometryUtils.__v2;
return d.subVectors(b, a),
e.subVectors(c, a),
d.cross(e),
.5 * d.length()
},
center: function(a) {
a.computeBoundingBox();
var b = a.boundingBox,
c = new THREE.Vector3;
return c.addVectors(b.min, b.max),
c.multiplyScalar( - .5),
a.applyMatrix((new THREE.Matrix4).makeTranslation(c.x, c.y, c.z)),
a.computeBoundingBox(),
c
},
normalizeUVs: function(a) {
for (var a = a.faceVertexUvs[0], b = 0, c = a.length; c > b; b++)
for (var d = a[b], e = 0, f = d.length; f > e; e++)
1 !== d[e].x && (d[e].x -= Math.floor(d[e].x)),
1 !== d[e].y && (d[e].y -= Math.floor(d[e].y))
},
triangulateQuads: function(a) {
var b,
c,
d,
e,
f = [],
g = [],
h = [];
for (b = 0, c = a.faceUvs.length; c > b; b++)
g[b] = [];
for (b = 0, c = a.faceVertexUvs.length; c > b; b++)
h[b] = [];
for (b = 0, c = a.faces.length; c > b; b++)
if (d = a.faces[b], d instanceof THREE.Face4) {
e = d.a;
var i = d.b,
j = d.c,
k = d.d,
l = new THREE.Face3,
m = new THREE.Face3;
for (l.color.copy(d.color), m.color.copy(d.color), l.materialIndex = d.materialIndex, m.materialIndex = d.materialIndex, l.a = e, l.b = i, l.c = k, m.a = i, m.b = j, m.c = k, 4 === d.vertexColors.length && (l.vertexColors[0] = d.vertexColors[0].clone(), l.vertexColors[1] = d.vertexColors[1].clone(), l.vertexColors[2] = d.vertexColors[3].clone(), m.vertexColors[0] = d.vertexColors[1].clone(), m.vertexColors[1] = d.vertexColors[2].clone(), m.vertexColors[2] = d.vertexColors[3].clone()), f.push(l, m), d = 0, e = a.faceVertexUvs.length; e > d; d++)
a.faceVertexUvs[d].length && (l = a.faceVertexUvs[d][b], i = l[1], j = l[2], k = l[3], l = [l[0].clone(), i.clone(), k.clone()], i = [i.clone(), j.clone(), k.clone()], h[d].push(l, i));
for (d = 0, e = a.faceUvs.length; e > d; d++)
a.faceUvs[d].length && (i = a.faceUvs[d][b], g[d].push(i, i))
} else {
for (f.push(d), d = 0, e = a.faceUvs.length; e > d; d++)
g[d].push(a.faceUvs[d][b]);
for (d = 0, e = a.faceVertexUvs.length; e > d; d++)
h[d].push(a.faceVertexUvs[d][b])
}
a.faces = f,
a.faceUvs = g,
a.faceVertexUvs = h,
a.computeCentroids(),
a.computeFaceNormals(),
a.computeVertexNormals(),
a.hasTangents && a.computeTangents()
},
setMaterialIndex: function(a, b, c, d) {
for (a = a.faces, d = d || a.length - 1, c = c || 0; d >= c; c++)
a[c].materialIndex = b
}
},
THREE.GeometryUtils.random = THREE.Math.random16,
THREE.GeometryUtils.__v1 = new THREE.Vector3,
THREE.GeometryUtils.__v2 = new THREE.Vector3,
THREE.ImageUtils = {
crossOrigin: "anonymous",
loadTexture: function(a, b, c, d) {
var e = new Image,
f = new THREE.Texture(e, b),
b = new THREE.ImageLoader;
return b.addEventListener("load", function(a) {
f.image = a.content,
f.needsUpdate = !0,
c && c(f)
}),
b.addEventListener("error", function(a) {
d && d(a.message)
}),
b.crossOrigin = this.crossOrigin,
b.load(a, e),
f.sourceFile = a,
f
},
loadCompressedTexture: function(a, b, c, d) {
var e = new THREE.CompressedTexture;
e.mapping = b;
var f = new XMLHttpRequest;
return f.onload = function() {
var a = THREE.ImageUtils.parseDDS(f.response, !0);
e.format = a.format,
e.mipmaps = a.mipmaps,
e.image.width = a.width,
e.image.height = a.height,
e.generateMipmaps = !1,
e.needsUpdate = !0,
c && c(e)
},
f.onerror = d,
f.open("GET", a, !0),
f.responseType = "arraybuffer",
f.send(null),
e
},
loadTextureCube: function(a, b, c, d) {
var e = [];
e.loadCount = 0;
var f = new THREE.Texture;
f.image = e,
void 0 !== b && (f.mapping = b),
f.flipY = !1;
for (var b = 0, g = a.length; g > b;++b) {
var h = new Image;
e[b] = h,
h.onload = function() {
e.loadCount += 1,
6 === e.loadCount && (f.needsUpdate = !0, c && c(f))
},
h.onerror = d,
h.crossOrigin = this.crossOrigin,
h.src = a[b]
}
return f
},
loadCompressedTextureCube: function(a, b, c, d) {
var e = [];
e.loadCount = 0;
var f = new THREE.CompressedTexture;
if (f.image = e, void 0 !== b && (f.mapping = b), f.flipY = !1, f.generateMipmaps = !1, b = function(a, b) {
return function() {
var d = THREE.ImageUtils.parseDDS(a.response, !0);
b.format = d.format,
b.mipmaps = d.mipmaps,
b.width = d.width,
b.height = d.height,
e.loadCount += 1,
6 === e.loadCount && (f.format = d.format, f.needsUpdate = !0, c && c(f))
}
}, a instanceof Array)
for (var g = 0, h = a.length; h > g;++g) {
var i = {};
e[g] = i;
var j = new XMLHttpRequest;
j.onload = b(j, i),
j.onerror = d,
i = a[g],
j.open("GET", i, !0),
j.responseType = "arraybuffer",
j.send(null)
} else
j = new XMLHttpRequest,
j.onload = function() {
var a = THREE.ImageUtils.parseDDS(j.response, !0);
if (a.isCubemap) {
for (var b = a.mipmaps.length / a.mipmapCount, d = 0; b > d; d++) {
e[d] = {
mipmaps: []
};
for (var g = 0; g < a.mipmapCount; g++)
e[d].mipmaps.push(a.mipmaps[d * a.mipmapCount + g]),
e[d].format = a.format,
e[d].width = a.width,
e[d].height = a.height
}
f.format = a.format,
f.needsUpdate = !0,
c && c(f)
}
},
j.onerror = d,
j.open("GET", a, !0),
j.responseType = "arraybuffer",
j.send(null);
return f
},
parseDDS: function(a, b) {
function c(a) {
return a.charCodeAt(0) + (a.charCodeAt(1) << 8) + (a.charCodeAt(2) << 16) + (a.charCodeAt(3) << 24)
}
var d = {
mipmaps: [],
width: 0,
height: 0,
format: null,
mipmapCount: 1
},
e = c("DXT1"),
f = c("DXT3"),
g = c("DXT5"),
h = new Int32Array(a, 0, 31);
if (542327876 !== h[0])
return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),
d;
if (4 & !h[20])
return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
d;
var i = h[21];
switch (i) {
case e:
e = 8,
d.format = THREE.RGB_S3TC_DXT1_Format;
break;
case f:
e = 16,
d.format = THREE.RGBA_S3TC_DXT3_Format;
break;
case g:
e = 16,
d.format = THREE.RGBA_S3TC_DXT5_Format;
break;
default:
return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ", String.fromCharCode(255 & i, i >> 8 & 255, i >> 16 & 255, i >> 24 & 255)),
d
}
d.mipmapCount = 1,
131072 & h[2] && !1 !== b && (d.mipmapCount = Math.max(1, h[7])),
d.isCubemap = 512 & h[28] ? !0: !1,
d.width = h[4],
d.height = h[3];
for (var h = h[1] + 4, f = d.width, g = d.height, i = d.isCubemap ? 6: 1, j = 0; i > j; j++) {
for (var k = 0; k < d.mipmapCount; k++) {
var l = Math.max(4, f) / 4 * Math.max(4, g) / 4 * e,
m = {
data: new Uint8Array(a, h, l),
width: f,
height: g
};
d.mipmaps.push(m),
h += l,
f = Math.max(.5 * f, 1),
g = Math.max(.5 * g, 1)
}
f = d.width,
g = d.height
}
return d
},
getNormalMap: function(a, b) {
var c = function(a) {
var b = Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
return [a[0] / b, a[1] / b, a[2] / b]
},
b = 1 | b,
d = a.width,
e = a.height,
f = document.createElement("canvas");
f.width = d,
f.height = e;
var g = f.getContext("2d");
g.drawImage(a, 0, 0);
for (var h = g.getImageData(0, 0, d, e).data, i = g.createImageData(d, e), j = i.data, k = 0; d > k; k++)
for (var l = 0; e > l; l++) {
var m = 0 > l - 1 ? 0: l - 1,
n = l + 1 > e - 1 ? e - 1: l + 1,
o = 0 > k - 1 ? 0: k - 1,
p = k + 1 > d - 1 ? d - 1: k + 1,
q = [],
r = [0, 0, h[4 * (l * d + k)] / 255 * b];
for (q.push([ - 1, 0, h[4 * (l * d + o)] / 255 * b]), q.push([ - 1, -1, h[4 * (m * d + o)] / 255 * b]), q.push([0, -1, h[4 * (m * d + k)] / 255 * b]), q.push([1, -1, h[4 * (m * d + p)] / 255 * b]), q.push([1, 0, h[4 * (l * d + p)] / 255 * b]), q.push([1, 1, h[4 * (n * d + p)] / 255 * b]), q.push([0, 1, h[4 * (n * d + k)] / 255 * b]), q.push([ - 1, 1, h[4 * (n * d + o)] / 255 * b]), m = [], o = q.length, n = 0; o > n; n++) {
var p = q[n],
s = q[(n + 1) % o],
p = [p[0] - r[0], p[1] - r[1], p[2] - r[2]],
s = [s[0] - r[0], s[1] - r[1], s[2] - r[2]];
m.push(c([p[1] * s[2] - p[2] * s[1], p[2] * s[0] - p[0] * s[2], p[0] * s[1] - p[1] * s[0]]))
}
for (q = [0, 0, 0], n = 0; n < m.length; n++)
q[0] += m[n][0],
q[1] += m[n][1],
q[2] += m[n][2];
q[0] /= m.length,
q[1] /= m.length,
q[2] /= m.length,
r = 4 * (l * d + k),
j[r] = 255 * ((q[0] + 1) / 2) | 0,
j[r + 1] = 255 * ((q[1] + 1) / 2) | 0,
j[r + 2] = 255 * q[2] | 0,
j[r + 3] = 255
}
return g.putImageData(i, 0, 0),
f
},
generateDataTexture: function(a, b, c) {
for (var d = a * b, e = new Uint8Array(3 * d), f = Math.floor(255 * c.r), g = Math.floor(255 * c.g), c = Math.floor(255 * c.b), h = 0; d > h; h++)
e[3 * h] = f,
e[3 * h + 1] = g,
e[3 * h + 2] = c;
return a = new THREE.DataTexture(e, a, b, THREE.RGBFormat),
a.needsUpdate = !0,
a
}
},
THREE.SceneUtils = {
createMultiMaterialObject: function(a, b) {
for (var c = new THREE.Object3D, d = 0, e = b.length; e > d; d++)
c.add(new THREE.Mesh(a, b[d]));
return c
},
detach: function(a, b, c) {
a.applyMatrix(b.matrixWorld),
b.remove(a),
c.add(a)
},
attach: function(a, b, c) {
var d = new THREE.Matrix4;
d.getInverse(c.matrixWorld),
a.applyMatrix(d),
b.remove(a),
c.add(a)
}
},
THREE.FontUtils = {
faces: {},
face: "helvetiker",
weight: "normal",
style: "normal",
size: 150,
divisions: 10,
getFace: function() {
return this.faces[this.face][this.weight][this.style]
},
loadFace: function(a) {
var b = a.familyName.toLowerCase();
return this.faces[b] = this.faces[b] || {},
this.faces[b][a.cssFontWeight] = this.faces[b][a.cssFontWeight] || {},
this.faces[b][a.cssFontWeight][a.cssFontStyle] = a,
this.faces[b][a.cssFontWeight][a.cssFontStyle] = a
},
drawText: function(a) {
for (var b = this.getFace(), c = this.size / b.resolution, d = 0, e = String(a).split(""), f = e.length, g = [], a = 0; f > a; a++) {
var h = new THREE.Path,
h = this.extractGlyphPoints(e[a], b, c, d, h),
d = d + h.offset;
g.push(h.path)
}
return {
paths: g,
offset: d / 2
}
},
extractGlyphPoints: function(a, b, c, d, e) {
var f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
p,
q = [],
r = b.glyphs[a] || b.glyphs["?"];
if (r) {
if (r.o)
for (b = r._cachedOutline || (r._cachedOutline = r.o.split(" ")), i = b.length, a = 0; i > a;)
switch (h = b[a++]) {
case "m":
h = b[a++] * c + d,
j = b[a++] * c,
e.moveTo(h, j);
break;
case "l":
h = b[a++] * c + d,
j = b[a++] * c,
e.lineTo(h, j);
break;
case "q":
if (h = b[a++] * c + d, j = b[a++] * c, m = b[a++] * c + d, n = b[a++] * c, e.quadraticCurveTo(m, n, h, j), f = q[q.length - 1])
for (k = f.x, l = f.y, f = 1, g = this.divisions; g >= f; f++) {
var s = f / g;
THREE.Shape.Utils.b2(s, k, m, h),
THREE.Shape.Utils.b2(s, l, n, j)
}
break;
case "b":
if (h = b[a++] * c + d, j = b[a++] * c, m = b[a++] * c + d, n = b[a++] * -c, o = b[a++] * c + d, p = b[a++] * -c, e.bezierCurveTo(h, j, m, n, o, p), f = q[q.length - 1])
for (k = f.x, l = f.y, f = 1, g = this.divisions; g >= f; f++)
s = f / g,
THREE.Shape.Utils.b3(s, k, m, o, h),
THREE.Shape.Utils.b3(s, l, n, p, j)
}
return {
offset: r.ha * c,
path: e
}
}
}
},
THREE.FontUtils.generateShapes = function(a, b) {
var b = b || {},
c = void 0 !== b.curveSegments ? b.curveSegments: 4,
d = void 0 !== b.font ? b.font: "helvetiker",
e = void 0 !== b.weight ? b.weight: "normal",
f = void 0 !== b.style ? b.style: "normal";
for (THREE.FontUtils.size = void 0 !== b.size ? b.size: 100, THREE.FontUtils.divisions = c, THREE.FontUtils.face = d, THREE.FontUtils.weight = e, THREE.FontUtils.style = f, c = THREE.FontUtils.drawText(a).paths, d = [], e = 0, f = c.length; f > e; e++)
Array.prototype.push.apply(d, c[e].toShapes());
return d
},
function(a) {
var b = function(a) {
for (var b = a.length, c = 0, d = b - 1, e = 0; b > e; d = e++)
c += a[d].x * a[e].y - a[e].x * a[d].y;
return.5 * c
};
return a.Triangulate = function(a, c) {
var d = a.length;
if (3 > d)
return null;
var e,
f,
g,
h = [],
i = [],
j = [];
if (0 < b(a))
for (f = 0; d > f; f++)
i[f] = f;
else
for (f = 0; d > f; f++)
i[f] = d - 1 - f;
var k = 2 * d;
for (f = d - 1; d > 2;) {
if (0 >= k--) {
console.log("Warning, unable to triangulate polygon!");
break
}
e = f,
e >= d && (e = 0),
f = e + 1,
f >= d && (f = 0),
g = f + 1,
g >= d && (g = 0);
var l;
a: {
var m = l = void 0,
n = void 0,
o = void 0,
p = void 0,
q = void 0,
r = void 0,
s = void 0,
t = void 0,
m = a[i[e]].x,
n = a[i[e]].y,
o = a[i[f]].x,
p = a[i[f]].y,
q = a[i[g]].x,
r = a[i[g]].y;
if (1e - 10 > (o - m) * (r - n) - (p - n) * (q - m))
l = !1;
else {
var u = void 0,
v = void 0,
w = void 0,
x = void 0,
y = void 0,
z = void 0,
A = void 0,
B = void 0,
C = void 0,
D = void 0,
C = B = A = t = s = void 0,
u = q - o,
v = r - p,
w = m - q,
x = n - r,
y = o - m,
z = p - n;
for (l = 0; d > l; l++)
if (l !== e && l !== f && l !== g && (s = a[i[l]].x, t = a[i[l]].y, A = s - m, B = t - n, C = s - o, D = t - p, s -= q, t -= r, C = u * D - v * C, A = y * B - z * A, B = w * t - x * s, C >= 0 && B >= 0 && A >= 0)) {
l = !1;
break a
}
l = !0
}
}
if (l) {
for (h.push([a[i[e]], a[i[f]], a[i[g]]]), j.push([i[e], i[f], i[g]]), e = f, g = f + 1; d > g; e++, g++)
i[e] = i[g];
d--,
k = 2 * d
}
}
return c ? j: h
},
a.Triangulate.area = b,
a
} (THREE.FontUtils),
self._typeface_js = {
faces: THREE.FontUtils.faces,
loadFace: THREE.FontUtils.loadFace
},
THREE.typeface_js = self._typeface_js,
THREE.Curve = function() {},
THREE.Curve.prototype.getPoint = function() {
return console.log("Warning, getPoint() not implemented!"),
null
},
THREE.Curve.prototype.getPointAt = function(a) {
return a = this.getUtoTmapping(a),
this.getPoint(a)
},
THREE.Curve.prototype.getPoints = function(a) {
a || (a = 5);
var b,
c = [];
for (b = 0; a >= b; b++)
c.push(this.getPoint(b / a));
return c
},
THREE.Curve.prototype.getSpacedPoints = function(a) {
a || (a = 5);
var b,
c = [];
for (b = 0; a >= b; b++)
c.push(this.getPointAt(b / a));
return c
},
THREE.Curve.prototype.getLength = function() {
var a = this.getLengths();
return a[a.length - 1]
},
THREE.Curve.prototype.getLengths = function(a) {
if (a || (a = this.__arcLengthDivisions ? this.__arcLengthDivisions: 200), this.cacheArcLengths && this.cacheArcLengths.length == a + 1 && !this.needsUpdate)
return this.cacheArcLengths;
this.needsUpdate = !1;
var b,
c,
d = [],
e = this.getPoint(0),
f = 0;
for (d.push(0), c = 1; a >= c; c++)
b = this.getPoint(c / a),
f += b.distanceTo(e),
d.push(f),
e = b;
return this.cacheArcLengths = d
},
THREE.Curve.prototype.updateArcLengths = function() {
this.needsUpdate = !0,
this.getLengths()
},
THREE.Curve.prototype.getUtoTmapping = function(a, b) {
var c,
d = this.getLengths(),
e = 0,
f = d.length;
c = b ? b: a * d[f - 1];
for (var g, h = 0, i = f - 1; i >= h;)
if (e = Math.floor(h + (i - h) / 2), g = d[e] - c, 0 > g)
h = e + 1;
else {
if (! (g > 0)) {
i = e;
break
}
i = e - 1
}
return e = i,
d[e] == c ? e / (f - 1) : (h = d[e], d = (e + (c - h) / (d[e + 1] - h)) / (f - 1))
},
THREE.Curve.prototype.getTangent = function(a) {
var b = a - 1e - 4,
a = a + 1e - 4;
return 0 > b && (b = 0),
a > 1 && (a = 1),
b = this.getPoint(b),
this.getPoint(a).clone().sub(b).normalize()
},
THREE.Curve.prototype.getTangentAt = function(a) {
return a = this.getUtoTmapping(a),
this.getTangent(a)
},
THREE.LineCurve = function(a, b) {
this.v1 = a,
this.v2 = b
},
THREE.LineCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.LineCurve.prototype.getPoint = function(a) {
var b = this.v2.clone().sub(this.v1);
return b.multiplyScalar(a).add(this.v1),
b
},
THREE.LineCurve.prototype.getPointAt = function(a) {
return this.getPoint(a)
},
THREE.LineCurve.prototype.getTangent = function() {
return this.v2.clone().sub(this.v1).normalize()
},
THREE.QuadraticBezierCurve = function(a, b, c) {
this.v0 = a,
this.v1 = b,
this.v2 = c
},
THREE.QuadraticBezierCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.QuadraticBezierCurve.prototype.getPoint = function(a) {
var b;
return b = THREE.Shape.Utils.b2(a, this.v0.x, this.v1.x, this.v2.x),
a = THREE.Shape.Utils.b2(a, this.v0.y, this.v1.y, this.v2.y),
new THREE.Vector2(b, a)
},
THREE.QuadraticBezierCurve.prototype.getTangent = function(a) {
var b;
return b = THREE.Curve.Utils.tangentQuadraticBezier(a, this.v0.x, this.v1.x, this.v2.x),
a = THREE.Curve.Utils.tangentQuadraticBezier(a, this.v0.y, this.v1.y, this.v2.y),
b = new THREE.Vector2(b, a),
b.normalize(),
b
},
THREE.CubicBezierCurve = function(a, b, c, d) {
this.v0 = a,
this.v1 = b,
this.v2 = c,
this.v3 = d
},
THREE.CubicBezierCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.CubicBezierCurve.prototype.getPoint = function(a) {
var b;
return b = THREE.Shape.Utils.b3(a, this.v0.x, this.v1.x, this.v2.x, this.v3.x),
a = THREE.Shape.Utils.b3(a, this.v0.y, this.v1.y, this.v2.y, this.v3.y),
new THREE.Vector2(b, a)
},
THREE.CubicBezierCurve.prototype.getTangent = function(a) {
var b;
return b = THREE.Curve.Utils.tangentCubicBezier(a, this.v0.x, this.v1.x, this.v2.x, this.v3.x),
a = THREE.Curve.Utils.tangentCubicBezier(a, this.v0.y, this.v1.y, this.v2.y, this.v3.y),
b = new THREE.Vector2(b, a),
b.normalize(),
b
},
THREE.SplineCurve = function(a) {
this.points = void 0 == a ? [] : a
},
THREE.SplineCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.SplineCurve.prototype.getPoint = function(a) {
var b,
c = new THREE.Vector2,
d = [],
e = this.points;
return b = (e.length - 1) * a,
a = Math.floor(b),
b -= a,
d[0] = 0 == a ? a: a - 1,
d[1] = a,
d[2] = a > e.length - 2 ? e.length - 1: a + 1,
d[3] = a > e.length - 3 ? e.length - 1: a + 2,
c.x = THREE.Curve.Utils.interpolate(e[d[0]].x, e[d[1]].x, e[d[2]].x, e[d[3]].x, b),
c.y = THREE.Curve.Utils.interpolate(e[d[0]].y, e[d[1]].y, e[d[2]].y, e[d[3]].y, b),
c
},
THREE.EllipseCurve = function(a, b, c, d, e, f, g) {
this.aX = a,
this.aY = b,
this.xRadius = c,
this.yRadius = d,
this.aStartAngle = e,
this.aEndAngle = f,
this.aClockwise = g
},
THREE.EllipseCurve.prototype = Object.create(THREE.Curve.prototype),
THREE.EllipseCurve.prototype.getPoint = function(a) {
var b = this.aEndAngle - this.aStartAngle;
return this.aClockwise || (a = 1 - a),
b = this.aStartAngle + a * b,
a = this.aX + this.xRadius * Math.cos(b),
b = this.aY + this.yRadius * Math.sin(b),
new THREE.Vector2(a, b)
},
THREE.ArcCurve = function(a, b, c, d, e, f) {
THREE.EllipseCurve.call(this, a, b, c, c, d, e, f)
},
THREE.ArcCurve.prototype = Object.create(THREE.EllipseCurve.prototype),
THREE.Curve.Utils = {
tangentQuadraticBezier: function(a, b, c, d) {
return 2 * (1 - a) * (c - b) + 2 * a * (d - c)
},
tangentCubicBezier: function(a, b, c, d, e) {
return - 3 * b * (1 - a) * (1 - a) + 3 * c * (1 - a) * (1 - a) - 6 * a * c * (1 - a) + 6 * a * d * (1 - a) - 3 * a * a * d + 3 * a * a * e
},
tangentSpline: function(a) {
return 6 * a * a - 6 * a + (3 * a * a - 4 * a + 1) + ( - 6 * a * a + 6 * a) + (3 * a * a - 2 * a)
},
interpolate: function(a, b, c, d, e) {
var a = .5 * (c - a),
d = .5 * (d - b),
f = e * e;
return (2 * b - 2 * c + a + d) * e * f + ( - 3 * b + 3 * c - 2 * a - d) * f + a * e + b
}
},
THREE.Curve.create = function(a, b) {
return a.prototype = Object.create(THREE.Curve.prototype),
a.prototype.getPoint = b,
a
},
THREE.LineCurve3 = THREE.Curve.create(function(a, b) {
this.v1 = a,
this.v2 = b
}, function(a) {
var b = new THREE.Vector3;
return b.subVectors(this.v2, this.v1),
b.multiplyScalar(a),
b.add(this.v1),
b
}),
THREE.QuadraticBezierCurve3 = THREE.Curve.create(function(a, b, c) {
this.v0 = a,
this.v1 = b,
this.v2 = c
}, function(a) {
var b,
c;
return b = THREE.Shape.Utils.b2(a, this.v0.x, this.v1.x, this.v2.x),
c = THREE.Shape.Utils.b2(a, this.v0.y, this.v1.y, this.v2.y),
a = THREE.Shape.Utils.b2(a, this.v0.z, this.v1.z, this.v2.z),
new THREE.Vector3(b, c, a)
}),
THREE.CubicBezierCurve3 = THREE.Curve.create(function(a, b, c, d) {
this.v0 = a,
this.v1 = b,
this.v2 = c,
this.v3 = d
}, function(a) {
var b,
c;
return b = THREE.Shape.Utils.b3(a, this.v0.x, this.v1.x, this.v2.x, this.v3.x),
c = THREE.Shape.Utils.b3(a, this.v0.y, this.v1.y, this.v2.y, this.v3.y),
a = THREE.Shape.Utils.b3(a, this.v0.z, this.v1.z, this.v2.z, this.v3.z),
new THREE.Vector3(b, c, a)
}),
THREE.SplineCurve3 = THREE.Curve.create(function(a) {
this.points = void 0 == a ? [] : a
}, function(a) {
var b,
c = new THREE.Vector3,
d = [],
e = this.points,
a = (e.length - 1) * a;
b = Math.floor(a),
a -= b,
d[0] = 0 == b ? b: b - 1,
d[1] = b,
d[2] = b > e.length - 2 ? e.length - 1: b + 1,
d[3] = b > e.length - 3 ? e.length - 1: b + 2,
b = e[d[0]];
var f = e[d[1]],
g = e[d[2]],
d = e[d[3]];
return c.x = THREE.Curve.Utils.interpolate(b.x, f.x, g.x, d.x, a),
c.y = THREE.Curve.Utils.interpolate(b.y, f.y, g.y, d.y, a),
c.z = THREE.Curve.Utils.interpolate(b.z, f.z, g.z, d.z, a),
c
}),
THREE.ClosedSplineCurve3 = THREE.Curve.create(function(a) {
this.points = void 0 == a ? [] : a
}, function(a) {
var b,
c = new THREE.Vector3,
d = [],
e = this.points;
return b = (e.length - 0) * a,
a = Math.floor(b),
b -= a,
a += a > 0 ? 0: (Math.floor(Math.abs(a) / e.length) + 1) * e.length,
d[0] = (a - 1) % e.length,
d[1] = a % e.length,
d[2] = (a + 1) % e.length,
d[3] = (a + 2) % e.length,
c.x = THREE.Curve.Utils.interpolate(e[d[0]].x, e[d[1]].x, e[d[2]].x, e[d[3]].x, b),
c.y = THREE.Curve.Utils.interpolate(e[d[0]].y, e[d[1]].y, e[d[2]].y, e[d[3]].y, b),
c.z = THREE.Curve.Utils.interpolate(e[d[0]].z, e[d[1]].z, e[d[2]].z, e[d[3]].z, b),
c
}),
THREE.CurvePath = function() {
this.curves = [],
this.bends = [],
this.autoClose = !1
},
THREE.CurvePath.prototype = Object.create(THREE.Curve.prototype),
THREE.CurvePath.prototype.add = function(a) {
this.curves.push(a)
},
THREE.CurvePath.prototype.checkConnection = function() {},
THREE.CurvePath.prototype.closePath = function() {
var a = this.curves[0].getPoint(0),
b = this.curves[this.curves.length - 1].getPoint(1);
a.equals(b) || this.curves.push(new THREE.LineCurve(b, a))
},
THREE.CurvePath.prototype.getPoint = function(a) {
for (var b = a * this.getLength(), c = this.getCurveLengths(), a = 0; a < c.length;) {
if (c[a] >= b)
return b = c[a] - b,
a = this.curves[a],
b = 1 - b / a.getLength(),
a.getPointAt(b);
a++
}
return null
},
THREE.CurvePath.prototype.getLength = function() {
var a = this.getCurveLengths();
return a[a.length - 1]
},
THREE.CurvePath.prototype.getCurveLengths = function() {
if (this.cacheLengths && this.cacheLengths.length == this.curves.length)
return this.cacheLengths;
var a,
b = [],
c = 0,
d = this.curves.length;
for (a = 0; d > a; a++)
c += this.curves[a].getLength(),
b.push(c);
return this.cacheLengths = b
},
THREE.CurvePath.prototype.getBoundingBox = function() {
var a,
b,
c,
d,
e,
f,
g = this.getPoints();
a = b = Number.NEGATIVE_INFINITY,
d = e = Number.POSITIVE_INFINITY;
var h,
i,
j,
k,
l = g[0]
instanceof THREE.Vector3;
for (k = l ? new THREE.Vector3: new THREE.Vector2, i = 0, j = g.length; j > i; i++)
h = g[i],
h.x > a ? a = h.x: h.x < d && (d = h.x),
h.y > b ? b = h.y: h.y < e && (e = h.y),
l && (h.z > c ? c = h.z: h.z < f && (f = h.z)),
k.add(h);
return g = {
minX: d,
minY: e,
maxX: a,
maxY: b,
centroid: k.divideScalar(j)
},
l && (g.maxZ = c, g.minZ = f),
g
},
THREE.CurvePath.prototype.createPointsGeometry = function(a) {
return a = this.getPoints(a, !0),
this.createGeometry(a)
},
THREE.CurvePath.prototype.createSpacedPointsGeometry = function(a) {
return a = this.getSpacedPoints(a, !0),
this.createGeometry(a)
},
THREE.CurvePath.prototype.createGeometry = function(a) {
for (var b = new THREE.Geometry, c = 0; c < a.length; c++)
b.vertices.push(new THREE.Vector3(a[c].x, a[c].y, a[c].z || 0));
return b
},
THREE.CurvePath.prototype.addWrapPath = function(a) {
this.bends.push(a)
},
THREE.CurvePath.prototype.getTransformedPoints = function(a, b) {
var c,
d,
e = this.getPoints(a);
for (b || (b = this.bends), c = 0, d = b.length; d > c; c++)
e = this.getWrapPoints(e, b[c]);
return e
},
THREE.CurvePath.prototype.getTransformedSpacedPoints = function(a, b) {
var c,
d,
e = this.getSpacedPoints(a);
for (b || (b = this.bends), c = 0, d = b.length; d > c; c++)
e = this.getWrapPoints(e, b[c]);
return e
},
THREE.CurvePath.prototype.getWrapPoints = function(a, b) {
var c,
d,
e,
f,
g,
h,
i = this.getBoundingBox();
for (c = 0, d = a.length; d > c; c++)
e = a[c],
f = e.x,
g = e.y,
h = f / i.maxX,
h = b.getUtoTmapping(h, f),
f = b.getPoint(h),
g = b.getNormalVector(h).multiplyScalar(g),
e.x = f.x + g.x,
e.y = f.y + g.y;
return a
},
THREE.Gyroscope = function() {
THREE.Object3D.call(this)
},
THREE.Gyroscope.prototype = Object.create(THREE.Object3D.prototype),
THREE.Gyroscope.prototype.updateMatrixWorld = function(a) {
this.matrixAutoUpdate && this.updateMatrix(),
(this.matrixWorldNeedsUpdate || a) && (this.parent ? (this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorld.decompose(this.translationWorld, this.rotationWorld, this.scaleWorld), this.matrix.decompose(this.translationObject, this.rotationObject, this.scaleObject), this.matrixWorld.makeFromPositionQuaternionScale(this.translationWorld, this.rotationObject, this.scaleWorld)) : this.matrixWorld.copy(this.matrix), this.matrixWorldNeedsUpdate = !1, a = !0);
for (var b = 0, c = this.children.length; c > b; b++)
this.children[b].updateMatrixWorld(a)
},
THREE.Gyroscope.prototype.translationWorld = new THREE.Vector3,
THREE.Gyroscope.prototype.translationObject = new THREE.Vector3,
THREE.Gyroscope.prototype.rotationWorld = new THREE.Quaternion,
THREE.Gyroscope.prototype.rotationObject = new THREE.Quaternion,
THREE.Gyroscope.prototype.scaleWorld = new THREE.Vector3,
THREE.Gyroscope.prototype.scaleObject = new THREE.Vector3,
THREE.Path = function(a) {
THREE.CurvePath.call(this),
this.actions = [],
a && this.fromPoints(a)
},
THREE.Path.prototype = Object.create(THREE.CurvePath.prototype),
THREE.PathActions = {
MOVE_TO: "moveTo",
LINE_TO: "lineTo",
QUADRATIC_CURVE_TO: "quadraticCurveTo",
BEZIER_CURVE_TO: "bezierCurveTo",
CSPLINE_THRU: "splineThru",
ARC: "arc",
ELLIPSE: "ellipse"
},
THREE.Path.prototype.fromPoints = function(a) {
this.moveTo(a[0].x, a[0].y);
for (var b = 1, c = a.length; c > b; b++)
this.lineTo(a[b].x, a[b].y)
},
THREE.Path.prototype.moveTo = function() {
var a = Array.prototype.slice.call(arguments);
this.actions.push({
action: THREE.PathActions.MOVE_TO,
args: a
})
},
THREE.Path.prototype.lineTo = function(a, b) {
var c = Array.prototype.slice.call(arguments),
d = this.actions[this.actions.length - 1].args,
d = new THREE.LineCurve(new THREE.Vector2(d[d.length - 2], d[d.length - 1]), new THREE.Vector2(a, b));
this.curves.push(d),
this.actions.push({
action: THREE.PathActions.LINE_TO,
args: c
})
},
THREE.Path.prototype.quadraticCurveTo = function(a, b, c, d) {
var e = Array.prototype.slice.call(arguments),
f = this.actions[this.actions.length - 1].args,
f = new THREE.QuadraticBezierCurve(new THREE.Vector2(f[f.length - 2], f[f.length - 1]), new THREE.Vector2(a, b), new THREE.Vector2(c, d));
this.curves.push(f),
this.actions.push({
action: THREE.PathActions.QUADRATIC_CURVE_TO,
args: e
})
},
THREE.Path.prototype.bezierCurveTo = function(a, b, c, d, e, f) {
var g = Array.prototype.slice.call(arguments),
h = this.actions[this.actions.length - 1].args,
h = new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length - 2], h[h.length - 1]), new THREE.Vector2(a, b), new THREE.Vector2(c, d), new THREE.Vector2(e, f));
this.curves.push(h),
this.actions.push({
action: THREE.PathActions.BEZIER_CURVE_TO,
args: g
})
},
THREE.Path.prototype.splineThru = function(a) {
var b = Array.prototype.slice.call(arguments),
c = this.actions[this.actions.length - 1].args,
c = [new THREE.Vector2(c[c.length - 2], c[c.length - 1])];
Array.prototype.push.apply(c, a),
c = new THREE.SplineCurve(c),
this.curves.push(c),
this.actions.push({
action: THREE.PathActions.CSPLINE_THRU,
args: b
})
},
THREE.Path.prototype.arc = function(a, b, c, d, e, f) {
var g = this.actions[this.actions.length - 1].args;
this.absarc(a + g[g.length - 2], b + g[g.length - 1], c, d, e, f)
},
THREE.Path.prototype.absarc = function(a, b, c, d, e, f) {
this.absellipse(a, b, c, c, d, e, f)
},
THREE.Path.prototype.ellipse = function(a, b, c, d, e, f, g) {
var h = this.actions[this.actions.length - 1].args;
this.absellipse(a + h[h.length - 2], b + h[h.length - 1], c, d, e, f, g)
},
THREE.Path.prototype.absellipse = function(a, b, c, d, e, f, g) {
var h = Array.prototype.slice.call(arguments),
i = new THREE.EllipseCurve(a, b, c, d, e, f, g);
this.curves.push(i),
i = i.getPoint(g ? 1: 0),
h.push(i.x),
h.push(i.y),
this.actions.push({
action: THREE.PathActions.ELLIPSE,
args: h
})
},
THREE.Path.prototype.getSpacedPoints = function(a) {
a || (a = 40);
for (var b = [], c = 0; a > c; c++)
b.push(this.getPoint(c / a));
return b
},
THREE.Path.prototype.getPoints = function(a, b) {
if (this.useSpacedPoints)
return console.log("tata"),
this.getSpacedPoints(a, b);
var c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n,
o,
a = a || 12,
p = [];
for (c = 0, d = this.actions.length; d > c; c++)
switch (e = this.actions[c], f = e.action, e = e.args, f) {
case THREE.PathActions.MOVE_TO:
p.push(new THREE.Vector2(e[0], e[1]));
break;
case THREE.PathActions.LINE_TO:
p.push(new THREE.Vector2(e[0], e[1]));
break;
case THREE.PathActions.QUADRATIC_CURVE_TO:
for (g = e[2], h = e[3], k = e[0], l = e[1], 0 < p.length ? (f = p[p.length - 1], m = f.x, n = f.y) : (f = this.actions[c - 1].args, m = f[f.length - 2], n = f[f.length - 1]), e = 1; a >= e; e++)
o = e / a,
f = THREE.Shape.Utils.b2(o, m, k, g),
o = THREE.Shape.Utils.b2(o, n, l, h),
p.push(new THREE.Vector2(f, o));
break;
case THREE.PathActions.BEZIER_CURVE_TO:
for (g = e[4], h = e[5], k = e[0], l = e[1], i = e[2], j = e[3], 0 < p.length ? (f = p[p.length - 1], m = f.x, n = f.y) : (f = this.actions[c - 1].args, m = f[f.length - 2], n = f[f.length - 1]), e = 1; a >= e; e++)
o = e / a,
f = THREE.Shape.Utils.b3(o, m, k, i, g),
o = THREE.Shape.Utils.b3(o, n, l, j, h),
p.push(new THREE.Vector2(f, o));
break;
case THREE.PathActions.CSPLINE_THRU:
for (f = this.actions[c - 1].args, o = [new THREE.Vector2(f[f.length - 2], f[f.length - 1])], f = a * e[0].length, o = o.concat(e[0]), o = new THREE.SplineCurve(o), e = 1; f >= e; e++)
p.push(o.getPointAt(e / f));
break;
case THREE.PathActions.ARC:
for (g = e[0], h = e[1], l = e[2], i = e[3], f = e[4], k = !!e[5], m = f - i, n = 2 * a, e = 1; n >= e; e++)
o = e / n,
k || (o = 1 - o),
o = i + o * m,
f = g + l * Math.cos(o),
o = h + l * Math.sin(o),
p.push(new THREE.Vector2(f, o));
break;
case THREE.PathActions.ELLIPSE:
for (g = e[0], h = e[1], l = e[2], j = e[3], i = e[4], f = e[5], k = !!e[6], m = f - i, n = 2 * a, e = 1; n >= e; e++)
o = e / n,
k || (o = 1 - o),
o = i + o * m,
f = g + l * Math.cos(o),
o = h + j * Math.sin(o),
p.push(new THREE.Vector2(f, o))
}
return c = p[p.length - 1],
1e - 10 > Math.abs(c.x - p[0].x) && 1e - 10 > Math.abs(c.y - p[0].y) && p.splice(p.length - 1, 1),
b && p.push(p[0]),
p
},
THREE.Path.prototype.toShapes = function() {
var a,
b,
c,
d,
e = [],
f = new THREE.Path;
for (a = 0, b = this.actions.length; b > a; a++)
c = this.actions[a],
d = c.args,
c = c.action,
c == THREE.PathActions.MOVE_TO && 0 != f.actions.length && (e.push(f), f = new THREE.Path),
f[c].apply(f, d);
if (0 != f.actions.length && e.push(f), 0 == e.length)
return [];
var g;
if (d = [], a = !THREE.Shape.Utils.isClockWise(e[0].getPoints()), 1 == e.length)
return f = e[0],
g = new THREE.Shape,
g.actions = f.actions,
g.curves = f.curves,
d.push(g),
d;
if (a)
for (g = new THREE.Shape, a = 0, b = e.length; b > a; a++)
f = e[a],
THREE.Shape.Utils.isClockWise(f.getPoints()) ? (g.actions = f.actions, g.curves = f.curves, d.push(g), g = new THREE.Shape) : g.holes.push(f);
else {
for (a = 0, b = e.length; b > a; a++)
f = e[a],
THREE.Shape.Utils.isClockWise(f.getPoints()) ? (g && d.push(g), g = new THREE.Shape, g.actions = f.actions, g.curves = f.curves) : g.holes.push(f);
d.push(g)
}
return d
},
THREE.Shape = function() {
THREE.Path.apply(this, arguments),
this.holes = []
},
THREE.Shape.prototype = Object.create(THREE.Path.prototype),
THREE.Shape.prototype.extrude = function(a) {
return new THREE.ExtrudeGeometry(this, a)
},
THREE.Shape.prototype.makeGeometry = function(a) {
return new THREE.ShapeGeometry(this, a)
},
THREE.Shape.prototype.getPointsHoles = function(a) {
var b,
c = this.holes.length,
d = [];
for (b = 0; c > b; b++)
d[b] = this.holes[b].getTransformedPoints(a, this.bends);
return d
},
THREE.Shape.prototype.getSpacedPointsHoles = function(a) {
var b,
c = this.holes.length,
d = [];
for (b = 0; c > b; b++)
d[b] = this.holes[b].getTransformedSpacedPoints(a, this.bends);
return d
},
THREE.Shape.prototype.extractAllPoints = function(a) {
return {
shape: this.getTransformedPoints(a),
holes: this.getPointsHoles(a)
}
},
THREE.Shape.prototype.extractPoints = function(a) {
return this.useSpacedPoints ? this.extractAllSpacedPoints(a) : this.extractAllPoints(a)
},
THREE.Shape.prototype.extractAllSpacedPoints = function(a) {
return {
shape: this.getTransformedSpacedPoints(a),
holes: this.getSpacedPointsHoles(a)
}
},
THREE.Shape.Utils = {
removeHoles: function(a, b) {
var c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m = a.concat(),
n = m.concat(),
o = [];
for (g = 0; g < b.length; g++) {
for (h = b[g], Array.prototype.push.apply(n, h), d = Number.POSITIVE_INFINITY, c = 0; c < h.length; c++)
for (k = h[c], l = [], j = 0; j < m.length; j++)
i = m[j],
i = k.distanceToSquared(i),
l.push(i),
d > i && (d = i, e = c, f = j);
c = f - 1 >= 0 ? f - 1: m.length - 1,
d = e - 1 >= 0 ? e - 1: h.length - 1;
var p = [h[e], m[f], m[c]];
j = THREE.FontUtils.Triangulate.area(p);
var q = [h[e], h[d], m[f]];
k = THREE.FontUtils.Triangulate.area(q),
l = f,
i = e,
f += 1,
e += -1,
0 > f && (f += m.length),
f %= m.length,
0 > e && (e += h.length),
e %= h.length,
c = f - 1 >= 0 ? f - 1: m.length - 1,
d = e - 1 >= 0 ? e - 1: h.length - 1,
p = [h[e], m[f], m[c]],
p = THREE.FontUtils.Triangulate.area(p),
q = [h[e], h[d], m[f]],
q = THREE.FontUtils.Triangulate.area(q),
j + k > p + q && (f = l, e = i, 0 > f && (f += m.length), f %= m.length, 0 > e && (e += h.length), e %= h.length, c = f - 1 >= 0 ? f - 1: m.length - 1, d = e - 1 >= 0 ? e - 1: h.length - 1),
j = m.slice(0, f),
k = m.slice(f),
l = h.slice(e),
i = h.slice(0, e),
d = [h[e], h[d], m[f]],
o.push([h[e], m[f], m[c]]),
o.push(d),
m = j.concat(l).concat(i).concat(k)
}
return {
shape: m,
isolatedPts: o,
allpoints: n
}
},
triangulateShape: function(a, b) {
var c,
d,
e,
f,
g = THREE.Shape.Utils.removeHoles(a, b),
h = g.allpoints,
i = g.isolatedPts,
g = THREE.FontUtils.Triangulate(g.shape, !1),
j = {};
for (c = 0, d = h.length; d > c; c++)
f = h[c].x + ":" + h[c].y,
void 0 !== j[f] && console.log("Duplicate point", f),
j[f] = c;
for (c = 0, d = g.length; d > c; c++)
for (e = g[c], h = 0; 3 > h; h++)
f = e[h].x + ":" + e[h].y,
f = j[f],
void 0 !== f && (e[h] = f);
for (c = 0, d = i.length; d > c; c++)
for (e = i[c], h = 0; 3 > h; h++)
f = e[h].x + ":" + e[h].y,
f = j[f],
void 0 !== f && (e[h] = f);
return g.concat(i)
},
isClockWise: function(a) {
return 0 > THREE.FontUtils.Triangulate.area(a)
},
b2p0: function(a, b) {
var c = 1 - a;
return c * c * b
},
b2p1: function(a, b) {
return 2 * (1 - a) * a * b
},
b2p2: function(a, b) {
return a * a * b
},
b2: function(a, b, c, d) {
return this.b2p0(a, b) + this.b2p1(a, c) + this.b2p2(a, d)
},
b3p0: function(a, b) {
var c = 1 - a;
return c * c * c * b
},
b3p1: function(a, b) {
var c = 1 - a;
return 3 * c * c * a * b
},
b3p2: function(a, b) {
return 3 * (1 - a) * a * a * b
},
b3p3: function(a, b) {
return a * a * a * b
},
b3: function(a, b, c, d, e) {
return this.b3p0(a, b) + this.b3p1(a, c) + this.b3p2(a, d) + this.b3p3(a, e)
}
},
THREE.AnimationHandler = function() {
var a = [],
b = {},
c = {
update: function(b) {
for (var c = 0; c < a.length; c++)
a[c].update(b)
},
addToUpdate: function(b) { - 1 === a.indexOf(b) && a.push(b)
},
removeFromUpdate: function(b) {
b = a.indexOf(b),
-1 !== b && a.splice(b, 1)
},
add: function(a) {
if (void 0 !== b[a.name] && console.log("THREE.AnimationHandler.add: Warning! " + a.name + " already exists in library. Overwriting."), b[a.name] = a, !0 !== a.initialized) {
for (var c = 0; c < a.hierarchy.length; c++) {
for (var d = 0; d < a.hierarchy[c].keys.length; d++)
if (0 > a.hierarchy[c].keys[d].time && (a.hierarchy[c].keys[d].time = 0), void 0 !== a.hierarchy[c].keys[d].rot && !(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)) {
var e = a.hierarchy[c].keys[d].rot;
a.hierarchy[c].keys[d].rot = new THREE.Quaternion(e[0], e[1], e[2], e[3])
}
if (a.hierarchy[c].keys.length && void 0 !== a.hierarchy[c].keys[0].morphTargets) {
for (e = {}, d = 0; d < a.hierarchy[c].keys.length; d++)
for (var f = 0; f < a.hierarchy[c].keys[d].morphTargets.length; f++) {
var g = a.hierarchy[c].keys[d].morphTargets[f];
e[g] = -1
}
for (a.hierarchy[c].usedMorphTargets = e, d = 0; d < a.hierarchy[c].keys.length; d++) {
var h = {};
for (g in e) {
for (f = 0; f < a.hierarchy[c].keys[d].morphTargets.length; f++)
if (a.hierarchy[c].keys[d].morphTargets[f] === g) {
h[g] = a.hierarchy[c].keys[d].morphTargetsInfluences[f];
break
}
f === a.hierarchy[c].keys[d].morphTargets.length && (h[g] = 0)
}
a.hierarchy[c].keys[d].morphTargetsInfluences = h
}
}
for (d = 1; d < a.hierarchy[c].keys.length; d++)
a.hierarchy[c].keys[d].time === a.hierarchy[c].keys[d - 1].time && (a.hierarchy[c].keys.splice(d, 1), d--);
for (d = 0; d < a.hierarchy[c].keys.length; d++)
a.hierarchy[c].keys[d].index = d
}
for (d = parseInt(a.length * a.fps, 10), a.JIT = {}, a.JIT.hierarchy = [], c = 0; c < a.hierarchy.length; c++)
a.JIT.hierarchy.push(Array(d));
a.initialized = !0
}
},
get: function(a) {
return "string" == typeof a ? b[a] ? b[a] : (console.log("THREE.AnimationHandler.get: Couldn't find animation " + a), null) : void 0
},
parse: function(a) {
var b = [];
if (a instanceof THREE.SkinnedMesh)
for (var c = 0; c < a.bones.length; c++)
b.push(a.bones[c]);
else
d(a, b);
return b
}
},
d = function(a, b) {
b.push(a);
for (var c = 0; c < a.children.length; c++)
d(a.children[c], b)
};
return c.LINEAR = 0,
c.CATMULLROM = 1,
c.CATMULLROM_FORWARD = 2,
c
} (),
THREE.Animation = function(a, b, c) {
this.root = a,
this.data = THREE.AnimationHandler.get(b),
this.hierarchy = THREE.AnimationHandler.parse(a),
this.currentTime = 0,
this.timeScale = 1,
this.isPlaying = !1,
this.loop = this.isPaused = !0,
this.interpolationType = void 0 !== c ? c: THREE.AnimationHandler.LINEAR,
this.points = [],
this.target = new THREE.Vector3
},
THREE.Animation.prototype.play = function(a, b) {
if (!1 === this.isPlaying) {
this.isPlaying = !0,
this.loop = void 0 !== a ? a: !0,
this.currentTime = void 0 !== b ? b: 0;
var c,
d,
e = this.hierarchy.length;
for (c = 0; e > c; c++) {
d = this.hierarchy[c],
this.interpolationType !== THREE.AnimationHandler.CATMULLROM_FORWARD && (d.useQuaternion = !0),
d.matrixAutoUpdate = !0,
void 0 === d.animationCache && (d.animationCache = {}, d.animationCache.prevKey = {
pos: 0,
rot: 0,
scl: 0
}, d.animationCache.nextKey = {
pos: 0,
rot: 0,
scl: 0
}, d.animationCache.originalMatrix = d instanceof THREE.Bone ? d.skinMatrix: d.matrix);
var f = d.animationCache.prevKey;
d = d.animationCache.nextKey,
f.pos = this.data.hierarchy[c].keys[0],
f.rot = this.data.hierarchy[c].keys[0],
f.scl = this.data.hierarchy[c].keys[0],
d.pos = this.getNextKeyWith("pos", c, 1),
d.rot = this.getNextKeyWith("rot", c, 1),
d.scl = this.getNextKeyWith("scl", c, 1)
}
this.update(0)
}
this.isPaused = !1,
THREE.AnimationHandler.addToUpdate(this)
},
THREE.Animation.prototype.pause = function() { ! 0 === this.isPaused ? THREE.AnimationHandler.addToUpdate(this) : THREE.AnimationHandler.removeFromUpdate(this),
this.isPaused = !this.isPaused
},
THREE.Animation.prototype.stop = function() {
this.isPaused = this.isPlaying = !1,
THREE.AnimationHandler.removeFromUpdate(this)
},
THREE.Animation.prototype.update = function(a) {
if (!1 !== this.isPlaying) {
var b,
c,
d,
e,
f,
g,
h,
i,
j,
k = ["pos", "rot", "scl"];
j = this.currentTime += a * this.timeScale,
i = this.currentTime %= this.data.length,
parseInt(Math.min(i * this.data.fps, this.data.length * this.data.fps), 10);
for (var l = 0, m = this.hierarchy.length; m > l; l++) {
a = this.hierarchy[l],
h = a.animationCache;
for (var n = 0; 3 > n; n++) {
if (b = k[n], f = h.prevKey[b], g = h.nextKey[b], g.time <= j) {
if (j > i) {
if (!this.loop)
return void this.stop();
for (f = this.data.hierarchy[l].keys[0], g = this.getNextKeyWith(b, l, 1); g.time < i;)
f = g,
g = this.getNextKeyWith(b, l, g.index + 1)
} else
do f = g,
g = this.getNextKeyWith(b, l, g.index + 1);
while (g.time < i);
h.prevKey[b] = f,
h.nextKey[b] = g
}
a.matrixAutoUpdate = !0,
a.matrixWorldNeedsUpdate = !0,
c = (i - f.time) / (g.time - f.time),
d = f[b],
e = g[b],
(0 > c || c > 1) && (console.log("THREE.Animation.update: Warning! Scale out of bounds:" + c + " on bone " + l), c = 0 > c ? 0: 1),
"pos" === b ? (b = a.position, this.interpolationType === THREE.AnimationHandler.LINEAR ? (b.x = d[0] + (e[0] - d[0]) * c, b.y = d[1] + (e[1] - d[1]) * c, b.z = d[2] + (e[2] - d[2]) * c) : (this.interpolationType === THREE.AnimationHandler.CATMULLROM || this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD) && (this.points[0] = this.getPrevKeyWith("pos", l, f.index - 1).pos, this.points[1] = d, this.points[2] = e, this.points[3] = this.getNextKeyWith("pos", l, g.index + 1).pos, c = .33 * c + .33, d = this.interpolateCatmullRom(this.points, c), b.x = d[0], b.y = d[1], b.z = d[2], this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD && (c = this.interpolateCatmullRom(this.points, 1.01 * c), this.target.set(c[0], c[1], c[2]), this.target.sub(b), this.target.y = 0, this.target.normalize(), c = Math.atan2(this.target.x, this.target.z), a.rotation.set(0, c, 0)))) : "rot" === b ? THREE.Quaternion.slerp(d, e, a.quaternion, c) : "scl" === b && (b = a.scale, b.x = d[0] + (e[0] - d[0]) * c, b.y = d[1] + (e[1] - d[1]) * c, b.z = d[2] + (e[2] - d[2]) * c)
}
}
}
},
THREE.Animation.prototype.interpolateCatmullRom = function(a, b) {
var c,
d,
e,
f,
g,
h,
i = [],
j = [];
return c = (a.length - 1) * b,
d = Math.floor(c),
c -= d,
i[0] = 0 === d ? d: d - 1,
i[1] = d,
i[2] = d > a.length - 2 ? d: d + 1,
i[3] = d > a.length - 3 ? d: d + 2,
d = a[i[0]],
f = a[i[1]],
g = a[i[2]],
h = a[i[3]],
i = c * c,
e = c * i,
j[0] = this.interpolate(d[0], f[0], g[0], h[0], c, i, e),
j[1] = this.interpolate(d[1], f[1], g[1], h[1], c, i, e),
j[2] = this.interpolate(d[2], f[2], g[2], h[2], c, i, e),
j
},
THREE.Animation.prototype.interpolate = function(a, b, c, d, e, f, g) {
return a = .5 * (c - a),
d = .5 * (d - b),
(2 * (b - c) + a + d) * g + ( - 3 * (b - c) - 2 * a - d) * f + a * e + b
},
THREE.Animation.prototype.getNextKeyWith = function(a, b, c) {
for (var d = this.data.hierarchy[b].keys, c = this.interpolationType === THREE.AnimationHandler.CATMULLROM || this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ? c < d.length - 1 ? c: d.length - 1: c % d.length; c < d.length; c++)
if (void 0 !== d[c][a])
return d[c];
return this.data.hierarchy[b].keys[0]
},
THREE.Animation.prototype.getPrevKeyWith = function(a, b, c) {
for (var d = this.data.hierarchy[b].keys, c = this.interpolationType === THREE.AnimationHandler.CATMULLROM || this.interpolationType === THREE.AnimationHandler.CATMULLROM_FORWARD ? c > 0 ? c: 0: c >= 0 ? c: c + d.length; c >= 0; c--)
if (void 0 !== d[c][a])
return d[c];
return this.data.hierarchy[b].keys[d.length - 1]
},
THREE.KeyFrameAnimation = function(a, b, c) {
for (this.root = a, this.data = THREE.AnimationHandler.get(b), this.hierarchy = THREE.AnimationHandler.parse(a), this.currentTime = 0, this.timeScale = .001, this.isPlaying = !1, this.loop = this.isPaused = !0, this.JITCompile = void 0 !== c ? c: !0, a = 0, b = this.hierarchy.length; b > a; a++) {
var c = this.data.hierarchy[a].sids,
d = this.hierarchy[a];
if (this.data.hierarchy[a].keys.length && c) {
for (var e = 0; e < c.length; e++) {
var f = c[e],
g = this.getNextKeyWith(f, a, 0);
g && g.apply(f)
}
d.matrixAutoUpdate = !1,
this.data.hierarchy[a].node.updateMatrix(),
d.matrixWorldNeedsUpdate = !0
}
}
},
THREE.KeyFrameAnimation.prototype.play = function(a, b) {
if (!this.isPlaying) {
this.isPlaying = !0,
this.loop = void 0 !== a ? a: !0,
this.currentTime = void 0 !== b ? b: 0,
this.startTimeMs = b,
this.startTime = 1e7,
this.endTime = -this.startTime;
var c,
d,
e,
f = this.hierarchy.length;
for (c = 0; f > c; c++)
d = this.hierarchy[c],
e = this.data.hierarchy[c],
d.useQuaternion = !0,
void 0 === e.animationCache && (e.animationCache = {}, e.animationCache.prevKey = null, e.animationCache.nextKey = null, e.animationCache.originalMatrix = d instanceof THREE.Bone ? d.skinMatrix: d.matrix),
d = this.data.hierarchy[c].keys,
d.length && (e.animationCache.prevKey = d[0], e.animationCache.nextKey = d[1], this.startTime = Math.min(d[0].time, this.startTime), this.endTime = Math.max(d[d.length - 1].time, this.endTime));
this.update(0)
}
this.isPaused = !1,
THREE.AnimationHandler.addToUpdate(this)
},
THREE.KeyFrameAnimation.prototype.pause = function() {
this.isPaused ? THREE.AnimationHandler.addToUpdate(this) : THREE.AnimationHandler.removeFromUpdate(this),
this.isPaused = !this.isPaused
},
THREE.KeyFrameAnimation.prototype.stop = function() {
this.isPaused = this.isPlaying = !1,
THREE.AnimationHandler.removeFromUpdate(this);
for (var a = 0; a < this.data.hierarchy.length; a++) {
var b = this.hierarchy[a],
c = this.data.hierarchy[a];
if (void 0 !== c.animationCache) {
var d = c.animationCache.originalMatrix;
b instanceof THREE.Bone ? (d.copy(b.skinMatrix), b.skinMatrix = d) : (d.copy(b.matrix), b.matrix = d),
delete c.animationCache
}
}
},
THREE.KeyFrameAnimation.prototype.update = function(a) {
if (this.isPlaying) {
var b,
c,
d,
e,
f,
g,
h,
i = this.data.JIT.hierarchy;
if (g = this.currentTime += a * this.timeScale, f = this.currentTime %= this.data.length, f < this.startTimeMs && (f = this.currentTime = this.startTimeMs + f), e = parseInt(Math.min(f * this.data.fps, this.data.length * this.data.fps), 10), (h = g > f) && !this.loop) {
for (var a = 0, j = this.hierarchy.length; j > a; a++) {
var k = this.data.hierarchy[a].keys,
i = this.data.hierarchy[a].sids;
if (d = k.length - 1, e = this.hierarchy[a], k.length) {
for (k = 0; k < i.length; k++)
f = i[k],
(g = this.getPrevKeyWith(f, a, d)) && g.apply(f);
this.data.hierarchy[a].node.updateMatrix(),
e.matrixWorldNeedsUpdate = !0
}
}
this.stop()
} else if (! (f < this.startTime)) {
for (a = 0, j = this.hierarchy.length; j > a; a++) {
d = this.hierarchy[a],
b = this.data.hierarchy[a];
var k = b.keys,
l = b.animationCache;
if (this.JITCompile && void 0 !== i[a][e])
d instanceof THREE.Bone ? (d.skinMatrix = i[a][e], d.matrixWorldNeedsUpdate = !1) : (d.matrix = i[a][e], d.matrixWorldNeedsUpdate = !0);
else if (k.length) {
if (this.JITCompile && l && (d instanceof THREE.Bone ? d.skinMatrix = l.originalMatrix: d.matrix = l.originalMatrix), b = l.prevKey, c = l.nextKey, b && c) {
if (c.time <= g) {
if (h && this.loop)
for (b = k[0], c = k[1]; c.time < f;)
b = c,
c = k[b.index + 1];
else if (!h)
for (var m = k.length - 1; c.time < f && c.index !== m;)
b = c,
c = k[b.index + 1];
l.prevKey = b,
l.nextKey = c
}
c.time >= f ? b.interpolate(c, f) : b.interpolate(c, c.time)
}
this.data.hierarchy[a].node.updateMatrix(),
d.matrixWorldNeedsUpdate = !0
}
}
if (this.JITCompile && void 0 === i[0][e])
for (this.hierarchy[0].updateMatrixWorld(!0), a = 0; a < this.hierarchy.length; a++)
i[a][e] = this.hierarchy[a]
instanceof THREE.Bone ? this.hierarchy[a].skinMatrix.clone() : this.hierarchy[a].matrix.clone()
}
}
},
THREE.KeyFrameAnimation.prototype.getNextKeyWith = function(a, b, c) {
for (b = this.data.hierarchy[b].keys, c %= b.length; c < b.length; c++)
if (b[c].hasTarget(a))
return b[c];
return b[0]
},
THREE.KeyFrameAnimation.prototype.getPrevKeyWith = function(a, b, c) {
for (b = this.data.hierarchy[b].keys, c = c >= 0 ? c: c + b.length; c >= 0; c--)
if (b[c].hasTarget(a))
return b[c];
return b[b.length - 1]
},
THREE.CubeCamera = function(a, b, c) {
THREE.Object3D.call(this);
var d = new THREE.PerspectiveCamera(90, 1, a, b);
d.up.set(0, -1, 0),
d.lookAt(new THREE.Vector3(1, 0, 0)),
this.add(d);
var e = new THREE.PerspectiveCamera(90, 1, a, b);
e.up.set(0, -1, 0),
e.lookAt(new THREE.Vector3( - 1, 0, 0)),
this.add(e);
var f = new THREE.PerspectiveCamera(90, 1, a, b);
f.up.set(0, 0, 1),
f.lookAt(new THREE.Vector3(0, 1, 0)),
this.add(f);
var g = new THREE.PerspectiveCamera(90, 1, a, b);
g.up.set(0, 0, -1),
g.lookAt(new THREE.Vector3(0, -1, 0)),
this.add(g);
var h = new THREE.PerspectiveCamera(90, 1, a, b);
h.up.set(0, -1, 0),
h.lookAt(new THREE.Vector3(0, 0, 1)),
this.add(h);
var i = new THREE.PerspectiveCamera(90, 1, a, b);
i.up.set(0, -1, 0),
i.lookAt(new THREE.Vector3(0, 0, -1)),
this.add(i),
this.renderTarget = new THREE.WebGLRenderTargetCube(c, c, {
format: THREE.RGBFormat,
magFilter: THREE.LinearFilter,
minFilter: THREE.LinearFilter
}),
this.updateCubeMap = function(a, b) {
var c = this.renderTarget,
j = c.generateMipmaps;
c.generateMipmaps = !1,
c.activeCubeFace = 0,
a.render(b, d, c),
c.activeCubeFace = 1,
a.render(b, e, c),
c.activeCubeFace = 2,
a.render(b, f, c),
c.activeCubeFace = 3,
a.render(b, g, c),
c.activeCubeFace = 4,
a.render(b, h, c),
c.generateMipmaps = j,
c.activeCubeFace = 5,
a.render(b, i, c)
}
},
THREE.CubeCamera.prototype = Object.create(THREE.Object3D.prototype),
THREE.CombinedCamera = function(a, b, c, d, e, f, g) {
THREE.Camera.call(this),
this.fov = c,
this.left = -a / 2,
this.right = a / 2,
this.top = b / 2,
this.bottom = -b / 2,
this.cameraO = new THREE.OrthographicCamera(a / -2, a / 2, b / 2, b / -2, f, g),
this.cameraP = new THREE.PerspectiveCamera(c, a / b, d, e),
this.zoom = 1,
this.toPerspective()
},
THREE.CombinedCamera.prototype = Object.create(THREE.Camera.prototype),
THREE.CombinedCamera.prototype.toPerspective = function() {
this.near = this.cameraP.near,
this.far = this.cameraP.far,
this.cameraP.fov = this.fov / this.zoom,
this.cameraP.updateProjectionMatrix(),
this.projectionMatrix = this.cameraP.projectionMatrix,
this.inPerspectiveMode = !0,
this.inOrthographicMode = !1
},
THREE.CombinedCamera.prototype.toOrthographic = function() {
var a = this.cameraP.aspect,
b = (this.cameraP.near + this.cameraP.far) / 2,
b = Math.tan(this.fov / 2) * b,
a = 2 * b * a / 2,
b = b / this.zoom,
a = a / this.zoom;
this.cameraO.left = -a,
this.cameraO.right = a,
this.cameraO.top = b,
this.cameraO.bottom = -b,
this.cameraO.updateProjectionMatrix(),
this.near = this.cameraO.near,
this.far = this.cameraO.far,
this.projectionMatrix = this.cameraO.projectionMatrix,
this.inPerspectiveMode = !1,
this.inOrthographicMode = !0
},
THREE.CombinedCamera.prototype.setSize = function(a, b) {
this.cameraP.aspect = a / b,
this.left = -a / 2,
this.right = a / 2,
this.top = b / 2,
this.bottom = -b / 2
},
THREE.CombinedCamera.prototype.setFov = function(a) {
this.fov = a,
this.inPerspectiveMode ? this.toPerspective() : this.toOrthographic()
},
THREE.CombinedCamera.prototype.updateProjectionMatrix = function() {
this.inPerspectiveMode ? this.toPerspective() : (this.toPerspective(), this.toOrthographic())
},
THREE.CombinedCamera.prototype.setLens = function(a, b) {
void 0 === b && (b = 24);
var c = 2 * THREE.Math.radToDeg(Math.atan(b / (2 * a)));
return this.setFov(c),
c
},
THREE.CombinedCamera.prototype.setZoom = function(a) {
this.zoom = a,
this.inPerspectiveMode ? this.toPerspective() : this.toOrthographic()
},
THREE.CombinedCamera.prototype.toFrontView = function() {
this.rotation.x = 0,
this.rotation.y = 0,
this.rotation.z = 0,
this.rotationAutoUpdate = !1
},
THREE.CombinedCamera.prototype.toBackView = function() {
this.rotation.x = 0,
this.rotation.y = Math.PI,
this.rotation.z = 0,
this.rotationAutoUpdate = !1
},
THREE.CombinedCamera.prototype.toLeftView = function() {
this.rotation.x = 0,
this.rotation.y = -Math.PI / 2,
this.rotation.z = 0,
this.rotationAutoUpdate = !1
},
THREE.CombinedCamera.prototype.toRightView = function() {
this.rotation.x = 0,
this.rotation.y = Math.PI / 2,
this.rotation.z = 0,
this.rotationAutoUpdate = !1
},
THREE.CombinedCamera.prototype.toTopView = function() {
this.rotation.x = -Math.PI / 2,
this.rotation.y = 0,
this.rotation.z = 0,
this.rotationAutoUpdate = !1
},
THREE.CombinedCamera.prototype.toBottomView = function() {
this.rotation.x = Math.PI / 2,
this.rotation.y = 0,
this.rotation.z = 0,
this.rotationAutoUpdate = !1
},
THREE.CircleGeometry = function(a, b, c, d) {
THREE.Geometry.call(this);
var e,
a = a || 50,
c = void 0 !== c ? c: 0,
d = void 0 !== d ? d: 2 * Math.PI,
b = void 0 !== b ? Math.max(3, b) : 8,
f = [];
e = new THREE.Vector3;
var g = new THREE.Vector2(.5, .5);
for (this.vertices.push(e), f.push(g), e = 0; b >= e; e++) {
var h = new THREE.Vector3,
i = c + e / b * d;
h.x = a * Math.cos(i),
h.y = a * Math.sin(i),
this.vertices.push(h),
f.push(new THREE.Vector2((h.x / a + 1) / 2, (h.y / a + 1) / 2))
}
for (c = new THREE.Vector3(0, 0, 1), e = 1; b >= e; e++)
this.faces.push(new THREE.Face3(e, e + 1, 0, [c, c, c])),
this.faceVertexUvs[0].push([f[e], f[e + 1], g]);
this.computeCentroids(),
this.computeFaceNormals(),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, a)
},
THREE.CircleGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.CubeGeometry = function(a, b, c, d, e, f) {
function g(a, b, c, d, e, f, g, i) {
var j,
k = h.widthSegments,
l = h.heightSegments,
m = e / 2,
n = f / 2,
o = h.vertices.length;
"x" === a && "y" === b || "y" === a && "x" === b ? j = "z": "x" === a && "z" === b || "z" === a && "x" === b ? (j = "y", l = h.depthSegments) : ("z" === a && "y" === b || "y" === a && "z" === b) && (j = "x", k = h.depthSegments);
var p = k + 1,
q = l + 1,
r = e / k,
s = f / l,
t = new THREE.Vector3;
for (t[j] = g > 0 ? 1: -1, e = 0; q > e; e++)
for (f = 0; p > f; f++) {
var u = new THREE.Vector3;
u[a] = (f * r - m) * c,
u[b] = (e * s - n) * d,
u[j] = g,
h.vertices.push(u)
}
for (e = 0; l > e; e++)
for (f = 0; k > f; f++)
a = new THREE.Face4(f + p * e + o, f + p * (e + 1) + o, f + 1 + p * (e + 1) + o, f + 1 + p * e + o),
a.normal.copy(t),
a.vertexNormals.push(t.clone(), t.clone(), t.clone(), t.clone()),
a.materialIndex = i,
h.faces.push(a),
h.faceVertexUvs[0].push([new THREE.Vector2(f / k, 1 - e / l), new THREE.Vector2(f / k, 1 - (e + 1) / l), new THREE.Vector2((f + 1) / k, 1 - (e + 1) / l), new THREE.Vector2((f + 1) / k, 1 - e / l)])
}
THREE.Geometry.call(this);
var h = this;
this.width = a,
this.height = b,
this.depth = c,
this.widthSegments = d || 1,
this.heightSegments = e || 1,
this.depthSegments = f || 1,
a = this.width / 2,
b = this.height / 2,
c = this.depth / 2,
g("z", "y", -1, -1, this.depth, this.height, a, 0),
g("z", "y", 1, -1, this.depth, this.height, -a, 1),
g("x", "z", 1, 1, this.width, this.depth, b, 2),
g("x", "z", 1, -1, this.width, this.depth, -b, 3),
g("x", "y", 1, -1, this.width, this.height, c, 4),
g("x", "y", -1, -1, this.width, this.height, -c, 5),
this.computeCentroids(),
this.mergeVertices()
},
THREE.CubeGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.CylinderGeometry = function(a, b, c, d, e, f) {
THREE.Geometry.call(this),
this.radiusTop = a = void 0 !== a ? a: 20,
this.radiusBottom = b = void 0 !== b ? b: 20,
this.height = c = void 0 !== c ? c: 100,
this.radiusSegments = d = d || 8,
this.heightSegments = e = e || 1,
this.openEnded = f = void 0 !== f ? f: !1;
var g,
h,
i = c / 2,
j = [],
k = [];
for (h = 0; e >= h; h++) {
var l = [],
m = [],
n = h / e,
o = n * (b - a) + a;
for (g = 0; d >= g; g++) {
var p = g / d,
q = new THREE.Vector3;
q.x = o * Math.sin(2 * p * Math.PI),
q.y = -n * c + i,
q.z = o * Math.cos(2 * p * Math.PI),
this.vertices.push(q),
l.push(this.vertices.length - 1),
m.push(new THREE.Vector2(p, 1 - n))
}
j.push(l),
k.push(m)
}
for (c = (b - a) / c, g = 0; d > g; g++)
for (0 !== a ? (l = this.vertices[j[0][g]].clone(), m = this.vertices[j[0][g + 1]].clone()) : (l = this.vertices[j[1][g]].clone(), m = this.vertices[j[1][g + 1]].clone()), l.setY(Math.sqrt(l.x * l.x + l.z * l.z) * c).normalize(), m.setY(Math.sqrt(m.x * m.x + m.z * m.z) * c).normalize(), h = 0; e > h; h++) {
var n = j[h][g],
o = j[h + 1][g],
p = j[h + 1][g + 1],
q = j[h][g + 1],
r = l.clone(),
s = l.clone(),
t = m.clone(),
u = m.clone(),
v = k[h][g].clone(),
w = k[h + 1][g].clone(),
x = k[h + 1][g + 1].clone(),
y = k[h][g + 1].clone();
this.faces.push(new THREE.Face4(n, o, p, q, [r, s, t, u])),
this.faceVertexUvs[0].push([v, w, x, y])
}
if (!1 === f && a > 0)
for (this.vertices.push(new THREE.Vector3(0, i, 0)), g = 0; d > g; g++)
n = j[0][g],
o = j[0][g + 1],
p = this.vertices.length - 1,
r = new THREE.Vector3(0, 1, 0),
s = new THREE.Vector3(0, 1, 0),
t = new THREE.Vector3(0, 1, 0),
v = k[0][g].clone(),
w = k[0][g + 1].clone(),
x = new THREE.Vector2(w.u, 0),
this.faces.push(new THREE.Face3(n, o, p, [r, s, t])),
this.faceVertexUvs[0].push([v, w, x]);
if (!1 === f && b > 0)
for (this.vertices.push(new THREE.Vector3(0, -i, 0)), g = 0; d > g; g++)
n = j[h][g + 1],
o = j[h][g],
p = this.vertices.length - 1,
r = new THREE.Vector3(0, -1, 0),
s = new THREE.Vector3(0, -1, 0),
t = new THREE.Vector3(0, -1, 0),
v = k[h][g + 1].clone(),
w = k[h][g].clone(),
x = new THREE.Vector2(w.u, 1),
this.faces.push(new THREE.Face3(n, o, p, [r, s, t])),
this.faceVertexUvs[0].push([v, w, x]);
this.computeCentroids(),
this.computeFaceNormals()
},
THREE.CylinderGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ExtrudeGeometry = function(a, b) {
"undefined" != typeof a && (THREE.Geometry.call(this), a = a instanceof Array ? a: [a], this.shapebb = a[a.length - 1].getBoundingBox(), this.addShapeList(a, b), this.computeCentroids(), this.computeFaceNormals())
},
THREE.ExtrudeGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ExtrudeGeometry.prototype.addShapeList = function(a, b) {
for (var c = a.length, d = 0; c > d; d++)
this.addShape(a[d], b)
},
THREE.ExtrudeGeometry.prototype.addShape = function(a, b) {
function c(a, b, c) {
return b || console.log("die"),
b.clone().multiplyScalar(c).add(a)
}
function d(a, b, c) {
var d = THREE.ExtrudeGeometry.__v1,
e = THREE.ExtrudeGeometry.__v2,
f = THREE.ExtrudeGeometry.__v3,
g = THREE.ExtrudeGeometry.__v4,
h = THREE.ExtrudeGeometry.__v5,
i = THREE.ExtrudeGeometry.__v6;
return d.set(a.x - b.x, a.y - b.y),
e.set(a.x - c.x, a.y - c.y),
d = d.normalize(),
e = e.normalize(),
f.set( - d.y, d.x),
g.set(e.y, -e.x),
h.copy(a).add(f),
i.copy(a).add(g),
h.equals(i) ? g.clone() : (h.copy(b).add(f), i.copy(c).add(g), f = d.dot(g), g = i.sub(h).dot(g), 0 === f && (console.log("Either infinite or no solutions!"), console.log(0 === g ? "Its finite solutions.": "Too bad, no solutions.")), g /= f, 0 > g ? (b = Math.atan2(b.y - a.y, b.x - a.x), a = Math.atan2(c.y - a.y, c.x - a.x), b > a && (a += 2 * Math.PI), c = (b + a) / 2, a = -Math.cos(c), c = -Math.sin(c), new THREE.Vector2(a, c)) : d.multiplyScalar(g).add(h).sub(a).clone())
}
function e(c, d) {
var e,
f;
for (M = c.length; 0 <= --M;) {
e = M,
f = M - 1,
0 > f && (f = c.length - 1);
for (var g = 0, h = s + 2 * p, g = 0; h > g; g++) {
var i = J * g,
j = J * (g + 1),
k = d + e + i,
i = d + f + i,
l = d + f + j,
j = d + e + j,
m = c,
n = g,
o = h,
q = e,
r = f,
k = k + C,
i = i + C,
l = l + C,
j = j + C;
B.faces.push(new THREE.Face4(k, i, l, j, null, null, w)),
k = x.generateSideWallUV(B, a, m, b, k, i, l, j, n, o, q, r),
B.faceVertexUvs[0].push(k)
}
}
}
function f(a, b, c) {
B.vertices.push(new THREE.Vector3(a, b, c))
}
function g(c, d, e, f) {
c += C,
d += C,
e += C,
B.faces.push(new THREE.Face3(c, d, e, null, null, v)),
c = f ? x.generateBottomUV(B, a, b, c, d, e) : x.generateTopUV(B, a, b, c, d, e),
B.faceVertexUvs[0].push(c)
}
var h,
i,
j,
k,
l,
m = void 0 !== b.amount ? b.amount: 100,
n = void 0 !== b.bevelThickness ? b.bevelThickness: 6,
o = void 0 !== b.bevelSize ? b.bevelSize: n - 2,
p = void 0 !== b.bevelSegments ? b.bevelSegments: 3,
q = void 0 !== b.bevelEnabled ? b.bevelEnabled: !0,
r = void 0 !== b.curveSegments ? b.curveSegments: 12,
s = void 0 !== b.steps ? b.steps: 1,
t = b.extrudePath,
u = !1,
v = b.material,
w = b.extrudeMaterial,
x = void 0 !== b.UVGenerator ? b.UVGenerator: THREE.ExtrudeGeometry.WorldUVGenerator;
t && (h = t.getSpacedPoints(s), u = !0, q = !1, i = void 0 !== b.frames ? b.frames: new THREE.TubeGeometry.FrenetFrames(t, s, !1), j = new THREE.Vector3, k = new THREE.Vector3, l = new THREE.Vector3),
q || (o = n = p = 0);
var y,
z,
A,
B = this,
C = this.vertices.length,
r = a.extractPoints(r),
D = r.shape,
r = r.holes;
if (t = !THREE.Shape.Utils.isClockWise(D)) {
for (D = D.reverse(), z = 0, A = r.length; A > z; z++)
y = r[z],
THREE.Shape.Utils.isClockWise(y) && (r[z] = y.reverse());
t = !1
}
var E = THREE.Shape.Utils.triangulateShape(D, r),
t = D;
for (z = 0, A = r.length; A > z; z++)
y = r[z],
D = D.concat(y);
var F,
G,
H,
I,
J = D.length,
K = E.length,
L = [],
M = 0,
N = t.length;
for (F = N - 1, G = M + 1; N > M; M++, F++, G++)
F === N && (F = 0),
G === N && (G = 0),
L[M] = d(t[M], t[F], t[G]);
var O,
P = [],
Q = L.concat();
for (z = 0, A = r.length; A > z; z++) {
for (y = r[z], O = [], M = 0, N = y.length, F = N - 1, G = M + 1; N > M; M++, F++, G++)
F === N && (F = 0),
G === N && (G = 0),
O[M] = d(y[M], y[F], y[G]);
P.push(O),
Q = Q.concat(O)
}
for (F = 0; p > F; F++) {
for (y = F / p, H = n * (1 - y), G = o * Math.sin(y * Math.PI / 2), M = 0, N = t.length; N > M; M++)
I = c(t[M], L[M], G),
f(I.x, I.y, -H);
for (z = 0, A = r.length; A > z; z++)
for (y = r[z], O = P[z], M = 0, N = y.length; N > M; M++)
I = c(y[M], O[M], G),
f(I.x, I.y, -H)
}
for (G = o, M = 0; J > M; M++)
I = q ? c(D[M], Q[M], G) : D[M],
u ? (k.copy(i.normals[0]).multiplyScalar(I.x), j.copy(i.binormals[0]).multiplyScalar(I.y), l.copy(h[0]).add(k).add(j), f(l.x, l.y, l.z)) : f(I.x, I.y, 0);
for (y = 1; s >= y; y++)
for (M = 0; J > M; M++)
I = q ? c(D[M], Q[M], G) : D[M],
u ? (k.copy(i.normals[y]).multiplyScalar(I.x), j.copy(i.binormals[y]).multiplyScalar(I.y), l.copy(h[y]).add(k).add(j), f(l.x, l.y, l.z)) : f(I.x, I.y, m / s * y);
for (F = p - 1; F >= 0; F--) {
for (y = F / p, H = n * (1 - y), G = o * Math.sin(y * Math.PI / 2), M = 0, N = t.length; N > M; M++)
I = c(t[M], L[M], G),
f(I.x, I.y, m + H);
for (z = 0, A = r.length; A > z; z++)
for (y = r[z], O = P[z], M = 0, N = y.length; N > M; M++)
I = c(y[M], O[M], G),
u ? f(I.x, I.y + h[s - 1].y, h[s - 1].x + H) : f(I.x, I.y, m + H)
}
if (q) {
for (n = 0 * J, M = 0; K > M; M++)
m = E[M],
g(m[2] + n, m[1] + n, m[0] + n, !0);
for (n = J * (s + 2 * p), M = 0; K > M; M++)
m = E[M],
g(m[0] + n, m[1] + n, m[2] + n, !1)
} else {
for (M = 0; K > M; M++)
m = E[M],
g(m[2], m[1], m[0], !0);
for (M = 0; K > M; M++)
m = E[M],
g(m[0] + J * s, m[1] + J * s, m[2] + J * s, !1)
}
for (m = 0, e(t, m), m += t.length, z = 0, A = r.length; A > z; z++)
y = r[z],
e(y, m),
m += y.length
},
THREE.ExtrudeGeometry.WorldUVGenerator = {
generateTopUV: function(a, b, c, d, e, f) {
return b = a.vertices[e].x,
e = a.vertices[e].y,
c = a.vertices[f].x,
f = a.vertices[f].y,
[new THREE.Vector2(a.vertices[d].x, a.vertices[d].y), new THREE.Vector2(b, e), new THREE.Vector2(c, f)]
},
generateBottomUV: function(a, b, c, d, e, f) {
return this.generateTopUV(a, b, c, d, e, f)
},
generateSideWallUV: function(a, b, c, d, e, f, g, h) {
var b = a.vertices[e].x,
c = a.vertices[e].y,
e = a.vertices[e].z,
d = a.vertices[f].x,
i = a.vertices[f].y,
f = a.vertices[f].z,
j = a.vertices[g].x,
k = a.vertices[g].y,
g = a.vertices[g].z,
l = a.vertices[h].x,
m = a.vertices[h].y,
a = a.vertices[h].z;
return.01 > Math.abs(c - i) ? [new THREE.Vector2(b, 1 - e), new THREE.Vector2(d, 1 - f), new THREE.Vector2(j, 1 - g), new THREE.Vector2(l, 1 - a)] : [new THREE.Vector2(c, 1 - e), new THREE.Vector2(i, 1 - f), new THREE.Vector2(k, 1 - g), new THREE.Vector2(m, 1 - a)]
}
},
THREE.ExtrudeGeometry.__v1 = new THREE.Vector2,
THREE.ExtrudeGeometry.__v2 = new THREE.Vector2,
THREE.ExtrudeGeometry.__v3 = new THREE.Vector2,
THREE.ExtrudeGeometry.__v4 = new THREE.Vector2,
THREE.ExtrudeGeometry.__v5 = new THREE.Vector2,
THREE.ExtrudeGeometry.__v6 = new THREE.Vector2,
THREE.ShapeGeometry = function(a, b) {
THREE.Geometry.call(this),
!1 == a instanceof Array && (a = [a]),
this.shapebb = a[a.length - 1].getBoundingBox(),
this.addShapeList(a, b),
this.computeCentroids(),
this.computeFaceNormals()
},
THREE.ShapeGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ShapeGeometry.prototype.addShapeList = function(a, b) {
for (var c = 0, d = a.length; d > c; c++)
this.addShape(a[c], b);
return this
},
THREE.ShapeGeometry.prototype.addShape = function(a, b) {
void 0 === b && (b = {});
var c,
d,
e,
f = b.material,
g = void 0 === b.UVGenerator ? THREE.ExtrudeGeometry.WorldUVGenerator: b.UVGenerator,
h = this.vertices.length;
c = a.extractPoints(void 0 !== b.curveSegments ? b.curveSegments: 12);
var i = c.shape,
j = c.holes;
if (!THREE.Shape.Utils.isClockWise(i))
for (i = i.reverse(), c = 0, d = j.length; d > c; c++)
e = j[c],
THREE.Shape.Utils.isClockWise(e) && (j[c] = e.reverse());
var k = THREE.Shape.Utils.triangulateShape(i, j);
for (c = 0, d = j.length; d > c; c++)
e = j[c],
i = i.concat(e);
for (j = i.length, d = k.length, c = 0; j > c; c++)
e = i[c],
this.vertices.push(new THREE.Vector3(e.x, e.y, 0));
for (c = 0; d > c; c++)
j = k[c],
i = j[0] + h,
e = j[1] + h,
j = j[2] + h,
this.faces.push(new THREE.Face3(i, e, j, null, null, f)),
this.faceVertexUvs[0].push(g.generateBottomUV(this, a, b, i, e, j))
},
THREE.LatheGeometry = function(a, b, c, d) {
THREE.Geometry.call(this);
for (var b = b || 12, c = c || 0, d = d || 2 * Math.PI, e = 1 / (a.length - 1), f = 1 / b, g = 0, h = b; h >= g; g++)
for (var i = c + g * f * d, j = Math.cos(i), k = Math.sin(i), i = 0, l = a.length; l > i; i++) {
var m = a[i],
n = new THREE.Vector3;
n.x = j * m.x - k * m.y,
n.y = k * m.x + j * m.y,
n.z = m.z,
this.vertices.push(n)
}
for (c = a.length, g = 0, h = b; h > g; g++)
for (i = 0, l = a.length - 1; l > i; i++)
d = b = i + c * g,
k = b + c,
j = b + 1 + c,
this.faces.push(new THREE.Face4(d, k, j, b + 1)),
j = g * f,
b = i * e,
d = j + f,
k = b + e,
this.faceVertexUvs[0].push([new THREE.Vector2(j, b), new THREE.Vector2(d, b), new THREE.Vector2(d, k), new THREE.Vector2(j, k)]);
this.mergeVertices(),
this.computeCentroids(),
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.LatheGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.PlaneGeometry = function(a, b, c, d) {
THREE.Geometry.call(this),
this.width = a,
this.height = b,
this.widthSegments = c || 1,
this.heightSegments = d || 1;
for (var c = a / 2, e = b / 2, d = this.widthSegments, f = this.heightSegments, g = d + 1, h = f + 1, i = this.width / d, j = this.height / f, k = new THREE.Vector3(0, 0, 1), a = 0; h > a; a++)
for (b = 0; g > b; b++)
this.vertices.push(new THREE.Vector3(b * i - c, -(a * j - e), 0));
for (a = 0; f > a; a++)
for (b = 0; d > b; b++)
c = new THREE.Face4(b + g * a, b + g * (a + 1), b + 1 + g * (a + 1), b + 1 + g * a),
c.normal.copy(k),
c.vertexNormals.push(k.clone(), k.clone(), k.clone(), k.clone()),
this.faces.push(c),
this.faceVertexUvs[0].push([new THREE.Vector2(b / d, 1 - a / f), new THREE.Vector2(b / d, 1 - (a + 1) / f), new THREE.Vector2((b + 1) / d, 1 - (a + 1) / f), new THREE.Vector2((b + 1) / d, 1 - a / f)]);
this.computeCentroids()
},
THREE.PlaneGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.RingGeometry = function(a, b, c, d, e, f) {
THREE.Geometry.call(this);
for (var a = a || 0, b = b || 50, e = void 0 !== e ? e: 0, f = void 0 !== f ? f: 2 * Math.PI, c = void 0 !== c ? Math.max(3, c) : 8, d = void 0 !== d ? Math.max(3, d) : 8, g = [], h = a, i = (b - a) / d, a = 0; d >= a; a++) {
for (b = 0; c >= b; b++) {
var j = new THREE.Vector3,
k = e + b / c * f;
j.x = h * Math.cos(k),
j.y = h * Math.sin(k),
this.vertices.push(j),
g.push(new THREE.Vector2((j.x / h + 1) / 2, -(j.y / h + 1) / 2 + 1))
}
h += i
}
for (e = new THREE.Vector3(0, 0, 1), a = 0; d > a; a++)
for (f = a * c, b = 0; c >= b; b++) {
var k = b + f,
i = k + a,
j = k + c + a,
l = k + c + 1 + a;
this.faces.push(new THREE.Face3(i, j, l, [e, e, e])),
this.faceVertexUvs[0].push([g[i], g[j], g[l]]),
i = k + a,
j = k + c + 1 + a,
l = k + 1 + a,
this.faces.push(new THREE.Face3(i, j, l, [e, e, e])),
this.faceVertexUvs[0].push([g[i], g[j], g[l]])
}
this.computeCentroids(),
this.computeFaceNormals(),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, h)
},
THREE.RingGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.SphereGeometry = function(a, b, c, d, e, f, g) {
THREE.Geometry.call(this),
this.radius = a = a || 50,
this.widthSegments = b = Math.max(3, Math.floor(b) || 8),
this.heightSegments = c = Math.max(2, Math.floor(c) || 6),
this.phiStart = d = void 0 !== d ? d: 0,
this.phiLength = e = void 0 !== e ? e: 2 * Math.PI,
this.thetaStart = f = void 0 !== f ? f: 0,
this.thetaLength = g = void 0 !== g ? g: Math.PI;
var h,
i,
j = [],
k = [];
for (i = 0; c >= i; i++) {
var l = [],
m = [];
for (h = 0; b >= h; h++) {
var n = h / b,
o = i / c,
p = new THREE.Vector3;
p.x = -a * Math.cos(d + n * e) * Math.sin(f + o * g),
p.y = a * Math.cos(f + o * g),
p.z = a * Math.sin(d + n * e) * Math.sin(f + o * g),
this.vertices.push(p),
l.push(this.vertices.length - 1),
m.push(new THREE.Vector2(n, 1 - o))
}
j.push(l),
k.push(m)
}
for (i = 0; i < this.heightSegments; i++)
for (h = 0; h < this.widthSegments; h++) {
var b = j[i][h + 1],
c = j[i][h],
d = j[i + 1][h],
e = j[i + 1][h + 1],
f = this.vertices[b].clone().normalize(),
g = this.vertices[c].clone().normalize(),
l = this.vertices[d].clone().normalize(),
m = this.vertices[e].clone().normalize(),
n = k[i][h + 1].clone(),
o = k[i][h].clone(),
p = k[i + 1][h].clone(),
q = k[i + 1][h + 1].clone();
Math.abs(this.vertices[b].y) === this.radius ? (this.faces.push(new THREE.Face3(b, d, e, [f, l, m])), this.faceVertexUvs[0].push([n, p, q])) : Math.abs(this.vertices[d].y) === this.radius ? (this.faces.push(new THREE.Face3(b, c, d, [f, g, l])), this.faceVertexUvs[0].push([n, o, p])) : (this.faces.push(new THREE.Face4(b, c, d, e, [f, g, l, m])), this.faceVertexUvs[0].push([n, o, p, q]))
}
this.computeCentroids(),
this.computeFaceNormals(),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, a)
},
THREE.SphereGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TextGeometry = function(a, b) {
var b = b || {},
c = THREE.FontUtils.generateShapes(a, b);
b.amount = void 0 !== b.height ? b.height: 50,
void 0 === b.bevelThickness && (b.bevelThickness = 10),
void 0 === b.bevelSize && (b.bevelSize = 8),
void 0 === b.bevelEnabled && (b.bevelEnabled = !1),
THREE.ExtrudeGeometry.call(this, c, b)
},
THREE.TextGeometry.prototype = Object.create(THREE.ExtrudeGeometry.prototype),
THREE.TorusGeometry = function(a, b, c, d, e) {
for (THREE.Geometry.call(this), this.radius = a || 100, this.tube = b || 40, this.radialSegments = c || 8, this.tubularSegments = d || 6, this.arc = e || 2 * Math.PI, e = new THREE.Vector3, a = [], b = [], c = 0; c <= this.radialSegments; c++)
for (d = 0; d <= this.tubularSegments; d++) {
var f = d / this.tubularSegments * this.arc,
g = 2 * c / this.radialSegments * Math.PI;
e.x = this.radius * Math.cos(f),
e.y = this.radius * Math.sin(f);
var h = new THREE.Vector3;
h.x = (this.radius + this.tube * Math.cos(g)) * Math.cos(f),
h.y = (this.radius + this.tube * Math.cos(g)) * Math.sin(f),
h.z = this.tube * Math.sin(g),
this.vertices.push(h),
a.push(new THREE.Vector2(d / this.tubularSegments, c / this.radialSegments)),
b.push(h.clone().sub(e).normalize())
}
for (c = 1; c <= this.radialSegments; c++)
for (d = 1; d <= this.tubularSegments; d++) {
var e = (this.tubularSegments + 1) * c + d - 1,
f = (this.tubularSegments + 1) * (c - 1) + d - 1,
g = (this.tubularSegments + 1) * (c - 1) + d,
h = (this.tubularSegments + 1) * c + d,
i = new THREE.Face4(e, f, g, h, [b[e], b[f], b[g], b[h]]);
i.normal.add(b[e]),
i.normal.add(b[f]),
i.normal.add(b[g]),
i.normal.add(b[h]),
i.normal.normalize(),
this.faces.push(i),
this.faceVertexUvs[0].push([a[e].clone(), a[f].clone(), a[g].clone(), a[h].clone()])
}
this.computeCentroids()
},
THREE.TorusGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TorusKnotGeometry = function(a, b, c, d, e, f, g) {
function h(a, b, c, d, e, f) {
var g = Math.cos(a);
return Math.cos(b),
b = Math.sin(a),
a *= c / d,
c = Math.cos(a),
g *= .5 * e * (2 + c),
b = .5 * e * (2 + c) * b,
e = .5 * f * e * Math.sin(a),
new THREE.Vector3(g, b, e)
}
for (THREE.Geometry.call(this), this.radius = a || 100, this.tube = b || 40, this.radialSegments = c || 64, this.tubularSegments = d || 8, this.p = e || 2, this.q = f || 3, this.heightScale = g || 1, this.grid = Array(this.radialSegments), c = new THREE.Vector3, d = new THREE.Vector3, e = new THREE.Vector3, a = 0; a < this.radialSegments;++a)
for (this.grid[a] = Array(this.tubularSegments), b = 0; b < this.tubularSegments;++b) {
var i = 2 * (a / this.radialSegments) * this.p * Math.PI,
g = 2 * (b / this.tubularSegments) * Math.PI,
f = h(i, g, this.q, this.p, this.radius, this.heightScale),
i = h(i + .01, g, this.q, this.p, this.radius, this.heightScale);
c.subVectors(i, f),
d.addVectors(i, f),
e.crossVectors(c, d),
d.crossVectors(e, c),
e.normalize(),
d.normalize(),
i = -this.tube * Math.cos(g),
g = this.tube * Math.sin(g),
f.x += i * d.x + g * e.x,
f.y += i * d.y + g * e.y,
f.z += i * d.z + g * e.z,
this.grid[a][b] = this.vertices.push(new THREE.Vector3(f.x, f.y, f.z)) - 1
}
for (a = 0; a < this.radialSegments;++a)
for (b = 0; b < this.tubularSegments;++b) {
var e = (a + 1) % this.radialSegments,
f = (b + 1) % this.tubularSegments,
c = this.grid[a][b],
d = this.grid[e][b],
e = this.grid[e][f],
f = this.grid[a][f],
g = new THREE.Vector2(a / this.radialSegments, b / this.tubularSegments),
i = new THREE.Vector2((a + 1) / this.radialSegments, b / this.tubularSegments),
j = new THREE.Vector2((a + 1) / this.radialSegments, (b + 1) / this.tubularSegments),
k = new THREE.Vector2(a / this.radialSegments, (b + 1) / this.tubularSegments);
this.faces.push(new THREE.Face4(c, d, e, f)),
this.faceVertexUvs[0].push([g, i, j, k])
}
this.computeCentroids(),
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.TorusKnotGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TubeGeometry = function(a, b, c, d, e, f) {
THREE.Geometry.call(this),
this.path = a,
this.segments = b || 64,
this.radius = c || 1,
this.radiusSegments = d || 8,
this.closed = e || !1,
f && (this.debug = new THREE.Object3D),
this.grid = [];
var g,
h,
i,
j,
k,
l,
m,
n,
e = this.segments + 1,
f = new THREE.Vector3,
b = new THREE.TubeGeometry.FrenetFrames(this.path, this.segments, this.closed);
for (l = b.tangents, m = b.normals, n = b.binormals, this.tangents = l, this.normals = m, this.binormals = n, b = 0; e > b; b++)
for (this.grid[b] = [], d = b / (e - 1), k = a.getPointAt(d), d = l[b], g = m[b], h = n[b], this.debug && (this.debug.add(new THREE.ArrowHelper(d, k, c, 255)), this.debug.add(new THREE.ArrowHelper(g, k, c, 16711680)), this.debug.add(new THREE.ArrowHelper(h, k, c, 65280))), d = 0; d < this.radiusSegments; d++)
i = 2 * (d / this.radiusSegments) * Math.PI,
j = -this.radius * Math.cos(i),
i = this.radius * Math.sin(i),
f.copy(k),
f.x += j * g.x + i * h.x,
f.y += j * g.y + i * h.y,
f.z += j * g.z + i * h.z,
this.grid[b][d] = this.vertices.push(new THREE.Vector3(f.x, f.y, f.z)) - 1;
for (b = 0; b < this.segments; b++)
for (d = 0; d < this.radiusSegments; d++)
e = this.closed ? (b + 1) % this.segments: b + 1,
f = (d + 1) % this.radiusSegments,
a = this.grid[b][d],
c = this.grid[e][d],
e = this.grid[e][f],
f = this.grid[b][f],
l = new THREE.Vector2(b / this.segments, d / this.radiusSegments),
m = new THREE.Vector2((b + 1) / this.segments, d / this.radiusSegments),
n = new THREE.Vector2((b + 1) / this.segments, (d + 1) / this.radiusSegments),
g = new THREE.Vector2(b / this.segments, (d + 1) / this.radiusSegments),
this.faces.push(new THREE.Face4(a, c, e, f)),
this.faceVertexUvs[0].push([l, m, n, g]);
this.computeCentroids(),
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.TubeGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TubeGeometry.FrenetFrames = function(a, b, c) {
new THREE.Vector3;
var d = new THREE.Vector3;
new THREE.Vector3;
var e,
f,
g,
h = [],
i = [],
j = [],
k = new THREE.Vector3,
l = new THREE.Matrix4,
b = b + 1;
for (this.tangents = h, this.normals = i, this.binormals = j, e = 0; b > e; e++)
f = e / (b - 1),
h[e] = a.getTangentAt(f),
h[e].normalize();
for (i[0] = new THREE.Vector3, j[0] = new THREE.Vector3, a = Number.MAX_VALUE, e = Math.abs(h[0].x), f = Math.abs(h[0].y), g = Math.abs(h[0].z), a >= e && (a = e, d.set(1, 0, 0)), a >= f && (a = f, d.set(0, 1, 0)), a >= g && d.set(0, 0, 1), k.crossVectors(h[0], d).normalize(), i[0].crossVectors(h[0], k), j[0].crossVectors(h[0], i[0]), e = 1; b > e; e++)
i[e] = i[e - 1].clone(),
j[e] = j[e - 1].clone(),
k.crossVectors(h[e - 1], h[e]),
1e - 4 < k.length() && (k.normalize(), d = Math.acos(h[e - 1].dot(h[e])), i[e].applyMatrix4(l.makeRotationAxis(k, d))),
j[e].crossVectors(h[e], i[e]);
if (c)
for (d = Math.acos(i[0].dot(i[b - 1])), d /= b - 1, 0 < h[0].dot(k.crossVectors(i[0], i[b - 1])) && (d = -d), e = 1; b > e; e++)
i[e].applyMatrix4(l.makeRotationAxis(h[e], d * e)),
j[e].crossVectors(h[e], i[e])
},
THREE.PolyhedronGeometry = function(a, b, c, d) {
function e(a) {
var b = a.normalize().clone();
b.index = h.vertices.push(b) - 1;
var c = Math.atan2(a.z, -a.x) / 2 / Math.PI + .5,
a = Math.atan2( - a.y, Math.sqrt(a.x * a.x + a.z * a.z)) / Math.PI + .5;
return b.uv = new THREE.Vector2(c, 1 - a),
b
}
function f(a, b, c) {
var d = new THREE.Face3(a.index, b.index, c.index, [a.clone(), b.clone(), c.clone()]);
d.centroid.add(a).add(b).add(c).divideScalar(3),
d.normal.copy(d.centroid).normalize(),
h.faces.push(d),
d = Math.atan2(d.centroid.z, -d.centroid.x),
h.faceVertexUvs[0].push([g(a.uv, a, d), g(b.uv, b, d), g(c.uv, c, d)])
}
function g(a, b, c) {
return 0 > c && 1 === a.x && (a = new THREE.Vector2(a.x - 1, a.y)),
0 === b.x && 0 === b.z && (a = new THREE.Vector2(c / 2 / Math.PI + .5, a.y)),
a.clone()
}
THREE.Geometry.call(this);
for (var c = c || 1, d = d || 0, h = this, i = 0, j = a.length; j > i; i++)
e(new THREE.Vector3(a[i][0], a[i][1], a[i][2]));
for (var k = this.vertices, a = [], i = 0, j = b.length; j > i; i++) {
var l = k[b[i][0]],
m = k[b[i][1]],
n = k[b[i][2]];
a[i] = new THREE.Face3(l.index, m.index, n.index, [l.clone(), m.clone(), n.clone()])
}
for (i = 0, j = a.length; j > i; i++) {
m = a[i],
k = d,
b = Math.pow(2, k),
Math.pow(4, k);
for (var k = e(h.vertices[m.a]), l = e(h.vertices[m.b]), o = e(h.vertices[m.c]), m = [], n = 0; b >= n; n++) {
m[n] = [];
for (var p = e(k.clone().lerp(o, n / b)), q = e(l.clone().lerp(o, n / b)), r = b - n, s = 0; r >= s; s++)
m[n][s] = 0 == s && n == b ? p: e(p.clone().lerp(q, s / r))
}
for (n = 0; b > n; n++)
for (s = 0; 2 * (b - n) - 1 > s; s++)
k = Math.floor(s / 2),
0 == s % 2 ? f(m[n][k + 1], m[n + 1][k], m[n][k]) : f(m[n][k + 1], m[n + 1][k + 1], m[n + 1][k])
}
for (i = 0, j = this.faceVertexUvs[0].length; j > i; i++)
d = this.faceVertexUvs[0][i],
a = d[0].x,
b = d[1].x,
k = d[2].x,
l = Math.max(a, Math.max(b, k)),
m = Math.min(a, Math.min(b, k)),
l > .9 && .1 > m && (.2 > a && (d[0].x += 1), .2 > b && (d[1].x += 1), .2 > k && (d[2].x += 1));
for (this.mergeVertices(), i = 0, j = this.vertices.length; j > i; i++)
this.vertices[i].multiplyScalar(c);
this.computeCentroids(),
this.boundingSphere = new THREE.Sphere(new THREE.Vector3, c)
},
THREE.PolyhedronGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.IcosahedronGeometry = function(a, b) {
this.radius = a,
this.detail = b;
var c = (1 + Math.sqrt(5)) / 2;
THREE.PolyhedronGeometry.call(this, [[ - 1, c, 0], [1, c, 0], [ - 1, -c, 0], [1, -c, 0], [0, -1, c], [0, 1, c], [0, -1, -c], [0, 1, -c], [c, 0, -1], [c, 0, 1], [ - c, 0, -1], [ - c, 0, 1]], [[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]], a, b)
},
THREE.IcosahedronGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.OctahedronGeometry = function(a, b) {
THREE.PolyhedronGeometry.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]], a, b)
},
THREE.OctahedronGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.TetrahedronGeometry = function(a, b) {
THREE.PolyhedronGeometry.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]], a, b)
},
THREE.TetrahedronGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ParametricGeometry = function(a, b, c, d) {
THREE.Geometry.call(this);
var e,
f,
g,
h,
i = this.vertices,
j = this.faces,
k = this.faceVertexUvs[0],
d = void 0 === d ? !1: d,
l = b + 1;
for (e = 0; c >= e; e++)
for (h = e / c, f = 0; b >= f; f++)
g = f / b,
g = a(g, h),
i.push(g);
var m,
n,
o,
p;
for (e = 0; c > e; e++)
for (f = 0; b > f; f++)
a = e * l + f,
i = e * l + f + 1,
h = (e + 1) * l + f,
g = (e + 1) * l + f + 1,
m = new THREE.Vector2(f / b, e / c),
n = new THREE.Vector2((f + 1) / b, e / c),
o = new THREE.Vector2(f / b, (e + 1) / c),
p = new THREE.Vector2((f + 1) / b, (e + 1) / c),
d ? (j.push(new THREE.Face3(a, i, h)), j.push(new THREE.Face3(i, g, h)), k.push([m, n, o]), k.push([n, p, o])) : (j.push(new THREE.Face4(a, i, g, h)), k.push([m, n, p, o]));
this.computeCentroids(),
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.ParametricGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.ConvexGeometry = function(a) {
function b(a) {
var b = a.length();
return new THREE.Vector2(a.x / b, a.y / b)
}
THREE.Geometry.call(this);
for (var c = [[0, 1, 2], [0, 2, 1]], d = 3; d < a.length; d++) {
var e = d,
f = a[e].clone(),
g = f.length();
f.x += 2e - 6 * g * (Math.random() - .5),
f.y += 2e - 6 * g * (Math.random() - .5),
f.z += 2e - 6 * g * (Math.random() - .5);
for (var g = [], h = 0; h < c.length;) {
var i,
j = c[h],
k = f,
l = a[j[0]];
i = l;
var m = a[j[1]],
n = a[j[2]],
o = new THREE.Vector3,
p = new THREE.Vector3;
if (o.subVectors(n, m), p.subVectors(i, m), o.cross(p), o.normalize(), i = o, l = i.dot(l), i.dot(k) >= l) {
for (k = 0; 3 > k; k++) {
for (l = [j[k], j[(k + 1) % 3]], i = !0, m = 0; m < g.length; m++)
if (g[m][0] === l[1] && g[m][1] === l[0]) {
g[m] = g[g.length - 1],
g.pop(),
i = !1;
break
}
i && g.push(l)
}
c[h] = c[c.length - 1],
c.pop()
} else
h++
}
for (m = 0; m < g.length; m++)
c.push([g[m][0], g[m][1], e])
}
for (e = 0, f = Array(a.length), d = 0; d < c.length; d++)
for (g = c[d], h = 0; 3 > h; h++)
void 0 === f[g[h]] && (f[g[h]] = e++, this.vertices.push(a[g[h]])),
g[h] = f[g[h]];
for (d = 0; d < c.length; d++)
this.faces.push(new THREE.Face3(c[d][0], c[d][1], c[d][2]));
for (d = 0; d < this.faces.length; d++)
g = this.faces[d],
this.faceVertexUvs[0].push([b(this.vertices[g.a]), b(this.vertices[g.b]), b(this.vertices[g.c])]);
this.computeCentroids(),
this.computeFaceNormals(),
this.computeVertexNormals()
},
THREE.ConvexGeometry.prototype = Object.create(THREE.Geometry.prototype),
THREE.AxisHelper = function(a) {
var a = a || 1,
b = new THREE.Geometry;
b.vertices.push(new THREE.Vector3, new THREE.Vector3(a, 0, 0), new THREE.Vector3, new THREE.Vector3(0, a, 0), new THREE.Vector3, new THREE.Vector3(0, 0, a)),
b.colors.push(new THREE.Color(16711680), new THREE.Color(16755200), new THREE.Color(65280), new THREE.Color(11206400), new THREE.Color(255), new THREE.Color(43775)),
a = new THREE.LineBasicMaterial({
vertexColors: THREE.VertexColors
}),
THREE.Line.call(this, b, a, THREE.LinePieces)
},
THREE.AxisHelper.prototype = Object.create(THREE.Line.prototype),
THREE.ArrowHelper = function(a, b, c, d) {
THREE.Object3D.call(this),
void 0 === d && (d = 16776960),
void 0 === c && (c = 1),
this.position = b,
this.useQuaternion = !0,
b = new THREE.Geometry,
b.vertices.push(new THREE.Vector3(0, 0, 0)),
b.vertices.push(new THREE.Vector3(0, 1, 0)),
this.line = new THREE.Line(b, new THREE.LineBasicMaterial({
color: d
})),
this.line.matrixAutoUpdate = !1,
this.add(this.line),
b = new THREE.CylinderGeometry(0, .05, .25, 5, 1),
b.applyMatrix((new THREE.Matrix4).makeTranslation(0, .875, 0)),
this.cone = new THREE.Mesh(b, new THREE.MeshBasicMaterial({
color: d
})),
this.cone.matrixAutoUpdate = !1,
this.add(this.cone),
this.setDirection(a),
this.setLength(c)
},
THREE.ArrowHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.ArrowHelper.prototype.setDirection = function() {
var a,
b = new THREE.Vector3;
return function(c) {.999 < c.y ? this.quaternion.set(0, 0, 0, 1) : -.999 > c.y ? this.quaternion.set(1, 0, 0, 0) : (b.set(c.z, 0, -c.x).normalize(), a = Math.acos(c.y), this.quaternion.setFromAxisAngle(b, a))
}
} (),
THREE.ArrowHelper.prototype.setLength = function(a) {
this.scale.set(a, a, a)
},
THREE.ArrowHelper.prototype.setColor = function(a) {
this.line.material.color.setHex(a),
this.cone.material.color.setHex(a)
},
THREE.BoxHelper = function(a) {
var a = a || 1,
b = new THREE.Geometry,
a = [new THREE.Vector3(a, a, a), new THREE.Vector3( - a, a, a), new THREE.Vector3( - a, -a, a), new THREE.Vector3(a, -a, a), new THREE.Vector3(a, a, -a), new THREE.Vector3( - a, a, -a), new THREE.Vector3( - a, -a, -a), new THREE.Vector3(a, -a, -a)];
b.vertices.push(a[0], a[1], a[1], a[2], a[2], a[3], a[3], a[0], a[4], a[5], a[5], a[6], a[6], a[7], a[7], a[4], a[0], a[4], a[1], a[5], a[2], a[6], a[3], a[7]),
this.vertices = a,
THREE.Line.call(this, b, new THREE.LineBasicMaterial, THREE.LinePieces)
},
THREE.BoxHelper.prototype = Object.create(THREE.Line.prototype),
THREE.BoxHelper.prototype.update = function(a) {
var b = a.geometry;
null === b.boundingBox && b.computeBoundingBox();
var c = b.boundingBox.min,
b = b.boundingBox.max,
d = this.vertices;
d[0].set(b.x, b.y, b.z),
d[1].set(c.x, b.y, b.z),
d[2].set(c.x, c.y, b.z),
d[3].set(b.x, c.y, b.z),
d[4].set(b.x, b.y, c.z),
d[5].set(c.x, b.y, c.z),
d[6].set(c.x, c.y, c.z),
d[7].set(b.x, c.y, c.z),
this.geometry.computeBoundingSphere(),
this.geometry.verticesNeedUpdate = !0,
this.matrixAutoUpdate = !1,
this.matrixWorld = a.matrixWorld
},
THREE.CameraHelper = function(a) {
function b(a, b, d) {
c(a, d),
c(b, d)
}
function c(a, b) {
d.vertices.push(new THREE.Vector3),
d.colors.push(new THREE.Color(b)),
void 0 === f[a] && (f[a] = []),
f[a].push(d.vertices.length - 1)
}
THREE.Line.call(this);
var d = new THREE.Geometry,
e = new THREE.LineBasicMaterial({
color: 16777215,
vertexColors: THREE.FaceColors
}),
f = {};
b("n1", "n2", 16755200),
b("n2", "n4", 16755200),
b("n4", "n3", 16755200),
b("n3", "n1", 16755200),
b("f1", "f2", 16755200),
b("f2", "f4", 16755200),
b("f4", "f3", 16755200),
b("f3", "f1", 16755200),
b("n1", "f1", 16755200),
b("n2", "f2", 16755200),
b("n3", "f3", 16755200),
b("n4", "f4", 16755200),
b("p", "n1", 16711680),
b("p", "n2", 16711680),
b("p", "n3", 16711680),
b("p", "n4", 16711680),
b("u1", "u2", 43775),
b("u2", "u3", 43775),
b("u3", "u1", 43775),
b("c", "t", 16777215),
b("p", "c", 3355443),
b("cn1", "cn2", 3355443),
b("cn3", "cn4", 3355443),
b("cf1", "cf2", 3355443),
b("cf3", "cf4", 3355443),
THREE.Line.call(this, d, e, THREE.LinePieces),
this.camera = a,
this.matrixWorld = a.matrixWorld,
this.matrixAutoUpdate = !1,
this.pointMap = f,
this.update()
},
THREE.CameraHelper.prototype = Object.create(THREE.Line.prototype),
THREE.CameraHelper.prototype.update = function() {
var a = new THREE.Vector3,
b = new THREE.Camera,
c = new THREE.Projector;
return function() {
function d(d, f, g, h) {
if (a.set(f, g, h), c.unprojectVector(a, b), d = e.pointMap[d], void 0 !== d)
for (f = 0, g = d.length; g > f; f++)
e.geometry.vertices[d[f]].copy(a)
}
var e = this;
b.projectionMatrix.copy(this.camera.projectionMatrix),
d("c", 0, 0, -1),
d("t", 0, 0, 1),
d("n1", -1, -1, -1),
d("n2", 1, -1, -1),
d("n3", -1, 1, -1),
d("n4", 1, 1, -1),
d("f1", -1, -1, 1),
d("f2", 1, -1, 1),
d("f3", -1, 1, 1),
d("f4", 1, 1, 1),
d("u1", .7, 1.1, -1),
d("u2", -.7, 1.1, -1),
d("u3", 0, 2, -1),
d("cf1", -1, 0, 1),
d("cf2", 1, 0, 1),
d("cf3", 0, -1, 1),
d("cf4", 0, 1, 1),
d("cn1", -1, 0, -1),
d("cn2", 1, 0, -1),
d("cn3", 0, -1, -1),
d("cn4", 0, 1, -1),
this.geometry.verticesNeedUpdate = !0
}
} (),
THREE.DirectionalLightHelper = function(a, b) {
THREE.Object3D.call(this),
this.matrixAutoUpdate = !1,
this.light = a;
var c = new THREE.SphereGeometry(b, 4, 2),
d = new THREE.MeshBasicMaterial({
fog: !1,
wireframe: !0
});
d.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.lightSphere = new THREE.Mesh(c, d),
this.lightSphere.matrixWorld = this.light.matrixWorld,
this.lightSphere.matrixAutoUpdate = !1,
this.add(this.lightSphere),
c = new THREE.Geometry,
c.vertices.push(this.light.position),
c.vertices.push(this.light.target.position),
c.computeLineDistances(),
d = new THREE.LineDashedMaterial({
dashSize: 4,
gapSize: 4,
opacity: .75,
transparent: !0,
fog: !1
}),
d.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.targetLine = new THREE.Line(c, d),
this.add(this.targetLine)
},
THREE.DirectionalLightHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.DirectionalLightHelper.prototype.update = function() {
this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.targetLine.geometry.computeLineDistances(),
this.targetLine.geometry.verticesNeedUpdate = !0,
this.targetLine.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)
},
THREE.GridHelper = function(a, b) {
for (var c = new THREE.Geometry, d = new THREE.LineBasicMaterial({
vertexColors: THREE.VertexColors
}), e = new THREE.Color(4473924), f = new THREE.Color(8947848), g = -a; a >= g; g += b) {
c.vertices.push(new THREE.Vector3( - a, 0, g)),
c.vertices.push(new THREE.Vector3(a, 0, g)),
c.vertices.push(new THREE.Vector3(g, 0, -a)),
c.vertices.push(new THREE.Vector3(g, 0, a));
var h = 0 === g ? e: f;
c.colors.push(h, h, h, h)
}
THREE.Line.call(this, c, d, THREE.LinePieces)
},
THREE.GridHelper.prototype = Object.create(THREE.Line.prototype),
THREE.HemisphereLightHelper = function(a, b) {
THREE.Object3D.call(this),
this.light = a;
var c = new THREE.SphereGeometry(b, 4, 2);
c.applyMatrix((new THREE.Matrix4).makeRotationX( - Math.PI / 2));
for (var d = 0; 8 > d; d++)
c.faces[d].materialIndex = 4 > d ? 0: 1;
d = new THREE.MeshBasicMaterial({
fog: !1,
wireframe: !0
}),
d.color.copy(a.color).multiplyScalar(a.intensity);
var e = new THREE.MeshBasicMaterial({
fog: !1,
wireframe: !0
});
e.color.copy(a.groundColor).multiplyScalar(a.intensity),
this.lightSphere = new THREE.Mesh(c, new THREE.MeshFaceMaterial([d, e])),
this.lightSphere.position = a.position,
this.lightSphere.lookAt(new THREE.Vector3),
this.add(this.lightSphere)
},
THREE.HemisphereLightHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.HemisphereLightHelper.prototype.update = function() {
this.lightSphere.lookAt(new THREE.Vector3),
this.lightSphere.material.materials[0].color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.lightSphere.material.materials[1].color.copy(this.light.groundColor).multiplyScalar(this.light.intensity)
},
THREE.PointLightHelper = function(a, b) {
THREE.Object3D.call(this),
this.matrixAutoUpdate = !1,
this.light = a;
var c = new THREE.SphereGeometry(b, 4, 2),
d = new THREE.MeshBasicMaterial({
fog: !1,
wireframe: !0
});
d.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.lightSphere = new THREE.Mesh(c, d),
this.lightSphere.matrixWorld = this.light.matrixWorld,
this.lightSphere.matrixAutoUpdate = !1,
this.add(this.lightSphere)
},
THREE.PointLightHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.PointLightHelper.prototype.update = function() {
this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)
},
THREE.SpotLightHelper = function(a, b) {
THREE.Object3D.call(this),
this.matrixAutoUpdate = !1,
this.light = a;
var c = new THREE.SphereGeometry(b, 4, 2),
d = new THREE.MeshBasicMaterial({
fog: !1,
wireframe: !0
});
d.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.lightSphere = new THREE.Mesh(c, d),
this.lightSphere.matrixWorld = this.light.matrixWorld,
this.lightSphere.matrixAutoUpdate = !1,
this.add(this.lightSphere),
c = new THREE.CylinderGeometry(1e - 4, 1, 1, 8, 1, !0),
c.applyMatrix((new THREE.Matrix4).makeTranslation(0, -.5, 0)),
c.applyMatrix((new THREE.Matrix4).makeRotationX( - Math.PI / 2)),
d = new THREE.MeshBasicMaterial({
fog: !1,
wireframe: !0,
opacity: .3,
transparent: !0
}),
d.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.lightCone = new THREE.Mesh(c, d),
this.lightCone.position = this.light.position,
c = a.distance ? a.distance: 1e4,
d = c * Math.tan(a.angle),
this.lightCone.scale.set(d, d, c),
this.lightCone.lookAt(this.light.target.position),
this.add(this.lightCone)
},
THREE.SpotLightHelper.prototype = Object.create(THREE.Object3D.prototype),
THREE.SpotLightHelper.prototype.update = function() {
var a = this.light.distance ? this.light.distance: 1e4,
b = a * Math.tan(this.light.angle);
this.lightCone.scale.set(b, b, a),
this.lightCone.lookAt(this.light.target.position),
this.lightSphere.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),
this.lightCone.material.color.copy(this.light.color).multiplyScalar(this.light.intensity)
},
THREE.ImmediateRenderObject = function() {
THREE.Object3D.call(this),
this.render = function() {}
},
THREE.ImmediateRenderObject.prototype = Object.create(THREE.Object3D.prototype),
THREE.LensFlare = function(a, b, c, d, e) {
THREE.Object3D.call(this),
this.lensFlares = [],
this.positionScreen = new THREE.Vector3,
this.customUpdateCallback = void 0,
void 0 !== a && this.add(a, b, c, d, e)
},
THREE.LensFlare.prototype = Object.create(THREE.Object3D.prototype),
THREE.LensFlare.prototype.add = function(a, b, c, d, e, f) {
void 0 === b && (b = -1),
void 0 === c && (c = 0),
void 0 === f && (f = 1),
void 0 === e && (e = new THREE.Color(16777215)),
void 0 === d && (d = THREE.NormalBlending),
c = Math.min(c, Math.max(0, c)),
this.lensFlares.push({
texture: a,
size: b,
distance: c,
x: 0,
y: 0,
z: 0,
scale: 1,
rotation: 1,
opacity: f,
color: e,
blending: d
})
},
THREE.LensFlare.prototype.updateLensFlares = function() {
var a,
b,
c = this.lensFlares.length,
d = 2 * -this.positionScreen.x,
e = 2 * -this.positionScreen.y;
for (a = 0; c > a; a++)
b = this.lensFlares[a],
b.x = this.positionScreen.x + d * b.distance,
b.y = this.positionScreen.y + e * b.distance,
b.wantedRotation = .25 * b.x * Math.PI,
b.rotation += .25 * (b.wantedRotation - b.rotation)
},
THREE.MorphBlendMesh = function(a, b) {
THREE.Mesh.call(this, a, b),
this.animationsMap = {},
this.animationsList = [];
var c = this.geometry.morphTargets.length;
this.createAnimation("__default", 0, c - 1, c / 1),
this.setAnimationWeight("__default", 1)
},
THREE.MorphBlendMesh.prototype = Object.create(THREE.Mesh.prototype),
THREE.MorphBlendMesh.prototype.createAnimation = function(a, b, c, d) {
b = {
startFrame: b,
endFrame: c,
length: c - b + 1,
fps: d,
duration: (c - b) / d,
lastFrame: 0,
currentFrame: 0,
active: !1,
time: 0,
direction: 1,
weight: 1,
directionBackwards: !1,
mirroredLoop: !1
},
this.animationsMap[a] = b,
this.animationsList.push(b)
},
THREE.MorphBlendMesh.prototype.autoCreateAnimations = function(a) {
for (var b, c = /([a-z]+)(\d+)/, d = {}, e = this.geometry, f = 0, g = e.morphTargets.length; g > f; f++) {
var h = e.morphTargets[f].name.match(c);
if (h && 1 < h.length) {
var i = h[1];
d[i] || (d[i] = {
start: 1 / 0,
end: -1 / 0
}),
h = d[i],
f < h.start && (h.start = f),
f > h.end && (h.end = f),
b || (b = i)
}
}
for (i in d)
h = d[i],
this.createAnimation(i, h.start, h.end, a);
this.firstAnimation = b
},
THREE.MorphBlendMesh.prototype.setAnimationDirectionForward = function(a) { (a = this.animationsMap[a]) && (a.direction = 1, a.directionBackwards = !1)
},
THREE.MorphBlendMesh.prototype.setAnimationDirectionBackward = function(a) { (a = this.animationsMap[a]) && (a.direction = -1, a.directionBackwards = !0)
},
THREE.MorphBlendMesh.prototype.setAnimationFPS = function(a, b) {
var c = this.animationsMap[a];
c && (c.fps = b, c.duration = (c.end - c.start) / c.fps)
},
THREE.MorphBlendMesh.prototype.setAnimationDuration = function(a, b) {
var c = this.animationsMap[a];
c && (c.duration = b, c.fps = (c.end - c.start) / c.duration)
},
THREE.MorphBlendMesh.prototype.setAnimationWeight = function(a, b) {
var c = this.animationsMap[a];
c && (c.weight = b)
},
THREE.MorphBlendMesh.prototype.setAnimationTime = function(a, b) {
var c = this.animationsMap[a];
c && (c.time = b)
},
THREE.MorphBlendMesh.prototype.getAnimationTime = function(a) {
var b = 0;
return (a = this.animationsMap[a]) && (b = a.time),
b
},
THREE.MorphBlendMesh.prototype.getAnimationDuration = function(a) {
var b = -1;
return (a = this.animationsMap[a]) && (b = a.duration),
b
},
THREE.MorphBlendMesh.prototype.playAnimation = function(a) {
var b = this.animationsMap[a];
b ? (b.time = 0, b.active = !0) : console.warn("animation[" + a + "] undefined")
},
THREE.MorphBlendMesh.prototype.stopAnimation = function(a) { (a = this.animationsMap[a]) && (a.active = !1)
},
THREE.MorphBlendMesh.prototype.update = function(a) {
for (var b = 0, c = this.animationsList.length; c > b; b++) {
var d = this.animationsList[b];
if (d.active) {
var e = d.duration / d.length;
d.time += d.direction * a,
d.mirroredLoop ? (d.time > d.duration || 0 > d.time) && (d.direction *= -1, d.time > d.duration && (d.time = d.duration, d.directionBackwards = !0), 0 > d.time && (d.time = 0, d.directionBackwards = !1)) : (d.time %= d.duration, 0 > d.time && (d.time += d.duration));
var f = d.startFrame + THREE.Math.clamp(Math.floor(d.time / e), 0, d.length - 1),
g = d.weight;
f !== d.currentFrame && (this.morphTargetInfluences[d.lastFrame] = 0, this.morphTargetInfluences[d.currentFrame] = 1 * g, this.morphTargetInfluences[f] = 0, d.lastFrame = d.currentFrame, d.currentFrame = f),
e = d.time % e / e,
d.directionBackwards && (e = 1 - e),
this.morphTargetInfluences[d.currentFrame] = e * g,
this.morphTargetInfluences[d.lastFrame] = (1 - e) * g
}
}
},
THREE.LensFlarePlugin = function() {
function a(a, c) {
var d = b.createProgram(),
e = b.createShader(b.FRAGMENT_SHADER),
f = b.createShader(b.VERTEX_SHADER),
g = "precision " + c + " float;\n";
return b.shaderSource(e, g + a.fragmentShader),
b.shaderSource(f, g + a.vertexShader),
b.compileShader(e),
b.compileShader(f),
b.attachShader(d, e),
b.attachShader(d, f),
b.linkProgram(d),
d
}
var b,
c,
d,
e,
f,
g,
h,
i,
j,
k,
l,
m,
n;
this.init = function(o) {
b = o.context,
c = o,
d = o.getPrecision(),
e = new Float32Array(16),
f = new Uint16Array(6),
o = 0,
e[o++] = -1,
e[o++] = -1,
e[o++] = 0,
e[o++] = 0,
e[o++] = 1,
e[o++] = -1,
e[o++] = 1,
e[o++] = 0,
e[o++] = 1,
e[o++] = 1,
e[o++] = 1,
e[o++] = 1,
e[o++] = -1,
e[o++] = 1,
e[o++] = 0,
e[o++] = 1,
o = 0,
f[o++] = 0,
f[o++] = 1,
f[o++] = 2,
f[o++] = 0,
f[o++] = 2,
f[o++] = 3,
g = b.createBuffer(),
h = b.createBuffer(),
b.bindBuffer(b.ARRAY_BUFFER, g),
b.bufferData(b.ARRAY_BUFFER, e, b.STATIC_DRAW),
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, h),
b.bufferData(b.ELEMENT_ARRAY_BUFFER, f, b.STATIC_DRAW),
i = b.createTexture(),
j = b.createTexture(),
b.bindTexture(b.TEXTURE_2D, i),
b.texImage2D(b.TEXTURE_2D, 0, b.RGB, 16, 16, 0, b.RGB, b.UNSIGNED_BYTE, null),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, b.NEAREST),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.NEAREST),
b.bindTexture(b.TEXTURE_2D, j),
b.texImage2D(b.TEXTURE_2D, 0, b.RGBA, 16, 16, 0, b.RGBA, b.UNSIGNED_BYTE, null),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, b.NEAREST),
b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.NEAREST),
0 >= b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS) ? (k = !1, l = a(THREE.ShaderFlares.lensFlare, d)) : (k = !0, l = a(THREE.ShaderFlares.lensFlareVertexTexture, d)),
m = {},
n = {},
m.vertex = b.getAttribLocation(l, "position"),
m.uv = b.getAttribLocation(l, "uv"),
n.renderType = b.getUniformLocation(l, "renderType"),
n.map = b.getUniformLocation(l, "map"),
n.occlusionMap = b.getUniformLocation(l, "occlusionMap"),
n.opacity = b.getUniformLocation(l, "opacity"),
n.color = b.getUniformLocation(l, "color"),
n.scale = b.getUniformLocation(l, "scale"),
n.rotation = b.getUniformLocation(l, "rotation"),
n.screenPosition = b.getUniformLocation(l, "screenPosition")
},
this.render = function(a, d, e, f) {
var a = a.__webglFlares,
o = a.length;
if (o) {
var p = new THREE.Vector3,
q = f / e,
r = .5 * e,
s = .5 * f,
t = 16 / f,
u = new THREE.Vector2(t * q, t),
v = new THREE.Vector3(1, 1, 0),
w = new THREE.Vector2(1, 1),
x = n,
t = m;
b.useProgram(l),
b.enableVertexAttribArray(m.vertex),
b.enableVertexAttribArray(m.uv),
b.uniform1i(x.occlusionMap, 0),
b.uniform1i(x.map, 1),
b.bindBuffer(b.ARRAY_BUFFER, g),
b.vertexAttribPointer(t.vertex, 2, b.FLOAT, !1, 16, 0),
b.vertexAttribPointer(t.uv, 2, b.FLOAT, !1, 16, 8),
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, h),
b.disable(b.CULL_FACE),
b.depthMask(!1);
var y,
z,
A,
B,
C;
for (y = 0; o > y; y++)
if (t = 16 / f, u.set(t * q, t), B = a[y], p.set(B.matrixWorld.elements[12], B.matrixWorld.elements[13], B.matrixWorld.elements[14]), p.applyMatrix4(d.matrixWorldInverse), p.applyProjection(d.projectionMatrix), v.copy(p), w.x = v.x * r + r, w.y = v.y * s + s, k || 0 < w.x && w.x < e && 0 < w.y && w.y < f)
for (b.activeTexture(b.TEXTURE1), b.bindTexture(b.TEXTURE_2D, i), b.copyTexImage2D(b.TEXTURE_2D, 0, b.RGB, w.x - 8, w.y - 8, 16, 16, 0), b.uniform1i(x.renderType, 0), b.uniform2f(x.scale, u.x, u.y), b.uniform3f(x.screenPosition, v.x, v.y, v.z), b.disable(b.BLEND), b.enable(b.DEPTH_TEST), b.drawElements(b.TRIANGLES, 6, b.UNSIGNED_SHORT, 0), b.activeTexture(b.TEXTURE0), b.bindTexture(b.TEXTURE_2D, j), b.copyTexImage2D(b.TEXTURE_2D, 0, b.RGBA, w.x - 8, w.y - 8, 16, 16, 0), b.uniform1i(x.renderType, 1), b.disable(b.DEPTH_TEST), b.activeTexture(b.TEXTURE1), b.bindTexture(b.TEXTURE_2D, i), b.drawElements(b.TRIANGLES, 6, b.UNSIGNED_SHORT, 0), B.positionScreen.copy(v), B.customUpdateCallback ? B.customUpdateCallback(B) : B.updateLensFlares(), b.uniform1i(x.renderType, 2), b.enable(b.BLEND), z = 0, A = B.lensFlares.length; A > z; z++)
C = B.lensFlares[z],
.001 < C.opacity && .001 < C.scale && (v.x = C.x, v.y = C.y, v.z = C.z, t = C.size * C.scale / f, u.x = t * q, u.y = t, b.uniform3f(x.screenPosition, v.x, v.y, v.z), b.uniform2f(x.scale, u.x, u.y), b.uniform1f(x.rotation, C.rotation), b.uniform1f(x.opacity, C.opacity), b.uniform3f(x.color, C.color.r, C.color.g, C.color.b), c.setBlending(C.blending, C.blendEquation, C.blendSrc, C.blendDst), c.setTexture(C.texture, 1), b.drawElements(b.TRIANGLES, 6, b.UNSIGNED_SHORT, 0));
b.enable(b.CULL_FACE),
b.enable(b.DEPTH_TEST),
b.depthMask(!0)
}
}
},
THREE.ShadowMapPlugin = function() {
var a,
b,
c,
d,
e,
f,
g = new THREE.Frustum,
h = new THREE.Matrix4,
i = new THREE.Vector3,
j = new THREE.Vector3,
k = new THREE.Vector3;
this.init = function(g) {
a = g.context,
b = g;
var g = THREE.ShaderLib.depthRGBA,
h = THREE.UniformsUtils.clone(g.uniforms);
c = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h
}),
d = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h,
morphTargets: !0
}),
e = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h,
skinning: !0
}),
f = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h,
morphTargets: !0,
skinning: !0
}),
c._shadowPass = !0,
d._shadowPass = !0,
e._shadowPass = !0,
f._shadowPass = !0
},
this.render = function(a, c) {
b.shadowMapEnabled && b.shadowMapAutoUpdate && this.update(a, c)
},
this.update = function(l, m) {
var n,
o,
p,
q,
r,
s,
t,
u,
v,
w = [];
for (q = 0, a.clearColor(1, 1, 1, 1), a.disable(a.BLEND), a.enable(a.CULL_FACE), a.frontFace(a.CCW), a.cullFace(b.shadowMapCullFace === THREE.CullFaceFront ? a.FRONT: a.BACK), b.setDepthTest(!0), n = 0, o = l.__lights.length; o > n; n++)
if (p = l.__lights[n], p.castShadow)
if (p instanceof THREE.DirectionalLight && p.shadowCascade)
for (r = 0; r < p.shadowCascadeCount; r++) {
var x;
if (p.shadowCascadeArray[r])
x = p.shadowCascadeArray[r];
else {
v = p,
t = r,
x = new THREE.DirectionalLight,
x.isVirtual = !0,
x.onlyShadow = !0,
x.castShadow = !0,
x.shadowCameraNear = v.shadowCameraNear,
x.shadowCameraFar = v.shadowCameraFar,
x.shadowCameraLeft = v.shadowCameraLeft,
x.shadowCameraRight = v.shadowCameraRight,
x.shadowCameraBottom = v.shadowCameraBottom,
x.shadowCameraTop = v.shadowCameraTop,
x.shadowCameraVisible = v.shadowCameraVisible,
x.shadowDarkness = v.shadowDarkness,
x.shadowBias = v.shadowCascadeBias[t],
x.shadowMapWidth = v.shadowCascadeWidth[t],
x.shadowMapHeight = v.shadowCascadeHeight[t],
x.pointsWorld = [],
x.pointsFrustum = [],
u = x.pointsWorld,
s = x.pointsFrustum;
for (var y = 0; 8 > y; y++)
u[y] = new THREE.Vector3,
s[y] = new THREE.Vector3;
u = v.shadowCascadeNearZ[t],
v = v.shadowCascadeFarZ[t],
s[0].set( - 1, -1, u),
s[1].set(1, -1, u),
s[2].set( - 1, 1, u),
s[3].set(1, 1, u),
s[4].set( - 1, -1, v),
s[5].set(1, -1, v),
s[6].set( - 1, 1, v),
s[7].set(1, 1, v),
x.originalCamera = m,
s = new THREE.Gyroscope,
s.position = p.shadowCascadeOffset,
s.add(x),
s.add(x.target),
m.add(s),
p.shadowCascadeArray[r] = x,
console.log("Created virtualLight", x)
}
t = p,
u = r,
v = t.shadowCascadeArray[u],
v.position.copy(t.position),
v.target.position.copy(t.target.position),
v.lookAt(v.target),
v.shadowCameraVisible = t.shadowCameraVisible,
v.shadowDarkness = t.shadowDarkness,
v.shadowBias = t.shadowCascadeBias[u],
s = t.shadowCascadeNearZ[u],
t = t.shadowCascadeFarZ[u],
v = v.pointsFrustum,
v[0].z = s,
v[1].z = s,
v[2].z = s,
v[3].z = s,
v[4].z = t,
v[5].z = t,
v[6].z = t,
v[7].z = t,
w[q] = x,
q++
} else
w[q] = p,
q++;
for (n = 0, o = w.length; o > n; n++) {
if (p = w[n], p.shadowMap || (r = THREE.LinearFilter, b.shadowMapType === THREE.PCFSoftShadowMap && (r = THREE.NearestFilter), p.shadowMap = new THREE.WebGLRenderTarget(p.shadowMapWidth, p.shadowMapHeight, {
minFilter: r,
magFilter: r,
format: THREE.RGBAFormat
}), p.shadowMapSize = new THREE.Vector2(p.shadowMapWidth, p.shadowMapHeight), p.shadowMatrix = new THREE.Matrix4), !p.shadowCamera) {
if (p instanceof THREE.SpotLight)
p.shadowCamera = new THREE.PerspectiveCamera(p.shadowCameraFov, p.shadowMapWidth / p.shadowMapHeight, p.shadowCameraNear, p.shadowCameraFar);
else {
if (! (p instanceof THREE.DirectionalLight)) {
console.error("Unsupported light type for shadow");
continue
}
p.shadowCamera = new THREE.OrthographicCamera(p.shadowCameraLeft, p.shadowCameraRight, p.shadowCameraTop, p.shadowCameraBottom, p.shadowCameraNear, p.shadowCameraFar)
}
l.add(p.shadowCamera),
!0 === l.autoUpdate && l.updateMatrixWorld()
}
if (p.shadowCameraVisible && !p.cameraHelper && (p.cameraHelper = new THREE.CameraHelper(p.shadowCamera), p.shadowCamera.add(p.cameraHelper)), p.isVirtual && x.originalCamera == m) {
for (r = m, q = p.shadowCamera, s = p.pointsFrustum, v = p.pointsWorld, i.set(1 / 0, 1 / 0, 1 / 0), j.set( - 1 / 0, -1 / 0, -1 / 0), t = 0; 8 > t; t++)
u = v[t],
u.copy(s[t]),
THREE.ShadowMapPlugin.__projector.unprojectVector(u, r),
u.applyMatrix4(q.matrixWorldInverse),
u.x < i.x && (i.x = u.x),
u.x > j.x && (j.x = u.x),
u.y < i.y && (i.y = u.y),
u.y > j.y && (j.y = u.y),
u.z < i.z && (i.z = u.z),
u.z > j.z && (j.z = u.z);
q.left = i.x,
q.right = j.x,
q.top = j.y,
q.bottom = i.y,
q.updateProjectionMatrix()
}
for (q = p.shadowMap, s = p.shadowMatrix, r = p.shadowCamera, r.position.getPositionFromMatrix(p.matrixWorld), k.getPositionFromMatrix(p.target.matrixWorld), r.lookAt(k), r.updateMatrixWorld(), r.matrixWorldInverse.getInverse(r.matrixWorld), p.cameraHelper && (p.cameraHelper.visible = p.shadowCameraVisible), p.shadowCameraVisible && p.cameraHelper.update(), s.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1), s.multiply(r.projectionMatrix), s.multiply(r.matrixWorldInverse), h.multiplyMatrices(r.projectionMatrix, r.matrixWorldInverse), g.setFromMatrix(h), b.setRenderTarget(q), b.clear(), v = l.__webglObjects, p = 0, q = v.length; q > p; p++)
t = v[p],
s = t.object,
t.render = !1,
!s.visible || !s.castShadow || (s instanceof THREE.Mesh || s instanceof THREE.ParticleSystem) && s.frustumCulled && !g.intersectsObject(s) || (s._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse, s.matrixWorld), t.render = !0);
for (p = 0, q = v.length; q > p; p++)
t = v[p],
t.render && (s = t.object, t = t.buffer, y = s.material instanceof THREE.MeshFaceMaterial ? s.material.materials[0] : s.material, u = 0 < s.geometry.morphTargets.length && y.morphTargets, y = s instanceof THREE.SkinnedMesh && y.skinning, u = s.customDepthMaterial ? s.customDepthMaterial: y ? u ? f: e: u ? d: c, t instanceof THREE.BufferGeometry ? b.renderBufferDirect(r, l.__lights, null, u, t, s) : b.renderBuffer(r, l.__lights, null, u, t, s));
for (v = l.__webglObjectsImmediate, p = 0, q = v.length; q > p; p++)
t = v[p],
s = t.object,
s.visible && s.castShadow && (s._modelViewMatrix.multiplyMatrices(r.matrixWorldInverse, s.matrixWorld), b.renderImmediateObject(r, l.__lights, null, c, s))
}
n = b.getClearColor(),
o = b.getClearAlpha(),
a.clearColor(n.r, n.g, n.b, o),
a.enable(a.BLEND),
b.shadowMapCullFace === THREE.CullFaceFront && a.cullFace(a.BACK)
}
},
THREE.ShadowMapPlugin.__projector = new THREE.Projector,
THREE.SpritePlugin = function() {
function a(a, b) {
return a.z !== b.z ? b.z - a.z: b.id - a.id
}
var b,
c,
d,
e,
f,
g,
h,
i,
j,
k;
this.init = function(a) {
b = a.context,
c = a,
d = a.getPrecision(),
e = new Float32Array(16),
f = new Uint16Array(6),
a = 0,
e[a++] = -1,
e[a++] = -1,
e[a++] = 0,
e[a++] = 0,
e[a++] = 1,
e[a++] = -1,
e[a++] = 1,
e[a++] = 0,
e[a++] = 1,
e[a++] = 1,
e[a++] = 1,
e[a++] = 1,
e[a++] = -1,
e[a++] = 1,
e[a++] = 0,
e[a++] = 1,
a = 0,
f[a++] = 0,
f[a++] = 1,
f[a++] = 2,
f[a++] = 0,
f[a++] = 2,
f[a++] = 3,
g = b.createBuffer(),
h = b.createBuffer(),
b.bindBuffer(b.ARRAY_BUFFER, g),
b.bufferData(b.ARRAY_BUFFER, e, b.STATIC_DRAW),
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, h),
b.bufferData(b.ELEMENT_ARRAY_BUFFER, f, b.STATIC_DRAW);
var a = THREE.ShaderSprite.sprite,
l = b.createProgram(),
m = b.createShader(b.FRAGMENT_SHADER),
n = b.createShader(b.VERTEX_SHADER),
o = "precision " + d + " float;\n";
b.shaderSource(m, o + a.fragmentShader),
b.shaderSource(n, o + a.vertexShader),
b.compileShader(m),
b.compileShader(n),
b.attachShader(l, m),
b.attachShader(l, n),
b.linkProgram(l),
i = l,
j = {},
k = {},
j.position = b.getAttribLocation(i, "position"),
j.uv = b.getAttribLocation(i, "uv"),
k.uvOffset = b.getUniformLocation(i, "uvOffset"),
k.uvScale = b.getUniformLocation(i, "uvScale"),
k.rotation = b.getUniformLocation(i, "rotation"),
k.scale = b.getUniformLocation(i, "scale"),
k.alignment = b.getUniformLocation(i, "alignment"),
k.color = b.getUniformLocation(i, "color"),
k.map = b.getUniformLocation(i, "map"),
k.opacity = b.getUniformLocation(i, "opacity"),
k.useScreenCoordinates = b.getUniformLocation(i, "useScreenCoordinates"),
k.sizeAttenuation = b.getUniformLocation(i, "sizeAttenuation"),
k.screenPosition = b.getUniformLocation(i, "screenPosition"),
k.modelViewMatrix = b.getUniformLocation(i, "modelViewMatrix"),
k.projectionMatrix = b.getUniformLocation(i, "projectionMatrix"),
k.fogType = b.getUniformLocation(i, "fogType"),
k.fogDensity = b.getUniformLocation(i, "fogDensity"),
k.fogNear = b.getUniformLocation(i, "fogNear"),
k.fogFar = b.getUniformLocation(i, "fogFar"),
k.fogColor = b.getUniformLocation(i, "fogColor"),
k.alphaTest = b.getUniformLocation(i, "alphaTest")
},
this.render = function(d, e, f, l) {
var m = d.__webglSprites,
n = m.length;
if (n) {
var o = j,
p = k,
q = l / f,
f = .5 * f,
r = .5 * l;
b.useProgram(i),
b.enableVertexAttribArray(o.position),
b.enableVertexAttribArray(o.uv),
b.disable(b.CULL_FACE),
b.enable(b.BLEND),
b.bindBuffer(b.ARRAY_BUFFER, g),
b.vertexAttribPointer(o.position, 2, b.FLOAT, !1, 16, 0),
b.vertexAttribPointer(o.uv, 2, b.FLOAT, !1, 16, 8),
b.bindBuffer(b.ELEMENT_ARRAY_BUFFER, h),
b.uniformMatrix4fv(p.projectionMatrix, !1, e.projectionMatrix.elements),
b.activeTexture(b.TEXTURE0),
b.uniform1i(p.map, 0);
var s = o = 0,
t = d.fog;
t ? (b.uniform3f(p.fogColor, t.color.r, t.color.g, t.color.b), t instanceof THREE.Fog ? (b.uniform1f(p.fogNear, t.near), b.uniform1f(p.fogFar, t.far), b.uniform1i(p.fogType, 1), s = o = 1) : t instanceof THREE.FogExp2 && (b.uniform1f(p.fogDensity, t.density), b.uniform1i(p.fogType, 2), s = o = 2)) : (b.uniform1i(p.fogType, 0), s = o = 0);
for (var u, v, w = [], t = 0; n > t; t++)
u = m[t],
v = u.material,
u.visible && 0 !== v.opacity && (v.useScreenCoordinates ? u.z = -u.position.z: (u._modelViewMatrix.multiplyMatrices(e.matrixWorldInverse, u.matrixWorld), u.z = -u._modelViewMatrix.elements[14]));
for (m.sort(a), t = 0; n > t; t++)
u = m[t],
v = u.material,
u.visible && 0 !== v.opacity && v.map && v.map.image && v.map.image.width && (b.uniform1f(p.alphaTest, v.alphaTest), !0 === v.useScreenCoordinates ? (b.uniform1i(p.useScreenCoordinates, 1), b.uniform3f(p.screenPosition, (u.position.x * c.devicePixelRatio - f) / f, (r - u.position.y * c.devicePixelRatio) / r, Math.max(0, Math.min(1, u.position.z))), w[0] = c.devicePixelRatio, w[1] = c.devicePixelRatio) : (b.uniform1i(p.useScreenCoordinates, 0), b.uniform1i(p.sizeAttenuation, v.sizeAttenuation ? 1: 0), b.uniformMatrix4fv(p.modelViewMatrix, !1, u._modelViewMatrix.elements), w[0] = 1, w[1] = 1), e = d.fog && v.fog ? s: 0, o !== e && (b.uniform1i(p.fogType, e), o = e), e = 1 / (v.scaleByViewport ? l: 1), w[0] *= e * q * u.scale.x, w[1] *= e * u.scale.y, b.uniform2f(p.uvScale, v.uvScale.x, v.uvScale.y), b.uniform2f(p.uvOffset, v.uvOffset.x, v.uvOffset.y), b.uniform2f(p.alignment, v.alignment.x, v.alignment.y), b.uniform1f(p.opacity, v.opacity), b.uniform3f(p.color, v.color.r, v.color.g, v.color.b), b.uniform1f(p.rotation, u.rotation), b.uniform2fv(p.scale, w), c.setBlending(v.blending, v.blendEquation, v.blendSrc, v.blendDst), c.setDepthTest(v.depthTest), c.setDepthWrite(v.depthWrite), c.setTexture(v.map, 0), b.drawElements(b.TRIANGLES, 6, b.UNSIGNED_SHORT, 0));
b.enable(b.CULL_FACE)
}
}
},
THREE.DepthPassPlugin = function() {
this.enabled = !1,
this.renderTarget = null;
var a,
b,
c,
d,
e,
f,
g = new THREE.Frustum,
h = new THREE.Matrix4;
this.init = function(g) {
a = g.context,
b = g;
var g = THREE.ShaderLib.depthRGBA,
h = THREE.UniformsUtils.clone(g.uniforms);
c = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h
}),
d = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h,
morphTargets: !0
}),
e = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h,
skinning: !0
}),
f = new THREE.ShaderMaterial({
fragmentShader: g.fragmentShader,
vertexShader: g.vertexShader,
uniforms: h,
morphTargets: !0,
skinning: !0
}),
c._shadowPass = !0,
d._shadowPass = !0,
e._shadowPass = !0,
f._shadowPass = !0
},
this.render = function(a, b) {
this.enabled && this.update(a, b)
},
this.update = function(i, j) {
var k,
l,
m,
n,
o,
p;
for (a.clearColor(1, 1, 1, 1), a.disable(a.BLEND), b.setDepthTest(!0), !0 === i.autoUpdate && i.updateMatrixWorld(), j.matrixWorldInverse.getInverse(j.matrixWorld), h.multiplyMatrices(j.projectionMatrix, j.matrixWorldInverse), g.setFromMatrix(h), b.setRenderTarget(this.renderTarget), b.clear(), p = i.__webglObjects, k = 0, l = p.length; l > k; k++)
m = p[k],
o = m.object,
m.render = !1,
!o.visible || (o instanceof THREE.Mesh || o instanceof THREE.ParticleSystem) && o.frustumCulled && !g.intersectsObject(o) || (o._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse, o.matrixWorld), m.render = !0);
var q;
for (k = 0, l = p.length; l > k; k++)
m = p[k],
!m.render || (o = m.object, m = m.buffer, o instanceof THREE.ParticleSystem && !o.customDepthMaterial) || ((q = o.material instanceof THREE.MeshFaceMaterial ? o.material.materials[0] : o.material) && b.setMaterialFaces(o.material), n = 0 < o.geometry.morphTargets.length && q.morphTargets, q = o instanceof THREE.SkinnedMesh && q.skinning, n = o.customDepthMaterial ? o.customDepthMaterial: q ? n ? f: e: n ? d: c, m instanceof THREE.BufferGeometry ? b.renderBufferDirect(j, i.__lights, null, n, m, o) : b.renderBuffer(j, i.__lights, null, n, m, o));
for (p = i.__webglObjectsImmediate, k = 0, l = p.length; l > k; k++)
m = p[k],
o = m.object,
o.visible && (o._modelViewMatrix.multiplyMatrices(j.matrixWorldInverse, o.matrixWorld), b.renderImmediateObject(j, i.__lights, null, c, o));
k = b.getClearColor(),
l = b.getClearAlpha(),
a.clearColor(k.r, k.g, k.b, l),
a.enable(a.BLEND)
}
},
THREE.ShaderFlares = {
lensFlareVertexTexture: {
vertexShader: "uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
fragmentShader: "uniform lowp int renderType;\nuniform sampler2D map;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"
},
lensFlare: {
vertexShader: "uniform lowp int renderType;\nuniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
fragmentShader: "precision mediump float;\nuniform lowp int renderType;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"
}
},
THREE.ShaderSprite = {
sprite: {
vertexShader: "uniform int useScreenCoordinates;\nuniform int sizeAttenuation;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( sizeAttenuation == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
fragmentShader: "uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n}\n}"
}
},
void 0 === Date.now && (Date.now = function() {
return (new Date).valueOf()
});
var TWEEN = TWEEN || function() {
var a = [];
return {
REVISION: "12",
getAll: function() {
return a
},
removeAll: function() {
a = []
},
add: function(b) {
a.push(b)
},
remove: function(b) {
var c = a.indexOf(b); - 1 !== c && a.splice(c, 1)
},
update: function(b) {
if (0 === a.length)
return ! 1;
var c = 0;
for (b = void 0 !== b ? b: "undefined" != typeof window && void 0 !== window.performance && void 0 !== window.performance.now ? window.performance.now() : Date.now(); c < a.length;)
a[c].update(b) ? c++:a.splice(c, 1);
return ! 0
}
}
} ();
TWEEN.Tween = function(a) {
var b = a,
c = {},
d = {},
e = {},
f = 1e3,
g = 0,
h = !1,
i = !1,
j = !1,
k = 0,
l = null,
m = TWEEN.Easing.Linear.None,
n = TWEEN.Interpolation.Linear,
o = [],
p = null,
q = !1,
r = null,
s = null;
for (var t in a)
c[t] = parseFloat(a[t], 10);
this.to = function(a, b) {
return void 0 !== b && (f = b),
d = a,
this
},
this.start = function(a) {
TWEEN.add(this),
i = !0,
q = !1,
l = void 0 !== a ? a: "undefined" != typeof window && void 0 !== window.performance && void 0 !== window.performance.now ? window.performance.now() : Date.now(),
l += k;
for (var f in d) {
if (d[f]
instanceof Array) {
if (0 === d[f].length)
continue;
d[f] = [b[f]].concat(d[f])
}
c[f] = b[f],
c[f]
instanceof Array == !1 && (c[f] *= 1),
e[f] = c[f] || 0
}
return this
},
this.stop = function() {
return i ? (TWEEN.remove(this), i = !1, this.stopChainedTweens(), this) : this
},
this.stopChainedTweens = function() {
for (var a = 0, b = o.length; b > a; a++)
o[a].stop()
},
this.delay = function(a) {
return k = a,
this
},
this.repeat = function(a) {
return g = a,
this
},
this.yoyo = function(a) {
return h = a,
this
},
this.easing = function(a) {
return m = a,
this
},
this.interpolation = function(a) {
return n = a,
this
},
this.chain = function() {
return o = arguments,
this
},
this.onStart = function(a) {
return p = a,
this
},
this.onUpdate = function(a) {
return r = a,
this
},
this.onComplete = function(a) {
return s = a,
this
},
this.update = function(a) {
var i;
if (l > a)
return ! 0;
q === !1 && (null !== p && p.call(b), q = !0);
var t = (a - l) / f;
t = t > 1 ? 1: t;
var u = m(t);
for (i in d) {
var v = c[i] || 0,
w = d[i];
w instanceof Array ? b[i] = n(w, u) : ("string" == typeof w && (w = v + parseFloat(w, 10)), "number" == typeof w && (b[i] = v + (w - v) * u))
}
if (null !== r && r.call(b, u), 1 == t) {
if (g > 0) {
isFinite(g) && g--;
for (i in e) {
if ("string" == typeof d[i] && (e[i] = e[i] + parseFloat(d[i], 10)), h) {
var x = e[i];
e[i] = d[i],
d[i] = x,
j = !j
}
c[i] = e[i]
}
return l = a + k,
!0
}
null !== s && s.call(b);
for (var y = 0, z = o.length; z > y; y++)
o[y].start(a);
return ! 1
}
return ! 0
}
},
TWEEN.Easing = {
Linear: {
None: function(a) {
return a
}
},
Quadratic: {
In: function(a) {
return a * a
},
Out: function(a) {
return a * (2 - a)
},
InOut: function(a) {
return (a *= 2) < 1 ? .5 * a * a: -.5 * (--a * (a - 2) - 1)
}
},
Cubic: {
In: function(a) {
return a * a * a
},
Out: function(a) {
return--a * a * a + 1
},
InOut: function(a) {
return (a *= 2) < 1 ? .5 * a * a * a: .5 * ((a -= 2) * a * a + 2)
}
},
Quartic: {
In: function(a) {
return a * a * a * a
},
Out: function(a) {
return 1 - --a * a * a * a
},
InOut: function(a) {
return (a *= 2) < 1 ? .5 * a * a * a * a: -.5 * ((a -= 2) * a * a * a - 2)
}
},
Quintic: {
In: function(a) {
return a * a * a * a * a
},
Out: function(a) {
return--a * a * a * a * a + 1
},
InOut: function(a) {
return (a *= 2) < 1 ? .5 * a * a * a * a * a: .5 * ((a -= 2) * a * a * a * a + 2)
}
},
Sinusoidal: {
In: function(a) {
return 1 - Math.cos(a * Math.PI / 2)
},
Out: function(a) {
return Math.sin(a * Math.PI / 2)
},
InOut: function(a) {
return.5 * (1 - Math.cos(Math.PI * a))
}
},
Exponential: {
In: function(a) {
return 0 === a ? 0: Math.pow(1024, a - 1)
},
Out: function(a) {
return 1 === a ? 1: 1 - Math.pow(2, -10 * a)
},
InOut: function(a) {
return 0 === a ? 0: 1 === a ? 1: (a *= 2) < 1 ? .5 * Math.pow(1024, a - 1) : .5 * ( - Math.pow(2, -10 * (a - 1)) + 2)
}
},
Circular: {
In: function(a) {
return 1 - Math.sqrt(1 - a * a)
},
Out: function(a) {
return Math.sqrt(1 - --a * a)
},
InOut: function(a) {
return (a *= 2) < 1 ? -.5 * (Math.sqrt(1 - a * a) - 1) : .5 * (Math.sqrt(1 - (a -= 2) * a) + 1)
}
},
Elastic: {
In: function(a) {
var b,
c = .1,
d = .4;
return 0 === a ? 0: 1 === a ? 1: (!c || 1 > c ? (c = 1, b = d / 4) : b = d * Math.asin(1 / c) / (2 * Math.PI), -(c * Math.pow(2, 10 * (a -= 1)) * Math.sin(2 * (a - b) * Math.PI / d)))
},
Out: function(a) {
var b,
c = .1,
d = .4;
return 0 === a ? 0: 1 === a ? 1: (!c || 1 > c ? (c = 1, b = d / 4) : b = d * Math.asin(1 / c) / (2 * Math.PI), c * Math.pow(2, -10 * a) * Math.sin(2 * (a - b) * Math.PI / d) + 1)
},
InOut: function(a) {
var b,
c = .1,
d = .4;
return 0 === a ? 0: 1 === a ? 1: (!c || 1 > c ? (c = 1, b = d / 4) : b = d * Math.asin(1 / c) / (2 * Math.PI), (a *= 2) < 1 ? -.5 * c * Math.pow(2, 10 * (a -= 1)) * Math.sin(2 * (a - b) * Math.PI / d) : c * Math.pow(2, -10 * (a -= 1)) * Math.sin(2 * (a - b) * Math.PI / d) * .5 + 1)
}
},
Back: {
In: function(a) {
var b = 1.70158;
return a * a * ((b + 1) * a - b)
},
Out: function(a) {
var b = 1.70158;
return--a * a * ((b + 1) * a + b) + 1
},
InOut: function(a) {
var b = 2.5949095;
return (a *= 2) < 1 ? .5 * a * a * ((b + 1) * a - b) : .5 * ((a -= 2) * a * ((b + 1) * a + b) + 2)
}
},
Bounce: {
In: function(a) {
return 1 - TWEEN.Easing.Bounce.Out(1 - a)
},
Out: function(a) {
return 1 / 2.75 > a ? 7.5625 * a * a: 2 / 2.75 > a ? 7.5625 * (a -= 1.5 / 2.75) * a + .75: 2.5 / 2.75 > a ? 7.5625 * (a -= 2.25 / 2.75) * a + .9375: 7.5625 * (a -= 2.625 / 2.75) * a + .984375
},
InOut: function(a) {
return.5 > a ? .5 * TWEEN.Easing.Bounce.In(2 * a) : .5 * TWEEN.Easing.Bounce.Out(2 * a - 1) + .5
}
}
},
TWEEN.Interpolation = {
Linear: function(a, b) {
var c = a.length - 1,
d = c * b,
e = Math.floor(d),
f = TWEEN.Interpolation.Utils.Linear;
return 0 > b ? f(a[0], a[1], d) : b > 1 ? f(a[c], a[c - 1], c - d) : f(a[e], a[e + 1 > c ? c: e + 1], d - e)
},
Bezier: function(a, b) {
var c,
d = 0,
e = a.length - 1,
f = Math.pow,
g = TWEEN.Interpolation.Utils.Bernstein;
for (c = 0; e >= c; c++)
d += f(1 - b, e - c) * f(b, c) * a[c] * g(e, c);
return d
},
CatmullRom: function(a, b) {
var c = a.length - 1,
d = c * b,
e = Math.floor(d),
f = TWEEN.Interpolation.Utils.CatmullRom;
return a[0] === a[c] ? (0 > b && (e = Math.floor(d = c * (1 + b))), f(a[(e - 1 + c) % c], a[e], a[(e + 1) % c], a[(e + 2) % c], d - e)) : 0 > b ? a[0] - (f(a[0], a[0], a[1], a[1], -d) - a[0]) : b > 1 ? a[c] - (f(a[c], a[c], a[c - 1], a[c - 1], d - c) - a[c]) : f(a[e ? e - 1: 0], a[e], a[e + 1 > c ? c: e + 1], a[e + 2 > c ? c: e + 2], d - e)
},
Utils: {
Linear: function(a, b, c) {
return (b - a) * c + a
},
Bernstein: function(a, b) {
var c = TWEEN.Interpolation.Utils.Factorial;
return c(a) / c(b) / c(a - b)
},
Factorial: function() {
var a = [1];
return function(b) {
var c,
d = 1;
if (a[b])
return a[b];
for (c = b; c > 1; c--)
d *= c;
return a[b] = d
}
} (),
CatmullRom: function(a, b, c, d, e) {
var f = .5 * (c - a),
g = .5 * (d - b),
h = e * e,
i = e * h;
return (2 * b - 2 * c + f + g) * i + ( - 3 * b + 3 * c - 2 * f - g) * h + f * e + b
}
}
},
THREE.EffectComposer = function(a, b) {
if (this.renderer = a, void 0 === b) {
var c = window.innerWidth || 1,
d = window.innerHeight || 1,
e = {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBFormat,
stencilBuffer: !1
};
b = new THREE.WebGLRenderTarget(c, d, e)
}
this.renderTarget1 = b,
this.renderTarget2 = b.clone(),
this.writeBuffer = this.renderTarget1,
this.readBuffer = this.renderTarget2,
this.passes = [],
void 0 === THREE.CopyShader && console.error("THREE.EffectComposer relies on THREE.CopyShader"),
this.copyPass = new THREE.ShaderPass(THREE.CopyShader)
},
THREE.EffectComposer.prototype = {
swapBuffers: function() {
var a = this.readBuffer;
this.readBuffer = this.writeBuffer,
this.writeBuffer = a
},
addPass: function(a) {
this.passes.push(a)
},
insertPass: function(a, b) {
this.passes.splice(b, 0, a)
},
render: function(a) {
this.writeBuffer = this.renderTarget1,
this.readBuffer = this.renderTarget2;
var b,
c,
d = !1,
e = this.passes.length;
for (c = 0; e > c; c++)
if (b = this.passes[c], b.enabled) {
if (b.render(this.renderer, this.writeBuffer, this.readBuffer, a, d), b.needsSwap) {
if (d) {
var f = this.renderer.context;
f.stencilFunc(f.NOTEQUAL, 1, 4294967295),
this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, a),
f.stencilFunc(f.EQUAL, 1, 4294967295)
}
this.swapBuffers()
}
b instanceof THREE.MaskPass ? d = !0: b instanceof THREE.ClearMaskPass && (d = !1)
}
},
reset: function(a) {
void 0 === a && (a = this.renderTarget1.clone(), a.width = window.innerWidth, a.height = window.innerHeight),
this.renderTarget1 = a,
this.renderTarget2 = a.clone(),
this.writeBuffer = this.renderTarget1,
this.readBuffer = this.renderTarget2
},
setSize: function(a, b) {
var c = this.renderTarget1.clone();
c.width = a,
c.height = b,
this.reset(c)
}
},
THREE.RenderPass = function(a, b, c, d, e) {
this.scene = a,
this.camera = b,
this.overrideMaterial = c,
this.clearColor = d,
this.clearAlpha = void 0 !== e ? e: 1,
this.oldClearColor = new THREE.Color,
this.oldClearAlpha = 1,
this.enabled = !0,
this.clear = !0,
this.needsSwap = !1
},
THREE.RenderPass.prototype = {
render: function(a, b, c) {
this.scene.overrideMaterial = this.overrideMaterial,
this.clearColor && (this.oldClearColor.copy(a.getClearColor()), this.oldClearAlpha = a.getClearAlpha(), a.setClearColor(this.clearColor, this.clearAlpha)),
a.render(this.scene, this.camera, c, this.clear),
this.clearColor && a.setClearColor(this.oldClearColor, this.oldClearAlpha),
this.scene.overrideMaterial = null
}
},
THREE.ShaderPass = function(a, b) {
this.textureID = void 0 !== b ? b: "tDiffuse",
this.uniforms = THREE.UniformsUtils.clone(a.uniforms),
this.material = new THREE.ShaderMaterial({
uniforms: this.uniforms,
vertexShader: a.vertexShader,
fragmentShader: a.fragmentShader
}),
this.renderToScreen = !1,
this.enabled = !0,
this.needsSwap = !0,
this.clear = !1,
this.camera = new THREE.OrthographicCamera( - 1, 1, 1, -1, 0, 1),
this.scene = new THREE.Scene,
this.quad = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), null),
this.scene.add(this.quad)
},
THREE.ShaderPass.prototype = {
render: function(a, b, c) {
this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = c),
this.quad.material = this.material,
this.renderToScreen ? a.render(this.scene, this.camera) : a.render(this.scene, this.camera, b, this.clear)
}
},
THREE.ShaderPass2 = function(a, b) {
this.textureID = void 0 !== b ? b: "tDiffuse",
this.uniforms = THREE.UniformsUtils.clone(a.uniforms),
this.material = new THREE.ShaderMaterial({
uniforms: this.uniforms,
vertexShader: a.vertexShader,
fragmentShader: a.fragmentShader
}),
this.renderToScreen = !1,
this.enabled = !0,
this.needsSwap = !0,
this.clear = !1,
this.camera = new THREE.OrthographicCamera( - 1, 1, 1, -1, 0, 1),
this.scene = new THREE.Scene,
this.quad = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), null),
this.scene.add(this.quad)
},
THREE.ShaderPass2.prototype = {
render: function(a, b) {
this.quad.material = this.material,
this.renderToScreen ? a.render(this.scene, this.camera) : a.render(this.scene, this.camera, b, this.clear)
}
},
THREE.FilmPass = function(a, b, c, d) {
void 0 === THREE.FilmShader && console.error("THREE.FilmPass relies on THREE.FilmShader");
var e = THREE.FilmShader;
this.uniforms = THREE.UniformsUtils.clone(e.uniforms),
this.material = new THREE.ShaderMaterial({
uniforms: this.uniforms,
vertexShader: e.vertexShader,
fragmentShader: e.fragmentShader
}),
void 0 !== d && (this.uniforms.grayscale.value = d),
void 0 !== a && (this.uniforms.nIntensity.value = a),
void 0 !== b && (this.uniforms.sIntensity.value = b),
void 0 !== c && (this.uniforms.sCount.value = c),
this.enabled = !0,
this.renderToScreen = !1,
this.needsSwap = !0
},
THREE.FilmPass.prototype = {
render: function(a, b, c, d) {
this.uniforms.tDiffuse.value = c,
this.uniforms.time.value += d,
THREE.EffectComposer.quad.material = this.material,
this.renderToScreen ? a.render(THREE.EffectComposer.scene, THREE.EffectComposer.camera) : a.render(THREE.EffectComposer.scene, THREE.EffectComposer.camera, b, !1)
}
},
THREE.MaskPass = function(a, b) {
this.scene = a,
this.camera = b,
this.enabled = !0,
this.clear = !0,
this.needsSwap = !1,
this.inverse = !1
},
THREE.MaskPass.prototype = {
render: function(a, b, c) {
var d = a.context;
d.colorMask(!1, !1, !1, !1),
d.depthMask(!1);
var e,
f;
this.inverse ? (e = 0, f = 1) : (e = 1, f = 0),
d.enable(d.STENCIL_TEST),
d.stencilOp(d.REPLACE, d.REPLACE, d.REPLACE),
d.stencilFunc(d.ALWAYS, e, 4294967295),
d.clearStencil(f),
a.render(this.scene, this.camera, c, this.clear),
a.render(this.scene, this.camera, b, this.clear),
d.colorMask(!0, !0, !0, !0),
d.depthMask(!0),
d.stencilFunc(d.EQUAL, 1, 4294967295),
d.stencilOp(d.KEEP, d.KEEP, d.KEEP)
}
},
THREE.ClearMaskPass = function() {
this.enabled = !0
},
THREE.ClearMaskPass.prototype = {
render: function(a) {
var b = a.context;
b.disable(b.STENCIL_TEST)
}
},
THREE.CopyShader = {
uniforms: {
tDiffuse: {
type: "t",
value: null
},
opacity: {
type: "f",
value: 1
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}"].join("\n")
},
THREE.FilmShader = {
uniforms: {
tDiffuse: {
type: "t",
value: null
},
time: {
type: "f",
value: 0
},
nIntensity: {
type: "f",
value: .5
},
sIntensity: {
type: "f",
value: .05
},
sCount: {
type: "f",
value: 4096
},
grayscale: {
type: "i",
value: 1
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform float time;", "uniform bool grayscale;", "uniform float nIntensity;", "uniform float sIntensity;", "uniform float sCount;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 cTextureScreen = texture2D( tDiffuse, vUv );", "float x = vUv.x * vUv.y * time * 1000.0;", "x = mod( x, 13.0 ) * mod( x, 123.0 );", "float dx = mod( x, 0.01 );", "vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );", "vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );", "cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;", "cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );", "if( grayscale ) {", "cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );", "}", "gl_FragColor = vec4( cResult, cTextureScreen.a );", "}"].join("\n")
},
THREE.RGBShiftShader = {
uniforms: {
tDiffuse: {
type: "t",
value: null
},
amount: {
type: "f",
value: .005
},
angle: {
type: "f",
value: 0
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform sampler2D tDiffuse;", "uniform float amount;", "uniform float angle;", "varying vec2 vUv;", "void main() {", "vec2 offset = amount * vec2( cos(angle), sin(angle));", "vec4 cr = texture2D(tDiffuse, vUv + offset);", "vec4 cga = texture2D(tDiffuse, vUv);", "vec4 cb = texture2D(tDiffuse, vUv - offset);", "gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);", "}"].join("\n")
},
THREE.BadTVShader = {
uniforms: {
tDiffuse: {
type: "t",
value: null
},
time: {
type: "f",
value: 0
},
distortion: {
type: "f",
value: 3
},
distortion2: {
type: "f",
value: 5
},
speed: {
type: "f",
value: .2
},
rollSpeed: {
type: "f",
value: .1
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform sampler2D tDiffuse;", "uniform float time;", "uniform float distortion;", "uniform float distortion2;", "uniform float speed;", "uniform float rollSpeed;", "varying vec2 vUv;", "vec3 mod289(vec3 x) {", " return x - floor(x * (1.0 / 289.0)) * 289.0;", "}", "vec2 mod289(vec2 x) {", " return x - floor(x * (1.0 / 289.0)) * 289.0;", "}", "vec3 permute(vec3 x) {", " return mod289(((x*34.0)+1.0)*x);", "}", "float snoise(vec2 v)", " {", " const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0", " 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)", " -0.577350269189626, // -1.0 + 2.0 * C.x", " 0.024390243902439); // 1.0 / 41.0", " vec2 i = floor(v + dot(v, C.yy) );", " vec2 x0 = v - i + dot(i, C.xx);", " vec2 i1;", " i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);", " vec4 x12 = x0.xyxy + C.xxzz;", " x12.xy -= i1;", " i = mod289(i); // Avoid truncation effects in permutation", " vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))", " + i.x + vec3(0.0, i1.x, 1.0 ));", " vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);", " m = m*m ;", " m = m*m ;", " vec3 x = 2.0 * fract(p * C.www) - 1.0;", " vec3 h = abs(x) - 0.5;", " vec3 ox = floor(x + 0.5);", " vec3 a0 = x - ox;", " m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );", " vec3 g;", " g.x = a0.x * x0.x + h.x * x0.y;", " g.yz = a0.yz * x12.xz + h.yz * x12.yw;", " return 130.0 * dot(m, g);", "}", "void main() {", "vec2 p = vUv;", "float ty = time*speed;", "float yt = p.y - ty;", "float offset = snoise(vec2(yt*3.0,0.0))*0.2;", "offset = pow( offset*distortion,3.0)/distortion;", "offset += snoise(vec2(yt*50.0,0.0))*distortion2*0.001;", "gl_FragColor = texture2D(tDiffuse, vec2(fract(p.x + offset),fract(p.y-time*rollSpeed) ));", "}"].join("\n")
},
THREE.StaticShader = {
uniforms: {
tDiffuse: {
type: "t",
value: null
},
time: {
type: "f",
value: 0
},
amount: {
type: "f",
value: .5
},
size: {
type: "f",
value: 4
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform sampler2D tDiffuse;", "uniform float time;", "uniform float amount;", "uniform float size;", "varying vec2 vUv;", "float rand(vec2 co){", "return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);", "}", "void main() {", "vec2 p = vUv;", "vec4 color = texture2D(tDiffuse, p);", "float xs = floor(gl_FragCoord.x / size);", "float ys = floor(gl_FragCoord.y / size);", "vec4 snow = vec4(rand(vec2(xs * time,ys * time))*amount);", "gl_FragColor = color+ snow;", "}"].join("\n")
},
THREE.CorruptionShader = {
uniforms: {
iResolution: {
type: "v3",
value: null
},
time: {
type: "f",
value: 0
},
speed: {
type: "f",
value: 1
},
tDiffuse: {
type: "t",
value: null
},
iChannel1: {
type: "t",
value: null
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform vec3 iResolution;", "uniform float time;", "uniform float speed;", "uniform sampler2D tDiffuse;", "uniform sampler2D iChannel1;", "varying vec2 vUv;", "void main()", "{", "vec2 uv = gl_FragCoord.xy / iResolution.xy;", "vec2 block = floor(gl_FragCoord.xy / vec2(16));", "vec2 uv_noise = block / vec2(64);", "float timeStep = time*speed;", "uv_noise += floor(vec2(timeStep) * vec2(1234.0, 3543.0)) / vec2(64);", "float block_thresh = pow(fract(timeStep * 1236.0453), 2.0) * 0.2;", "float line_thresh = pow(fract(timeStep * 2236.0453), 3.0) * 0.7;", "vec2 uv_r = uv, uv_g = uv, uv_b = uv;", "if (texture2D(iChannel1, uv_noise).r < block_thresh ||", "texture2D(iChannel1, vec2(uv_noise.y, 0.0)).g < line_thresh) {", "vec2 dist = (fract(uv_noise) - 0.5) * 0.3;", "uv_r += dist * 0.1;", "uv_g += dist * 0.2;", "uv_b += dist * 0.125;", "}", "gl_FragColor.r = texture2D(tDiffuse, uv_r).r;", "gl_FragColor.g = texture2D(tDiffuse, uv_g).g;", "gl_FragColor.b = texture2D(tDiffuse, uv_b).b;", "if (texture2D(iChannel1, uv_noise).g < block_thresh)", "gl_FragColor.rgb = gl_FragColor.ggg;", "if (texture2D(iChannel1, vec2(uv_noise.y, 0.0)).b * 3.5 < line_thresh)", "gl_FragColor.rgb = vec3(0.0, dot(gl_FragColor.rgb, vec3(1.0)), 0.0);", "if (texture2D(iChannel1, uv_noise).g * 1.5 < block_thresh ||", "texture2D(iChannel1, vec2(uv_noise.y, 0.0)).g * 2.5 < line_thresh) {", "float line = fract(gl_FragCoord.y / 3.0);", "vec3 mask = vec3(3.0, 0.0, 0.0);", "if (line > 0.333)", "mask = vec3(0.0, 3.0, 0.0);", "if (line > 0.666)", "mask = vec3(0.0, 0.0, 3.0);", "gl_FragColor.xyz *= mask;", "}", "}"].join("\n")
},
THREE.BlendShader = {
uniforms: {
tDiffuse: {
type: "t",
value: 0,
texture: null
},
tTop: {
type: "t",
value: 1,
texture: null
},
opacity: {
type: "f",
value: 1
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "uniform sampler2D tTop;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "vec4 top = texture2D( tTop, vUv );", "gl_FragColor = (texel + top)*opacity;", "}"].join("\n")
},
THREE.TransStaticShader = {
uniforms: {
tDiffuse: {
type: "t",
value: null
},
time: {
type: "f",
value: 0
},
amount: {
type: "f",
value: .5
},
size: {
type: "f",
value: 4
}
},
vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["uniform sampler2D tDiffuse;", "uniform float time;", "uniform float amount;", "uniform float size;", "varying vec2 vUv;", "float rand(vec2 co){", "return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);", "}", "void main() {", "vec2 p = vUv;", "vec4 color = texture2D(tDiffuse, p);", "float xs = floor(gl_FragCoord.x / size);", "float ys = floor(gl_FragCoord.y / size);", "vec4 snow = vec4(rand(vec2(xs * time,ys * time))*amount);", "if (color.a <= 0.0) {", "gl_FragColor = color;", "} else {", "gl_FragColor = color- snow;", "}", "}"].join("\n")
};
var EventBusClass = {};
EventBusClass = function() {
this.listeners = {}
},
EventBusClass.prototype = {
addEventListener: function(a, b, c) {
for (var d = [], e = arguments.length, f = 0; e > f; f++)
d.push(arguments[f]);
d = d.length > 3 ? d.splice(3, d.length - 1) : [],
"undefined" != typeof this.listeners[a] ? this.listeners[a].push({
scope: c,
callback: b,
args: d
}) : this.listeners[a] = [{
scope: c,
callback: b,
args: d
}]
},
removeEventListener: function(a, b, c) {
if ("undefined" != typeof this.listeners[a]) {
for (var d = this.listeners[a].length, e = [], f = 0; d > f; f++) {
var g = this.listeners[a][f];
g.scope == c && g.callback == b || e.push(g)
}
this.listeners[a] = e
}
},
hasEventListener: function(a, b, c) {
if ("undefined" != typeof this.listeners[a]) {
var d = this.listeners[a].length;
if (void 0 === b && void 0 === c)
return d > 0;
for (var e = 0; d > e; e++) {
var f = this.listeners[a][e];
if ((c ? f.scope == c: !0) && f.callback == b)
return ! 0
}
}
return ! 1
},
dispatch: function(a, b) {
for (var c = 0, d = {
type: a,
target: b
}, e = [], f = arguments.length, g = 0; f > g; g++)
e.push(arguments[g]);
if (e = e.length > 2 ? e.splice(2, e.length - 1) : [], e = [d].concat(e), "undefined" != typeof this.listeners[a])
for (var h = this.listeners[a].length, g = 0; h > g; g++) {
var i = this.listeners[a][g];
if (i && i.callback) {
var j = e.concat(i.args);
i.callback.apply(i.scope, j),
c += 1
}
}
},
getEvents: function() {
var a = "";
for (var b in this.listeners)
for (var c = this.listeners[b].length, d = 0; c > d; d++) {
var e = this.listeners[b][d];
a += e.scope && e.scope.className ? e.scope.className: "anonymous",
a += " listen for '" + b + "'\n"
}
return a
}
};
var EventBus = new EventBusClass,
VideoStream = function() {
this.init()
};
VideoStream.prototype = {
assetState: {
video: !1
},
assetReady: function(a) {
this.assetState[a] = !0,
console.log("Asset " + a + " ready");
var b = !0;
for (var c in this.assetState)
if (this.assetState.hasOwnProperty(c)) {
if (!this.assetState[c]) {
console.log(" asset " + c + " not ready"),
b = !1;
break
}
} else
console.log(" skipping key " + c);
b && (console.log("all assets loaded"), this.allAssetsReady())
},
allAssetsReady: function() {
EventBus.dispatch("video-ready", this)
},
start: function() {
function a() {
var c = new TWEEN.Tween(b.scenes.global.variables.film).to({
nIntensity: 100 * Math.random(),
sIntensity: .8 * Math.random()
}, 5e3 * Math.random() + 500).yoyo(!0).repeat(1).delay(1e3 + 5e3 * Math.random()).easing(TWEEN.Easing.Quartic.InOut),
d = new TWEEN.Tween(b.scenes.global.variables.badtv).to({
distortion: 2 * Math.random()
}, 3e3 * Math.random()).yoyo(!0).repeat(1).delay(500 + 5e3 * Math.random()).easing(TWEEN.Easing.Elastic.Out),
e = new TWEEN.Tween(b.scenes.global.variables.rgbshift).to({
amount: .005
}, 500 + 3e3 * Math.random()).delay(3e3 * Math.random()).easing(TWEEN.Easing.Bounce.InOut).chain(new TWEEN.Tween(b.scenes.global.variables.rgbshift).to({
amount: 0
}, 4e3 * Math.random()).easing(TWEEN.Easing.Bounce.InOut));
e.start(),
c.start(),
d.start(),
setTimeout(a, 15e3 + 1e4 * Math.random())
}
console.log("starting video stream"),
this.lastFrame = Date.now(),
this.tweenHead.start(),
this.video.play(),
this.animate();
var b = this;
setTimeout(function() {
document.getElementById("formContainer").className = "fadeIn",
a()
}, 8e3)
},
initTimeline: function() {
this.tweenHead = new TWEEN.Tween(this.scenes.global.variables.copy).to({
opacity: 0
}, 10);
var a = new TWEEN.Tween(this.scenes.global.variables.copy).to({
opacity: 1
}, 4e3).yoyo(!1).easing(TWEEN.Easing.Quadratic.In),
b = new TWEEN.Tween(this.scenes.global.variables.rgbshift).to({
amount: .01
}, 3e3).yoyo(!0).repeat(1).easing(TWEEN.Easing.Bounce.InOut).chain(new TWEEN.Tween(this.scenes.global.variables.rgbshift).to({
amount: 0
}, 4e3).easing(TWEEN.Easing.Bounce.InOut)),
c = new TWEEN.Tween(this.scenes.global.variables.badtv).to({
rollSpeed: 0
}, 8e3).yoyo(!1).easing(TWEEN.Easing.Elastic.Out),
d = new TWEEN.Tween(this.scenes.global.variables.film).to({
nIntensity: .5,
sIntensity: .1
}, 6e3).yoyo(!1).easing(TWEEN.Easing.Quartic.In),
e = new TWEEN.Tween(this.scenes.logo.variables.copy).to({
opacity: .5
}, 4e3).delay(3e3).yoyo(!1).easing(TWEEN.Easing.Quadratic.In),
f = new TWEEN.Tween(this.scenes.logo.variables.badtv).to({
distortion: .1
}, 3e3).delay(1e3).yoyo(!1).easing(TWEEN.Easing.Quadratic.In);
this.tweenHead.chain(a, d, b, c, e, f)
},
init: function() {
this.scenes = {},
this.shaderTime = 0,
EventBus.addEventListener("video-start", this.start, this),
this.video = document.createElement("video"),
this.video.defaultPlaybackRate = .6,
this.video.loop = !0,
this.video.src = "http://hackaday.com/wp-content/themes/vip/hackaday2/space/earth.mp4",
this.video.load();
var a = this;
this.video.addEventListener("canplaythrough", function() {
a.assetReady("video")
}),
this.initCamera(),
this.initRenderer(),
this.initVideoScene(),
this.initLogoScene(),
this.initComposition(),
this.initTimeline(),
window.addEventListener("resize", this.onResize.bind(this), !1),
this.onResize()
},
initCamera: function() {
this.camera = new THREE.OrthographicCamera(window.innerWidth / -2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / -2, 20, 3e3),
this.camera.position.z = 1e3,
this.scene = new THREE.Scene
},
initVideoScene: function() {
var a = new THREE.Scene,
b = new THREE.Texture(this.video);
b.minFilter = THREE.LinearFilter,
b.magFilter = THREE.LinearFilter,
b.generateMipmaps = !1;
var c = new THREE.MeshBasicMaterial({
map: b,
overdraw: !0,
side: THREE.DoubleSide
}),
d = new THREE.PlaneGeometry(1920, 1080, 1, 1),
e = new THREE.Mesh(d, c);
e.z = 0,
e.scale.x = e.scale.y = 1,
a.add(e);
var f = new THREE.RenderPass(a, this.camera),
g = new THREE.ShaderPass(THREE.StaticShader),
h = new THREE.ShaderPass(THREE.CopyShader),
i = new THREE.EffectComposer(this.renderer);
g.uniforms.amount.value = 0,
g.uniforms.size.value = 1,
i.addPass(f),
i.addPass(g),
i.addPass(h),
this.scenes.video = {
scene: a,
texture: b,
material: c,
geometry: d,
mesh: e,
shaders: {
render: f,
"static": g
},
composer: i
}
},
initTestPatternScene: function() {
var a = new THREE.Scene,
b = THREE.ImageUtils.loadTexture(assetPath + "testPattern.png");
b.generateMipmaps = !1;
var c = new THREE.MeshBasicMaterial({
map: b,
color: new THREE.Color(4294967295),
transparent: !0
}),
d = new THREE.PlaneGeometry(1280, 720, 1, 1),
e = new THREE.Mesh(d, c);
a.add(e);
var f = new THREE.RenderPass(a, this.camera),
g = new THREE.ShaderPass(THREE.StaticShader),
h = new THREE.ShaderPass(THREE.CopyShader),
i = new THREE.EffectComposer(this.renderer);
g.uniforms.amount.value = 1,
g.uniforms.size.value = 1,
i.addPass(f),
i.addPass(g),
i.addPass(h),
this.scenes.testpattern = {
scene: a,
texture: b,
material: c,
mesh: e,
shaders: {
render: f,
"static": g
},
variables: {
"static": {
amount: 1,
size: 1
}
},
composer: i
}
},
initLogoScene: function() {
var a = new THREE.Scene,
b = THREE.ImageUtils.loadTexture("http://hackaday.com/wp-content/themes/vip/hackaday2/space//logo.png"),
c = new THREE.MeshBasicMaterial({
map: b,
color: new THREE.Color(4294967295),
transparent: !0
}),
d = new THREE.PlaneGeometry(256, 256, 1, 1),
e = new THREE.Mesh(d, c);
e.position.y = 150,
a.add(e);
var f = window.innerWidth || 1,
g = window.innerHeight || 1,
h = {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBAFormat,
stencilBuffer: !1
},
i = new THREE.WebGLRenderTarget(f, g, h),
j = new THREE.RenderPass(a, this.camera),
k = (new THREE.ShaderPass(THREE.TransStaticShader), new THREE.ShaderPass(THREE.BadTVShader)),
l = new THREE.ShaderPass(THREE.CopyShader),
m = new THREE.EffectComposer(this.renderer, i);
m.addPass(j),
m.addPass(k),
m.addPass(l),
this.scenes.logo = {
scene: a,
texture: b,
material: c,
mesh: e,
shaders: {
render: j,
badtv: k,
copy: l
},
variables: {
badtv: {
distortion: 3,
distortion2: .5,
speed: .5,
rollSpeed: 0
},
copy: {
opacity: 0
}
},
composer: m
}
},
initComposition: function() {
var a = new THREE.ShaderPass2(THREE.BlendShader);
a.uniforms.tDiffuse.value = this.scenes.video.composer.renderTarget2,
a.uniforms.tTop.value = this.scenes.logo.composer.renderTarget2,
this.blendPass = a;
var b = new THREE.EffectComposer(this.renderer),
c = new THREE.ShaderPass(THREE.CopyShader),
d = new THREE.ShaderPass(THREE.BadTVShader),
e = new THREE.ShaderPass(THREE.RGBShiftShader),
f = new THREE.ShaderPass(THREE.FilmShader);
b.addPass(a),
b.addPass(d),
b.addPass(e),
b.addPass(f),
b.addPass(c),
c.renderToScreen = !0,
this.scenes.global = {
scene: this.scene,
shaders: {
blend: a,
badtv: d,
rgbshift: e,
film: f,
copy: c
},
variables: {
badtv: {
distortion: .5,
distortion2: .3,
speed: .1,
rollSpeed: .15
},
rgbshift: {
amount: .005,
angle: 0
},
film: {
nIntensity: 100,
sIntensity: 10,
sCount: 4096,
grayscale: 0
},
blend: {
opacity: 1
},
copy: {
opacity: 0
}
}
},
this.composer = b
},
initRenderer: function() {
this.renderer = new THREE.WebGLRenderer,
this.renderer.setSize(800, 600),
document.getElementById("videoContainer").appendChild(this.renderer.domElement)
},
onResize: function() {
this.renderer.setSize(window.innerWidth, window.innerHeight),
this.composer.setSize(window.innerWidth, window.innerHeight),
this.camera.left = window.innerWidth / -2,
this.camera.right = window.innerWidth / 2,
this.camera.top = window.innerHeight / 2,
this.camera.bottom = window.innerHeight / -2,
this.camera.aspect = window.innerWidth / window.innerHeight,
this.camera.updateProjectionMatrix()
},
animate: function() {
var a = (Date.now() - this.lastFrame) / 1e3;
this.shaderTime += .1,
this.shaderTime %= 1,
TWEEN.update(),
this.video.readyState === this.video.HAVE_ENOUGH_DATA && this.scenes.video.texture && (this.scenes.video.texture.needsUpdate = !0),
requestAnimationFrame(this.animate.bind(this)),
this.lastFrame = Date.now();
for (var b in this.scenes) {
var c,
d,
e = this.scenes[b];
for (c in e.shaders)
d = e.shaders[c],
d.uniforms && d.uniforms.time && (d.uniforms.time.value = this.shaderTime);
for (c in e.variables) {
var f = e.variables[c];
d = e.shaders[c];
for (var g in f)
d.uniforms && d.uniforms[g] && (d.uniforms[g].value = f[g])
}
e.composer && e.composer.render(a)
}
this.composer.render(a)
}
};
var video,
Terminal = function() {
this.output = document.getElementById("terminal"),
this.startTimeout()
};
Terminal.prototype = {
maxDelay: 500,
ready: !1,
dotCount: 0,
text: ["Connection established.", "", "Confirming input sources...", "Confirming 18.344167 -66.752778... Done.", "Confirming 34.078749 -107.618283... Done.", "Confirming 43.826167 41.586683... Done.", "Confirming 50.524722 6.882778... Done.", "Confirming 52.908889 6.868889... Done.", "Success! All inputs confirmed.", "", "Acquiring test data... Done.", "", "Validating test block 1...", "49 27 6d 20 66 6c 6f 61 74 69 6e 67 20 69 6e 20 61", "20 6d 6f 73 74 20 70 65 63 75 6c 69 61 72 20 77 61", "79", "Data for test block 1 is valid.", "", "Validating test block 2.", "0 0 0 0 0 0 0 1 1 0 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0", "0 1 1 1 1 1 0 1 1 1 0 1 1 0 0 1 0 1 0 1 1 1 1 1 0", "0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 1 1 0 1 0 0 0 1 0", "0 1 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 1 0", "0 1 0 0 0 1 0 1 0 1 1 0 0 0 1 1 0 1 0 1 0 0 0 1 0", "0 1 1 1 1 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0", "0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0", "1 1 1 1 1 1 1 1 1 0 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1", "0 0 1 1 1 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 0 0 1 1 1", "0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1", "0 0 1 0 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 0 1 0 1 0 0", "1 1 1 1 0 0 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 0", "1 1 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0", "0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 0 1 1 1 0 1", "0 1 1 0 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 0 0", "0 1 0 1 0 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 1 0", "0 1 1 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1", "1 1 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 1", "0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 0 1 1 0", "0 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 0 1 1 1 0 1 1 1 1", "0 1 0 0 0 1 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1", "0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 0 0 0 1 1 0 1 0 0", "0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 0", "0 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 1 1 0", "0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 0", "Data for test block 2 is valid.", "", "Configuring reception parameters... Done."],
loaded: function() {
this.maxDelay = -100,
this.ready = !0
},
startTimeout: function() {
this.currentLine = 0;
EventBus.addEventListener("video-ready", this.loaded, this),
setTimeout(this.onTimeout.bind(this), 300)
},
onTimeout: function() {
this.currentLine < this.text.length ? (this.write(this.text[this.currentLine]), this.currentLine++) : this.currentLine === this.text.length && (this.output.value += "Precaching stream.", this.dotCount = 18),
this.currentLine < this.text.length ? setTimeout(this.onTimeout.bind(this), 100 + Math.round(Math.random() * this.maxDelay)) : this.ready ? this.confirm() : (this.dotCount++, this.output.value += ".", this.dotCount >= 41 && (this.output.value += "\n", this.dotCount = 0), setTimeout(this.onTimeout.bind(this), 300))
},
write: function(a) {
this.output.value += "\n" + a,
this.output.scrollTop = this.output.scrollHeight
},
confirm: function() {
this.output.removeAttribute("readonly"),
this.write("\nBegin receiving data? [Y/n] > "),
this.setCaretPosition(this.output, 9999),
this.output.scrollTop = this.output.scrollHeight;
var a = this;
this.output.addEventListener("click", function() {
a.setCaretPosition(a.output, 9999),
a.output.scrollTop = a.output.scrollHeight
});
var b = function(c) {
var d = String.fromCharCode(c.keyCode);
"Y" === d || "y" === d || 13 === c.keyCode ? a.startFeed() : "N" === d || "n" === d ? (a.write("Closing connection."), a.write("-------------------"), a.write("\n\n\nHave a nice day."), a.output.removeEventListener(b), a.output.setAttribute("readonly", "readonly")) : (a.write("Invalid response"), a.write("Begin receiving data? [Y/n] > ")),
c.preventDefault()
};
this.output.addEventListener("keyup", b)
},
setCaretPosition: function(a, b) {
var c;
a.createTextRange ? (c = a.createTextRange(), c.move("character", b), c.select()) : (a.focus(), void 0 !== a.selectionStart && a.setSelectionRange(b, b))
},
startFeed: function() {
this.output.style.display = "none",
EventBus.dispatch("video-start")
}
};
var deadline = Date.UTC(2014, 3, 28, 9, 0, 0, 0);
if (setInterval(updateCountdown, 1e3), document.getElementById("email-form").addEventListener("submit", function() {
var a = document.getElementById("email"),
b = a.value,
c = "https://docs.google.com/forms/d/12x_8dsyc13fJBwzVujoBQ0clGtS1nvF8Ill3ne9A570/formResponse?entry.1512545551=",
d = "&submit=submit",
e = c + b + d;
this.action = e,
a.className = "active",
a.value = "Stay tuned...",
a.disabled = "disabled"
}, !1), window.isCapable)
var term = new Terminal,
stream = new VideoStream;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment