2022跨年烟花代码(二)HTML5点击泡沫横飞烟花特效
HTML5点击泡沫横飞烟花特效
html代码:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HTML5 Canvas点击泡沫横飞特效</title>
<style>
body {
background: #3E4777;
overflow: hidden;
margin: 0;
}
.instructions {
position: absolute;
top: 20px;
right: 20px;
letter-spacing: 0.2em;
font-size: 18px;
color: white;
}
</style>
</head>
<body>
<script type="text/javascript" src="js/three.min.js"></script>
<script type="text/javascript" src="js/Stats.min.js"></script>
<canvas ></canvas>
<div ></div>
<div class="instructions">点击页面</div>
<script type="text/javascript">
(function() {
var Particles,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Particles = (function() {
function Particles() {
this.render = bind(this.render, this);
this.rotateRadians = bind(this.rotateRadians, this);
this.random = bind(this.random, this);
this.mouseMove = bind(this.mouseMove, this);
this.mouseDown = bind(this.mouseDown, this);
this.resize = bind(this.resize, this);
this.animate = bind(this.animate, this);
this.setStage = bind(this.setStage, this);
this.setLighting = bind(this.setLighting, this);
this.getTexture = bind(this.getTexture, this);
this.addStars = bind(this.addStars, this);
this.setActors = bind(this.setActors, this);
this.getPastelColor = bind(this.getPastelColor, this);
this.canvasMouse = {
x: 0,
y: 0,
z: 0,
px: 0,
py: 0,
py: 0,
vx: 0,
vy: 0,
pressed: false
};
this.colors = ['#da6b00', '#8555d4', '#4ad3b5', '#ffffff'];
this.particleCount = 500;
this.initialRadius = 0.1;
this.movementSpeed = 2;
this.directions = [];
this.starSystems = [];
this.systemCount = 1;
this.setStage();
this.setLighting();
this.setActors();
setInterval((function(_this) {
return function() {
_this.systemCount++;
return _this.addStars(_this.getPastelColor(), 0, 0);
};
})(this), 5000);
this.animate();
this.render();
}
Particles.prototype.getPastelColor = function() {
this.col = new THREE.Color("hsl(" + (this.random(0, 360)) + ", " + (Math.floor(25 + 70 * Math.random())) + "%, " + (Math.floor(85 + 10 * Math.random())) + "%)");
return "#" + (this.col.getHexString());
};
Particles.prototype.setActors = function() {
return this.addStars(this.getPastelColor(), 0, 0);
};
Particles.prototype.addStars = function(color, x, y) {
var angle, i, k, radiusSQ, ref, vertex;
this.dirs = [];
this.geometry = new THREE.Geometry();
this.materials = new THREE.PointsMaterial({
color: color,
size: 1,
transparent: true,
blending: THREE.AdditiveBlending,
map: this.getTexture(color),
depthTest: false
});
for (i = k = 0, ref = this.particleCount; 0 <= ref ? k < ref : k > ref; i = 0 <= ref ? ++k : --k) {
angle = Math.random() * 2 * Math.PI;
radiusSQ = Math.random() * this.initialRadius * this.initialRadius;
vertex = new THREE.Vector3();
vertex.x = x;
vertex.y = y;
vertex.z = 0;
this.dirs.push({
x: (Math.random() * this.movementSpeed) - (this.movementSpeed / 2),
y: (Math.random() * this.movementSpeed) - (this.movementSpeed / 2),
z: (Math.random() * this.movementSpeed) - (this.movementSpeed / 2)
});
this.geometry.vertices.push(vertex);
}
this.starSystem = new THREE.Points(this.geometry, this.materials);
this.starSystem.sortParticles = true;
this.directions.push(this.dirs);
this.starSystems.push(this.starSystem);
return this.scene.add(this.starSystem);
};
Particles.prototype.getTexture = function(color) {
var canvas, context, gradient, texture;
canvas = document.createElement('canvas');
canvas.width = 32;
canvas.height = 32;
context = canvas.getContext('2d');
gradient = context.createRadialGradient(canvas.width / 2, canvas.height / 2, 0, canvas.width / 2, canvas.height / 2, canvas.width / 2);
gradient.addColorStop(0, 'rgba(255,255,255,1)');
gradient.addColorStop(0.2, color);
gradient.addColorStop(0.4, color);
gradient.addColorStop(1, 'rgba(0,0,0,1)');
context.fillStyle = gradient;
context.fillRect(0, 0, canvas.width, canvas.height);
texture = new THREE.Texture(canvas);
texture.needsUpdate = true;
return texture;
};
Particles.prototype.setLighting = function() {
this.ambientLight = new THREE.AmbientLight("#ffffff", 0.5);
return this.scene.add(this.ambientLight);
};
Particles.prototype.setStage = function() {
this.renderer = new THREE.WebGLRenderer({
canvas: document.getElementById("canvas"),
antialias: true
});
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.autoClear = false;
this.renderer.setSize(window.innerWidth, window.innerHeight);
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000);
this.camera.position.z = 50;
this.stats = new Stats();
this.stats.setMode(0);
this.stats.domElement.style.position = 'absolute';
this.stats.domElement.style.left = '0px';
this.stats.domElement.style.top = '0px';
document.getElementById("stats").appendChild(this.stats.domElement);
window.addEventListener('resize', this.resize, false);
window.addEventListener('mousemove', this.mouseMove, false);
return window.addEventListener("mousedown", this.mouseDown);
};
Particles.prototype.animate = function() {
var i, j, k, l, particle, ref, ref1;
for (j = k = 0, ref = this.systemCount - 1; 0 <= ref ? k <= ref : k >= ref; j = 0 <= ref ? ++k : --k) {
for (i = l = 0, ref1 = this.particleCount; 0 <= ref1 ? l < ref1 : l > ref1; i = 0 <= ref1 ? ++l : --l) {
particle = this.starSystems[j].geometry.vertices[i];
particle.x += this.directions[j][i].x;
particle.y += this.directions[j][i].y;
particle.z += this.directions[j][i].z;
}
this.starSystems[j].geometry.verticesNeedUpdate = true;
}
this.stats.update();
this.render();
return requestAnimationFrame(this.animate);
};
Particles.prototype.resize = function() {
this.camera.aspect = window.innerWidth / window.innerHeight;
this.camera.updateProjectionMatrix();
this.renderer.setSize(window.innerWidth, window.innerHeight);
return this.render();
};
Particles.prototype.mouseDown = function() {
this.systemCount++;
return this.addStars(this.getPastelColor(), this.canvasMouse.x, this.canvasMouse.y);
};
Particles.prototype.mouseMove = function() {
this.canvasMouse.px = this.canvasMouse.x;
this.canvasMouse.py = this.canvasMouse.y;
this.canvasX = (event.clientX / window.innerWidth) * 2 - 1;
this.canvasY = -(event.clientY / window.innerHeight) * 2 + 1;
this.vector = new THREE.Vector3(this.canvasX || 0, this.canvasY || 0, 0);
this.vector.unproject(this.camera);
this.dir = this.vector.sub(this.camera.position).normalize();
this.distance = -this.camera.position.z / this.dir.z;
return this.canvasMouse = this.camera.position.clone().add(this.dir.multiplyScalar(this.distance));
};
Particles.prototype.random = function(min, max) {
return Math.floor(Math.random() * max) + min;
};
Particles.prototype.rotateRadians = function(deg) {
return deg * (Math.PI / 180);
};
Particles.prototype.render = function() {
return this.renderer.render(this.scene, this.camera);
};
return Particles;
})();
new Particles;
}).call(this);
</script>
<div MicroSoft YaHei';">
<p>适用浏览器:360、FireFox、Chrome、Opera、傲游、搜狗、世界之窗. 不支持Safari、IE8及以下浏览器。</p>
</div>
</body>
</html>
Stats.min.js代码:
var Stats = function() {
var e = Date.now(),
t = e,
n = 0,
i = 1 / 0,
a = 0,
d = 0,
l = 1 / 0,
o = 0,
s = 0,
r = 0,
c = document.createElement("div");
c.id = "stats",
c.addEventListener("mousedown",
function(e) {
e.preventDefault(),
g(++r % 2)
},
!1),
c.style.cssText = "width:80px;opacity:0.9;cursor:pointer";
var p = document.createElement("div");
p.id = "fps",
p.style.cssText = "padding:0 0 3px 3px;text-align:left;background-color:#002",
c.appendChild(p);
var h = document.createElement("div");
h.id = "fpsText",
h.style.cssText = "color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px",
h.innerHTML = "FPS",
p.appendChild(h);
var f = document.createElement("div");
for (f.id = "fpsGraph", f.style.cssText = "position:relative;width:74px;height:30px;background-color:#0ff", p.appendChild(f); f.children.length < 74;) {
var x = document.createElement("span");
x.style.cssText = "width:1px;height:30px;float:left;background-color:#113",
f.appendChild(x)
}
var m = document.createElement("div");
m.id = "ms",
m.style.cssText = "padding:0 0 3px 3px;text-align:left;background-color:#020;display:none",
c.appendChild(m);
var u = document.createElement("div");
u.id = "msText",
u.style.cssText = "color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px",
u.innerHTML = "MS",
m.appendChild(u);
var v = document.createElement("div");
for (v.id = "msGraph", v.style.cssText = "position:relative;width:74px;height:30px;background-color:#0f0", m.appendChild(v); v.children.length < 74;) {
var x = document.createElement("span");
x.style.cssText = "width:1px;height:30px;float:left;background-color:#131",
v.appendChild(x)
}
var g = function(e) {
switch (r = e) {
case 0:
p.style.display = "block",
m.style.display = "none";
break;
case 1:
p.style.display = "none",
m.style.display = "block"
}
},
y = function(e, t) {
var n = e.appendChild(e.firstChild);
n.style.height = t + "px"
};
return {
REVISION: 11,
domElement: c,
setMode: g,
begin: function() {
e = Date.now()
},
end: function() {
var r = Date.now();
return n = r - e,
i = Math.min(i, n),
a = Math.max(a, n),
u.textContent = n + " MS (" + i + "-" + a + ")",
y(v, Math.min(30, 30 - n / 200 * 30)),
s++,
r > t + 1e3 && (d = Math.round(1e3 * s / (r - t)), l = Math.min(l, d), o = Math.max(o, d), h.textContent = d + " FPS (" + l + "-" + o + ")", y(f, Math.min(30, 30 - d / 100 * 30)), t = r, s = 0),
r
},
update: function() {
e = this.end()
}
}
};
three.min.js代码:
// threejs.org/license
(function(l, pa) {
"object" === typeof exports && "undefined" !== typeof module ? pa(exports) : "function" === typeof define && define.amd ? define(["exports"], pa) : pa(l.THREE = l.THREE || {})
})(this,
function(l) {
function pa() {}
function D(a, b) {
this.x = a || 0;
this.y = b || 0
}
function ea(a, b, c, d, e, f, g, h, m, k) {
Object.defineProperty(this, "id", {
value: Ze++
});
this.uuid = N.generateUUID();
this.name = "";
this.image = void 0 !== a ? a: ea.DEFAULT_IMAGE;
this.mipmaps = [];
this.mapping = void 0 !== b ? b: ea.DEFAULT_MAPPING;
this.wrapS = void 0 !== c ? c: 1001;
this.wrapT = void 0 !== d ? d: 1001;
this.magFilter = void 0 !== e ? e: 1006;
this.minFilter = void 0 !== f ? f: 1008;
this.anisotropy = void 0 !== m ? m: 1;
this.format = void 0 !== g ? g: 1023;
this.type = void 0 !== h ? h: 1009;
this.offset = new D(0, 0);
this.repeat = new D(1, 1);
this.generateMipmaps = !0;
this.premultiplyAlpha = !1;
this.flipY = !0;
this.unpackAlignment = 4;
this.encoding = void 0 !== k ? k: 3E3;
this.version = 0;
this.onUpdate = null
}
function fa(a, b, c, d) {
this.x = a || 0;
this.y = b || 0;
this.z = c || 0;
this.w = void 0 !== d ? d: 1
}
function Ya(a, b, c) {
this.uuid = N.generateUUID();
this.width = a;
this.height = b;
this.scissor = new fa(0, 0, a, b);
this.scissorTest = !1;
this.viewport = new fa(0, 0, a, b);
c = c || {};
void 0 === c.minFilter && (c.minFilter = 1006);
this.texture = new ea(void 0, void 0, c.wrapS, c.wrapT, c.magFilter, c.minFilter, c.format, c.type, c.anisotropy, c.encoding);
this.depthBuffer = void 0 !== c.depthBuffer ? c.depthBuffer: !0;
this.stencilBuffer = void 0 !== c.stencilBuffer ? c.stencilBuffer: !0;
this.depthTexture = void 0 !== c.depthTexture ? c.depthTexture: null
}
function Gb(a, b, c) {
Ya.call(this, a, b, c);
this.activeMipMapLevel = this.activeCubeFace = 0
}
function ca(a, b, c, d) {
this._x = a || 0;
this._y = b || 0;
this._z = c || 0;
this._w = void 0 !== d ? d: 1
}
function q(a, b, c) {
this.x = a || 0;
this.y = b || 0;
this.z = c || 0
}
function S() {
this.elements = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
0 < arguments.length && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")
}
function Za(a, b, c, d, e, f, g, h, m, k) {
a = void 0 !== a ? a: [];
ea.call(this, a, void 0 !== b ? b: 301, c, d, e, f, g, h, m, k);
this.flipY = !1
}
function Hb(a, b, c) {
var d = a[0];
if (0 >= d || 0 < d) return a;
var e = b * c,
f = Be[e];
void 0 === f && (f = new Float32Array(e), Be[e] = f);
if (0 !== b) for (d.toArray(f, 0), d = 1, e = 0; d !== b; ++d) e += c,
a[d].toArray(f, e);
return f
}
function Ce(a, b) {
var c = De[b];
void 0 === c && (c = new Int32Array(b), De[b] = c);
for (var d = 0; d !== b; ++d) c[d] = a.allocTextureUnit();
return c
}
function $e(a, b) {
a.uniform1f(this.addr, b)
}
function af(a, b) {
a.uniform1i(this.addr, b)
}
function bf(a, b) {
void 0 === b.x ? a.uniform2fv(this.addr, b) : a.uniform2f(this.addr, b.x, b.y)
}
function cf(a, b) {
void 0 !== b.x ? a.uniform3f(this.addr, b.x, b.y, b.z) : void 0 !== b.r ? a.uniform3f(this.addr, b.r, b.g, b.b) : a.uniform3fv(this.addr, b)
}
function df(a, b) {
void 0 === b.x ? a.uniform4fv(this.addr, b) : a.uniform4f(this.addr, b.x, b.y, b.z, b.w)
}
function ef(a, b) {
a.uniformMatrix2fv(this.addr, !1, b.elements || b)
}
function ff(a, b) {
a.uniformMatrix3fv(this.addr, !1, b.elements || b)
}
function gf(a, b) {
a.uniformMatrix4fv(this.addr, !1, b.elements || b)
}
function hf(a, b, c) {
var d = c.allocTextureUnit();
a.uniform1i(this.addr, d);
c.setTexture2D(b || Ee, d)
}
function jf(a, b, c) {
var d = c.allocTextureUnit();
a.uniform1i(this.addr, d);
c.setTextureCube(b || Fe, d)
}
function Ge(a, b) {
a.uniform2iv(this.addr, b)
}
function He(a, b) {
a.uniform3iv(this.addr, b)
}
function Ie(a, b) {
a.uniform4iv(this.addr, b)
}
function kf(a) {
switch (a) {
case 5126:
return $e;
case 35664:
return bf;
case 35665:
return cf;
case 35666:
return df;
case 35674:
return ef;
case 35675:
return ff;
case 35676:
return gf;
case 35678:
return hf;
case 35680:
return jf;
case 5124:
case 35670:
return af;
case 35667:
case 35671:
return Ge;
case 35668:
case 35672:
return He;
case 35669:
case 35673:
return Ie
}
}
function lf(a, b) {
a.uniform1fv(this.addr, b)
}
function mf(a, b) {
a.uniform1iv(this.addr, b)
}
function nf(a, b) {
a.uniform2fv(this.addr, Hb(b, this.size, 2))
}
function of(a, b) {
a.uniform3fv(this.addr, Hb(b, this.size, 3))
}
function pf(a, b) {
a.uniform4fv(this.addr, Hb(b, this.size, 4))
}
function qf(a, b) {
a.uniformMatrix2fv(this.addr, !1, Hb(b, this.size, 4))
}
function rf(a, b) {
a.uniformMatrix3fv(this.addr, !1, Hb(b, this.size, 9))
}
function sf(a, b) {
a.uniformMatrix4fv(this.addr, !1, Hb(b, this.size, 16))
}
function tf(a, b, c) {
var d = b.length,
e = Ce(c, d);
a.uniform1iv(this.addr, e);
for (a = 0; a !== d; ++a) c.setTexture2D(b[a] || Ee, e[a])
}
function uf(a, b, c) {
var d = b.length,
e = Ce(c, d);
a.uniform1iv(this.addr, e);
for (a = 0; a !== d; ++a) c.setTextureCube(b[a] || Fe, e[a])
}
function vf(a) {
switch (a) {
case 5126:
return lf;
case 35664:
return nf;
case 35665:
return of;
case 35666:
return pf;
case 35674:
return qf;
case 35675:
return rf;
case 35676:
return sf;
case 35678:
return tf;
case 35680:
return uf;
case 5124:
case 35670:
return mf;
case 35667:
case 35671:
return Ge;
case 35668:
case 35672:
return He;
case 35669:
case 35673:
return Ie
}
}
function wf(a, b, c) {
this.id = a;
this.addr = c;
this.setValue = kf(b.type)
}
function xf(a, b, c) {
this.id = a;
this.addr = c;
this.size = b.size;
this.setValue = vf(b.type)
}
function Je(a) {
this.id = a;
this.seq = [];
this.map = {}
}
function $a(a, b, c) {
this.seq = [];
this.map = {};
this.renderer = c;
c = a.getProgramParameter(b, a.ACTIVE_UNIFORMS);
for (var d = 0; d < c; ++d) {
var e = a.getActiveUniform(b, d),
f = a.getUniformLocation(b, e.name),
g = this,
h = e.name,
m = h.length;
for (Rd.lastIndex = 0;;) {
var k = Rd.exec(h),
t = Rd.lastIndex,
p = k[1],
n = k[3];
"]" === k[2] && (p |= 0);
if (void 0 === n || "[" === n && t + 2 === m) {
h = g;
e = void 0 === n ? new wf(p, e, f) : new xf(p, e, f);
h.seq.push(e);
h.map[e.id] = e;
break
} else n = g.map[p],
void 0 === n && (n = new Je(p), p = g, g = n, p.seq.push(g), p.map[g.id] = g),
g = n
}
}
}
function J(a, b, c) {
return void 0 === b && void 0 === c ? this.set(a) : this.setRGB(a, b, c)
}
function eb(a, b, c, d, e, f, g, h, m, k, t, p) {
ea.call(this, null, f, g, h, m, k, d, e, t, p);
this.image = {
data: a,
width: b,
height: c
};
this.magFilter = void 0 !== m ? m: 1003;
this.minFilter = void 0 !== k ? k: 1003;
this.flipY = this.generateMipmaps = !1;
this.unpackAlignment = 1
}
function sc(a, b) {
this.min = void 0 !== a ? a: new D(Infinity, Infinity);
this.max = void 0 !== b ? b: new D( - Infinity, -Infinity)
}
function yf(a, b) {
var c, d, e, f, g, h, m, k, t, p, n = a.context,
u = a.state,
l, r, A, w, y, K;
this.render = function(v, E, L) {
if (0 !== b.length) {
v = new q;
var C = L.w / L.z,
F = .5 * L.z,
da = .5 * L.w,
H = 16 / L.w,
aa = new D(H * C, H),
Da = new q(1, 1, 0),
fb = new D(1, 1),
Sd = new sc;
Sd.min.set(L.x, L.y);
Sd.max.set(L.x + (L.z - 16), L.y + (L.w - 16));
if (void 0 === w) {
var H = new Float32Array([ - 1, -1, 0, 0, 1, -1, 1, 0, 1, 1, 1, 1, -1, 1, 0, 1]),
Q = new Uint16Array([0, 1, 2, 0, 2, 3]);
l = n.createBuffer();
r = n.createBuffer();
n.bindBuffer(n.ARRAY_BUFFER, l);
n.bufferData(n.ARRAY_BUFFER, H, n.STATIC_DRAW);
n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, r);
n.bufferData(n.ELEMENT_ARRAY_BUFFER, Q, n.STATIC_DRAW);
y = n.createTexture();
K = n.createTexture();
u.bindTexture(n.TEXTURE_2D, y);
n.texImage2D(n.TEXTURE_2D, 0, n.RGB, 16, 16, 0, n.RGB, n.UNSIGNED_BYTE, null);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.NEAREST);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.NEAREST);
u.bindTexture(n.TEXTURE_2D, K);
n.texImage2D(n.TEXTURE_2D, 0, n.RGBA, 16, 16, 0, n.RGBA, n.UNSIGNED_BYTE, null);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.NEAREST);
n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.NEAREST);
var H = A = {
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 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );\nvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = visibility.r / 9.0;\nvVisibility *= 1.0 - visibility.g / 9.0;\nvVisibility *= visibility.b / 9.0;\nvVisibility *= 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}"
},
Q = n.createProgram(),
M = n.createShader(n.FRAGMENT_SHADER),
O = n.createShader(n.VERTEX_SHADER),
P = "precision " + a.getPrecision() + " float;\n";
n.shaderSource(M, P + H.fragmentShader);
n.shaderSource(O, P + H.vertexShader);
n.compileShader(M);
n.compileShader(O);
n.attachShader(Q, M);
n.attachShader(Q, O);
n.linkProgram(Q);
w = Q;
t = n.getAttribLocation(w, "position");
p = n.getAttribLocation(w, "uv");
c = n.getUniformLocation(w, "renderType");
d = n.getUniformLocation(w, "map");
e = n.getUniformLocation(w, "occlusionMap");
f = n.getUniformLocation(w, "opacity");
g = n.getUniformLocation(w, "color");
h = n.getUniformLocation(w, "scale");
m = n.getUniformLocation(w, "rotation");
k = n.getUniformLocation(w, "screenPosition")
}
n.useProgram(w);
u.initAttributes();
u.enableAttribute(t);
u.enableAttribute(p);
u.disableUnusedAttributes();
n.uniform1i(e, 0);
n.uniform1i(d, 1);
n.bindBuffer(n.ARRAY_BUFFER, l);
n.vertexAttribPointer(t, 2, n.FLOAT, !1, 16, 0);
n.vertexAttribPointer(p, 2, n.FLOAT, !1, 16, 8);
n.bindBuffer(n.ELEMENT_ARRAY_BUFFER, r);
u.disable(n.CULL_FACE);
u.setDepthWrite(!1);
Q = 0;
for (M = b.length; Q < M; Q++) if (H = 16 / L.w, aa.set(H * C, H), O = b[Q], v.set(O.matrixWorld.elements[12], O.matrixWorld.elements[13], O.matrixWorld.elements[14]), v.applyMatrix4(E.matrixWorldInverse), v.applyMatrix4(E.projectionMatrix), Da.copy(v), fb.x = L.x + Da.x * F + F - 8, fb.y = L.y + Da.y * da + da - 8, !0 === Sd.containsPoint(fb)) {
u.activeTexture(n.TEXTURE0);
u.bindTexture(n.TEXTURE_2D, null);
u.activeTexture(n.TEXTURE1);
u.bindTexture(n.TEXTURE_2D, y);
n.copyTexImage2D(n.TEXTURE_2D, 0, n.RGB, fb.x, fb.y, 16, 16, 0);
n.uniform1i(c, 0);
n.uniform2f(h, aa.x, aa.y);
n.uniform3f(k, Da.x, Da.y, Da.z);
u.disable(n.BLEND);
u.enable(n.DEPTH_TEST);
n.drawElements(n.TRIANGLES, 6, n.UNSIGNED_SHORT, 0);
u.activeTexture(n.TEXTURE0);
u.bindTexture(n.TEXTURE_2D, K);
n.copyTexImage2D(n.TEXTURE_2D, 0, n.RGBA, fb.x, fb.y, 16, 16, 0);
n.uniform1i(c, 1);
u.disable(n.DEPTH_TEST);
u.activeTexture(n.TEXTURE1);
u.bindTexture(n.TEXTURE_2D, y);
n.drawElements(n.TRIANGLES, 6, n.UNSIGNED_SHORT, 0);
O.positionScreen.copy(Da);
O.customUpdateCallback ? O.customUpdateCallback(O) : O.updateLensFlares();
n.uniform1i(c, 2);
u.enable(n.BLEND);
for (var P = 0,
wa = O.lensFlares.length; P < wa; P++) {
var W = O.lensFlares[P];.001 < W.opacity && .001 < W.scale && (Da.x = W.x, Da.y = W.y, Da.z = W.z, H = W.size * W.scale / L.w, aa.x = H * C, aa.y = H, n.uniform3f(k, Da.x, Da.y, Da.z), n.uniform2f(h, aa.x, aa.y), n.uniform1f(m, W.rotation), n.uniform1f(f, W.opacity), n.uniform3f(g, W.color.r, W.color.g, W.color.b), u.setBlending(W.blending, W.blendEquation, W.blendSrc, W.blendDst), a.setTexture2D(W.texture, 1), n.drawElements(n.TRIANGLES, 6, n.UNSIGNED_SHORT, 0))
}
}
u.enable(n.CULL_FACE);
u.enable(n.DEPTH_TEST);
u.setDepthWrite(!0);
a.resetGLState()
}
}
}
function zf(a, b) {
var c, d, e, f, g, h, m, k, t, p, n, u, l, r, A, w, y;
function K(a, b) {
return a.renderOrder !== b.renderOrder ? a.renderOrder - b.renderOrder: a.z !== b.z ? b.z - a.z: b.id - a.id
}
var v = a.context,
E = a.state,
L, C, F, da, H = new q,
aa = new ca,
Da = new q;
this.render = function(q, D) {
if (0 !== b.length) {
if (void 0 === F) {
var Q = new Float32Array([ - .5, -.5, 0, 0, .5, -.5, 1, 0, .5, .5, 1, 1, -.5, .5, 0, 1]),
M = new Uint16Array([0, 1, 2, 0, 2, 3]);
L = v.createBuffer();
C = v.createBuffer();
v.bindBuffer(v.ARRAY_BUFFER, L);
v.bufferData(v.ARRAY_BUFFER, Q, v.STATIC_DRAW);
v.bindBuffer(v.ELEMENT_ARRAY_BUFFER, C);
v.bufferData(v.ELEMENT_ARRAY_BUFFER, M, v.STATIC_DRAW);
var Q = v.createProgram(),
M = v.createShader(v.VERTEX_SHADER),
O = v.createShader(v.FRAGMENT_SHADER);
v.shaderSource(M, ["precision " + a.getPrecision() + " float;", "uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n"));
v.shaderSource(O, ["precision " + a.getPrecision() + " float;", "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;\nfogFactor = 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}"].join("\n"));
v.compileShader(M);
v.compileShader(O);
v.attachShader(Q, M);
v.attachShader(Q, O);
v.linkProgram(Q);
F = Q;
w = v.getAttribLocation(F, "position");
y = v.getAttribLocation(F, "uv");
c = v.getUniformLocation(F, "uvOffset");
d = v.getUniformLocation(F, "uvScale");
e = v.getUniformLocation(F, "rotation");
f = v.getUniformLocation(F, "scale");
g = v.getUniformLocation(F, "color");
h = v.getUniformLocation(F, "map");
m = v.getUniformLocation(F, "opacity");
k = v.getUniformLocation(F, "modelViewMatrix");
t = v.getUniformLocation(F, "projectionMatrix");
p = v.getUniformLocation(F, "fogType");
n = v.getUniformLocation(F, "fogDensity");
u = v.getUniformLocation(F, "fogNear");
l = v.getUniformLocation(F, "fogFar");
r = v.getUniformLocation(F, "fogColor");
A = v.getUniformLocation(F, "alphaTest");
Q = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
Q.width = 8;
Q.height = 8;
M = Q.getContext("2d");
M.fillStyle = "white";
M.fillRect(0, 0, 8, 8);
da = new ea(Q);
da.needsUpdate = !0
}
v.useProgram(F);
E.initAttributes();
E.enableAttribute(w);
E.enableAttribute(y);
E.disableUnusedAttributes();
E.disable(v.CULL_FACE);
E.enable(v.BLEND);
v.bindBuffer(v.ARRAY_BUFFER, L);
v.vertexAttribPointer(w, 2, v.FLOAT, !1, 16, 0);
v.vertexAttribPointer(y, 2, v.FLOAT, !1, 16, 8);
v.bindBuffer(v.ELEMENT_ARRAY_BUFFER, C);
v.uniformMatrix4fv(t, !1, D.projectionMatrix.elements);
E.activeTexture(v.TEXTURE0);
v.uniform1i(h, 0);
M = Q = 0; (O = q.fog) ? (v.uniform3f(r, O.color.r, O.color.g, O.color.b), O.isFog ? (v.uniform1f(u, O.near), v.uniform1f(l, O.far), v.uniform1i(p, 1), M = Q = 1) : O.isFogExp2 && (v.uniform1f(n, O.density), v.uniform1i(p, 2), M = Q = 2)) : (v.uniform1i(p, 0), M = Q = 0);
for (var O = 0,
P = b.length; O < P; O++) {
var wa = b[O];
wa.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse, wa.matrixWorld);
wa.z = -wa.modelViewMatrix.elements[14]
}
b.sort(K);
for (var W = [], O = 0, P = b.length; O < P; O++) {
var wa = b[O],
x = wa.material; ! 1 !== x.visible && (v.uniform1f(A, x.alphaTest), v.uniformMatrix4fv(k, !1, wa.modelViewMatrix.elements), wa.matrixWorld.decompose(H, aa, Da), W[0] = Da.x, W[1] = Da.y, wa = 0, q.fog && x.fog && (wa = M), Q !== wa && (v.uniform1i(p, wa), Q = wa), null !== x.map ? (v.uniform2f(c, x.map.offset.x, x.map.offset.y), v.uniform2f(d, x.map.repeat.x, x.map.repeat.y)) : (v.uniform2f(c, 0, 0), v.uniform2f(d, 1, 1)), v.uniform1f(m, x.opacity), v.uniform3f(g, x.color.r, x.color.g, x.color.b), v.uniform1f(e, x.rotation), v.uniform2fv(f, W), E.setBlending(x.blending, x.blendEquation, x.blendSrc, x.blendDst), E.setDepthTest(x.depthTest), E.setDepthWrite(x.depthWrite), x.map ? a.setTexture2D(x.map, 0) : a.setTexture2D(da, 0), v.drawElements(v.TRIANGLES, 6, v.UNSIGNED_SHORT, 0))
}
E.enable(v.CULL_FACE);
a.resetGLState()
}
}
}
function X() {
Object.defineProperty(this, "id", {
value: Af++
});
this.uuid = N.generateUUID();
this.name = "";
this.type = "Material";
this.lights = this.fog = !0;
this.blending = 1;
this.side = 0;
this.shading = 2;
this.vertexColors = 0;
this.opacity = 1;
this.transparent = !1;
this.blendSrc = 204;
this.blendDst = 205;
this.blendEquation = 100;
this.blendEquationAlpha = this.blendDstAlpha = this.blendSrcAlpha = null;
this.depthFunc = 3;
this.depthWrite = this.depthTest = !0;
this.clippingPlanes = null;
this.clipShadows = this.clipIntersection = !1;
this.colorWrite = !0;
this.precision = null;
this.polygonOffset = !1;
this.alphaTest = this.polygonOffsetUnits = this.polygonOffsetFactor = 0;
this.premultipliedAlpha = !1;
this.overdraw = 0;
this._needsUpdate = this.visible = !0
}
function Ha(a) {
X.call(this);
this.type = "ShaderMaterial";
this.defines = {};
this.uniforms = {};
this.vertexShader = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}";
this.fragmentShader = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}";
this.linewidth = 1;
this.wireframe = !1;
this.wireframeLinewidth = 1;
this.morphNormals = this.morphTargets = this.skinning = this.clipping = this.lights = this.fog = !1;
this.extensions = {
derivatives: !1,
fragDepth: !1,
drawBuffers: !1,
shaderTextureLOD: !1
};
this.defaultAttributeValues = {
color: [1, 1, 1],
uv: [0, 0],
uv2: [0, 0]
};
this.index0AttributeName = void 0;
void 0 !== a && (void 0 !== a.attributes && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."), this.setValues(a))
}
function ab(a) {
X.call(this);
this.type = "MeshDepthMaterial";
this.depthPacking = 3200;
this.morphTargets = this.skinning = !1;
this.displacementMap = this.alphaMap = this.map = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.wireframe = !1;
this.wireframeLinewidth = 1;
this.lights = this.fog = !1;
this.setValues(a)
}
function Pa(a, b) {
this.min = void 0 !== a ? a: new q(Infinity, Infinity, Infinity);
this.max = void 0 !== b ? b: new q( - Infinity, -Infinity, -Infinity)
}
function Na(a, b) {
this.center = void 0 !== a ? a: new q;
this.radius = void 0 !== b ? b: 0
}
function ya() {
this.elements = new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
0 < arguments.length && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")
}
function la(a, b) {
this.normal = void 0 !== a ? a: new q(1, 0, 0);
this.constant = void 0 !== b ? b: 0
}
function tc(a, b, c, d, e, f) {
this.planes = [void 0 !== a ? a: new la, void 0 !== b ? b: new la, void 0 !== c ? c: new la, void 0 !== d ? d: new la, void 0 !== e ? e: new la, void 0 !== f ? f: new la]
}
function Ke(a, b, c, d) {
function e(b, c, d, e) {
var f = b.geometry,
g;
g = A;
var h = b.customDepthMaterial;
d && (g = w, h = b.customDistanceMaterial);
h ? g = h: (h = !1, c.morphTargets && (f && f.isBufferGeometry ? h = f.morphAttributes && f.morphAttributes.position && 0 < f.morphAttributes.position.length: f && f.isGeometry && (h = f.morphTargets && 0 < f.morphTargets.length)), b = b.isSkinnedMesh && c.skinning, f = 0, h && (f |= 1), b && (f |= 2), g = g[f]);
a.localClippingEnabled && !0 === c.clipShadows && 0 !== c.clippingPlanes.length && (f = g.uuid, h = c.uuid, b = y[f], void 0 === b && (b = {},
y[f] = b), f = b[h], void 0 === f && (f = g.clone(), b[h] = f), g = f);
g.visible = c.visible;
g.wireframe = c.wireframe;
h = c.side;
aa.renderSingleSided && 2 == h && (h = 0);
aa.renderReverseSided && (0 === h ? h = 1 : 1 === h && (h = 0));
g.side = h;
g.clipShadows = c.clipShadows;
g.clippingPlanes = c.clippingPlanes;
g.wireframeLinewidth = c.wireframeLinewidth;
g.linewidth = c.linewidth;
d && void 0 !== g.uniforms.lightPos && g.uniforms.lightPos.value.copy(e);
return g
}
function f(a, b, c) {
if (!1 !== a.visible) {
0 !== (a.layers.mask & b.layers.mask) && (a.isMesh || a.isLine || a.isPoints) && a.castShadow && (!1 === a.frustumCulled || !0 === m.intersectsObject(a)) && !0 === a.material.visible && (a.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse, a.matrixWorld), r.push(a));
a = a.children;
for (var d = 0,
e = a.length; d < e; d++) f(a[d], b, c)
}
}
var g = a.context,
h = a.state,
m = new tc,
k = new S,
t = b.shadows,
p = new D,
n = new D(d.maxTextureSize, d.maxTextureSize),
u = new q,
l = new q,
r = [],
A = Array(4),
w = Array(4),
y = {},
K = [new q(1, 0, 0), new q( - 1, 0, 0), new q(0, 0, 1), new q(0, 0, -1), new q(0, 1, 0), new q(0, -1, 0)],
v = [new q(0, 1, 0), new q(0, 1, 0), new q(0, 1, 0), new q(0, 1, 0), new q(0, 0, 1), new q(0, 0, -1)],
E = [new fa, new fa, new fa, new fa, new fa, new fa];
b = new ab;
b.depthPacking = 3201;
b.clipping = !0;
d = bb.distanceRGBA;
for (var L = Ja.clone(d.uniforms), C = 0; 4 !== C; ++C) {
var F = 0 !== (C & 1),
da = 0 !== (C & 2),
H = b.clone();
H.morphTargets = F;
H.skinning = da;
A[C] = H;
F = new Ha({
defines: {
USE_SHADOWMAP: ""
},
uniforms: L,
vertexShader: d.vertexShader,
fragmentShader: d.fragmentShader,
morphTargets: F,
skinning: da,
clipping: !0
});
w[C] = F
}
var aa = this;
this.enabled = !1;
this.autoUpdate = !0;
this.needsUpdate = !1;
this.type = 1;
this.renderSingleSided = this.renderReverseSided = !0;
this.render = function(b, d) {
if (!1 !== aa.enabled && (!1 !== aa.autoUpdate || !1 !== aa.needsUpdate) && 0 !== t.length) {
h.buffers.color.setClear(1, 1, 1, 1);
h.disable(g.BLEND);
h.setDepthTest(!0);
h.setScissorTest(!1);
for (var y, q, A = 0,
C = t.length; A < C; A++) {
var w = t[A],
L = w.shadow;
if (void 0 === L) console.warn("THREE.WebGLShadowMap:", w, "has no shadow.");
else {
var F = L.camera;
p.copy(L.mapSize);
p.min(n);
if (w && w.isPointLight) {
y = 6;
q = !0;
var H = p.x,
da = p.y;
E[0].set(2 * H, da, H, da);
E[1].set(0, da, H, da);
E[2].set(3 * H, da, H, da);
E[3].set(H, da, H, da);
E[4].set(3 * H, 0, H, da);
E[5].set(H, 0, H, da);
p.x *= 4;
p.y *= 2
} else y = 1,
q = !1;
null === L.map && (L.map = new Ya(p.x, p.y, {
minFilter: 1003,
magFilter: 1003,
format: 1023
}), F.updateProjectionMatrix());
L.isSpotLightShadow && L.update(w);
L && L.isRectAreaLightShadow && L.update(w);
H = L.map;
L = L.matrix;
l.setFromMatrixPosition(w.matrixWorld);
F.position.copy(l);
a.setRenderTarget(H);
a.clear();
for (H = 0; H < y; H++) {
q ? (u.copy(F.position), u.add(K[H]), F.up.copy(v[H]), F.lookAt(u), h.viewport(E[H])) : (u.setFromMatrixPosition(w.target.matrixWorld), F.lookAt(u));
F.updateMatrixWorld();
F.matrixWorldInverse.getInverse(F.matrixWorld);
L.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1);
L.multiply(F.projectionMatrix);
L.multiply(F.matrixWorldInverse);
k.multiplyMatrices(F.projectionMatrix, F.matrixWorldInverse);
m.setFromMatrix(k);
r.length = 0;
f(b, d, F);
for (var da = 0,
x = r.length; da < x; da++) {
var D = r[da],
Td = c.update(D),
Sa = D.material;
if (Sa && Sa.isMultiMaterial) for (var Le = Td.groups,
Sa = Sa.materials,
z = 0,
Ea = Le.length; z < Ea; z++) {
var I = Le[z],
J = Sa[I.materialIndex]; ! 0 === J.visible && (J = e(D, J, q, l), a.renderBufferDirect(F, null, Td, J, D, I))
} else J = e(D, Sa, q, l),
a.renderBufferDirect(F, null, Td, J, D, null)
}
}
}
}
y = a.getClearColor();
q = a.getClearAlpha();
a.setClearColor(y, q);
aa.needsUpdate = !1
}
}
}
function cb(a, b) {
this.origin = void 0 !== a ? a: new q;
this.direction = void 0 !== b ? b: new q
}
function db(a, b, c, d) {
this._x = a || 0;
this._y = b || 0;
this._z = c || 0;
this._order = d || db.DefaultOrder
}
function nd() {
this.mask = 1
}
function x() {
Object.defineProperty(this, "id", {
value: Bf++
});
this.uuid = N.generateUUID();
this.name = "";
this.type = "Object3D";
this.parent = null;
this.children = [];
this.up = x.DefaultUp.clone();
var a = new q,
b = new db,
c = new ca,
d = new q(1, 1, 1);
b.onChange(function() {
c.setFromEuler(b, !1)
});
c.onChange(function() {
b.setFromQuaternion(c, void 0, !1)
});
Object.defineProperties(this, {
position: {
enumerable: !0,
value: a
},
rotation: {
enumerable: !0,
value: b
},
quaternion: {
enumerable: !0,
value: c
},
scale: {
enumerable: !0,
value: d
},
modelViewMatrix: {
value: new S
},
normalMatrix: {
value: new ya
}
});
this.matrix = new S;
this.matrixWorld = new S;
this.matrixAutoUpdate = x.DefaultMatrixAutoUpdate;
this.matrixWorldNeedsUpdate = !1;
this.layers = new nd;
this.visible = !0;
this.receiveShadow = this.castShadow = !1;
this.frustumCulled = !0;
this.renderOrder = 0;
this.userData = {};
this.onBeforeRender = function() {};
this.onAfterRender = function() {}
}
function hb(a, b) {
this.start = void 0 !== a ? a: new q;
this.end = void 0 !== b ? b: new q
}
function za(a, b, c) {
this.a = void 0 !== a ? a: new q;
this.b = void 0 !== b ? b: new q;
this.c = void 0 !== c ? c: new q
}
function ha(a, b, c, d, e, f) {
this.a = a;
this.b = b;
this.c = c;
this.normal = d && d.isVector3 ? d: new q;
this.vertexNormals = Array.isArray(d) ? d: [];
this.color = e && e.isColor ? e: new J;
this.vertexColors = Array.isArray(e) ? e: [];
this.materialIndex = void 0 !== f ? f: 0
}
function Ka(a) {
X.call(this);
this.type = "MeshBasicMaterial";
this.color = new J(16777215);
this.lightMap = this.map = null;
this.lightMapIntensity = 1;
this.aoMap = null;
this.aoMapIntensity = 1;
this.envMap = this.alphaMap = this.specularMap = null;
this.combine = 0;
this.reflectivity = 1;
this.refractionRatio = .98;
this.wireframe = !1;
this.wireframeLinewidth = 1;
this.wireframeLinejoin = this.wireframeLinecap = "round";
this.lights = this.morphTargets = this.skinning = !1;
this.setValues(a)
}
function U(a, b, c) {
if (Array.isArray(a)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
this.uuid = N.generateUUID();
this.array = a;
this.itemSize = b;
this.count = void 0 !== a ? a.length / b: 0;
this.normalized = !0 === c;
this.dynamic = !1;
this.updateRange = {
offset: 0,
count: -1
};
this.onUploadCallback = function() {};
this.version = 0
}
function uc(a, b) {
U.call(this, new Int8Array(a), b)
}
function vc(a, b) {
U.call(this, new Uint8Array(a), b)
}
function wc(a, b) {
U.call(this, new Uint8ClampedArray(a), b)
}
function xc(a, b) {
U.call(this, new Int16Array(a), b)
}
function ib(a, b) {
U.call(this, new Uint16Array(a), b)
}
function yc(a, b) {
U.call(this, new Int32Array(a), b)
}
function jb(a, b) {
U.call(this, new Uint32Array(a), b)
}
function z(a, b) {
U.call(this, new Float32Array(a), b)
}
function zc(a, b) {
U.call(this, new Float64Array(a), b)
}
function Me() {
this.indices = [];
this.vertices = [];
this.normals = [];
this.colors = [];
this.uvs = [];
this.uvs2 = [];
this.groups = [];
this.morphTargets = {};
this.skinWeights = [];
this.skinIndices = [];
this.boundingSphere = this.boundingBox = null;
this.groupsNeedUpdate = this.uvsNeedUpdate = this.colorsNeedUpdate = this.normalsNeedUpdate = this.verticesNeedUpdate = !1
}
function Ud(a) {
for (var b = a.length,
c = -Infinity; b--;) a[b] > c && (c = a[b]);
return c
}
function T() {
Object.defineProperty(this, "id", {
value: Vd++
});
this.uuid = N.generateUUID();
this.name = "";
this.type = "Geometry";
this.vertices = [];
this.colors = [];
this.faces = [];
this.faceVertexUvs = [[]];
this.morphTargets = [];
this.morphNormals = [];
this.skinWeights = [];
this.skinIndices = [];
this.lineDistances = [];
this.boundingSphere = this.boundingBox = null;
this.groupsNeedUpdate = this.lineDistancesNeedUpdate = this.colorsNeedUpdate = this.normalsNeedUpdate = this.uvsNeedUpdate = this.verticesNeedUpdate = this.elementsNeedUpdate = !1
}
function I() {
Object.defineProperty(this, "id", {
value: Vd++
});
this.uuid = N.generateUUID();
this.name = "";
this.type = "BufferGeometry";
this.index = null;
this.attributes = {};
this.morphAttributes = {};
this.groups = [];
this.boundingSphere = this.boundingBox = null;
this.drawRange = {
start: 0,
count: Infinity
}
}
function Aa(a, b) {
x.call(this);
this.type = "Mesh";
this.geometry = void 0 !== a ? a: new I;
this.material = void 0 !== b ? b: new Ka({
color: 16777215 * Math.random()
});
this.drawMode = 0;
this.updateMorphTargets()
}
function Ib(a, b, c, d, e, f) {
T.call(this);
this.type = "BoxGeometry";
this.parameters = {
width: a,
height: b,
depth: c,
widthSegments: d,
heightSegments: e,
depthSegments: f
};
this.fromBufferGeometry(new kb(a, b, c, d, e, f));
this.mergeVertices()
}
function kb(a, b, c, d, e, f) {
function g(a, b, c, d, e, f, g, l, L, C, F) {
var da = f / L,
H = g / C,
aa = f / 2,
x = g / 2,
D = l / 2;
g = L + 1;
var z = C + 1,
Q = f = 0,
M, O, P = new q;
for (O = 0; O < z; O++) {
var J = O * H - x;
for (M = 0; M < g; M++) P[a] = (M * da - aa) * d,
P[b] = J * e,
P[c] = D,
k.push(P.x, P.y, P.z),
P[a] = 0,
P[b] = 0,
P[c] = 0 < l ? 1 : -1,
t.push(P.x, P.y, P.z),
p.push(M / L),
p.push(1 - O / C),
f += 1
}
for (O = 0; O < C; O++) for (M = 0; M < L; M++) a = n + M + g * (O + 1),
b = n + (M + 1) + g * (O + 1),
c = n + (M + 1) + g * O,
m.push(n + M + g * O, a, c),
m.push(a, b, c),
Q += 6;
h.addGroup(u, Q, F);
u += Q;
n += f
}
I.call(this);
this.type = "BoxBufferGeometry";
this.parameters = {
width: a,
height: b,
depth: c,
widthSegments: d,
heightSegments: e,
depthSegments: f
};
var h = this;
d = Math.floor(d) || 1;
e = Math.floor(e) || 1;
f = Math.floor(f) || 1;
var m = [],
k = [],
t = [],
p = [],
n = 0,
u = 0;
g("z", "y", "x", -1, -1, c, b, a, f, e, 0);
g("z", "y", "x", 1, -1, c, b, -a, f, e, 1);
g("x", "z", "y", 1, 1, a, c, b, d, f, 2);
g("x", "z", "y", 1, -1, a, c, -b, d, f, 3);
g("x", "y", "z", 1, -1, a, b, c, d, e, 4);
g("x", "y", "z", -1, -1, a, b, -c, d, e, 5);
this.setIndex(m);
this.addAttribute("position", new z(k, 3));
this.addAttribute("normal", new z(t, 3));
this.addAttribute("uv", new z(p, 2))
}
function Ac(a, b, c, d) {
T.call(this);
this.type = "PlaneGeometry";
this.parameters = {
width: a,
height: b,
widthSegments: c,
heightSegments: d
};
this.fromBufferGeometry(new lb(a, b, c, d))
}
function lb(a, b, c, d) {
I.call(this);
this.type = "PlaneBufferGeometry";
this.parameters = {
width: a,
height: b,
widthSegments: c,
heightSegments: d
};
var e = a / 2,
f = b / 2;
c = Math.floor(c) || 1;
d = Math.floor(d) || 1;
var g = c + 1,
h = d + 1,
m = a / c,
k = b / d,
t = [],
p = [],
n = [],
u = [];
for (a = 0; a < h; a++) {
var l = a * k - f;
for (b = 0; b < g; b++) p.push(b * m - e, -l, 0),
n.push(0, 0, 1),
u.push(b / c),
u.push(1 - a / d)
}
for (a = 0; a < d; a++) for (b = 0; b < c; b++) e = b + g * (a + 1),
f = b + 1 + g * (a + 1),
h = b + 1 + g * a,
t.push(b + g * a, e, h),
t.push(e, f, h);
this.setIndex(t);
this.addAttribute("position", new z(p, 3));
this.addAttribute("normal", new z(n, 3));
this.addAttribute("uv", new z(u, 2))
}
function ra() {
x.call(this);
this.type = "Camera";
this.matrixWorldInverse = new S;
this.projectionMatrix = new S
}
function Fa(a, b, c, d) {
ra.call(this);
this.type = "PerspectiveCamera";
this.fov = void 0 !== a ? a: 50;
this.zoom = 1;
this.near = void 0 !== c ? c: .1;
this.far = void 0 !== d ? d: 2E3;
this.focus = 10;
this.aspect = void 0 !== b ? b: 1;
this.view = null;
this.filmGauge = 35;
this.filmOffset = 0;
this.updateProjectionMatrix()
}
function Jb(a, b, c, d, e, f) {
ra.call(this);
this.type = "OrthographicCamera";
this.zoom = 1;
this.view = null;
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()
}
function Cf(a, b, c) {
var d, e, f;
return {
setMode: function(a) {
d = a
},
setIndex: function(c) {
c.array instanceof Uint32Array && b.get("OES_element_index_uint") ? (e = a.UNSIGNED_INT, f = 4) : c.array instanceof Uint16Array ? (e = a.UNSIGNED_SHORT, f = 2) : (e = a.UNSIGNED_BYTE, f = 1)
},
render: function(b, h) {
a.drawElements(d, h, e, b * f);
c.calls++;
c.vertices += h;
d === a.TRIANGLES && (c.faces += h / 3)
},
renderInstances: function(g, h, m) {
var k = b.get("ANGLE_instanced_arrays");
null === k ? console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.") : (k.drawElementsInstancedANGLE(d, m, e, h * f, g.maxInstancedCount), c.calls++, c.vertices += m * g.maxInstancedCount, d === a.TRIANGLES && (c.faces += g.maxInstancedCount * m / 3))
}
}
}
function Df(a, b, c) {
var d;
return {
setMode: function(a) {
d = a
},
render: function(b, f) {
a.drawArrays(d, b, f);
c.calls++;
c.vertices += f;
d === a.TRIANGLES && (c.faces += f / 3)
},
renderInstances: function(e) {
var f = b.get("ANGLE_instanced_arrays");
if (null === f) console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
else {
var g = e.attributes.position,
g = g.isInterleavedBufferAttribute ? g.data.count: g.count;
f.drawArraysInstancedANGLE(d, 0, g, e.maxInstancedCount);
c.calls++;
c.vertices += g * e.maxInstancedCount;
d === a.TRIANGLES && (c.faces += e.maxInstancedCount * g / 3)
}
}
}
}
function Ef() {
var a = {};
return {
get: function(b) {
if (void 0 !== a[b.id]) return a[b.id];
var c;
switch (b.type) {
case "DirectionalLight":
c = {
direction: new q,
color: new J,
shadow: !1,
shadowBias: 0,
shadowRadius: 1,
shadowMapSize: new D
};
break;
case "SpotLight":
c = {
position: new q,
direction: new q,
color: new J,
distance: 0,
coneCos: 0,
penumbraCos: 0,
decay: 0,
shadow: !1,
shadowBias: 0,
shadowRadius: 1,
shadowMapSize: new D
};
break;
case "PointLight":
c = {
position: new q,
color: new J,
distance: 0,
decay: 0,
shadow: !1,
shadowBias: 0,
shadowRadius: 1,
shadowMapSize: new D
};
break;
case "HemisphereLight":
c = {
direction: new q,
skyColor: new J,
groundColor: new J
};
break;
case "RectAreaLight":
c = {
color: new J,
position: new q,
halfWidth: new q,
halfHeight: new q
}
}
return a[b.id] = c
}
}
}
function Ff(a) {
a = a.split("\n");
for (var b = 0; b < a.length; b++) a[b] = b + 1 + ": " + a[b];
return a.join("\n")
}
function Ne(a, b, c) {
var d = a.createShader(b);
a.shaderSource(d, c);
a.compileShader(d); ! 1 === a.getShaderParameter(d, a.COMPILE_STATUS) && console.error("THREE.WebGLShader: Shader couldn't compile.");
"" !== a.getShaderInfoLog(d) && console.warn("THREE.WebGLShader: gl.getShaderInfoLog()", b === a.VERTEX_SHADER ? "vertex": "fragment", a.getShaderInfoLog(d), Ff(c));
return d
}
function Oe(a) {
switch (a) {
case 3E3:
return ["Linear", "( value )"];
case 3001:
return ["sRGB", "( value )"];
case 3002:
return ["RGBE", "( value )"];
case 3004:
return ["RGBM", "( value, 7.0 )"];
case 3005:
return ["RGBM", "( value, 16.0 )"];
case 3006:
return ["RGBD", "( value, 256.0 )"];
case 3007:
return ["Gamma", "( value, float( GAMMA_FACTOR ) )"];
default:
throw Error("unsupported encoding: " + a);
}
}
function Wd(a, b) {
var c = Oe(b);
return "vec4 " + a + "( vec4 value ) { return " + c[0] + "ToLinear" + c[1] + "; }"
}
function Gf(a, b) {
var c = Oe(b);
return "vec4 " + a + "( vec4 value ) { return LinearTo" + c[0] + c[1] + "; }"
}
function Hf(a, b) {
var c;
switch (b) {
case 1:
c = "Linear";
break;
case 2:
c = "Reinhard";
break;
case 3:
c = "Uncharted2";
break;
case 4:
c = "OptimizedCineon";
break;
default:
throw Error("unsupported toneMapping: " + b);
}
return "vec3 " + a + "( vec3 color ) { return " + c + "ToneMapping( color ); }"
}
function If(a, b, c) {
a = a || {};
return [a.derivatives || b.envMapCubeUV || b.bumpMap || b.normalMap || b.flatShading ? "#extension GL_OES_standard_derivatives : enable": "", (a.fragDepth || b.logarithmicDepthBuffer) && c.get("EXT_frag_depth") ? "#extension GL_EXT_frag_depth : enable": "", a.drawBuffers && c.get("WEBGL_draw_buffers") ? "#extension GL_EXT_draw_buffers : require": "", (a.shaderTextureLOD || b.envMap) && c.get("EXT_shader_texture_lod") ? "#extension GL_EXT_shader_texture_lod : enable": ""].filter(Bc).join("\n")
}
function Jf(a) {
var b = [],
c;
for (c in a) {
var d = a[c]; ! 1 !== d && b.push("#define " + c + " " + d)
}
return b.join("\n")
}
function Bc(a) {
return "" !== a
}
function Pe(a, b) {
return a.replace(/NUM_DIR_LIGHTS/g, b.numDirLights).replace(/NUM_SPOT_LIGHTS/g, b.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, b.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, b.numPointLights).replace(/NUM_HEMI_LIGHTS/g, b.numHemiLights)
}
function Xd(a) {
return a.replace(/#include +<([\w\d.]+)>/g,
function(a, c) {
var d = Z[c];
if (void 0 === d) throw Error("Can not resolve #include <" + c + ">");
return Xd(d)
})
}
function Qe(a) {
return a.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,
function(a, c, d, e) {
a = "";
for (c = parseInt(c); c < parseInt(d); c++) a += e.replace(/\[ i \]/g, "[ " + c + " ]");
return a
})
}
function Kf(a, b, c, d) {
var e = a.context,
f = c.extensions,
g = c.defines,
h = c.__webglShader.vertexShader,
m = c.__webglShader.fragmentShader,
k = "SHADOWMAP_TYPE_BASIC";
1 === d.shadowMapType ? k = "SHADOWMAP_TYPE_PCF": 2 === d.shadowMapType && (k = "SHADOWMAP_TYPE_PCF_SOFT");
var t = "ENVMAP_TYPE_CUBE",
p = "ENVMAP_MODE_REFLECTION",
n = "ENVMAP_BLENDING_MULTIPLY";
if (d.envMap) {
switch (c.envMap.mapping) {
case 301:
case 302:
t = "ENVMAP_TYPE_CUBE";
break;
case 306:
case 307:
t = "ENVMAP_TYPE_CUBE_UV";
break;
case 303:
case 304:
t = "ENVMAP_TYPE_EQUIREC";
break;
case 305:
t = "ENVMAP_TYPE_SPHERE"
}
switch (c.envMap.mapping) {
case 302:
case 304:
p = "ENVMAP_MODE_REFRACTION"
}
switch (c.combine) {
case 0:
n = "ENVMAP_BLENDING_MULTIPLY";
break;
case 1:
n = "ENVMAP_BLENDING_MIX";
break;
case 2:
n = "ENVMAP_BLENDING_ADD"
}
}
var u = 0 < a.gammaFactor ? a.gammaFactor: 1,
f = If(f, d, a.extensions),
l = Jf(g),
r = e.createProgram();
c.isRawShaderMaterial ? (g = [l, "\n"].filter(Bc).join("\n"), k = [f, l, "\n"].filter(Bc).join("\n")) : (g = ["precision " + d.precision + " float;", "precision " + d.precision + " int;", "#define SHADER_NAME " + c.__webglShader.name, l, d.supportsVertexTextures ? "#define VERTEX_TEXTURES": "", "#define GAMMA_FACTOR " + u, "#define MAX_BONES " + d.maxBones, d.useFog && d.fog ? "#define USE_FOG": "", d.useFog && d.fogExp ? "#define FOG_EXP2": "", d.map ? "#define USE_MAP": "", d.envMap ? "#define USE_ENVMAP": "", d.envMap ? "#define " + p: "", d.lightMap ? "#define USE_LIGHTMAP": "", d.aoMap ? "#define USE_AOMAP": "", d.emissiveMap ? "#define USE_EMISSIVEMAP": "", d.bumpMap ? "#define USE_BUMPMAP": "", d.normalMap ? "#define USE_NORMALMAP": "", d.displacementMap && d.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP": "", d.specularMap ? "#define USE_SPECULARMAP": "", d.roughnessMap ? "#define USE_ROUGHNESSMAP": "", d.metalnessMap ? "#define USE_METALNESSMAP": "", d.alphaMap ? "#define USE_ALPHAMAP": "", d.vertexColors ? "#define USE_COLOR": "", d.flatShading ? "#define FLAT_SHADED": "", d.skinning ? "#define USE_SKINNING": "", d.useVertexTexture ? "#define BONE_TEXTURE": "", d.morphTargets ? "#define USE_MORPHTARGETS": "", d.morphNormals && !1 === d.flatShading ? "#define USE_MORPHNORMALS": "", d.doubleSided ? "#define DOUBLE_SIDED": "", d.flipSided ? "#define FLIP_SIDED": "", "#define NUM_CLIPPING_PLANES " + d.numClippingPlanes, d.shadowMapEnabled ? "#define USE_SHADOWMAP": "", d.shadowMapEnabled ? "#define " + k: "", d.sizeAttenuation ? "#define USE_SIZEATTENUATION": "", d.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF": "", d.logarithmicDepthBuffer && a.extensions.get("EXT_frag_depth") ? "#define USE_LOGDEPTHBUF_EXT": "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_COLOR", "\tattribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", "\tattribute vec3 morphTarget0;", "\tattribute vec3 morphTarget1;", "\tattribute vec3 morphTarget2;", "\tattribute vec3 morphTarget3;", "\t#ifdef USE_MORPHNORMALS", "\t\tattribute vec3 morphNormal0;", "\t\tattribute vec3 morphNormal1;", "\t\tattribute vec3 morphNormal2;", "\t\tattribute vec3 morphNormal3;", "\t#else", "\t\tattribute vec3 morphTarget4;", "\t\tattribute vec3 morphTarget5;", "\t\tattribute vec3 morphTarget6;", "\t\tattribute vec3 morphTarget7;", "\t#endif", "#endif", "#ifdef USE_SKINNING", "\tattribute vec4 skinIndex;", "\tattribute vec4 skinWeight;", "#endif", "\n"].filter(Bc).join("\n"), k = [f, "precision " + d.precision + " float;", "precision " + d.precision + " int;", "#define SHADER_NAME " + c.__webglShader.name, l, d.alphaTest ? "#define ALPHATEST " + d.alphaTest: "", "#define GAMMA_FACTOR " + u, d.useFog && d.fog ? "#define USE_FOG": "", d.useFog && d.fogExp ? "#define FOG_EXP2": "", d.map ? "#define USE_MAP": "", d.envMap ? "#define USE_ENVMAP": "", d.envMap ? "#define " + t: "", d.envMap ? "#define " + p: "", d.envMap ? "#define " + n: "", d.lightMap ? "#define USE_LIGHTMAP": "", d.aoMap ? "#define USE_AOMAP": "", d.emissiveMap ? "#define USE_EMISSIVEMAP": "", d.bumpMap ? "#define USE_BUMPMAP": "", d.normalMap ? "#define USE_NORMALMAP": "", d.specularMap ? "#define USE_SPECULARMAP": "", d.roughnessMap ? "#define USE_ROUGHNESSMAP": "", d.metalnessMap ? "#define USE_METALNESSMAP": "", d.alphaMap ? "#define USE_ALPHAMAP": "", d.vertexColors ? "#define USE_COLOR": "", d.gradientMap ? "#define USE_GRADIENTMAP": "", d.flatShading ? "#define FLAT_SHADED": "", d.doubleSided ? "#define DOUBLE_SIDED": "", d.flipSided ? "#define FLIP_SIDED": "", "#define NUM_CLIPPING_PLANES " + d.numClippingPlanes, "#define UNION_CLIPPING_PLANES " + (d.numClippingPlanes - d.numClipIntersection), d.shadowMapEnabled ? "#define USE_SHADOWMAP": "", d.shadowMapEnabled ? "#define " + k: "", d.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA": "", d.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS": "", d.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF": "", d.logarithmicDepthBuffer && a.extensions.get("EXT_frag_depth") ? "#define USE_LOGDEPTHBUF_EXT": "", d.envMap && a.extensions.get("EXT_shader_texture_lod") ? "#define TEXTURE_LOD_EXT": "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", 0 !== d.toneMapping ? "#define TONE_MAPPING": "", 0 !== d.toneMapping ? Z.tonemapping_pars_fragment: "", 0 !== d.toneMapping ? Hf("toneMapping", d.toneMapping) : "", d.outputEncoding || d.mapEncoding || d.envMapEncoding || d.emissiveMapEncoding ? Z.encodings_pars_fragment: "", d.mapEncoding ? Wd("mapTexelToLinear", d.mapEncoding) : "", d.envMapEncoding ? Wd("envMapTexelToLinear", d.envMapEncoding) : "", d.emissiveMapEncoding ? Wd("emissiveMapTexelToLinear", d.emissiveMapEncoding) : "", d.outputEncoding ? Gf("linearToOutputTexel", d.outputEncoding) : "", d.depthPacking ? "#define DEPTH_PACKING " + c.depthPacking: "", "\n"].filter(Bc).join("\n"));
h = Xd(h, d);
h = Pe(h, d);
m = Xd(m, d);
m = Pe(m, d);
c.isShaderMaterial || (h = Qe(h), m = Qe(m));
m = k + m;
h = Ne(e, e.VERTEX_SHADER, g + h);
m = Ne(e, e.FRAGMENT_SHADER, m);
e.attachShader(r, h);
e.attachShader(r, m);
void 0 !== c.index0AttributeName ? e.bindAttribLocation(r, 0, c.index0AttributeName) : !0 === d.morphTargets && e.bindAttribLocation(r, 0, "position");
e.linkProgram(r);
d = e.getProgramInfoLog(r);
t = e.getShaderInfoLog(h);
p = e.getShaderInfoLog(m);
u = n = !0;
if (!1 === e.getProgramParameter(r, e.LINK_STATUS)) n = !1,
console.error("THREE.WebGLProgram: shader error: ", e.getError(), "gl.VALIDATE_STATUS", e.getProgramParameter(r, e.VALIDATE_STATUS), "gl.getProgramInfoLog", d, t, p);
else if ("" !== d) console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", d);
else if ("" === t || "" === p) u = !1;
u && (this.diagnostics = {
runnable: n,
material: c,
programLog: d,
vertexShader: {
log: t,
prefix: g
},
fragmentShader: {
log: p,
prefix: k
}
});
e.deleteShader(h);
e.deleteShader(m);
var q;
this.getUniforms = function() {
void 0 === q && (q = new $a(e, r, a));
return q
};
var w;
this.getAttributes = function() {
if (void 0 === w) {
for (var a = {},
b = e.getProgramParameter(r, e.ACTIVE_ATTRIBUTES), c = 0; c < b; c++) {
var d = e.getActiveAttrib(r, c).name;
a[d] = e.getAttribLocation(r, d)
}
w = a
}
return w
};
this.destroy = function() {
e.deleteProgram(r);
this.program = void 0
};
Object.defineProperties(this, {
uniforms: {
get: function() {
console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms().");
return this.getUniforms()
}
},
attributes: {
get: function() {
console.warn("THREE.WebGLProgram: .attributes is now .getAttributes().");
return this.getAttributes()
}
}
});
this.id = Lf++;
this.code = b;
this.usedTimes = 1;
this.program = r;
this.vertexShader = h;
this.fragmentShader = m;
return this
}
function Mf(a, b) {
function c(a, b) {
var c;
a ? a.isTexture ? c = a.encoding: a.isWebGLRenderTarget && (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), c = a.texture.encoding) : c = 3E3;
3E3 === c && b && (c = 3007);
return c
}
var d = [],
e = {
MeshDepthMaterial: "depth",
MeshNormalMaterial: "normal",
MeshBasicMaterial: "basic",
MeshLambertMaterial: "lambert",
MeshPhongMaterial: "phong",
MeshToonMaterial: "phong",
MeshStandardMaterial: "physical",
MeshPhysicalMaterial: "physical",
LineBasicMaterial: "basic",
LineDashedMaterial: "dashed",
PointsMaterial: "points"
},
f = "precision supportsVertexTextures map mapEncoding envMap envMapMode envMapEncoding lightMap aoMap emissiveMap emissiveMapEncoding bumpMap normalMap displacementMap specularMap roughnessMap metalnessMap gradientMap alphaMap combine vertexColors fog useFog fogExp flatShading sizeAttenuation logarithmicDepthBuffer skinning maxBones useVertexTexture morphTargets morphNormals maxMorphTargets maxMorphNormals premultipliedAlpha numDirLights numPointLights numSpotLights numHemiLights numRectAreaLights shadowMapEnabled shadowMapType toneMapping physicallyCorrectLights alphaTest doubleSided flipSided numClippingPlanes numClipIntersection depthPacking".split(" ");
this.getParameters = function(d, f, m, k, t, p) {
var n = e[d.type],
u;
b.floatVertexTextures && p && p.skeleton && p.skeleton.useVertexTexture ? u = 1024 : (u = Math.floor((b.maxVertexUniforms - 20) / 4), void 0 !== p && p && p.isSkinnedMesh && (u = Math.min(p.skeleton.bones.length, u), u < p.skeleton.bones.length && console.warn("WebGLRenderer: too many bones - " + p.skeleton.bones.length + ", this GPU supports just " + u + " (try OpenGL instead of ANGLE)")));
var l = a.getPrecision();
null !== d.precision && (l = b.getMaxPrecision(d.precision), l !== d.precision && console.warn("THREE.WebGLProgram.getParameters:", d.precision, "not supported, using", l, "instead."));
var r = a.getCurrentRenderTarget();
return {
shaderID: n,
precision: l,
supportsVertexTextures: b.vertexTextures,
outputEncoding: c(r ? r.texture: null, a.gammaOutput),
map: !!d.map,
mapEncoding: c(d.map, a.gammaInput),
envMap: !!d.envMap,
envMapMode: d.envMap && d.envMap.mapping,
envMapEncoding: c(d.envMap, a.gammaInput),
envMapCubeUV: !!d.envMap && (306 === d.envMap.mapping || 307 === d.envMap.mapping),
lightMap: !!d.lightMap,
aoMap: !!d.aoMap,
emissiveMap: !!d.emissiveMap,
emissiveMapEncoding: c(d.emissiveMap, a.gammaInput),
bumpMap: !!d.bumpMap,
normalMap: !!d.normalMap,
displacementMap: !!d.displacementMap,
roughnessMap: !!d.roughnessMap,
metalnessMap: !!d.metalnessMap,
specularMap: !!d.specularMap,
alphaMap: !!d.alphaMap,
gradientMap: !!d.gradientMap,
combine: d.combine,
vertexColors: d.vertexColors,
fog: !!m,
useFog: d.fog,
fogExp: m && m.isFogExp2,
flatShading: 1 === d.shading,
sizeAttenuation: d.sizeAttenuation,
logarithmicDepthBuffer: b.logarithmicDepthBuffer,
skinning: d.skinning,
maxBones: u,
useVertexTexture: b.floatVertexTextures && p && p.skeleton && p.skeleton.useVertexTexture,
morphTargets: d.morphTargets,
morphNormals: d.morphNormals,
maxMorphTargets: a.maxMorphTargets,
maxMorphNormals: a.maxMorphNormals,
numDirLights: f.directional.length,
numPointLights: f.point.length,
numSpotLights: f.spot.length,
numRectAreaLights: f.rectArea.length,
numHemiLights: f.hemi.length,
numClippingPlanes: k,
numClipIntersection: t,
shadowMapEnabled: a.shadowMap.enabled && p.receiveShadow && 0 < f.shadows.length,
shadowMapType: a.shadowMap.type,
toneMapping: a.toneMapping,
physicallyCorrectLights: a.physicallyCorrectLights,
premultipliedAlpha: d.premultipliedAlpha,
alphaTest: d.alphaTest,
doubleSided: 2 === d.side,
flipSided: 1 === d.side,
depthPacking: void 0 !== d.depthPacking ? d.depthPacking: !1
}
};
this.getProgramCode = function(a, b) {
var c = [];
b.shaderID ? c.push(b.shaderID) : (c.push(a.fragmentShader), c.push(a.vertexShader));
if (void 0 !== a.defines) for (var d in a.defines) c.push(d),
c.push(a.defines[d]);
for (d = 0; d < f.length; d++) c.push(b[f[d]]);
return c.join()
};
this.acquireProgram = function(b, c, e) {
for (var f, t = 0,
p = d.length; t < p; t++) {
var n = d[t];
if (n.code === e) {
f = n; ++f.usedTimes;
break
}
}
void 0 === f && (f = new Kf(a, e, b, c), d.push(f));
return f
};
this.releaseProgram = function(a) {
if (0 === --a.usedTimes) {
var b = d.indexOf(a);
d[b] = d[d.length - 1];
d.pop();
a.destroy()
}
};
this.programs = d
}
function Nf(a, b, c) {
function d(a) {
var h = a.target;
a = f[h.id];
null !== a.index && e(a.index);
var m = a.attributes,
k;
for (k in m) e(m[k]);
h.removeEventListener("dispose", d);
delete f[h.id];
k = b.get(h);
k.wireframe && e(k.wireframe);
b["delete"](h);
h = b.get(a);
h.wireframe && e(h.wireframe);
b["delete"](a);
c.memory.geometries--
}
function e(c) {
var d;
d = c.isInterleavedBufferAttribute ? b.get(c.data).__webglBuffer: b.get(c).__webglBuffer;
void 0 !== d && (a.deleteBuffer(d), c.isInterleavedBufferAttribute ? b["delete"](c.data) : b["delete"](c))
}
var f = {};
return {
get: function(a) {
var b = a.geometry;
if (void 0 !== f[b.id]) return f[b.id];
b.addEventListener("dispose", d);
var e;
b.isBufferGeometry ? e = b: b.isGeometry && (void 0 === b._bufferGeometry && (b._bufferGeometry = (new I).setFromObject(a)), e = b._bufferGeometry);
f[b.id] = e;
c.memory.geometries++;
return e
}
}
}
function Of(a, b, c) {
function d(c, d) {
var e = c.isInterleavedBufferAttribute ? c.data: c,
m = b.get(e);
if (void 0 === m.__webglBuffer) {
m.__webglBuffer = a.createBuffer();
a.bindBuffer(d, m.__webglBuffer);
a.bufferData(d, e.array, e.dynamic ? a.DYNAMIC_DRAW: a.STATIC_DRAW);
var k = a.FLOAT,
t = e.array;
t instanceof Float32Array ? k = a.FLOAT: t instanceof Float64Array ? console.warn("Unsupported data buffer format: Float64Array") : t instanceof Uint16Array ? k = a.UNSIGNED_SHORT: t instanceof Int16Array ? k = a.SHORT: t instanceof Uint32Array ? k = a.UNSIGNED_INT: t instanceof Int32Array ? k = a.INT: t instanceof Int8Array ? k = a.BYTE: t instanceof Uint8Array && (k = a.UNSIGNED_BYTE);
m.bytesPerElement = t.BYTES_PER_ELEMENT;
m.type = k;
m.version = e.version;
e.onUploadCallback()
} else m.version !== e.version && (a.bindBuffer(d, m.__webglBuffer), !1 === e.dynamic ? a.bufferData(d, e.array, a.STATIC_DRAW) : -1 === e.updateRange.count ? a.bufferSubData(d, 0, e.array) : 0 === e.updateRange.count ? console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually.") : (a.bufferSubData(d, e.updateRange.offset * e.array.BYTES_PER_ELEMENT, e.array.subarray(e.updateRange.offset, e.updateRange.offset + e.updateRange.count)), e.updateRange.count = 0), m.version = e.version)
}
var e = new Nf(a, b, c);
return {
getAttributeBuffer: function(a) {
return a.isInterleavedBufferAttribute ? b.get(a.data).__webglBuffer: b.get(a).__webglBuffer
},
getAttributeProperties: function(a) {
return a.isInterleavedBufferAttribute ? b.get(a.data) : b.get(a)
},
getWireframeAttribute: function(c) {
var e = b.get(c);
if (void 0 !== e.wireframe) return e.wireframe;
var h = [],
m = c.index;
c = c.attributes;
if (null !== m) {
m = m.array;
c = 0;
for (var k = m.length; c < k; c += 3) {
var t = m[c + 0],
p = m[c + 1],
n = m[c + 2];
h.push(t, p, p, n, n, t)
}
} else for (m = c.position.array, c = 0, k = m.length / 3 - 1; c < k; c += 3) t = c + 0,
p = c + 1,
n = c + 2,
h.push(t, p, p, n, n, t);
h = new(65535 < Ud(h) ? jb: ib)(h, 1);
d(h, a.ELEMENT_ARRAY_BUFFER);
return e.wireframe = h
},
update: function(b) {
var c = e.get(b);
b.geometry.isGeometry && c.updateFromObject(b);
b = c.index;
var h = c.attributes;
null !== b && d(b, a.ELEMENT_ARRAY_BUFFER);
for (var m in h) d(h[m], a.ARRAY_BUFFER);
b = c.morphAttributes;
for (m in b) for (var h = b[m], k = 0, t = h.length; k < t; k++) d(h[k], a.ARRAY_BUFFER);
return c
}
}
}
function Pf(a, b, c, d, e, f, g) {
function h(a, b) {
if (a.width > b || a.height > b) {
var c = b / Math.max(a.width, a.height),
d = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
d.width = Math.floor(a.width * c);
d.height = Math.floor(a.height * c);
d.getContext("2d").drawImage(a, 0, 0, a.width, a.height, 0, 0, d.width, d.height);
console.warn("THREE.WebGLRenderer: image is too big (" + a.width + "x" + a.height + "). Resized to " + d.width + "x" + d.height, a);
return d
}
return a
}
function m(a) {
return N.isPowerOfTwo(a.width) && N.isPowerOfTwo(a.height)
}
function k(b) {
return 1003 === b || 1004 === b || 1005 === b ? a.NEAREST: a.LINEAR
}
function t(b) {
b = b.target;
b.removeEventListener("dispose", t);
a: {
var c = d.get(b);
if (b.image && c.__image__webglTextureCube) a.deleteTexture(c.__image__webglTextureCube);
else {
if (void 0 === c.__webglInit) break a;
a.deleteTexture(c.__webglTexture)
}
d["delete"](b)
}
q.textures--
}
function p(b) {
b = b.target;
b.removeEventListener("dispose", p);
var c = d.get(b),
e = d.get(b.texture);
if (b) {
void 0 !== e.__webglTexture && a.deleteTexture(e.__webglTexture);
b.depthTexture && b.depthTexture.dispose();
if (b.isWebGLRenderTargetCube) for (e = 0; 6 > e; e++) a.deleteFramebuffer(c.__webglFramebuffer[e]),
c.__webglDepthbuffer && a.deleteRenderbuffer(c.__webglDepthbuffer[e]);
else a.deleteFramebuffer(c.__webglFramebuffer),
c.__webglDepthbuffer && a.deleteRenderbuffer(c.__webglDepthbuffer);
d["delete"](b.texture);
d["delete"](b)
}
q.textures--
}
function n(b, g) {
var k = d.get(b);
if (0 < b.version && k.__version !== b.version) {
var n = b.image;
if (void 0 === n) console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined", b);
else if (!1 === n.complete) console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete", b);
else {
void 0 === k.__webglInit && (k.__webglInit = !0, b.addEventListener("dispose", t), k.__webglTexture = a.createTexture(), q.textures++);
c.activeTexture(a.TEXTURE0 + g);
c.bindTexture(a.TEXTURE_2D, k.__webglTexture);
a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, b.flipY);
a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL, b.premultiplyAlpha);
a.pixelStorei(a.UNPACK_ALIGNMENT, b.unpackAlignment);
var p = h(b.image, e.maxTextureSize);
if ((1001 !== b.wrapS || 1001 !== b.wrapT || 1003 !== b.minFilter && 1006 !== b.minFilter) && !1 === m(p)) if (n = p, n instanceof HTMLImageElement || n instanceof HTMLCanvasElement) {
var l = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
l.width = N.nearestPowerOfTwo(n.width);
l.height = N.nearestPowerOfTwo(n.height);
l.getContext("2d").drawImage(n, 0, 0, l.width, l.height);
console.warn("THREE.WebGLRenderer: image is not power of two (" + n.width + "x" + n.height + "). Resized to " + l.width + "x" + l.height, n);
p = l
} else p = n;
var n = m(p),
l = f(b.format),
G = f(b.type);
u(a.TEXTURE_2D, b, n);
var r = b.mipmaps;
if (b.isDepthTexture) {
r = a.DEPTH_COMPONENT;
if (1015 === b.type) {
if (!w) throw Error("Float Depth Texture only supported in WebGL2.0");
r = a.DEPTH_COMPONENT32F
} else w && (r = a.DEPTH_COMPONENT16);
1026 === b.format && r === a.DEPTH_COMPONENT && 1012 !== b.type && 1014 !== b.type && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), b.type = 1012, G = f(b.type));
1027 === b.format && (r = a.DEPTH_STENCIL, 1020 !== b.type && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), b.type = 1020, G = f(b.type)));
c.texImage2D(a.TEXTURE_2D, 0, r, p.width, p.height, 0, l, G, null)
} else if (b.isDataTexture) if (0 < r.length && n) {
for (var H = 0,
aa = r.length; H < aa; H++) p = r[H],
c.texImage2D(a.TEXTURE_2D, H, l, p.width, p.height, 0, l, G, p.data);
b.generateMipmaps = !1
} else c.texImage2D(a.TEXTURE_2D, 0, l, p.width, p.height, 0, l, G, p.data);
else if (b.isCompressedTexture) for (H = 0, aa = r.length; H < aa; H++) p = r[H],
1023 !== b.format && 1022 !== b.format ? -1 < c.getCompressedTextureFormats().indexOf(l) ? c.compressedTexImage2D(a.TEXTURE_2D, H, l, p.width, p.height, 0, p.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : c.texImage2D(a.TEXTURE_2D, H, l, p.width, p.height, 0, l, G, p.data);
else if (0 < r.length && n) {
H = 0;
for (aa = r.length; H < aa; H++) p = r[H],
c.texImage2D(a.TEXTURE_2D, H, l, l, G, p);
b.generateMipmaps = !1
} else c.texImage2D(a.TEXTURE_2D, 0, l, l, G, p);
b.generateMipmaps && n && a.generateMipmap(a.TEXTURE_2D);
k.__version = b.version;
if (b.onUpdate) b.onUpdate(b);
return
}
}
c.activeTexture(a.TEXTURE0 + g);
c.bindTexture(a.TEXTURE_2D, k.__webglTexture)
}
function u(c, g, h) {
h ? (a.texParameteri(c, a.TEXTURE_WRAP_S, f(g.wrapS)), a.texParameteri(c, a.TEXTURE_WRAP_T, f(g.wrapT)), a.texParameteri(c, a.TEXTURE_MAG_FILTER, f(g.magFilter)), a.texParameteri(c, a.TEXTURE_MIN_FILTER, f(g.minFilter))) : (a.texParameteri(c, a.TEXTURE_WRAP_S, a.CLAMP_TO_EDGE), a.texParameteri(c, a.TEXTURE_WRAP_T, a.CLAMP_TO_EDGE), 1001 === g.wrapS && 1001 === g.wrapT || console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.", g), a.texParameteri(c, a.TEXTURE_MAG_FILTER, k(g.magFilter)), a.texParameteri(c, a.TEXTURE_MIN_FILTER, k(g.minFilter)), 1003 !== g.minFilter && 1006 !== g.minFilter && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.", g)); ! (h = b.get("EXT_texture_filter_anisotropic")) || 1015 === g.type && null === b.get("OES_texture_float_linear") || 1016 === g.type && null === b.get("OES_texture_half_float_linear") || !(1 < g.anisotropy || d.get(g).__currentAnisotropy) || (a.texParameterf(c, h.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(g.anisotropy, e.getMaxAnisotropy())), d.get(g).__currentAnisotropy = g.anisotropy)
}
function l(b, e, g, h) {
var m = f(e.texture.format),
k = f(e.texture.type);
c.texImage2D(h, 0, m, e.width, e.height, 0, m, k, null);
a.bindFramebuffer(a.FRAMEBUFFER, b);
a.framebufferTexture2D(a.FRAMEBUFFER, g, h, d.get(e.texture).__webglTexture, 0);
a.bindFramebuffer(a.FRAMEBUFFER, null)
}
function r(b, c) {
a.bindRenderbuffer(a.RENDERBUFFER, b);
c.depthBuffer && !c.stencilBuffer ? (a.renderbufferStorage(a.RENDERBUFFER, a.DEPTH_COMPONENT16, c.width, c.height), a.framebufferRenderbuffer(a.FRAMEBUFFER, a.DEPTH_ATTACHMENT, a.RENDERBUFFER, b)) : c.depthBuffer && c.stencilBuffer ? (a.renderbufferStorage(a.RENDERBUFFER, a.DEPTH_STENCIL, c.width, c.height), a.framebufferRenderbuffer(a.FRAMEBUFFER, a.DEPTH_STENCIL_ATTACHMENT, a.RENDERBUFFER, b)) : a.renderbufferStorage(a.RENDERBUFFER, a.RGBA4, c.width, c.height);
a.bindRenderbuffer(a.RENDERBUFFER, null)
}
var q = g.memory,
w = "undefined" !== typeof WebGL2RenderingContext && a instanceof WebGL2RenderingContext;
this.setTexture2D = n;
this.setTextureCube = function(b, g) {
var k = d.get(b);
if (6 === b.image.length) if (0 < b.version && k.__version !== b.version) {
k.__image__webglTextureCube || (b.addEventListener("dispose", t), k.__image__webglTextureCube = a.createTexture(), q.textures++);
c.activeTexture(a.TEXTURE0 + g);
c.bindTexture(a.TEXTURE_CUBE_MAP, k.__image__webglTextureCube);
a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, b.flipY);
for (var n = b && b.isCompressedTexture,
p = b.image[0] && b.image[0].isDataTexture, l = [], r = 0; 6 > r; r++) l[r] = n || p ? p ? b.image[r].image: b.image[r] : h(b.image[r], e.maxCubemapSize);
var G = m(l[0]),
w = f(b.format),
aa = f(b.type);
u(a.TEXTURE_CUBE_MAP, b, G);
for (r = 0; 6 > r; r++) if (n) for (var x, D = l[r].mipmaps, z = 0, Q = D.length; z < Q; z++) x = D[z],
1023 !== b.format && 1022 !== b.format ? -1 < c.getCompressedTextureFormats().indexOf(w) ? c.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X + r, z, w, x.width, x.height, 0, x.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X + r, z, w, x.width, x.height, 0, w, aa, x.data);
else p ? c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X + r, 0, w, l[r].width, l[r].height, 0, w, aa, l[r].data) : c.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X + r, 0, w, w, aa, l[r]);
b.generateMipmaps && G && a.generateMipmap(a.TEXTURE_CUBE_MAP);
k.__version = b.version;
if (b.onUpdate) b.onUpdate(b)
} else c.activeTexture(a.TEXTURE0 + g),
c.bindTexture(a.TEXTURE_CUBE_MAP, k.__image__webglTextureCube)
};
this.setTextureCubeDynamic = function(b, e) {
c.activeTexture(a.TEXTURE0 + e);
c.bindTexture(a.TEXTURE_CUBE_MAP, d.get(b).__webglTexture)
};
this.setupRenderTarget = function(b) {
var e = d.get(b),
f = d.get(b.texture);
b.addEventListener("dispose", p);
f.__webglTexture = a.createTexture();
q.textures++;
var g = !0 === b.isWebGLRenderTargetCube,
h = m(b);
if (g) {
e.__webglFramebuffer = [];
for (var k = 0; 6 > k; k++) e.__webglFramebuffer[k] = a.createFramebuffer()
} else e.__webglFramebuffer = a.createFramebuffer();
if (g) {
c.bindTexture(a.TEXTURE_CUBE_MAP, f.__webglTexture);
u(a.TEXTURE_CUBE_MAP, b.texture, h);
for (k = 0; 6 > k; k++) l(e.__webglFramebuffer[k], b, a.COLOR_ATTACHMENT0, a.TEXTURE_CUBE_MAP_POSITIVE_X + k);
b.texture.generateMipmaps && h && a.generateMipmap(a.TEXTURE_CUBE_MAP);
c.bindTexture(a.TEXTURE_CUBE_MAP, null)
} else c.bindTexture(a.TEXTURE_2D, f.__webglTexture),
u(a.TEXTURE_2D, b.texture, h),
l(e.__webglFramebuffer, b, a.COLOR_ATTACHMENT0, a.TEXTURE_2D),
b.texture.generateMipmaps && h && a.generateMipmap(a.TEXTURE_2D),
c.bindTexture(a.TEXTURE_2D, null);
if (b.depthBuffer) {
e = d.get(b);
f = !0 === b.isWebGLRenderTargetCube;
if (b.depthTexture) {
if (f) throw Error("target.depthTexture not supported in Cube render targets");
if (b && b.isWebGLRenderTargetCube) throw Error("Depth Texture with cube render targets is not supported!");
a.bindFramebuffer(a.FRAMEBUFFER, e.__webglFramebuffer);
if (!b.depthTexture || !b.depthTexture.isDepthTexture) throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");
d.get(b.depthTexture).__webglTexture && b.depthTexture.image.width === b.width && b.depthTexture.image.height === b.height || (b.depthTexture.image.width = b.width, b.depthTexture.image.height = b.height, b.depthTexture.needsUpdate = !0);
n(b.depthTexture, 0);
e = d.get(b.depthTexture).__webglTexture;
if (1026 === b.depthTexture.format) a.framebufferTexture2D(a.FRAMEBUFFER, a.DEPTH_ATTACHMENT, a.TEXTURE_2D, e, 0);
else if (1027 === b.depthTexture.format) a.framebufferTexture2D(a.FRAMEBUFFER, a.DEPTH_STENCIL_ATTACHMENT, a.TEXTURE_2D, e, 0);
else throw Error("Unknown depthTexture format");
} else if (f) for (e.__webglDepthbuffer = [], f = 0; 6 > f; f++) a.bindFramebuffer(a.FRAMEBUFFER, e.__webglFramebuffer[f]),
e.__webglDepthbuffer[f] = a.createRenderbuffer(),
r(e.__webglDepthbuffer[f], b);
else a.bindFramebuffer(a.FRAMEBUFFER, e.__webglFramebuffer),
e.__webglDepthbuffer = a.createRenderbuffer(),
r(e.__webglDepthbuffer, b);
a.bindFramebuffer(a.FRAMEBUFFER, null)
}
};
this.updateRenderTargetMipmap = function(b) {
var e = b.texture;
e.generateMipmaps && m(b) && 1003 !== e.minFilter && 1006 !== e.minFilter && (b = b && b.isWebGLRenderTargetCube ? a.TEXTURE_CUBE_MAP: a.TEXTURE_2D, e = d.get(e).__webglTexture, c.bindTexture(b, e), a.generateMipmap(b), c.bindTexture(b, null))
}
}
function Qf() {
var a = {};
return {
get: function(b) {
b = b.uuid;
var c = a[b];
void 0 === c && (c = {},
a[b] = c);
return c
},
"delete": function(b) {
delete a[b.uuid]
},
clear: function() {
a = {}
}
}
}
function Rf(a, b, c) {
function d(b, c, d) {
var e = new Uint8Array(4),
f = a.createTexture();
a.bindTexture(b, f);
a.texParameteri(b, a.TEXTURE_MIN_FILTER, a.NEAREST);
a.texParameteri(b, a.TEXTURE_MAG_FILTER, a.NEAREST);
for (b = 0; b < d; b++) a.texImage2D(c + b, 0, a.RGBA, 1, 1, 0, a.RGBA, a.UNSIGNED_BYTE, e);
return f
}
function e(b) { ! 0 !== y[b] && (a.enable(b), y[b] = !0)
}
function f(b) { ! 1 !== y[b] && (a.disable(b), y[b] = !1)
}
function g(b, d, g, h, m, k, n, t) {
0 !== b ? e(a.BLEND) : f(a.BLEND);
if (b !== v || t !== x) 2 === b ? t ? (a.blendEquationSeparate(a.FUNC_ADD, a.FUNC_ADD), a.blendFuncSeparate(a.ONE, a.ONE, a.ONE, a.ONE)) : (a.blendEquation(a.FUNC_ADD), a.blendFunc(a.SRC_ALPHA, a.ONE)) : 3 === b ? t ? (a.blendEquationSeparate(a.FUNC_ADD, a.FUNC_ADD), a.blendFuncSeparate(a.ZERO, a.ZERO, a.ONE_MINUS_SRC_COLOR, a.ONE_MINUS_SRC_ALPHA)) : (a.blendEquation(a.FUNC_ADD), a.blendFunc(a.ZERO, a.ONE_MINUS_SRC_COLOR)) : 4 === b ? t ? (a.blendEquationSeparate(a.FUNC_ADD, a.FUNC_ADD), a.blendFuncSeparate(a.ZERO, a.SRC_COLOR, a.ZERO, a.SRC_ALPHA)) : (a.blendEquation(a.FUNC_ADD), a.blendFunc(a.ZERO, a.SRC_COLOR)) : t ? (a.blendEquationSeparate(a.FUNC_ADD, a.FUNC_ADD), a.blendFuncSeparate(a.ONE, a.ONE_MINUS_SRC_ALPHA, a.ONE, a.ONE_MINUS_SRC_ALPHA)) : (a.blendEquationSeparate(a.FUNC_ADD, a.FUNC_ADD), a.blendFuncSeparate(a.SRC_ALPHA, a.ONE_MINUS_SRC_ALPHA, a.ONE, a.ONE_MINUS_SRC_ALPHA)),
v = b,
x = t;
if (5 === b) {
m = m || d;
k = k || g;
n = n || h;
if (d !== E || m !== F) a.blendEquationSeparate(c(d), c(m)),
E = d,
F = m;
if (g !== L || h !== C || k !== da || n !== H) a.blendFuncSeparate(c(g), c(h), c(k), c(n)),
L = g,
C = h,
da = k,
H = n
} else H = da = F = C = L = E = null
}
function h(a) {
n.setFunc(a)
}
function m(b) {
D !== b && (b ? a.frontFace(a.CW) : a.frontFace(a.CCW), D = b)
}
function k(b) {
0 !== b ? (e(a.CULL_FACE), b !== z && (1 === b ? a.cullFace(a.BACK) : 2 === b ? a.cullFace(a.FRONT) : a.cullFace(a.FRONT_AND_BACK))) : f(a.CULL_FACE);
z = b
}
function t(b) {
void 0 === b && (b = a.TEXTURE0 + P - 1);
W !== b && (a.activeTexture(b), W = b)
}
var p = new
function() {
var b = !1,
c = new fa,
d = null,
e = new fa;
return {
setMask: function(c) {
d === c || b || (a.colorMask(c, c, c, c), d = c)
},
setLocked: function(a) {
b = a
},
setClear: function(b, d, f, g, h) { ! 0 === h && (b *= g, d *= g, f *= g);
c.set(b, d, f, g); ! 1 === e.equals(c) && (a.clearColor(b, d, f, g), e.copy(c))
},
reset: function() {
b = !1;
d = null;
e.set(0, 0, 0, 1)
}
}
},
n = new
function() {
var b = !1,
c = null,
d = null,
g = null;
return {
setTest: function(b) {
b ? e(a.DEPTH_TEST) : f(a.DEPTH_TEST)
},
setMask: function(d) {
c === d || b || (a.depthMask(d), c = d)
},
setFunc: function(b) {
if (d !== b) {
if (b) switch (b) {
case 0:
a.depthFunc(a.NEVER);
break;
case 1:
a.depthFunc(a.ALWAYS);
break;
case 2:
a.depthFunc(a.LESS);
break;
case 3:
a.depthFunc(a.LEQUAL);
break;
case 4:
a.depthFunc(a.EQUAL);
break;
case 5:
a.depthFunc(a.GEQUAL);
break;
case 6:
a.depthFunc(a.GREATER);
break;
case 7:
a.depthFunc(a.NOTEQUAL);
break;
default:
a.depthFunc(a.LEQUAL)
} else a.depthFunc(a.LEQUAL);
d = b
}
},
setLocked: function(a) {
b = a
},
setClear: function(b) {
g !== b && (a.clearDepth(b), g = b)
},
reset: function() {
b = !1;
g = d = c = null
}
}
},
u = new
function() {
var b = !1,
c = null,
d = null,
g = null,
h = null,
m = null,
k = null,
n = null,
t = null;
return {
setTest: function(b) {
b ? e(a.STENCIL_TEST) : f(a.STENCIL_TEST)
},
setMask: function(d) {
c === d || b || (a.stencilMask(d), c = d)
},
setFunc: function(b, c, e) {
if (d !== b || g !== c || h !== e) a.stencilFunc(b, c, e),
d = b,
g = c,
h = e
},
setOp: function(b, c, d) {
if (m !== b || k !== c || n !== d) a.stencilOp(b, c, d),
m = b,
k = c,
n = d
},
setLocked: function(a) {
b = a
},
setClear: function(b) {
t !== b && (a.clearStencil(b), t = b)
},
reset: function() {
b = !1;
t = n = k = m = h = g = d = c = null
}
}
},
l = a.getParameter(a.MAX_VERTEX_ATTRIBS),
r = new Uint8Array(l),
q = new Uint8Array(l),
w = new Uint8Array(l),
y = {},
K = null,
v = null,
E = null,
L = null,
C = null,
F = null,
da = null,
H = null,
x = !1,
D = null,
z = null,
J = null,
Q = null,
M = null,
O = null,
P = a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),
l = parseFloat(/^WebGL\ ([0-9])/.exec(a.getParameter(a.VERSION))[1]),
I = 1 <= parseFloat(l),
W = null,
S = {},
R = new fa,
T = new fa,
N = {};
N[a.TEXTURE_2D] = d(a.TEXTURE_2D, a.TEXTURE_2D, 1);
N[a.TEXTURE_CUBE_MAP] = d(a.TEXTURE_CUBE_MAP, a.TEXTURE_CUBE_MAP_POSITIVE_X, 6);
return {
buffers: {
color: p,
depth: n,
stencil: u
},
init: function() {
p.setClear(0, 0, 0, 1);
n.setClear(1);
u.setClear(0);
e(a.DEPTH_TEST);
h(3);
m(!1);
k(1);
e(a.CULL_FACE);
e(a.BLEND);
g(1)
},
initAttributes: function() {
for (var a = 0,
b = r.length; a < b; a++) r[a] = 0
},
enableAttribute: function(c) {
r[c] = 1;
0 === q[c] && (a.enableVertexAttribArray(c), q[c] = 1);
0 !== w[c] && (b.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(c, 0), w[c] = 0)
},
enableAttributeAndDivisor: function(b, c, d) {
r[b] = 1;
0 === q[b] && (a.enableVertexAttribArray(b), q[b] = 1);
w[b] !== c && (d.vertexAttribDivisorANGLE(b, c), w[b] = c)
},
disableUnusedAttributes: function() {
for (var b = 0,
c = q.length; b !== c; ++b) q[b] !== r[b] && (a.disableVertexAttribArray(b), q[b] = 0)
},
enable: e,
disable: f,
getCompressedTextureFormats: function() {
if (null === K && (K = [], b.get("WEBGL_compressed_texture_pvrtc") || b.get("WEBGL_compressed_texture_s3tc") || b.get("WEBGL_compressed_texture_etc1"))) for (var c = a.getParameter(a.COMPRESSED_TEXTURE_FORMATS), d = 0; d < c.length; d++) K.push(c[d]);
return K
},
setBlending: g,
setColorWrite: function(a) {
p.setMask(a)
},
setDepthTest: function(a) {
n.setTest(a)
},
setDepthWrite: function(a) {
n.setMask(a)
},
setDepthFunc: h,
setStencilTest: function(a) {
u.setTest(a)
},
setStencilWrite: function(a) {
u.setMask(a)
},
setStencilFunc: function(a, b, c) {
u.setFunc(a, b, c)
},
setStencilOp: function(a, b, c) {
u.setOp(a, b, c)
},
setFlipSided: m,
setCullFace: k,
setLineWidth: function(b) {
b !== J && (I && a.lineWidth(b), J = b)
},
setPolygonOffset: function(b, c, d) {
if (b) {
if (e(a.POLYGON_OFFSET_FILL), Q !== c || M !== d) a.polygonOffset(c, d),
Q = c,
M = d
} else f(a.POLYGON_OFFSET_FILL)
},
getScissorTest: function() {
return O
},
setScissorTest: function(b) { (O = b) ? e(a.SCISSOR_TEST) : f(a.SCISSOR_TEST)
},
activeTexture: t,
bindTexture: function(b, c) {
null === W && t();
var d = S[W];
void 0 === d && (d = {
type: void 0,
texture: void 0
},
S[W] = d);
if (d.type !== b || d.texture !== c) a.bindTexture(b, c || N[b]),
d.type = b,
d.texture = c
},
compressedTexImage2D: function() {
try {
a.compressedTexImage2D.apply(a, arguments)
} catch(b) {
console.error(b)
}
},
texImage2D: function() {
try {
a.texImage2D.apply(a, arguments)
} catch(b) {
console.error(b)
}
},
scissor: function(b) { ! 1 === R.equals(b) && (a.scissor(b.x, b.y, b.z, b.w), R.copy(b))
},
viewport: function(b) { ! 1 === T.equals(b) && (a.viewport(b.x, b.y, b.z, b.w), T.copy(b))
},
reset: function() {
for (var b = 0; b < q.length; b++) 1 === q[b] && (a.disableVertexAttribArray(b), q[b] = 0);
y = {};
W = K = null;
S = {};
z = D = v = null;
p.reset();
n.reset();
u.reset()
}
}
}
function Sf(a, b, c) {
function d(b) {
if ("highp" === b) {
if (0 < a.getShaderPrecisionFormat(a.VERTEX_SHADER, a.HIGH_FLOAT).precision && 0 < a.getShaderPrecisionFormat(a.FRAGMENT_SHADER, a.HIGH_FLOAT).precision) return "highp";
b = "mediump"
}
return "mediump" === b && 0 < a.getShaderPrecisionFormat(a.VERTEX_SHADER, a.MEDIUM_FLOAT).precision && 0 < a.getShaderPrecisionFormat(a.FRAGMENT_SHADER, a.MEDIUM_FLOAT).precision ? "mediump": "lowp"
}
var e, f = void 0 !== c.precision ? c.precision: "highp",
g = d(f);
g !== f && (console.warn("THREE.WebGLRenderer:", f, "not supported, using", g, "instead."), f = g);
c = !0 === c.logarithmicDepthBuffer && !!b.get("EXT_frag_depth");
var g = a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS),
h = a.getParameter(a.MAX_VERTEX_TEXTURE_IMAGE_UNITS),
m = a.getParameter(a.MAX_TEXTURE_SIZE),
k = a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE),
t = a.getParameter(a.MAX_VERTEX_ATTRIBS),
p = a.getParameter(a.MAX_VERTEX_UNIFORM_VECTORS),
n = a.getParameter(a.MAX_VARYING_VECTORS),
u = a.getParameter(a.MAX_FRAGMENT_UNIFORM_VECTORS),
l = 0 < h,
r = !!b.get("OES_texture_float");
return {
getMaxAnisotropy: function() {
if (void 0 !== e) return e;
var c = b.get("EXT_texture_filter_anisotropic");
return e = null !== c ? a.getParameter(c.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0
},
getMaxPrecision: d,
precision: f,
logarithmicDepthBuffer: c,
maxTextures: g,
maxVertexTextures: h,
maxTextureSize: m,
maxCubemapSize: k,
maxAttributes: t,
maxVertexUniforms: p,
maxVaryings: n,
maxFragmentUniforms: u,
vertexTextures: l,
floatFragmentTextures: r,
floatVertexTextures: l && r
}
}
function Tf(a) {
var b = {};
return {
get: function(c) {
if (void 0 !== b[c]) return b[c];
var d;
switch (c) {
case "WEBGL_depth_texture":
d = a.getExtension("WEBGL_depth_texture") || a.getExtension("MOZ_WEBGL_depth_texture") || a.getExtension("WEBKIT_WEBGL_depth_texture");
break;
case "EXT_texture_filter_anisotropic":
d = a.getExtension("EXT_texture_filter_anisotropic") || a.getExtension("MOZ_EXT_texture_filter_anisotropic") || a.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
break;
case "WEBGL_compressed_texture_s3tc":
d = a.getExtension("WEBGL_compressed_texture_s3tc") || a.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || a.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
break;
case "WEBGL_compressed_texture_pvrtc":
d = a.getExtension("WEBGL_compressed_texture_pvrtc") || a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");
break;
case "WEBGL_compressed_texture_etc1":
d = a.getExtension("WEBGL_compressed_texture_etc1");
break;
default:
d = a.getExtension(c)
}
null === d && console.warn("THREE.WebGLRenderer: " + c + " extension not supported.");
return b[c] = d
}
}
}
function Uf() {
function a() {
k.value !== d && (k.value = d, k.needsUpdate = 0 < e);
c.numPlanes = e;
c.numIntersection = 0
}
function b(a, b, d, e) {
var f = null !== a ? a.length: 0,
g = null;
if (0 !== f) {
g = k.value;
if (!0 !== e || null === g) {
e = d + 4 * f;
b = b.matrixWorldInverse;
m.getNormalMatrix(b);
if (null === g || g.length < e) g = new Float32Array(e);
for (e = 0; e !== f; ++e, d += 4) h.copy(a[e]).applyMatrix4(b, m),
h.normal.toArray(g, d),
g[d + 3] = h.constant
}
k.value = g;
k.needsUpdate = !0
}
c.numPlanes = f;
return g
}
var c = this,
d = null,
e = 0,
f = !1,
g = !1,
h = new la,
m = new ya,
k = {
value: null,
needsUpdate: !1
};
this.uniform = k;
this.numIntersection = this.numPlanes = 0;
this.init = function(a, c, g) {
var h = 0 !== a.length || c || 0 !== e || f;
f = c;
d = b(a, g, 0);
e = a.length;
return h
};
this.beginShadows = function() {
g = !0;
b(null)
};
this.endShadows = function() {
g = !1;
a()
};
this.setState = function(c, h, m, l, G, r) {
if (!f || null === c || 0 === c.length || g && !m) g ? b(null) : a();
else {
m = g ? 0 : e;
var q = 4 * m,
w = G.clippingState || null;
k.value = w;
w = b(c, l, q, r);
for (c = 0; c !== q; ++c) w[c] = d[c];
G.clippingState = w;
this.numIntersection = h ? this.numPlanes: 0;
this.numPlanes += m
}
}
}
function Yd(a) {
function b() {
Y.init();
Y.scissor(X.copy(ga).multiplyScalar(Ra));
Y.viewport(Z.copy(ia).multiplyScalar(Ra));
Y.buffers.color.setClear(Ea.r, Ea.g, Ea.b, gb, F)
}
function c() {
U = wa = null;
V = "";
R = -1;
Y.reset()
}
function d(a) {
a.preventDefault();
c();
b();
ha.clear()
}
function e(a) {
a = a.target;
a.removeEventListener("dispose", e);
f(a);
ha["delete"](a)
}
function f(a) {
var b = ha.get(a).program;
a.program = void 0;
void 0 !== b && ya.releaseProgram(b)
}
function g(a, b) {
return Math.abs(b[0]) - Math.abs(a[0])
}
function h(a, b) {
return a.object.renderOrder !== b.object.renderOrder ? a.object.renderOrder - b.object.renderOrder: a.material.program && b.material.program && a.material.program !== b.material.program ? a.material.program.id - b.material.program.id: a.material.id !== b.material.id ? a.material.id - b.material.id: a.z !== b.z ? a.z - b.z: a.id - b.id
}
function m(a, b) {
return a.object.renderOrder !== b.object.renderOrder ? a.object.renderOrder - b.object.renderOrder: a.z !== b.z ? b.z - a.z: a.id - b.id
}
function k(a, b, c, d, e) {
var f;
c.transparent ? (d = z, f = ++T) : (d = aa, f = ++D);
f = d[f];
void 0 !== f ? (f.id = a.id, f.object = a, f.geometry = b, f.material = c, f.z = Ga.z, f.group = e) : (f = {
id: a.id,
object: a,
geometry: b,
material: c,
z: Ga.z,
group: e
},
d.push(f))
}
function t(a) {
if (!ma.intersectsSphere(a)) return ! 1;
var b = ca.numPlanes;
if (0 === b) return ! 0;
var c = P.clippingPlanes,
d = a.center;
a = -a.radius;
var e = 0;
do
if (c[e].distanceToPoint(d) < a) return ! 1;
while (++e !== b);
return ! 0
}
function p(a, b) {
if (!1 !== a.visible) {
if (0 !== (a.layers.mask & b.layers.mask)) if (a.isLight) H.push(a);
else if (a.isSprite) {
var c; (c = !1 === a.frustumCulled) || (na.center.set(0, 0, 0), na.radius = .7071067811865476, na.applyMatrix4(a.matrixWorld), c = !0 === t(na));
c && M.push(a)
} else if (a.isLensFlare) O.push(a);
else if (a.isImmediateRenderObject) ! 0 === P.sortObjects && (Ga.setFromMatrixPosition(a.matrixWorld), Ga.applyMatrix4(ua)),
k(a, null, a.material, Ga.z, null);
else if (a.isMesh || a.isLine || a.isPoints) if (a.isSkinnedMesh && a.skeleton.update(), (c = !1 === a.frustumCulled) || (c = a.geometry, null === c.boundingSphere && c.computeBoundingSphere(), na.copy(c.boundingSphere).applyMatrix4(a.matrixWorld), c = !0 === t(na)), c) {
var d = a.material;
if (!0 === d.visible) if (!0 === P.sortObjects && (Ga.setFromMatrixPosition(a.matrixWorld), Ga.applyMatrix4(ua)), c = qa.update(a), d.isMultiMaterial) for (var e = c.groups,
f = d.materials,
d = 0,
g = e.length; d < g; d++) {
var h = e[d],
m = f[h.materialIndex]; ! 0 === m.visible && k(a, c, m, Ga.z, h)
} else k(a, c, d, Ga.z, null)
}
c = a.children;
d = 0;
for (g = c.length; d < g; d++) p(c[d], b)
}
}
function n(a, b, c, d) {
for (var e = 0,
f = a.length; e < f; e++) {
var g = a[e],
h = g.object,
m = g.geometry,
k = void 0 === d ? g.material: d,
g = g.group;
h.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse, h.matrixWorld);
h.normalMatrix.getNormalMatrix(h.modelViewMatrix);
h.onBeforeRender(P, b, c, m, k, g);
if (h.isImmediateRenderObject) {
l(k);
var n = G(c, b.fog, k, h);
V = "";
h.render(function(a) {
P.renderBufferImmediate(a, n, k)
})
} else P.renderBufferDirect(c, b.fog, m, k, h, g);
h.onAfterRender(P, b, c, m, k, g)
}
}
function l(a) {
2 === a.side ? Y.disable(B.CULL_FACE) : Y.enable(B.CULL_FACE);
Y.setFlipSided(1 === a.side); ! 0 === a.transparent ? Y.setBlending(a.blending, a.blendEquation, a.blendSrc, a.blendDst, a.blendEquationAlpha, a.blendSrcAlpha, a.blendDstAlpha, a.premultipliedAlpha) : Y.setBlending(0);
Y.setDepthFunc(a.depthFunc);
Y.setDepthTest(a.depthTest);
Y.setDepthWrite(a.depthWrite);
Y.setColorWrite(a.colorWrite);
Y.setPolygonOffset(a.polygonOffset, a.polygonOffsetFactor, a.polygonOffsetUnits)
}
function G(a, b, c, d) {
ea = 0;
var g = ha.get(c);
oa && (ra || a !== U) && ca.setState(c.clippingPlanes, c.clipIntersection, c.clipShadows, a, g, a === U && c.id === R); ! 1 === c.needsUpdate && (void 0 === g.program ? c.needsUpdate = !0 : c.fog && g.fog !== b ? c.needsUpdate = !0 : c.lights && g.lightsHash !== ba.hash ? c.needsUpdate = !0 : void 0 === g.numClippingPlanes || g.numClippingPlanes === ca.numPlanes && g.numIntersection === ca.numIntersection || (c.needsUpdate = !0));
if (c.needsUpdate) {
a: {
var h = ha.get(c),
m = ya.getParameters(c, ba, b, ca.numPlanes, ca.numIntersection, d),
k = ya.getProgramCode(c, m),
n = h.program,
t = !0;
if (void 0 === n) c.addEventListener("dispose", e);
else if (n.code !== k) f(c);
else if (void 0 !== m.shaderID) break a;
else t = !1;
t && (m.shaderID ? (n = bb[m.shaderID], h.__webglShader = {
name: c.type,
uniforms: Ja.clone(n.uniforms),
vertexShader: n.vertexShader,
fragmentShader: n.fragmentShader
}) : h.__webglShader = {
name: c.type,
uniforms: c.uniforms,
vertexShader: c.vertexShader,
fragmentShader: c.fragmentShader
},
c.__webglShader = h.__webglShader, n = ya.acquireProgram(c, m, k), h.program = n, c.program = n);
m = n.getAttributes();
if (c.morphTargets) for (k = c.numSupportedMorphTargets = 0; k < P.maxMorphTargets; k++) 0 <= m["morphTarget" + k] && c.numSupportedMorphTargets++;
if (c.morphNormals) for (k = c.numSupportedMorphNormals = 0; k < P.maxMorphNormals; k++) 0 <= m["morphNormal" + k] && c.numSupportedMorphNormals++;
m = h.__webglShader.uniforms;
if (!c.isShaderMaterial && !c.isRawShaderMaterial || !0 === c.clipping) h.numClippingPlanes = ca.numPlanes,
h.numIntersection = ca.numIntersection,
m.clippingPlanes = ca.uniform;
h.fog = b;
h.lightsHash = ba.hash;
c.lights && (m.ambientLightColor.value = ba.ambient, m.directionalLights.value = ba.directional, m.spotLights.value = ba.spot, m.rectAreaLights.value = ba.rectArea, m.pointLights.value = ba.point, m.hemisphereLights.value = ba.hemi, m.directionalShadowMap.value = ba.directionalShadowMap, m.directionalShadowMatrix.value = ba.directionalShadowMatrix, m.spotShadowMap.value = ba.spotShadowMap, m.spotShadowMatrix.value = ba.spotShadowMatrix, m.pointShadowMap.value = ba.pointShadowMap, m.pointShadowMatrix.value = ba.pointShadowMatrix);
k = h.program.getUniforms();
m = $a.seqWithValue(k.seq, m);
h.uniformsList = m
}
c.needsUpdate = !1
}
var p = !1,
t = n = !1,
h = g.program,
m = h.getUniforms(),
k = g.__webglShader.uniforms;
h.id !== wa && (B.useProgram(h.program), wa = h.id, t = n = p = !0);
c.id !== R && (R = c.id, n = !0);
if (p || a !== U) {
m.set(B, a, "projectionMatrix");
la.logarithmicDepthBuffer && m.setValue(B, "logDepthBufFC", 2 / (Math.log(a.far + 1) / Math.LN2));
a !== U && (U = a, t = n = !0);
if (c.isShaderMaterial || c.isMeshPhongMaterial || c.isMeshStandardMaterial || c.envMap) p = m.map.cameraPosition,
void 0 !== p && p.setValue(B, Ga.setFromMatrixPosition(a.matrixWorld)); (c.isMeshPhongMaterial || c.isMeshLambertMaterial || c.isMeshBasicMaterial || c.isMeshStandardMaterial || c.isShaderMaterial || c.skinning) && m.setValue(B, "viewMatrix", a.matrixWorldInverse);
m.set(B, P, "toneMappingExposure");
m.set(B, P, "toneMappingWhitePoint")
}
c.skinning && (m.setOptional(B, d, "bindMatrix"), m.setOptional(B, d, "bindMatrixInverse"), a = d.skeleton) && (la.floatVertexTextures && a.useVertexTexture ? (m.set(B, a, "boneTexture"), m.set(B, a, "boneTextureWidth"), m.set(B, a, "boneTextureHeight")) : m.setOptional(B, a, "boneMatrices"));
if (n) {
c.lights && (a = t, k.ambientLightColor.needsUpdate = a, k.directionalLights.needsUpdate = a, k.pointLights.needsUpdate = a, k.spotLights.needsUpdate = a, k.rectAreaLights.needsUpdate = a, k.hemisphereLights.needsUpdate = a);
b && c.fog && (k.fogColor.value = b.color, b.isFog ? (k.fogNear.value = b.near, k.fogFar.value = b.far) : b.isFogExp2 && (k.fogDensity.value = b.density));
if (c.isMeshBasicMaterial || c.isMeshLambertMaterial || c.isMeshPhongMaterial || c.isMeshStandardMaterial || c.isMeshNormalMaterial || c.isMeshDepthMaterial) {
k.opacity.value = c.opacity;
k.diffuse.value = c.color;
c.emissive && k.emissive.value.copy(c.emissive).multiplyScalar(c.emissiveIntensity);
k.map.value = c.map;
k.specularMap.value = c.specularMap;
k.alphaMap.value = c.alphaMap;
c.lightMap && (k.lightMap.value = c.lightMap, k.lightMapIntensity.value = c.lightMapIntensity);
c.aoMap && (k.aoMap.value = c.aoMap, k.aoMapIntensity.value = c.aoMapIntensity);
var l;
c.map ? l = c.map: c.specularMap ? l = c.specularMap: c.displacementMap ? l = c.displacementMap: c.normalMap ? l = c.normalMap: c.bumpMap ? l = c.bumpMap: c.roughnessMap ? l = c.roughnessMap: c.metalnessMap ? l = c.metalnessMap: c.alphaMap ? l = c.alphaMap: c.emissiveMap && (l = c.emissiveMap);
void 0 !== l && (l.isWebGLRenderTarget && (l = l.texture), b = l.offset, l = l.repeat, k.offsetRepeat.value.set(b.x, b.y, l.x, l.y));
k.envMap.value = c.envMap;
k.flipEnvMap.value = c.envMap && c.envMap.isCubeTexture ? -1 : 1;
k.reflectivity.value = c.reflectivity;
k.refractionRatio.value = c.refractionRatio
}
c.isLineBasicMaterial ? (k.diffuse.value = c.color, k.opacity.value = c.opacity) : c.isLineDashedMaterial ? (k.diffuse.value = c.color, k.opacity.value = c.opacity, k.dashSize.value = c.dashSize, k.totalSize.value = c.dashSize + c.gapSize, k.scale.value = c.scale) : c.isPointsMaterial ? (k.diffuse.value = c.color, k.opacity.value = c.opacity, k.size.value = c.size * Ra, k.scale.value = .5 * Cc, k.map.value = c.map, null !== c.map && (l = c.map.offset, c = c.map.repeat, k.offsetRepeat.value.set(l.x, l.y, c.x, c.y))) : c.isMeshLambertMaterial ? c.emissiveMap && (k.emissiveMap.value = c.emissiveMap) : c.isMeshToonMaterial ? (r(k, c), c.gradientMap && (k.gradientMap.value = c.gradientMap)) : c.isMeshPhongMaterial ? r(k, c) : c.isMeshPhysicalMaterial ? (k.clearCoat.value = c.clearCoat, k.clearCoatRoughness.value = c.clearCoatRoughness, A(k, c)) : c.isMeshStandardMaterial ? A(k, c) : c.isMeshDepthMaterial ? c.displacementMap && (k.displacementMap.value = c.displacementMap, k.displacementScale.value = c.displacementScale, k.displacementBias.value = c.displacementBias) : c.isMeshNormalMaterial && (c.bumpMap && (k.bumpMap.value = c.bumpMap, k.bumpScale.value = c.bumpScale), c.normalMap && (k.normalMap.value = c.normalMap, k.normalScale.value.copy(c.normalScale)), c.displacementMap && (k.displacementMap.value = c.displacementMap, k.displacementScale.value = c.displacementScale, k.displacementBias.value = c.displacementBias));
void 0 !== k.ltcMat && (k.ltcMat.value = THREE.UniformsLib.LTC_MAT_TEXTURE);
void 0 !== k.ltcMag && (k.ltcMag.value = THREE.UniformsLib.LTC_MAG_TEXTURE);
$a.upload(B, g.uniformsList, k, P)
}
m.set(B, d, "modelViewMatrix");
m.set(B, d, "normalMatrix");
m.setValue(B, "modelMatrix", d.matrixWorld);
return h
}
function r(a, b) {
a.specular.value = b.specular;
a.shininess.value = Math.max(b.shininess, 1E-4);
b.emissiveMap && (a.emissiveMap.value = b.emissiveMap);
b.bumpMap && (a.bumpMap.value = b.bumpMap, a.bumpScale.value = b.bumpScale);
b.normalMap && (a.normalMap.value = b.normalMap, a.normalScale.value.copy(b.normalScale));
b.displacementMap && (a.displacementMap.value = b.displacementMap, a.displacementScale.value = b.displacementScale, a.displacementBias.value = b.displacementBias)
}
function A(a, b) {
a.roughness.value = b.roughness;
a.metalness.value = b.metalness;
b.roughnessMap && (a.roughnessMap.value = b.roughnessMap);
b.metalnessMap && (a.metalnessMap.value = b.metalnessMap);
b.emissiveMap && (a.emissiveMap.value = b.emissiveMap);
b.bumpMap && (a.bumpMap.value = b.bumpMap, a.bumpScale.value = b.bumpScale);
b.normalMap && (a.normalMap.value = b.normalMap, a.normalScale.value.copy(b.normalScale));
b.displacementMap && (a.displacementMap.value = b.displacementMap, a.displacementScale.value = b.displacementScale, a.displacementBias.value = b.displacementBias);
b.envMap && (a.envMapIntensity.value = b.envMapIntensity)
}
function w(a) {
var b;
if (1E3 === a) return B.REPEAT;
if (1001 === a) return B.CLAMP_TO_EDGE;
if (1002 === a) return B.MIRRORED_REPEAT;
if (1003 === a) return B.NEAREST;
if (1004 === a) return B.NEAREST_MIPMAP_NEAREST;
if (1005 === a) return B.NEAREST_MIPMAP_LINEAR;
if (1006 === a) return B.LINEAR;
if (1007 === a) return B.LINEAR_MIPMAP_NEAREST;
if (1008 === a) return B.LINEAR_MIPMAP_LINEAR;
if (1009 === a) return B.UNSIGNED_BYTE;
if (1017 === a) return B.UNSIGNED_SHORT_4_4_4_4;
if (1018 === a) return B.UNSIGNED_SHORT_5_5_5_1;
if (1019 === a) return B.UNSIGNED_SHORT_5_6_5;
if (1010 === a) return B.BYTE;
if (1011 === a) return B.SHORT;
if (1012 === a) return B.UNSIGNED_SHORT;
if (1013 === a) return B.INT;
if (1014 === a) return B.UNSIGNED_INT;
if (1015 === a) return B.FLOAT;
if (1016 === a && (b = ja.get("OES_texture_half_float"), null !== b)) return b.HALF_FLOAT_OES;
if (1021 === a) return B.ALPHA;
if (1022 === a) return B.RGB;
if (1023 === a) return B.RGBA;
if (1024 === a) return B.LUMINANCE;
if (1025 === a) return B.LUMINANCE_ALPHA;
if (1026 === a) return B.DEPTH_COMPONENT;
if (1027 === a) return B.DEPTH_STENCIL;
if (100 === a) return B.FUNC_ADD;
if (101 === a) return B.FUNC_SUBTRACT;
if (102 === a) return B.FUNC_REVERSE_SUBTRACT;
if (200 === a) return B.ZERO;
if (201 === a) return B.ONE;
if (202 === a) return B.SRC_COLOR;
if (203 === a) return B.ONE_MINUS_SRC_COLOR;
if (204 === a) return B.SRC_ALPHA;
if (205 === a) return B.ONE_MINUS_SRC_ALPHA;
if (206 === a) return B.DST_ALPHA;
if (207 === a) return B.ONE_MINUS_DST_ALPHA;
if (208 === a) return B.DST_COLOR;
if (209 === a) return B.ONE_MINUS_DST_COLOR;
if (210 === a) return B.SRC_ALPHA_SATURATE;
if (2001 === a || 2002 === a || 2003 === a || 2004 === a) if (b = ja.get("WEBGL_compressed_texture_s3tc"), null !== b) {
if (2001 === a) return b.COMPRESSED_RGB_S3TC_DXT1_EXT;
if (2002 === a) return b.COMPRESSED_RGBA_S3TC_DXT1_EXT;
if (2003 === a) return b.COMPRESSED_RGBA_S3TC_DXT3_EXT;
if (2004 === a) return b.COMPRESSED_RGBA_S3TC_DXT5_EXT
}
if (2100 === a || 2101 === a || 2102 === a || 2103 === a) if (b = ja.get("WEBGL_compressed_texture_pvrtc"), null !== b) {
if (2100 === a) return b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
if (2101 === a) return b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
if (2102 === a) return b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
if (2103 === a) return b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
}
if (2151 === a && (b = ja.get("WEBGL_compressed_texture_etc1"), null !== b)) return b.COMPRESSED_RGB_ETC1_WEBGL;
if (103 === a || 104 === a) if (b = ja.get("EXT_blend_minmax"), null !== b) {
if (103 === a) return b.MIN_EXT;
if (104 === a) return b.MAX_EXT
}
return 1020 === a && (b = ja.get("WEBGL_depth_texture"), null !== b) ? b.UNSIGNED_INT_24_8_WEBGL: 0
}
console.log("THREE.WebGLRenderer", "84");
a = a || {};
var y = void 0 !== a.canvas ? a.canvas: document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"),
K = void 0 !== a.context ? a.context: null,
v = void 0 !== a.alpha ? a.alpha: !1,
E = void 0 !== a.depth ? a.depth: !0,
L = void 0 !== a.stencil ? a.stencil: !0,
C = void 0 !== a.antialias ? a.antialias: !1,
F = void 0 !== a.premultipliedAlpha ? a.premultipliedAlpha: !0,
x = void 0 !== a.preserveDrawingBuffer ? a.preserveDrawingBuffer: !1,
H = [],
aa = [],
D = -1,
z = [],
T = -1,
Q = new Float32Array(8),
M = [],
O = [];
this.domElement = y;
this.context = null;
this.sortObjects = this.autoClearStencil = this.autoClearDepth = this.autoClearColor = this.autoClear = !0;
this.clippingPlanes = [];
this.localClippingEnabled = !1;
this.gammaFactor = 2;
this.physicallyCorrectLights = this.gammaOutput = this.gammaInput = !1;
this.toneMappingWhitePoint = this.toneMappingExposure = this.toneMapping = 1;
this.maxMorphTargets = 8;
this.maxMorphNormals = 4;
var P = this,
wa = null,
W = null,
N = null,
R = -1,
V = "",
U = null,
X = new fa,
Sa = null,
Z = new fa,
ea = 0,
Ea = new J(0),
gb = 0,
md = y.width,
Cc = y.height,
Ra = 1,
ga = new fa(0, 0, md, Cc),
ka = !1,
ia = new fa(0, 0, md, Cc),
ma = new tc,
ca = new Uf,
oa = !1,
ra = !1,
na = new Na,
ua = new S,
Ga = new q,
Ba = new S,
xa = new S,
ba = {
hash: "",
ambient: [0, 0, 0],
directional: [],
directionalShadowMap: [],
directionalShadowMatrix: [],
spot: [],
spotShadowMap: [],
spotShadowMatrix: [],
rectArea: [],
point: [],
pointShadowMap: [],
pointShadowMatrix: [],
hemi: [],
shadows: []
},
pa = {
calls: 0,
vertices: 0,
faces: 0,
points: 0
};
this.info = {
render: pa,
memory: {
geometries: 0,
textures: 0
},
programs: null
};
var B;
try {
v = {
alpha: v,
depth: E,
stencil: L,
antialias: C,
premultipliedAlpha: F,
preserveDrawingBuffer: x
};
B = K || y.getContext("webgl", v) || y.getContext("experimental-webgl", v);
if (null === B) {
if (null !== y.getContext("webgl")) throw "Error creating WebGL context with your selected attributes.";
throw "Error creating WebGL context.";
}
void 0 === B.getShaderPrecisionFormat && (B.getShaderPrecisionFormat = function() {
return {
rangeMin: 1,
rangeMax: 1,
precision: 1
}
});
y.addEventListener("webglcontextlost", d, !1)
} catch(Vf) {
console.error("THREE.WebGLRenderer: " + Vf)
}
var ja = new Tf(B);
ja.get("WEBGL_depth_texture");
ja.get("OES_texture_float");
ja.get("OES_texture_float_linear");
ja.get("OES_texture_half_float");
ja.get("OES_texture_half_float_linear");
ja.get("OES_standard_derivatives");
ja.get("ANGLE_instanced_arrays");
ja.get("OES_element_index_uint") && (I.MaxIndex = 4294967296);
var la = new Sf(B, ja, a),
Y = new Rf(B, ja, w),
ha = new Qf,
ta = new Pf(B, ja, Y, ha, la, w, this.info),
qa = new Of(B, ha, this.info),
ya = new Mf(this, la),
za = new Ef;
this.info.programs = ya.programs;
var La = new Df(B, ja, pa),
Oa = new Cf(B, ja, pa),
Ia,
Ca,
sa,
va;
b();
this.context = B;
this.capabilities = la;
this.extensions = ja;
this.properties = ha;
this.state = Y;
var Ma = new Ke(this, ba, qa, la);
this.shadowMap = Ma;
var Pa = new zf(this, M),
Qa = new yf(this, O);
this.getContext = function() {
return B
};
this.getContextAttributes = function() {
return B.getContextAttributes()
};
this.forceContextLoss = function() {
ja.get("WEBGL_lose_context").loseContext()
};
this.getMaxAnisotropy = function() {
return la.getMaxAnisotropy()
};
this.getPrecision = function() {
return la.precision
};
this.getPixelRatio = function() {
return Ra
};
this.setPixelRatio = function(a) {
void 0 !== a && (Ra = a, this.setSize(ia.z, ia.w, !1))
};
this.getSize = function() {
return {
width: md,
height: Cc
}
};
this.setSize = function(a, b, c) {
md = a;
Cc = b;
y.width = a * Ra;
y.height = b * Ra; ! 1 !== c && (y.style.width = a + "px", y.style.height = b + "px");
this.setViewport(0, 0, a, b)
};
this.setViewport = function(a, b, c, d) {
Y.viewport(ia.set(a, b, c, d))
};
this.setScissor = function(a, b, c, d) {
Y.scissor(ga.set(a, b, c, d))
};
this.setScissorTest = function(a) {
Y.setScissorTest(ka = a)
};
this.getClearColor = function() {
return Ea
};
this.setClearColor = function(a, b) {
Ea.set(a);
gb = void 0 !== b ? b: 1;
Y.buffers.color.setClear(Ea.r, Ea.g, Ea.b, gb, F)
};
this.getClearAlpha = function() {
return gb
};
this.setClearAlpha = function(a) {
gb = a;
Y.buffers.color.setClear(Ea.r, Ea.g, Ea.b, gb, F)
};
this.clear = function(a, b, c) {
var d = 0;
if (void 0 === a || a) d |= B.COLOR_BUFFER_BIT;
if (void 0 === b || b) d |= B.DEPTH_BUFFER_BIT;
if (void 0 === c || c) d |= B.STENCIL_BUFFER_BIT;
B.clear(d)
};
this.clearColor = function() {
this.clear(!0, !1, !1)
};
this.clearDepth = function() {
this.clear(!1, !0, !1)
};
this.clearStencil = function() {
this.clear(!1, !1, !0)
};
this.clearTarget = function(a, b, c, d) {
this.setRenderTarget(a);
this.clear(b, c, d)
};
this.resetGLState = c;
this.dispose = function() {
z = [];
T = -1;
aa = [];
D = -1;
y.removeEventListener("webglcontextlost", d, !1)
};
this.renderBufferImmediate = function(a, b, c) {
Y.initAttributes();
var d = ha.get(a);
a.hasPositions && !d.position && (d.position = B.createBuffer());
a.hasNormals && !d.normal && (d.normal = B.createBuffer());
a.hasUvs && !d.uv && (d.uv = B.createBuffer());
a.hasColors && !d.color && (d.color = B.createBuffer());
b = b.getAttributes();
a.hasPositions && (B.bindBuffer(B.ARRAY_BUFFER, d.position), B.bufferData(B.ARRAY_BUFFER, a.positionArray, B.DYNAMIC_DRAW), Y.enableAttribute(b.position), B.vertexAttribPointer(b.position, 3, B.FLOAT, !1, 0, 0));
if (a.hasNormals) {
B.bindBuffer(B.ARRAY_BUFFER, d.normal);
if (!c.isMeshPhongMaterial && !c.isMeshStandardMaterial && !c.isMeshNormalMaterial && 1 === c.shading) for (var e = 0,
f = 3 * a.count; e < f; e += 9) {
var g = a.normalArray,
h = (g[e + 0] + g[e + 3] + g[e + 6]) / 3,
m = (g[e + 1] + g[e + 4] + g[e + 7]) / 3,
k = (g[e + 2] + g[e + 5] + g[e + 8]) / 3;
g[e + 0] = h;
g[e + 1] = m;
g[e + 2] = k;
g[e + 3] = h;
g[e + 4] = m;
g[e + 5] = k;
g[e + 6] = h;
g[e + 7] = m;
g[e + 8] = k
}
B.bufferData(B.ARRAY_BUFFER, a.normalArray, B.DYNAMIC_DRAW);
Y.enableAttribute(b.normal);
B.vertexAttribPointer(b.normal, 3, B.FLOAT, !1, 0, 0)
}
a.hasUvs && c.map && (B.bindBuffer(B.ARRAY_BUFFER, d.uv), B.bufferData(B.ARRAY_BUFFER, a.uvArray, B.DYNAMIC_DRAW), Y.enableAttribute(b.uv), B.vertexAttribPointer(b.uv, 2, B.FLOAT, !1, 0, 0));
a.hasColors && 0 !== c.vertexColors && (B.bindBuffer(B.ARRAY_BUFFER, d.color), B.bufferData(B.ARRAY_BUFFER, a.colorArray, B.DYNAMIC_DRAW), Y.enableAttribute(b.color), B.vertexAttribPointer(b.color, 3, B.FLOAT, !1, 0, 0));
Y.disableUnusedAttributes();
B.drawArrays(B.TRIANGLES, 0, a.count);
a.count = 0
};
this.renderBufferDirect = function(a, b, c, d, e, f) {
l(d);
var h = G(a, b, d, e),
m = !1;
a = c.id + "_" + h.id + "_" + d.wireframe;
a !== V && (V = a, m = !0);
b = e.morphTargetInfluences;
if (void 0 !== b) {
var k = [];
a = 0;
for (var n = b.length; a < n; a++) m = b[a],
k.push([m, a]);
k.sort(g);
8 < k.length && (k.length = 8);
var t = c.morphAttributes;
a = 0;
for (n = k.length; a < n; a++) m = k[a],
Q[a] = m[0],
0 !== m[0] ? (b = m[1], !0 === d.morphTargets && t.position && c.addAttribute("morphTarget" + a, t.position[b]), !0 === d.morphNormals && t.normal && c.addAttribute("morphNormal" + a, t.normal[b])) : (!0 === d.morphTargets && c.removeAttribute("morphTarget" + a), !0 === d.morphNormals && c.removeAttribute("morphNormal" + a));
a = k.length;
for (b = Q.length; a < b; a++) Q[a] = 0;
h.getUniforms().setValue(B, "morphTargetInfluences", Q);
m = !0
}
b = c.index;
n = c.attributes.position;
k = 1; ! 0 === d.wireframe && (b = qa.getWireframeAttribute(c), k = 2);
null !== b ? (a = Oa, a.setIndex(b)) : a = La;
if (m) {
a: {
var m = void 0,
p;
if (c && c.isInstancedBufferGeometry && (p = ja.get("ANGLE_instanced_arrays"), null === p)) {
console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
break a
}
void 0 === m && (m = 0);
Y.initAttributes();
var t = c.attributes,
h = h.getAttributes(),
r = d.defaultAttributeValues,
q;
for (q in h) {
var y = h[q];
if (0 <= y) {
var v = t[q];
if (void 0 !== v) {
var w = v.normalized,
A = v.itemSize,
K = qa.getAttributeProperties(v),
C = K.__webglBuffer,
L = K.type,
K = K.bytesPerElement;
if (v.isInterleavedBufferAttribute) {
var F = v.data,
E = F.stride,
v = v.offset;
F && F.isInstancedInterleavedBuffer ? (Y.enableAttributeAndDivisor(y, F.meshPerAttribute, p), void 0 === c.maxInstancedCount && (c.maxInstancedCount = F.meshPerAttribute * F.count)) : Y.enableAttribute(y);
B.bindBuffer(B.ARRAY_BUFFER, C);
B.vertexAttribPointer(y, A, L, w, E * K, (m * E + v) * K)
} else v.isInstancedBufferAttribute ? (Y.enableAttributeAndDivisor(y, v.meshPerAttribute, p), void 0 === c.maxInstancedCount && (c.maxInstancedCount = v.meshPerAttribute * v.count)) : Y.enableAttribute(y),
B.bindBuffer(B.ARRAY_BUFFER, C),
B.vertexAttribPointer(y, A, L, w, 0, m * A * K)
} else if (void 0 !== r && (w = r[q], void 0 !== w)) switch (w.length) {
case 2:
B.vertexAttrib2fv(y, w);
break;
case 3:
B.vertexAttrib3fv(y, w);
break;
case 4:
B.vertexAttrib4fv(y, w);
break;
default:
B.vertexAttrib1fv(y, w)
}
}
}
Y.disableUnusedAttributes()
}
null !== b && B.bindBuffer(B.ELEMENT_ARRAY_BUFFER, qa.getAttributeBuffer(b))
}
p = 0;
null !== b ? p = b.count: void 0 !== n && (p = n.count);
b = c.drawRange.start * k;
n = null !== f ? f.start * k: 0;
q = Math.max(b, n);
f = Math.max(0, Math.min(p, b + c.drawRange.count * k, n + (null !== f ? f.count * k: Infinity)) - 1 - q + 1);
if (0 !== f) {
if (e.isMesh) if (!0 === d.wireframe) Y.setLineWidth(d.wireframeLinewidth * (null === W ? Ra: 1)),
a.setMode(B.LINES);
else switch (e.drawMode) {
case 0:
a.setMode(B.TRIANGLES);
break;
case 1:
a.setMode(B.TRIANGLE_STRIP);
break;
case 2:
a.setMode(B.TRIANGLE_FAN)
} else e.isLine ? (d = d.linewidth, void 0 === d && (d = 1), Y.setLineWidth(d * (null === W ? Ra: 1)), e.isLineSegments ? a.setMode(B.LINES) : a.setMode(B.LINE_STRIP)) : e.isPoints && a.setMode(B.POINTS);
c && c.isInstancedBufferGeometry ? 0 < c.maxInstancedCount && a.renderInstances(c, q, f) : a.render(q, f)
}
};
this.render = function(a, b, c, d) {
if (void 0 !== b && !0 !== b.isCamera) console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");
else {
V = "";
R = -1;
U = null; ! 0 === a.autoUpdate && a.updateMatrixWorld();
null === b.parent && b.updateMatrixWorld();
b.matrixWorldInverse.getInverse(b.matrixWorld);
ua.multiplyMatrices(b.projectionMatrix, b.matrixWorldInverse);
ma.setFromMatrix(ua);
H.length = 0;
T = D = -1;
M.length = 0;
O.length = 0;
ra = this.localClippingEnabled;
oa = ca.init(this.clippingPlanes, ra, b);
p(a, b);
aa.length = D + 1;
z.length = T + 1; ! 0 === P.sortObjects && (aa.sort(h), z.sort(m));
oa && ca.beginShadows();
for (var e = H,
f = 0,
g = 0,
k = e.length; g < k; g++) {
var t = e[g];
t.castShadow && (ba.shadows[f++] = t)
}
ba.shadows.length = f;
Ma.render(a, b);
for (var e = H,
l = t = 0,
u = 0,
r, G, q, y, v = b.matrixWorldInverse,
w = 0,
A = 0,
K = 0,
C = 0,
L = 0,
f = 0,
g = e.length; f < g; f++) if (k = e[f], r = k.color, G = k.intensity, q = k.distance, y = k.shadow && k.shadow.map ? k.shadow.map.texture: null, k.isAmbientLight) t += r.r * G,
l += r.g * G,
u += r.b * G;
else if (k.isDirectionalLight) {
var E = za.get(k);
E.color.copy(k.color).multiplyScalar(k.intensity);
E.direction.setFromMatrixPosition(k.matrixWorld);
Ga.setFromMatrixPosition(k.target.matrixWorld);
E.direction.sub(Ga);
E.direction.transformDirection(v);
if (E.shadow = k.castShadow) E.shadowBias = k.shadow.bias,
E.shadowRadius = k.shadow.radius,
E.shadowMapSize = k.shadow.mapSize;
ba.directionalShadowMap[w] = y;
ba.directionalShadowMatrix[w] = k.shadow.matrix;
ba.directional[w++] = E
} else if (k.isSpotLight) {
E = za.get(k);
E.position.setFromMatrixPosition(k.matrixWorld);
E.position.applyMatrix4(v);
E.color.copy(r).multiplyScalar(G);
E.distance = q;
E.direction.setFromMatrixPosition(k.matrixWorld);
Ga.setFromMatrixPosition(k.target.matrixWorld);
E.direction.sub(Ga);
E.direction.transformDirection(v);
E.coneCos = Math.cos(k.angle);
E.penumbraCos = Math.cos(k.angle * (1 - k.penumbra));
E.decay = 0 === k.distance ? 0 : k.decay;
if (E.shadow = k.castShadow) E.shadowBias = k.shadow.bias,
E.shadowRadius = k.shadow.radius,
E.shadowMapSize = k.shadow.mapSize;
ba.spotShadowMap[K] = y;
ba.spotShadowMatrix[K] = k.shadow.matrix;
ba.spot[K++] = E
} else if (k.isRectAreaLight) E = za.get(k),
E.color.copy(r).multiplyScalar(G / (k.width * k.height)),
E.position.setFromMatrixPosition(k.matrixWorld),
E.position.applyMatrix4(v),
xa.identity(),
Ba.copy(k.matrixWorld),
Ba.premultiply(v),
xa.extractRotation(Ba),
E.halfWidth.set(.5 * k.width, 0, 0),
E.halfHeight.set(0, .5 * k.height, 0),
E.halfWidth.applyMatrix4(xa),
E.halfHeight.applyMatrix4(xa),
ba.rectArea[C++] = E;
else if (k.isPointLight) {
E = za.get(k);
E.position.setFromMatrixPosition(k.matrixWorld);
E.position.applyMatrix4(v);
E.color.copy(k.color).multiplyScalar(k.intensity);
E.distance = k.distance;
E.decay = 0 === k.distance ? 0 : k.decay;
if (E.shadow = k.castShadow) E.shadowBias = k.shadow.bias,
E.shadowRadius = k.shadow.radius,
E.shadowMapSize = k.shadow.mapSize;
ba.pointShadowMap[A] = y;
void 0 === ba.pointShadowMatrix[A] && (ba.pointShadowMatrix[A] = new S);
Ga.setFromMatrixPosition(k.matrixWorld).negate();
ba.pointShadowMatrix[A].identity().setPosition(Ga);
ba.point[A++] = E
} else k.isHemisphereLight && (E = za.get(k), E.direction.setFromMatrixPosition(k.matrixWorld), E.direction.transformDirection(v), E.direction.normalize(), E.skyColor.copy(k.color).multiplyScalar(G), E.groundColor.copy(k.groundColor).multiplyScalar(G), ba.hemi[L++] = E);
ba.ambient[0] = t;
ba.ambient[1] = l;
ba.ambient[2] = u;
ba.directional.length = w;
ba.spot.length = K;
ba.rectArea.length = C;
ba.point.length = A;
ba.hemi.length = L;
ba.hash = w + "," + A + "," + K + "," + C + "," + L + "," + ba.shadows.length;
oa && ca.endShadows();
pa.calls = 0;
pa.vertices = 0;
pa.faces = 0;
pa.points = 0;
void 0 === c && (c = null);
this.setRenderTarget(c);
e = a.background;
null === e ? Y.buffers.color.setClear(Ea.r, Ea.g, Ea.b, gb, F) : e && e.isColor && (Y.buffers.color.setClear(e.r, e.g, e.b, 1, F), d = !0); (this.autoClear || d) && this.clear(this.autoClearColor, this.autoClearDepth, this.autoClearStencil);
e && e.isCubeTexture ? (void 0 === sa && (sa = new Fa, va = new Aa(new kb(5, 5, 5), new Ha({
uniforms: bb.cube.uniforms,
vertexShader: bb.cube.vertexShader,
fragmentShader: bb.cube.fragmentShader,
side: 1,
depthTest: !1,
depthWrite: !1,
fog: !1
}))), sa.projectionMatrix.copy(b.projectionMatrix), sa.matrixWorld.extractRotation(b.matrixWorld), sa.matrixWorldInverse.getInverse(sa.matrixWorld), va.material.uniforms.tCube.value = e, va.modelViewMatrix.multiplyMatrices(sa.matrixWorldInverse, va.matrixWorld), qa.update(va), P.renderBufferDirect(sa, null, va.geometry, va.material, va, null)) : e && e.isTexture && (void 0 === Ia && (Ia = new Jb( - 1, 1, 1, -1, 0, 1), Ca = new Aa(new lb(2, 2), new Ka({
depthTest: !1,
depthWrite: !1,
fog: !1
}))), Ca.material.map = e, qa.update(Ca), P.renderBufferDirect(Ia, null, Ca.geometry, Ca.material, Ca, null));
a.overrideMaterial ? (d = a.overrideMaterial, n(aa, a, b, d), n(z, a, b, d)) : (Y.setBlending(0), n(aa, a, b), n(z, a, b));
Pa.render(a, b);
Qa.render(a, b, Z);
c && ta.updateRenderTargetMipmap(c);
Y.setDepthTest(!0);
Y.setDepthWrite(!0);
Y.setColorWrite(!0)
}
};
this.setFaceCulling = function(a, b) {
Y.setCullFace(a);
Y.setFlipSided(0 === b)
};
this.allocTextureUnit = function() {
var a = ea;
a >= la.maxTextures && console.warn("WebGLRenderer: trying to use " + a + " texture units while this GPU supports only " + la.maxTextures);
ea += 1;
return a
};
this.setTexture2D = function() {
var a = !1;
return function(b, c) {
b && b.isWebGLRenderTarget && (a || (console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), a = !0), b = b.texture);
ta.setTexture2D(b, c)
}
} ();
this.setTexture = function() {
var a = !1;
return function(b, c) {
a || (console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."), a = !0);
ta.setTexture2D(b, c)
}
} ();
this.setTextureCube = function() {
var a = !1;
return function(b, c) {
b && b.isWebGLRenderTargetCube && (a || (console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."), a = !0), b = b.texture);
b && b.isCubeTexture || Array.isArray(b.image) && 6 === b.image.length ? ta.setTextureCube(b, c) : ta.setTextureCubeDynamic(b, c)
}
} ();
this.getCurrentRenderTarget = function() {
return W
};
this.setRenderTarget = function(a) { (W = a) && void 0 === ha.get(a).__webglFramebuffer && ta.setupRenderTarget(a);
var b = a && a.isWebGLRenderTargetCube,
c;
a ? (c = ha.get(a), c = b ? c.__webglFramebuffer[a.activeCubeFace] : c.__webglFramebuffer, X.copy(a.scissor), Sa = a.scissorTest, Z.copy(a.viewport)) : (c = null, X.copy(ga).multiplyScalar(Ra), Sa = ka, Z.copy(ia).multiplyScalar(Ra));
N !== c && (B.bindFramebuffer(B.FRAMEBUFFER, c), N = c);
Y.scissor(X);
Y.setScissorTest(Sa);
Y.viewport(Z);
b && (b = ha.get(a.texture), B.framebufferTexture2D(B.FRAMEBUFFER, B.COLOR_ATTACHMENT0, B.TEXTURE_CUBE_MAP_POSITIVE_X + a.activeCubeFace, b.__webglTexture, a.activeMipMapLevel))
};
this.readRenderTargetPixels = function(a, b, c, d, e, f) {
if (!1 === (a && a.isWebGLRenderTarget)) console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");
else {
var g = ha.get(a).__webglFramebuffer;
if (g) {
var h = !1;
g !== N && (B.bindFramebuffer(B.FRAMEBUFFER, g), h = !0);
try {
var k = a.texture,
m = k.format,
n = k.type;
1023 !== m && w(m) !== B.getParameter(B.IMPLEMENTATION_COLOR_READ_FORMAT) ? console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.") : 1009 === n || w(n) === B.getParameter(B.IMPLEMENTATION_COLOR_READ_TYPE) || 1015 === n && (ja.get("OES_texture_float") || ja.get("WEBGL_color_buffer_float")) || 1016 === n && ja.get("EXT_color_buffer_half_float") ? B.checkFramebufferStatus(B.FRAMEBUFFER) === B.FRAMEBUFFER_COMPLETE ? 0 <= b && b <= a.width - d && 0 <= c && c <= a.height - e && B.readPixels(b, c, d, e, w(m), w(n), f) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.") : console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.")
} finally {
h && B.bindFramebuffer(B.FRAMEBUFFER, N)
}
}
}
}
}
function Kb(a, b) {
this.name = "";
this.color = new J(a);
this.density = void 0 !== b ? b: 2.5E-4
}
function Lb(a, b, c) {
this.name = "";
this.color = new J(a);
this.near = void 0 !== b ? b: 1;
this.far = void 0 !== c ? c: 1E3
}
function mb() {
x.call(this);
this.type = "Scene";
this.overrideMaterial = this.fog = this.background = null;
this.autoUpdate = !0
}
function Zd(a, b, c, d, e) {
x.call(this);
this.lensFlares = [];
this.positionScreen = new q;
this.customUpdateCallback = void 0;
void 0 !== a && this.add(a, b, c, d, e)
}
function nb(a) {
X.call(this);
this.type = "SpriteMaterial";
this.color = new J(16777215);
this.map = null;
this.rotation = 0;
this.lights = this.fog = !1;
this.setValues(a)
}
function Dc(a) {
x.call(this);
this.type = "Sprite";
this.material = void 0 !== a ? a: new nb
}
function Ec() {
x.call(this);
this.type = "LOD";
Object.defineProperties(this, {
levels: {
enumerable: !0,
value: []
}
})
}
function od(a, b, c) {
this.useVertexTexture = void 0 !== c ? c: !0;
this.identityMatrix = new S;
a = a || [];
this.bones = a.slice(0);
this.useVertexTexture ? (a = Math.sqrt(4 * this.bones.length), a = N.nextPowerOfTwo(Math.ceil(a)), this.boneTextureHeight = this.boneTextureWidth = a = Math.max(a, 4), this.boneMatrices = new Float32Array(this.boneTextureWidth * this.boneTextureHeight * 4), this.boneTexture = new eb(this.boneMatrices, this.boneTextureWidth, this.boneTextureHeight, 1023, 1015)) : this.boneMatrices = new Float32Array(16 * this.bones.length);
if (void 0 === b) this.calculateInverses();
else if (this.bones.length === b.length) this.boneInverses = b.slice(0);
else for (console.warn("THREE.Skeleton bonInverses is the wrong length."), this.boneInverses = [], b = 0, a = this.bones.length; b < a; b++) this.boneInverses.push(new S)
}
function pd() {
x.call(this);
this.type = "Bone"
}
function qd(a, b, c) {
Aa.call(this, a, b);
this.type = "SkinnedMesh";
this.bindMode = "attached";
this.bindMatrix = new S;
this.bindMatrixInverse = new S;
a = [];
if (this.geometry && void 0 !== this.geometry.bones) {
for (var d, e = 0,
f = this.geometry.bones.length; e < f; ++e) d = this.geometry.bones[e],
b = new pd,
a.push(b),
b.name = d.name,
b.position.fromArray(d.pos),
b.quaternion.fromArray(d.rotq),
void 0 !== d.scl && b.scale.fromArray(d.scl);
e = 0;
for (f = this.geometry.bones.length; e < f; ++e) d = this.geometry.bones[e],
-1 !== d.parent && null !== d.parent && void 0 !== a[d.parent] ? a[d.parent].add(a[e]) : this.add(a[e])
}
this.normalizeSkinWeights();
this.updateMatrixWorld(!0);
this.bind(new od(a, void 0, c), this.matrixWorld)
}
function ia(a) {
X.call(this);
this.type = "LineBasicMaterial";
this.color = new J(16777215);
this.linewidth = 1;
this.linejoin = this.linecap = "round";
this.lights = !1;
this.setValues(a)
}
function Ua(a, b, c) {
if (1 === c) return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),
new ga(a, b);
x.call(this);
this.type = "Line";
this.geometry = void 0 !== a ? a: new I;
this.material = void 0 !== b ? b: new ia({
color: 16777215 * Math.random()
})
}
function ga(a, b) {
Ua.call(this, a, b);
this.type = "LineSegments"
}
function Oa(a) {
X.call(this);
this.type = "PointsMaterial";
this.color = new J(16777215);
this.map = null;
this.size = 1;
this.sizeAttenuation = !0;
this.lights = !1;
this.setValues(a)
}
function Mb(a, b) {
x.call(this);
this.type = "Points";
this.geometry = void 0 !== a ? a: new I;
this.material = void 0 !== b ? b: new Oa({
color: 16777215 * Math.random()
})
}
function Fc() {
x.call(this);
this.type = "Group"
}
function rd(a, b, c, d, e, f, g, h, m) {
function k() {
requestAnimationFrame(k);
a.readyState >= a.HAVE_CURRENT_DATA && (t.needsUpdate = !0)
}
ea.call(this, a, b, c, d, e, f, g, h, m);
this.generateMipmaps = !1;
var t = this;
k()
}
function Nb(a, b, c, d, e, f, g, h, m, k, t, p) {
ea.call(this, null, f, g, h, m, k, d, e, t, p);
this.image = {
width: b,
height: c
};
this.mipmaps = a;
this.generateMipmaps = this.flipY = !1
}
function sd(a, b, c, d, e, f, g, h, m) {
ea.call(this, a, b, c, d, e, f, g, h, m);
this.needsUpdate = !0
}
function Gc(a, b, c, d, e, f, g, h, m, k) {
k = void 0 !== k ? k: 1026;
if (1026 !== k && 1027 !== k) throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
void 0 === c && 1026 === k && (c = 1012);
void 0 === c && 1027 === k && (c = 1020);
ea.call(this, null, d, e, f, g, h, k, c, m);
this.image = {
width: a,
height: b
};
this.magFilter = void 0 !== g ? g: 1003;
this.minFilter = void 0 !== h ? h: 1003;
this.generateMipmaps = this.flipY = !1
}
function Ob(a) {
function b(a, b) {
return a - b
}
I.call(this);
this.type = "WireframeGeometry";
var c = [],
d,
e,
f,
g,
h = [0, 0],
m = {},
k,
t = ["a", "b", "c"];
if (a && a.isGeometry) {
var p = a.faces;
d = 0;
for (f = p.length; d < f; d++) {
var n = p[d];
for (e = 0; 3 > e; e++) h[0] = n[t[e]],
h[1] = n[t[(e + 1) % 3]],
h.sort(b),
k = h.toString(),
void 0 === m[k] && (m[k] = {
index1: h[0],
index2: h[1]
})
}
for (k in m) d = m[k],
t = a.vertices[d.index1],
c.push(t.x, t.y, t.z),
t = a.vertices[d.index2],
c.push(t.x, t.y, t.z)
} else if (a && a.isBufferGeometry) {
var l, t = new q;
if (null !== a.index) {
p = a.attributes.position;
n = a.index;
l = a.groups;
0 === l.length && a.addGroup(0, n.count);
a = 0;
for (g = l.length; a < g; ++a) for (d = l[a], e = d.start, f = d.count, d = e, f = e + f; d < f; d += 3) for (e = 0; 3 > e; e++) h[0] = n.getX(d + e),
h[1] = n.getX(d + (e + 1) % 3),
h.sort(b),
k = h.toString(),
void 0 === m[k] && (m[k] = {
index1: h[0],
index2: h[1]
});
for (k in m) d = m[k],
t.fromBufferAttribute(p, d.index1),
c.push(t.x, t.y, t.z),
t.fromBufferAttribute(p, d.index2),
c.push(t.x, t.y, t.z)
} else for (p = a.attributes.position, d = 0, f = p.count / 3; d < f; d++) for (e = 0; 3 > e; e++) m = 3 * d + e,
t.fromBufferAttribute(p, m),
c.push(t.x, t.y, t.z),
m = 3 * d + (e + 1) % 3,
t.fromBufferAttribute(p, m),
c.push(t.x, t.y, t.z)
}
this.addAttribute("position", new z(c, 3))
}
function Hc(a, b, c) {
T.call(this);
this.type = "ParametricGeometry";
this.parameters = {
func: a,
slices: b,
stacks: c
};
this.fromBufferGeometry(new Pb(a, b, c));
this.mergeVertices()
}
function Pb(a, b, c) {
I.call(this);
this.type = "ParametricBufferGeometry";
this.parameters = {
func: a,
slices: b,
stacks: c
};
var d = [],
e = [],
f = [],
g,
h,
m = b + 1;
for (g = 0; g <= c; g++) {
var k = g / c;
for (h = 0; h <= b; h++) {
var t = h / b,
p = a(t, k);
e.push(p.x, p.y, p.z);
f.push(t, k)
}
}
for (g = 0; g < c; g++) for (h = 0; h < b; h++) a = g * m + h + 1,
k = (g + 1) * m + h + 1,
t = (g + 1) * m + h,
d.push(g * m + h, a, t),
d.push(a, k, t);
this.setIndex(d);
this.addAttribute("position", new z(e, 3));
this.addAttribute("uv", new z(f, 2));
this.computeVertexNormals()
}
function Ic(a, b, c, d) {
T.call(this);
this.type = "PolyhedronGeometry";
this.parameters = {
vertices: a,
indices: b,
radius: c,
detail: d
};
this.fromBufferGeometry(new Ba(a, b, c, d));
this.mergeVertices()
}
function Ba(a, b, c, d) {
function e(a) {
h.push(a.x, a.y, a.z)
}
function f(b, c) {
var d = 3 * b;
c.x = a[d + 0];
c.y = a[d + 1];
c.z = a[d + 2]
}
function g(a, b, c, d) {
0 > d && 1 === a.x && (m[b] = a.x - 1);
0 === c.x && 0 === c.z && (m[b] = d / 2 / Math.PI + .5)
}
I.call(this);
this.type = "PolyhedronBufferGeometry";
this.parameters = {
vertices: a,
indices: b,
radius: c,
detail: d
};
c = c || 1;
var h = [],
m = []; (function(a) {
for (var c = new q,
d = new q,
g = new q,
h = 0; h < b.length; h += 3) {
f(b[h + 0], c);
f(b[h + 1], d);
f(b[h + 2], g);
var m = c,
l = d,
A = g,
w = Math.pow(2, a),
y = [],
K,
v;
for (K = 0; K <= w; K++) {
y[K] = [];
var E = m.clone().lerp(A, K / w),
L = l.clone().lerp(A, K / w),
C = w - K;
for (v = 0; v <= C; v++) y[K][v] = 0 === v && K === w ? E: E.clone().lerp(L, v / C)
}
for (K = 0; K < w; K++) for (v = 0; v < 2 * (w - K) - 1; v++) m = Math.floor(v / 2),
0 === v % 2 ? (e(y[K][m + 1]), e(y[K + 1][m]), e(y[K][m])) : (e(y[K][m + 1]), e(y[K + 1][m + 1]), e(y[K + 1][m]))
}
})(d || 0); (function(a) {
for (var b = new q,
c = 0; c < h.length; c += 3) b.x = h[c + 0],
b.y = h[c + 1],
b.z = h[c + 2],
b.normalize().multiplyScalar(a),
h[c + 0] = b.x,
h[c + 1] = b.y,
h[c + 2] = b.z
})(c); (function() {
for (var a = new q,
b = 0; b < h.length; b += 3) a.x = h[b + 0],
a.y = h[b + 1],
a.z = h[b + 2],
m.push(Math.atan2(a.z, -a.x) / 2 / Math.PI + .5, 1 - (Math.atan2( - a.y, Math.sqrt(a.x * a.x + a.z * a.z)) / Math.PI + .5));
for (var a = new q,
b = new q,
c = new q,
d = new q,
e = new D,
f = new D,
l = new D,
A = 0,
w = 0; A < h.length; A += 9, w += 6) {
a.set(h[A + 0], h[A + 1], h[A + 2]);
b.set(h[A + 3], h[A + 4], h[A + 5]);
c.set(h[A + 6], h[A + 7], h[A + 8]);
e.set(m[w + 0], m[w + 1]);
f.set(m[w + 2], m[w + 3]);
l.set(m[w + 4], m[w + 5]);
d.copy(a).add(b).add(c).divideScalar(3);
var y = Math.atan2(d.z, -d.x);
g(e, w + 0, a, y);
g(f, w + 2, b, y);
g(l, w + 4, c, y)
}
for (a = 0; a < m.length; a += 6) b = m[a + 0],
c = m[a + 2],
d = m[a + 4],
e = Math.min(b, c, d),
.9 < Math.max(b, c, d) && .1 > e && (.2 > b && (m[a + 0] += 1), .2 > c && (m[a + 2] += 1), .2 > d && (m[a + 4] += 1))
})();
this.addAttribute("position", new z(h, 3));
this.addAttribute("normal", new z(h.slice(), 3));
this.addAttribute("uv", new z(m, 2));
this.normalizeNormals()
}
function Jc(a, b) {
T.call(this);
this.type = "TetrahedronGeometry";
this.parameters = {
radius: a,
detail: b
};
this.fromBufferGeometry(new Qb(a, b));
this.mergeVertices()
}
function Qb(a, b) {
Ba.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);
this.type = "TetrahedronBufferGeometry";
this.parameters = {
radius: a,
detail: b
}
}
function Kc(a, b) {
T.call(this);
this.type = "OctahedronGeometry";
this.parameters = {
radius: a,
detail: b
};
this.fromBufferGeometry(new ob(a, b));
this.mergeVertices()
}
function ob(a, b) {
Ba.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);
this.type = "OctahedronBufferGeometry";
this.parameters = {
radius: a,
detail: b
}
}
function Lc(a, b) {
T.call(this);
this.type = "IcosahedronGeometry";
this.parameters = {
radius: a,
detail: b
};
this.fromBufferGeometry(new Rb(a, b));
this.mergeVertices()
}
function Rb(a, b) {
var c = (1 + Math.sqrt(5)) / 2;
Ba.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);
this.type = "IcosahedronBufferGeometry";
this.parameters = {
radius: a,
detail: b
}
}
function Mc(a, b) {
T.call(this);
this.type = "DodecahedronGeometry";
this.parameters = {
radius: a,
detail: b
};
this.fromBufferGeometry(new Sb(a, b));
this.mergeVertices()
}
function Sb(a, b) {
var c = (1 + Math.sqrt(5)) / 2,
d = 1 / c;
Ba.call(this, [ - 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 0, -d, -c, 0, -d, c, 0, d, -c, 0, d, c, -d, -c, 0, -d, c, 0, d, -c, 0, d, c, 0, -c, 0, -d, c, 0, -d, -c, 0, d, c, 0, d], [3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9], a, b);
this.type = "DodecahedronBufferGeometry";
this.parameters = {
radius: a,
detail: b
}
}
function Nc(a, b, c, d, e, f) {
T.call(this);
this.type = "TubeGeometry";
this.parameters = {
path: a,
tubularSegments: b,
radius: c,
radialSegments: d,
closed: e
};
void 0 !== f && console.warn("THREE.TubeGeometry: taper has been removed.");
a = new Tb(a, b, c, d, e);
this.tangents = a.tangents;
this.normals = a.normals;
this.binormals = a.binormals;
this.fromBufferGeometry(a);
this.mergeVertices()
}
function Tb(a, b, c, d, e) {
function f(e) {
var f = a.getPointAt(e / b),
k = g.normals[e];
e = g.binormals[e];
for (p = 0; p <= d; p++) {
var t = p / d * Math.PI * 2,
r = Math.sin(t),
t = -Math.cos(t);
m.x = t * k.x + r * e.x;
m.y = t * k.y + r * e.y;
m.z = t * k.z + r * e.z;
m.normalize();
l.push(m.x, m.y, m.z);
h.x = f.x + c * m.x;
h.y = f.y + c * m.y;
h.z = f.z + c * m.z;
n.push(h.x, h.y, h.z)
}
}
I.call(this);
this.type = "TubeBufferGeometry";
this.parameters = {
path: a,
tubularSegments: b,
radius: c,
radialSegments: d,
closed: e
};
b = b || 64;
c = c || 1;
d = d || 8;
e = e || !1;
var g = a.computeFrenetFrames(b, e);
this.tangents = g.tangents;
this.normals = g.normals;
this.binormals = g.binormals;
var h = new q,
m = new q,
k = new D,
t, p, n = [],
l = [],
G = [],
r = [];
for (t = 0; t < b; t++) f(t);
f(!1 === e ? b: 0);
for (t = 0; t <= b; t++) for (p = 0; p <= d; p++) k.x = t / b,
k.y = p / d,
G.push(k.x, k.y); (function() {
for (p = 1; p <= b; p++) for (t = 1; t <= d; t++) {
var a = (d + 1) * p + (t - 1),
c = (d + 1) * p + t,
e = (d + 1) * (p - 1) + t;
r.push((d + 1) * (p - 1) + (t - 1), a, e);
r.push(a, c, e)
}
})();
this.setIndex(r);
this.addAttribute("position", new z(n, 3));
this.addAttribute("normal", new z(l, 3));
this.addAttribute("uv", new z(G, 2))
}
function Oc(a, b, c, d, e, f, g) {
T.call(this);
this.type = "TorusKnotGeometry";
this.parameters = {
radius: a,
tube: b,
tubularSegments: c,
radialSegments: d,
p: e,
q: f
};
void 0 !== g && console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead.");
this.fromBufferGeometry(new Ub(a, b, c, d, e, f));
this.mergeVertices()
}
function Ub(a, b, c, d, e, f) {
function g(a, b, c, d, e) {
var f = Math.sin(a);
b = c / b * a;
c = Math.cos(b);
e.x = d * (2 + c) * .5 * Math.cos(a);
e.y = d * (2 + c) * f * .5;
e.z = d * Math.sin(b) * .5
}
I.call(this);
this.type = "TorusKnotBufferGeometry";
this.parameters = {
radius: a,
tube: b,
tubularSegments: c,
radialSegments: d,
p: e,
q: f
};
a = a || 100;
b = b || 40;
c = Math.floor(c) || 64;
d = Math.floor(d) || 8;
e = e || 2;
f = f || 3;
var h = [],
m = [],
k = [],
t = [],
p,
n,
l = new q,
G = new q;
new D;
var r = new q,
A = new q,
w = new q,
y = new q,
K = new q;
for (p = 0; p <= c; ++p) for (n = p / c * e * Math.PI * 2, g(n, e, f, a, r), g(n + .01, e, f, a, A), y.subVectors(A, r), K.addVectors(A, r), w.crossVectors(y, K), K.crossVectors(w, y), w.normalize(), K.normalize(), n = 0; n <= d; ++n) {
var v = n / d * Math.PI * 2,
E = -b * Math.cos(v),
v = b * Math.sin(v);
l.x = r.x + (E * K.x + v * w.x);
l.y = r.y + (E * K.y + v * w.y);
l.z = r.z + (E * K.z + v * w.z);
m.push(l.x, l.y, l.z);
G.subVectors(l, r).normalize();
k.push(G.x, G.y, G.z);
t.push(p / c);
t.push(n / d)
}
for (n = 1; n <= c; n++) for (p = 1; p <= d; p++) a = (d + 1) * n + (p - 1),
b = (d + 1) * n + p,
e = (d + 1) * (n - 1) + p,
h.push((d + 1) * (n - 1) + (p - 1), a, e),
h.push(a, b, e);
this.setIndex(h);
this.addAttribute("position", new z(m, 3));
this.addAttribute("normal", new z(k, 3));
this.addAttribute("uv", new z(t, 2))
}
function Pc(a, b, c, d, e) {
T.call(this);
this.type = "TorusGeometry";
this.parameters = {
radius: a,
tube: b,
radialSegments: c,
tubularSegments: d,
arc: e
};
this.fromBufferGeometry(new Vb(a, b, c, d, e))
}
function Vb(a, b, c, d, e) {
I.call(this);
this.type = "TorusBufferGeometry";
this.parameters = {
radius: a,
tube: b,
radialSegments: c,
tubularSegments: d,
arc: e
};
a = a || 100;
b = b || 40;
c = Math.floor(c) || 8;
d = Math.floor(d) || 6;
e = e || 2 * Math.PI;
var f = [],
g = [],
h = [],
m = [],
k = new q,
t = new q,
p = new q,
n,
l;
for (n = 0; n <= c; n++) for (l = 0; l <= d; l++) {
var G = l / d * e,
r = n / c * Math.PI * 2;
t.x = (a + b * Math.cos(r)) * Math.cos(G);
t.y = (a + b * Math.cos(r)) * Math.sin(G);
t.z = b * Math.sin(r);
g.push(t.x, t.y, t.z);
k.x = a * Math.cos(G);
k.y = a * Math.sin(G);
p.subVectors(t, k).normalize();
h.push(p.x, p.y, p.z);
m.push(l / d);
m.push(n / c)
}
for (n = 1; n <= c; n++) for (l = 1; l <= d; l++) a = (d + 1) * (n - 1) + l - 1,
b = (d + 1) * (n - 1) + l,
e = (d + 1) * n + l,
f.push((d + 1) * n + l - 1, a, e),
f.push(a, b, e);
this.setIndex(f);
this.addAttribute("position", new z(g, 3));
this.addAttribute("normal", new z(h, 3));
this.addAttribute("uv", new z(m, 2))
}
function La(a, b) {
"undefined" !== typeof a && (T.call(this), this.type = "ExtrudeGeometry", a = Array.isArray(a) ? a: [a], this.addShapeList(a, b), this.computeFaceNormals())
}
function Qc(a, b) {
b = b || {};
var c = b.font;
if (!1 === (c && c.isFont)) return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),
new T;
c = c.generateShapes(a, b.size, b.curveSegments);
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);
La.call(this, c, b);
this.type = "TextGeometry"
}
function Rc(a, b, c, d, e, f, g) {
T.call(this);
this.type = "SphereGeometry";
this.parameters = {
radius: a,
widthSegments: b,
heightSegments: c,
phiStart: d,
phiLength: e,
thetaStart: f,
thetaLength: g
};
this.fromBufferGeometry(new pb(a, b, c, d, e, f, g))
}
function pb(a, b, c, d, e, f, g) {
I.call(this);
this.type = "SphereBufferGeometry";
this.parameters = {
radius: a,
widthSegments: b,
heightSegments: c,
phiStart: d,
phiLength: e,
thetaStart: f,
thetaLength: g
};
a = a || 50;
b = Math.max(3, Math.floor(b) || 8);
c = Math.max(2, Math.floor(c) || 6);
d = void 0 !== d ? d: 0;
e = void 0 !== e ? e: 2 * Math.PI;
f = void 0 !== f ? f: 0;
g = void 0 !== g ? g: Math.PI;
var h = f + g,
m, k, t = 0,
p = [],
n = new q,
l = new q,
G = [],
r = [],
A = [],
w = [];
for (k = 0; k <= c; k++) {
var y = [],
K = k / c;
for (m = 0; m <= b; m++) {
var v = m / b;
n.x = -a * Math.cos(d + v * e) * Math.sin(f + K * g);
n.y = a * Math.cos(f + K * g);
n.z = a * Math.sin(d + v * e) * Math.sin(f + K * g);
r.push(n.x, n.y, n.z);
l.set(n.x, n.y, n.z).normalize();
A.push(l.x, l.y, l.z);
w.push(v, 1 - K);
y.push(t++)
}
p.push(y)
}
for (k = 0; k < c; k++) for (m = 0; m < b; m++) a = p[k][m + 1],
d = p[k][m],
e = p[k + 1][m],
g = p[k + 1][m + 1],
(0 !== k || 0 < f) && G.push(a, d, g),
(k !== c - 1 || h < Math.PI) && G.push(d, e, g);
this.setIndex(G);
this.addAttribute("position", new z(r, 3));
this.addAttribute("normal", new z(A, 3));
this.addAttribute("uv", new z(w, 2))
}
function Sc(a, b, c, d, e, f) {
T.call(this);
this.type = "RingGeometry";
this.parameters = {
innerRadius: a,
outerRadius: b,
thetaSegments: c,
phiSegments: d,
thetaStart: e,
thetaLength: f
};
this.fromBufferGeometry(new Wb(a, b, c, d, e, f))
}
function Wb(a, b, c, d, e, f) {
I.call(this);
this.type = "RingBufferGeometry";
this.parameters = {
innerRadius: a,
outerRadius: b,
thetaSegments: c,
phiSegments: d,
thetaStart: e,
thetaLength: f
};
a = a || 20;
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(1, d) : 1;
var g = [],
h = [],
m = [],
k = [],
t = a,
p = (b - a) / d,
n = new q,
l = new D,
G,
r;
for (G = 0; G <= d; G++) {
for (r = 0; r <= c; r++) a = e + r / c * f,
n.x = t * Math.cos(a),
n.y = t * Math.sin(a),
h.push(n.x, n.y, n.z),
m.push(0, 0, 1),
l.x = (n.x / b + 1) / 2,
l.y = (n.y / b + 1) / 2,
k.push(l.x, l.y);
t += p
}
for (G = 0; G < d; G++) for (b = G * (c + 1), r = 0; r < c; r++) a = r + b,
e = a + c + 1,
f = a + c + 2,
t = a + 1,
g.push(a, e, t),
g.push(e, f, t);
this.setIndex(g);
this.addAttribute("position", new z(h, 3));
this.addAttribute("normal", new z(m, 3));
this.addAttribute("uv", new z(k, 2))
}
function Tc(a, b, c, d) {
T.call(this);
this.type = "LatheGeometry";
this.parameters = {
points: a,
segments: b,
phiStart: c,
phiLength: d
};
this.fromBufferGeometry(new Xb(a, b, c, d));
this.mergeVertices()
}
function Xb(a, b, c, d) {
I.call(this);
this.type = "LatheBufferGeometry";
this.parameters = {
points: a,
segments: b,
phiStart: c,
phiLength: d
};
b = Math.floor(b) || 12;
c = c || 0;
d = d || 2 * Math.PI;
d = N.clamp(d, 0, 2 * Math.PI);
var e = [],
f = [],
g = [],
h = 1 / b,
m = new q,
k = new D,
t,
p;
for (t = 0; t <= b; t++) {
p = c + t * h * d;
var n = Math.sin(p),
l = Math.cos(p);
for (p = 0; p <= a.length - 1; p++) m.x = a[p].x * n,
m.y = a[p].y,
m.z = a[p].x * l,
f.push(m.x, m.y, m.z),
k.x = t / b,
k.y = p / (a.length - 1),
g.push(k.x, k.y)
}
for (t = 0; t < b; t++) for (p = 0; p < a.length - 1; p++) c = p + t * a.length,
h = c + a.length,
m = c + a.length + 1,
k = c + 1,
e.push(c, h, k),
e.push(h, m, k);
this.setIndex(e);
this.addAttribute("position", new z(f, 3));
this.addAttribute("uv", new z(g, 2));
this.computeVertexNormals();
if (d === 2 * Math.PI) for (d = this.attributes.normal.array, e = new q, f = new q, g = new q, c = b * a.length * 3, p = t = 0; t < a.length; t++, p += 3) e.x = d[p + 0],
e.y = d[p + 1],
e.z = d[p + 2],
f.x = d[c + p + 0],
f.y = d[c + p + 1],
f.z = d[c + p + 2],
g.addVectors(e, f).normalize(),
d[p + 0] = d[c + p + 0] = g.x,
d[p + 1] = d[c + p + 1] = g.y,
d[p + 2] = d[c + p + 2] = g.z
}
function Yb(a, b) {
T.call(this);
this.type = "ShapeGeometry";
"object" === typeof b && (console.warn("THREE.ShapeGeometry: Options parameter has been removed."), b = b.curveSegments);
this.parameters = {
shapes: a,
curveSegments: b
};
this.fromBufferGeometry(new Zb(a, b));
this.mergeVertices()
}
function Zb(a, b) {
function c(a) {
var c, h, k = e.length / 3;
a = a.extractPoints(b);
var l = a.shape,
r = a.holes;
if (!1 === Ia.isClockWise(l)) for (l = l.reverse(), a = 0, c = r.length; a < c; a++) h = r[a],
!0 === Ia.isClockWise(h) && (r[a] = h.reverse());
var q = Ia.triangulateShape(l, r);
a = 0;
for (c = r.length; a < c; a++) h = r[a],
l = l.concat(h);
a = 0;
for (c = l.length; a < c; a++) h = l[a],
e.push(h.x, h.y, 0),
f.push(0, 0, 1),
g.push(h.x, h.y);
a = 0;
for (c = q.length; a < c; a++) l = q[a],
d.push(l[0] + k, l[1] + k, l[2] + k),
m += 3
}
I.call(this);
this.type = "ShapeBufferGeometry";
this.parameters = {
shapes: a,
curveSegments: b
};
b = b || 12;
var d = [],
e = [],
f = [],
g = [],
h = 0,
m = 0;
if (!1 === Array.isArray(a)) c(a);
else for (var k = 0; k < a.length; k++) c(a[k]),
this.addGroup(h, m, k),
h += m,
m = 0;
this.setIndex(d);
this.addAttribute("position", new z(e, 3));
this.addAttribute("normal", new z(f, 3));
this.addAttribute("uv", new z(g, 2))
}
function $b(a, b) {
function c(a, b) {
return a - b
}
I.call(this);
this.type = "EdgesGeometry";
this.parameters = {
thresholdAngle: b
};
var d = [],
e = Math.cos(N.DEG2RAD * (void 0 !== b ? b: 1)),
f = [0, 0],
g = {},
h,
m = ["a", "b", "c"],
k;
a.isBufferGeometry ? (k = new T, k.fromBufferGeometry(a)) : k = a.clone();
k.mergeVertices();
k.computeFaceNormals();
var t = k.vertices;
k = k.faces;
for (var p = 0,
n = k.length; p < n; p++) for (var l = k[p], q = 0; 3 > q; q++) f[0] = l[m[q]],
f[1] = l[m[(q + 1) % 3]],
f.sort(c),
h = f.toString(),
void 0 === g[h] ? g[h] = {
index1: f[0],
index2: f[1],
face1: p,
face2: void 0
}: g[h].face2 = p;
for (h in g) if (f = g[h], void 0 === f.face2 || k[f.face1].normal.dot(k[f.face2].normal) <= e) m = t[f.index1],
d.push(m.x, m.y, m.z),
m = t[f.index2],
d.push(m.x, m.y, m.z);
this.addAttribute("position", new z(d, 3))
}
function qb(a, b, c, d, e, f, g, h) {
T.call(this);
this.type = "CylinderGeometry";
this.parameters = {
radiusTop: a,
radiusBottom: b,
height: c,
radialSegments: d,
heightSegments: e,
openEnded: f,
thetaStart: g,
thetaLength: h
};
this.fromBufferGeometry(new Va(a, b, c, d, e, f, g, h));
this.mergeVertices()
}
function Va(a, b, c, d, e, f, g, h) {
function m(c) {
var e, f, m, r = new D,
C = new q,
F = 0,
x = !0 === c ? a: b,
H = !0 === c ? 1 : -1;
f = G;
for (e = 1; e <= d; e++) p.push(0, A * H, 0),
n.push(0, H, 0),
l.push(.5, .5),
G++;
m = G;
for (e = 0; e <= d; e++) {
var aa = e / d * h + g,
z = Math.cos(aa),
aa = Math.sin(aa);
C.x = x * aa;
C.y = A * H;
C.z = x * z;
p.push(C.x, C.y, C.z);
n.push(0, H, 0);
r.x = .5 * z + .5;
r.y = .5 * aa * H + .5;
l.push(r.x, r.y);
G++
}
for (e = 0; e < d; e++) r = f + e,
C = m + e,
!0 === c ? t.push(C, C + 1, r) : t.push(C + 1, C, r),
F += 3;
k.addGroup(w, F, !0 === c ? 1 : 2);
w += F
}
I.call(this);
this.type = "CylinderBufferGeometry";
this.parameters = {
radiusTop: a,
radiusBottom: b,
height: c,
radialSegments: d,
heightSegments: e,
openEnded: f,
thetaStart: g,
thetaLength: h
};
var k = this;
a = void 0 !== a ? a: 20;
b = void 0 !== b ? b: 20;
c = void 0 !== c ? c: 100;
d = Math.floor(d) || 8;
e = Math.floor(e) || 1;
f = void 0 !== f ? f: !1;
g = void 0 !== g ? g: 0;
h = void 0 !== h ? h: 2 * Math.PI;
var t = [],
p = [],
n = [],
l = [],
G = 0,
r = [],
A = c / 2,
w = 0; (function() {
var f, m, v = new q,
E = new q,
L = 0,
C = (b - a) / c;
for (m = 0; m <= e; m++) {
var F = [],
x = m / e,
H = x * (b - a) + a;
for (f = 0; f <= d; f++) {
var D = f / d,
z = D * h + g,
J = Math.sin(z),
z = Math.cos(z);
E.x = H * J;
E.y = -x * c + A;
E.z = H * z;
p.push(E.x, E.y, E.z);
v.set(J, C, z).normalize();
n.push(v.x, v.y, v.z);
l.push(D, 1 - x);
F.push(G++)
}
r.push(F)
}
for (f = 0; f < d; f++) for (m = 0; m < e; m++) v = r[m + 1][f],
E = r[m + 1][f + 1],
C = r[m][f + 1],
t.push(r[m][f], v, C),
t.push(v, E, C),
L += 6;
k.addGroup(w, L, 0);
w += L
})(); ! 1 === f && (0 < a && m(!0), 0 < b && m(!1));
this.setIndex(t);
this.addAttribute("position", new z(p, 3));
this.addAttribute("normal", new z(n, 3));
this.addAttribute("uv", new z(l, 2))
}
function Uc(a, b, c, d, e, f, g) {
qb.call(this, 0, a, b, c, d, e, f, g);
this.type = "ConeGeometry";
this.parameters = {
radius: a,
height: b,
radialSegments: c,
heightSegments: d,
openEnded: e,
thetaStart: f,
thetaLength: g
}
}
function Vc(a, b, c, d, e, f, g) {
Va.call(this, 0, a, b, c, d, e, f, g);
this.type = "ConeBufferGeometry";
this.parameters = {
radius: a,
height: b,
radialSegments: c,
heightSegments: d,
openEnded: e,
thetaStart: f,
thetaLength: g
}
}
function Wc(a, b, c, d) {
T.call(this);
this.type = "CircleGeometry";
this.parameters = {
radius: a,
segments: b,
thetaStart: c,
thetaLength: d
};
this.fromBufferGeometry(new ac(a, b, c, d))
}
function ac(a, b, c, d) {
I.call(this);
this.type = "CircleBufferGeometry";
this.parameters = {
radius: a,
segments: b,
thetaStart: c,
thetaLength: d
};
a = a || 50;
b = void 0 !== b ? Math.max(3, b) : 8;
c = void 0 !== c ? c: 0;
d = void 0 !== d ? d: 2 * Math.PI;
var e = [],
f = [],
g = [],
h = [],
m,
k,
t = new q,
p = new D;
f.push(0, 0, 0);
g.push(0, 0, 1);
h.push(.5, .5);
k = 0;
for (m = 3; k <= b; k++, m += 3) {
var n = c + k / b * d;
t.x = a * Math.cos(n);
t.y = a * Math.sin(n);
f.push(t.x, t.y, t.z);
g.push(0, 0, 1);
p.x = (f[m] / a + 1) / 2;
p.y = (f[m + 1] / a + 1) / 2;
h.push(p.x, p.y)
}
for (m = 1; m <= b; m++) e.push(m, m + 1, 0);
this.setIndex(e);
this.addAttribute("position", new z(f, 3));
this.addAttribute("normal", new z(g, 3));
this.addAttribute("uv", new z(h, 2))
}
function bc() {
Ha.call(this, {
uniforms: Ja.merge([V.lights, {
opacity: {
value: 1
}
}]),
vertexShader: Z.shadow_vert,
fragmentShader: Z.shadow_frag
});
this.transparent = this.lights = !0;
Object.defineProperties(this, {
opacity: {
enumerable: !0,
get: function() {
return this.uniforms.opacity.value
},
set: function(a) {
this.uniforms.opacity.value = a
}
}
})
}
function cc(a) {
Ha.call(this, a);
this.type = "RawShaderMaterial"
}
function Xc(a) {
this.uuid = N.generateUUID();
this.type = "MultiMaterial";
this.materials = Array.isArray(a) ? a: [];
this.visible = !0
}
function Qa(a) {
X.call(this);
this.defines = {
STANDARD: ""
};
this.type = "MeshStandardMaterial";
this.color = new J(16777215);
this.metalness = this.roughness = .5;
this.lightMap = this.map = null;
this.lightMapIntensity = 1;
this.aoMap = null;
this.aoMapIntensity = 1;
this.emissive = new J(0);
this.emissiveIntensity = 1;
this.bumpMap = this.emissiveMap = null;
this.bumpScale = 1;
this.normalMap = null;
this.normalScale = new D(1, 1);
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.envMap = this.alphaMap = this.metalnessMap = this.roughnessMap = null;
this.envMapIntensity = 1;
this.refractionRatio = .98;
this.wireframe = !1;
this.wireframeLinewidth = 1;
this.wireframeLinejoin = this.wireframeLinecap = "round";
this.morphNormals = this.morphTargets = this.skinning = !1;
this.setValues(a)
}
function rb(a) {
Qa.call(this);
this.defines = {
PHYSICAL: ""
};
this.type = "MeshPhysicalMaterial";
this.reflectivity = .5;
this.clearCoatRoughness = this.clearCoat = 0;
this.setValues(a)
}
function Ca(a) {
X.call(this);
this.type = "MeshPhongMaterial";
this.color = new J(16777215);
this.specular = new J(1118481);
this.shininess = 30;
this.lightMap = this.map = null;
this.lightMapIntensity = 1;
this.aoMap = null;
this.aoMapIntensity = 1;
this.emissive = new J(0);
this.emissiveIntensity = 1;
this.bumpMap = this.emissiveMap = null;
this.bumpScale = 1;
this.normalMap = null;
this.normalScale = new D(1, 1);
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.envMap = this.alphaMap = this.specularMap = null;
this.combine = 0;
this.reflectivity = 1;
this.refractionRatio = .98;
this.wireframe = !1;
this.wireframeLinewidth = 1;
this.wireframeLinejoin = this.wireframeLinecap = "round";
this.morphNormals = this.morphTargets = this.skinning = !1;
this.setValues(a)
}
function sb(a) {
Ca.call(this);
this.defines = {
TOON: ""
};
this.type = "MeshToonMaterial";
this.gradientMap = null;
this.setValues(a)
}
function tb(a) {
X.call(this, a);
this.type = "MeshNormalMaterial";
this.bumpMap = null;
this.bumpScale = 1;
this.normalMap = null;
this.normalScale = new D(1, 1);
this.displacementMap = null;
this.displacementScale = 1;
this.displacementBias = 0;
this.wireframe = !1;
this.wireframeLinewidth = 1;
this.morphNormals = this.morphTargets = this.skinning = this.lights = this.fog = !1;
this.setValues(a)
}
function ub(a) {
X.call(this);
this.type = "MeshLambertMaterial";
this.color = new J(16777215);
this.lightMap = this.map = null;
this.lightMapIntensity = 1;
this.aoMap = null;
this.aoMapIntensity = 1;
this.emissive = new J(0);
this.emissiveIntensity = 1;
this.envMap = this.alphaMap = this.specularMap = this.emissiveMap = null;
this.combine = 0;
this.reflectivity = 1;
this.refractionRatio = .98;
this.wireframe = !1;
this.wireframeLinewidth = 1;
this.wireframeLinejoin = this.wireframeLinecap = "round";
this.morphNormals = this.morphTargets = this.skinning = !1;
this.setValues(a)
}
function vb(a) {
X.call(this);
this.type = "LineDashedMaterial";
this.color = new J(16777215);
this.scale = this.linewidth = 1;
this.dashSize = 3;
this.gapSize = 1;
this.lights = !1;
this.setValues(a)
}
function $d(a, b, c) {
var d = this,
e = !1,
f = 0,
g = 0;
this.onStart = void 0;
this.onLoad = a;
this.onProgress = b;
this.onError = c;
this.itemStart = function(a) {
g++;
if (!1 === e && void 0 !== d.onStart) d.onStart(a, f, g);
e = !0
};
this.itemEnd = function(a) {
f++;
if (void 0 !== d.onProgress) d.onProgress(a, f, g);
if (f === g && (e = !1, void 0 !== d.onLoad)) d.onLoad()
};
this.itemError = function(a) {
if (void 0 !== d.onError) d.onError(a)
}
}
function sa(a) {
this.manager = void 0 !== a ? a: ta
}
function Re(a) {
this.manager = void 0 !== a ? a: ta;
this._parser = null
}
function ae(a) {
this.manager = void 0 !== a ? a: ta;
this._parser = null
}
function Yc(a) {
this.manager = void 0 !== a ? a: ta
}
function be(a) {
this.manager = void 0 !== a ? a: ta
}
function td(a) {
this.manager = void 0 !== a ? a: ta
}
function ma(a, b) {
x.call(this);
this.type = "Light";
this.color = new J(a);
this.intensity = void 0 !== b ? b: 1;
this.receiveShadow = void 0
}
function ud(a, b, c) {
ma.call(this, a, c);
this.type = "HemisphereLight";
this.castShadow = void 0;
this.position.copy(x.DefaultUp);
this.updateMatrix();
this.groundColor = new J(b)
}
function wb(a) {
this.camera = a;
this.bias = 0;
this.radius = 1;
this.mapSize = new D(512, 512);
this.map = null;
this.matrix = new S
}
function vd() {
wb.call(this, new Fa(50, 1, .5, 500))
}
function wd(a, b, c, d, e, f) {
ma.call(this, a, b);
this.type = "SpotLight";
this.position.copy(x.DefaultUp);
this.updateMatrix();
this.target = new x;
Object.defineProperty(this, "power", {
get: function() {
return this.intensity * Math.PI
},
set: function(a) {
this.intensity = a / Math.PI
}
});
this.distance = void 0 !== c ? c: 0;
this.angle = void 0 !== d ? d: Math.PI / 3;
this.penumbra = void 0 !== e ? e: 0;
this.decay = void 0 !== f ? f: 1;
this.shadow = new vd
}
function xd(a, b, c, d) {
ma.call(this, a, b);
this.type = "PointLight";
Object.defineProperty(this, "power", {
get: function() {
return 4 * this.intensity * Math.PI
},
set: function(a) {
this.intensity = a / (4 * Math.PI)
}
});
this.distance = void 0 !== c ? c: 0;
this.decay = void 0 !== d ? d: 1;
this.shadow = new wb(new Fa(90, 1, .5, 500))
}
function yd() {
wb.call(this, new Jb( - 5, 5, 5, -5, .5, 500))
}
function zd(a, b) {
ma.call(this, a, b);
this.type = "DirectionalLight";
this.position.copy(x.DefaultUp);
this.updateMatrix();
this.target = new x;
this.shadow = new yd
}
function Ad(a, b) {
ma.call(this, a, b);
this.type = "AmbientLight";
this.castShadow = void 0
}
function xa(a, b, c, d) {
this.parameterPositions = a;
this._cachedIndex = 0;
this.resultBuffer = void 0 !== d ? d: new b.constructor(c);
this.sampleValues = b;
this.valueSize = c
}
function Bd(a, b, c, d) {
xa.call(this, a, b, c, d);
this._offsetNext = this._weightNext = this._offsetPrev = this._weightPrev = -0
}
function Zc(a, b, c, d) {
xa.call(this, a, b, c, d)
}
function Cd(a, b, c, d) {
xa.call(this, a, b, c, d)
}
function xb(a, b, c, d) {
if (void 0 === a) throw Error("track name is undefined");
if (void 0 === b || 0 === b.length) throw Error("no keyframes in track named " + a);
this.name = a;
this.times = na.convertArray(b, this.TimeBufferType);
this.values = na.convertArray(c, this.ValueBufferType);
this.setInterpolation(d || this.DefaultInterpolation);
this.validate();
this.optimize()
}
function dc(a, b, c, d) {
xb.call(this, a, b, c, d)
}
function Dd(a, b, c, d) {
xa.call(this, a, b, c, d)
}
function $c(a, b, c, d) {
xb.call(this, a, b, c, d)
}
function ec(a, b, c, d) {
xb.call(this, a, b, c, d)
}
function Ed(a, b, c, d) {
xb.call(this, a, b, c, d)
}
function Fd(a, b, c) {
xb.call(this, a, b, c)
}
function Gd(a, b, c, d) {
xb.call(this, a, b, c, d)
}
function yb(a, b, c, d) {
xb.apply(this, arguments)
}
function qa(a, b, c) {
this.name = a;
this.tracks = c;
this.duration = void 0 !== b ? b: -1;
this.uuid = N.generateUUID();
0 > this.duration && this.resetDuration();
this.optimize()
}
function Hd(a) {
this.manager = void 0 !== a ? a: ta;
this.textures = {}
}
function ce(a) {
this.manager = void 0 !== a ? a: ta
}
function zb() {
this.onLoadStart = function() {};
this.onLoadProgress = function() {};
this.onLoadComplete = function() {}
}
function de(a) {
"boolean" === typeof a && (console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."), a = void 0);
this.manager = void 0 !== a ? a: ta;
this.withCredentials = !1
}
function Se(a) {
this.manager = void 0 !== a ? a: ta;
this.texturePath = ""
}
function Te(a, b, c, d, e) {
b = .5 * (d - b);
e = .5 * (e - c);
var f = a * a;
return (2 * c - 2 * d + b + e) * a * f + ( - 3 * c + 3 * d - 2 * b - e) * f + b * a + c
}
function Ab(a, b, c, d) {
var e = 1 - a;
return e * e * b + 2 * (1 - a) * a * c + a * a * d
}
function Bb(a, b, c, d, e) {
var f = 1 - a,
g = 1 - a;
return f * f * f * b + 3 * g * g * a * c + 3 * (1 - a) * a * a * d + a * a * a * e
}
function ua() {}
function Ta(a, b) {
this.v1 = a;
this.v2 = b
}
function ad() {
this.curves = [];
this.autoClose = !1
}
function Wa(a, b, c, d, e, f, g, h) {
this.aX = a;
this.aY = b;
this.xRadius = c;
this.yRadius = d;
this.aStartAngle = e;
this.aEndAngle = f;
this.aClockwise = g;
this.aRotation = h || 0
}
function Cb(a) {
this.points = void 0 === a ? [] : a
}
function fc(a, b, c, d) {
this.v0 = a;
this.v1 = b;
this.v2 = c;
this.v3 = d
}
function gc(a, b, c) {
this.v0 = a;
this.v1 = b;
this.v2 = c
}
function bd(a) {
ad.call(this);
this.currentPoint = new D;
a && this.fromPoints(a)
}
function Db() {
bd.apply(this, arguments);
this.holes = []
}
function ee() {
this.subPaths = [];
this.currentPath = null
}
function fe(a) {
this.data = a
}
function Ue(a) {
this.manager = void 0 !== a ? a: ta
}
function ge(a) {
this.manager = void 0 !== a ? a: ta
}
function he(a, b, c, d) {
ma.call(this, a, b);
this.type = "RectAreaLight";
this.position.set(0, 1, 0);
this.updateMatrix();
this.width = void 0 !== c ? c: 10;
this.height = void 0 !== d ? d: 10
}
function Ve() {
this.type = "StereoCamera";
this.aspect = 1;
this.eyeSep = .064;
this.cameraL = new Fa;
this.cameraL.layers.enable(1);
this.cameraL.matrixAutoUpdate = !1;
this.cameraR = new Fa;
this.cameraR.layers.enable(2);
this.cameraR.matrixAutoUpdate = !1
}
function Id(a, b, c) {
x.call(this);
this.type = "CubeCamera";
var d = new Fa(90, 1, a, b);
d.up.set(0, -1, 0);
d.lookAt(new q(1, 0, 0));
this.add(d);
var e = new Fa(90, 1, a, b);
e.up.set(0, -1, 0);
e.lookAt(new q( - 1, 0, 0));
this.add(e);
var f = new Fa(90, 1, a, b);
f.up.set(0, 0, 1);
f.lookAt(new q(0, 1, 0));
this.add(f);
var g = new Fa(90, 1, a, b);
g.up.set(0, 0, -1);
g.lookAt(new q(0, -1, 0));
this.add(g);
var h = new Fa(90, 1, a, b);
h.up.set(0, -1, 0);
h.lookAt(new q(0, 0, 1));
this.add(h);
var m = new Fa(90, 1, a, b);
m.up.set(0, -1, 0);
m.lookAt(new q(0, 0, -1));
this.add(m);
this.renderTarget = new Gb(c, c, {
format: 1022,
magFilter: 1006,
minFilter: 1006
});
this.updateCubeMap = function(a, b) {
null === this.parent && this.updateMatrixWorld();
var c = this.renderTarget,
n = c.texture.generateMipmaps;
c.texture.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.texture.generateMipmaps = n;
c.activeCubeFace = 5;
a.render(b, m, c);
a.setRenderTarget(null)
}
}
function ie() {
x.call(this);
this.type = "AudioListener";
this.context = je.getContext();
this.gain = this.context.createGain();
this.gain.connect(this.context.destination);
this.filter = null
}
function hc(a) {
x.call(this);
this.type = "Audio";
this.context = a.context;
this.gain = this.context.createGain();
this.gain.connect(a.getInput());
this.autoplay = !1;
this.buffer = null;
this.loop = !1;
this.startTime = 0;
this.playbackRate = 1;
this.isPlaying = !1;
this.hasPlaybackControl = !0;
this.sourceType = "empty";
this.filters = []
}
function ke(a) {
hc.call(this, a);
this.panner = this.context.createPanner();
this.panner.connect(this.gain)
}
function le(a, b) {
this.analyser = a.context.createAnalyser();
this.analyser.fftSize = void 0 !== b ? b: 2048;
this.data = new Uint8Array(this.analyser.frequencyBinCount);
a.getOutput().connect(this.analyser)
}
function Jd(a, b, c) {
this.binding = a;
this.valueSize = c;
a = Float64Array;
switch (b) {
case "quaternion":
b = this._slerp;
break;
case "string":
case "bool":
a = Array;
b = this._select;
break;
default:
b = this._lerp
}
this.buffer = new a(4 * c);
this._mixBufferRegion = b;
this.referenceCount = this.useCount = this.cumulativeWeight = 0
}
function ka(a, b, c) {
this.path = b;
this.parsedPath = c || ka.parseTrackName(b);
this.node = ka.findNode(a, this.parsedPath.nodeName) || a;
this.rootNode = a
}
function me(a) {
this.uuid = N.generateUUID();
this._objects = Array.prototype.slice.call(arguments);
this.nCachedObjects_ = 0;
var b = {};
this._indicesByUUID = b;
for (var c = 0,
d = arguments.length; c !== d; ++c) b[arguments[c].uuid] = c;
this._paths = [];
this._parsedPaths = [];
this._bindings = [];
this._bindingsIndicesByPath = {};
var e = this;
this.stats = {
objects: {
get total() {
return e._objects.length
},
get inUse() {
return this.total - e.nCachedObjects_
}
},
get bindingsPerObject() {
return e._bindings.length
}
}
}
function ne(a, b, c) {
this._mixer = a;
this._clip = b;
this._localRoot = c || null;
a = b.tracks;
b = a.length;
c = Array(b);
for (var d = {
endingStart: 2400,
endingEnd: 2400
},
e = 0; e !== b; ++e) {
var f = a[e].createInterpolant(null);
c[e] = f;
f.settings = d
}
this._interpolantSettings = d;
this._interpolants = c;
this._propertyBindings = Array(b);
this._weightInterpolant = this._timeScaleInterpolant = this._byClipCacheIndex = this._cacheIndex = null;
this.loop = 2201;
this._loopCount = -1;
this._startTime = null;
this.time = 0;
this._effectiveWeight = this.weight = this._effectiveTimeScale = this.timeScale = 1;
this.repetitions = Infinity;
this.paused = !1;
this.enabled = !0;
this.clampWhenFinished = !1;
this.zeroSlopeAtEnd = this.zeroSlopeAtStart = !0
}
function cd(a) {
this._root = a;
this._initMemoryManager();
this.time = this._accuIndex = 0;
this.timeScale = 1
}
function Kd(a, b) {
"string" === typeof a && (console.warn("THREE.Uniform: Type parameter is no longer needed."), a = b);
this.value = a
}
function Eb() {
I.call(this);
this.type = "InstancedBufferGeometry";
this.maxInstancedCount = void 0
}
function oe(a, b, c, d) {
this.uuid = N.generateUUID();
this.data = a;
this.itemSize = b;
this.offset = c;
this.normalized = !0 === d
}
function ic(a, b) {
this.uuid = N.generateUUID();
this.array = a;
this.stride = b;
this.count = void 0 !== a ? a.length / b: 0;
this.dynamic = !1;
this.updateRange = {
offset: 0,
count: -1
};
this.onUploadCallback = function() {};
this.version = 0
}
function jc(a, b, c) {
ic.call(this, a, b);
this.meshPerAttribute = c || 1
}
function kc(a, b, c) {
U.call(this, a, b);
this.meshPerAttribute = c || 1
}
function pe(a, b, c, d) {
this.ray = new cb(a, b);
this.near = c || 0;
this.far = d || Infinity;
this.params = {
Mesh: {},
Line: {},
LOD: {},
Points: {
threshold: 1
},
Sprite: {}
};
Object.defineProperties(this.params, {
PointCloud: {
get: function() {
console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points.");
return this.Points
}
}
})
}
function We(a, b) {
return a.distance - b.distance
}
function qe(a, b, c, d) {
if (!1 !== a.visible && (a.raycast(b, c), !0 === d)) {
a = a.children;
d = 0;
for (var e = a.length; d < e; d++) qe(a[d], b, c, !0)
}
}
function re(a) {
this.autoStart = void 0 !== a ? a: !0;
this.elapsedTime = this.oldTime = this.startTime = 0;
this.running = !1
}
function se(a, b, c) {
this.radius = void 0 !== a ? a: 1;
this.phi = void 0 !== b ? b: 0;
this.theta = void 0 !== c ? c: 0;
return this
}
function te(a, b, c) {
this.radius = void 0 !== a ? a: 1;
this.theta = void 0 !== b ? b: 0;
this.y = void 0 !== c ? c: 0;
return this
}
function oa(a, b) {
Aa.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)
}
function dd(a) {
x.call(this);
this.material = a;
this.render = function(a) {}
}
function ed(a, b, c, d) {
this.object = a;
this.size = void 0 !== b ? b: 1;
a = void 0 !== c ? c: 16711680;
d = void 0 !== d ? d: 1;
b = 0; (c = this.object.geometry) && c.isGeometry ? b = 3 * c.faces.length: c && c.isBufferGeometry && (b = c.attributes.normal.count);
c = new I;
b = new z(6 * b, 3);
c.addAttribute("position", b);
ga.call(this, c, new ia({
color: a,
linewidth: d
}));
this.matrixAutoUpdate = !1;
this.update()
}
function lc(a) {
x.call(this);
this.light = a;
this.light.updateMatrixWorld();
this.matrix = a.matrixWorld;
this.matrixAutoUpdate = !1;
a = new I;
for (var b = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1], c = 0, d = 1; 32 > c; c++, d++) {
var e = c / 32 * Math.PI * 2,
f = d / 32 * Math.PI * 2;
b.push(Math.cos(e), Math.sin(e), 1, Math.cos(f), Math.sin(f), 1)
}
a.addAttribute("position", new z(b, 3));
b = new ia({
fog: !1
});
this.cone = new ga(a, b);
this.add(this.cone);
this.update()
}
function mc(a) {
this.bones = this.getBoneList(a);
for (var b = new I,
c = [], d = [], e = new J(0, 0, 1), f = new J(0, 1, 0), g = 0; g < this.bones.length; g++) {
var h = this.bones[g];
h.parent && h.parent.isBone && (c.push(0, 0, 0), c.push(0, 0, 0), d.push(e.r, e.g, e.b), d.push(f.r, f.g, f.b))
}
b.addAttribute("position", new z(c, 3));
b.addAttribute("color", new z(d, 3));
c = new ia({
vertexColors: 2,
depthTest: !1,
depthWrite: !1,
transparent: !0
});
ga.call(this, b, c);
this.root = a;
this.matrix = a.matrixWorld;
this.matrixAutoUpdate = !1;
this.update()
}
function nc(a, b) {
this.light = a;
this.light.updateMatrixWorld();
var c = new pb(b, 4, 2),
d = new Ka({
wireframe: !0,
fog: !1
});
d.color.copy(this.light.color).multiplyScalar(this.light.intensity);
Aa.call(this, c, d);
this.matrix = this.light.matrixWorld;
this.matrixAutoUpdate = !1
}
function oc(a) {
x.call(this);
this.light = a;
this.light.updateMatrixWorld();
var b = new Ka({
color: a.color,
fog: !1
});
a = new Ka({
color: a.color,
fog: !1,
wireframe: !0
});
var c = new I;
c.addAttribute("position", new U(new Float32Array(18), 3));
this.add(new Aa(c, b));
this.add(new Aa(c, a));
this.update()
}
function pc(a, b) {
x.call(this);
this.light = a;
this.light.updateMatrixWorld();
this.matrix = a.matrixWorld;
this.matrixAutoUpdate = !1;
var c = new ob(b);
c.rotateY(.5 * Math.PI);
var d = new Ka({
vertexColors: 2,
wireframe: !0
}),
e = c.getAttribute("position"),
e = new Float32Array(3 * e.count);
c.addAttribute("color", new U(e, 3));
this.add(new Aa(c, d));
this.update()
}
function fd(a, b, c, d) {
a = a || 10;
b = b || 10;
c = new J(void 0 !== c ? c: 4473924);
d = new J(void 0 !== d ? d: 8947848);
var e = b / 2,
f = a / b,
g = a / 2;
a = [];
for (var h = [], m = 0, k = 0, t = -g; m <= b; m++, t += f) {
a.push( - g, 0, t, g, 0, t);
a.push(t, 0, -g, t, 0, g);
var l = m === e ? c: d;
l.toArray(h, k);
k += 3;
l.toArray(h, k);
k += 3;
l.toArray(h, k);
k += 3;
l.toArray(h, k);
k += 3
}
b = new I;
b.addAttribute("position", new z(a, 3));
b.addAttribute("color", new z(h, 3));
c = new ia({
vertexColors: 2
});
ga.call(this, b, c)
}
function Ld(a, b, c, d, e, f) {
a = a || 10;
b = b || 16;
c = c || 8;
d = d || 64;
e = new J(void 0 !== e ? e: 4473924);
f = new J(void 0 !== f ? f: 8947848);
var g = [],
h = [],
m,
k,
t,
l,
n;
for (t = 0; t <= b; t++) k = t / b * 2 * Math.PI,
m = Math.sin(k) * a,
k = Math.cos(k) * a,
g.push(0, 0, 0),
g.push(m, 0, k),
n = t & 1 ? e: f,
h.push(n.r, n.g, n.b),
h.push(n.r, n.g, n.b);
for (t = 0; t <= c; t++) for (n = t & 1 ? e: f, l = a - a / c * t, b = 0; b < d; b++) k = b / d * 2 * Math.PI,
m = Math.sin(k) * l,
k = Math.cos(k) * l,
g.push(m, 0, k),
h.push(n.r, n.g, n.b),
k = (b + 1) / d * 2 * Math.PI,
m = Math.sin(k) * l,
k = Math.cos(k) * l,
g.push(m, 0, k),
h.push(n.r, n.g, n.b);
a = new I;
a.addAttribute("position", new z(g, 3));
a.addAttribute("color", new z(h, 3));
g = new ia({
vertexColors: 2
});
ga.call(this, a, g)
}
function gd(a, b, c, d) {
this.object = a;
this.size = void 0 !== b ? b: 1;
a = void 0 !== c ? c: 16776960;
d = void 0 !== d ? d: 1;
b = 0; (c = this.object.geometry) && c.isGeometry ? b = c.faces.length: console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");
c = new I;
b = new z(6 * b, 3);
c.addAttribute("position", b);
ga.call(this, c, new ia({
color: a,
linewidth: d
}));
this.matrixAutoUpdate = !1;
this.update()
}
function qc(a, b) {
x.call(this);
this.light = a;
this.light.updateMatrixWorld();
this.matrix = a.matrixWorld;
this.matrixAutoUpdate = !1;
void 0 === b && (b = 1);
var c = new I;
c.addAttribute("position", new z([ - b, b, 0, b, b, 0, b, -b, 0, -b, -b, 0, -b, b, 0], 3));
var d = new ia({
fog: !1
});
this.add(new Ua(c, d));
c = new I;
c.addAttribute("position", new z([0, 0, 0, 0, 0, 1], 3));
this.add(new Ua(c, d));
this.update()
}
function hd(a) {
function b(a, b, d) {
c(a, d);
c(b, d)
}
function c(a, b) {
f.push(0, 0, 0);
g.push(b.r, b.g, b.b);
void 0 === h[a] && (h[a] = []);
h[a].push(f.length / 3 - 1)
}
var d = new I,
e = new ia({
color: 16777215,
vertexColors: 1
}),
f = [],
g = [],
h = {},
m = new J(16755200),
k = new J(16711680),
l = new J(43775),
p = new J(16777215),
n = new J(3355443);
b("n1", "n2", m);
b("n2", "n4", m);
b("n4", "n3", m);
b("n3", "n1", m);
b("f1", "f2", m);
b("f2", "f4", m);
b("f4", "f3", m);
b("f3", "f1", m);
b("n1", "f1", m);
b("n2", "f2", m);
b("n3", "f3", m);
b("n4", "f4", m);
b("p", "n1", k);
b("p", "n2", k);
b("p", "n3", k);
b("p", "n4", k);
b("u1", "u2", l);
b("u2", "u3", l);
b("u3", "u1", l);
b("c", "t", p);
b("p", "c", n);
b("cn1", "cn2", n);
b("cn3", "cn4", n);
b("cf1", "cf2", n);
b("cf3", "cf4", n);
d.addAttribute("position", new z(f, 3));
d.addAttribute("color", new z(g, 3));
ga.call(this, d, e);
this.camera = a;
this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix();
this.matrix = a.matrixWorld;
this.matrixAutoUpdate = !1;
this.pointMap = h;
this.update()
}
function rc(a, b) {
void 0 === b && (b = 16776960);
var c = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]),
d = new Float32Array(24),
e = new I;
e.setIndex(new U(c, 1));
e.addAttribute("position", new U(d, 3));
ga.call(this, e, new ia({
color: b
}));
void 0 !== a && this.update(a)
}
function Fb(a, b, c, d, e, f) {
x.call(this);
void 0 === d && (d = 16776960);
void 0 === c && (c = 1);
void 0 === e && (e = .2 * c);
void 0 === f && (f = .2 * e);
void 0 === Md && (Md = new I, Md.addAttribute("position", new z([0, 0, 0, 0, 1, 0], 3)), ue = new Va(0, .5, 1, 5, 1), ue.translate(0, -.5, 0));
this.position.copy(b);
this.line = new Ua(Md, new ia({
color: d
}));
this.line.matrixAutoUpdate = !1;
this.add(this.line);
this.cone = new Aa(ue, new Ka({
color: d
}));
this.cone.matrixAutoUpdate = !1;
this.add(this.cone);
this.setDirection(a);
this.setLength(c, e, f)
}
function Nd(a) {
a = a || 1;
var b = [0, 0, 0, a, 0, 0, 0, 0, 0, 0, a, 0, 0, 0, 0, 0, 0, a];
a = new I;
a.addAttribute("position", new z(b, 3));
a.addAttribute("color", new z([1, 0, 0, 1, .6, 0, 0, 1, 0, .6, 1, 0, 0, 0, 1, 0, .6, 1], 3));
b = new ia({
vertexColors: 2
});
ga.call(this, a, b)
}
function ve() {
var a = 0,
b = 0,
c = 0,
d = 0;
return {
initCatmullRom: function(e, f, g, h, m) {
e = m * (g - e);
h = m * (h - f);
a = f;
b = e;
c = -3 * f + 3 * g - 2 * e - h;
d = 2 * f - 2 * g + e + h
},
initNonuniformCatmullRom: function(e, f, g, h, m, k, l) {
e = ((f - e) / m - (g - e) / (m + k) + (g - f) / k) * k;
h = ((g - f) / k - (h - f) / (k + l) + (h - g) / l) * k;
a = f;
b = e;
c = -3 * f + 3 * g - 2 * e - h;
d = 2 * f - 2 * g + e + h
},
calc: function(e) {
var f = e * e;
return a + b * e + c * f + d * f * e
}
}
}
function va(a) {
this.points = a || [];
this.closed = !1
}
function id(a, b, c, d) {
this.v0 = a;
this.v1 = b;
this.v2 = c;
this.v3 = d
}
function jd(a, b, c) {
this.v0 = a;
this.v1 = b;
this.v2 = c
}
function kd(a, b) {
this.v1 = a;
this.v2 = b
}
function Od(a, b, c, d, e, f) {
Wa.call(this, a, b, c, c, d, e, f)
}
function Xe(a) {
console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");
va.call(this, a);
this.type = "catmullrom";
this.closed = !0
}
function Ye(a) {
console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");
va.call(this, a);
this.type = "catmullrom"
}
function we(a) {
console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.");
va.call(this, a);
this.type = "catmullrom"
}
void 0 === Number.EPSILON && (Number.EPSILON = Math.pow(2, -52));
void 0 === Math.sign && (Math.sign = function(a) {
return 0 > a ? -1 : 0 < a ? 1 : +a
});
void 0 === Function.prototype.name && Object.defineProperty(Function.prototype, "name", {
get: function() {
return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]
}
});
void 0 === Object.assign &&
function() {
Object.assign = function(a) {
if (void 0 === a || null === a) throw new TypeError("Cannot convert undefined or null to object");
for (var b = Object(a), c = 1; c < arguments.length; c++) {
var d = arguments[c];
if (void 0 !== d && null !== d) for (var e in d) Object.prototype.hasOwnProperty.call(d, e) && (b[e] = d[e])
}
return b
}
} ();
pa.prototype = {
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)
},
removeEventListener: function(a, b) {
if (void 0 !== this._listeners) {
var c = this._listeners[a];
if (void 0 !== c) {
var d = c.indexOf(b); - 1 !== d && c.splice(d, 1)
}
}
},
dispatchEvent: function(a) {
if (void 0 !== this._listeners) {
var b = this._listeners[a.type];
if (void 0 !== b) {
a.target = this;
var c = [],
d,
e = b.length;
for (d = 0; d < e; d++) c[d] = b[d];
for (d = 0; d < e; d++) c[d].call(this, a)
}
}
}
};
var N = {
DEG2RAD: Math.PI / 180,
RAD2DEG: 180 / Math.PI,
generateUUID: function() {
var a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),
b = Array(36),
c = 0,
d;
return function() {
for (var e = 0; 36 > e; e++) 8 === e || 13 === e || 18 === e || 23 === e ? b[e] = "-": 14 === e ? b[e] = "4": (2 >= c && (c = 33554432 + 16777216 * Math.random() | 0), d = c & 15, c >>= 4, b[e] = a[19 === e ? d & 3 | 8 : d]);
return b.join("")
}
} (),
clamp: function(a, b, c) {
return Math.max(b, Math.min(c, a))
},
euclideanModulo: function(a, b) {
return (a % b + b) % b
},
mapLinear: function(a, b, c, d, e) {
return d + (a - b) * (e - d) / (c - b)
},
lerp: function(a, b, c) {
return (1 - c) * a + c * b
},
smoothstep: function(a, b, c) {
if (a <= b) return 0;
if (a >= c) return 1;
a = (a - b) / (c - b);
return a * a * (3 - 2 * a)
},
smootherstep: function(a, b, c) {
if (a <= b) return 0;
if (a >= c) return 1;
a = (a - b) / (c - b);
return a * a * a * (a * (6 * a - 15) + 10)
},
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())
},
degToRad: function(a) {
return a * N.DEG2RAD
},
radToDeg: function(a) {
return a * N.RAD2DEG
},
isPowerOfTwo: function(a) {
return 0 === (a & a - 1) && 0 !== a
},
nearestPowerOfTwo: function(a) {
return Math.pow(2, Math.round(Math.log(a) / Math.LN2))
},
nextPowerOfTwo: function(a) {
a--;
a |= a >> 1;
a |= a >> 2;
a |= a >> 4;
a |= a >> 8;
a |= a >> 16;
a++;
return a
}
};
D.prototype = {
constructor: D,
isVector2: !0,
get width() {
return this.x
},
set width(a) {
this.x = a
},
get height() {
return this.y
},
set height(a) {
this.y = a
},
set: function(a, b) {
this.x = a;
this.y = b;
return this
},
setScalar: function(a) {
this.y = this.x = a;
return this
},
setX: function(a) {
this.x = a;
return this
},
setY: function(a) {
this.y = a;
return 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);
}
return this
},
getComponent: function(a) {
switch (a) {
case 0:
return this.x;
case 1:
return this.y;
default:
throw Error("index is out of range: " + a);
}
},
clone: function() {
return new this.constructor(this.x, this.y)
},
copy: function(a) {
this.x = a.x;
this.y = a.y;
return this
},
add: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
this.addVectors(a, b);
this.x += a.x;
this.y += a.y;
return this
},
addScalar: function(a) {
this.x += a;
this.y += a;
return this
},
addVectors: function(a, b) {
this.x = a.x + b.x;
this.y = a.y + b.y;
return this
},
addScaledVector: function(a, b) {
this.x += a.x * b;
this.y += a.y * b;
return this
},
sub: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
this.subVectors(a, b);
this.x -= a.x;
this.y -= a.y;
return this
},
subScalar: function(a) {
this.x -= a;
this.y -= a;
return this
},
subVectors: function(a, b) {
this.x = a.x - b.x;
this.y = a.y - b.y;
return this
},
multiply: function(a) {
this.x *= a.x;
this.y *= a.y;
return this
},
multiplyScalar: function(a) {
isFinite(a) ? (this.x *= a, this.y *= a) : this.y = this.x = 0;
return this
},
divide: function(a) {
this.x /= a.x;
this.y /= a.y;
return this
},
divideScalar: function(a) {
return this.multiplyScalar(1 / a)
},
min: function(a) {
this.x = Math.min(this.x, a.x);
this.y = Math.min(this.y, a.y);
return this
},
max: function(a) {
this.x = Math.max(this.x, a.x);
this.y = Math.max(this.y, a.y);
return this
},
clamp: function(a, b) {
this.x = Math.max(a.x, Math.min(b.x, this.x));
this.y = Math.max(a.y, Math.min(b.y, this.y));
return this
},
clampScalar: function() {
var a, b;
return function(c, d) {
void 0 === a && (a = new D, b = new D);
a.set(c, c);
b.set(d, d);
return this.clamp(a, b)
}
} (),
clampLength: function(a, b) {
var c = this.length();
return this.multiplyScalar(Math.max(a, Math.min(b, c)) / c)
},
floor: function() {
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
return this
},
ceil: function() {
this.x = Math.ceil(this.x);
this.y = Math.ceil(this.y);
return this
},
round: function() {
this.x = Math.round(this.x);
this.y = Math.round(this.y);
return this
},
roundToZero: function() {
this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x);
this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y);
return this
},
negate: function() {
this.x = -this.x;
this.y = -this.y;
return this
},
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)
},
lengthManhattan: function() {
return Math.abs(this.x) + Math.abs(this.y)
},
normalize: function() {
return this.divideScalar(this.length())
},
angle: function() {
var a = Math.atan2(this.y, this.x);
0 > a && (a += 2 * Math.PI);
return a
},
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
},
distanceToManhattan: function(a) {
return Math.abs(this.x - a.x) + Math.abs(this.y - a.y)
},
setLength: function(a) {
return this.multiplyScalar(a / this.length())
},
lerp: function(a, b) {
this.x += (a.x - this.x) * b;
this.y += (a.y - this.y) * b;
return this
},
lerpVectors: function(a, b, c) {
return this.subVectors(b, a).multiplyScalar(c).add(a)
},
equals: function(a) {
return a.x === this.x && a.y === this.y
},
fromArray: function(a, b) {
void 0 === b && (b = 0);
this.x = a[b];
this.y = a[b + 1];
return this
},
toArray: function(a, b) {
void 0 === a && (a = []);
void 0 === b && (b = 0);
a[b] = this.x;
a[b + 1] = this.y;
return a
},
fromBufferAttribute: function(a, b, c) {
void 0 !== c && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");
this.x = a.getX(b);
this.y = a.getY(b);
return this
},
rotateAround: function(a, b) {
var c = Math.cos(b),
d = Math.sin(b),
e = this.x - a.x,
f = this.y - a.y;
this.x = e * c - f * d + a.x;
this.y = e * d + f * c + a.y;
return this
}
};
var Ze = 0;
ea.DEFAULT_IMAGE = void 0;
ea.DEFAULT_MAPPING = 300;
ea.prototype = {
constructor: ea,
isTexture: !0,
set needsUpdate(a) { ! 0 === a && this.version++
},
clone: function() {
return (new this.constructor).copy(this)
},
copy: function(a) {
this.image = a.image;
this.mipmaps = a.mipmaps.slice(0);
this.mapping = a.mapping;
this.wrapS = a.wrapS;
this.wrapT = a.wrapT;
this.magFilter = a.magFilter;
this.minFilter = a.minFilter;
this.anisotropy = a.anisotropy;
this.format = a.format;
this.type = a.type;
this.offset.copy(a.offset);
this.repeat.copy(a.repeat);
this.generateMipmaps = a.generateMipmaps;
this.premultiplyAlpha = a.premultiplyAlpha;
this.flipY = a.flipY;
this.unpackAlignment = a.unpackAlignment;
this.encoding = a.encoding;
return this
},
toJSON: function(a) {
if (void 0 !== a.textures[this.uuid]) return a.textures[this.uuid];
var b = {
metadata: {
version: 4.4,
type: "Texture",
generator: "Texture.toJSON"
},
uuid: this.uuid,
name: this.name,
mapping: this.mapping,
repeat: [this.repeat.x, this.repeat.y],
offset: [this.offset.x, this.offset.y],
wrap: [this.wrapS, this.wrapT],
minFilter: this.minFilter,
magFilter: this.magFilter,
anisotropy: this.anisotropy,
flipY: this.flipY
};
if (void 0 !== this.image) {
var c = this.image;
void 0 === c.uuid && (c.uuid = N.generateUUID());
if (void 0 === a.images[c.uuid]) {
var d = a.images,
e = c.uuid,
f = c.uuid,
g;
void 0 !== c.toDataURL ? g = c: (g = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"), g.width = c.width, g.height = c.height, g.getContext("2d").drawImage(c, 0, 0, c.width, c.height));
g = 2048 < g.width || 2048 < g.height ? g.toDataURL("image/jpeg", .6) : g.toDataURL("image/png");
d[e] = {
uuid: f,
url: g
}
}
b.image = c.uuid
}
return a.textures[this.uuid] = b
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
},
transformUv: function(a) {
if (300 === this.mapping) {
a.multiply(this.repeat);
a.add(this.offset);
if (0 > a.x || 1 < a.x) switch (this.wrapS) {
case 1E3:
a.x -= Math.floor(a.x);
break;
case 1001:
a.x = 0 > a.x ? 0 : 1;
break;
case 1002:
a.x = 1 === Math.abs(Math.floor(a.x) % 2) ? Math.ceil(a.x) - a.x: a.x - Math.floor(a.x)
}
if (0 > a.y || 1 < a.y) switch (this.wrapT) {
case 1E3:
a.y -= Math.floor(a.y);
break;
case 1001:
a.y = 0 > a.y ? 0 : 1;
break;
case 1002:
a.y = 1 === Math.abs(Math.floor(a.y) % 2) ? Math.ceil(a.y) - a.y: a.y - Math.floor(a.y)
}
this.flipY && (a.y = 1 - a.y)
}
}
};
Object.assign(ea.prototype, pa.prototype);
fa.prototype = {
constructor: fa,
isVector4: !0,
set: function(a, b, c, d) {
this.x = a;
this.y = b;
this.z = c;
this.w = d;
return this
},
setScalar: function(a) {
this.w = this.z = this.y = this.x = a;
return this
},
setX: function(a) {
this.x = a;
return this
},
setY: function(a) {
this.y = a;
return this
},
setZ: function(a) {
this.z = a;
return this
},
setW: function(a) {
this.w = a;
return 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);
}
return this
},
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);
}
},
clone: function() {
return new this.constructor(this.x, this.y, this.z, this.w)
},
copy: function(a) {
this.x = a.x;
this.y = a.y;
this.z = a.z;
this.w = void 0 !== a.w ? a.w: 1;
return this
},
add: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector4: .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;
return this
},
addScalar: function(a) {
this.x += a;
this.y += a;
this.z += a;
this.w += a;
return this
},
addVectors: function(a, b) {
this.x = a.x + b.x;
this.y = a.y + b.y;
this.z = a.z + b.z;
this.w = a.w + b.w;
return this
},
addScaledVector: function(a, b) {
this.x += a.x * b;
this.y += a.y * b;
this.z += a.z * b;
this.w += a.w * b;
return this
},
sub: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector4: .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;
return this
},
subScalar: function(a) {
this.x -= a;
this.y -= a;
this.z -= a;
this.w -= a;
return this
},
subVectors: function(a, b) {
this.x = a.x - b.x;
this.y = a.y - b.y;
this.z = a.z - b.z;
this.w = a.w - b.w;
return this
},
multiplyScalar: function(a) {
isFinite(a) ? (this.x *= a, this.y *= a, this.z *= a, this.w *= a) : this.w = this.z = this.y = this.x = 0;
return this
},
applyMatrix4: function(a) {
var b = this.x,
c = this.y,
d = this.z,
e = this.w;
a = a.elements;
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;
return this
},
divideScalar: function(a) {
return this.multiplyScalar(1 / a)
},
setAxisAngleFromQuaternion: function(a) {
this.w = 2 * Math.acos(a.w);
var b = Math.sqrt(1 - a.w * a.w);
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);
return this
},
setAxisAngleFromRotationMatrix: function(a) {
var b, c, d;
a = a.elements;
var e = a[0];
d = a[4];
var f = a[8],
g = a[1],
h = a[5],
m = a[9];
c = a[2];
b = a[6];
var k = a[10];
if (.01 > Math.abs(d - g) && .01 > Math.abs(f - c) && .01 > Math.abs(m - b)) {
if (.1 > Math.abs(d + g) && .1 > Math.abs(f + c) && .1 > Math.abs(m + b) && .1 > Math.abs(e + h + k - 3)) return this.set(1, 0, 0, 0),
this;
a = Math.PI;
e = (e + 1) / 2;
h = (h + 1) / 2;
k = (k + 1) / 2;
d = (d + g) / 4;
f = (f + c) / 4;
m = (m + b) / 4;
e > h && e > k ? .01 > e ? (b = 0, d = c = .707106781) : (b = Math.sqrt(e), c = d / b, d = f / b) : h > k ? .01 > h ? (b = .707106781, c = 0, d = .707106781) : (c = Math.sqrt(h), b = d / c, d = m / c) : .01 > k ? (c = b = .707106781, d = 0) : (d = Math.sqrt(k), b = f / d, c = m / d);
this.set(b, c, d, a);
return this
}
a = Math.sqrt((b - m) * (b - m) + (f - c) * (f - c) + (g - d) * (g - d));.001 > Math.abs(a) && (a = 1);
this.x = (b - m) / a;
this.y = (f - c) / a;
this.z = (g - d) / a;
this.w = Math.acos((e + h + k - 1) / 2);
return this
},
min: function(a) {
this.x = Math.min(this.x, a.x);
this.y = Math.min(this.y, a.y);
this.z = Math.min(this.z, a.z);
this.w = Math.min(this.w, a.w);
return this
},
max: function(a) {
this.x = Math.max(this.x, a.x);
this.y = Math.max(this.y, a.y);
this.z = Math.max(this.z, a.z);
this.w = Math.max(this.w, a.w);
return this
},
clamp: function(a, b) {
this.x = Math.max(a.x, Math.min(b.x, this.x));
this.y = Math.max(a.y, Math.min(b.y, this.y));
this.z = Math.max(a.z, Math.min(b.z, this.z));
this.w = Math.max(a.w, Math.min(b.w, this.w));
return this
},
clampScalar: function() {
var a, b;
return function(c, d) {
void 0 === a && (a = new fa, b = new fa);
a.set(c, c, c, c);
b.set(d, d, d, d);
return this.clamp(a, b)
}
} (),
floor: function() {
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
this.z = Math.floor(this.z);
this.w = Math.floor(this.w);
return this
},
ceil: function() {
this.x = Math.ceil(this.x);
this.y = Math.ceil(this.y);
this.z = Math.ceil(this.z);
this.w = Math.ceil(this.w);
return this
},
round: function() {
this.x = Math.round(this.x);
this.y = Math.round(this.y);
this.z = Math.round(this.z);
this.w = Math.round(this.w);
return this
},
roundToZero: function() {
this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x);
this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y);
this.z = 0 > this.z ? Math.ceil(this.z) : Math.floor(this.z);
this.w = 0 > this.w ? Math.ceil(this.w) : Math.floor(this.w);
return this
},
negate: function() {
this.x = -this.x;
this.y = -this.y;
this.z = -this.z;
this.w = -this.w;
return this
},
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) {
return this.multiplyScalar(a / this.length())
},
lerp: function(a, b) {
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;
return this
},
lerpVectors: function(a, b, c) {
return this.subVectors(b, a).multiplyScalar(c).add(a)
},
equals: function(a) {
return a.x === this.x && a.y === this.y && a.z === this.z && a.w === this.w
},
fromArray: function(a, b) {
void 0 === b && (b = 0);
this.x = a[b];
this.y = a[b + 1];
this.z = a[b + 2];
this.w = a[b + 3];
return this
},
toArray: function(a, b) {
void 0 === a && (a = []);
void 0 === b && (b = 0);
a[b] = this.x;
a[b + 1] = this.y;
a[b + 2] = this.z;
a[b + 3] = this.w;
return a
},
fromBufferAttribute: function(a, b, c) {
void 0 !== c && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");
this.x = a.getX(b);
this.y = a.getY(b);
this.z = a.getZ(b);
this.w = a.getW(b);
return this
}
};
Ya.prototype = {
constructor: Ya,
isWebGLRenderTarget: !0,
setSize: function(a, b) {
if (this.width !== a || this.height !== b) this.width = a,
this.height = b,
this.dispose();
this.viewport.set(0, 0, a, b);
this.scissor.set(0, 0, a, b)
},
clone: function() {
return (new this.constructor).copy(this)
},
copy: function(a) {
this.width = a.width;
this.height = a.height;
this.viewport.copy(a.viewport);
this.texture = a.texture.clone();
this.depthBuffer = a.depthBuffer;
this.stencilBuffer = a.stencilBuffer;
this.depthTexture = a.depthTexture;
return this
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
}
};
Object.assign(Ya.prototype, pa.prototype);
Gb.prototype = Object.create(Ya.prototype);
Gb.prototype.constructor = Gb;
Gb.prototype.isWebGLRenderTargetCube = !0;
ca.prototype = {
constructor: ca,
get x() {
return this._x
},
set x(a) {
this._x = a;
this.onChangeCallback()
},
get y() {
return this._y
},
set y(a) {
this._y = a;
this.onChangeCallback()
},
get z() {
return this._z
},
set z(a) {
this._z = a;
this.onChangeCallback()
},
get w() {
return this._w
},
set w(a) {
this._w = a;
this.onChangeCallback()
},
set: function(a, b, c, d) {
this._x = a;
this._y = b;
this._z = c;
this._w = d;
this.onChangeCallback();
return this
},
clone: function() {
return new this.constructor(this._x, this._y, this._z, this._w)
},
copy: function(a) {
this._x = a.x;
this._y = a.y;
this._z = a.z;
this._w = a.w;
this.onChangeCallback();
return this
},
setFromEuler: function(a, b) {
if (!1 === (a && a.isEuler)) throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");
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),
m = a.order;
"XYZ" === m ? (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" === m ? (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" === m ? (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" === m ? (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" === m ? (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" === m && (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);
if (!1 !== b) this.onChangeCallback();
return this
},
setFromAxisAngle: function(a, b) {
var c = b / 2,
d = Math.sin(c);
this._x = a.x * d;
this._y = a.y * d;
this._z = a.z * d;
this._w = Math.cos(c);
this.onChangeCallback();
return this
},
setFromRotationMatrix: function(a) {
var b = a.elements,
c = b[0];
a = b[4];
var d = b[8],
e = b[1],
f = b[5],
g = b[9],
h = b[2],
m = b[6],
b = b[10],
k = c + f + b;
0 < k ? (c = .5 / Math.sqrt(k + 1), this._w = .25 / c, this._x = (m - 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 = (m - 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 + m) / c) : (c = 2 * Math.sqrt(1 + b - c - f), this._w = (e - a) / c, this._x = (d + h) / c, this._y = (g + m) / c, this._z = .25 * c);
this.onChangeCallback();
return this
},
setFromUnitVectors: function() {
var a, b;
return function(c, d) {
void 0 === a && (a = new q);
b = c.dot(d) + 1;
1E-6 > b ? (b = 0, Math.abs(c.x) > Math.abs(c.z) ? a.set( - c.y, c.x, 0) : a.set(0, -c.z, c.y)) : a.crossVectors(c, d);
this._x = a.x;
this._y = a.y;
this._z = a.z;
this._w = b;
return this.normalize()
}
} (),
inverse: function() {
return this.conjugate().normalize()
},
conjugate: function() {
this._x *= -1;
this._y *= -1;
this._z *= -1;
this.onChangeCallback();
return this
},
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)
},
normalize: function() {
var a = this.length();
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.onChangeCallback();
return this
},
multiply: function(a, b) {
return void 0 !== b ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(a, b)) : this.multiplyQuaternions(this, a)
},
premultiply: function(a) {
return this.multiplyQuaternions(a, this)
},
multiplyQuaternions: function(a, b) {
var c = a._x,
d = a._y,
e = a._z,
f = a._w,
g = b._x,
h = b._y,
m = b._z,
k = b._w;
this._x = c * k + f * g + d * m - e * h;
this._y = d * k + f * h + e * g - c * m;
this._z = e * k + f * m + c * h - d * g;
this._w = f * k - c * g - d * h - e * m;
this.onChangeCallback();
return this
},
slerp: function(a, b) {
if (0 === b) return this;
if (1 === b) return this.copy(a);
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;
0 > g ? (this._w = -a._w, this._x = -a._x, this._y = -a._y, this._z = -a._z, g = -g) : this.copy(a);
if (1 <= g) return this._w = f,
this._x = c,
this._y = d,
this._z = e,
this;
var h = Math.sqrt(1 - g * g);
if (.001 > Math.abs(h)) return 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;
var m = Math.atan2(h, g),
g = Math.sin((1 - b) * m) / h,
h = Math.sin(b * m) / h;
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.onChangeCallback();
return this
},
equals: function(a) {
return a._x === this._x && a._y === this._y && a._z === this._z && a._w === this._w
},
fromArray: function(a, b) {
void 0 === b && (b = 0);
this._x = a[b];
this._y = a[b + 1];
this._z = a[b + 2];
this._w = a[b + 3];
this.onChangeCallback();
return this
},
toArray: function(a, b) {
void 0 === a && (a = []);
void 0 === b && (b = 0);
a[b] = this._x;
a[b + 1] = this._y;
a[b + 2] = this._z;
a[b + 3] = this._w;
return a
},
onChange: function(a) {
this.onChangeCallback = a;
return this
},
onChangeCallback: function() {}
};
Object.assign(ca, {
slerp: function(a, b, c, d) {
return c.copy(a).slerp(b, d)
},
slerpFlat: function(a, b, c, d, e, f, g) {
var h = c[d + 0],
m = c[d + 1],
k = c[d + 2];
c = c[d + 3];
d = e[f + 0];
var l = e[f + 1],
p = e[f + 2];
e = e[f + 3];
if (c !== e || h !== d || m !== l || k !== p) {
f = 1 - g;
var n = h * d + m * l + k * p + c * e,
u = 0 <= n ? 1 : -1,
q = 1 - n * n;
q > Number.EPSILON && (q = Math.sqrt(q), n = Math.atan2(q, n * u), f = Math.sin(f * n) / q, g = Math.sin(g * n) / q);
u *= g;
h = h * f + d * u;
m = m * f + l * u;
k = k * f + p * u;
c = c * f + e * u;
f === 1 - g && (g = 1 / Math.sqrt(h * h + m * m + k * k + c * c), h *= g, m *= g, k *= g, c *= g)
}
a[b] = h;
a[b + 1] = m;
a[b + 2] = k;
a[b + 3] = c
}
});
q.prototype = {
constructor: q,
isVector3: !0,
set: function(a, b, c) {
this.x = a;
this.y = b;
this.z = c;
return this
},
setScalar: function(a) {
this.z = this.y = this.x = a;
return this
},
setX: function(a) {
this.x = a;
return this
},
setY: function(a) {
this.y = a;
return this
},
setZ: function(a) {
this.z = a;
return 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);
}
return this
},
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);
}
},
clone: function() {
return new this.constructor(this.x, this.y, this.z)
},
copy: function(a) {
this.x = a.x;
this.y = a.y;
this.z = a.z;
return this
},
add: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector3: .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;
return this
},
addScalar: function(a) {
this.x += a;
this.y += a;
this.z += a;
return this
},
addVectors: function(a, b) {
this.x = a.x + b.x;
this.y = a.y + b.y;
this.z = a.z + b.z;
return this
},
addScaledVector: function(a, b) {
this.x += a.x * b;
this.y += a.y * b;
this.z += a.z * b;
return this
},
sub: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector3: .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;
return this
},
subScalar: function(a) {
this.x -= a;
this.y -= a;
this.z -= a;
return this
},
subVectors: function(a, b) {
this.x = a.x - b.x;
this.y = a.y - b.y;
this.z = a.z - b.z;
return this
},
multiply: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector3: .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;
return this
},
multiplyScalar: function(a) {
isFinite(a) ? (this.x *= a, this.y *= a, this.z *= a) : this.z = this.y = this.x = 0;
return this
},
multiplyVectors: function(a, b) {
this.x = a.x * b.x;
this.y = a.y * b.y;
this.z = a.z * b.z;
return this
},
applyEuler: function() {
var a;
return function(b) { ! 1 === (b && b.isEuler) && console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");
void 0 === a && (a = new ca);
return this.applyQuaternion(a.setFromEuler(b))
}
} (),
applyAxisAngle: function() {
var a;
return function(b, c) {
void 0 === a && (a = new ca);
return this.applyQuaternion(a.setFromAxisAngle(b, c))
}
} (),
applyMatrix3: function(a) {
var b = this.x,
c = this.y,
d = this.z;
a = a.elements;
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;
return this
},
applyMatrix4: function(a) {
var b = this.x,
c = this.y,
d = this.z;
a = a.elements;
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];
return this.divideScalar(a[3] * b + a[7] * c + a[11] * d + a[15])
},
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;
var h = a * b + f * d - g * c,
m = a * c + g * b - e * d,
k = a * d + e * c - f * b,
b = -e * b - f * c - g * d;
this.x = h * a + b * -e + m * -g - k * -f;
this.y = m * a + b * -f + k * -e - h * -g;
this.z = k * a + b * -g + h * -f - m * -e;
return this
},
project: function() {
var a;
return function(b) {
void 0 === a && (a = new S);
a.multiplyMatrices(b.projectionMatrix, a.getInverse(b.matrixWorld));
return this.applyMatrix4(a)
}
} (),
unproject: function() {
var a;
return function(b) {
void 0 === a && (a = new S);
a.multiplyMatrices(b.matrixWorld, a.getInverse(b.projectionMatrix));
return this.applyMatrix4(a)
}
} (),
transformDirection: function(a) {
var b = this.x,
c = this.y,
d = this.z;
a = a.elements;
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;
return this.normalize()
},
divide: function(a) {
this.x /= a.x;
this.y /= a.y;
this.z /= a.z;
return this
},
divideScalar: function(a) {
return this.multiplyScalar(1 / a)
},
min: function(a) {
this.x = Math.min(this.x, a.x);
this.y = Math.min(this.y, a.y);
this.z = Math.min(this.z, a.z);
return this
},
max: function(a) {
this.x = Math.max(this.x, a.x);
this.y = Math.max(this.y, a.y);
this.z = Math.max(this.z, a.z);
return this
},
clamp: function(a, b) {
this.x = Math.max(a.x, Math.min(b.x, this.x));
this.y = Math.max(a.y, Math.min(b.y, this.y));
this.z = Math.max(a.z, Math.min(b.z, this.z));
return this
},
clampScalar: function() {
var a, b;
return function(c, d) {
void 0 === a && (a = new q, b = new q);
a.set(c, c, c);
b.set(d, d, d);
return this.clamp(a, b)
}
} (),
clampLength: function(a, b) {
var c = this.length();
return this.multiplyScalar(Math.max(a, Math.min(b, c)) / c)
},
floor: function() {
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
this.z = Math.floor(this.z);
return this
},
ceil: function() {
this.x = Math.ceil(this.x);
this.y = Math.ceil(this.y);
this.z = Math.ceil(this.z);
return this
},
round: function() {
this.x = Math.round(this.x);
this.y = Math.round(this.y);
this.z = Math.round(this.z);
return this
},
roundToZero: function() {
this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x);
this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y);
this.z = 0 > this.z ? Math.ceil(this.z) : Math.floor(this.z);
return this
},
negate: function() {
this.x = -this.x;
this.y = -this.y;
this.z = -this.z;
return this
},
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) {
return this.multiplyScalar(a / this.length())
},
lerp: function(a, b) {
this.x += (a.x - this.x) * b;
this.y += (a.y - this.y) * b;
this.z += (a.z - this.z) * b;
return this
},
lerpVectors: function(a, b, c) {
return this.subVectors(b, a).multiplyScalar(c).add(a)
},
cross: function(a, b) {
if (void 0 !== b) return console.warn("THREE.Vector3: .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;
this.x = d * a.z - e * a.y;
this.y = e * a.x - c * a.z;
this.z = c * a.y - d * a.x;
return this
},
crossVectors: function(a, b) {
var c = a.x,
d = a.y,
e = a.z,
f = b.x,
g = b.y,
h = b.z;
this.x = d * h - e * g;
this.y = e * f - c * h;
this.z = c * g - d * f;
return this
},
projectOnVector: function(a) {
var b = a.dot(this) / a.lengthSq();
return this.copy(a).multiplyScalar(b)
},
projectOnPlane: function() {
var a;
return function(b) {
void 0 === a && (a = new q);
a.copy(this).projectOnVector(b);
return this.sub(a)
}
} (),
reflect: function() {
var a;
return function(b) {
void 0 === a && (a = new q);
return this.sub(a.copy(b).multiplyScalar(2 * this.dot(b)))
}
} (),
angleTo: function(a) {
a = this.dot(a) / Math.sqrt(this.lengthSq() * a.lengthSq());
return Math.acos(N.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
},
distanceToManhattan: function(a) {
return Math.abs(this.x - a.x) + Math.abs(this.y - a.y) + Math.abs(this.z - a.z)
},
setFromSpherical: function(a) {
var b = Math.sin(a.phi) * a.radius;
this.x = b * Math.sin(a.theta);
this.y = Math.cos(a.phi) * a.radius;
this.z = b * Math.cos(a.theta);
return this
},
setFromCylindrical: function(a) {
this.x = a.radius * Math.sin(a.theta);
this.y = a.y;
this.z = a.radius * Math.cos(a.theta);
return this
},
setFromMatrixPosition: function(a) {
return this.setFromMatrixColumn(a, 3)
},
setFromMatrixScale: function(a) {
var b = this.setFromMatrixColumn(a, 0).length(),
c = this.setFromMatrixColumn(a, 1).length();
a = this.setFromMatrixColumn(a, 2).length();
this.x = b;
this.y = c;
this.z = a;
return this
},
setFromMatrixColumn: function(a, b) {
if ("number" === typeof a) {
console.warn("THREE.Vector3: setFromMatrixColumn now expects ( matrix, index ).");
var c = a;
a = b;
b = c
}
return this.fromArray(a.elements, 4 * b)
},
equals: function(a) {
return a.x === this.x && a.y === this.y && a.z === this.z
},
fromArray: function(a, b) {
void 0 === b && (b = 0);
this.x = a[b];
this.y = a[b + 1];
this.z = a[b + 2];
return this
},
toArray: function(a, b) {
void 0 === a && (a = []);
void 0 === b && (b = 0);
a[b] = this.x;
a[b + 1] = this.y;
a[b + 2] = this.z;
return a
},
fromBufferAttribute: function(a, b, c) {
void 0 !== c && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");
this.x = a.getX(b);
this.y = a.getY(b);
this.z = a.getZ(b);
return this
}
};
S.prototype = {
constructor: S,
isMatrix4: !0,
set: function(a, b, c, d, e, f, g, h, m, k, l, p, n, u, q, r) {
var A = this.elements;
A[0] = a;
A[4] = b;
A[8] = c;
A[12] = d;
A[1] = e;
A[5] = f;
A[9] = g;
A[13] = h;
A[2] = m;
A[6] = k;
A[10] = l;
A[14] = p;
A[3] = n;
A[7] = u;
A[11] = q;
A[15] = r;
return this
},
identity: function() {
this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
return this
},
clone: function() {
return (new S).fromArray(this.elements)
},
copy: function(a) {
this.elements.set(a.elements);
return this
},
copyPosition: function(a) {
var b = this.elements;
a = a.elements;
b[12] = a[12];
b[13] = a[13];
b[14] = a[14];
return this
},
extractBasis: function(a, b, c) {
a.setFromMatrixColumn(this, 0);
b.setFromMatrixColumn(this, 1);
c.setFromMatrixColumn(this, 2);
return this
},
makeBasis: function(a, b, c) {
this.set(a.x, b.x, c.x, 0, a.y, b.y, c.y, 0, a.z, b.z, c.z, 0, 0, 0, 0, 1);
return this
},
extractRotation: function() {
var a;
return function(b) {
void 0 === a && (a = new q);
var c = this.elements,
d = b.elements,
e = 1 / a.setFromMatrixColumn(b, 0).length(),
f = 1 / a.setFromMatrixColumn(b, 1).length();
b = 1 / a.setFromMatrixColumn(b, 2).length();
c[0] = d[0] * e;
c[1] = d[1] * e;
c[2] = d[2] * e;
c[4] = d[4] * f;
c[5] = d[5] * f;
c[6] = d[6] * f;
c[8] = d[8] * b;
c[9] = d[9] * b;
c[10] = d[10] * b;
return this
}
} (),
makeRotationFromEuler: function(a) { ! 1 === (a && a.isEuler) && console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");
var b = this.elements,
c = a.x,
d = a.y,
e = a.z,
f = Math.cos(c),
c = Math.sin(c),
g = Math.cos(d),
d = Math.sin(d),
h = Math.cos(e),
e = Math.sin(e);
if ("XYZ" === a.order) {
a = f * h;
var m = f * e,
k = c * h,
l = c * e;
b[0] = g * h;
b[4] = -g * e;
b[8] = d;
b[1] = m + k * d;
b[5] = a - l * d;
b[9] = -c * g;
b[2] = l - a * d;
b[6] = k + m * d;
b[10] = f * g
} else "YXZ" === a.order ? (a = g * h, m = g * e, k = d * h, l = d * e, b[0] = a + l * c, b[4] = k * c - m, b[8] = f * d, b[1] = f * e, b[5] = f * h, b[9] = -c, b[2] = m * c - k, b[6] = l + a * c, b[10] = f * g) : "ZXY" === a.order ? (a = g * h, m = g * e, k = d * h, l = d * e, b[0] = a - l * c, b[4] = -f * e, b[8] = k + m * c, b[1] = m + k * c, b[5] = f * h, b[9] = l - a * c, b[2] = -f * d, b[6] = c, b[10] = f * g) : "ZYX" === a.order ? (a = f * h, m = f * e, k = c * h, l = c * e, b[0] = g * h, b[4] = k * d - m, b[8] = a * d + l, b[1] = g * e, b[5] = l * d + a, b[9] = m * d - k, b[2] = -d, b[6] = c * g, b[10] = f * g) : "YZX" === a.order ? (a = f * g, m = f * d, k = c * g, l = c * d, b[0] = g * h, b[4] = l - a * e, b[8] = k * e + m, b[1] = e, b[5] = f * h, b[9] = -c * h, b[2] = -d * h, b[6] = m * e + k, b[10] = a - l * e) : "XZY" === a.order && (a = f * g, m = f * d, k = c * g, l = c * d, b[0] = g * h, b[4] = -e, b[8] = d * h, b[1] = a * e + l, b[5] = f * h, b[9] = m * e - k, b[2] = k * e - m, b[6] = c * h, b[10] = l * e + a);
b[3] = 0;
b[7] = 0;
b[11] = 0;
b[12] = 0;
b[13] = 0;
b[14] = 0;
b[15] = 1;
return this
},
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,
m = e + e;
a = c * g;
var k = c * h,
c = c * m,
l = d * h,
d = d * m,
e = e * m,
g = f * g,
h = f * h,
f = f * m;
b[0] = 1 - (l + e);
b[4] = k - f;
b[8] = c + h;
b[1] = k + f;
b[5] = 1 - (a + e);
b[9] = d - g;
b[2] = c - h;
b[6] = d + g;
b[10] = 1 - (a + l);
b[3] = 0;
b[7] = 0;
b[11] = 0;
b[12] = 0;
b[13] = 0;
b[14] = 0;
b[15] = 1;
return this
},
lookAt: function() {
var a, b, c;
return function(d, e, f) {
void 0 === a && (a = new q, b = new q, c = new q);
var g = this.elements;
c.subVectors(d, e).normalize();
0 === c.lengthSq() && (c.z = 1);
a.crossVectors(f, c).normalize();
0 === a.lengthSq() && (c.z += 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;
return this
}
} (),
multiply: function(a, b) {
return void 0 !== b ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(a, b)) : this.multiplyMatrices(this, a)
},
premultiply: function(a) {
return this.multiplyMatrices(a, this)
},
multiplyMatrices: function(a, b) {
var c = a.elements,
d = b.elements,
e = this.elements,
f = c[0],
g = c[4],
h = c[8],
m = c[12],
k = c[1],
l = c[5],
p = c[9],
n = c[13],
u = c[2],
q = c[6],
r = c[10],
A = c[14],
w = c[3],
y = c[7],
K = c[11],
c = c[15],
v = d[0],
E = d[4],
L = d[8],
C = d[12],
F = d[1],
x = d[5],
H = d[9],
D = d[13],
z = d[2],
J = d[6],
I = d[10],
Q = d[14],
M = d[3],
O = d[7],
P = d[11],
d = d[15];
e[0] = f * v + g * F + h * z + m * M;
e[4] = f * E + g * x + h * J + m * O;
e[8] = f * L + g * H + h * I + m * P;
e[12] = f * C + g * D + h * Q + m * d;
e[1] = k * v + l * F + p * z + n * M;
e[5] = k * E + l * x + p * J + n * O;
e[9] = k * L + l * H + p * I + n * P;
e[13] = k * C + l * D + p * Q + n * d;
e[2] = u * v + q * F + r * z + A * M;
e[6] = u * E + q * x + r * J + A * O;
e[10] = u * L + q * H + r * I + A * P;
e[14] = u * C + q * D + r * Q + A * d;
e[3] = w * v + y * F + K * z + c * M;
e[7] = w * E + y * x + K * J + c * O;
e[11] = w * L + y * H + K * I + c * P;
e[15] = w * C + y * D + K * Q + c * d;
return this
},
multiplyToArray: function(a, b, c) {
var d = this.elements;
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];
return this
},
multiplyScalar: function(a) {
var b = this.elements;
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;
return this
},
applyToBufferAttribute: function() {
var a;
return function(b) {
void 0 === a && (a = new q);
for (var c = 0,
d = b.count; c < d; c++) a.x = b.getX(c),
a.y = b.getY(c),
a.z = b.getZ(c),
a.applyMatrix4(this),
b.setXYZ(c, a.x, a.y, a.z);
return b
}
} (),
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],
m = a[13],
k = a[2],
l = a[6],
p = a[10],
n = a[14];
return a[3] * ( + e * h * l - d * m * l - e * g * p + c * m * p + d * g * n - c * h * n) + a[7] * ( + b * h * n - b * m * p + e * f * p - d * f * n + d * m * k - e * h * k) + a[11] * ( + b * m * l - b * g * n - e * f * l + c * f * n + e * g * k - c * m * k) + a[15] * ( - d * g * k - b * h * l + b * g * p + d * f * l - c * f * p + c * h * k)
},
transpose: function() {
var a = this.elements,
b;
b = a[1];
a[1] = a[4];
a[4] = b;
b = a[2];
a[2] = a[8];
a[8] = b;
b = a[6];
a[6] = a[9];
a[9] = b;
b = a[3];
a[3] = a[12];
a[12] = b;
b = a[7];
a[7] = a[13];
a[13] = b;
b = a[11];
a[11] = a[14];
a[14] = b;
return this
},
setPosition: function(a) {
var b = this.elements;
b[12] = a.x;
b[13] = a.y;
b[14] = a.z;
return this
},
getInverse: function(a, b) {
var c = this.elements,
d = a.elements,
e = d[0],
f = d[1],
g = d[2],
h = d[3],
m = d[4],
k = d[5],
l = d[6],
p = d[7],
n = d[8],
u = d[9],
q = d[10],
r = d[11],
A = d[12],
w = d[13],
y = d[14],
d = d[15],
K = u * y * p - w * q * p + w * l * r - k * y * r - u * l * d + k * q * d,
v = A * q * p - n * y * p - A * l * r + m * y * r + n * l * d - m * q * d,
E = n * w * p - A * u * p + A * k * r - m * w * r - n * k * d + m * u * d,
L = A * u * l - n * w * l - A * k * q + m * w * q + n * k * y - m * u * y,
C = e * K + f * v + g * E + h * L;
if (0 === C) {
if (!0 === b) throw Error("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");
console.warn("THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0");
return this.identity()
}
C = 1 / C;
c[0] = K * C;
c[1] = (w * q * h - u * y * h - w * g * r + f * y * r + u * g * d - f * q * d) * C;
c[2] = (k * y * h - w * l * h + w * g * p - f * y * p - k * g * d + f * l * d) * C;
c[3] = (u * l * h - k * q * h - u * g * p + f * q * p + k * g * r - f * l * r) * C;
c[4] = v * C;
c[5] = (n * y * h - A * q * h + A * g * r - e * y * r - n * g * d + e * q * d) * C;
c[6] = (A * l * h - m * y * h - A * g * p + e * y * p + m * g * d - e * l * d) * C;
c[7] = (m * q * h - n * l * h + n * g * p - e * q * p - m * g * r + e * l * r) * C;
c[8] = E * C;
c[9] = (A * u * h - n * w * h - A * f * r + e * w * r + n * f * d - e * u * d) * C;
c[10] = (m * w * h - A * k * h + A * f * p - e * w * p - m * f * d + e * k * d) * C;
c[11] = (n * k * h - m * u * h - n * f * p + e * u * p + m * f * r - e * k * r) * C;
c[12] = L * C;
c[13] = (n * w * g - A * u * g + A * f * q - e * w * q - n * f * y + e * u * y) * C;
c[14] = (A * k * g - m * w * g - A * f * l + e * w * l + m * f * y - e * k * y) * C;
c[15] = (m * u * g - n * k * g + n * f * l - e * u * l - m * f * q + e * k * q) * C;
return this
},
scale: function(a) {
var b = this.elements,
c = a.x,
d = a.y;
a = a.z;
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;
return this
},
getMaxScaleOnAxis: function() {
var a = this.elements;
return Math.sqrt(Math.max(a[0] * a[0] + a[1] * a[1] + a[2] * a[2], 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) {
this.set(1, 0, 0, a, 0, 1, 0, b, 0, 0, 1, c, 0, 0, 0, 1);
return this
},
makeRotationX: function(a) {
var b = Math.cos(a);
a = Math.sin(a);
this.set(1, 0, 0, 0, 0, b, -a, 0, 0, a, b, 0, 0, 0, 0, 1);
return this
},
makeRotationY: function(a) {
var b = Math.cos(a);
a = Math.sin(a);
this.set(b, 0, a, 0, 0, 1, 0, 0, -a, 0, b, 0, 0, 0, 0, 1);
return this
},
makeRotationZ: function(a) {
var b = Math.cos(a);
a = Math.sin(a);
this.set(b, -a, 0, 0, a, b, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
return 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,
m = e * f,
k = e * g;
this.set(m * f + c, m * g - d * h, m * h + d * g, 0, m * g + d * h, k * g + c, k * h - d * f, 0, m * h - d * g, k * h + d * f, e * h * h + c, 0, 0, 0, 0, 1);
return this
},
makeScale: function(a, b, c) {
this.set(a, 0, 0, 0, 0, b, 0, 0, 0, 0, c, 0, 0, 0, 0, 1);
return this
},
makeShear: function(a, b, c) {
this.set(1, b, c, 0, a, 1, c, 0, a, b, 1, 0, 0, 0, 0, 1);
return this
},
compose: function(a, b, c) {
this.makeRotationFromQuaternion(b);
this.scale(c);
this.setPosition(a);
return this
},
decompose: function() {
var a, b;
return function(c, d, e) {
void 0 === a && (a = new q, b = new S);
var f = this.elements,
g = a.set(f[0], f[1], f[2]).length(),
h = a.set(f[4], f[5], f[6]).length(),
m = a.set(f[8], f[9], f[10]).length();
0 > this.determinant() && (g = -g);
c.x = f[12];
c.y = f[13];
c.z = f[14];
b.elements.set(this.elements);
c = 1 / g;
var f = 1 / h,
k = 1 / m;
b.elements[0] *= c;
b.elements[1] *= c;
b.elements[2] *= c;
b.elements[4] *= f;
b.elements[5] *= f;
b.elements[6] *= f;
b.elements[8] *= k;
b.elements[9] *= k;
b.elements[10] *= k;
d.setFromRotationMatrix(b);
e.x = g;
e.y = h;
e.z = m;
return this
}
} (),
makePerspective: function(a, b, c, d, e, f) {
void 0 === f && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");
var g = this.elements;
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 / (c - d);
g[9] = (c + d) / (c - d);
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;
return this
},
makeOrthographic: function(a, b, c, d, e, f) {
var g = this.elements,
h = 1 / (b - a),
m = 1 / (c - d),
k = 1 / (f - e);
g[0] = 2 * h;
g[4] = 0;
g[8] = 0;
g[12] = -((b + a) * h);
g[1] = 0;
g[5] = 2 * m;
g[9] = 0;
g[13] = -((c + d) * m);
g[2] = 0;
g[6] = 0;
g[10] = -2 * k;
g[14] = -((f + e) * k);
g[3] = 0;
g[7] = 0;
g[11] = 0;
g[15] = 1;
return this
},
equals: function(a) {
var b = this.elements;
a = a.elements;
for (var c = 0; 16 > c; c++) if (b[c] !== a[c]) return ! 1;
return ! 0
},
fromArray: function(a, b) {
void 0 === b && (b = 0);
for (var c = 0; 16 > c; c++) this.elements[c] = a[c + b];
return this
},
toArray: function(a, b) {
void 0 === a && (a = []);
void 0 === b && (b = 0);
var c = this.elements;
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];
return a
}
};
Za.prototype = Object.create(ea.prototype);
Za.prototype.constructor = Za;
Za.prototype.isCubeTexture = !0;
Object.defineProperty(Za.prototype, "images", {
get: function() {
return this.image
},
set: function(a) {
this.image = a
}
});
var Ee = new ea,
Fe = new Za,
Be = [],
De = [];
Je.prototype.setValue = function(a, b) {
for (var c = this.seq,
d = 0,
e = c.length; d !== e; ++d) {
var f = c[d];
f.setValue(a, b[f.id])
}
};
var Rd = /([\w\d_]+)(\])?(\[|\.)?/g;
$a.prototype.setValue = function(a, b, c) {
b = this.map[b];
void 0 !== b && b.setValue(a, c, this.renderer)
};
$a.prototype.set = function(a, b, c) {
var d = this.map[c];
void 0 !== d && d.setValue(a, b[c], this.renderer)
};
$a.prototype.setOptional = function(a, b, c) {
b = b[c];
void 0 !== b && this.setValue(a, c, b)
};
$a.upload = function(a, b, c, d) {
for (var e = 0,
f = b.length; e !== f; ++e) {
var g = b[e],
h = c[g.id]; ! 1 !== h.needsUpdate && g.setValue(a, h.value, d)
}
};
$a.seqWithValue = function(a, b) {
for (var c = [], d = 0, e = a.length; d !== e; ++d) {
var f = a[d];
f.id in b && c.push(f)
}
return c
};
var Ja = {
merge: function(a) {
for (var b = {},
c = 0; c < a.length; c++) {
var d = this.clone(a[c]),
e;
for (e in d) b[e] = d[e]
}
return b
},
clone: function(a) {
var b = {},
c;
for (c in a) {
b[c] = {};
for (var d in a[c]) {
var e = a[c][d];
e && (e.isColor || e.isMatrix3 || e.isMatrix4 || e.isVector2 || e.isVector3 || e.isVector4 || e.isTexture) ? b[c][d] = e.clone() : Array.isArray(e) ? b[c][d] = e.slice() : b[c][d] = e
}
}
return b
}
},
Z = {
alphamap_fragment: "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",
alphamap_pars_fragment: "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",
alphatest_fragment: "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",
aomap_fragment: "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",
aomap_pars_fragment: "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",
begin_vertex: "\nvec3 transformed = vec3( position );\n",
beginnormal_vertex: "\nvec3 objectNormal = vec3( normal );\n",
bsdfs: "float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t\t}\n\t\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 ltcTextureCoords( const in GeometricContext geometry, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = (LUT_SIZE - 1.0)/LUT_SIZE;\n\tconst float LUT_BIAS = 0.5/LUT_SIZE;\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tfloat theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nvoid clipQuadToHorizon( inout vec3 L[5], out int n ) {\n\tint config = 0;\n\tif ( L[0].z > 0.0 ) config += 1;\n\tif ( L[1].z > 0.0 ) config += 2;\n\tif ( L[2].z > 0.0 ) config += 4;\n\tif ( L[3].z > 0.0 ) config += 8;\n\tn = 0;\n\tif ( config == 0 ) {\n\t} else if ( config == 1 ) {\n\t\tn = 3;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 2 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 3 ) {\n\t\tn = 4;\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t\tL[3] = -L[3].z * L[0] + L[0].z * L[3];\n\t} else if ( config == 4 ) {\n\t\tn = 3;\n\t\tL[0] = -L[3].z * L[2] + L[2].z * L[3];\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t} else if ( config == 5 ) {\n\t\tn = 0;\n\t} else if ( config == 6 ) {\n\t\tn = 4;\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 7 ) {\n\t\tn = 5;\n\t\tL[4] = -L[3].z * L[0] + L[0].z * L[3];\n\t\tL[3] = -L[3].z * L[2] + L[2].z * L[3];\n\t} else if ( config == 8 ) {\n\t\tn = 3;\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[1] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = L[3];\n\t} else if ( config == 9 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t\tL[2] = -L[2].z * L[3] + L[3].z * L[2];\n\t} else if ( config == 10 ) {\n\t\tn = 0;\n\t} else if ( config == 11 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = -L[2].z * L[3] + L[3].z * L[2];\n\t\tL[2] = -L[2].z * L[1] + L[1].z * L[2];\n\t} else if ( config == 12 ) {\n\t\tn = 4;\n\t\tL[1] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[0] = -L[0].z * L[3] + L[3].z * L[0];\n\t} else if ( config == 13 ) {\n\t\tn = 5;\n\t\tL[4] = L[3];\n\t\tL[3] = L[2];\n\t\tL[2] = -L[1].z * L[2] + L[2].z * L[1];\n\t\tL[1] = -L[1].z * L[0] + L[0].z * L[1];\n\t} else if ( config == 14 ) {\n\t\tn = 5;\n\t\tL[4] = -L[0].z * L[3] + L[3].z * L[0];\n\t\tL[0] = -L[0].z * L[1] + L[1].z * L[0];\n\t} else if ( config == 15 ) {\n\t\tn = 4;\n\t}\n\tif ( n == 3 )\n\t\tL[3] = L[0];\n\tif ( n == 4 )\n\t\tL[4] = L[0];\n}\nfloat integrateLtcBrdfOverRectEdge( vec3 v1, vec3 v2 ) {\n\tfloat cosTheta = dot( v1, v2 );\n\tfloat theta = acos( cosTheta );\n\tfloat res = cross( v1, v2 ).z * ( ( theta > 0.001 ) ? theta / sin( theta ) : 1.0 );\n\treturn res;\n}\nvoid initRectPoints( const in vec3 pos, const in vec3 halfWidth, const in vec3 halfHeight, out vec3 rectPoints[4] ) {\n\trectPoints[0] = pos - halfWidth - halfHeight;\n\trectPoints[1] = pos + halfWidth - halfHeight;\n\trectPoints[2] = pos + halfWidth + halfHeight;\n\trectPoints[3] = pos - halfWidth + halfHeight;\n}\nvec3 integrateLtcBrdfOverRect( const in GeometricContext geometry, const in mat3 brdfMat, const in vec3 rectPoints[4] ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 P = geometry.position;\n\tvec3 T1, T2;\n\tT1 = normalize(V - N * dot( V, N ));\n\tT2 = - cross( N, T1 );\n\tmat3 brdfWrtSurface = brdfMat * transpose( mat3( T1, T2, N ) );\n\tvec3 clippedRect[5];\n\tclippedRect[0] = brdfWrtSurface * ( rectPoints[0] - P );\n\tclippedRect[1] = brdfWrtSurface * ( rectPoints[1] - P );\n