Description here.
Last active
July 27, 2017 11:42
-
-
Save drupol/387a7d54ca992136c6582bad14f07173 to your computer and use it in GitHub Desktop.
Hilbert curve
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=11)}([function(t,e,n){t.exports=n(5),t.exports.color=n(4)},function(t,e){t.exports=function(t){function e(e,n){function i(){return 2*Math.PI/60/60*N.autoRotateSpeed}function r(){return Math.pow(.95,N.zoomSpeed)}function o(t){H.theta-=t}function a(t){H.phi-=t}function s(e){N.object instanceof t.PerspectiveCamera?V/=e:N.object instanceof t.OrthographicCamera?(N.object.zoom=Math.max(N.minZoom,Math.min(N.maxZoom,N.object.zoom*e)),N.object.updateProjectionMatrix(),W=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),N.enableZoom=!1)}function c(e){N.object instanceof t.PerspectiveCamera?V*=e:N.object instanceof t.OrthographicCamera?(N.object.zoom=Math.max(N.minZoom,Math.min(N.maxZoom,N.object.zoom/e)),N.object.updateProjectionMatrix(),W=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),N.enableZoom=!1)}function u(t){X.set(t.clientX,t.clientY)}function l(t){Q.set(t.clientX,t.clientY)}function h(t){Z.set(t.clientX,t.clientY)}function d(t){Y.set(t.clientX,t.clientY),q.subVectors(Y,X);var e=N.domElement===document?N.domElement.body:N.domElement;o(2*Math.PI*q.x/e.clientWidth*N.rotateSpeed),a(2*Math.PI*q.y/e.clientHeight*N.rotateSpeed),X.copy(Y),N.update()}function p(t){$.set(t.clientX,t.clientY),tt.subVectors($,Q),tt.y>0?s(r()):tt.y<0&&c(r()),Q.copy($),N.update()}function f(t){J.set(t.clientX,t.clientY),K.subVectors(J,Z),it(K.x,K.y),Z.copy(J),N.update()}function m(t){}function g(t){t.deltaY<0?c(r()):t.deltaY>0&&s(r()),N.update()}function v(t){switch(t.keyCode){case N.keys.UP:it(0,N.keyPanSpeed),N.update();break;case N.keys.BOTTOM:it(0,-N.keyPanSpeed),N.update();break;case N.keys.LEFT:it(N.keyPanSpeed,0),N.update();break;case N.keys.RIGHT:it(-N.keyPanSpeed,0),N.update()}}function y(t){X.set(t.touches[0].pageX,t.touches[0].pageY)}function _(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(e*e+n*n);Q.set(0,i)}function x(t){Z.set(t.touches[0].pageX,t.touches[0].pageY)}function b(t){Y.set(t.touches[0].pageX,t.touches[0].pageY),q.subVectors(Y,X);var e=N.domElement===document?N.domElement.body:N.domElement;o(2*Math.PI*q.x/e.clientWidth*N.rotateSpeed),a(2*Math.PI*q.y/e.clientHeight*N.rotateSpeed),X.copy(Y),N.update()}function w(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(e*e+n*n);$.set(0,i),tt.subVectors($,Q),tt.y>0?c(r()):tt.y<0&&s(r()),Q.copy($),N.update()}function E(t){J.set(t.touches[0].pageX,t.touches[0].pageY),K.subVectors(J,Z),it(K.x,K.y),Z.copy(J),N.update()}function M(t){}function T(t){if(!1!==N.enabled){if(t.preventDefault(),t.button===N.mouseButtons.ORBIT){if(!1===N.enableRotate)return;u(t),z=B.ROTATE}else if(t.button===N.mouseButtons.ZOOM){if(!1===N.enableZoom)return;l(t),z=B.DOLLY}else if(t.button===N.mouseButtons.PAN){if(!1===N.enablePan)return;h(t),z=B.PAN}z!==B.NONE&&(document.addEventListener("mousemove",S,!1),document.addEventListener("mouseup",A,!1),N.dispatchEvent(D))}}function S(t){if(!1!==N.enabled)if(t.preventDefault(),z===B.ROTATE){if(!1===N.enableRotate)return;d(t)}else if(z===B.DOLLY){if(!1===N.enableZoom)return;p(t)}else if(z===B.PAN){if(!1===N.enablePan)return;f(t)}}function A(t){!1!==N.enabled&&(m(t),document.removeEventListener("mousemove",S,!1),document.removeEventListener("mouseup",A,!1),N.dispatchEvent(F),z=B.NONE)}function R(t){!1===N.enabled||!1===N.enableZoom||z!==B.NONE&&z!==B.ROTATE||(t.preventDefault(),t.stopPropagation(),g(t),N.dispatchEvent(D),N.dispatchEvent(F))}function L(t){!1!==N.enabled&&!1!==N.enableKeys&&!1!==N.enablePan&&v(t)}function C(t){if(!1!==N.enabled){switch(t.touches.length){case 1:if(!1===N.enableRotate)return;y(t),z=B.TOUCH_ROTATE;break;case 2:if(!1===N.enableZoom)return;_(t),z=B.TOUCH_DOLLY;break;case 3:if(!1===N.enablePan)return;x(t),z=B.TOUCH_PAN;break;default:z=B.NONE}z!==B.NONE&&N.dispatchEvent(D)}}function P(t){if(!1!==N.enabled)switch(t.preventDefault(),t.stopPropagation(),t.touches.length){case 1:if(!1===N.enableRotate)return;if(z!==B.TOUCH_ROTATE)return;b(t);break;case 2:if(!1===N.enableZoom)return;if(z!==B.TOUCH_DOLLY)return;w(t);break;case 3:if(!1===N.enablePan)return;if(z!==B.TOUCH_PAN)return;E(t);break;default:z=B.NONE}}function O(t){!1!==N.enabled&&(M(t),N.dispatchEvent(F),z=B.NONE)}function I(t){t.preventDefault()}this.object=e,this.domElement=void 0!==n?n:document,this.enabled=!0,this.target=new t.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:t.MOUSE.LEFT,ZOOM:t.MOUSE.MIDDLE,PAN:t.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return k.phi},this.getAzimuthalAngle=function(){return k.theta},this.reset=function(){N.target.copy(N.target0),N.object.position.copy(N.position0),N.object.zoom=N.zoom0,N.object.updateProjectionMatrix(),N.dispatchEvent(U),N.update(),z=B.NONE},this.update=function(){var n=new t.Vector3,r=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),a=r.clone().inverse(),s=new t.Vector3,c=new t.Quaternion;return function(){var t=N.object.position;return n.copy(t).sub(N.target),n.applyQuaternion(r),k.setFromVector3(n),N.autoRotate&&z===B.NONE&&o(i()),k.theta+=H.theta,k.phi+=H.phi,k.theta=Math.max(N.minAzimuthAngle,Math.min(N.maxAzimuthAngle,k.theta)),k.phi=Math.max(N.minPolarAngle,Math.min(N.maxPolarAngle,k.phi)),k.makeSafe(),k.radius*=V,k.radius=Math.max(N.minDistance,Math.min(N.maxDistance,k.radius)),N.target.add(j),n.setFromSpherical(k),n.applyQuaternion(a),t.copy(N.target).add(n),N.object.lookAt(N.target),!0===N.enableDamping?(H.theta*=1-N.dampingFactor,H.phi*=1-N.dampingFactor):H.set(0,0,0),V=1,j.set(0,0,0),!!(W||s.distanceToSquared(N.object.position)>G||8*(1-c.dot(N.object.quaternion))>G)&&(N.dispatchEvent(U),s.copy(N.object.position),c.copy(N.object.quaternion),W=!1,!0)}}(),this.dispose=function(){N.domElement.removeEventListener("contextmenu",I,!1),N.domElement.removeEventListener("mousedown",T,!1),N.domElement.removeEventListener("wheel",R,!1),N.domElement.removeEventListener("touchstart",C,!1),N.domElement.removeEventListener("touchend",O,!1),N.domElement.removeEventListener("touchmove",P,!1),document.removeEventListener("mousemove",S,!1),document.removeEventListener("mouseup",A,!1),window.removeEventListener("keydown",L,!1)};var N=this,U={type:"change"},D={type:"start"},F={type:"end"},B={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},z=B.NONE,G=1e-6,k=new t.Spherical,H=new t.Spherical,V=1,j=new t.Vector3,W=!1,X=new t.Vector2,Y=new t.Vector2,q=new t.Vector2,Z=new t.Vector2,J=new t.Vector2,K=new t.Vector2,Q=new t.Vector2,$=new t.Vector2,tt=new t.Vector2,et=function(){var e=new t.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),j.add(e)}}(),nt=function(){var e=new t.Vector3;return function(t,n){e.setFromMatrixColumn(n,1),e.multiplyScalar(t),j.add(e)}}(),it=function(){var e=new t.Vector3;return function(n,i){var r=N.domElement===document?N.domElement.body:N.domElement;if(N.object instanceof t.PerspectiveCamera){var o=N.object.position;e.copy(o).sub(N.target);var a=e.length();a*=Math.tan(N.object.fov/2*Math.PI/180),et(2*n*a/r.clientHeight,N.object.matrix),nt(2*i*a/r.clientHeight,N.object.matrix)}else N.object instanceof t.OrthographicCamera?(et(n*(N.object.right-N.object.left)/N.object.zoom/r.clientWidth,N.object.matrix),nt(i*(N.object.top-N.object.bottom)/N.object.zoom/r.clientHeight,N.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),N.enablePan=!1)}}();N.domElement.addEventListener("contextmenu",I,!1),N.domElement.addEventListener("mousedown",T,!1),N.domElement.addEventListener("wheel",R,!1),N.domElement.addEventListener("touchstart",C,!1),N.domElement.addEventListener("touchend",O,!1),N.domElement.addEventListener("touchmove",P,!1),window.addEventListener("keydown",L,!1),this.update()}return e.prototype=Object.create(t.EventDispatcher.prototype),e.prototype.constructor=e,Object.defineProperties(e.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(t){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!t}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(t){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!t}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(t){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!t}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(t){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!t}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(t){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!t}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor},set:function(t){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor=t}}}),e}},function(t,e,n){"use strict";function i(){}function r(t,e){this.x=t||0,this.y=e||0}function o(t,e,n,i,a,s,c,u,l,h){Object.defineProperty(this,"id",{value:Ms++}),this.uuid=Es.generateUUID(),this.name="",this.image=void 0!==t?t:o.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:o.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:ya,this.wrapT=void 0!==i?i:ya,this.magFilter=void 0!==a?a:Ea,this.minFilter=void 0!==s?s:Ta,this.anisotropy=void 0!==l?l:1,this.format=void 0!==c?c:Ga,this.type=void 0!==u?u:Sa,this.offset=new r(0,0),this.repeat=new r(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:ps,this.version=0,this.onUpdate=null}function a(t,e,n,i){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==i?i:1}function s(t,e,n){this.uuid=Es.generateUUID(),this.width=t,this.height=e,this.scissor=new a(0,0,t,e),this.scissorTest=!1,this.viewport=new a(0,0,t,e),n=n||{},void 0===n.minFilter&&(n.minFilter=Ea),this.texture=new o(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function c(t,e,n){s.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function u(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==i?i:1}function l(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function h(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function d(t,e,n,i,r,a,s,c,u,l,h,d){o.call(this,null,a,s,c,u,l,i,r,h,d),this.image={data:t,width:e,height:n},this.magFilter=void 0!==u?u:xa,this.minFilter=void 0!==l?l:xa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function p(t,e,n,i,r,a,s,c,u,l){t=void 0!==t?t:[],e=void 0!==e?e:la,o.call(this,t,e,n,i,r,a,s,c,u,l),this.flipY=!1}function f(){this.seq=[],this.map={}}function m(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,o=As[r];if(void 0===o&&(o=new Float32Array(r),As[r]=o),0!==e){i.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function g(t,e){var n=Rs[e];void 0===n&&(n=new Int32Array(e),Rs[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocTextureUnit();return n}function v(t,e){t.uniform1f(this.addr,e)}function y(t,e){t.uniform1i(this.addr,e)}function _(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function x(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function b(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function w(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function E(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Cs.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Cs))}function M(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Ls.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Ls))}function T(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTexture2D(e||Ts,i)}function S(t,e,n){var i=n.allocTextureUnit();t.uniform1i(this.addr,i),n.setTextureCube(e||Ss,i)}function A(t,e){t.uniform2iv(this.addr,e)}function R(t,e){t.uniform3iv(this.addr,e)}function L(t,e){t.uniform4iv(this.addr,e)}function C(t){switch(t){case 5126:return v;case 35664:return _;case 35665:return x;case 35666:return b;case 35674:return w;case 35675:return E;case 35676:return M;case 35678:return T;case 35680:return S;case 5124:case 35670:return y;case 35667:case 35671:return A;case 35668:case 35672:return R;case 35669:case 35673:return L}}function P(t,e){t.uniform1fv(this.addr,e)}function O(t,e){t.uniform1iv(this.addr,e)}function I(t,e){t.uniform2fv(this.addr,m(e,this.size,2))}function N(t,e){t.uniform3fv(this.addr,m(e,this.size,3))}function U(t,e){t.uniform4fv(this.addr,m(e,this.size,4))}function D(t,e){t.uniformMatrix2fv(this.addr,!1,m(e,this.size,4))}function F(t,e){t.uniformMatrix3fv(this.addr,!1,m(e,this.size,9))}function B(t,e){t.uniformMatrix4fv(this.addr,!1,m(e,this.size,16))}function z(t,e,n){var i=e.length,r=g(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTexture2D(e[o]||Ts,r[o])}function G(t,e,n){var i=e.length,r=g(n,i);t.uniform1iv(this.addr,r);for(var o=0;o!==i;++o)n.setTextureCube(e[o]||Ss,r[o])}function k(t){switch(t){case 5126:return P;case 35664:return I;case 35665:return N;case 35666:return U;case 35674:return D;case 35675:return F;case 35676:return B;case 35678:return z;case 35680:return G;case 5124:case 35670:return O;case 35667:case 35671:return A;case 35668:case 35672:return R;case 35669:case 35673:return L}}function H(t,e,n){this.id=t,this.addr=n,this.setValue=C(e.type)}function V(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=k(e.type)}function j(t){this.id=t,f.call(this)}function W(t,e){t.seq.push(e),t.map[e.id]=e}function X(t,e,n){var i=t.name,r=i.length;for(Ps.lastIndex=0;;){var o=Ps.exec(i),a=Ps.lastIndex,s=o[1],c="]"===o[2],u=o[3];if(c&&(s|=0),void 0===u||"["===u&&a+2===r){W(n,void 0===u?new H(s,t,e):new V(s,t,e));break}var l=n.map,h=l[s];void 0===h&&(h=new j(s),W(n,h)),n=h}}function Y(t,e,n){f.call(this),this.renderer=n;for(var i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r=0;r<i;++r){var o=t.getActiveUniform(e,r),a=o.name;X(o,t.getUniformLocation(e,a),this)}}function q(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function Z(t,e){this.min=void 0!==t?t:new r(1/0,1/0),this.max=void 0!==e?e:new r(-1/0,-1/0)}function J(t,e){function n(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=f.createBuffer(),a=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,o),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,a),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),d=f.createTexture(),p=f.createTexture(),m.bindTexture(f.TEXTURE_2D,d),f.texImage2D(f.TEXTURE_2D,0,f.RGB,16,16,0,f.RGB,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),m.bindTexture(f.TEXTURE_2D,p),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,16,16,0,f.RGBA,f.UNSIGNED_BYTE,null),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.NEAREST),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},c=i(s),u={vertex:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},h={renderType:f.getUniformLocation(c,"renderType"),map:f.getUniformLocation(c,"map"),occlusionMap:f.getUniformLocation(c,"occlusionMap"),opacity:f.getUniformLocation(c,"opacity"),color:f.getUniformLocation(c,"color"),scale:f.getUniformLocation(c,"scale"),rotation:f.getUniformLocation(c,"rotation"),screenPosition:f.getUniformLocation(c,"screenPosition")}}function i(e){var n=f.createProgram(),i=f.createShader(f.FRAGMENT_SHADER),r=f.createShader(f.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return f.shaderSource(i,o+e.fragmentShader),f.shaderSource(r,o+e.vertexShader),f.compileShader(i),f.compileShader(r),f.attachShader(n,i),f.attachShader(n,r),f.linkProgram(n),n}var o,a,s,c,u,h,d,p,f=t.context,m=t.state;this.render=function(i,s,g){if(0!==e.length){var v=new l,y=g.w/g.z,_=.5*g.z,x=.5*g.w,b=16/g.w,w=new r(b*y,b),E=new l(1,1,0),M=new r(1,1),T=new Z;T.min.set(g.x,g.y),T.max.set(g.x+(g.z-16),g.y+(g.w-16)),void 0===c&&n(),f.useProgram(c),m.initAttributes(),m.enableAttribute(u.vertex),m.enableAttribute(u.uv),m.disableUnusedAttributes(),f.uniform1i(h.occlusionMap,0),f.uniform1i(h.map,1),f.bindBuffer(f.ARRAY_BUFFER,o),f.vertexAttribPointer(u.vertex,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(u.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,a),m.disable(f.CULL_FACE),m.buffers.depth.setMask(!1);for(var S=0,A=e.length;S<A;S++){b=16/g.w,w.set(b*y,b);var R=e[S];if(v.set(R.matrixWorld.elements[12],R.matrixWorld.elements[13],R.matrixWorld.elements[14]),v.applyMatrix4(s.matrixWorldInverse),v.applyMatrix4(s.projectionMatrix),E.copy(v),M.x=g.x+E.x*_+_-8,M.y=g.y+E.y*x+x-8,!0===T.containsPoint(M)){m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,null),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,d),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGB,M.x,M.y,16,16,0),f.uniform1i(h.renderType,0),f.uniform2f(h.scale,w.x,w.y),f.uniform3f(h.screenPosition,E.x,E.y,E.z),m.disable(f.BLEND),m.enable(f.DEPTH_TEST),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),m.activeTexture(f.TEXTURE0),m.bindTexture(f.TEXTURE_2D,p),f.copyTexImage2D(f.TEXTURE_2D,0,f.RGBA,M.x,M.y,16,16,0),f.uniform1i(h.renderType,1),m.disable(f.DEPTH_TEST),m.activeTexture(f.TEXTURE1),m.bindTexture(f.TEXTURE_2D,d),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0),R.positionScreen.copy(E),R.customUpdateCallback?R.customUpdateCallback(R):R.updateLensFlares(),f.uniform1i(h.renderType,2),m.enable(f.BLEND);for(var L=0,C=R.lensFlares.length;L<C;L++){var P=R.lensFlares[L];P.opacity>.001&&P.scale>.001&&(E.x=P.x,E.y=P.y,E.z=P.z,b=P.size*P.scale/g.w,w.x=b*y,w.y=b,f.uniform3f(h.screenPosition,E.x,E.y,E.z),f.uniform2f(h.scale,w.x,w.y),f.uniform1f(h.rotation,P.rotation),f.uniform1f(h.opacity,P.opacity),f.uniform3f(h.color,P.color.r,P.color.g,P.color.b),m.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),t.setTexture2D(P.texture,1),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0))}}}m.enable(f.CULL_FACE),m.enable(f.DEPTH_TEST),m.buffers.depth.setMask(!0),t.resetGLState()}}}function K(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=f.createBuffer(),s=f.createBuffer(),f.bindBuffer(f.ARRAY_BUFFER,a),f.bufferData(f.ARRAY_BUFFER,t,f.STATIC_DRAW),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.bufferData(f.ELEMENT_ARRAY_BUFFER,e,f.STATIC_DRAW),c=i(),h={position:f.getAttribLocation(c,"position"),uv:f.getAttribLocation(c,"uv")},d={uvOffset:f.getUniformLocation(c,"uvOffset"),uvScale:f.getUniformLocation(c,"uvScale"),rotation:f.getUniformLocation(c,"rotation"),scale:f.getUniformLocation(c,"scale"),color:f.getUniformLocation(c,"color"),map:f.getUniformLocation(c,"map"),opacity:f.getUniformLocation(c,"opacity"),modelViewMatrix:f.getUniformLocation(c,"modelViewMatrix"),projectionMatrix:f.getUniformLocation(c,"projectionMatrix"),fogType:f.getUniformLocation(c,"fogType"),fogDensity:f.getUniformLocation(c,"fogDensity"),fogNear:f.getUniformLocation(c,"fogNear"),fogFar:f.getUniformLocation(c,"fogFar"),fogColor:f.getUniformLocation(c,"fogColor"),alphaTest:f.getUniformLocation(c,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var r=n.getContext("2d");r.fillStyle="white",r.fillRect(0,0,8,8),p=new o(n),p.needsUpdate=!0}function i(){var e=f.createProgram(),n=f.createShader(f.VERTEX_SHADER),i=f.createShader(f.FRAGMENT_SHADER);return f.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),f.shaderSource(i,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),f.compileShader(n),f.compileShader(i),f.attachShader(e,n),f.attachShader(e,i),f.linkProgram(e),e}function r(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var a,s,c,h,d,p,f=t.context,m=t.state,g=new l,v=new u,y=new l;this.render=function(i,o){if(0!==e.length){void 0===c&&n(),f.useProgram(c),m.initAttributes(),m.enableAttribute(h.position),m.enableAttribute(h.uv),m.disableUnusedAttributes(),m.disable(f.CULL_FACE),m.enable(f.BLEND),f.bindBuffer(f.ARRAY_BUFFER,a),f.vertexAttribPointer(h.position,2,f.FLOAT,!1,16,0),f.vertexAttribPointer(h.uv,2,f.FLOAT,!1,16,8),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,s),f.uniformMatrix4fv(d.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(f.TEXTURE0),f.uniform1i(d.map,0);var u=0,l=0,_=i.fog;_?(f.uniform3f(d.fogColor,_.color.r,_.color.g,_.color.b),_.isFog?(f.uniform1f(d.fogNear,_.near),f.uniform1f(d.fogFar,_.far),f.uniform1i(d.fogType,1),u=1,l=1):_.isFogExp2&&(f.uniform1f(d.fogDensity,_.density),f.uniform1i(d.fogType,2),u=2,l=2)):(f.uniform1i(d.fogType,0),u=0,l=0);for(var x=0,b=e.length;x<b;x++){var w=e[x];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(r);for(var E=[],x=0,b=e.length;x<b;x++){var w=e[x],M=w.material;if(!1!==M.visible){f.uniform1f(d.alphaTest,M.alphaTest),f.uniformMatrix4fv(d.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(g,v,y),E[0]=y.x,E[1]=y.y;var T=0;i.fog&&M.fog&&(T=l),u!==T&&(f.uniform1i(d.fogType,T),u=T),null!==M.map?(f.uniform2f(d.uvOffset,M.map.offset.x,M.map.offset.y),f.uniform2f(d.uvScale,M.map.repeat.x,M.map.repeat.y)):(f.uniform2f(d.uvOffset,0,0),f.uniform2f(d.uvScale,1,1)),f.uniform1f(d.opacity,M.opacity),f.uniform3f(d.color,M.color.r,M.color.g,M.color.b),f.uniform1f(d.rotation,M.rotation),f.uniform2fv(d.scale,E),m.setBlending(M.blending,M.blendEquation,M.blendSrc,M.blendDst),m.buffers.depth.setTest(M.depthTest),m.buffers.depth.setMask(M.depthWrite),M.map?t.setTexture2D(M.map,0):t.setTexture2D(p,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0)}}m.enable(f.CULL_FACE),t.resetGLState()}}}function Q(){Object.defineProperty(this,"id",{value:Fs++}),this.uuid=Es.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=So,this.side=vo,this.shading=bo,this.vertexColors=wo,this.opacity=1,this.transparent=!1,this.blendSrc=Go,this.blendDst=ko,this.blendEquation=Po,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Jo,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function $(t){Q.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function tt(t){Q.call(this),this.type="MeshDepthMaterial",this.depthPacking=bs,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function et(t,e){this.min=void 0!==t?t:new l(1/0,1/0,1/0),this.max=void 0!==e?e:new l(-1/0,-1/0,-1/0)}function nt(t,e){this.center=void 0!==t?t:new l,this.radius=void 0!==e?e:0}function it(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function rt(t,e){this.normal=void 0!==t?t:new l(1,0,0),this.constant=void 0!==e?e:0}function ot(t,e,n,i,r,o){this.planes=[void 0!==t?t:new rt,void 0!==e?e:new rt,void 0!==n?n:new rt,void 0!==i?i:new rt,void 0!==r?r:new rt,void 0!==o?o:new rt]}function at(t,e,n,i){function o(e,n,i,r){var o=e.geometry,a=null,s=E,c=e.customDepthMaterial;if(i&&(s=M,c=e.customDistanceMaterial),c)a=c;else{var u=!1;n.morphTargets&&(o&&o.isBufferGeometry?u=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(u=o.morphTargets&&o.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var l=e.isSkinnedMesh&&n.skinning,h=0;u&&(h|=x),l&&(h|=b),a=s[h]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var d=a.uuid,p=n.uuid,f=T[d];void 0===f&&(f={},T[d]=f);var m=f[p];void 0===m&&(m=a.clone(),f[p]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var g=n.side;return F.renderSingleSided&&g==_o&&(g=vo),F.renderReverseSided&&(g===vo?g=yo:g===yo&&(g=vo)),a.side=g,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,i&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(r),a}function c(e,i,r,a){if(!1!==e.visible){if(e.layers.test(i.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||p.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld);var s=n.update(e),u=e.material;if(Array.isArray(u))for(var l=s.groups,h=0,d=l.length;h<d;h++){var f=l[h],m=u[f.materialIndex];if(m&&m.visible){var g=o(e,m,a,_);t.renderBufferDirect(r,null,s,g,e,f)}}else if(u.visible){var g=o(e,u,a,_);t.renderBufferDirect(r,null,s,g,e,null)}}for(var v=e.children,y=0,x=v.length;y<x;y++)c(v[y],i,r,a)}}var u=t.context,d=t.state,p=new ot,f=new h,m=e.shadows,g=new r,v=new r(i.maxTextureSize,i.maxTextureSize),y=new l,_=new l,x=1,b=2,w=1+(x|b),E=new Array(w),M=new Array(w),T={},S=[new l(1,0,0),new l(-1,0,0),new l(0,0,1),new l(0,0,-1),new l(0,1,0),new l(0,-1,0)],A=[new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,0,1),new l(0,0,-1)],R=[new a,new a,new a,new a,new a,new a],L=new tt;L.depthPacking=ws,L.clipping=!0;for(var C=Ds.distanceRGBA,P=Ns.clone(C.uniforms),O=0;O!==w;++O){var I=0!=(O&x),N=0!=(O&b),U=L.clone();U.morphTargets=I,U.skinning=N,E[O]=U;var D=new $({defines:{USE_SHADOWMAP:""},uniforms:P,vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,morphTargets:I,skinning:N,clipping:!0});M[O]=D}var F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=mo,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,n){if(!1!==F.enabled&&(!1!==F.autoUpdate||!1!==F.needsUpdate)&&0!==m.length){d.disable(u.BLEND),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var i,r,o=0,a=m.length;o<a;o++){var l=m[o],h=l.shadow;if(void 0!==h){var x=h.camera,b=h.matrix;if(_.setFromMatrixPosition(l.matrixWorld),x.position.copy(_),g.copy(h.mapSize),g.min(v),l&&l.isPointLight){i=6,r=!0;var w=g.x,E=g.y;R[0].set(2*w,E,w,E),R[1].set(0,E,w,E),R[2].set(3*w,E,w,E),R[3].set(w,E,w,E),R[4].set(3*w,0,w,E),R[5].set(w,0,w,E),g.x*=4,g.y*=2,b.makeTranslation(-_.x,-_.y,-_.z)}else i=1,r=!1,y.setFromMatrixPosition(l.target.matrixWorld),x.lookAt(y),x.updateMatrixWorld(),x.matrixWorldInverse.getInverse(x.matrixWorld),b.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),b.multiply(x.projectionMatrix),b.multiply(x.matrixWorldInverse);if(null===h.map){var M={minFilter:xa,magFilter:xa,format:Ga};h.map=new s(g.x,g.y,M),h.map.texture.name=l.name+".shadowMap",x.updateProjectionMatrix()}h.isSpotLightShadow&&h.update(l);var T=h.map;t.setRenderTarget(T),t.clear();for(var L=0;L<i;L++){if(r){y.copy(x.position),y.add(S[L]),x.up.copy(A[L]),x.lookAt(y),x.updateMatrixWorld(),x.matrixWorldInverse.getInverse(x.matrixWorld);var C=R[L];d.viewport(C)}f.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse),p.setFromMatrix(f),c(e,n,x,r)}}else console.warn("THREE.WebGLShadowMap:",l,"has no shadow.")}var P=t.getClearColor(),O=t.getClearAlpha();t.setClearColor(P,O),F.needsUpdate=!1}}}function st(t,e){this.origin=void 0!==t?t:new l,this.direction=void 0!==e?e:new l}function ct(t,e,n,i){this._x=t||0,this._y=e||0,this._z=n||0,this._order=i||ct.DefaultOrder}function ut(){this.mask=1}function lt(){function t(){r.setFromEuler(i,!1)}function e(){i.setFromQuaternion(r,void 0,!1)}Object.defineProperty(this,"id",{value:Bs++}),this.uuid=Es.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=lt.DefaultUp.clone();var n=new l,i=new ct,r=new u,o=new l(1,1,1);i.onChange(t),r.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:n},rotation:{enumerable:!0,value:i},quaternion:{enumerable:!0,value:r},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new h},normalMatrix:{value:new it}}),this.matrix=new h,this.matrixWorld=new h,this.matrixAutoUpdate=lt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ut,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function ht(t,e){this.start=void 0!==t?t:new l,this.end=void 0!==e?e:new l}function dt(t,e,n){this.a=void 0!==t?t:new l,this.b=void 0!==e?e:new l,this.c=void 0!==n?n:new l}function pt(t,e,n,i,r,o){this.a=t,this.b=e,this.c=n,this.normal=i&&i.isVector3?i:new l,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new q,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==o?o:0}function ft(t){Q.call(this),this.type="MeshBasicMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ea,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function mt(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Es.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function gt(t,e){mt.call(this,new Int8Array(t),e)}function vt(t,e){mt.call(this,new Uint8Array(t),e)}function yt(t,e){mt.call(this,new Uint8ClampedArray(t),e)}function _t(t,e){mt.call(this,new Int16Array(t),e)}function xt(t,e){mt.call(this,new Uint16Array(t),e)}function bt(t,e){mt.call(this,new Int32Array(t),e)}function wt(t,e){mt.call(this,new Uint32Array(t),e)}function Et(t,e){mt.call(this,new Float32Array(t),e)}function Mt(t,e){mt.call(this,new Float64Array(t),e)}function Tt(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function St(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,i=t.length;n<i;++n)t[n]>e&&(e=t[n]);return e}function At(){return zs++}function Rt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Es.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Lt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Es.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Ct(t,e){lt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new ft({color:16777215*Math.random()}),this.drawMode=ls,this.updateMorphTargets()}function Pt(t,e,n,i,r,o){Rt.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o},this.fromBufferGeometry(new Ot(t,e,n,i,r,o)),this.mergeVertices()}function Ot(t,e,n,i,r,o){function a(t,e,n,i,r,o,a,m,g,v,y){var _,x,b=o/g,w=a/v,E=o/2,M=a/2,T=m/2,S=g+1,A=v+1,R=0,L=0,C=new l;for(x=0;x<A;x++){var P=x*w-M;for(_=0;_<S;_++){var O=_*b-E;C[t]=O*i,C[e]=P*r,C[n]=T,u.push(C.x,C.y,C.z),C[t]=0,C[e]=0,C[n]=m>0?1:-1,h.push(C.x,C.y,C.z),d.push(_/g),d.push(1-x/v),R+=1}}for(x=0;x<v;x++)for(_=0;_<g;_++){var I=p+_+S*x,N=p+_+S*(x+1),U=p+(_+1)+S*(x+1),D=p+(_+1)+S*x;c.push(I,N,D),c.push(N,U,D),L+=6}s.addGroup(f,L,y),f+=L,p+=R}Lt.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};var s=this;i=Math.floor(i)||1,r=Math.floor(r)||1,o=Math.floor(o)||1;var c=[],u=[],h=[],d=[],p=0,f=0;a("z","y","x",-1,-1,n,e,t,o,r,0),a("z","y","x",1,-1,n,e,-t,o,r,1),a("x","z","y",1,1,t,n,e,i,o,2),a("x","z","y",1,-1,t,n,-e,i,o,3),a("x","y","z",1,-1,t,e,n,i,r,4),a("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(c),this.addAttribute("position",new Et(u,3)),this.addAttribute("normal",new Et(h,3)),this.addAttribute("uv",new Et(d,2))}function It(t,e,n,i){Rt.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new Nt(t,e,n,i)),this.mergeVertices()}function Nt(t,e,n,i){Lt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};var r,o,a=t/2,s=e/2,c=Math.floor(n)||1,u=Math.floor(i)||1,l=c+1,h=u+1,d=t/c,p=e/u,f=[],m=[],g=[],v=[];for(o=0;o<h;o++){var y=o*p-s;for(r=0;r<l;r++){var _=r*d-a;m.push(_,-y,0),g.push(0,0,1),v.push(r/c),v.push(1-o/u)}}for(o=0;o<u;o++)for(r=0;r<c;r++){var x=r+l*o,b=r+l*(o+1),w=r+1+l*(o+1),E=r+1+l*o;f.push(x,b,E),f.push(b,w,E)}this.setIndex(f),this.addAttribute("position",new Et(m,3)),this.addAttribute("normal",new Et(g,3)),this.addAttribute("uv",new Et(v,2))}function Ut(){lt.call(this),this.type="Camera",this.matrixWorldInverse=new h,this.projectionMatrix=new h}function Dt(t,e,n,i){Ut.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Ft(t,e,n,i,r,o){Ut.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=void 0!==r?r:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function Bt(t){function e(e,n){var i=e.array,r=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,o=t.createBuffer();t.bindBuffer(n,o),t.bufferData(n,i,r),e.onUploadCallback();var a=t.FLOAT;return i instanceof Float32Array?a=t.FLOAT:i instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):i instanceof Uint16Array?a=t.UNSIGNED_SHORT:i instanceof Int16Array?a=t.SHORT:i instanceof Uint32Array?a=t.UNSIGNED_INT:i instanceof Int32Array?a=t.INT:i instanceof Int8Array?a=t.BYTE:i instanceof Uint8Array&&(a=t.UNSIGNED_BYTE),{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version}}function n(e,n,i){var r=n.array,o=n.updateRange;t.bindBuffer(i,e),!1===n.dynamic?t.bufferData(i,r,t.STATIC_DRAW):-1===o.count?t.bufferSubData(i,0,r):0===o.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(i,o.offset*r.BYTES_PER_ELEMENT,r.subarray(o.offset,o.offset+o.count)),o.count=0)}function i(t){return t.isInterleavedBufferAttribute&&(t=t.data),a[t.uuid]}function r(e){var n=a[e.uuid];n&&(t.deleteBuffer(n.buffer),delete a[e.uuid])}function o(t,i){t.isInterleavedBufferAttribute&&(t=t.data);var r=a[t.uuid];void 0===r?a[t.uuid]=e(t,i):r.version<t.version&&(n(r.buffer,t,i),r.version=t.version)}var a={};return{get:i,remove:r,update:o}}function zt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Gt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function kt(){function t(){o=-1,s=-1}function e(t,e,n,i,c){var u,l;n.transparent?(u=a,l=++s):(u=r,l=++o);var h=u[l];h?(h.id=t.id,h.object=t,h.geometry=e,h.material=n,h.program=n.program,h.renderOrder=t.renderOrder,h.z=i,h.group=c):(h={id:t.id,object:t,geometry:e,material:n,program:n.program,renderOrder:t.renderOrder,z:i,group:c},u.push(h))}function n(){r.length=o+1,a.length=s+1}function i(){r.sort(zt),a.sort(Gt)}var r=[],o=-1,a=[],s=-1;return{opaque:r,transparent:a,init:t,push:e,finish:n,sort:i}}function Ht(){function t(t,e){var i=t.id+","+e.id,r=n[i];return void 0===r&&(r=new kt,n[i]=r),r}function e(){n={}}var n={};return{get:t,dispose:e}}function Vt(t,e,n){function i(t){s=t}function r(n){n.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(c=t.UNSIGNED_INT,u=4):n.array instanceof Uint16Array?(c=t.UNSIGNED_SHORT,u=2):(c=t.UNSIGNED_BYTE,u=1)}function o(e,i){t.drawElements(s,i,c,e*u),n.calls++,n.vertices+=i,s===t.TRIANGLES&&(n.faces+=i/3)}function a(i,r,o){var a=e.get("ANGLE_instanced_arrays");if(null===a)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");a.drawElementsInstancedANGLE(s,o,c,r*u,i.maxInstancedCount),n.calls++,n.vertices+=o*i.maxInstancedCount,s===t.TRIANGLES&&(n.faces+=i.maxInstancedCount*o/3)}var s,c,u;this.setMode=i,this.setIndex=r,this.render=o,this.renderInstances=a}function jt(t,e,n){function i(t){a=t}function r(e,i){t.drawArrays(a,e,i),n.calls++,n.vertices+=i,a===t.TRIANGLES&&(n.faces+=i/3)}function o(i,r,o){var s=e.get("ANGLE_instanced_arrays");if(null===s)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var c=i.attributes.position;c.isInterleavedBufferAttribute?(o=c.data.count,s.drawArraysInstancedANGLE(a,0,o,i.maxInstancedCount)):s.drawArraysInstancedANGLE(a,r,o,i.maxInstancedCount),n.calls++,n.vertices+=o*i.maxInstancedCount,a===t.TRIANGLES&&(n.faces+=i.maxInstancedCount*o/3)}var a;this.setMode=i,this.render=r,this.renderInstances=o}function Wt(t,e,n){function i(t){var r=t.target,o=s[r.id];null!==o.index&&e.remove(o.index);for(var a in o.attributes)e.remove(o.attributes[a]);r.removeEventListener("dispose",i),delete s[r.id];var u=c[r.id];u&&(e.remove(u),delete c[r.id]),u=c[o.id],u&&(e.remove(u),delete c[o.id]),n.geometries--}function r(t,e){var r=s[e.id];return r||(e.addEventListener("dispose",i),e.isBufferGeometry?r=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Lt).setFromObject(t)),r=e._bufferGeometry),s[e.id]=r,n.geometries++,r)}function o(n){var i=n.index,r=n.attributes;null!==i&&e.update(i,t.ELEMENT_ARRAY_BUFFER);for(var o in r)e.update(r[o],t.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],c=0,u=s.length;c<u;c++)e.update(s[c],t.ARRAY_BUFFER)}function a(n){var i=c[n.id];if(i)return i;var r=[],o=n.index,a=n.attributes;if(null!==o)for(var s=o.array,u=0,l=s.length;u<l;u+=3){var h=s[u+0],d=s[u+1],p=s[u+2];r.push(h,d,d,p,p,h)}else for(var s=a.position.array,u=0,l=s.length/3-1;u<l;u+=3){var h=u+0,d=u+1,p=u+2;r.push(h,d,d,p,p,h)}return i=new(St(r)>65535?wt:xt)(r,1),e.update(i,t.ELEMENT_ARRAY_BUFFER),c[n.id]=i,i}var s={},c={};return{get:r,update:o,getWireframeAttribute:a}}function Xt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new l,color:new q,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"SpotLight":n={position:new l,direction:new l,color:new q,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"PointLight":n={position:new l,color:new q,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new r};break;case"HemisphereLight":n={direction:new l,skyColor:new q,groundColor:new q};break;case"RectAreaLight":n={color:new q,position:new l,halfWidth:new l,halfHeight:new l}}return t[e.id]=n,n}}}function Yt(t,e,n){function i(t){var i=n.frame,r=t.geometry,a=e.get(t,r);return o[a.id]!==i&&(r.isGeometry&&a.updateFromObject(t),e.update(a),o[a.id]=i),a}function r(){o={}}var o={};return{update:i,clear:r}}function qt(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function Zt(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),!1===t.getShaderParameter(i,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(i)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(i),qt(n)),i}function Jt(t){switch(t){case ps:return["Linear","( value )"];case fs:return["sRGB","( value )"];case gs:return["RGBE","( value )"];case ys:return["RGBM","( value, 7.0 )"];case _s:return["RGBM","( value, 16.0 )"];case xs:return["RGBD","( value, 256.0 )"];case ms:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Kt(t,e){var n=Jt(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Qt(t,e){var n=Jt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function $t(t,e){var n;switch(e){case oa:n="Linear";break;case aa:n="Reinhard";break;case sa:n="Uncharted2";break;case ca:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function te(t,e,n){return t=t||{},[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ie).join("\n")}function ee(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}function ne(t,e,n){for(var i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<r;o++){var a=t.getActiveAttrib(e,o),s=a.name;i[s]=t.getAttribLocation(e,s)}return i}function ie(t){return""!==t}function re(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function oe(t){function e(t,e){var n=Us[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return oe(n)}var n=/^[ \t]*#include +<([\w\d.]+)>/gm;return t.replace(n,e)}function ae(t){function e(t,e,n,i){for(var r="",o=parseInt(e);o<parseInt(n);o++)r+=i.replace(/\[ i \]/g,"[ "+o+" ]");return r}var n=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(n,e)}function se(t,e,n,i){var r=t.context,o=n.extensions,a=n.defines,s=n.__webglShader.vertexShader,c=n.__webglShader.fragmentShader,u="SHADOWMAP_TYPE_BASIC";i.shadowMapType===mo?u="SHADOWMAP_TYPE_PCF":i.shadowMapType===go&&(u="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",h="ENVMAP_MODE_REFLECTION",d="ENVMAP_BLENDING_MULTIPLY";if(i.envMap){switch(n.envMap.mapping){case la:case ha:l="ENVMAP_TYPE_CUBE";break;case ma:case ga:l="ENVMAP_TYPE_CUBE_UV";break;case da:case pa:l="ENVMAP_TYPE_EQUIREC";break;case fa:l="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case ha:case pa:h="ENVMAP_MODE_REFRACTION"}switch(n.combine){case ea:d="ENVMAP_BLENDING_MULTIPLY";break;case na:d="ENVMAP_BLENDING_MIX";break;case ia:d="ENVMAP_BLENDING_ADD"}}var p,f,m=t.gammaFactor>0?t.gammaFactor:1,g=te(o,i,t.extensions),v=ee(a),y=r.createProgram();n.isRawShaderMaterial?(p=[v,"\n"].filter(ie).join("\n"),f=[g,v,"\n"].filter(ie).join("\n")):(p=["precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,i.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+i.maxBones,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.useVertexTexture?"#define BONE_TEXTURE":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.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(ie).join("\n"),f=[g,"precision "+i.precision+" float;","precision "+i.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,i.alphaTest?"#define ALPHATEST "+i.alphaTest:"","#define GAMMA_FACTOR "+m,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+l:"",i.envMap?"#define "+h:"",i.envMap?"#define "+d:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.vertexColors?"#define USE_COLOR":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+i.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(i.numClippingPlanes-i.numClipIntersection),i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+u:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",i.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",i.toneMapping!==ra?"#define TONE_MAPPING":"",i.toneMapping!==ra?Us.tonemapping_pars_fragment:"",i.toneMapping!==ra?$t("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.outputEncoding||i.mapEncoding||i.envMapEncoding||i.emissiveMapEncoding?Us.encodings_pars_fragment:"",i.mapEncoding?Kt("mapTexelToLinear",i.mapEncoding):"",i.envMapEncoding?Kt("envMapTexelToLinear",i.envMapEncoding):"",i.emissiveMapEncoding?Kt("emissiveMapTexelToLinear",i.emissiveMapEncoding):"",i.outputEncoding?Qt("linearToOutputTexel",i.outputEncoding):"",i.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ie).join("\n")),s=oe(s,i),s=re(s,i),c=oe(c,i),c=re(c,i),n.isShaderMaterial||(s=ae(s),c=ae(c));var _=p+s,x=f+c,b=Zt(r,r.VERTEX_SHADER,_),w=Zt(r,r.FRAGMENT_SHADER,x);r.attachShader(y,b),r.attachShader(y,w),void 0!==n.index0AttributeName?r.bindAttribLocation(y,0,n.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);var E=r.getProgramInfoLog(y),M=r.getShaderInfoLog(b),T=r.getShaderInfoLog(w),S=!0,A=!0;!1===r.getProgramParameter(y,r.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",r.getError(),"gl.VALIDATE_STATUS",r.getProgramParameter(y,r.VALIDATE_STATUS),"gl.getProgramInfoLog",E,M,T)):""!==E?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",E):""!==M&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:n,programLog:E,vertexShader:{log:M,prefix:p},fragmentShader:{log:T,prefix:f}}),r.deleteShader(b),r.deleteShader(w);var R;this.getUniforms=function(){return void 0===R&&(R=new Y(r,y,t)),R};var L;return this.getAttributes=function(){return void 0===L&&(L=ne(r,y)),L},this.destroy=function(){r.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=Gs++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=b,this.fragmentShader=w,this}function ce(t,e){function n(t){var n=t.skeleton,i=n.bones;if(e.floatVertexTextures)return 1024;var r=e.maxVertexUniforms,o=Math.floor((r-20)/4),a=Math.min(o,i.length);return a<i.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+i.length+" bones. This GPU supports "+a+"."),0):a}function i(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=ps,n===ps&&e&&(n=ms),n}var r=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];this.getParameters=function(r,a,s,c,u,l){var h=o[r.type],d=l.isSkinnedMesh?n(l):0,p=t.getPrecision();null!==r.precision&&(p=e.getMaxPrecision(r.precision))!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead.");var f=t.getRenderTarget();return{shaderID:h,precision:p,supportsVertexTextures:e.vertexTextures,outputEncoding:i(f?f.texture:null,t.gammaOutput),map:!!r.map,mapEncoding:i(r.map,t.gammaInput),envMap:!!r.envMap,envMapMode:r.envMap&&r.envMap.mapping,envMapEncoding:i(r.envMap,t.gammaInput),envMapCubeUV:!!r.envMap&&(r.envMap.mapping===ma||r.envMap.mapping===ga),lightMap:!!r.lightMap,aoMap:!!r.aoMap,emissiveMap:!!r.emissiveMap,emissiveMapEncoding:i(r.emissiveMap,t.gammaInput),bumpMap:!!r.bumpMap,normalMap:!!r.normalMap,displacementMap:!!r.displacementMap,roughnessMap:!!r.roughnessMap,metalnessMap:!!r.metalnessMap,specularMap:!!r.specularMap,alphaMap:!!r.alphaMap,gradientMap:!!r.gradientMap,combine:r.combine,vertexColors:r.vertexColors,fog:!!s,useFog:r.fog,fogExp:s&&s.isFogExp2,flatShading:r.shading===xo,sizeAttenuation:r.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:r.skinning&&d>0,maxBones:d,useVertexTexture:e.floatVertexTextures,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numClippingPlanes:c,numClipIntersection:u,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&a.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:r.side===_o,flipSided:r.side===yo,depthPacking:void 0!==r.depthPacking&&r.depthPacking}},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)n.push(i),n.push(t.defines[i]);for(var r=0;r<a.length;r++)n.push(e[a[r]]);return n.join()},this.acquireProgram=function(e,n,i){for(var o,a=0,s=r.length;a<s;a++){var c=r[a];if(c.code===i){o=c,++o.usedTimes;break}}return void 0===o&&(o=new se(t,i,e,n),r.push(o)),o},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=r.indexOf(t);r[e]=r[r.length-1],r.pop(),t.destroy()}},this.programs=r}function ue(t,e,n,i,r,o,a){function s(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");i.width=Math.floor(t.width*n),i.height=Math.floor(t.height*n);return i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,i.width,i.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+i.width+"x"+i.height,t),i}return t}function c(t){return Es.isPowerOfTwo(t.width)&&Es.isPowerOfTwo(t.height)}function u(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=Es.nearestPowerOfTwo(t.width),e.height=Es.nearestPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function l(t){return t.wrapS!==ya||t.wrapT!==ya||t.minFilter!==xa&&t.minFilter!==Ea}function h(e){return e===xa||e===ba||e===wa?t.NEAREST:t.LINEAR}function d(t){var e=t.target;e.removeEventListener("dispose",d),f(e),a.textures--}function p(t){var e=t.target;e.removeEventListener("dispose",p),m(e),a.textures--}function f(e){var n=i.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}i.remove(e)}function m(e){var n=i.get(e),r=i.get(e.texture);if(e){if(void 0!==r.__webglTexture&&t.deleteTexture(r.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);i.remove(e.texture),i.remove(e)}}function g(e,r){var o=i.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==a.complete)return void x(o,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function v(e,u){var l=i.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",d),l.__image__webglTextureCube=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,p=e.image[0]&&e.image[0].isDataTexture,f=[],m=0;m<6;m++)f[m]=h||p?p?e.image[m].image:e.image[m]:s(e.image[m],r.maxCubemapSize);var g=f[0],v=c(g),y=o(e.format),x=o(e.type);_(t.TEXTURE_CUBE_MAP,e,v);for(var m=0;m<6;m++)if(h)for(var b,w=f[m].mipmaps,E=0,M=w.length;E<M;E++)b=w[E],e.format!==Ga&&e.format!==za?n.getCompressedTextureFormats().indexOf(y)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,E,y,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,E,y,b.width,b.height,0,y,x,b.data);else p?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,f[m].width,f[m].height,0,y,x,f[m].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,y,x,f[m]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+u),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function y(e,r){n.activeTexture(t.TEXTURE0+r),n.bindTexture(t.TEXTURE_CUBE_MAP,i.get(e).__webglTexture)}function _(n,a,s){var c;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===ya&&a.wrapT===ya||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,h(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,h(a.minFilter)),a.minFilter!==xa&&a.minFilter!==Ea&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),c=e.get("EXT_texture_filter_anisotropic")){if(a.type===Oa&&null===e.get("OES_texture_float_linear"))return;if(a.type===Ia&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||i.get(a).__currentAnisotropy)&&(t.texParameterf(n,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,i,h){void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",d),e.__webglTexture=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+h),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,i.unpackAlignment);var p=s(i.image,r.maxTextureSize);l(i)&&!1===c(p)&&(p=u(p));var f=c(p),m=o(i.format),g=o(i.type);_(t.TEXTURE_2D,i,f);var v,y=i.mipmaps;if(i.isDepthTexture){var x=t.DEPTH_COMPONENT;if(i.type===Oa){if(!A)throw new Error("Float Depth Texture only supported in WebGL2.0");x=t.DEPTH_COMPONENT32F}else A&&(x=t.DEPTH_COMPONENT16);i.format===ja&&x===t.DEPTH_COMPONENT&&i.type!==La&&i.type!==Pa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=La,g=o(i.type)),i.format===Wa&&(x=t.DEPTH_STENCIL,i.type!==Fa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Fa,g=o(i.type))),n.texImage2D(t.TEXTURE_2D,0,x,p.width,p.height,0,m,g,null)}else if(i.isDataTexture)if(y.length>0&&f){for(var b=0,w=y.length;b<w;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,m,g,v.data);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,p.width,p.height,0,m,g,p.data);else if(i.isCompressedTexture)for(var b=0,w=y.length;b<w;b++)v=y[b],i.format!==Ga&&i.format!==za?n.getCompressedTextureFormats().indexOf(m)>-1?n.compressedTexImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,m,g,v.data);else if(y.length>0&&f){for(var b=0,w=y.length;b<w;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,m,g,v);i.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,m,g,p);i.generateMipmaps&&f&&t.generateMipmap(t.TEXTURE_2D),e.__version=i.version,i.onUpdate&&i.onUpdate(i)}function b(e,r,a,s){var c=o(r.texture.format),u=o(r.texture.type);n.texImage2D(s,0,c,r.width,r.height,0,c,u,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,i.get(r.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function E(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),g(n.depthTexture,0);var r=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===ja)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(n.depthTexture.format!==Wa)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}function M(e){var n=i.get(e),r=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(r)throw new Error("target.depthTexture not supported in Cube render targets");E(n.__webglFramebuffer,e)}else if(r){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),w(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var r=i.get(e),o=i.get(e.texture);e.addEventListener("dispose",p),o.__webglTexture=t.createTexture(),a.textures++;var s=!0===e.isWebGLRenderTargetCube,u=c(e);if(s){r.__webglFramebuffer=[];for(var l=0;l<6;l++)r.__webglFramebuffer[l]=t.createFramebuffer()}else r.__webglFramebuffer=t.createFramebuffer();if(s){n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),_(t.TEXTURE_CUBE_MAP,e.texture,u);for(var l=0;l<6;l++)b(r.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);e.texture.generateMipmaps&&u&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),_(t.TEXTURE_2D,e.texture,u),b(r.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&u&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&M(e)}function S(e){var r=e.texture;if(r.generateMipmaps&&c(e)&&r.minFilter!==xa&&r.minFilter!==Ea){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=i.get(r).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}var A="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function le(){function t(t){var e=t.uuid,n=i[e];return void 0===n&&(n={},i[e]=n),n}function e(t){delete i[t.uuid]}function n(){i={}}var i={};return{get:t,remove:e,clear:n}}function he(t,e,n){function i(){var e=!1,n=new a,i=null,r=new a;return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,o,a,s){!0===s&&(e*=a,i*=a,o*=a),n.set(e,i,o,a),!1===r.equals(n)&&(t.clearColor(e,i,o,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(0,0,0,1)}}}function r(){var e=!1,n=null,i=null,r=null;return{setTest:function(e){e?p(t.DEPTH_TEST):f(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case Yo:t.depthFunc(t.NEVER);break;case qo:t.depthFunc(t.ALWAYS);break;case Zo:t.depthFunc(t.LESS);break;case Jo:t.depthFunc(t.LEQUAL);break;case Ko:t.depthFunc(t.EQUAL);break;case Qo:t.depthFunc(t.GEQUAL);break;case $o:t.depthFunc(t.GREATER);break;case ta:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}}function o(){var e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,u=null;return{setTest:function(e){e?p(t.STENCIL_TEST):f(t.STENCIL_TEST)},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&o===a||(t.stencilFunc(e,n,a),i=e,r=n,o=a)},setOp:function(e,n,i){a===e&&s===n&&c===i||(t.stencilOp(e,n,i),a=e,s=n,c=i)},setLocked:function(t){e=t},setClear:function(e){u!==e&&(t.clearStencil(e),u=e)},reset:function(){e=!1,n=null,i=null,r=null,o=null,a=null,s=null,c=null,u=null}}}function s(e,n,i){var r=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a<i;a++)t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return o}function c(){P.setClear(0,0,0,1),O.setClear(1),I.setClear(0),p(t.DEPTH_TEST),O.setFunc(Jo),y(!1),_(co),p(t.CULL_FACE),p(t.BLEND),g(So)}function u(){for(var t=0,e=U.length;t<e;t++)U[t]=0}function l(n){if(U[n]=1,0===D[n]&&(t.enableVertexAttribArray(n),D[n]=1),0!==F[n]){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),F[n]=0}}function h(n,i){if(U[n]=1,0===D[n]&&(t.enableVertexAttribArray(n),D[n]=1),F[n]!==i){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,i),F[n]=i}}function d(){for(var e=0,n=D.length;e!==n;++e)D[e]!==U[e]&&(t.disableVertexAttribArray(e),D[e]=0)}function p(e){!0!==B[e]&&(t.enable(e),B[e]=!0)}function f(e){!1!==B[e]&&(t.disable(e),B[e]=!1)}function m(){if(null===z&&(z=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),i=0;i<n.length;i++)z.push(n[i]);return z}function g(e,i,r,o,a,s,c,u){e!==To?p(t.BLEND):f(t.BLEND),e===G&&u===Y||(e===Ao?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===Ro?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===Lo?u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):u?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),G=e,Y=u),e===Co?(a=a||i,s=s||r,c=c||o,i===k&&a===j||(t.blendEquationSeparate(n(i),n(a)),k=i,j=a),r===H&&o===V&&s===W&&c===X||(t.blendFuncSeparate(n(r),n(o),n(s),n(c)),H=r,V=o,W=s,X=c)):(k=null,H=null,V=null,j=null,W=null,X=null)}function v(e){e.side===_o?f(t.CULL_FACE):p(t.CULL_FACE),y(e.side===yo),!0===e.transparent?g(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):g(To),O.setFunc(e.depthFunc),O.setTest(e.depthTest),O.setMask(e.depthWrite),P.setMask(e.colorWrite),b(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function y(e){q!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),q=e)}function _(e){e!==so?(p(t.CULL_FACE),e!==Z&&(e===co?t.cullFace(t.BACK):e===uo?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):f(t.CULL_FACE),Z=e}function x(e){e!==J&&(nt&&t.lineWidth(e),J=e)}function b(e,n,i){e?(p(t.POLYGON_OFFSET_FILL),K===n&&Q===i||(t.polygonOffset(n,i),K=n,Q=i)):f(t.POLYGON_OFFSET_FILL)}function w(){return $}function E(e){$=e,e?p(t.SCISSOR_TEST):f(t.SCISSOR_TEST)}function M(e){void 0===e&&(e=t.TEXTURE0+tt-1),it!==e&&(t.activeTexture(e),it=e)}function T(e,n){null===it&&M();var i=rt[it];void 0===i&&(i={type:void 0,texture:void 0},rt[it]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||st[e]),i.type=e,i.texture=n)}function S(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}}function A(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}}function R(e){!1===ot.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ot.copy(e))}function L(e){!1===at.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),at.copy(e))}function C(){for(var e=0;e<D.length;e++)1===D[e]&&(t.disableVertexAttribArray(e),D[e]=0);B={},z=null,it=null,rt={},G=null,q=null,Z=null,P.reset(),O.reset(),I.reset()}var P=new i,O=new r,I=new o,N=t.getParameter(t.MAX_VERTEX_ATTRIBS),U=new Uint8Array(N),D=new Uint8Array(N),F=new Uint8Array(N),B={},z=null,G=null,k=null,H=null,V=null,j=null,W=null,X=null,Y=!1,q=null,Z=null,J=null,K=null,Q=null,$=null,tt=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),et=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),nt=parseFloat(et)>=1,it=null,rt={},ot=new a,at=new a,st={};return st[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),st[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:P,depth:O,stencil:I},init:c,initAttributes:u,enableAttribute:l,enableAttributeAndDivisor:h,disableUnusedAttributes:d,enable:p,disable:f,getCompressedTextureFormats:m,setBlending:g,setMaterial:v,setFlipSided:y,setCullFace:_,setLineWidth:x,setPolygonOffset:b,getScissorTest:w,setScissorTest:E,activeTexture:M,bindTexture:T,compressedTexImage2D:S,texImage2D:A,scissor:R,viewport:L,reset:C}}function de(t,e,n){function i(){if(void 0!==o)return o;var n=e.get("EXT_texture_filter_anisotropic");return o=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==n.precision?n.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var c=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),d=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),p=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=l>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:i,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y}}function pe(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":i=t.getExtension("WEBGL_compressed_texture_etc1");break;default:i=t.getExtension(n)}return null===i&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=i,i}}}function fe(){function t(){u.value!==i&&(u.value=i,u.needsUpdate=r>0),n.numPlanes=r,n.numIntersection=0}function e(t,e,i,r){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=u.value,!0!==r||null===a){var l=i+4*o,h=e.matrixWorldInverse;c.getNormalMatrix(h),(null===a||a.length<l)&&(a=new Float32Array(l));for(var d=0,p=i;d!==o;++d,p+=4)s.copy(t[d]).applyMatrix4(h,c),s.normal.toArray(a,p),a[p+3]=s.constant}u.value=a,u.needsUpdate=!0}return n.numPlanes=o,a}var n=this,i=null,r=0,o=!1,a=!1,s=new rt,c=new it,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(t,n,a){var s=0!==t.length||n||0!==r||o;return o=n,i=e(t,a,0),r=t.length,s},this.beginShadows=function(){a=!0,e(null)},this.endShadows=function(){a=!1,t()},this.setState=function(n,s,c,l,h,d){if(!o||null===n||0===n.length||a&&!c)a?e(null):t();else{var p=a?0:r,f=4*p,m=h.clippingState||null;u.value=m,m=e(n,l,f,d);for(var g=0;g!==f;++g)m[g]=i[g];h.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=p}}}function me(t){function e(){return null===nt?yt:1}function n(){Jt.init(),Jt.scissor(ut.copy(_t).multiplyScalar(yt)),Jt.viewport(ht.copy(bt).multiplyScalar(yt)),Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H)}function i(){et=null,ct=null,st="",rt=-1,Jt.reset()}function r(t){t.preventDefault(),i(),n(),Kt.clear(),ee.clear()}function o(t){var e=t.target;e.removeEventListener("dispose",o),s(e)}function s(t){c(t),Kt.remove(t)}function c(t){var e=Kt.get(t).program;t.program=void 0,void 0!==e&&ne.releaseProgram(e)}function u(t,e,n){t.render(function(t){tt.renderBufferImmediate(t,e,n)})}function p(t,e){return Math.abs(e[0])-Math.abs(t[0])}function f(t,e,n,i){if(n&&n.isInstancedBufferGeometry&&null===qt.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===i&&(i=0),Jt.initAttributes();var r=n.attributes,o=e.getAttributes(),a=t.defaultAttributeValues;for(var s in o){var c=o[s];if(c>=0){var u=r[s];if(void 0!==u){var l=u.normalized,h=u.itemSize,d=$t.get(u),p=d.buffer,f=d.type,m=d.bytesPerElement;if(u.isInterleavedBufferAttribute){var g=u.data,v=g.stride,y=u.offset;g&&g.isInstancedInterleavedBuffer?(Jt.enableAttributeAndDivisor(c,g.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=g.meshPerAttribute*g.count)):Jt.enableAttribute(c),Gt.bindBuffer(Gt.ARRAY_BUFFER,p),Gt.vertexAttribPointer(c,h,f,l,v*m,(i*v+y)*m)}else u.isInstancedBufferAttribute?(Jt.enableAttributeAndDivisor(c,u.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=u.meshPerAttribute*u.count)):Jt.enableAttribute(c),Gt.bindBuffer(Gt.ARRAY_BUFFER,p),Gt.vertexAttribPointer(c,h,f,l,0,i*h*m)}else if(void 0!==a){var _=a[s];if(void 0!==_)switch(_.length){case 2:Gt.vertexAttrib2fv(c,_);break;case 3:Gt.vertexAttrib3fv(c,_);break;case 4:Gt.vertexAttrib4fv(c,_);break;default:Gt.vertexAttrib1fv(c,_)}}}}Jt.disableUnusedAttributes()}function m(t,e,n){if(t.visible){if(t.layers.test(e.layers))if(t.isLight)j.push(t);else if(t.isSprite)t.frustumCulled&&!wt.intersectsSprite(t)||Z.push(t);else if(t.isLensFlare)Q.push(t);else if(t.isImmediateRenderObject)n&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St),W.push(t,null,t.material,At.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||wt.intersectsObject(t))){n&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St);var i=ee.update(t),r=t.material;if(Array.isArray(r))for(var o=i.groups,a=0,s=o.length;a<s;a++){var c=o[a],u=r[c.materialIndex];u&&u.visible&&W.push(t,i,u,At.z,c)}else r.visible&&W.push(t,i,r,At.z,null)}for(var l=t.children,a=0,s=l.length;a<s;a++)m(l[a],e,n)}}function g(t,e,n,i){for(var r=0,o=t.length;r<o;r++){var a=t[r],s=a.object,c=a.geometry,u=void 0===i?a.material:i,l=a.group;if(s.onBeforeRender(tt,e,n,c,u,l),n.isArrayCamera&&n.enabled)for(var h=n.cameras,d=0,p=h.length;d<p;d++){var f=h[d],m=f.bounds;tt.setViewport(m.x*gt*yt,m.y*vt*yt,m.z*gt*yt,m.w*vt*yt),tt.setScissor(m.x*gt*yt,m.y*vt*yt,m.z*gt*yt,m.w*vt*yt),tt.setScissorTest(!0),v(s,e,f,c,u,l)}else v(s,e,n,c,u,l);s.onAfterRender(tt,e,n,c,u,l)}}function v(t,e,n,i,r,o){if(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){Jt.setMaterial(r);var a=_(n,e.fog,r,t);st="",u(t,a,r)}else tt.renderBufferDirect(n,e.fog,i,r,t,o)}function y(t,e,n){var i=Kt.get(t),r=ne.getParameters(t,It,e,Et.numPlanes,Et.numIntersection,n),a=ne.getProgramCode(t,r),s=i.program,u=!0;if(void 0===s)t.addEventListener("dispose",o);else if(s.code!==a)c(t);else{if(void 0!==r.shaderID)return;u=!1}if(u){if(r.shaderID){var l=Ds[r.shaderID];i.__webglShader={name:t.type,uniforms:Ns.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else i.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=i.__webglShader,s=ne.acquireProgram(t,r,a),i.program=s,t.program=s}var h=s.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var d=0;d<tt.maxMorphTargets;d++)h["morphTarget"+d]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var d=0;d<tt.maxMorphNormals;d++)h["morphNormal"+d]>=0&&t.numSupportedMorphNormals++}var p=i.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(i.numClippingPlanes=Et.numPlanes,i.numIntersection=Et.numIntersection,p.clippingPlanes=Et.uniform),i.fog=e,i.lightsHash=It.hash,t.lights&&(p.ambientLightColor.value=It.ambient,p.directionalLights.value=It.directional,p.spotLights.value=It.spot,p.rectAreaLights.value=It.rectArea,p.pointLights.value=It.point,p.hemisphereLights.value=It.hemi,p.directionalShadowMap.value=It.directionalShadowMap,p.directionalShadowMatrix.value=It.directionalShadowMatrix,p.spotShadowMap.value=It.spotShadowMap,p.spotShadowMatrix.value=It.spotShadowMatrix,p.pointShadowMap.value=It.pointShadowMap,p.pointShadowMatrix.value=It.pointShadowMatrix);var f=i.program.getUniforms(),m=Y.seqWithValue(f.seq,p);i.uniformsList=m}function _(t,e,n,i){dt=0;var r=Kt.get(n);if(Mt&&(Tt||t!==ct)){var o=t===ct&&n.id===rt;Et.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,r,o)}!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==e?n.needsUpdate=!0:n.lights&&r.lightsHash!==It.hash?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===Et.numPlanes&&r.numIntersection===Et.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(y(n,e,i),n.needsUpdate=!1);var a=!1,s=!1,c=!1,u=r.program,l=u.getUniforms(),h=r.__webglShader.uniforms;if(u.id!==et&&(Gt.useProgram(u.program),et=u.id,a=!0,s=!0,c=!0),n.id!==rt&&(rt=n.id,s=!0),a||t!==ct){if(l.setValue(Gt,"projectionMatrix",t.projectionMatrix),Zt.logarithmicDepthBuffer&&l.setValue(Gt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ct&&(ct=t,s=!0,c=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var p=l.map.cameraPosition;void 0!==p&&p.setValue(Gt,At.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&l.setValue(Gt,"viewMatrix",t.matrixWorldInverse),l.setValue(Gt,"toneMappingExposure",tt.toneMappingExposure),l.setValue(Gt,"toneMappingWhitePoint",tt.toneMappingWhitePoint)}if(n.skinning){l.setOptional(Gt,i,"bindMatrix"),l.setOptional(Gt,i,"bindMatrixInverse");var f=i.skeleton;if(f){var m=f.bones;if(Zt.floatVertexTextures){if(void 0===f.boneTexture){var g=Math.sqrt(4*m.length);g=Es.nextPowerOfTwo(Math.ceil(g)),g=Math.max(g,4);var v=new Float32Array(g*g*4);v.set(f.boneMatrices);var _=new d(v,g,g,Ga,Oa);f.boneMatrices=v,f.boneTexture=_,f.boneTextureSize=g}l.setValue(Gt,"boneTexture",f.boneTexture),l.setValue(Gt,"boneTextureSize",f.boneTextureSize)}else l.setOptional(Gt,f,"boneMatrices")}}return s&&(n.lights&&P(h,c),e&&n.fog&&M(h,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&x(h,n),n.isLineBasicMaterial?b(h,n):n.isLineDashedMaterial?(b(h,n),w(h,n)):n.isPointsMaterial?E(h,n):n.isMeshLambertMaterial?T(h,n):n.isMeshToonMaterial?A(h,n):n.isMeshPhongMaterial?S(h,n):n.isMeshPhysicalMaterial?L(h,n):n.isMeshStandardMaterial?R(h,n):n.isMeshDepthMaterial?n.displacementMap&&(h.displacementMap.value=n.displacementMap,h.displacementScale.value=n.displacementScale,h.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&C(h,n),void 0!==h.ltcMat&&(h.ltcMat.value=Is.LTC_MAT_TEXTURE),void 0!==h.ltcMag&&(h.ltcMag.value=Is.LTC_MAG_TEXTURE),Y.upload(Gt,r.uniformsList,h,tt)),l.setValue(Gt,"modelViewMatrix",i.modelViewMatrix),l.setValue(Gt,"normalMatrix",i.normalMatrix),l.setValue(Gt,"modelMatrix",i.matrixWorld),u}function x(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var i=n.offset,r=n.repeat;t.offsetRepeat.value.set(i.x,i.y,r.x,r.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function b(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function w(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function E(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*yt,t.scale.value=.5*vt,t.map.value=e.map,null!==e.map){var n=e.map.offset,i=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,i.x,i.y)}}function M(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function T(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function S(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function A(t,e){S(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function R(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function L(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,R(t,e)}function C(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function P(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function O(t){for(var e=0,n=0,i=t.length;n<i;n++){var r=t[n];r.castShadow&&(It.shadows[e]=r,e++)}It.shadows.length=e}function I(t,e){var n,i,r,o,a,s,c,u,l=0,h=0,d=0,p=e.matrixWorldInverse,f=0,m=0,g=0,v=0,y=0;for(n=0,i=t.length;n<i;n++)if(r=t[n],a=r.color,s=r.intensity,c=r.distance,u=r.shadow&&r.shadow.map?r.shadow.map.texture:null,r.isAmbientLight)l+=a.r*s,h+=a.g*s,d+=a.b*s;else if(r.isDirectionalLight){var _=ie.get(r);_.color.copy(r.color).multiplyScalar(r.intensity),_.direction.setFromMatrixPosition(r.matrixWorld),At.setFromMatrixPosition(r.target.matrixWorld),_.direction.sub(At),_.direction.transformDirection(p),_.shadow=r.castShadow,r.castShadow&&(o=r.shadow,_.shadowBias=o.bias,_.shadowRadius=o.radius,_.shadowMapSize=o.mapSize),It.directionalShadowMap[f]=u,It.directionalShadowMatrix[f]=r.shadow.matrix,It.directional[f]=_,f++}else if(r.isSpotLight){var _=ie.get(r);_.position.setFromMatrixPosition(r.matrixWorld),_.position.applyMatrix4(p),_.color.copy(a).multiplyScalar(s),_.distance=c,_.direction.setFromMatrixPosition(r.matrixWorld),At.setFromMatrixPosition(r.target.matrixWorld),_.direction.sub(At),_.direction.transformDirection(p),_.coneCos=Math.cos(r.angle),_.penumbraCos=Math.cos(r.angle*(1-r.penumbra)),_.decay=0===r.distance?0:r.decay,_.shadow=r.castShadow,r.castShadow&&(o=r.shadow,_.shadowBias=o.bias,_.shadowRadius=o.radius,_.shadowMapSize=o.mapSize),It.spotShadowMap[g]=u,It.spotShadowMatrix[g]=r.shadow.matrix,It.spot[g]=_,g++}else if(r.isRectAreaLight){var _=ie.get(r);_.color.copy(a).multiplyScalar(s/(r.width*r.height)),_.position.setFromMatrixPosition(r.matrixWorld),_.position.applyMatrix4(p),Pt.identity(),Rt.copy(r.matrixWorld),Rt.premultiply(p),Pt.extractRotation(Rt),_.halfWidth.set(.5*r.width,0,0),_.halfHeight.set(0,.5*r.height,0),_.halfWidth.applyMatrix4(Pt),_.halfHeight.applyMatrix4(Pt),It.rectArea[v]=_,v++}else if(r.isPointLight){var _=ie.get(r);_.position.setFromMatrixPosition(r.matrixWorld),_.position.applyMatrix4(p),_.color.copy(r.color).multiplyScalar(r.intensity),_.distance=r.distance,_.decay=0===r.distance?0:r.decay,_.shadow=r.castShadow,r.castShadow&&(o=r.shadow,_.shadowBias=o.bias,_.shadowRadius=o.radius,_.shadowMapSize=o.mapSize),It.pointShadowMap[m]=u,It.pointShadowMatrix[m]=r.shadow.matrix,It.point[m]=_,m++}else if(r.isHemisphereLight){var _=ie.get(r);_.direction.setFromMatrixPosition(r.matrixWorld),_.direction.transformDirection(p),_.direction.normalize(),_.skyColor.copy(r.color).multiplyScalar(s),_.groundColor.copy(r.groundColor).multiplyScalar(s),It.hemi[y]=_,y++}It.ambient[0]=l,It.ambient[1]=h,It.ambient[2]=d,It.directional.length=f,It.spot.length=g,It.rectArea.length=v,It.point.length=m,It.hemi.length=y,It.hash=f+","+m+","+g+","+v+","+y+","+It.shadows.length}function N(){var t=dt;return t>=Zt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Zt.maxTextures),dt+=1,t}function U(t){var e;if(t===va)return Gt.REPEAT;if(t===ya)return Gt.CLAMP_TO_EDGE;if(t===_a)return Gt.MIRRORED_REPEAT;if(t===xa)return Gt.NEAREST;if(t===ba)return Gt.NEAREST_MIPMAP_NEAREST;if(t===wa)return Gt.NEAREST_MIPMAP_LINEAR;if(t===Ea)return Gt.LINEAR;if(t===Ma)return Gt.LINEAR_MIPMAP_NEAREST;if(t===Ta)return Gt.LINEAR_MIPMAP_LINEAR;if(t===Sa)return Gt.UNSIGNED_BYTE;if(t===Na)return Gt.UNSIGNED_SHORT_4_4_4_4;if(t===Ua)return Gt.UNSIGNED_SHORT_5_5_5_1;if(t===Da)return Gt.UNSIGNED_SHORT_5_6_5;if(t===Aa)return Gt.BYTE;if(t===Ra)return Gt.SHORT;if(t===La)return Gt.UNSIGNED_SHORT;if(t===Ca)return Gt.INT;if(t===Pa)return Gt.UNSIGNED_INT;if(t===Oa)return Gt.FLOAT;if(t===Ia&&null!==(e=qt.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Ba)return Gt.ALPHA;if(t===za)return Gt.RGB;if(t===Ga)return Gt.RGBA;if(t===ka)return Gt.LUMINANCE;if(t===Ha)return Gt.LUMINANCE_ALPHA;if(t===ja)return Gt.DEPTH_COMPONENT;if(t===Wa)return Gt.DEPTH_STENCIL;if(t===Po)return Gt.FUNC_ADD;if(t===Oo)return Gt.FUNC_SUBTRACT;if(t===Io)return Gt.FUNC_REVERSE_SUBTRACT;if(t===Do)return Gt.ZERO;if(t===Fo)return Gt.ONE;if(t===Bo)return Gt.SRC_COLOR;if(t===zo)return Gt.ONE_MINUS_SRC_COLOR;if(t===Go)return Gt.SRC_ALPHA;if(t===ko)return Gt.ONE_MINUS_SRC_ALPHA;if(t===Ho)return Gt.DST_ALPHA;if(t===Vo)return Gt.ONE_MINUS_DST_ALPHA;if(t===jo)return Gt.DST_COLOR;if(t===Wo)return Gt.ONE_MINUS_DST_COLOR;if(t===Xo)return Gt.SRC_ALPHA_SATURATE;if((t===Xa||t===Ya||t===qa||t===Za)&&null!==(e=qt.get("WEBGL_compressed_texture_s3tc"))){if(t===Xa)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===Ya)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===qa)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Za)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===Ja||t===Ka||t===Qa||t===$a)&&null!==(e=qt.get("WEBGL_compressed_texture_pvrtc"))){if(t===Ja)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Ka)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Qa)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===$a)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ts&&null!==(e=qt.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===No||t===Uo)&&null!==(e=qt.get("EXT_blend_minmax"))){if(t===No)return e.MIN_EXT;if(t===Uo)return e.MAX_EXT}return t===Fa&&null!==(e=qt.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",oo),t=t||{};var D=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),F=void 0!==t.context?t.context:null,B=void 0!==t.alpha&&t.alpha,z=void 0===t.depth||t.depth,G=void 0===t.stencil||t.stencil,k=void 0!==t.antialias&&t.antialias,H=void 0===t.premultipliedAlpha||t.premultipliedAlpha,V=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,j=[],W=null,X=new Float32Array(8),Z=[],Q=[];this.domElement=D,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=oa,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var tt=this,et=null,nt=null,it=null,rt=-1,st="",ct=null,ut=new a,lt=null,ht=new a,dt=0,pt=new q(0),mt=0,gt=D.width,vt=D.height,yt=1,_t=new a(0,0,gt,vt),xt=!1,bt=new a(0,0,gt,vt),wt=new ot,Et=new fe,Mt=!1,Tt=!1,St=new h,At=new l,Rt=new h,Pt=new h,It={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ut={geometries:0,textures:0},zt={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:zt,memory:Ut,programs:null};var Gt;try{var kt={alpha:B,depth:z,stencil:G,antialias:k,premultipliedAlpha:H,preserveDrawingBuffer:V};if(null===(Gt=F||D.getContext("webgl",kt)||D.getContext("experimental-webgl",kt)))throw null!==D.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===Gt.getShaderPrecisionFormat&&(Gt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),D.addEventListener("webglcontextlost",r,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var qt=new pe(Gt);qt.get("WEBGL_depth_texture"),qt.get("OES_texture_float"),qt.get("OES_texture_float_linear"),qt.get("OES_texture_half_float"),qt.get("OES_texture_half_float_linear"),qt.get("OES_standard_derivatives"),qt.get("ANGLE_instanced_arrays"),qt.get("OES_element_index_uint")&&(Lt.MaxIndex=4294967296);var Zt=new de(Gt,qt,t),Jt=new he(Gt,qt,U),Kt=new le,Qt=new ue(Gt,qt,Jt,Kt,Zt,U,Ut),$t=new Bt(Gt),te=new Wt(Gt,$t,Ut),ee=new Yt(Gt,te,zt),ne=new ce(this,Zt),ie=new Xt,re=new Ht;this.info.programs=ne.programs;var oe,ae,se,me,ge=new jt(Gt,qt,zt),ve=new Vt(Gt,qt,zt);n(),this.context=Gt,this.capabilities=Zt,this.extensions=qt,this.properties=Kt,this.state=Jt;var ye=new at(this,It,ee,Zt);this.shadowMap=ye;var _e=new K(this,Z),xe=new J(this,Q);this.getContext=function(){return Gt},this.getContextAttributes=function(){return Gt.getContextAttributes()},this.forceContextLoss=function(){var t=qt.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return Zt.getMaxAnisotropy()},this.getPrecision=function(){return Zt.precision},this.getPixelRatio=function(){return yt},this.setPixelRatio=function(t){void 0!==t&&(yt=t,this.setSize(bt.z,bt.w,!1))},this.getSize=function(){return{width:gt,height:vt}},this.setSize=function(t,e,n){gt=t,vt=e,D.width=t*yt,D.height=e*yt,!1!==n&&(D.style.width=t+"px",D.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,i){Jt.viewport(bt.set(t,e,n,i))},this.setScissor=function(t,e,n,i){Jt.scissor(_t.set(t,e,n,i))},this.setScissorTest=function(t){Jt.setScissorTest(xt=t)},this.getClearColor=function(){return pt},this.setClearColor=function(t,e){pt.set(t),mt=void 0!==e?e:1,Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H)},this.getClearAlpha=function(){return mt},this.setClearAlpha=function(t){mt=t,Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H)},this.clear=function(t,e,n){var i=0;(void 0===t||t)&&(i|=Gt.COLOR_BUFFER_BIT),(void 0===e||e)&&(i|=Gt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(i|=Gt.STENCIL_BUFFER_BIT),Gt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,i){this.setRenderTarget(t),this.clear(e,n,i)},this.resetGLState=i,this.dispose=function(){D.removeEventListener("webglcontextlost",r,!1),re.dispose()},this.renderBufferImmediate=function(t,e,n){Jt.initAttributes();var i=Kt.get(t);t.hasPositions&&!i.position&&(i.position=Gt.createBuffer()),t.hasNormals&&!i.normal&&(i.normal=Gt.createBuffer()),t.hasUvs&&!i.uv&&(i.uv=Gt.createBuffer()),t.hasColors&&!i.color&&(i.color=Gt.createBuffer());var r=e.getAttributes();if(t.hasPositions&&(Gt.bindBuffer(Gt.ARRAY_BUFFER,i.position),Gt.bufferData(Gt.ARRAY_BUFFER,t.positionArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(r.position),Gt.vertexAttribPointer(r.position,3,Gt.FLOAT,!1,0,0)),t.hasNormals){if(Gt.bindBuffer(Gt.ARRAY_BUFFER,i.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===xo)for(var o=0,a=3*t.count;o<a;o+=9){var s=t.normalArray,c=(s[o+0]+s[o+3]+s[o+6])/3,u=(s[o+1]+s[o+4]+s[o+7])/3,l=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=c,s[o+1]=u,s[o+2]=l,s[o+3]=c,s[o+4]=u,s[o+5]=l,s[o+6]=c,s[o+7]=u,s[o+8]=l}Gt.bufferData(Gt.ARRAY_BUFFER,t.normalArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(r.normal),Gt.vertexAttribPointer(r.normal,3,Gt.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(Gt.bindBuffer(Gt.ARRAY_BUFFER,i.uv),Gt.bufferData(Gt.ARRAY_BUFFER,t.uvArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(r.uv),Gt.vertexAttribPointer($t.uv,2,Gt.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==wo&&(Gt.bindBuffer(Gt.ARRAY_BUFFER,i.color),Gt.bufferData(Gt.ARRAY_BUFFER,t.colorArray,Gt.DYNAMIC_DRAW),Jt.enableAttribute(r.color),Gt.vertexAttribPointer(r.color,3,Gt.FLOAT,!1,0,0)),Jt.disableUnusedAttributes(),Gt.drawArrays(Gt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,i,r,o,a){Jt.setMaterial(r);var s=_(t,n,r,o),c=i.id+"_"+s.id+"_"+(!0===r.wireframe),u=!1;c!==st&&(st=c,u=!0);var l=o.morphTargetInfluences;if(void 0!==l){for(var h=[],d=0,m=l.length;d<m;d++){var g=l[d];h.push([g,d])}h.sort(p),h.length>8&&(h.length=8);for(var v=i.morphAttributes,d=0,m=h.length;d<m;d++){var g=h[d];if(X[d]=g[0],0!==g[0]){var y=g[1];!0===r.morphTargets&&v.position&&i.addAttribute("morphTarget"+d,v.position[y]),!0===r.morphNormals&&v.normal&&i.addAttribute("morphNormal"+d,v.normal[y])}else!0===r.morphTargets&&i.removeAttribute("morphTarget"+d),!0===r.morphNormals&&i.removeAttribute("morphNormal"+d)}for(var d=h.length,x=X.length;d<x;d++)X[d]=0;s.getUniforms().setValue(Gt,"morphTargetInfluences",X),u=!0}var y=i.index,b=i.attributes.position,w=1;!0===r.wireframe&&(y=te.getWireframeAttribute(i),w=2);var E=ge;null!==y&&(E=ve,E.setIndex(y)),u&&(f(r,s,i),null!==y&&Gt.bindBuffer(Gt.ELEMENT_ARRAY_BUFFER,$t.get(y).buffer));var M=0;null!==y?M=y.count:void 0!==b&&(M=b.count);var T=i.drawRange.start*w,S=i.drawRange.count*w,A=null!==a?a.start*w:0,R=null!==a?a.count*w:1/0,L=Math.max(T,A),C=Math.min(M,T+S,A+R)-1,P=Math.max(0,C-L+1);if(0!==P){if(o.isMesh)if(!0===r.wireframe)Jt.setLineWidth(r.wireframeLinewidth*e()),E.setMode(Gt.LINES);else switch(o.drawMode){case ls:E.setMode(Gt.TRIANGLES);break;case hs:E.setMode(Gt.TRIANGLE_STRIP);break;case ds:E.setMode(Gt.TRIANGLE_FAN)}else if(o.isLine){var O=r.linewidth;void 0===O&&(O=1),Jt.setLineWidth(O*e()),o.isLineSegments?E.setMode(Gt.LINES):o.isLineLoop?E.setMode(Gt.LINE_LOOP):E.setMode(Gt.LINE_STRIP)}else o.isPoints&&E.setMode(Gt.POINTS);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&E.renderInstances(i,L,P):E.render(L,P)}},this.compile=function(t,e){j=[],t.traverse(function(t){t.isLight&&j.push(t)}),I(j,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n<e.material.length;n++)y(e.material[n],t.fog,e);else y(e.material,t.fog,e)})},this.render=function(t,e,n,i){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");st="",rt=-1,ct=null,!0===t.autoUpdate&&t.updateMatrixWorld(),e.onBeforeRender(tt),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),St.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),wt.setFromMatrix(St),j.length=0,Z.length=0,Q.length=0,Tt=this.localClippingEnabled,Mt=Et.init(this.clippingPlanes,Tt,e),W=re.get(t,e),W.init(),m(t,e,tt.sortObjects),W.finish(),!0===tt.sortObjects&&W.sort(),Mt&&Et.beginShadows(),O(j),ye.render(t,e),I(j,e),Mt&&Et.endShadows(),zt.frame++,zt.calls=0,zt.vertices=0,zt.faces=0,zt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var r=t.background;null===r?Jt.buffers.color.setClear(pt.r,pt.g,pt.b,mt,H):r&&r.isColor&&(Jt.buffers.color.setClear(r.r,r.g,r.b,1,H),i=!0),(this.autoClear||i)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),r&&r.isCubeTexture?(void 0===se&&(se=new Dt,me=new Ct(new Ot(5,5,5),new $({uniforms:Ds.cube.uniforms,vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:yo,depthTest:!1,depthWrite:!1,fog:!1}))),se.projectionMatrix.copy(e.projectionMatrix),se.matrixWorld.extractRotation(e.matrixWorld),se.matrixWorldInverse.getInverse(se.matrixWorld),me.material.uniforms.tCube.value=r,me.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,me.matrixWorld),ee.update(me),tt.renderBufferDirect(se,null,me.geometry,me.material,me,null)):r&&r.isTexture&&(void 0===oe&&(oe=new Ft(-1,1,1,-1,0,1),ae=new Ct(new Nt(2,2),new ft({depthTest:!1,depthWrite:!1,fog:!1}))),ae.material.map=r,ee.update(ae),tt.renderBufferDirect(oe,null,ae.geometry,ae.material,ae,null));var o=W.opaque,a=W.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;o.length&&g(o,t,e,s),a.length&&g(a,t,e,s)}else o.length&&g(o,t,e),a.length&&g(a,t,e);_e.render(t,e),xe.render(t,e,ht),n&&Qt.updateRenderTargetMipmap(n),Jt.buffers.depth.setTest(!0),Jt.buffers.depth.setMask(!0),Jt.buffers.color.setMask(!0),e.isArrayCamera&&e.enabled&&tt.setScissorTest(!1),e.onAfterRender(tt)},this.setFaceCulling=function(t,e){Jt.setCullFace(t),Jt.setFlipSided(e===ho)},this.allocTextureUnit=N,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Qt.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Qt.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Qt.setTextureCube(e,n):Qt.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return nt},this.setRenderTarget=function(t){nt=t,t&&void 0===Kt.get(t).__webglFramebuffer&&Qt.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var i=Kt.get(t);e=n?i.__webglFramebuffer[t.activeCubeFace]:i.__webglFramebuffer,ut.copy(t.scissor),lt=t.scissorTest,ht.copy(t.viewport)}else e=null,ut.copy(_t).multiplyScalar(yt),lt=xt,ht.copy(bt).multiplyScalar(yt);if(it!==e&&(Gt.bindFramebuffer(Gt.FRAMEBUFFER,e),it=e),Jt.scissor(ut),Jt.setScissorTest(lt),Jt.viewport(ht),n){var r=Kt.get(t.texture);Gt.framebufferTexture2D(Gt.FRAMEBUFFER,Gt.COLOR_ATTACHMENT0,Gt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,r.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,i,r,o){if(!1===(t&&t.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=Kt.get(t).__webglFramebuffer;if(a){var s=!1;a!==it&&(Gt.bindFramebuffer(Gt.FRAMEBUFFER,a),s=!0);try{var c=t.texture,u=c.format,l=c.type;if(u!==Ga&&U(u)!==Gt.getParameter(Gt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===Sa||U(l)===Gt.getParameter(Gt.IMPLEMENTATION_COLOR_READ_TYPE)||l===Oa&&(qt.get("OES_texture_float")||qt.get("WEBGL_color_buffer_float"))||l===Ia&&qt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");Gt.checkFramebufferStatus(Gt.FRAMEBUFFER)===Gt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Gt.readPixels(e,n,i,r,U(u),U(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&Gt.bindFramebuffer(Gt.FRAMEBUFFER,it)}}}}function ge(t,e){this.name="",this.color=new q(t),this.density=void 0!==e?e:25e-5}function ve(t,e,n){this.name="",this.color=new q(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function ye(){lt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function _e(t,e,n,i,r){lt.call(this),this.lensFlares=[],this.positionScreen=new l,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,i,r)}function xe(t){Q.call(this),this.type="SpriteMaterial",this.color=new q(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function be(t){lt.call(this),this.type="Sprite",this.material=void 0!==t?t:new xe}function we(){lt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Ee(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new h)}}function Me(){lt.call(this),this.type="Bone"}function Te(t,e){Ct.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new h,this.bindMatrixInverse=new h;var n=this.initBones(),i=new Ee(n);this.bind(i,this.matrixWorld),this.normalizeSkinWeights()}function Se(t){Q.call(this),this.type="LineBasicMaterial",this.color=new q(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function Ae(t,e,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Re(t,e);lt.call(this),this.type="Line",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new Se({color:16777215*Math.random()})}function Re(t,e){Ae.call(this,t,e),this.type="LineSegments"}function Le(t,e){Ae.call(this,t,e),this.type="LineLoop"}function Ce(t){Q.call(this),this.type="PointsMaterial",this.color=new q(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Pe(t,e){lt.call(this),this.type="Points",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new Ce({color:16777215*Math.random()})}function Oe(){lt.call(this),this.type="Group"}function Ie(t,e,n,i,r,a,s,c,u){function l(){requestAnimationFrame(l),t.readyState>=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}o.call(this,t,e,n,i,r,a,s,c,u),this.generateMipmaps=!1;var h=this;l()}function Ne(t,e,n,i,r,a,s,c,u,l,h,d){o.call(this,null,a,s,c,u,l,i,r,h,d),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Ue(t,e,n,i,r,a,s,c,u){o.call(this,t,e,n,i,r,a,s,c,u),this.needsUpdate=!0}function De(t,e,n,i,r,a,s,c,u,l){if((l=void 0!==l?l:ja)!==ja&&l!==Wa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===ja&&(n=La),void 0===n&&l===Wa&&(n=Fa),o.call(this,null,i,r,a,s,c,l,n,u),this.image={width:t,height:e},this.magFilter=void 0!==s?s:xa,this.minFilter=void 0!==c?c:xa,this.flipY=!1,this.generateMipmaps=!1}function Fe(t){Lt.call(this),this.type="WireframeGeometry";var e,n,i,r,o,a,s,c,u,h,d=[],p=[0,0],f={},m=["a","b","c"];if(t&&t.isGeometry){var g=t.faces;for(e=0,i=g.length;e<i;e++){var v=g[e];for(n=0;n<3;n++)s=v[m[n]],c=v[m[(n+1)%3]],p[0]=Math.min(s,c),p[1]=Math.max(s,c),u=p[0]+","+p[1],void 0===f[u]&&(f[u]={index1:p[0],index2:p[1]})}for(u in f)a=f[u],h=t.vertices[a.index1],d.push(h.x,h.y,h.z),h=t.vertices[a.index2],d.push(h.x,h.y,h.z)}else if(t&&t.isBufferGeometry){var y,_,x,b,w,E,M,T;if(h=new l,null!==t.index){for(y=t.attributes.position,_=t.index,x=t.groups,0===x.length&&(x=[{start:0,count:_.count,materialIndex:0}]),r=0,o=x.length;r<o;++r)for(b=x[r],w=b.start,E=b.count,e=w,i=w+E;e<i;e+=3)for(n=0;n<3;n++)s=_.getX(e+n),c=_.getX(e+(n+1)%3),p[0]=Math.min(s,c),p[1]=Math.max(s,c),u=p[0]+","+p[1],void 0===f[u]&&(f[u]={index1:p[0],index2:p[1]});for(u in f)a=f[u],h.fromBufferAttribute(y,a.index1),d.push(h.x,h.y,h.z),h.fromBufferAttribute(y,a.index2),d.push(h.x,h.y,h.z)}else for(y=t.attributes.position,e=0,i=y.count/3;e<i;e++)for(n=0;n<3;n++)M=3*e+n,h.fromBufferAttribute(y,M),d.push(h.x,h.y,h.z),T=3*e+(n+1)%3,h.fromBufferAttribute(y,T),d.push(h.x,h.y,h.z)}this.addAttribute("position",new Et(d,3))}function Be(t,e,n){Rt.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new ze(t,e,n)),this.mergeVertices()}function ze(t,e,n){Lt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var i,r,o=[],a=[],s=[],c=[],u=new l,h=new l,d=new l,p=new l,f=new l,m=e+1;for(i=0;i<=n;i++){var g=i/n;for(r=0;r<=e;r++){var v=r/e;h=t(v,g,h),a.push(h.x,h.y,h.z),v-1e-5>=0?(d=t(v-1e-5,g,d),p.subVectors(h,d)):(d=t(v+1e-5,g,d),p.subVectors(d,h)),g-1e-5>=0?(d=t(v,g-1e-5,d),f.subVectors(h,d)):(d=t(v,g+1e-5,d),f.subVectors(d,h)),u.crossVectors(p,f).normalize(),s.push(u.x,u.y,u.z),c.push(v,g)}}for(i=0;i<n;i++)for(r=0;r<e;r++){var y=i*m+r,_=i*m+r+1,x=(i+1)*m+r+1,b=(i+1)*m+r;o.push(y,_,b),o.push(_,x,b)}this.setIndex(o),this.addAttribute("position",new Et(a,3)),this.addAttribute("normal",new Et(s,3)),this.addAttribute("uv",new Et(c,2))}function Ge(t,e,n,i){Rt.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},this.fromBufferGeometry(new ke(t,e,n,i)),this.mergeVertices()}function ke(t,e,n,i){function o(t,e,n,i){var r,o,a=Math.pow(2,i),c=[];for(r=0;r<=a;r++){c[r]=[];var u=t.clone().lerp(n,r/a),l=e.clone().lerp(n,r/a),h=a-r;for(o=0;o<=h;o++)c[r][o]=0===o&&r===a?u:u.clone().lerp(l,o/h)}for(r=0;r<a;r++)for(o=0;o<2*(a-r)-1;o++){var d=Math.floor(o/2);o%2==0?(s(c[r][d+1]),s(c[r+1][d]),s(c[r][d])):(s(c[r][d+1]),s(c[r+1][d+1]),s(c[r+1][d]))}}function a(){for(var t=0;t<m.length;t+=6){var e=m[t+0],n=m[t+2],i=m[t+4],r=Math.max(e,n,i),o=Math.min(e,n,i);r>.9&&o<.1&&(e<.2&&(m[t+0]+=1),n<.2&&(m[t+2]+=1),i<.2&&(m[t+4]+=1))}}function s(t){f.push(t.x,t.y,t.z)}function c(e,n){var i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function u(){for(var t=new l,e=new l,n=new l,i=new l,o=new r,a=new r,s=new r,c=0,u=0;c<f.length;c+=9,u+=6){t.set(f[c+0],f[c+1],f[c+2]),e.set(f[c+3],f[c+4],f[c+5]),n.set(f[c+6],f[c+7],f[c+8]),o.set(m[u+0],m[u+1]),a.set(m[u+2],m[u+3]),s.set(m[u+4],m[u+5]),i.copy(t).add(e).add(n).divideScalar(3);var p=d(i);h(o,u+0,t,p),h(a,u+2,e,p),h(s,u+4,n,p)}}function h(t,e,n,i){i<0&&1===t.x&&(m[e]=t.x-1),0===n.x&&0===n.z&&(m[e]=i/2/Math.PI+.5)}function d(t){return Math.atan2(t.z,-t.x)}function p(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}Lt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i},n=n||1,i=i||0;var f=[],m=[];!function(t){for(var n=new l,i=new l,r=new l,a=0;a<e.length;a+=3)c(e[a+0],n),c(e[a+1],i),c(e[a+2],r),o(n,i,r,t)}(i),function(t){for(var e=new l,n=0;n<f.length;n+=3)e.x=f[n+0],e.y=f[n+1],e.z=f[n+2],e.normalize().multiplyScalar(t),f[n+0]=e.x,f[n+1]=e.y,f[n+2]=e.z}(n),function(){for(var t=new l,e=0;e<f.length;e+=3){t.x=f[e+0],t.y=f[e+1],t.z=f[e+2];var n=d(t)/2/Math.PI+.5,i=p(t)/Math.PI+.5;m.push(n,1-i)}u(),a()}(),this.addAttribute("position",new Et(f,3)),this.addAttribute("normal",new Et(f.slice(),3)),this.addAttribute("uv",new Et(m,2)),this.normalizeNormals()}function He(t,e){Rt.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ve(t,e)),this.mergeVertices()}function Ve(t,e){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];ke.call(this,n,i,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function je(t,e){Rt.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new We(t,e)),this.mergeVertices()}function We(t,e){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];ke.call(this,n,i,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xe(t,e){Rt.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ye(t,e)),this.mergeVertices()}function Ye(t,e){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[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];ke.call(this,i,r,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function qe(t,e){Rt.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ze(t,e)),this.mergeVertices()}function Ze(t,e){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[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];ke.call(this,r,o,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Je(t,e,n,i,r,o){Rt.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Ke(t,e,n,i,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Ke(t,e,n,i,o){function a(r){var o=t.getPointAt(r/e),a=u.normals[r],s=u.binormals[r];for(d=0;d<=i;d++){var c=d/i*Math.PI*2,l=Math.sin(c),h=-Math.cos(c);f.x=h*a.x+l*s.x,f.y=h*a.y+l*s.y,f.z=h*a.z+l*s.z,f.normalize(),v.push(f.x,f.y,f.z),p.x=o.x+n*f.x,p.y=o.y+n*f.y,p.z=o.z+n*f.z,g.push(p.x,p.y,p.z)}}function s(){for(d=1;d<=e;d++)for(h=1;h<=i;h++){var t=(i+1)*(d-1)+(h-1),n=(i+1)*d+(h-1),r=(i+1)*d+h,o=(i+1)*(d-1)+h;_.push(t,n,o),_.push(n,r,o)}}function c(){for(h=0;h<=e;h++)for(d=0;d<=i;d++)m.x=h/e,m.y=d/i,y.push(m.x,m.y)}Lt.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:o},e=e||64,n=n||1,i=i||8,o=o||!1;var u=t.computeFrenetFrames(e,o);this.tangents=u.tangents,this.normals=u.normals,this.binormals=u.binormals;var h,d,p=new l,f=new l,m=new r,g=[],v=[],y=[],_=[];!function(){for(h=0;h<e;h++)a(h);a(!1===o?e:0),c(),s()}(),this.setIndex(_),this.addAttribute("position",new Et(g,3)),this.addAttribute("normal",new Et(v,3)),this.addAttribute("uv",new Et(y,2))}function Qe(t,e,n,i,r,o,a){Rt.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new $e(t,e,n,i,r,o)),this.mergeVertices()}function $e(t,e,n,i,r,o){function a(t,e,n,i,r){var o=Math.cos(t),a=Math.sin(t),s=n/e*t,c=Math.cos(s);r.x=i*(2+c)*.5*o,r.y=i*(2+c)*a*.5,r.z=i*Math.sin(s)*.5}Lt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:o},t=t||100,e=e||40,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,o=o||3;var s,c,u=[],h=[],d=[],p=[],f=new l,m=new l,g=new l,v=new l,y=new l,_=new l,x=new l;for(s=0;s<=n;++s){var b=s/n*r*Math.PI*2;for(a(b,r,o,t,g),a(b+.01,r,o,t,v),_.subVectors(v,g),x.addVectors(v,g),y.crossVectors(_,x),x.crossVectors(y,_),y.normalize(),x.normalize(),c=0;c<=i;++c){var w=c/i*Math.PI*2,E=-e*Math.cos(w),M=e*Math.sin(w);f.x=g.x+(E*x.x+M*y.x),f.y=g.y+(E*x.y+M*y.y),f.z=g.z+(E*x.z+M*y.z),h.push(f.x,f.y,f.z),m.subVectors(f,g).normalize(),d.push(m.x,m.y,m.z),p.push(s/n),p.push(c/i)}}for(c=1;c<=n;c++)for(s=1;s<=i;s++){var T=(i+1)*(c-1)+(s-1),S=(i+1)*c+(s-1),A=(i+1)*c+s,R=(i+1)*(c-1)+s;u.push(T,S,R),u.push(S,A,R)}this.setIndex(u),this.addAttribute("position",new Et(h,3)),this.addAttribute("normal",new Et(d,3)),this.addAttribute("uv",new Et(p,2))}function tn(t,e,n,i,r){Rt.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new en(t,e,n,i,r)),this.mergeVertices()}function en(t,e,n,i,r){Lt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},t=t||100,e=e||40,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||2*Math.PI;var o,a,s=[],c=[],u=[],h=[],d=new l,p=new l,f=new l;for(o=0;o<=n;o++)for(a=0;a<=i;a++){var m=a/i*r,g=o/n*Math.PI*2;p.x=(t+e*Math.cos(g))*Math.cos(m),p.y=(t+e*Math.cos(g))*Math.sin(m),p.z=e*Math.sin(g),c.push(p.x,p.y,p.z),d.x=t*Math.cos(m),d.y=t*Math.sin(m),f.subVectors(p,d).normalize(),u.push(f.x,f.y,f.z),h.push(a/i),h.push(o/n)}for(o=1;o<=n;o++)for(a=1;a<=i;a++){var v=(i+1)*o+a-1,y=(i+1)*(o-1)+a-1,_=(i+1)*(o-1)+a,x=(i+1)*o+a;s.push(v,y,x),s.push(y,_,x)}this.setIndex(s),this.addAttribute("position",new Et(c,3)),this.addAttribute("normal",new Et(u,3)),this.addAttribute("uv",new Et(h,2))}function nn(t,e){Rt.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new rn(t,e)),this.mergeVertices()}function rn(t,e){if(void 0===t)return void(t=[]);Lt.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals()}function on(t,e){Rt.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new an(t,e)),this.mergeVertices()}function an(t,e){e=e||{};var n=e.font;if(!1===(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Rt;var i=n.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),rn.call(this,i,e),this.type="TextBufferGeometry"}function sn(t,e,n,i,r,o,a){Rt.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new cn(t,e,n,i,r,o,a)),this.mergeVertices()}function cn(t,e,n,i,r,o,a){Lt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;var s,c,u=o+a,h=0,d=[],p=new l,f=new l,m=[],g=[],v=[],y=[];for(c=0;c<=n;c++){var _=[],x=c/n;for(s=0;s<=e;s++){var b=s/e;p.x=-t*Math.cos(i+b*r)*Math.sin(o+x*a),p.y=t*Math.cos(o+x*a),p.z=t*Math.sin(i+b*r)*Math.sin(o+x*a),g.push(p.x,p.y,p.z),f.set(p.x,p.y,p.z).normalize(),v.push(f.x,f.y,f.z),y.push(b,1-x),_.push(h++)}d.push(_)}for(c=0;c<n;c++)for(s=0;s<e;s++){var w=d[c][s+1],E=d[c][s],M=d[c+1][s],T=d[c+1][s+1];(0!==c||o>0)&&m.push(w,E,T),(c!==n-1||u<Math.PI)&&m.push(E,M,T)}this.setIndex(m),this.addAttribute("position",new Et(g,3)),this.addAttribute("normal",new Et(v,3)),this.addAttribute("uv",new Et(y,2))}function un(t,e,n,i,r,o){Rt.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:o},this.fromBufferGeometry(new ln(t,e,n,i,r,o)),this.mergeVertices()}function ln(t,e,n,i,o,a){Lt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:o,thetaLength:a},t=t||20,e=e||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8,i=void 0!==i?Math.max(1,i):1;var s,c,u,h=[],d=[],p=[],f=[],m=t,g=(e-t)/i,v=new l,y=new r;for(c=0;c<=i;c++){for(u=0;u<=n;u++)s=o+u/n*a,v.x=m*Math.cos(s),v.y=m*Math.sin(s),d.push(v.x,v.y,v.z),p.push(0,0,1),y.x=(v.x/e+1)/2,y.y=(v.y/e+1)/2,f.push(y.x,y.y);m+=g}for(c=0;c<i;c++){var _=c*(n+1);for(u=0;u<n;u++){s=u+_;var x=s,b=s+n+1,w=s+n+2,E=s+1;h.push(x,b,E),h.push(b,w,E)}}this.setIndex(h),this.addAttribute("position",new Et(d,3)),this.addAttribute("normal",new Et(p,3)),this.addAttribute("uv",new Et(f,2))}function hn(t,e,n,i){Rt.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},this.fromBufferGeometry(new dn(t,e,n,i)),this.mergeVertices()}function dn(t,e,n,i){Lt.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e)||12,n=n||0,i=i||2*Math.PI,i=Es.clamp(i,0,2*Math.PI);var o,a,s,c=[],u=[],h=[],d=1/e,p=new l,f=new r;for(a=0;a<=e;a++){var m=n+a*d*i,g=Math.sin(m),v=Math.cos(m);for(s=0;s<=t.length-1;s++)p.x=t[s].x*g,p.y=t[s].y,p.z=t[s].x*v,u.push(p.x,p.y,p.z),f.x=a/e,f.y=s/(t.length-1),h.push(f.x,f.y)}for(a=0;a<e;a++)for(s=0;s<t.length-1;s++){o=s+a*t.length;var y=o,_=o+t.length,x=o+t.length+1,b=o+1;c.push(y,_,b),c.push(_,x,b)}if(this.setIndex(c),this.addAttribute("position",new Et(u,3)),this.addAttribute("uv",new Et(h,2)),this.computeVertexNormals(),i===2*Math.PI){var w=this.attributes.normal.array,E=new l,M=new l,T=new l;for(o=e*t.length*3,a=0,s=0;a<t.length;a++,s+=3)E.x=w[s+0],E.y=w[s+1],E.z=w[s+2],M.x=w[o+s+0],M.y=w[o+s+1],M.z=w[o+s+2],T.addVectors(E,M).normalize(),w[s+0]=w[o+s+0]=T.x,w[s+1]=w[o+s+1]=T.y,w[s+2]=w[o+s+2]=T.z}}function pn(t,e){Rt.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new fn(t,e)),this.mergeVertices()}function fn(t,e){function n(t){var n,s,u,l=r.length/3,h=t.extractPoints(e),d=h.shape,p=h.holes;if(!1===ks.isClockWise(d))for(d=d.reverse(),n=0,s=p.length;n<s;n++)u=p[n],!0===ks.isClockWise(u)&&(p[n]=u.reverse());var f=ks.triangulateShape(d,p);for(n=0,s=p.length;n<s;n++)u=p[n],d=d.concat(u);for(n=0,s=d.length;n<s;n++){var m=d[n];r.push(m.x,m.y,0),o.push(0,0,1),a.push(m.x,m.y)}for(n=0,s=f.length;n<s;n++){var g=f[n],v=g[0]+l,y=g[1]+l,_=g[2]+l;i.push(v,y,_),c+=3}}Lt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var i=[],r=[],o=[],a=[],s=0,c=0;if(!1===Array.isArray(t))n(t);else for(var u=0;u<t.length;u++)n(t[u]),this.addGroup(s,c,u),s+=c,c=0;this.setIndex(i),this.addAttribute("position",new Et(r,3)),this.addAttribute("normal",new Et(o,3)),this.addAttribute("uv",new Et(a,2))}function mn(t,e){Lt.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var n,i,r,o,a=[],s=Math.cos(Es.DEG2RAD*e),c=[0,0],u={},l=["a","b","c"];t.isBufferGeometry?(o=new Rt,o.fromBufferGeometry(t)):o=t.clone(),o.mergeVertices(),o.computeFaceNormals();for(var h=o.vertices,d=o.faces,p=0,f=d.length;p<f;p++)for(var m=d[p],g=0;g<3;g++)n=m[l[g]],i=m[l[(g+1)%3]],c[0]=Math.min(n,i),c[1]=Math.max(n,i),r=c[0]+","+c[1],void 0===u[r]?u[r]={index1:c[0],index2:c[1],face1:p,face2:void 0}:u[r].face2=p;for(r in u){var v=u[r];if(void 0===v.face2||d[v.face1].normal.dot(d[v.face2].normal)<=s){var y=h[v.index1];a.push(y.x,y.y,y.z),y=h[v.index2],a.push(y.x,y.y,y.z)}}this.addAttribute("position",new Et(a,3))}function gn(t,e,n,i,r,o,a,s){Rt.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new vn(t,e,n,i,r,o,a,s)),this.mergeVertices()}function vn(t,e,n,i,o,a,s,c){function u(n){var o,a,u,v=new r,x=new l,b=0,w=!0===n?t:e,E=!0===n?1:-1;for(a=g,o=1;o<=i;o++)p.push(0,y*E,0),f.push(0,E,0),m.push(.5,.5),g++;for(u=g,o=0;o<=i;o++){var M=o/i,T=M*c+s,S=Math.cos(T),A=Math.sin(T);x.x=w*A,x.y=y*E,x.z=w*S,p.push(x.x,x.y,x.z),f.push(0,E,0),v.x=.5*S+.5,v.y=.5*A*E+.5,m.push(v.x,v.y),g++}for(o=0;o<i;o++){var R=a+o,L=u+o;!0===n?d.push(L,L+1,R):d.push(L+1,L,R),b+=3}h.addGroup(_,b,!0===n?1:2),_+=b}Lt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:c};var h=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,i=Math.floor(i)||8,o=Math.floor(o)||1,a=void 0!==a&&a,s=void 0!==s?s:0,c=void 0!==c?c:2*Math.PI;var d=[],p=[],f=[],m=[],g=0,v=[],y=n/2,_=0;!function(){var r,a,u=new l,x=new l,b=0,w=(e-t)/n;for(a=0;a<=o;a++){var E=[],M=a/o,T=M*(e-t)+t;for(r=0;r<=i;r++){var S=r/i,A=S*c+s,R=Math.sin(A),L=Math.cos(A);x.x=T*R,x.y=-M*n+y,x.z=T*L,p.push(x.x,x.y,x.z),u.set(R,w,L).normalize(),f.push(u.x,u.y,u.z),m.push(S,1-M),E.push(g++)}v.push(E)}for(r=0;r<i;r++)for(a=0;a<o;a++){var C=v[a][r],P=v[a+1][r],O=v[a+1][r+1],I=v[a][r+1];d.push(C,P,I),d.push(P,O,I),b+=6}h.addGroup(_,b,0),_+=b}(),!1===a&&(t>0&&u(!0),e>0&&u(!1)),this.setIndex(d),this.addAttribute("position",new Et(p,3)),this.addAttribute("normal",new Et(f,3)),this.addAttribute("uv",new Et(m,2))}function yn(t,e,n,i,r,o,a){gn.call(this,0,t,e,n,i,r,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function _n(t,e,n,i,r,o,a){vn.call(this,0,t,e,n,i,r,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:o,thetaLength:a}}function xn(t,e,n,i){Rt.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new bn(t,e,n,i)),this.mergeVertices()}function bn(t,e,n,i){Lt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var o,a,s=[],c=[],u=[],h=[],d=new l,p=new r;for(c.push(0,0,0),u.push(0,0,1),h.push(.5,.5),a=0,o=3;a<=e;a++,o+=3){var f=n+a/e*i;d.x=t*Math.cos(f),d.y=t*Math.sin(f),c.push(d.x,d.y,d.z),u.push(0,0,1),p.x=(c[o]/t+1)/2,p.y=(c[o+1]/t+1)/2,h.push(p.x,p.y)}for(o=1;o<=e;o++)s.push(o,o+1,0);this.setIndex(s),this.addAttribute("position",new Et(c,3)),this.addAttribute("normal",new Et(u,3)),this.addAttribute("uv",new Et(h,2))}function wn(t){$.call(this,{uniforms:Ns.merge([Is.lights,{opacity:{value:1}}]),vertexShader:Us.shadow_vert,fragmentShader:Us.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function En(t){$.call(this,t),this.type="RawShaderMaterial"}function Mn(t){Q.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new q(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Tn(t){Mn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Sn(t){Q.call(this),this.type="MeshPhongMaterial",this.color=new q(16777215),this.specular=new q(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ea,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function An(t){Sn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Rn(t){Q.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ln(t){Q.call(this),this.type="MeshLambertMaterial",this.color=new q(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new q(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ea,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Cn(t){Q.call(this),this.type="LineDashedMaterial",this.color=new q(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Pn(t,e,n){var i=this,r=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===r&&void 0!==i.onStart&&i.onStart(t,o,a),r=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)}}function On(t){this.manager=void 0!==t?t:Ws}function In(t){this.manager=void 0!==t?t:Ws,this._parser=null}function Nn(t){this.manager=void 0!==t?t:Ws,this._parser=null}function Un(t){this.manager=void 0!==t?t:Ws}function Dn(t){this.manager=void 0!==t?t:Ws}function Fn(t){this.manager=void 0!==t?t:Ws}function Bn(t,e){lt.call(this),this.type="Light",this.color=new q(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function zn(t,e,n){Bn.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(lt.DefaultUp),this.updateMatrix(),this.groundColor=new q(e)}function Gn(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new r(512,512),this.map=null,this.matrix=new h}function kn(){Gn.call(this,new Dt(50,1,.5,500))}function Hn(t,e,n,i,r,o){Bn.call(this,t,e),this.type="SpotLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==i?i:Math.PI/3,this.penumbra=void 0!==r?r:0,this.decay=void 0!==o?o:1,this.shadow=new kn}function Vn(t,e,n,i){Bn.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==i?i:1,this.shadow=new Gn(new Dt(90,1,.5,500))}function jn(){Gn.call(this,new Ft(-5,5,5,-5,.5,500))}function Wn(t,e){Bn.call(this,t,e),this.type="DirectionalLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,this.shadow=new jn}function Xn(t,e){Bn.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function Yn(t,e,n,i){Bn.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==i?i:10}function qn(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Zn(t,e,n,i){qn.call(this,t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Jn(t,e,n,i){qn.call(this,t,e,n,i)}function Kn(t,e,n,i){qn.call(this,t,e,n,i)}function Qn(t,e,n,i){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Xs.convertArray(e,this.TimeBufferType),this.values=Xs.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation),this.validate(),this.optimize()}function $n(t,e,n,i){Qn.call(this,t,e,n,i)}function ti(t,e,n,i){qn.call(this,t,e,n,i)}function ei(t,e,n,i){Qn.call(this,t,e,n,i)}function ni(t,e,n,i){Qn.call(this,t,e,n,i)}function ii(t,e,n,i){Qn.call(this,t,e,n,i)}function ri(t,e,n){Qn.call(this,t,e,n)}function oi(t,e,n,i){Qn.call(this,t,e,n,i)}function ai(t,e,n,i){Qn.apply(this,arguments)}function si(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=Es.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function ci(t){this.manager=void 0!==t?t:Ws,this.textures={}}function ui(t){this.manager=void 0!==t?t:Ws}function li(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function hi(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Ws,this.withCredentials=!1}function di(t){this.manager=void 0!==t?t:Ws,this.texturePath=""}function pi(t,e,n,i,r){var o=.5*(i-e),a=.5*(r-n),s=t*t;return(2*n-2*i+o+a)*(t*s)+(-3*n+3*i-2*o-a)*s+o*t+n}function fi(t,e){var n=1-t;return n*n*e}function mi(t,e){return 2*(1-t)*t*e}function gi(t,e){return t*t*e}function vi(t,e,n,i){return fi(t,e)+mi(t,n)+gi(t,i)}function yi(t,e){var n=1-t;return n*n*n*e}function _i(t,e){var n=1-t;return 3*n*n*t*e}function xi(t,e){return 3*(1-t)*t*t*e}function bi(t,e){return t*t*t*e}function wi(t,e,n,i,r){return yi(t,e)+_i(t,n)+xi(t,i)+bi(t,r)}function Ei(){this.arcLengthDivisions=200}function Mi(t,e){Ei.call(this),this.v1=t,this.v2=e}function Ti(){Ei.call(this),this.curves=[],this.autoClose=!1}function Si(t,e,n,i,r,o,a,s){Ei.call(this),this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function Ai(t){Ei.call(this),this.points=void 0===t?[]:t}function Ri(t,e,n,i){Ei.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=i}function Li(t,e,n){Ei.call(this),this.v0=t,this.v1=e,this.v2=n}function Ci(t){Ti.call(this),this.currentPoint=new r,t&&this.fromPoints(t)}function Pi(){Ci.apply(this,arguments),this.holes=[]}function Oi(){this.subPaths=[],this.currentPath=null}function Ii(t){this.data=t}function Ni(t){this.manager=void 0!==t?t:Ws}function Ui(t){this.manager=void 0!==t?t:Ws}function Di(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Dt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Dt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Fi(t,e,n){lt.call(this),this.type="CubeCamera";var i=new Dt(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new l(1,0,0)),this.add(i);var r=new Dt(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new l(-1,0,0)),this.add(r);var o=new Dt(90,1,t,e);o.up.set(0,0,1),o.lookAt(new l(0,1,0)),this.add(o);var a=new Dt(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new l(0,-1,0)),this.add(a);var s=new Dt(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new l(0,0,1)),this.add(s);var u=new Dt(90,1,t,e);u.up.set(0,-1,0),u.lookAt(new l(0,0,-1)),this.add(u);var h={format:za,magFilter:Ea,minFilter:Ea};this.renderTarget=new c(n,n,h),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,c=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,i,n),n.activeCubeFace=1,t.render(e,r,n),n.activeCubeFace=2,t.render(e,o,n),n.activeCubeFace=3,t.render(e,a,n),n.activeCubeFace=4,t.render(e,s,n),n.texture.generateMipmaps=c,n.activeCubeFace=5,t.render(e,u,n),t.setRenderTarget(null)}}function Bi(t){Dt.call(this),this.enabled=!1,this.cameras=t||[]}function zi(){lt.call(this),this.type="AudioListener",this.context=tc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function Gi(t){lt.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function ki(t){Gi.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Hi(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Vi(t,e,n){this.binding=t,this.valueSize=n;var i,r=Float64Array;switch(e){case"quaternion":i=this._slerp;break;case"string":case"bool":r=Array,i=this._select;break;default:i=this._lerp}this.buffer=new r(4*n),this._mixBufferRegion=i,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function ji(t,e,n){var i=n||Wi.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Wi(t,e,n){this.path=e,this.parsedPath=n||Wi.parseTrackName(e),this.node=Wi.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Xi(t){this.uuid=Es.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}function Yi(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var i=e.tracks,r=i.length,o=new Array(r),a={endingStart:ss,endingEnd:ss},s=0;s!==r;++s){var c=i[s].createInterpolant(null);o[s]=c,c.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ns,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function qi(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Zi(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Ji(){Lt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Ki(t,e,n,i){this.uuid=Es.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}function Qi(t,e){this.uuid=Es.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function $i(t,e,n){Qi.call(this,t,e),this.meshPerAttribute=n||1}function tr(t,e,n){mt.call(this,t,e),this.meshPerAttribute=n||1}function er(t,e,n,i){this.ray=new st(t,e),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function nr(t,e){return t.distance-e.distance}function ir(t,e,n,i){if(!1!==t.visible&&(t.raycast(e,n),!0===i))for(var r=t.children,o=0,a=r.length;o<a;o++)ir(r[o],e,n,!0)}function rr(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function or(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}function ar(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}function sr(t,e){Ct.call(this,t,e),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,i=n-1,r=n/1;this.createAnimation("__default",0,i,r),this.setAnimationWeight("__default",1)}function cr(t){lt.call(this),this.material=t,this.render=function(t){}}function ur(t,e,n,i){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==n?n:16711680,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count);var c=new Lt,u=new Et(2*a*3,3);c.addAttribute("position",u),Re.call(this,c,new Se({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function lr(t){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Lt,n=[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],i=0,r=1;i<32;i++,r++){var o=i/32*Math.PI*2,a=r/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(a),Math.sin(a),1)}e.addAttribute("position",new Et(n,3));var s=new Se({fog:!1});this.cone=new Re(e,s),this.add(this.cone),this.update()}function hr(t){this.bones=this.getBoneList(t);for(var e=new Lt,n=[],i=[],r=new q(0,0,1),o=new q(0,1,0),a=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),i.push(r.r,r.g,r.b),i.push(o.r,o.g,o.b))}e.addAttribute("position",new Et(n,3)),e.addAttribute("color",new Et(i,3));var c=new Se({vertexColors:Mo,depthTest:!1,depthWrite:!1,transparent:!0});Re.call(this,e,c),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function dr(t,e){this.light=t,this.light.updateMatrixWorld();var n=new cn(e,4,2),i=new ft({wireframe:!0,fog:!1});i.color.copy(this.light.color),Ct.call(this,n,i),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function pr(t){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var e=new Se({color:t.color}),n=new Lt;n.addAttribute("position",new mt(new Float32Array(15),3)),this.add(new Ae(n,e)),this.update()}function fr(t,e){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var n=new We(e);n.rotateY(.5*Math.PI);var i=new ft({vertexColors:Mo,wireframe:!0}),r=n.getAttribute("position"),o=new Float32Array(3*r.count);n.addAttribute("color",new mt(o,3)),this.add(new Ct(n,i)),this.update()}function mr(t,e,n,i){t=t||10,e=e||10,n=new q(void 0!==n?n:4473924),i=new q(void 0!==i?i:8947848);for(var r=e/2,o=t/e,a=t/2,s=[],c=[],u=0,l=0,h=-a;u<=e;u++,h+=o){s.push(-a,0,h,a,0,h),s.push(h,0,-a,h,0,a);var d=u===r?n:i;d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3,d.toArray(c,l),l+=3}var p=new Lt;p.addAttribute("position",new Et(s,3)),p.addAttribute("color",new Et(c,3));var f=new Se({vertexColors:Mo});Re.call(this,p,f)}function gr(t,e,n,i,r,o){t=t||10,e=e||16,n=n||8,i=i||64,r=new q(void 0!==r?r:4473924),o=new q(void 0!==o?o:8947848);var a,s,c,u,l,h,d,p=[],f=[];for(u=0;u<=e;u++)c=u/e*(2*Math.PI),a=Math.sin(c)*t,s=Math.cos(c)*t,p.push(0,0,0),p.push(a,0,s),d=1&u?r:o,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(u=0;u<=n;u++)for(d=1&u?r:o,h=t-t/n*u,l=0;l<i;l++)c=l/i*(2*Math.PI),a=Math.sin(c)*h,s=Math.cos(c)*h,p.push(a,0,s),f.push(d.r,d.g,d.b),c=(l+1)/i*(2*Math.PI),a=Math.sin(c)*h,s=Math.cos(c)*h,p.push(a,0,s),f.push(d.r,d.g,d.b);var m=new Lt;m.addAttribute("position",new Et(p,3)),m.addAttribute("color",new Et(f,3));var g=new Se({vertexColors:Mo});Re.call(this,m,g)}function vr(t,e,n,i){this.object=t,this.size=void 0!==e?e:1;var r=void 0!==n?n:16776960,o=void 0!==i?i:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var c=new Lt,u=new Et(2*a*3,3);c.addAttribute("position",u),Re.call(this,c,new Se({color:r,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function yr(t,e){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var n=new Lt;n.addAttribute("position",new Et([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var i=new Se({fog:!1});this.add(new Ae(n,i)),n=new Lt,n.addAttribute("position",new Et([0,0,0,0,0,1],3)),this.add(new Ae(n,i)),this.update()}function _r(t){function e(t,e,i){n(t,i),n(e,i)}function n(t,e){o.push(0,0,0),a.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(o.length/3-1)}var i=new Lt,r=new Se({color:16777215,vertexColors:Eo}),o=[],a=[],s={},c=new q(16755200),u=new q(16711680),l=new q(43775),h=new q(16777215),d=new q(3355443);e("n1","n2",c),e("n2","n4",c),e("n4","n3",c),e("n3","n1",c),e("f1","f2",c),e("f2","f4",c),e("f4","f3",c),e("f3","f1",c),e("n1","f1",c),e("n2","f2",c),e("n3","f3",c),e("n4","f4",c),e("p","n1",u),e("p","n2",u),e("p","n3",u),e("p","n4",u),e("u1","u2",l),e("u2","u3",l),e("u3","u1",l),e("c","t",h),e("p","c",d),e("cn1","cn2",d),e("cn3","cn4",d),e("cf1","cf2",d),e("cf3","cf4",d),i.addAttribute("position",new Et(o,3)),i.addAttribute("color",new Et(a,3)),Re.call(this,i,r),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function xr(t,e){this.object=t,void 0===e&&(e=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Lt;r.setIndex(new mt(n,1)),r.addAttribute("position",new mt(i,3)),Re.call(this,r,new Se({color:e})),this.matrixAutoUpdate=!1,this.update()}function br(t,e,n,i,r,o){lt.call(this),void 0===i&&(i=16776960),void 0===n&&(n=1),void 0===r&&(r=.2*n),void 0===o&&(o=.2*r),void 0===ec&&(ec=new Lt,ec.addAttribute("position",new Et([0,0,0,0,1,0],3)),nc=new vn(0,.5,1,5,1),nc.translate(0,-.5,0)),this.position.copy(e),this.line=new Ae(ec,new Se({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ct(nc,new ft({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,o)}function wr(t){t=t||1;var e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Lt;i.addAttribute("position",new Et(e,3)),i.addAttribute("color",new Et(n,3));var r=new Se({vertexColors:Mo});Re.call(this,i,r)}function Er(){function t(t,o,a,s){e=t,n=a,i=-3*t+3*o-2*a-s,r=2*t-2*o+a+s}var e=0,n=0,i=0,r=0;return{initCatmullRom:function(e,n,i,r,o){t(n,i,o*(i-e),o*(r-n))},initNonuniformCatmullRom:function(e,n,i,r,o,a,s){var c=(n-e)/o-(i-e)/(o+a)+(i-n)/a,u=(i-n)/a-(r-n)/(a+s)+(r-i)/s;c*=a,u*=a,t(n,i,c,u)},calc:function(t){var o=t*t;return e+n*t+i*o+r*(o*t)}}}function Mr(t){Ei.call(this),this.points=t||[],this.closed=!1}function Tr(t,e,n,i){Ei.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=i}function Sr(t,e,n){Ei.call(this),this.v0=t,this.v1=e,this.v2=n}function Ar(t,e){Ei.call(this),this.v1=t,this.v2=e}function Rr(t,e,n,i,r,o){Si.call(this,t,e,n,n,i,r,o)}function Lr(t,e,n,i,r,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new pt(t,e,n,r,o,a)}function Cr(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Pr(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Or(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Pe(t,e)}function Ir(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new be(t)}function Nr(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Pe(t,e)}function Ur(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Ce(t)}function Dr(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Ce(t)}function Fr(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Ce(t)}function Br(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new l(t,e,n)}function zr(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new mt(t,e).setDynamic(!0)}function Gr(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new gt(t,e)}function kr(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new vt(t,e)}function Hr(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new yt(t,e)}function Vr(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new _t(t,e)}function jr(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new xt(t,e)}function Wr(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new bt(t,e)}function Xr(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new wt(t,e)}function Yr(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Et(t,e)}function qr(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Mt(t,e)}function Zr(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Mr.call(this,t),this.type="catmullrom",this.closed=!0}function Jr(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Mr.call(this,t),this.type="catmullrom"}function Kr(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Mr.call(this,t),this.type="catmullrom"}function Qr(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new xr(t,e)}function $r(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Re(new mn(t.geometry),new Se({color:void 0!==e?e:16777215}))}function to(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Re(new Fe(t.geometry),new Se({color:void 0!==e?e:16777215}))}function eo(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new On(t)}function no(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Nn(t)}function io(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function ro(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"WebGLRenderTargetCube",function(){return c}),n.d(e,"WebGLRenderTarget",function(){return s}),n.d(e,"WebGLRenderer",function(){return me}),n.d(e,"ShaderLib",function(){return Ds}),n.d(e,"UniformsLib",function(){return Is}),n.d(e,"UniformsUtils",function(){return Ns}),n.d(e,"ShaderChunk",function(){return Us}),n.d(e,"FogExp2",function(){return ge}),n.d(e,"Fog",function(){return ve}),n.d(e,"Scene",function(){return ye}),n.d(e,"LensFlare",function(){return _e}),n.d(e,"Sprite",function(){return be}),n.d(e,"LOD",function(){return we}),n.d(e,"SkinnedMesh",function(){return Te}),n.d(e,"Skeleton",function(){return Ee}),n.d(e,"Bone",function(){return Me}),n.d(e,"Mesh",function(){return Ct}),n.d(e,"LineSegments",function(){return Re}),n.d(e,"LineLoop",function(){return Le}),n.d(e,"Line",function(){return Ae}),n.d(e,"Points",function(){return Pe}),n.d(e,"Group",function(){return Oe}),n.d(e,"VideoTexture",function(){return Ie}),n.d(e,"DataTexture",function(){return d}),n.d(e,"CompressedTexture",function(){return Ne}),n.d(e,"CubeTexture",function(){return p}),n.d(e,"CanvasTexture",function(){return Ue}),n.d(e,"DepthTexture",function(){return De}),n.d(e,"Texture",function(){return o}),n.d(e,"CompressedTextureLoader",function(){return In}),n.d(e,"DataTextureLoader",function(){return Nn}),n.d(e,"CubeTextureLoader",function(){return Dn}),n.d(e,"TextureLoader",function(){return Fn}),n.d(e,"ObjectLoader",function(){return di}),n.d(e,"MaterialLoader",function(){return ci}),n.d(e,"BufferGeometryLoader",function(){return ui}),n.d(e,"DefaultLoadingManager",function(){return Ws}),n.d(e,"LoadingManager",function(){return Pn}),n.d(e,"JSONLoader",function(){return hi}),n.d(e,"ImageLoader",function(){return Un}),n.d(e,"FontLoader",function(){return Ni}),n.d(e,"FileLoader",function(){return On}),n.d(e,"Loader",function(){return li}),n.d(e,"Cache",function(){return js}),n.d(e,"AudioLoader",function(){return Ui}),n.d(e,"SpotLightShadow",function(){return kn}),n.d(e,"SpotLight",function(){return Hn}),n.d(e,"PointLight",function(){return Vn}),n.d(e,"RectAreaLight",function(){return Yn}),n.d(e,"HemisphereLight",function(){return zn}),n.d(e,"DirectionalLightShadow",function(){return jn}),n.d(e,"DirectionalLight",function(){return Wn}),n.d(e,"AmbientLight",function(){return Xn}),n.d(e,"LightShadow",function(){return Gn}),n.d(e,"Light",function(){return Bn}),n.d(e,"StereoCamera",function(){return Di}),n.d(e,"PerspectiveCamera",function(){return Dt}),n.d(e,"OrthographicCamera",function(){return Ft}),n.d(e,"CubeCamera",function(){return Fi}),n.d(e,"ArrayCamera",function(){return Bi}),n.d(e,"Camera",function(){return Ut}),n.d(e,"AudioListener",function(){return zi}),n.d(e,"PositionalAudio",function(){return ki}),n.d(e,"AudioContext",function(){return tc}),n.d(e,"AudioAnalyser",function(){return Hi}),n.d(e,"Audio",function(){return Gi}),n.d(e,"VectorKeyframeTrack",function(){return $n}),n.d(e,"StringKeyframeTrack",function(){return ii}),n.d(e,"QuaternionKeyframeTrack",function(){return ei}),n.d(e,"NumberKeyframeTrack",function(){return ni}),n.d(e,"ColorKeyframeTrack",function(){return oi}),n.d(e,"BooleanKeyframeTrack",function(){return ri}),n.d(e,"PropertyMixer",function(){return Vi}),n.d(e,"PropertyBinding",function(){return Wi}),n.d(e,"KeyframeTrack",function(){return ai}),n.d(e,"AnimationUtils",function(){return Xs}),n.d(e,"AnimationObjectGroup",function(){return Xi}),n.d(e,"AnimationMixer",function(){return qi}),n.d(e,"AnimationClip",function(){return si}),n.d(e,"Uniform",function(){return Zi}),n.d(e,"InstancedBufferGeometry",function(){return Ji}),n.d(e,"BufferGeometry",function(){return Lt}),n.d(e,"GeometryIdCount",function(){return At}),n.d(e,"Geometry",function(){return Rt}),n.d(e,"InterleavedBufferAttribute",function(){return Ki}),n.d(e,"InstancedInterleavedBuffer",function(){return $i}),n.d(e,"InterleavedBuffer",function(){return Qi}),n.d(e,"InstancedBufferAttribute",function(){return tr}),n.d(e,"Face3",function(){return pt}),n.d(e,"Object3D",function(){return lt}),n.d(e,"Raycaster",function(){return er}),n.d(e,"Layers",function(){return ut}),n.d(e,"EventDispatcher",function(){return i}),n.d(e,"Clock",function(){return rr}),n.d(e,"QuaternionLinearInterpolant",function(){return ti}),n.d(e,"LinearInterpolant",function(){return Jn}),n.d(e,"DiscreteInterpolant",function(){return Kn}),n.d(e,"CubicInterpolant",function(){return Zn}),n.d(e,"Interpolant",function(){return qn}),n.d(e,"Triangle",function(){return dt}),n.d(e,"Math",function(){return Es}),n.d(e,"Spherical",function(){return or}),n.d(e,"Cylindrical",function(){return ar}),n.d(e,"Plane",function(){return rt}),n.d(e,"Frustum",function(){return ot}),n.d(e,"Sphere",function(){return nt}),n.d(e,"Ray",function(){return st}),n.d(e,"Matrix4",function(){return h}),n.d(e,"Matrix3",function(){return it}),n.d(e,"Box3",function(){return et}),n.d(e,"Box2",function(){return Z}),n.d(e,"Line3",function(){return ht}),n.d(e,"Euler",function(){return ct}),n.d(e,"Vector4",function(){return a}),n.d(e,"Vector3",function(){return l}),n.d(e,"Vector2",function(){return r}),n.d(e,"Quaternion",function(){return u}),n.d(e,"Color",function(){return q}),n.d(e,"MorphBlendMesh",function(){return sr}),n.d(e,"ImmediateRenderObject",function(){return cr}),n.d(e,"VertexNormalsHelper",function(){return ur}),n.d(e,"SpotLightHelper",function(){return lr}),n.d(e,"SkeletonHelper",function(){return hr}),n.d(e,"PointLightHelper",function(){return dr}),n.d(e,"RectAreaLightHelper",function(){return pr}),n.d(e,"HemisphereLightHelper",function(){return fr}),n.d(e,"GridHelper",function(){return mr}),n.d(e,"PolarGridHelper",function(){return gr}),n.d(e,"FaceNormalsHelper",function(){return vr}),n.d(e,"DirectionalLightHelper",function(){return yr}),n.d(e,"CameraHelper",function(){return _r}),n.d(e,"BoxHelper",function(){return xr}),n.d(e,"ArrowHelper",function(){return br}),n.d(e,"AxisHelper",function(){return wr}),n.d(e,"CatmullRomCurve3",function(){return Mr}),n.d(e,"CubicBezierCurve3",function(){return Tr}),n.d(e,"QuadraticBezierCurve3",function(){return Sr}),n.d(e,"LineCurve3",function(){return Ar}),n.d(e,"ArcCurve",function(){return Rr}),n.d(e,"EllipseCurve",function(){return Si}),n.d(e,"SplineCurve",function(){return Ai}),n.d(e,"CubicBezierCurve",function(){return Ri}),n.d(e,"QuadraticBezierCurve",function(){return Li}),n.d(e,"LineCurve",function(){return Mi}),n.d(e,"Shape",function(){return Pi}),n.d(e,"Path",function(){return Ci}),n.d(e,"ShapePath",function(){return Oi}),n.d(e,"Font",function(){return Ii}),n.d(e,"CurvePath",function(){return Ti}),n.d(e,"Curve",function(){return Ei}),n.d(e,"ShapeUtils",function(){return ks}),n.d(e,"SceneUtils",function(){return sc}),n.d(e,"WireframeGeometry",function(){return Fe}),n.d(e,"ParametricGeometry",function(){return Be}),n.d(e,"ParametricBufferGeometry",function(){return ze}),n.d(e,"TetrahedronGeometry",function(){return He}),n.d(e,"TetrahedronBufferGeometry",function(){return Ve}),n.d(e,"OctahedronGeometry",function(){return je}),n.d(e,"OctahedronBufferGeometry",function(){return We}),n.d(e,"IcosahedronGeometry",function(){return Xe}),n.d(e,"IcosahedronBufferGeometry",function(){return Ye}),n.d(e,"DodecahedronGeometry",function(){return qe}),n.d(e,"DodecahedronBufferGeometry",function(){return Ze}),n.d(e,"PolyhedronGeometry",function(){return Ge}),n.d(e,"PolyhedronBufferGeometry",function(){return ke}),n.d(e,"TubeGeometry",function(){return Je}),n.d(e,"TubeBufferGeometry",function(){return Ke}),n.d(e,"TorusKnotGeometry",function(){return Qe}),n.d(e,"TorusKnotBufferGeometry",function(){return $e}),n.d(e,"TorusGeometry",function(){return tn}),n.d(e,"TorusBufferGeometry",function(){return en}),n.d(e,"TextGeometry",function(){return on}),n.d(e,"TextBufferGeometry",function(){return an}),n.d(e,"SphereGeometry",function(){return sn}),n.d(e,"SphereBufferGeometry",function(){return cn}),n.d(e,"RingGeometry",function(){return un}),n.d(e,"RingBufferGeometry",function(){return ln}),n.d(e,"PlaneGeometry",function(){return It}),n.d(e,"PlaneBufferGeometry",function(){return Nt}),n.d(e,"LatheGeometry",function(){return hn}),n.d(e,"LatheBufferGeometry",function(){return dn}),n.d(e,"ShapeGeometry",function(){return pn}),n.d(e,"ShapeBufferGeometry",function(){return fn}),n.d(e,"ExtrudeGeometry",function(){return nn}),n.d(e,"ExtrudeBufferGeometry",function(){return rn}),n.d(e,"EdgesGeometry",function(){return mn}),n.d(e,"ConeGeometry",function(){return yn}),n.d(e,"ConeBufferGeometry",function(){return _n}),n.d(e,"CylinderGeometry",function(){return gn}),n.d(e,"CylinderBufferGeometry",function(){return vn}),n.d(e,"CircleGeometry",function(){return xn}),n.d(e,"CircleBufferGeometry",function(){return bn}),n.d(e,"BoxGeometry",function(){return Pt}),n.d(e,"BoxBufferGeometry",function(){return Ot}),n.d(e,"ShadowMaterial",function(){return wn}),n.d(e,"SpriteMaterial",function(){return xe}),n.d(e,"RawShaderMaterial",function(){return En}),n.d(e,"ShaderMaterial",function(){return $}),n.d(e,"PointsMaterial",function(){return Ce});n.d(e,"MeshPhysicalMaterial",function(){return Tn}),n.d(e,"MeshStandardMaterial",function(){return Mn}),n.d(e,"MeshPhongMaterial",function(){return Sn}),n.d(e,"MeshToonMaterial",function(){return An}),n.d(e,"MeshNormalMaterial",function(){return Rn}),n.d(e,"MeshLambertMaterial",function(){return Ln}),n.d(e,"MeshDepthMaterial",function(){return tt}),n.d(e,"MeshBasicMaterial",function(){return ft}),n.d(e,"LineDashedMaterial",function(){return Cn}),n.d(e,"LineBasicMaterial",function(){return Se}),n.d(e,"Material",function(){return Q}),n.d(e,"Float64BufferAttribute",function(){return Mt}),n.d(e,"Float32BufferAttribute",function(){return Et}),n.d(e,"Uint32BufferAttribute",function(){return wt}),n.d(e,"Int32BufferAttribute",function(){return bt}),n.d(e,"Uint16BufferAttribute",function(){return xt}),n.d(e,"Int16BufferAttribute",function(){return _t}),n.d(e,"Uint8ClampedBufferAttribute",function(){return yt}),n.d(e,"Uint8BufferAttribute",function(){return vt}),n.d(e,"Int8BufferAttribute",function(){return gt}),n.d(e,"BufferAttribute",function(){return mt}),n.d(e,"REVISION",function(){return oo}),n.d(e,"MOUSE",function(){return ao}),n.d(e,"CullFaceNone",function(){return so}),n.d(e,"CullFaceBack",function(){return co}),n.d(e,"CullFaceFront",function(){return uo}),n.d(e,"CullFaceFrontBack",function(){return lo}),n.d(e,"FrontFaceDirectionCW",function(){return ho}),n.d(e,"FrontFaceDirectionCCW",function(){return po}),n.d(e,"BasicShadowMap",function(){return fo}),n.d(e,"PCFShadowMap",function(){return mo}),n.d(e,"PCFSoftShadowMap",function(){return go}),n.d(e,"FrontSide",function(){return vo}),n.d(e,"BackSide",function(){return yo}),n.d(e,"DoubleSide",function(){return _o}),n.d(e,"FlatShading",function(){return xo}),n.d(e,"SmoothShading",function(){return bo}),n.d(e,"NoColors",function(){return wo}),n.d(e,"FaceColors",function(){return Eo}),n.d(e,"VertexColors",function(){return Mo}),n.d(e,"NoBlending",function(){return To}),n.d(e,"NormalBlending",function(){return So}),n.d(e,"AdditiveBlending",function(){return Ao}),n.d(e,"SubtractiveBlending",function(){return Ro}),n.d(e,"MultiplyBlending",function(){return Lo}),n.d(e,"CustomBlending",function(){return Co}),n.d(e,"AddEquation",function(){return Po}),n.d(e,"SubtractEquation",function(){return Oo}),n.d(e,"ReverseSubtractEquation",function(){return Io}),n.d(e,"MinEquation",function(){return No}),n.d(e,"MaxEquation",function(){return Uo}),n.d(e,"ZeroFactor",function(){return Do}),n.d(e,"OneFactor",function(){return Fo}),n.d(e,"SrcColorFactor",function(){return Bo}),n.d(e,"OneMinusSrcColorFactor",function(){return zo}),n.d(e,"SrcAlphaFactor",function(){return Go}),n.d(e,"OneMinusSrcAlphaFactor",function(){return ko}),n.d(e,"DstAlphaFactor",function(){return Ho}),n.d(e,"OneMinusDstAlphaFactor",function(){return Vo}),n.d(e,"DstColorFactor",function(){return jo}),n.d(e,"OneMinusDstColorFactor",function(){return Wo}),n.d(e,"SrcAlphaSaturateFactor",function(){return Xo}),n.d(e,"NeverDepth",function(){return Yo}),n.d(e,"AlwaysDepth",function(){return qo}),n.d(e,"LessDepth",function(){return Zo}),n.d(e,"LessEqualDepth",function(){return Jo}),n.d(e,"EqualDepth",function(){return Ko}),n.d(e,"GreaterEqualDepth",function(){return Qo}),n.d(e,"GreaterDepth",function(){return $o}),n.d(e,"NotEqualDepth",function(){return ta}),n.d(e,"MultiplyOperation",function(){return ea}),n.d(e,"MixOperation",function(){return na}),n.d(e,"AddOperation",function(){return ia}),n.d(e,"NoToneMapping",function(){return ra}),n.d(e,"LinearToneMapping",function(){return oa}),n.d(e,"ReinhardToneMapping",function(){return aa}),n.d(e,"Uncharted2ToneMapping",function(){return sa}),n.d(e,"CineonToneMapping",function(){return ca}),n.d(e,"UVMapping",function(){return ua}),n.d(e,"CubeReflectionMapping",function(){return la}),n.d(e,"CubeRefractionMapping",function(){return ha}),n.d(e,"EquirectangularReflectionMapping",function(){return da}),n.d(e,"EquirectangularRefractionMapping",function(){return pa}),n.d(e,"SphericalReflectionMapping",function(){return fa}),n.d(e,"CubeUVReflectionMapping",function(){return ma}),n.d(e,"CubeUVRefractionMapping",function(){return ga}),n.d(e,"RepeatWrapping",function(){return va}),n.d(e,"ClampToEdgeWrapping",function(){return ya}),n.d(e,"MirroredRepeatWrapping",function(){return _a}),n.d(e,"NearestFilter",function(){return xa}),n.d(e,"NearestMipMapNearestFilter",function(){return ba}),n.d(e,"NearestMipMapLinearFilter",function(){return wa}),n.d(e,"LinearFilter",function(){return Ea}),n.d(e,"LinearMipMapNearestFilter",function(){return Ma}),n.d(e,"LinearMipMapLinearFilter",function(){return Ta}),n.d(e,"UnsignedByteType",function(){return Sa}),n.d(e,"ByteType",function(){return Aa}),n.d(e,"ShortType",function(){return Ra}),n.d(e,"UnsignedShortType",function(){return La}),n.d(e,"IntType",function(){return Ca}),n.d(e,"UnsignedIntType",function(){return Pa}),n.d(e,"FloatType",function(){return Oa}),n.d(e,"HalfFloatType",function(){return Ia}),n.d(e,"UnsignedShort4444Type",function(){return Na}),n.d(e,"UnsignedShort5551Type",function(){return Ua}),n.d(e,"UnsignedShort565Type",function(){return Da}),n.d(e,"UnsignedInt248Type",function(){return Fa}),n.d(e,"AlphaFormat",function(){return Ba}),n.d(e,"RGBFormat",function(){return za}),n.d(e,"RGBAFormat",function(){return Ga}),n.d(e,"LuminanceFormat",function(){return ka}),n.d(e,"LuminanceAlphaFormat",function(){return Ha}),n.d(e,"RGBEFormat",function(){return Va}),n.d(e,"DepthFormat",function(){return ja}),n.d(e,"DepthStencilFormat",function(){return Wa}),n.d(e,"RGB_S3TC_DXT1_Format",function(){return Xa}),n.d(e,"RGBA_S3TC_DXT1_Format",function(){return Ya}),n.d(e,"RGBA_S3TC_DXT3_Format",function(){return qa}),n.d(e,"RGBA_S3TC_DXT5_Format",function(){return Za}),n.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return Ja}),n.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return Ka}),n.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return Qa}),n.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return $a}),n.d(e,"RGB_ETC1_Format",function(){return ts}),n.d(e,"LoopOnce",function(){return es}),n.d(e,"LoopRepeat",function(){return ns}),n.d(e,"LoopPingPong",function(){return is}),n.d(e,"InterpolateDiscrete",function(){return rs}),n.d(e,"InterpolateLinear",function(){return os}),n.d(e,"InterpolateSmooth",function(){return as}),n.d(e,"ZeroCurvatureEnding",function(){return ss}),n.d(e,"ZeroSlopeEnding",function(){return cs}),n.d(e,"WrapAroundEnding",function(){return us}),n.d(e,"TrianglesDrawMode",function(){return ls}),n.d(e,"TriangleStripDrawMode",function(){return hs}),n.d(e,"TriangleFanDrawMode",function(){return ds}),n.d(e,"LinearEncoding",function(){return ps}),n.d(e,"sRGBEncoding",function(){return fs}),n.d(e,"GammaEncoding",function(){return ms}),n.d(e,"RGBEEncoding",function(){return gs}),n.d(e,"LogLuvEncoding",function(){return vs}),n.d(e,"RGBM7Encoding",function(){return ys}),n.d(e,"RGBM16Encoding",function(){return _s}),n.d(e,"RGBDEncoding",function(){return xs}),n.d(e,"BasicDepthPacking",function(){return bs}),n.d(e,"RGBADepthPacking",function(){return ws}),n.d(e,"CubeGeometry",function(){return Pt}),n.d(e,"Face4",function(){return Lr}),n.d(e,"LineStrip",function(){return cc}),n.d(e,"LinePieces",function(){return uc}),n.d(e,"MeshFaceMaterial",function(){return Cr}),n.d(e,"MultiMaterial",function(){return Pr}),n.d(e,"PointCloud",function(){return Or}),n.d(e,"Particle",function(){return Ir}),n.d(e,"ParticleSystem",function(){return Nr}),n.d(e,"PointCloudMaterial",function(){return Ur}),n.d(e,"ParticleBasicMaterial",function(){return Dr}),n.d(e,"ParticleSystemMaterial",function(){return Fr}),n.d(e,"Vertex",function(){return Br}),n.d(e,"DynamicBufferAttribute",function(){return zr}),n.d(e,"Int8Attribute",function(){return Gr}),n.d(e,"Uint8Attribute",function(){return kr}),n.d(e,"Uint8ClampedAttribute",function(){return Hr}),n.d(e,"Int16Attribute",function(){return Vr}),n.d(e,"Uint16Attribute",function(){return jr}),n.d(e,"Int32Attribute",function(){return Wr}),n.d(e,"Uint32Attribute",function(){return Xr}),n.d(e,"Float32Attribute",function(){return Yr}),n.d(e,"Float64Attribute",function(){return qr}),n.d(e,"ClosedSplineCurve3",function(){return Zr}),n.d(e,"SplineCurve3",function(){return Jr}),n.d(e,"Spline",function(){return Kr}),n.d(e,"BoundingBoxHelper",function(){return Qr}),n.d(e,"EdgesHelper",function(){return $r}),n.d(e,"WireframeHelper",function(){return to}),n.d(e,"XHRLoader",function(){return eo}),n.d(e,"BinaryTextureLoader",function(){return no}),n.d(e,"GeometryUtils",function(){return lc}),n.d(e,"ImageUtils",function(){return hc}),n.d(e,"Projector",function(){return io}),n.d(e,"CanvasRenderer",function(){return ro}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),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(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(void 0!==i&&null!==i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}}(),Object.assign(i.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,i=n[t];if(void 0!==i){var r=i.indexOf(e);-1!==r&&i.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;var i=[],r=0,o=n.length;for(r=0;r<o;r++)i[r]=n[r];for(r=0;r<o;r++)i[r].call(this,t)}}}});var oo="85",ao={LEFT:0,MIDDLE:1,RIGHT:2},so=0,co=1,uo=2,lo=3,ho=0,po=1,fo=0,mo=1,go=2,vo=0,yo=1,_o=2,xo=1,bo=2,wo=0,Eo=1,Mo=2,To=0,So=1,Ao=2,Ro=3,Lo=4,Co=5,Po=100,Oo=101,Io=102,No=103,Uo=104,Do=200,Fo=201,Bo=202,zo=203,Go=204,ko=205,Ho=206,Vo=207,jo=208,Wo=209,Xo=210,Yo=0,qo=1,Zo=2,Jo=3,Ko=4,Qo=5,$o=6,ta=7,ea=0,na=1,ia=2,ra=0,oa=1,aa=2,sa=3,ca=4,ua=300,la=301,ha=302,da=303,pa=304,fa=305,ma=306,ga=307,va=1e3,ya=1001,_a=1002,xa=1003,ba=1004,wa=1005,Ea=1006,Ma=1007,Ta=1008,Sa=1009,Aa=1010,Ra=1011,La=1012,Ca=1013,Pa=1014,Oa=1015,Ia=1016,Na=1017,Ua=1018,Da=1019,Fa=1020,Ba=1021,za=1022,Ga=1023,ka=1024,Ha=1025,Va=Ga,ja=1026,Wa=1027,Xa=2001,Ya=2002,qa=2003,Za=2004,Ja=2100,Ka=2101,Qa=2102,$a=2103,ts=2151,es=2200,ns=2201,is=2202,rs=2300,os=2301,as=2302,ss=2400,cs=2401,us=2402,ls=0,hs=1,ds=2,ps=3e3,fs=3001,ms=3007,gs=3002,vs=3003,ys=3004,_s=3005,xs=3006,bs=3200,ws=3201,Es={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),i=0;return function(){for(var r=0;r<36;r++)8===r||13===r||18===r||23===r?n[r]="-":14===r?n[r]="4":(i<=2&&(i=33554432+16777216*Math.random()|0),t=15&i,i>>=4,n[r]=e[19===r?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Es.DEG2RAD},radToDeg:function(t){return t*Es.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.defineProperties(r.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(r.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new r,e=new r;return function(n,i){return t.set(n,n),e.set(i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,o=this.y-t.y;return this.x=r*n-o*i+t.x,this.y=r*i+o*n+t.y,this}});var Ms=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=ua,Object.defineProperty(o.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(o.prototype,i.prototype,{constructor:o,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Es.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===ua){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case va:t.x=t.x-Math.floor(t.x);break;case ya:t.x=t.x<0?0:1;break;case _a:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case va:t.y=t.y-Math.floor(t.y);break;case ya:t.y=t.y<0?0:1;break;case _a:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(a.prototype,{isVector4:!0,set:function(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*e+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*e+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*e+o[7]*n+o[11]*i+o[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,i,r,o=t.elements,a=o[0],s=o[4],c=o[8],u=o[1],l=o[5],h=o[9],d=o[2],p=o[6],f=o[10];if(Math.abs(s-u)<.01&&Math.abs(c-d)<.01&&Math.abs(h-p)<.01){if(Math.abs(s+u)<.1&&Math.abs(c+d)<.1&&Math.abs(h+p)<.1&&Math.abs(a+l+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(l+1)/2,v=(f+1)/2,y=(s+u)/4,_=(c+d)/4,x=(h+p)/4;return m>g&&m>v?m<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(m),i=y/n,r=_/n):g>v?g<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(g),n=y/i,r=x/i):v<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(v),n=_/r,i=x/r),this.set(n,i,r,e),this}var b=Math.sqrt((p-h)*(p-h)+(c-d)*(c-d)+(u-s)*(u-s));return Math.abs(b)<.001&&(b=1),this.x=(p-h)/b,this.y=(c-d)/b,this.z=(u-s)/b,this.w=Math.acos((a+l+f-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t=new a,e=new a;return function(n,i){return t.set(n,n,n,n),e.set(i,i,i,i),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(s.prototype,i.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),c.prototype=Object.create(s.prototype),c.prototype.constructor=c,c.prototype.isWebGLRenderTargetCube=!0,Object.assign(u,{slerp:function(t,e,n,i){return n.copy(t).slerp(e,i)},slerpFlat:function(t,e,n,i,r,o,a){var s=n[i+0],c=n[i+1],u=n[i+2],l=n[i+3],h=r[o+0],d=r[o+1],p=r[o+2],f=r[o+3];if(l!==f||s!==h||c!==d||u!==p){var m=1-a,g=s*h+c*d+u*p+l*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,g*v);m=Math.sin(m*x)/_,a=Math.sin(a*x)/_}var b=a*v;if(s=s*m+h*b,c=c*m+d*b,u=u*m+p*b,l=l*m+f*b,m===1-a){var w=1/Math.sqrt(s*s+c*c+u*u+l*l);s*=w,c*=w,u*=w,l*=w}}t[e]=s,t[e+1]=c,t[e+2]=u,t[e+3]=l}}),Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(u.prototype,{set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,i=t._y,r=t._z,o=t.order,a=Math.cos,s=Math.sin,c=a(n/2),u=a(i/2),l=a(r/2),h=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===o?(this._x=h*u*l+c*d*p,this._y=c*d*l-h*u*p,this._z=c*u*p+h*d*l,this._w=c*u*l-h*d*p):"YXZ"===o?(this._x=h*u*l+c*d*p,this._y=c*d*l-h*u*p,this._z=c*u*p-h*d*l,this._w=c*u*l+h*d*p):"ZXY"===o?(this._x=h*u*l-c*d*p,this._y=c*d*l+h*u*p,this._z=c*u*p+h*d*l,this._w=c*u*l-h*d*p):"ZYX"===o?(this._x=h*u*l-c*d*p,this._y=c*d*l+h*u*p,this._z=c*u*p-h*d*l,this._w=c*u*l+h*d*p):"YZX"===o?(this._x=h*u*l+c*d*p,this._y=c*d*l+h*u*p,this._z=c*u*p-h*d*l,this._w=c*u*l-h*d*p):"XZY"===o&&(this._x=h*u*l-c*d*p,this._y=c*d*l-h*u*p,this._z=c*u*p+h*d*l,this._w=c*u*l+h*d*p),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,i=n[0],r=n[4],o=n[8],a=n[1],s=n[5],c=n[9],u=n[2],l=n[6],h=n[10],d=i+s+h;return d>0?(e=.5/Math.sqrt(d+1),this._w=.25/e,this._x=(l-c)*e,this._y=(o-u)*e,this._z=(a-r)*e):i>s&&i>h?(e=2*Math.sqrt(1+i-s-h),this._w=(l-c)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(o+u)/e):s>h?(e=2*Math.sqrt(1+s-i-h),this._w=(o-u)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(c+l)/e):(e=2*Math.sqrt(1+h-i-s),this._w=(a-r)/e,this._x=(o+u)/e,this._y=(c+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new l;return function(n,i){return void 0===e&&(e=new l),t=n.dot(i)+1,t<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,i),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,i=t._y,r=t._z,o=t._w,a=e._x,s=e._y,c=e._z,u=e._w;return this._x=n*u+o*a+i*c-r*s,this._y=i*u+o*s+r*a-n*c,this._z=r*u+o*c+n*s-i*a,this._w=o*u-n*a-i*s-r*c,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,i=this._y,r=this._z,o=this._w,a=o*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=i,this._z=r,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(i+this._y),this._z=.5*(r+this._z),this;var c=Math.atan2(s,a),u=Math.sin((1-e)*c)/s,l=Math.sin(e*c)/s;return this._w=o*u+this._w*l,this._x=n*u+this._x*l,this._y=i*u+this._y*l,this._z=r*u+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(l.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new u;return function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new u;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this},applyMatrix4:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;this.x=r[0]*e+r[4]*n+r[8]*i+r[12],this.y=r[1]*e+r[5]*n+r[9]*i+r[13],this.z=r[2]*e+r[6]*n+r[10]*i+r[14];var o=r[3]*e+r[7]*n+r[11]*i+r[15];return this.divideScalar(o)},applyQuaternion:function(t){var e=this.x,n=this.y,i=this.z,r=t.x,o=t.y,a=t.z,s=t.w,c=s*e+o*i-a*n,u=s*n+a*e-r*i,l=s*i+r*n-o*e,h=-r*e-o*n-a*i;return this.x=c*s+h*-r+u*-a-l*-o,this.y=u*s+h*-o+l*-r-c*-a,this.z=l*s+h*-a+c*-o-u*-r,this},project:function(){var t=new h;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new h;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new l,e=new l;return function(n,i){return t.set(n,n,n),e.set(i,i,i),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,i=this.y,r=this.z;return this.x=i*t.z-r*t.y,this.y=r*t.x-n*t.z,this.z=n*t.y-i*t.x,this},crossVectors:function(t,e){var n=t.x,i=t.y,r=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-r*a,this.y=r*o-n*s,this.z=n*a-i*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new l;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new l;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Es.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(h.prototype,{isMatrix4:!0,set:function(t,e,n,i,r,o,a,s,c,u,l,h,d,p,f,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=o,g[9]=a,g[13]=s,g[2]=c,g[6]=u,g[10]=l,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new h).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new l;return function(e){var n=this.elements,i=e.elements,r=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[4]=i[4]*o,n[5]=i[5]*o,n[6]=i[6]*o,n[8]=i[8]*a,n[9]=i[9]*a,n[10]=i[10]*a,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,i=t.y,r=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(i),c=Math.sin(i),u=Math.cos(r),l=Math.sin(r);if("XYZ"===t.order){var h=o*u,d=o*l,p=a*u,f=a*l;e[0]=s*u,e[4]=-s*l,e[8]=c,e[1]=d+p*c,e[5]=h-f*c,e[9]=-a*s,e[2]=f-h*c,e[6]=p+d*c,e[10]=o*s}else if("YXZ"===t.order){var m=s*u,g=s*l,v=c*u,y=c*l;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*c,e[1]=o*l,e[5]=o*u,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*u,g=s*l,v=c*u,y=c*l;e[0]=m-y*a,e[4]=-o*l,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*u,e[9]=y-m*a,e[2]=-o*c,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var h=o*u,d=o*l,p=a*u,f=a*l;e[0]=s*u,e[4]=p*c-d,e[8]=h*c+f,e[1]=s*l,e[5]=f*c+h,e[9]=d*c-p,e[2]=-c,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var _=o*s,x=o*c,b=a*s,w=a*c;e[0]=s*u,e[4]=w-_*l,e[8]=b*l+x,e[1]=l,e[5]=o*u,e[9]=-a*u,e[2]=-c*u,e[6]=x*l+b,e[10]=_-w*l}else if("XZY"===t.order){var _=o*s,x=o*c,b=a*s,w=a*c;e[0]=s*u,e[4]=-l,e[8]=c*u,e[1]=_*l+w,e[5]=o*u,e[9]=x*l-b,e[2]=b*l-x,e[6]=a*u,e[10]=w*l+_}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,i=t._y,r=t._z,o=t._w,a=n+n,s=i+i,c=r+r,u=n*a,l=n*s,h=n*c,d=i*s,p=i*c,f=r*c,m=o*a,g=o*s,v=o*c;return e[0]=1-(d+f),e[4]=l-v,e[8]=h+g,e[1]=l+v,e[5]=1-(u+f),e[9]=p-m,e[2]=h-g,e[6]=p+m,e[10]=1-(u+d),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new l,e=new l,n=new l;return function(i,r,o){var a=this.elements;return n.subVectors(i,r),0===n.lengthSq()&&(n.z=1),n.normalize(),t.crossVectors(o,n),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n)),t.normalize(),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[4],s=n[8],c=n[12],u=n[1],l=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],b=i[0],w=i[4],E=i[8],M=i[12],T=i[1],S=i[5],A=i[9],R=i[13],L=i[2],C=i[6],P=i[10],O=i[14],I=i[3],N=i[7],U=i[11],D=i[15];return r[0]=o*b+a*T+s*L+c*I,r[4]=o*w+a*S+s*C+c*N,r[8]=o*E+a*A+s*P+c*U,r[12]=o*M+a*R+s*O+c*D,r[1]=u*b+l*T+h*L+d*I,r[5]=u*w+l*S+h*C+d*N,r[9]=u*E+l*A+h*P+d*U,r[13]=u*M+l*R+h*O+d*D,r[2]=p*b+f*T+m*L+g*I,r[6]=p*w+f*S+m*C+g*N,r[10]=p*E+f*A+m*P+g*U,r[14]=p*M+f*R+m*O+g*D,r[3]=v*b+y*T+_*L+x*I,r[7]=v*w+y*S+_*C+x*N,r[11]=v*E+y*A+_*P+x*U,r[15]=v*M+y*R+_*O+x*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new l;return function(e){for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix4(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],o=t[1],a=t[5],s=t[9],c=t[13],u=t[2],l=t[6],h=t[10],d=t[14];return t[3]*(+r*s*l-i*c*l-r*a*h+n*c*h+i*a*d-n*s*d)+t[7]*(+e*s*d-e*c*h+r*o*h-i*o*d+i*c*u-r*s*u)+t[11]*(+e*c*l-e*a*d-r*o*l+n*o*d+r*a*u-n*c*u)+t[15]*(-i*a*u-e*s*l+e*a*h+i*o*l-n*o*h+n*s*u)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var n=this.elements,i=t.elements,r=i[0],o=i[1],a=i[2],s=i[3],c=i[4],u=i[5],l=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],v=i[13],y=i[14],_=i[15],x=p*y*h-v*f*h+v*l*m-u*y*m-p*l*_+u*f*_,b=g*f*h-d*y*h-g*l*m+c*y*m+d*l*_-c*f*_,w=d*v*h-g*p*h+g*u*m-c*v*m-d*u*_+c*p*_,E=g*p*l-d*v*l-g*u*f+c*v*f+d*u*y-c*p*y,M=r*x+o*b+a*w+s*E;if(0===M){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/M;return n[0]=x*S,n[1]=(v*f*s-p*y*s-v*a*m+o*y*m+p*a*_-o*f*_)*S,n[2]=(u*y*s-v*l*s+v*a*h-o*y*h-u*a*_+o*l*_)*S,n[3]=(p*l*s-u*f*s-p*a*h+o*f*h+u*a*m-o*l*m)*S,n[4]=b*S,n[5]=(d*y*s-g*f*s+g*a*m-r*y*m-d*a*_+r*f*_)*S,n[6]=(g*l*s-c*y*s-g*a*h+r*y*h+c*a*_-r*l*_)*S,n[7]=(c*f*s-d*l*s+d*a*h-r*f*h-c*a*m+r*l*m)*S,n[8]=w*S,n[9]=(g*p*s-d*v*s-g*o*m+r*v*m+d*o*_-r*p*_)*S,n[10]=(c*v*s-g*u*s+g*o*h-r*v*h-c*o*_+r*u*_)*S,n[11]=(d*u*s-c*p*s-d*o*h+r*p*h+c*o*m-r*u*m)*S,n[12]=E*S,n[13]=(d*v*a-g*p*a+g*o*f-r*v*f-d*o*y+r*p*y)*S,n[14]=(g*u*a-c*v*a-g*o*l+r*v*l+c*o*y-r*u*y)*S,n[15]=(c*p*a-d*u*a+d*o*l-r*p*l-c*o*f+r*u*f)*S,this},scale:function(t){var e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),i=Math.sin(e),r=1-n,o=t.x,a=t.y,s=t.z,c=r*o,u=r*a;return this.set(c*o+n,c*a-i*s,c*s+i*a,0,c*a+i*s,u*a+n,u*s-i*o,0,c*s-i*a,u*s+i*o,r*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t=new l,e=new h;return function(n,i,r){var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),c=t.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),n.x=o[12],n.y=o[13],n.z=o[14],e.copy(this);var u=1/a,l=1/s,h=1/c;return e.elements[0]*=u,e.elements[1]*=u,e.elements[2]*=u,e.elements[4]*=l,e.elements[5]*=l,e.elements[6]*=l,e.elements[8]*=h,e.elements[9]*=h,e.elements[10]*=h,i.setFromRotationMatrix(e),r.x=a,r.y=s,r.z=c,this}}(),makePerspective:function(t,e,n,i,r,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*r/(e-t),c=2*r/(n-i),u=(e+t)/(e-t),l=(n+i)/(n-i),h=-(o+r)/(o-r),d=-2*o*r/(o-r);return a[0]=s,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,n,i,r,o){var a=this.elements,s=1/(e-t),c=1/(n-i),u=1/(o-r),l=(e+t)*s,h=(n+i)*c,d=(o+r)*u;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}),d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.prototype.isDataTexture=!0,p.prototype=Object.create(o.prototype),p.prototype.constructor=p,p.prototype.isCubeTexture=!0,Object.defineProperty(p.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Ts=new o,Ss=new p,As=[],Rs=[],Ls=new Float32Array(16),Cs=new Float32Array(9);j.prototype.setValue=function(t,e){for(var n=this.seq,i=0,r=n.length;i!==r;++i){var o=n[i];o.setValue(t,e[o.id])}};var Ps=/([\w\d_]+)(\])?(\[|\.)?/g;Y.prototype.setValue=function(t,e,n){var i=this.map[e];void 0!==i&&i.setValue(t,n,this.renderer)},Y.prototype.setOptional=function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)},Y.upload=function(t,e,n,i){for(var r=0,o=e.length;r!==o;++r){var a=e[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}},Y.seqWithValue=function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var o=t[i];o.id in e&&n.push(o)}return n};var Os={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(q.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,i){if(e=Es.euclideanModulo(e,1),n=Es.clamp(n,0,1),i=Es.clamp(i,0,1),0===n)this.r=this.g=this.b=i;else{var r=i<=.5?i*(1+n):i+n-i*n,o=2*i-r;this.r=t(o,r,e+1/3),this.g=t(o,r,e),this.b=t(o,r,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var i,r=n[1],o=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,e(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,e(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,c=parseInt(i[3],10)/100;return e(i[5]),this.setHSL(a,s,c)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var u=n[1],l=u.length;if(3===l)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}if(t&&t.length>0){var u=Os[t];void 0!==u?this.setHex(u):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,i=t||{h:0,s:0,l:0},r=this.r,o=this.g,a=this.b,s=Math.max(r,o,a),c=Math.min(r,o,a),u=(c+s)/2;if(c===s)e=0,n=0;else{var l=s-c;switch(n=u<=.5?l/(s+c):l/(2-s-c),s){case r:e=(o-a)/l+(o<a?6:0);break;case o:e=(a-r)/l+2;break;case a:e=(r-o)/l+4}e/=6}return i.h=e,i.s=n,i.l=u,i},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var i=this.getHSL();return i.h+=t,i.s+=e,i.l+=n,this.setHSL(i.h,i.s,i.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Is={common:{diffuse:{value:new q(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new r(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new q(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new q(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)}}},Ns={merge:function(t){for(var e={},n=0;n<t.length;n++){var i=this.clone(t[n]);for(var r in i)e[r]=i[r]}return e},clone:function(t){var e={};for(var n in t){e[n]={};for(var i in t[n]){var r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}},Us={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat 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}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},Ds={basic:{uniforms:Ns.merge([Is.common,Is.aomap,Is.lightmap,Is.fog]),vertexShader:Us.meshbasic_vert,fragmentShader:Us.meshbasic_frag},lambert:{uniforms:Ns.merge([Is.common,Is.aomap,Is.lightmap,Is.emissivemap,Is.fog,Is.lights,{emissive:{value:new q(0)}}]),vertexShader:Us.meshlambert_vert,fragmentShader:Us.meshlambert_frag},phong:{uniforms:Ns.merge([Is.common,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.gradientmap,Is.fog,Is.lights,{emissive:{value:new q(0)},specular:{value:new q(1118481)},shininess:{value:30}}]),vertexShader:Us.meshphong_vert,fragmentShader:Us.meshphong_frag},standard:{uniforms:Ns.merge([Is.common,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.roughnessmap,Is.metalnessmap,Is.fog,Is.lights,{emissive:{value:new q(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Us.meshphysical_vert,fragmentShader:Us.meshphysical_frag},points:{uniforms:Ns.merge([Is.points,Is.fog]),vertexShader:Us.points_vert,fragmentShader:Us.points_frag},dashed:{uniforms:Ns.merge([Is.common,Is.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Us.linedashed_vert,fragmentShader:Us.linedashed_frag},depth:{uniforms:Ns.merge([Is.common,Is.displacementmap]),vertexShader:Us.depth_vert,fragmentShader:Us.depth_frag},normal:{uniforms:Ns.merge([Is.common,Is.bumpmap,Is.normalmap,Is.displacementmap,{opacity:{value:1}}]),vertexShader:Us.normal_vert,fragmentShader:Us.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Us.cube_vert,fragmentShader:Us.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Us.equirect_vert,fragmentShader:Us.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new l}},vertexShader:Us.distanceRGBA_vert,fragmentShader:Us.distanceRGBA_frag}};Ds.physical={uniforms:Ns.merge([Ds.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Us.meshphysical_vert,fragmentShader:Us.meshphysical_frag},Object.assign(Z.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new r;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new r;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new r;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new r).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new r).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new r;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Fs=0;Object.assign(Q.prototype,i.prototype,{isMaterial:!0,setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearCoat&&(i.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(i.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,i.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(i.size=this.size),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==So&&(i.blending=this.blending),this.shading!==bo&&(i.shading=this.shading),this.side!==vo&&(i.side=this.side),this.vertexColors!==wo&&(i.vertexColors=this.vertexColors),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),i.skinning=this.skinning,i.morphTargets=this.morphTargets,i.dithering=this.dithering,n){var r=e(t.textures),o=e(t.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var i=e.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=e[r].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),$.prototype=Object.create(Q.prototype),$.prototype.constructor=$,$.prototype.isShaderMaterial=!0,$.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ns.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},$.prototype.toJSON=function(t){var e=Q.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},tt.prototype=Object.create(Q.prototype),tt.prototype.constructor=tt,tt.prototype.isMeshDepthMaterial=!0,tt.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(et.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.length;s<c;s+=3){var u=t[s],l=t[s+1],h=t[s+2];u<e&&(e=u),l<n&&(n=l),h<i&&(i=h),u>r&&(r=u),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,i=1/0,r=-1/0,o=-1/0,a=-1/0,s=0,c=t.count;s<c;s++){var u=t.getX(s),l=t.getY(s),h=t.getZ(s);u<e&&(e=u),l<n&&(n=l),h<i&&(i=h),u>r&&(r=u),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new l;return function(e,n){var i=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new l;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new l;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new l;return function(e){var n=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var i,r,o=e.geometry;if(void 0!==o)if(o.isGeometry){var a=o.vertices;for(i=0,r=a.length;i<r;i++)t.copy(a[i]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}else if(o.isBufferGeometry){var s=o.attributes.position;if(void 0!==s)for(i=0,r=s.count;i<r;i++)t.fromBufferAttribute(s,i).applyMatrix4(e.matrixWorld),n.expandByPoint(t)}}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new l).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t=new l;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new l).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new l;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new l;return function(e){var n=e||new nt;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new l,new l,new l,new l,new l,new l,new l,new l];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(nt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new et;return function(e,n){var i=this.center;void 0!==n?i.copy(n):t.setFromPoints(e).getCenter(i);for(var r=0,o=0,a=e.length;o<a;o++)r=Math.max(r,i.distanceToSquared(e[o]));return this.radius=Math.sqrt(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t),i=e||new l;return i.copy(t),n>this.radius*this.radius&&(i.sub(this.center).normalize(),i.multiplyScalar(this.radius).add(this.center)),i},getBoundingBox:function(t){var e=t||new et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(it.prototype,{isMatrix3:!0,set:function(t,e,n,i,r,o,a,s,c){var u=this.elements;return u[0]=t,u[1]=i,u[2]=a,u[3]=e,u[4]=r,u[5]=s,u[6]=n,u[7]=o,u[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new l;return function(e){for(var n=0,i=e.count;n<i;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix3(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,i=e.elements,r=this.elements,o=n[0],a=n[3],s=n[6],c=n[1],u=n[4],l=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],_=i[7],x=i[2],b=i[5],w=i[8];return r[0]=o*f+a*v+s*x,r[3]=o*m+a*y+s*b,r[6]=o*g+a*_+s*w,r[1]=c*f+u*v+l*x,r[4]=c*m+u*y+l*b,r[7]=c*g+u*_+l*w,r[2]=h*f+d*v+p*x,r[5]=h*m+d*y+p*b,r[8]=h*g+d*_+p*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],o=t[4],a=t[5],s=t[6],c=t[7],u=t[8];return e*o*u-e*a*c-n*r*u+n*a*s+i*r*c-i*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=t.elements,i=this.elements,r=n[0],o=n[1],a=n[2],s=n[3],c=n[4],u=n[5],l=n[6],h=n[7],d=n[8],p=d*c-u*h,f=u*l-d*s,m=h*s-c*l,g=r*p+o*f+a*m;if(0===g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return i[0]=p*y,i[1]=(a*h-d*o)*y,i[2]=(u*o-a*c)*y,i[3]=f*y,i[4]=(d*r-a*l)*y,i[5]=(a*s-u*r)*y,i[6]=m*y,i[7]=(o*l-h*r)*y,i[8]=(c*r-o*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,n=t.elements,i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}}),Object.assign(rt.prototype,{set:function(t,e){return this.normal.copy(t),this.constant=e,this},setComponents:function(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this},setFromCoplanarPoints:function(){var t=new l,e=new l;return function(n,i,r){var o=t.subVectors(r,i).cross(e.subVectors(n,i)).normalize();return this.setFromNormalAndCoplanarPoint(o,n),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,e){return this.orthoPoint(t,e).sub(t).negate()},orthoPoint:function(t,e){var n=this.distanceToPoint(t);return(e||new l).copy(this.normal).multiplyScalar(n)},intersectLine:function(){var t=new l;return function(e,n){var i=n||new l,r=e.delta(t),o=this.normal.dot(r);if(0!==o){var a=-(e.start.dot(this.normal)+this.constant)/o;if(!(a<0||a>1))return i.copy(r).multiplyScalar(a).add(e.start)}else if(0===this.distanceToPoint(e.start))return i.copy(e.start)}}(),intersectsLine:function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return(t||new l).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var t=new l,e=new it;return function(n,i){var r=this.coplanarPoint(t).applyMatrix4(n),o=i||e.getNormalMatrix(n),a=this.normal.applyMatrix3(o).normalize();return this.constant=-r.dot(a),this}}(),translate:function(t){return this.constant=this.constant-t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}}),Object.assign(ot.prototype,{set:function(t,e,n,i,r,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromMatrix:function(t){var e=this.planes,n=t.elements,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],c=n[5],u=n[6],l=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(a-i,l-s,f-h,y-m).normalize(),e[1].setComponents(a+i,l+s,f+h,y+m).normalize(),e[2].setComponents(a+r,l+c,f+d,y+g).normalize(),e[3].setComponents(a-r,l-c,f-d,y-g).normalize(),e[4].setComponents(a-o,l-u,f-p,y-v).normalize(),e[5].setComponents(a+o,l+u,f+p,y+v).normalize(),this},intersectsObject:function(){var t=new nt;return function(e){var n=e.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),t.copy(n.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSprite:function(){var t=new nt;return function(e){return t.center.set(0,0,0),t.radius=.7071067811865476,t.applyMatrix4(e.matrixWorld),this.intersectsSphere(t)}}(),intersectsSphere:function(t){for(var e=this.planes,n=t.center,i=-t.radius,r=0;r<6;r++){if(e[r].distanceToPoint(n)<i)return!1}return!0},intersectsBox:function(){var t=new l,e=new l;return function(n){for(var i=this.planes,r=0;r<6;r++){var o=i[r];t.x=o.normal.x>0?n.min.x:n.max.x,e.x=o.normal.x>0?n.max.x:n.min.x,t.y=o.normal.y>0?n.min.y:n.max.y,e.y=o.normal.y>0?n.max.y:n.min.y,t.z=o.normal.z>0?n.min.z:n.max.z,e.z=o.normal.z>0?n.max.z:n.min.z;var a=o.distanceToPoint(t),s=o.distanceToPoint(e);if(a<0&&s<0)return!1}return!0}}(),containsPoint:function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}}),Object.assign(st.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return(e||new l).copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(){var t=new l;return function(e){return this.origin.copy(this.at(e,t)),this}}(),closestPointToPoint:function(t,e){var n=e||new l;n.subVectors(t,this.origin);var i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(i).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(){var t=new l;return function(e){var n=t.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(t.copy(this.direction).multiplyScalar(n).add(this.origin),t.distanceToSquared(e))}}(),distanceSqToSegment:function(){var t=new l,e=new l,n=new l;return function(i,r,o,a){t.copy(i).add(r).multiplyScalar(.5),e.copy(r).sub(i).normalize(),n.copy(this.origin).sub(t);var s,c,u,l,h=.5*i.distanceTo(r),d=-this.direction.dot(e),p=n.dot(this.direction),f=-n.dot(e),m=n.lengthSq(),g=Math.abs(1-d*d);if(g>0)if(s=d*f-p,c=d*p-f,l=h*g,s>=0)if(c>=-l)if(c<=l){var v=1/g;s*=v,c*=v,u=s*(s+d*c+2*p)+c*(d*s+c+2*f)+m}else c=h,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;else c=-h,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;else c<=-l?(s=Math.max(0,-(-d*h+p)),c=s>0?-h:Math.min(Math.max(-h,-f),h),u=-s*s+c*(c+2*f)+m):c<=l?(s=0,c=Math.min(Math.max(-h,-f),h),u=c*(c+2*f)+m):(s=Math.max(0,-(d*h+p)),c=s>0?h:Math.min(Math.max(-h,-f),h),u=-s*s+c*(c+2*f)+m);else c=d>0?-h:h,s=Math.max(0,-(d*c+p)),u=-s*s+c*(c+2*f)+m;return o&&o.copy(this.direction).multiplyScalar(s).add(this.origin),a&&a.copy(e).multiplyScalar(c).add(t),u}}(),intersectSphere:function(){var t=new l;return function(e,n){t.subVectors(e.center,this.origin);var i=t.dot(this.direction),r=t.dot(t)-i*i,o=e.radius*e.radius;if(r>o)return null;var a=Math.sqrt(o-r),s=i-a,c=i+a;return s<0&&c<0?null:s<0?this.at(c,n):this.at(s,n)}}(),intersectsSphere:function(t){return this.distanceToPoint(t.center)<=t.radius},distanceToPlane:function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},intersectPlane:function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},intersectsPlane:function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},intersectBox:function(t,e){var n,i,r,o,a,s,c=1/this.direction.x,u=1/this.direction.y,l=1/this.direction.z,h=this.origin;return c>=0?(n=(t.min.x-h.x)*c,i=(t.max.x-h.x)*c):(n=(t.max.x-h.x)*c,i=(t.min.x-h.x)*c),u>=0?(r=(t.min.y-h.y)*u,o=(t.max.y-h.y)*u):(r=(t.max.y-h.y)*u,o=(t.min.y-h.y)*u),n>o||r>i?null:((r>n||n!==n)&&(n=r),(o<i||i!==i)&&(i=o),l>=0?(a=(t.min.z-h.z)*l,s=(t.max.z-h.z)*l):(a=(t.max.z-h.z)*l,s=(t.min.z-h.z)*l),n>s||a>i?null:((a>n||n!==n)&&(n=a),(s<i||i!==i)&&(i=s),i<0?null:this.at(n>=0?n:i,e)))},intersectsBox:function(){var t=new l;return function(e){return null!==this.intersectBox(e,t)}}(),intersectTriangle:function(){var t=new l,e=new l,n=new l,i=new l;return function(r,o,a,s,c){e.subVectors(o,r),n.subVectors(a,r),i.crossVectors(e,n);var u,l=this.direction.dot(i);if(l>0){if(s)return null;u=1}else{if(!(l<0))return null;u=-1,l=-l}t.subVectors(this.origin,r);var h=u*this.direction.dot(n.crossVectors(t,n));if(h<0)return null;var d=u*this.direction.dot(e.cross(t));if(d<0)return null;if(h+d>l)return null;var p=-u*t.dot(i);return p<0?null:this.at(p/l,c)}}(),applyMatrix4:function(t){return this.direction.add(this.origin).applyMatrix4(t),this.origin.applyMatrix4(t),this.direction.sub(this.origin),this.direction.normalize(),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}}),ct.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],ct.DefaultOrder="XYZ",Object.defineProperties(ct.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(t){this._order=t,this.onChangeCallback()}}}),Object.assign(ct.prototype,{isEuler:!0,set:function(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this.onChangeCallback(),this},setFromRotationMatrix:function(t,e,n){var i=Es.clamp,r=t.elements,o=r[0],a=r[4],s=r[8],c=r[1],u=r[5],l=r[9],h=r[2],d=r[6],p=r[10];return e=e||this._order,"XYZ"===e?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(d,u),this._z=0)):"YXZ"===e?(this._x=Math.asin(-i(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,p),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-h,o),this._z=0)):"ZXY"===e?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,u)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===e?(this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(d,p),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,u))):"YZX"===e?(this._z=Math.asin(i(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,u),this._y=Math.atan2(-h,o)):(this._x=0,this._y=Math.atan2(s,p))):"XZY"===e?(this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(d,u),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-l,p),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+e),this._order=e,!1!==n&&this.onChangeCallback(),this},setFromQuaternion:function(){var t=new h;return function(e,n,i){return t.makeRotationFromQuaternion(e),this.setFromRotationMatrix(t,n,i)}}(),setFromVector3:function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},reorder:function(){var t=new u;return function(e){return t.setFromEuler(this),this.setFromQuaternion(t,e)}}(),equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},fromArray:function(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},toVector3:function(t){return t?t.set(this._x,this._y,this._z):new l(this._x,this._y,this._z)},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(ut.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},test:function(t){return 0!=(this.mask&t.mask)}});var Bs=0;lt.DefaultUp=new l(0,1,0),lt.DefaultMatrixAutoUpdate=!0,Object.assign(lt.prototype,i.prototype,{isObject3D:!0,applyMatrix:function(t){this.matrix.multiplyMatrices(t,this.matrix),this.matrix.decompose(this.position,this.quaternion,this.scale)},setRotationFromAxisAngle:function(t,e){this.quaternion.setFromAxisAngle(t,e)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(){var t=new u;return function(e,n){return t.setFromAxisAngle(e,n),this.quaternion.multiply(t),this}}(),rotateX:function(){var t=new l(1,0,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateY:function(){var t=new l(0,1,0);return function(e){return this.rotateOnAxis(t,e)}}(),rotateZ:function(){var t=new l(0,0,1);return function(e){return this.rotateOnAxis(t,e)}}(),translateOnAxis:function(){var t=new l;return function(e,n){return t.copy(e).applyQuaternion(this.quaternion),this.position.add(t.multiplyScalar(n)),this}}(),translateX:function(){var t=new l(1,0,0);return function(e){return this.translateOnAxis(t,e)}}(),translateY:function(){var t=new l(0,1,0);return function(e){return this.translateOnAxis(t,e)}}(),translateZ:function(){var t=new l(0,0,1);return function(e){return this.translateOnAxis(t,e)}}(),localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var t=new h;return function(e){return e.applyMatrix4(t.getInverse(this.matrixWorld))}}(),lookAt:function(){var t=new h;return function(e){this.isCamera?t.lookAt(this.position,e,this.up):t.lookAt(e,this.position,this.up),this.quaternion.setFromRotationMatrix(t)}}(),add:function(t){if(arguments.length>1){for(var e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,t.dispatchEvent({type:"added"}),this.children.push(t)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)},remove:function(t){if(arguments.length>1)for(var e=0;e<arguments.length;e++)this.remove(arguments[e]);var n=this.children.indexOf(t);-1!==n&&(t.parent=null,t.dispatchEvent({type:"removed"}),this.children.splice(n,1))},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,e){if(this[t]===e)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n],o=r.getObjectByProperty(t,e);if(void 0!==o)return o}},getWorldPosition:function(t){var e=t||new l;return this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var t=new l,e=new l;return function(n){var i=n||new u;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,i,e),i}}(),getWorldRotation:function(){var t=new u;return function(e){var n=e||new ct;return this.getWorldQuaternion(t),n.setFromQuaternion(t,this.rotation.order,!1)}}(),getWorldScale:function(){var t=new l,e=new u;return function(n){var i=n||new l;return this.updateMatrixWorld(!0),this.matrixWorld.decompose(t,e,i),i}}(),getWorldDirection:function(){var t=new u;return function(e){var n=e||new l;return this.getWorldQuaternion(t),n.set(0,0,1).applyQuaternion(t)}}(),raycast:function(){},traverse:function(t){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}},traverseAncestors:function(t){var e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(var e=this.children,n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)},toJSON:function(t){function e(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}function n(t){var e=[];for(var n in t){var i=t[n];delete i.metadata,e.push(i)}return e}var i=void 0===t||""===t,r={};i&&(t={geometries:{},materials:{},textures:{},images:{}},r.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var o={};if(o.uuid=this.uuid,o.type=this.type,""!==this.name&&(o.name=this.name),"{}"!==JSON.stringify(this.userData)&&(o.userData=this.userData),!0===this.castShadow&&(o.castShadow=!0),!0===this.receiveShadow&&(o.receiveShadow=!0),!1===this.visible&&(o.visible=!1),o.matrix=this.matrix.toArray(),void 0!==this.geometry&&(o.geometry=e(t.geometries,this.geometry)),void 0!==this.material)if(Array.isArray(this.material)){for(var a=[],s=0,c=this.material.length;s<c;s++)a.push(e(t.materials,this.material[s]));o.material=a}else o.material=e(t.materials,this.material);if(this.children.length>0){o.children=[];for(var s=0;s<this.children.length;s++)o.children.push(this.children[s].toJSON(t).object)}if(i){var u=n(t.geometries),l=n(t.materials),h=n(t.textures),d=n(t.images);u.length>0&&(r.geometries=u),l.length>0&&(r.materials=l),h.length>0&&(r.textures=h),d.length>0&&(r.images=d)}return r.object=o,r},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(var n=0;n<t.children.length;n++){var i=t.children[n];this.add(i.clone())}return this}}),Object.assign(ht.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return(t||new l).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return(t||new l).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){var n=e||new l;return this.delta(n).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(){var t=new l,e=new l;return function(n,i){t.subVectors(n,this.start),e.subVectors(this.end,this.start);var r=e.dot(e),o=e.dot(t),a=o/r;return i&&(a=Es.clamp(a,0,1)),a}}(),closestPointToPoint:function(t,e,n){var i=this.closestPointToPointParameter(t,e),r=n||new l;return this.delta(r).multiplyScalar(i).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),Object.assign(dt,{normal:function(){var t=new l;return function(e,n,i,r){var o=r||new l;o.subVectors(i,n),t.subVectors(e,n),o.cross(t);var a=o.lengthSq();return a>0?o.multiplyScalar(1/Math.sqrt(a)):o.set(0,0,0)}}(),barycoordFromPoint:function(){var t=new l,e=new l,n=new l;return function(i,r,o,a,s){t.subVectors(a,r),e.subVectors(o,r),n.subVectors(i,r);var c=t.dot(t),u=t.dot(e),h=t.dot(n),d=e.dot(e),p=e.dot(n),f=c*d-u*u,m=s||new l;if(0===f)return m.set(-2,-1,-1);var g=1/f,v=(d*h-u*p)*g,y=(c*p-u*h)*g;return m.set(1-v-y,y,v)}}(),containsPoint:function(){var t=new l;return function(e,n,i,r){var o=dt.barycoordFromPoint(e,n,i,r,t);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(dt.prototype,{set:function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},setFromPointsAndIndices:function(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},area:function(){var t=new l,e=new l;return function(){return t.subVectors(this.c,this.b),e.subVectors(this.a,this.b),.5*t.cross(e).length()}}(),midpoint:function(t){return(t||new l).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(t){return dt.normal(this.a,this.b,this.c,t)},plane:function(t){return(t||new rt).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(t,e){return dt.barycoordFromPoint(t,this.a,this.b,this.c,e)},containsPoint:function(t){return dt.containsPoint(t,this.a,this.b,this.c)},closestPointToPoint:function(){var t=new rt,e=[new ht,new ht,new ht],n=new l,i=new l;return function(r,o){var a=o||new l,s=1/0;if(t.setFromCoplanarPoints(this.a,this.b,this.c),t.projectPoint(r,n),!0===this.containsPoint(n))a.copy(n);else{e[0].set(this.a,this.b),e[1].set(this.b,this.c),e[2].set(this.c,this.a);for(var c=0;c<e.length;c++){e[c].closestPointToPoint(n,!0,i);var u=n.distanceToSquared(i);u<s&&(s=u,a.copy(i))}}return a}}(),equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Object.assign(pt.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var e=0,n=t.vertexNormals.length;e<n;e++)this.vertexNormals[e]=t.vertexNormals[e].clone();for(var e=0,n=t.vertexColors.length;e<n;e++)this.vertexColors[e]=t.vertexColors[e].clone();return this}}),ft.prototype=Object.create(Q.prototype),ft.prototype.constructor=ft,ft.prototype.isMeshBasicMaterial=!0,ft.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},Object.defineProperty(mt.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(mt.prototype,{isBufferAttribute:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.itemSize:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),o=new q),e[n++]=o.r,e[n++]=o.g,e[n++]=o.b}return this},copyIndicesArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];e[n++]=o.a,e[n++]=o.b,e[n++]=o.c}return this},copyVector2sArray:function(t){for(var e=this.array,n=0,i=0,o=t.length;i<o;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new r),e[n++]=a.x,e[n++]=a.y}return this},copyVector3sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),o=new l),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z}return this},copyVector4sArray:function(t){for(var e=this.array,n=0,i=0,r=t.length;i<r;i++){var o=t[i];void 0===o&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),o=new a),e[n++]=o.x,e[n++]=o.y,e[n++]=o.z,e[n++]=o.w}return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,e){return this.array[t*this.itemSize]=e,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,e){return this.array[t*this.itemSize+1]=e,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,e){return this.array[t*this.itemSize+2]=e,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,e){return this.array[t*this.itemSize+3]=e,this},setXY:function(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),gt.prototype=Object.create(mt.prototype),gt.prototype.constructor=gt,vt.prototype=Object.create(mt.prototype),vt.prototype.constructor=vt,yt.prototype=Object.create(mt.prototype),yt.prototype.constructor=yt,_t.prototype=Object.create(mt.prototype),_t.prototype.constructor=_t,xt.prototype=Object.create(mt.prototype),xt.prototype.constructor=xt,bt.prototype=Object.create(mt.prototype),bt.prototype.constructor=bt,wt.prototype=Object.create(mt.prototype),wt.prototype.constructor=wt,Et.prototype=Object.create(mt.prototype),Et.prototype.constructor=Et,Mt.prototype=Object.create(mt.prototype),Mt.prototype.constructor=Mt,Object.assign(Tt.prototype,{computeGroups:function(t){for(var e,n=[],i=void 0,r=t.faces,o=0;o<r.length;o++){var a=r[o];a.materialIndex!==i&&(i=a.materialIndex,void 0!==e&&(e.count=3*o-e.start,n.push(e)),e={start:3*o,materialIndex:i})}void 0!==e&&(e.count=3*o-e.start,n.push(e)),this.groups=n},fromGeometry:function(t){var e,n=t.faces,i=t.vertices,o=t.faceVertexUvs,a=o[0]&&o[0].length>0,s=o[1]&&o[1].length>0,c=t.morphTargets,u=c.length;if(u>0){e=[];for(var l=0;l<u;l++)e[l]=[];this.morphTargets.position=e}var h,d=t.morphNormals,p=d.length;if(p>0){h=[];for(var l=0;l<p;l++)h[l]=[];this.morphTargets.normal=h}for(var f=t.skinIndices,m=t.skinWeights,g=f.length===i.length,v=m.length===i.length,l=0;l<n.length;l++){var y=n[l];this.vertices.push(i[y.a],i[y.b],i[y.c]);var _=y.vertexNormals;if(3===_.length)this.normals.push(_[0],_[1],_[2]);else{var x=y.normal;this.normals.push(x,x,x)}var b=y.vertexColors;if(3===b.length)this.colors.push(b[0],b[1],b[2]);else{var w=y.color;this.colors.push(w,w,w)}if(!0===a){var E=o[0][l];void 0!==E?this.uvs.push(E[0],E[1],E[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new r,new r,new r))}if(!0===s){var E=o[1][l];void 0!==E?this.uvs2.push(E[0],E[1],E[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new r,new r,new r))}for(var M=0;M<u;M++){var T=c[M].vertices;e[M].push(T[y.a],T[y.b],T[y.c])}for(var M=0;M<p;M++){var S=d[M].vertexNormals[l];h[M].push(S.a,S.b,S.c)}g&&this.skinIndices.push(f[y.a],f[y.b],f[y.c]),v&&this.skinWeights.push(m[y.a],m[y.b],m[y.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this}});var zs=0;Object.assign(Rt.prototype,i.prototype,{isGeometry:!0,applyMatrix:function(t){for(var e=(new it).getNormalMatrix(t),n=0,i=this.vertices.length;n<i;n++){this.vertices[n].applyMatrix4(t)}for(var n=0,i=this.faces.length;n<i;n++){var r=this.faces[n];r.normal.applyMatrix3(e).normalize();for(var o=0,a=r.vertexNormals.length;o<a;o++)r.vertexNormals[o].applyMatrix3(e).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var t=new h;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new h;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new h;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new h;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new h;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new lt;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),fromBufferGeometry:function(t){function e(t,e,i,r){var o=void 0!==s?[d[t].clone(),d[e].clone(),d[i].clone()]:[],a=void 0!==c?[n.colors[t].clone(),n.colors[e].clone(),n.colors[i].clone()]:[],l=new pt(t,e,i,o,a,r);n.faces.push(l),void 0!==u&&n.faceVertexUvs[0].push([p[t].clone(),p[e].clone(),p[i].clone()]),void 0!==h&&n.faceVertexUvs[1].push([f[t].clone(),f[e].clone(),f[i].clone()])}var n=this,i=null!==t.index?t.index.array:void 0,o=t.attributes,a=o.position.array,s=void 0!==o.normal?o.normal.array:void 0,c=void 0!==o.color?o.color.array:void 0,u=void 0!==o.uv?o.uv.array:void 0,h=void 0!==o.uv2?o.uv2.array:void 0;void 0!==h&&(this.faceVertexUvs[1]=[]);for(var d=[],p=[],f=[],m=0,g=0;m<a.length;m+=3,g+=2)n.vertices.push(new l(a[m],a[m+1],a[m+2])),void 0!==s&&d.push(new l(s[m],s[m+1],s[m+2])),void 0!==c&&n.colors.push(new q(c[m],c[m+1],c[m+2])),void 0!==u&&p.push(new r(u[g],u[g+1])),void 0!==h&&f.push(new r(h[g],h[g+1]));var v=t.groups;if(v.length>0)for(var m=0;m<v.length;m++)for(var y=v[m],_=y.start,x=y.count,g=_,b=_+x;g<b;g+=3)void 0!==i?e(i[g],i[g+1],i[g+2],y.materialIndex):e(g,g+1,g+2,y.materialIndex);else if(void 0!==i)for(var m=0;m<i.length;m+=3)e(i[m],i[m+1],i[m+2]);else for(var m=0;m<a.length/3;m+=3)e(m,m+1,m+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,e=this.boundingSphere.radius,n=0===e?1:1/e,i=new h;return i.set(n,0,0,-n*t.x,0,n,0,-n*t.y,0,0,n,-n*t.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var t=new l,e=new l,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],o=this.vertices[r.a],a=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,a),e.subVectors(o,a),t.cross(e),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){void 0===t&&(t=!0);var e,n,i,r,o,a;for(a=new Array(this.vertices.length),e=0,n=this.vertices.length;e<n;e++)a[e]=new l;if(t){var s,c,u,h=new l,d=new l;for(i=0,r=this.faces.length;i<r;i++)o=this.faces[i],s=this.vertices[o.a],c=this.vertices[o.b],u=this.vertices[o.c],h.subVectors(u,c),d.subVectors(s,c),h.cross(d),a[o.a].add(h),a[o.b].add(h),a[o.c].add(h)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)o=this.faces[i],a[o.a].add(o.normal),a[o.b].add(o.normal),a[o.c].add(o.normal);for(e=0,n=this.vertices.length;e<n;e++)a[e].normalize();for(i=0,r=this.faces.length;i<r;i++){o=this.faces[i];var p=o.vertexNormals;3===p.length?(p[0].copy(a[o.a]),p[1].copy(a[o.b]),p[2].copy(a[o.c])):(p[0]=a[o.a].clone(),p[1]=a[o.b].clone(),p[2]=a[o.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,e,n;for(this.computeFaceNormals(),t=0,e=this.faces.length;t<e;t++){n=this.faces[t];var i=n.vertexNormals;3===i.length?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,e,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for(r=this.faces[n],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),t=0,e=r.vertexNormals.length;t<e;t++)r.__originalVertexNormals[t]?r.__originalVertexNormals[t].copy(r.vertexNormals[t]):r.__originalVertexNormals[t]=r.vertexNormals[t].clone();var o=new Rt;for(o.faces=this.faces,t=0,e=this.morphTargets.length;t<e;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];var a,s,c=this.morphNormals[t].faceNormals,u=this.morphNormals[t].vertexNormals;for(n=0,i=this.faces.length;n<i;n++)a=new l,s={a:new l,b:new l,c:new l},c.push(a),u.push(s)}var h=this.morphNormals[t];o.vertices=this.morphTargets[t].vertices,o.computeFaceNormals(),o.computeVertexNormals();var a,s;for(n=0,i=this.faces.length;n<i;n++)r=this.faces[n],a=h.faceNormals[n],s=h.vertexNormals[n],a.copy(r.normal),s.a.copy(r.vertexNormals[0]),s.b.copy(r.vertexNormals[1]),s.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)r=this.faces[n],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeLineDistances:function(){for(var t=0,e=this.vertices,n=0,i=e.length;n<i;n++)n>0&&(t+=e[n].distanceTo(e[n-1])),this.lineDistances[n]=t},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new nt),this.boundingSphere.setFromPoints(this.vertices)},merge:function(t,e,n){if(!1===(t&&t.isGeometry))return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",t);var i,r=this.vertices.length,o=this.vertices,a=t.vertices,s=this.faces,c=t.faces,u=this.faceVertexUvs[0],l=t.faceVertexUvs[0],h=this.colors,d=t.colors;void 0===n&&(n=0),void 0!==e&&(i=(new it).getNormalMatrix(e));for(var p=0,f=a.length;p<f;p++){var m=a[p],g=m.clone();void 0!==e&&g.applyMatrix4(e),o.push(g)}for(var p=0,f=d.length;p<f;p++)h.push(d[p].clone());for(p=0,f=c.length;p<f;p++){var v,y,_,x=c[p],b=x.vertexNormals,w=x.vertexColors;v=new pt(x.a+r,x.b+r,x.c+r),v.normal.copy(x.normal),void 0!==i&&v.normal.applyMatrix3(i).normalize();for(var E=0,M=b.length;E<M;E++)y=b[E].clone(),void 0!==i&&y.applyMatrix3(i).normalize(),v.vertexNormals.push(y);v.color.copy(x.color);for(var E=0,M=w.length;E<M;E++)_=w[E],v.vertexColors.push(_.clone());v.materialIndex=x.materialIndex+n,s.push(v)}for(p=0,f=l.length;p<f;p++){var T=l[p],S=[];if(void 0!==T){for(var E=0,M=T.length;E<M;E++)S.push(T[E].clone());u.push(S)}}},mergeMesh:function(t){if(!1===(t&&t.isMesh))return void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",t);t.matrixAutoUpdate&&t.updateMatrix(),this.merge(t.geometry,t.matrix)},mergeVertices:function(){var t,e,n,i,r,o,a,s,c={},u=[],l=[],h=Math.pow(10,4);for(n=0,i=this.vertices.length;n<i;n++)t=this.vertices[n],e=Math.round(t.x*h)+"_"+Math.round(t.y*h)+"_"+Math.round(t.z*h),void 0===c[e]?(c[e]=n,u.push(this.vertices[n]),l[n]=u.length-1):l[n]=l[c[e]];var d=[];for(n=0,i=this.faces.length;n<i;n++){r=this.faces[n],r.a=l[r.a],r.b=l[r.b],r.c=l[r.c],o=[r.a,r.b,r.c];for(var p=0;p<3;p++)if(o[p]===o[(p+1)%3]){d.push(n);break}}for(n=d.length-1;n>=0;n--){var f=d[n];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a<s;a++)this.faceVertexUvs[a].splice(f,1)}var m=this.vertices.length-u.length;return this.vertices=u,m},sortFacesByMaterialIndex:function(){function t(t,e){return t.materialIndex-e.materialIndex}for(var e=this.faces,n=e.length,i=0;i<n;i++)e[i]._id=i;e.sort(t);var r,o,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===n&&(r=[]),s&&s.length===n&&(o=[]);for(var i=0;i<n;i++){var c=e[i]._id;r&&r.push(a[c]),o&&o.push(s[c])}r&&(this.faceVertexUvs[0]=r),o&&(this.faceVertexUvs[1]=o)},toJSON:function(){function t(t,e,n){return n?t|1<<e:t&~(1<<e)}function e(t){var e=t.x.toString()+t.y.toString()+t.z.toString();return void 0!==d[e]?d[e]:(d[e]=h.length/3,h.push(t.x,t.y,t.z),d[e])}function n(t){var e=t.r.toString()+t.g.toString()+t.b.toString();return void 0!==f[e]?f[e]:(f[e]=p.length,p.push(t.getHex()),f[e])}function i(t){var e=t.x.toString()+t.y.toString();return void 0!==g[e]?g[e]:(g[e]=m.length/2,m.push(t.x,t.y),g[e])}var r={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),void 0!==this.parameters){var o=this.parameters;for(var a in o)void 0!==o[a]&&(r[a]=o[a]);return r}for(var s=[],c=0;c<this.vertices.length;c++){var u=this.vertices[c];s.push(u.x,u.y,u.z)}for(var l=[],h=[],d={},p=[],f={},m=[],g={},c=0;c<this.faces.length;c++){var v=this.faces[c],y=void 0!==this.faceVertexUvs[0][c],_=v.normal.length()>0,x=v.vertexNormals.length>0,b=1!==v.color.r||1!==v.color.g||1!==v.color.b,w=v.vertexColors.length>0,E=0;if(E=t(E,0,0),E=t(E,1,!0),E=t(E,2,!1),E=t(E,3,y),E=t(E,4,_),E=t(E,5,x),E=t(E,6,b),E=t(E,7,w),l.push(E),l.push(v.a,v.b,v.c),l.push(v.materialIndex),y){var M=this.faceVertexUvs[0][c];l.push(i(M[0]),i(M[1]),i(M[2]))}if(_&&l.push(e(v.normal)),x){var T=v.vertexNormals;l.push(e(T[0]),e(T[1]),e(T[2]))}if(b&&l.push(n(v.color)),w){var S=v.vertexColors;l.push(n(S[0]),n(S[1]),n(S[2]))}}return r.data={},r.data.vertices=s,r.data.normals=h,p.length>0&&(r.data.colors=p),m.length>0&&(r.data.uvs=[m]),r.data.faces=l,r},clone:function(){return(new Rt).copy(this)},copy:function(t){var e,n,i,r,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var s=t.vertices;for(e=0,n=s.length;e<n;e++)this.vertices.push(s[e].clone());var c=t.colors;for(e=0,n=c.length;e<n;e++)this.colors.push(c[e].clone());var u=t.faces;for(e=0,n=u.length;e<n;e++)this.faces.push(u[e].clone());for(e=0,n=t.faceVertexUvs.length;e<n;e++){var l=t.faceVertexUvs[e];for(void 0===this.faceVertexUvs[e]&&(this.faceVertexUvs[e]=[]),i=0,r=l.length;i<r;i++){var h=l[i],d=[];for(o=0,a=h.length;o<a;o++){var p=h[o];d.push(p.clone())}this.faceVertexUvs[e].push(d)}}var f=t.morphTargets;for(e=0,n=f.length;e<n;e++){var m={};if(m.name=f[e].name,void 0!==f[e].vertices)for(m.vertices=[],i=0,r=f[e].vertices.length;i<r;i++)m.vertices.push(f[e].vertices[i].clone());if(void 0!==f[e].normals)for(m.normals=[],i=0,r=f[e].normals.length;i<r;i++)m.normals.push(f[e].normals[i].clone());this.morphTargets.push(m)}var g=t.morphNormals;for(e=0,n=g.length;e<n;e++){var v={};if(void 0!==g[e].vertexNormals)for(v.vertexNormals=[],i=0,r=g[e].vertexNormals.length;i<r;i++){var y=g[e].vertexNormals[i],_={};_.a=y.a.clone(),_.b=y.b.clone(),_.c=y.c.clone(),v.vertexNormals.push(_)}if(void 0!==g[e].faceNormals)for(v.faceNormals=[],i=0,r=g[e].faceNormals.length;i<r;i++)v.faceNormals.push(g[e].faceNormals[i].clone());this.morphNormals.push(v)}var x=t.skinWeights;for(e=0,n=x.length;e<n;e++)this.skinWeights.push(x[e].clone());var b=t.skinIndices;for(e=0,n=b.length;e<n;e++)this.skinIndices.push(b[e].clone());var w=t.lineDistances;for(e=0,n=w.length;e<n;e++)this.lineDistances.push(w[e]);var E=t.boundingBox;null!==E&&(this.boundingBox=E.clone());var M=t.boundingSphere;return null!==M&&(this.boundingSphere=M.clone()),this.elementsNeedUpdate=t.elementsNeedUpdate,this.verticesNeedUpdate=t.verticesNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.lineDistancesNeedUpdate=t.lineDistancesNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Lt.MaxIndex=65535,Object.assign(Lt.prototype,i.prototype,{isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(St(t)>65535?wt:xt)(t,1):this.index=t},addAttribute:function(t,e){return!1===(e&&e.isBufferAttribute)&&!1===(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(t,new mt(arguments[1],arguments[2]))):"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(e)):(this.attributes[t]=e,this)},getAttribute:function(t){return this.attributes[t]},removeAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix:function(t){var e=this.attributes.position;void 0!==e&&(t.applyToBufferAttribute(e),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){(new it).getNormalMatrix(t).applyToBufferAttribute(n),n.needsUpdate=!0}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var t=new h;return function(e){return t.makeRotationX(e),this.applyMatrix(t),this}}(),rotateY:function(){var t=new h;return function(e){return t.makeRotationY(e),this.applyMatrix(t),this}}(),rotateZ:function(){var t=new h;return function(e){return t.makeRotationZ(e),this.applyMatrix(t),this}}(),translate:function(){var t=new h;return function(e,n,i){return t.makeTranslation(e,n,i),this.applyMatrix(t),this}}(),scale:function(){var t=new h;return function(e,n,i){return t.makeScale(e,n,i),this.applyMatrix(t),this}}(),lookAt:function(){var t=new lt;return function(e){t.lookAt(e),t.updateMatrix(),this.applyMatrix(t.matrix)}}(),center:function(){this.computeBoundingBox();var t=this.boundingBox.getCenter().negate();return this.translate(t.x,t.y,t.z),t},setFromObject:function(t){var e=t.geometry;if(t.isPoints||t.isLine){var n=new Et(3*e.vertices.length,3),i=new Et(3*e.colors.length,3);if(this.addAttribute("position",n.copyVector3sArray(e.vertices)),this.addAttribute("color",i.copyColorsArray(e.colors)),e.lineDistances&&e.lineDistances.length===e.vertices.length){var r=new Et(e.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(e.lineDistances))}null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone())}else t.isMesh&&e&&e.isGeometry&&this.fromGeometry(e);return this},updateFromObject:function(t){var e=t.geometry;if(t.isMesh){var n=e.__directGeometry;if(!0===e.elementsNeedUpdate&&(n=void 0,e.elementsNeedUpdate=!1),void 0===n)return this.fromGeometry(e);n.verticesNeedUpdate=e.verticesNeedUpdate,n.normalsNeedUpdate=e.normalsNeedUpdate,n.colorsNeedUpdate=e.colorsNeedUpdate,n.uvsNeedUpdate=e.uvsNeedUpdate,n.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=n}var i;return!0===e.verticesNeedUpdate&&(i=this.attributes.position,void 0!==i&&(i.copyVector3sArray(e.vertices),i.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(i=this.attributes.normal,void 0!==i&&(i.copyVector3sArray(e.normals),i.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(i=this.attributes.color,void 0!==i&&(i.copyColorsArray(e.colors),i.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(i=this.attributes.uv,void 0!==i&&(i.copyVector2sArray(e.uvs),i.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(i=this.attributes.lineDistance,void 0!==i&&(i.copyArray(e.lineDistances),i.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.__directGeometry=(new Tt).fromGeometry(t),this.fromDirectGeometry(t.__directGeometry)},fromDirectGeometry:function(t){var e=new Float32Array(3*t.vertices.length);if(this.addAttribute("position",new mt(e,3).copyVector3sArray(t.vertices)),t.normals.length>0){var n=new Float32Array(3*t.normals.length);this.addAttribute("normal",new mt(n,3).copyVector3sArray(t.normals))}if(t.colors.length>0){var i=new Float32Array(3*t.colors.length);this.addAttribute("color",new mt(i,3).copyColorsArray(t.colors))}if(t.uvs.length>0){var r=new Float32Array(2*t.uvs.length);this.addAttribute("uv",new mt(r,2).copyVector2sArray(t.uvs))}if(t.uvs2.length>0){var o=new Float32Array(2*t.uvs2.length);this.addAttribute("uv2",new mt(o,2).copyVector2sArray(t.uvs2))}if(t.indices.length>0){var a=St(t.indices)>65535?Uint32Array:Uint16Array,s=new a(3*t.indices.length);this.setIndex(new mt(s,1).copyIndicesArray(t.indices))}this.groups=t.groups;for(var c in t.morphTargets){for(var u=[],l=t.morphTargets[c],h=0,d=l.length;h<d;h++){var p=l[h],f=new Et(3*p.length,3);u.push(f.copyVector3sArray(p))}this.morphAttributes[c]=u}if(t.skinIndices.length>0){var m=new Et(4*t.skinIndices.length,4);this.addAttribute("skinIndex",m.copyVector4sArray(t.skinIndices))}if(t.skinWeights.length>0){var g=new Et(4*t.skinWeights.length,4);this.addAttribute("skinWeight",g.copyVector4sArray(t.skinWeights))}return null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et);var t=this.attributes.position;void 0!==t?this.boundingBox.setFromBufferAttribute(t):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var t=new et,e=new l;return function(){null===this.boundingSphere&&(this.boundingSphere=new nt);var n=this.attributes.position;if(n){var i=this.boundingSphere.center;t.setFromBufferAttribute(n),t.getCenter(i);for(var r=0,o=0,a=n.count;o<a;o++)e.x=n.getX(o),e.y=n.getY(o),e.z=n.getZ(o),r=Math.max(r,i.distanceToSquared(e));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,e=this.attributes,n=this.groups;if(e.position){var i=e.position.array;if(void 0===e.normal)this.addAttribute("normal",new mt(new Float32Array(i.length),3));else for(var r=e.normal.array,o=0,a=r.length;o<a;o++)r[o]=0;var s,c,u,h=e.normal.array,d=new l,p=new l,f=new l,m=new l,g=new l;if(t){var v=t.array;0===n.length&&this.addGroup(0,v.length);for(var y=0,_=n.length;y<_;++y)for(var x=n[y],b=x.start,w=x.count,o=b,a=b+w;o<a;o+=3)s=3*v[o+0],c=3*v[o+1],u=3*v[o+2],d.fromArray(i,s),p.fromArray(i,c),f.fromArray(i,u),m.subVectors(f,p),g.subVectors(d,p),m.cross(g),h[s]+=m.x,h[s+1]+=m.y,h[s+2]+=m.z,h[c]+=m.x,h[c+1]+=m.y,h[c+2]+=m.z,h[u]+=m.x,h[u+1]+=m.y,h[u+2]+=m.z}else for(var o=0,a=i.length;o<a;o+=9)d.fromArray(i,o),p.fromArray(i,o+3),f.fromArray(i,o+6),m.subVectors(f,p),g.subVectors(d,p),m.cross(g),h[o]=m.x,h[o+1]=m.y,h[o+2]=m.z,h[o+3]=m.x,h[o+4]=m.y,h[o+5]=m.z,h[o+6]=m.x,h[o+7]=m.y,h[o+8]=m.z;this.normalizeNormals(),e.normal.needsUpdate=!0}},merge:function(t,e){if(!1===(t&&t.isBufferGeometry))return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0);var n=this.attributes;for(var i in n)if(void 0!==t.attributes[i])for(var r=n[i],o=r.array,a=t.attributes[i],s=a.array,c=a.itemSize,u=0,l=c*e;u<s.length;u++,l++)o[l]=s[u];return this},normalizeNormals:function(){for(var t,e,n,i,r=this.attributes.normal,o=0,a=r.count;o<a;o++)t=r.getX(o),e=r.getY(o),n=r.getZ(o),i=1/Math.sqrt(t*t+e*e+n*n),r.setXYZ(o,t*i,e*i,n*i)},toNonIndexed:function(){if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new Lt,e=this.index.array,n=this.attributes;for(var i in n){for(var r=n[i],o=r.array,a=r.itemSize,s=new o.constructor(e.length*a),c=0,u=0,l=0,h=e.length;l<h;l++){c=e[l]*a;for(var d=0;d<a;d++)s[u++]=o[c++]}t.addAttribute(i,new mt(s,a))}return t},toJSON:function(){var t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var i=this.index;if(null!==i){var r=Array.prototype.slice.call(i.array);t.data.index={type:i.array.constructor.name,array:r}}var o=this.attributes;for(var n in o){var a=o[n],r=Array.prototype.slice.call(a.array);t.data.attributes[n]={itemSize:a.itemSize,type:a.array.constructor.name,array:r,normalized:a.normalized}}var s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t},clone:function(){return(new Lt).copy(this)},copy:function(t){var e,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=t.name;var r=t.index;null!==r&&this.setIndex(r.clone());var o=t.attributes;for(e in o){var a=o[e];this.addAttribute(e,a.clone())}var s=t.morphAttributes;for(e in s){var c=[],u=s[e];for(n=0,i=u.length;n<i;n++)c.push(u[n].clone());this.morphAttributes[e]=c}var l=t.groups;for(n=0,i=l.length;n<i;n++){var h=l[n];this.addGroup(h.start,h.count,h.materialIndex)}var d=t.boundingBox;null!==d&&(this.boundingBox=d.clone());var p=t.boundingSphere;return null!==p&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Ct.prototype=Object.assign(Object.create(lt.prototype),{constructor:Ct,isMesh:!0,setDrawMode:function(t){this.drawMode=t},copy:function(t){return lt.prototype.copy.call(this,t),this.drawMode=t.drawMode,this},updateMorphTargets:function(){var t=this.geometry.morphTargets;if(void 0!==t&&t.length>0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var e=0,n=t.length;e<n;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[t[e].name]=e}},raycast:function(){function t(t,e,n,i,r,o,a){return dt.barycoordFromPoint(t,e,n,i,y),r.multiplyScalar(y.x),o.multiplyScalar(y.y),a.multiplyScalar(y.z),r.add(o).add(a),r.clone()}function e(t,e,n,i,r,o,a){var s=t.material;if(null===(s.side===yo?n.intersectTriangle(o,r,i,!0,a):n.intersectTriangle(i,r,o,s.side!==_o,a)))return null;x.copy(a),x.applyMatrix4(t.matrixWorld);var c=e.ray.origin.distanceTo(x);return c<e.near||c>e.far?null:{distance:c,point:x.clone(),object:t}}function n(n,i,r,o,a,l,h,d){s.fromBufferAttribute(o,l),c.fromBufferAttribute(o,h),u.fromBufferAttribute(o,d);var p=e(n,i,r,s,c,u,_);return p&&(a&&(m.fromBufferAttribute(a,l),g.fromBufferAttribute(a,h),v.fromBufferAttribute(a,d),p.uv=t(_,s,c,u,m,g,v)),p.face=new pt(l,h,d,dt.normal(s,c,u)),p.faceIndex=l),p}var i=new h,o=new st,a=new nt,s=new l,c=new l,u=new l,d=new l,p=new l,f=new l,m=new r,g=new r,v=new r,y=new l,_=new l,x=new l;return function(r,l){var h=this.geometry,y=this.material,x=this.matrixWorld;if(void 0!==y&&(null===h.boundingSphere&&h.computeBoundingSphere(),a.copy(h.boundingSphere),a.applyMatrix4(x),!1!==r.ray.intersectsSphere(a)&&(i.getInverse(x),o.copy(r.ray).applyMatrix4(i),null===h.boundingBox||!1!==o.intersectsBox(h.boundingBox)))){var b;if(h.isBufferGeometry){var w,E,M,T,S,A=h.index,R=h.attributes.position,L=h.attributes.uv;if(null!==A)for(T=0,S=A.count;T<S;T+=3)w=A.getX(T),E=A.getX(T+1),M=A.getX(T+2),(b=n(this,r,o,R,L,w,E,M))&&(b.faceIndex=Math.floor(T/3),l.push(b));else for(T=0,S=R.count;T<S;T+=3)w=T,E=T+1,M=T+2,(b=n(this,r,o,R,L,w,E,M))&&(b.index=w,l.push(b))}else if(h.isGeometry){var C,P,O,I,N=Array.isArray(y),U=h.vertices,D=h.faces,F=h.faceVertexUvs[0];F.length>0&&(I=F);for(var B=0,z=D.length;B<z;B++){var G=D[B],k=N?y[G.materialIndex]:y;if(void 0!==k){if(C=U[G.a],P=U[G.b],O=U[G.c],!0===k.morphTargets){var H=h.morphTargets,V=this.morphTargetInfluences;s.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(var j=0,W=H.length;j<W;j++){var X=V[j];if(0!==X){var Y=H[j].vertices;s.addScaledVector(d.subVectors(Y[G.a],C),X),c.addScaledVector(p.subVectors(Y[G.b],P),X),u.addScaledVector(f.subVectors(Y[G.c],O),X)}}s.add(C),c.add(P),u.add(O),C=s,P=c,O=u}if(b=e(this,r,o,C,P,O,_)){if(I&&I[B]){var q=I[B];m.copy(q[0]),g.copy(q[1]),v.copy(q[2]),b.uv=t(_,C,P,O,m,g,v)}b.face=G,b.faceIndex=B,l.push(b)}}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Pt.prototype=Object.create(Rt.prototype),Pt.prototype.constructor=Pt,Ot.prototype=Object.create(Lt.prototype),Ot.prototype.constructor=Ot,It.prototype=Object.create(Rt.prototype),It.prototype.constructor=It,Nt.prototype=Object.create(Lt.prototype),Nt.prototype.constructor=Nt,Ut.prototype=Object.assign(Object.create(lt.prototype),{constructor:Ut,isCamera:!0,copy:function(t){return lt.prototype.copy.call(this,t),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this},getWorldDirection:function(){var t=new u;return function(e){var n=e||new l;return this.getWorldQuaternion(t),n.set(0,0,-1).applyQuaternion(t)}}(),clone:function(){return(new this.constructor).copy(this)}}),Dt.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Dt,isPerspectiveCamera:!0,copy:function(t){return Ut.prototype.copy.call(this,t),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*Es.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*Es.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*Es.RAD2DEG*Math.atan(Math.tan(.5*Es.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,i,r,o){this.aspect=t/e,this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*Es.DEG2RAD*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i,o=this.view;if(null!==o){var a=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/a,e-=o.offsetY*n/s,i*=o.width/a,n*=o.height/s}var c=this.filmOffset;0!==c&&(r+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far)},toJSON:function(t){var e=lt.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}),Ft.prototype=Object.assign(Object.create(Ut.prototype),{constructor:Ft,isOrthographicCamera:!0,copy:function(t){return Ut.prototype.copy.call(this,t),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,e,n,i,r,o){this.view={fullWidth:t,fullHeight:e,offsetX:n,offsetY:i,width:r,height:o},this.updateProjectionMatrix()},clearViewOffset:function(){this.view=null,this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-t,o=n+t,a=i+e,s=i-e;if(null!==this.view){var c=this.zoom/(this.view.width/this.view.fullWidth),u=this.zoom/(this.view.height/this.view.fullHeight),l=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;r+=l*(this.view.offsetX/c),o=r+l*(this.view.width/c),a-=h*(this.view.offsetY/u),s=a-h*(this.view.height/u)}this.projectionMatrix.makeOrthographic(r,o,a,s,this.near,this.far)},toJSON:function(t){var e=lt.prototype.toJSON.call(this,t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}});var Gs=0;ge.prototype.isFogExp2=!0,ge.prototype.clone=function(){return new ge(this.color.getHex(),this.density)},ge.prototype.toJSON=function(t){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},ve.prototype.isFog=!0,ve.prototype.clone=function(){return new ve(this.color.getHex(),this.near,this.far)},ve.prototype.toJSON=function(t){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},ye.prototype=Object.assign(Object.create(lt.prototype),{constructor:ye,copy:function(t,e){return lt.prototype.copy.call(this,t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},toJSON:function(t){var e=lt.prototype.toJSON.call(this,t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}),_e.prototype=Object.assign(Object.create(lt.prototype),{constructor:_e,isLensFlare:!0,copy:function(t){lt.prototype.copy.call(this,t),this.positionScreen.copy(t.positionScreen),this.customUpdateCallback=t.customUpdateCallback;for(var e=0,n=t.lensFlares.length;e<n;e++)this.lensFlares.push(t.lensFlares[e]);return this},add:function(t,e,n,i,r,o){void 0===e&&(e=-1),void 0===n&&(n=0),void 0===o&&(o=1),void 0===r&&(r=new q(16777215)),void 0===i&&(i=So),n=Math.min(n,Math.max(0,n)),this.lensFlares.push({texture:t,size:e,distance:n,x:0,y:0,z:0,scale:1,rotation:0,opacity:o,color:r,blending:i})},updateLensFlares:function(){var t,e,n=this.lensFlares.length,i=2*-this.positionScreen.x,r=2*-this.positionScreen.y;for(t=0;t<n;t++)e=this.lensFlares[t],e.x=this.positionScreen.x+i*e.distance,e.y=this.positionScreen.y+r*e.distance,e.wantedRotation=e.x*Math.PI*.25,e.rotation+=.25*(e.wantedRotation-e.rotation)}}),xe.prototype=Object.create(Q.prototype),xe.prototype.constructor=xe,xe.prototype.isSpriteMaterial=!0,xe.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.rotation=t.rotation,this},be.prototype=Object.assign(Object.create(lt.prototype),{constructor:be,isSprite:!0,raycast:function(){var t=new l,e=new l,n=new l;return function(i,r){e.setFromMatrixPosition(this.matrixWorld),i.ray.closestPointToPoint(e,t),n.setFromMatrixScale(this.matrixWorld);var o=n.x*n.y/4;if(!(e.distanceToSquared(t)>o)){var a=i.ray.origin.distanceTo(t);a<i.near||a>i.far||r.push({distance:a,point:t.clone(),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)}}),we.prototype=Object.assign(Object.create(lt.prototype),{constructor:we,copy:function(t){lt.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,i=e.length;n<i;n++){var r=e[n];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(t,e){void 0===e&&(e=0),e=Math.abs(e);for(var n=this.levels,i=0;i<n.length&&!(e<n[i].distance);i++);n.splice(i,0,{distance:e,object:t}),this.add(t)},getObjectForDistance:function(t){for(var e=this.levels,n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object},raycast:function(){var t=new l;return function(e,n){t.setFromMatrixPosition(this.matrixWorld);var i=e.ray.origin.distanceTo(t);this.getObjectForDistance(i).raycast(e,n)}}(),update:function(){var t=new l,e=new l;return function(n){var i=this.levels;if(i.length>1){t.setFromMatrixPosition(n.matrixWorld),e.setFromMatrixPosition(this.matrixWorld);var r=t.distanceTo(e);i[0].object.visible=!0;for(var o=1,a=i.length;o<a&&r>=i[o].distance;o++)i[o-1].object.visible=!1,i[o].object.visible=!0;for(;o<a;o++)i[o].object.visible=!1}}}(),toJSON:function(t){var e=lt.prototype.toJSON.call(this,t);e.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var o=n[i];e.object.levels.push({object:o.object.uuid,distance:o.distance})}return e}}),Object.assign(Ee.prototype,{calculateInverses:function(){this.boneInverses=[];for(var t=0,e=this.bones.length;t<e;t++){var n=new h;this.bones[t]&&n.getInverse(this.bones[t].matrixWorld),this.boneInverses.push(n)}},pose:function(){var t,e,n;for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&t.matrixWorld.getInverse(this.boneInverses[e]);for(e=0,n=this.bones.length;e<n;e++)(t=this.bones[e])&&(t.parent&&t.parent.isBone?(t.matrix.getInverse(t.parent.matrixWorld),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))},update:function(){var t=new h,e=new h;return function(){for(var n=this.bones,i=this.boneInverses,r=this.boneMatrices,o=this.boneTexture,a=0,s=n.length;a<s;a++){var c=n[a]?n[a].matrixWorld:e;t.multiplyMatrices(c,i[a]),t.toArray(r,16*a)}void 0!==o&&(o.needsUpdate=!0)}}(),clone:function(){return new Ee(this.bones,this.boneInverses)}}),Me.prototype=Object.assign(Object.create(lt.prototype),{constructor:Me,isBone:!0}),Te.prototype=Object.assign(Object.create(Ct.prototype),{constructor:Te,isSkinnedMesh:!0,initBones:function(){var t,e,n,i,r=[];if(this.geometry&&void 0!==this.geometry.bones){for(n=0,i=this.geometry.bones.length;n<i;n++)e=this.geometry.bones[n],t=new Me,r.push(t),t.name=e.name,t.position.fromArray(e.pos),t.quaternion.fromArray(e.rotq),void 0!==e.scl&&t.scale.fromArray(e.scl);for(n=0,i=this.geometry.bones.length;n<i;n++)e=this.geometry.bones[n],-1!==e.parent&&null!==e.parent&&void 0!==r[e.parent]?r[e.parent].add(r[n]):this.add(r[n])}return this.updateMatrixWorld(!0),r},bind:function(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.getInverse(e)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){var t,e;if(this.geometry&&this.geometry.isGeometry)for(e=0;e<this.geometry.skinWeights.length;e++){var n=this.geometry.skinWeights[e];t=1/n.lengthManhattan(),t!==1/0?n.multiplyScalar(t):n.set(1,0,0,0)}else if(this.geometry&&this.geometry.isBufferGeometry){var i=new a,r=this.geometry.attributes.skinWeight;for(e=0;e<r.count;e++)i.x=r.getX(e),i.y=r.getY(e),i.z=r.getZ(e),i.w=r.getW(e),t=1/i.lengthManhattan(),t!==1/0?i.multiplyScalar(t):i.set(1,0,0,0),r.setXYZW(e,i.x,i.y,i.z,i.w)}},updateMatrixWorld:function(t){Ct.prototype.updateMatrixWorld.call(this,t),"attached"===this.bindMode?this.bindMatrixInverse.getInverse(this.matrixWorld):"detached"===this.bindMode?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Se.prototype=Object.create(Q.prototype),Se.prototype.constructor=Se,Se.prototype.isLineBasicMaterial=!0,Se.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},Ae.prototype=Object.assign(Object.create(lt.prototype),{constructor:Ae,isLine:!0,raycast:function(){var t=new h,e=new st,n=new nt;return function(i,r){var o=i.linePrecision,a=o*o,s=this.geometry,c=this.matrixWorld;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),!1!==i.ray.intersectsSphere(n)){t.getInverse(c),e.copy(i.ray).applyMatrix4(t);var u=new l,h=new l,d=new l,p=new l,f=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var m=s.index,g=s.attributes,v=g.position.array;if(null!==m)for(var y=m.array,_=0,x=y.length-1;_<x;_+=f){var b=y[_],w=y[_+1];u.fromArray(v,3*b),h.fromArray(v,3*w);var E=e.distanceSqToSegment(u,h,p,d);if(!(E>a)){p.applyMatrix4(this.matrixWorld);var M=i.ray.origin.distanceTo(p);M<i.near||M>i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else for(var _=0,x=v.length/3-1;_<x;_+=f){u.fromArray(v,3*_),h.fromArray(v,3*_+3);var E=e.distanceSqToSegment(u,h,p,d);if(!(E>a)){p.applyMatrix4(this.matrixWorld);var M=i.ray.origin.distanceTo(p);M<i.near||M>i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var T=s.vertices,S=T.length,_=0;_<S-1;_+=f){var E=e.distanceSqToSegment(T[_],T[_+1],p,d);if(!(E>a)){p.applyMatrix4(this.matrixWorld);var M=i.ray.origin.distanceTo(p);M<i.near||M>i.far||r.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Re.prototype=Object.assign(Object.create(Ae.prototype),{constructor:Re,isLineSegments:!0}),Le.prototype=Object.assign(Object.create(Ae.prototype),{constructor:Le,isLineLoop:!0}),Ce.prototype=Object.create(Q.prototype),Ce.prototype.constructor=Ce,Ce.prototype.isPointsMaterial=!0,Ce.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this},Pe.prototype=Object.assign(Object.create(lt.prototype),{constructor:Pe,isPoints:!0,raycast:function(){var t=new h,e=new st,n=new nt;return function(i,r){function o(t,n){var o=e.distanceSqToPoint(t);if(o<d){var s=e.closestPointToPoint(t);s.applyMatrix4(c);var u=i.ray.origin.distanceTo(s);if(u<i.near||u>i.far)return;r.push({distance:u,distanceToRay:Math.sqrt(o),point:s.clone(),index:n,face:null,object:a})}}var a=this,s=this.geometry,c=this.matrixWorld,u=i.params.Points.threshold;if(null===s.boundingSphere&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(c),n.radius+=u,!1!==i.ray.intersectsSphere(n)){t.getInverse(c),e.copy(i.ray).applyMatrix4(t);var h=u/((this.scale.x+this.scale.y+this.scale.z)/3),d=h*h,p=new l;if(s.isBufferGeometry){var f=s.index,m=s.attributes,g=m.position.array;if(null!==f)for(var v=f.array,y=0,_=v.length;y<_;y++){var x=v[y];p.fromArray(g,3*x),o(p,x)}else for(var y=0,b=g.length/3;y<b;y++)p.fromArray(g,3*y),o(p,y)}else for(var w=s.vertices,y=0,b=w.length;y<b;y++)o(w[y],y)}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Oe.prototype=Object.assign(Object.create(lt.prototype),{constructor:Oe}),Ie.prototype=Object.create(o.prototype),Ie.prototype.constructor=Ie,Ne.prototype=Object.create(o.prototype),Ne.prototype.constructor=Ne,Ne.prototype.isCompressedTexture=!0,Ue.prototype=Object.create(o.prototype),Ue.prototype.constructor=Ue,De.prototype=Object.create(o.prototype),De.prototype.constructor=De,De.prototype.isDepthTexture=!0,Fe.prototype=Object.create(Lt.prototype),Fe.prototype.constructor=Fe,Be.prototype=Object.create(Rt.prototype),Be.prototype.constructor=Be,ze.prototype=Object.create(Lt.prototype),ze.prototype.constructor=ze,Ge.prototype=Object.create(Rt.prototype),Ge.prototype.constructor=Ge,ke.prototype=Object.create(Lt.prototype),ke.prototype.constructor=ke,He.prototype=Object.create(Rt.prototype),He.prototype.constructor=He,Ve.prototype=Object.create(ke.prototype),Ve.prototype.constructor=Ve,je.prototype=Object.create(Rt.prototype),je.prototype.constructor=je,We.prototype=Object.create(ke.prototype),We.prototype.constructor=We,Xe.prototype=Object.create(Rt.prototype),Xe.prototype.constructor=Xe,Ye.prototype=Object.create(ke.prototype),Ye.prototype.constructor=Ye,qe.prototype=Object.create(Rt.prototype),qe.prototype.constructor=qe,Ze.prototype=Object.create(ke.prototype),Ze.prototype.constructor=Ze,Je.prototype=Object.create(Rt.prototype),Je.prototype.constructor=Je,Ke.prototype=Object.create(Lt.prototype),Ke.prototype.constructor=Ke,Qe.prototype=Object.create(Rt.prototype),Qe.prototype.constructor=Qe,$e.prototype=Object.create(Lt.prototype),$e.prototype.constructor=$e,tn.prototype=Object.create(Rt.prototype),tn.prototype.constructor=tn,en.prototype=Object.create(Lt.prototype),en.prototype.constructor=en;var ks={area:function(t){for(var e=t.length,n=0,i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n},triangulate:function(){function t(t,e,n,i,r,o){var a,s,c,u,l,h,d,p,f;if(s=t[o[e]].x,c=t[o[e]].y,u=t[o[n]].x,l=t[o[n]].y,h=t[o[i]].x,d=t[o[i]].y,(u-s)*(d-c)-(l-c)*(h-s)<=0)return!1;var m,g,v,y,_,x,b,w,E,M,T,S,A,R,L;for(m=h-u,g=d-l,v=s-h,y=c-d,_=u-s,x=l-c,a=0;a<r;a++)if(p=t[o[a]].x,f=t[o[a]].y,!(p===s&&f===c||p===u&&f===l||p===h&&f===d)&&(b=p-s,w=f-c,E=p-u,M=f-l,T=p-h,S=f-d,L=m*M-g*E,A=_*w-x*b,R=v*S-y*T,L>=-Number.EPSILON&&R>=-Number.EPSILON&&A>=-Number.EPSILON))return!1;return!0}return function(e,n){var i=e.length;if(i<3)return null;var r,o,a,s=[],c=[],u=[];if(ks.area(e)>0)for(o=0;o<i;o++)c[o]=o;else for(o=0;o<i;o++)c[o]=i-1-o;var l=i,h=2*l;for(o=l-1;l>2;){if(h--<=0)return console.warn("THREE.ShapeUtils: Unable to triangulate polygon! in triangulate()"),n?u:s;if(r=o,l<=r&&(r=0),o=r+1,l<=o&&(o=0),a=o+1,l<=a&&(a=0),t(e,r,o,a,l,c)){var d,p,f,m,g;for(d=c[r],p=c[o],f=c[a],s.push([e[d],e[p],e[f]]),u.push([c[r],c[o],c[a]]),m=o,g=o+1;g<l;m++,g++)c[m]=c[g];l--,h=2*l}}return n?u:s}}(),triangulateShape:function(t,e){function n(t){var e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function i(t,e,n){return t.x!==e.x?t.x<e.x?t.x<=n.x&&n.x<=e.x:e.x<=n.x&&n.x<=t.x:t.y<e.y?t.y<=n.y&&n.y<=e.y:e.y<=n.y&&n.y<=t.y}function r(t,e,n,r,o){var a=e.x-t.x,s=e.y-t.y,c=r.x-n.x,u=r.y-n.y,l=t.x-n.x,h=t.y-n.y,d=s*c-a*u,p=s*l-a*h;if(Math.abs(d)>Number.EPSILON){var f;if(d>0){if(p<0||p>d)return[];if((f=u*l-c*h)<0||f>d)return[]}else{if(p>0||p<d)return[];if((f=u*l-c*h)>0||f<d)return[]}if(0===f)return!o||0!==p&&p!==d?[t]:[];if(f===d)return!o||0!==p&&p!==d?[e]:[];if(0===p)return[n];if(p===d)return[r];var m=f/d;return[{x:t.x+m*a,y:t.y+m*s}]}if(0!==p||u*l!=c*h)return[];var g=0===a&&0===s,v=0===c&&0===u;if(g&&v)return t.x!==n.x||t.y!==n.y?[]:[t];if(g)return i(n,r,t)?[t]:[];if(v)return i(t,e,n)?[n]:[];var y,_,x,b,w,E,M,T;return 0!==a?(t.x<e.x?(y=t,x=t.x,_=e,b=e.x):(y=e,x=e.x,_=t,b=t.x),n.x<r.x?(w=n,M=n.x,E=r,T=r.x):(w=r,M=r.x,E=n,T=n.x)):(t.y<e.y?(y=t,x=t.y,_=e,b=e.y):(y=e,x=e.y,_=t,b=t.y),n.y<r.y?(w=n,M=n.y,E=r,T=r.y):(w=r,M=r.y,E=n,T=n.y)),x<=M?b<M?[]:b===M?o?[]:[w]:b<=T?[w,_]:[w,E]:x>T?[]:x===T?o?[]:[y]:b<=T?[y,_]:[y,E]}function o(t,e,n,i){var r=e.x-t.x,o=e.y-t.y,a=n.x-t.x,s=n.y-t.y,c=i.x-t.x,u=i.y-t.y,l=r*s-o*a,h=r*u-o*c;if(Math.abs(l)>Number.EPSILON){var d=c*s-u*a;return l>0?h>=0&&d>=0:h>=0||d>=0}return h>0}n(t),e.forEach(n);for(var a,s,c,u,l,h,d={},p=t.concat(),f=0,m=e.length;f<m;f++)Array.prototype.push.apply(p,e[f]);for(a=0,s=p.length;a<s;a++)l=p[a].x+":"+p[a].y,void 0!==d[l]&&console.warn("THREE.ShapeUtils: Duplicate point",l,a),d[l]=a;var g=function(t,e){for(var n,i,a,s,c,u,l,h,d,p,f,m=t.concat(),g=[],v=[],y=0,_=e.length;y<_;y++)g.push(y);for(var x=0,b=2*g.length;g.length>0;){if(--b<0){console.log("Infinite Loop! Holes left:"+g.length+", Probably Hole outside Shape!");break}for(a=x;a<m.length;a++){s=m[a],i=-1;for(var y=0;y<g.length;y++)if(u=g[y],l=s.x+":"+s.y+":"+u,void 0===v[l]){n=e[u];for(var w=0;w<n.length;w++)if(c=n[w],function(t,e){var i=m.length-1,r=t-1;r<0&&(r=i);var a=t+1;a>i&&(a=0);var s=o(m[t],m[r],m[a],n[e]);if(!s)return!1;var c=n.length-1,u=e-1;u<0&&(u=c);var l=e+1;return l>c&&(l=0),!!(s=o(n[e],n[u],n[l],m[t]))}(a,w)&&!function(t,e){var n,i,o;for(n=0;n<m.length;n++)if(i=n+1,i%=m.length,o=r(t,e,m[n],m[i],!0),o.length>0)return!0;return!1}(s,c)&&!function(t,n){var i,o,a,s,c;for(i=0;i<g.length;i++)for(o=e[g[i]],a=0;a<o.length;a++)if(s=a+1,s%=o.length,c=r(t,n,o[a],o[s],!0),c.length>0)return!0;return!1}(s,c)){i=w,g.splice(y,1),h=m.slice(0,a+1),d=m.slice(a),p=n.slice(i),f=n.slice(0,i+1),m=h.concat(p).concat(f).concat(d),x=a;break}if(i>=0)break;v[l]=!0}if(i>=0)break}}return m}(t,e),v=ks.triangulate(g,!1);for(a=0,s=v.length;a<s;a++)for(u=v[a],c=0;c<3;c++)l=u[c].x+":"+u[c].y,void 0!==(h=d[l])&&(u[c]=h);return v.concat()},isClockWise:function(t){return ks.area(t)<0}};nn.prototype=Object.create(Rt.prototype),nn.prototype.constructor=nn,rn.prototype=Object.create(Lt.prototype),rn.prototype.constructor=rn,rn.prototype.getArrays=function(){var t=this.getAttribute("position"),e=t?Array.prototype.slice.call(t.array):[],n=this.getAttribute("uv"),i=n?Array.prototype.slice.call(n.array):[],r=this.index;return{position:e,uv:i,index:r?Array.prototype.slice.call(r.array):[]}},rn.prototype.addShapeList=function(t,e){var n=t.length;e.arrays=this.getArrays();for(var i=0;i<n;i++){var r=t[i];this.addShape(r,e)}this.setIndex(e.arrays.index),this.addAttribute("position",new Et(e.arrays.position,3)),this.addAttribute("uv",new Et(e.arrays.uv,2))},rn.prototype.addShape=function(t,e){function n(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}function i(t,e,n){var i,o,a=1,s=t.x-e.x,c=t.y-e.y,u=n.x-t.x,l=n.y-t.y,h=s*s+c*c,d=s*l-c*u;if(Math.abs(d)>Number.EPSILON){var p=Math.sqrt(h),f=Math.sqrt(u*u+l*l),m=e.x-c/p,g=e.y+s/p,v=n.x-l/f,y=n.y+u/f,_=((v-m)*l-(y-g)*u)/(s*l-c*u);i=m+s*_-t.x,o=g+c*_-t.y;var x=i*i+o*o;if(x<=2)return new r(i,o);a=Math.sqrt(x/2)}else{var b=!1;s>Number.EPSILON?u>Number.EPSILON&&(b=!0):s<-Number.EPSILON?u<-Number.EPSILON&&(b=!0):Math.sign(c)===Math.sign(l)&&(b=!0),b?(i=-c,o=s,a=Math.sqrt(h)):(i=s,o=c,a=Math.sqrt(h/2))}return new r(i/a,o/a)}function o(t,e){var n,i;for(K=t.length;--K>=0;){n=K,i=K-1,i<0&&(i=t.length-1);var r=0,o=R+2*T;for(r=0;r<o;r++){var a=q*r,s=q*(r+1);c(e+n+a,e+i+a,e+i+s,e+n+s,t,r,o,n,i)}}}function a(t,e,n){b.push(t),b.push(e),b.push(n)}function s(t,e,n){u(t),u(e),u(n);var i=y.length/3,r=P.generateTopUV(U,y,i-3,i-2,i-1);h(r[0]),h(r[1]),h(r[2])}function c(t,e,n,i,r,o,a,s,c){u(t),u(e),u(i),u(e),u(n),u(i);var l=y.length/3,d=P.generateSideWallUV(U,y,l-6,l-3,l-2,l-1);h(d[0]),h(d[1]),h(d[3]),h(d[1]),h(d[2]),h(d[3])}function u(t){_.push(y.length/3),y.push(b[3*t+0]),y.push(b[3*t+1]),y.push(b[3*t+2])}function h(t){x.push(t.x),x.push(t.y)}var d,p,f,m,g,v=e.arrays?e.arrays:this.getArrays(),y=v.position,_=v.index,x=v.uv,b=[],w=void 0!==e.amount?e.amount:100,E=void 0!==e.bevelThickness?e.bevelThickness:6,M=void 0!==e.bevelSize?e.bevelSize:E-2,T=void 0!==e.bevelSegments?e.bevelSegments:3,S=void 0===e.bevelEnabled||e.bevelEnabled,A=void 0!==e.curveSegments?e.curveSegments:12,R=void 0!==e.steps?e.steps:1,L=e.extrudePath,C=!1,P=void 0!==e.UVGenerator?e.UVGenerator:nn.WorldUVGenerator;L&&(d=L.getSpacedPoints(R),C=!0,S=!1,p=void 0!==e.frames?e.frames:L.computeFrenetFrames(R,!1),f=new l,m=new l,g=new l),S||(T=0,E=0,M=0);var O,I,N,U=this,D=t.extractPoints(A),F=D.shape,B=D.holes,z=!ks.isClockWise(F);if(z){for(F=F.reverse(),I=0,N=B.length;I<N;I++)O=B[I],ks.isClockWise(O)&&(B[I]=O.reverse());z=!1}var G=ks.triangulateShape(F,B),k=F;for(I=0,N=B.length;I<N;I++)O=B[I],F=F.concat(O);for(var H,V,j,W,X,Y,q=F.length,Z=G.length,J=[],K=0,Q=k.length,$=Q-1,tt=K+1;K<Q;K++,$++,tt++)$===Q&&($=0),tt===Q&&(tt=0),J[K]=i(k[K],k[$],k[tt]);var et,nt=[],it=J.concat();for(I=0,N=B.length;I<N;I++){for(O=B[I],et=[],K=0,Q=O.length,$=Q-1,tt=K+1;K<Q;K++,$++,tt++)$===Q&&($=0),tt===Q&&(tt=0),et[K]=i(O[K],O[$],O[tt]);nt.push(et),it=it.concat(et)}for(H=0;H<T;H++){for(j=H/T,W=E*Math.cos(j*Math.PI/2),V=M*Math.sin(j*Math.PI/2),K=0,Q=k.length;K<Q;K++)X=n(k[K],J[K],V),a(X.x,X.y,-W);for(I=0,N=B.length;I<N;I++)for(O=B[I],et=nt[I],K=0,Q=O.length;K<Q;K++)X=n(O[K],et[K],V),a(X.x,X.y,-W)}for(V=M,K=0;K<q;K++)X=S?n(F[K],it[K],V):F[K],C?(m.copy(p.normals[0]).multiplyScalar(X.x),f.copy(p.binormals[0]).multiplyScalar(X.y),g.copy(d[0]).add(m).add(f),a(g.x,g.y,g.z)):a(X.x,X.y,0);var rt;for(rt=1;rt<=R;rt++)for(K=0;K<q;K++)X=S?n(F[K],it[K],V):F[K],C?(m.copy(p.normals[rt]).multiplyScalar(X.x),f.copy(p.binormals[rt]).multiplyScalar(X.y),g.copy(d[rt]).add(m).add(f),a(g.x,g.y,g.z)):a(X.x,X.y,w/R*rt);for(H=T-1;H>=0;H--){for(j=H/T,W=E*Math.cos(j*Math.PI/2),V=M*Math.sin(j*Math.PI/2),K=0,Q=k.length;K<Q;K++)X=n(k[K],J[K],V),a(X.x,X.y,w+W);for(I=0,N=B.length;I<N;I++)for(O=B[I],et=nt[I],K=0,Q=O.length;K<Q;K++)X=n(O[K],et[K],V),C?a(X.x,X.y+d[R-1].y,d[R-1].x+W):a(X.x,X.y,w+W)}!function(){var t=y.length/3;if(S){var n=0,i=q*n;for(K=0;K<Z;K++)Y=G[K],s(Y[2]+i,Y[1]+i,Y[0]+i);for(n=R+2*T,i=q*n,K=0;K<Z;K++)Y=G[K],s(Y[0]+i,Y[1]+i,Y[2]+i)}else{for(K=0;K<Z;K++)Y=G[K],s(Y[2],Y[1],Y[0]);for(K=0;K<Z;K++)Y=G[K],s(Y[0]+q*R,Y[1]+q*R,Y[2]+q*R)}U.addGroup(t,y.length/3-t,void 0!==e.material?e.material:0)}(),function(){var t=y.length/3,n=0;for(o(k,n),n+=k.length,I=0,N=B.length;I<N;I++)O=B[I],o(O,n),n+=O.length;U.addGroup(t,y.length/3-t,void 0!==e.extrudeMaterial?e.extrudeMaterial:1)}(),e.arrays||(this.setIndex(_),this.addAttribute("position",new Et(y,3)),this.addAttribute("uv",new Et(e.arrays.uv,2)))},nn.WorldUVGenerator={generateTopUV:function(t,e,n,i,o){var a=e[3*n],s=e[3*n+1],c=e[3*i],u=e[3*i+1],l=e[3*o],h=e[3*o+1];return[new r(a,s),new r(c,u),new r(l,h)]},generateSideWallUV:function(t,e,n,i,o,a){var s=e[3*n],c=e[3*n+1],u=e[3*n+2],l=e[3*i],h=e[3*i+1],d=e[3*i+2],p=e[3*o],f=e[3*o+1],m=e[3*o+2],g=e[3*a],v=e[3*a+1],y=e[3*a+2];return Math.abs(c-h)<.01?[new r(s,1-u),new r(l,1-d),new r(p,1-m),new r(g,1-y)]:[new r(c,1-u),new r(h,1-d),new r(f,1-m),new r(v,1-y)]}},on.prototype=Object.create(Rt.prototype),on.prototype.constructor=on,an.prototype=Object.create(rn.prototype),an.prototype.constructor=an,sn.prototype=Object.create(Rt.prototype),sn.prototype.constructor=sn,cn.prototype=Object.create(Lt.prototype),cn.prototype.constructor=cn,un.prototype=Object.create(Rt.prototype),un.prototype.constructor=un,ln.prototype=Object.create(Lt.prototype),ln.prototype.constructor=ln,hn.prototype=Object.create(Rt.prototype),hn.prototype.constructor=hn,dn.prototype=Object.create(Lt.prototype),dn.prototype.constructor=dn,pn.prototype=Object.create(Rt.prototype),pn.prototype.constructor=pn,fn.prototype=Object.create(Lt.prototype),fn.prototype.constructor=fn,mn.prototype=Object.create(Lt.prototype),mn.prototype.constructor=mn,gn.prototype=Object.create(Rt.prototype),gn.prototype.constructor=gn,vn.prototype=Object.create(Lt.prototype),vn.prototype.constructor=vn,yn.prototype=Object.create(gn.prototype),yn.prototype.constructor=yn,_n.prototype=Object.create(vn.prototype),_n.prototype.constructor=_n,xn.prototype=Object.create(Rt.prototype),xn.prototype.constructor=xn,bn.prototype=Object.create(Lt.prototype),bn.prototype.constructor=bn;var Hs=Object.freeze({WireframeGeometry:Fe,ParametricGeometry:Be,ParametricBufferGeometry:ze,TetrahedronGeometry:He,TetrahedronBufferGeometry:Ve,OctahedronGeometry:je,OctahedronBufferGeometry:We,IcosahedronGeometry:Xe,IcosahedronBufferGeometry:Ye,DodecahedronGeometry:qe,DodecahedronBufferGeometry:Ze,PolyhedronGeometry:Ge,PolyhedronBufferGeometry:ke,TubeGeometry:Je,TubeBufferGeometry:Ke,TorusKnotGeometry:Qe,TorusKnotBufferGeometry:$e,TorusGeometry:tn,TorusBufferGeometry:en,TextGeometry:on,TextBufferGeometry:an,SphereGeometry:sn,SphereBufferGeometry:cn,RingGeometry:un,RingBufferGeometry:ln,PlaneGeometry:It,PlaneBufferGeometry:Nt,LatheGeometry:hn,LatheBufferGeometry:dn,ShapeGeometry:pn,ShapeBufferGeometry:fn,ExtrudeGeometry:nn,ExtrudeBufferGeometry:rn,EdgesGeometry:mn,ConeGeometry:yn,ConeBufferGeometry:_n,CylinderGeometry:gn,CylinderBufferGeometry:vn,CircleGeometry:xn,CircleBufferGeometry:bn,BoxGeometry:Pt,BoxBufferGeometry:Ot});wn.prototype=Object.create($.prototype),wn.prototype.constructor=wn,wn.prototype.isShadowMaterial=!0,En.prototype=Object.create($.prototype),En.prototype.constructor=En,En.prototype.isRawShaderMaterial=!0,Mn.prototype=Object.create(Q.prototype),Mn.prototype.constructor=Mn,Mn.prototype.isMeshStandardMaterial=!0,Mn.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Tn.prototype=Object.create(Mn.prototype),Tn.prototype.constructor=Tn,Tn.prototype.isMeshPhysicalMaterial=!0,Tn.prototype.copy=function(t){return Mn.prototype.copy.call(this,t),this.defines={PHYSICAL:""},this.reflectivity=t.reflectivity,this.clearCoat=t.clearCoat,this.clearCoatRoughness=t.clearCoatRoughness,this},Sn.prototype=Object.create(Q.prototype),Sn.prototype.constructor=Sn,Sn.prototype.isMeshPhongMaterial=!0,Sn.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},An.prototype=Object.create(Sn.prototype),An.prototype.constructor=An,An.prototype.isMeshToonMaterial=!0,An.prototype.copy=function(t){return Sn.prototype.copy.call(this,t),this.gradientMap=t.gradientMap,this},Rn.prototype=Object.create(Q.prototype),Rn.prototype.constructor=Rn,Rn.prototype.isMeshNormalMaterial=!0,Rn.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Ln.prototype=Object.create(Q.prototype),Ln.prototype.constructor=Ln,Ln.prototype.isMeshLambertMaterial=!0,Ln.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},Cn.prototype=Object.create(Q.prototype),Cn.prototype.constructor=Cn,Cn.prototype.isLineDashedMaterial=!0,Cn.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this};var Vs=Object.freeze({ShadowMaterial:wn,SpriteMaterial:xe,RawShaderMaterial:En,ShaderMaterial:$,PointsMaterial:Ce,MeshPhysicalMaterial:Tn,MeshStandardMaterial:Mn,MeshPhongMaterial:Sn,MeshToonMaterial:An,MeshNormalMaterial:Rn,MeshLambertMaterial:Ln,MeshDepthMaterial:tt,MeshBasicMaterial:ft,LineDashedMaterial:Cn,LineBasicMaterial:Se,Material:Q}),js={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}},Ws=new Pn;Object.assign(On.prototype,{load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,o=js.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;var a=/^data:(.*?)(;base64)?,(.*)$/,s=t.match(a);if(s){var c=s[1],u=!!s[2],l=s[3];l=window.decodeURIComponent(l),u&&(l=window.atob(l));try{var h,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":h=new ArrayBuffer(l.length);for(var p=new Uint8Array(h),f=0;f<l.length;f++)p[f]=l.charCodeAt(f);"blob"===d&&(h=new Blob([h],{type:c}));break;case"document":var m=new DOMParser;h=m.parseFromString(l,c);break;case"json":h=JSON.parse(l);break;default:h=l}window.setTimeout(function(){e&&e(h),r.manager.itemEnd(t)},0)}catch(e){window.setTimeout(function(){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},0)}}else{var g=new XMLHttpRequest;g.open("GET",t,!0),g.addEventListener("load",function(n){var o=n.target.response;js.add(t,o),200===this.status?(e&&e(o),r.manager.itemEnd(t)):0===this.status?(console.warn("THREE.FileLoader: HTTP Status 0 received."),e&&e(o),r.manager.itemEnd(t)):(i&&i(n),r.manager.itemEnd(t),r.manager.itemError(t))},!1),void 0!==n&&g.addEventListener("progress",function(t){n(t)},!1),g.addEventListener("error",function(e){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},!1),void 0!==this.responseType&&(g.responseType=this.responseType),void 0!==this.withCredentials&&(g.withCredentials=this.withCredentials),g.overrideMimeType&&g.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain");for(var v in this.requestHeader)g.setRequestHeader(v,this.requestHeader[v]);g.send(null)}return r.manager.itemStart(t),g},setPath:function(t){return this.path=t,this},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),Object.assign(In.prototype,{load:function(t,e,n,i){var r=this,o=[],a=new Ne;a.image=o;var s=new On(this.manager);if(s.setPath(this.path),s.setResponseType("arraybuffer"),Array.isArray(t))for(var c=0,u=0,l=t.length;u<l;++u)!function(u){s.load(t[u],function(t){var n=r._parser(t,!0);o[u]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},6===(c+=1)&&(1===n.mipmapCount&&(a.minFilter=Ea),a.format=n.format,a.needsUpdate=!0,e&&e(a))},n,i)}(u);else s.load(t,function(t){var n=r._parser(t,!0);if(n.isCubemap)for(var i=n.mipmaps.length/n.mipmapCount,s=0;s<i;s++){o[s]={mipmaps:[]};for(var c=0;c<n.mipmapCount;c++)o[s].mipmaps.push(n.mipmaps[s*n.mipmapCount+c]),o[s].format=n.format,o[s].width=n.width,o[s].height=n.height}else a.image.width=n.width,a.image.height=n.height,a.mipmaps=n.mipmaps;1===n.mipmapCount&&(a.minFilter=Ea),a.format=n.format,a.needsUpdate=!0,e&&e(a)},n,i);return a},setPath:function(t){return this.path=t,this}}),Object.assign(Nn.prototype,{load:function(t,e,n,i){var r=this,o=new d,a=new On(this.manager);return a.setResponseType("arraybuffer"),a.load(t,function(t){var n=r._parser(t);n&&(void 0!==n.image?o.image=n.image:void 0!==n.data&&(o.image.width=n.width,o.image.height=n.height,o.image.data=n.data),o.wrapS=void 0!==n.wrapS?n.wrapS:ya,o.wrapT=void 0!==n.wrapT?n.wrapT:ya,o.magFilter=void 0!==n.magFilter?n.magFilter:Ea,o.minFilter=void 0!==n.minFilter?n.minFilter:Ta,o.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.mipmaps&&(o.mipmaps=n.mipmaps),1===n.mipmapCount&&(o.minFilter=Ea),o.needsUpdate=!0,e&&e(o,n))},n,i),o}}),Object.assign(Un.prototype,{load:function(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t);var r=this,o=js.get(t);if(void 0!==o)return r.manager.itemStart(t),setTimeout(function(){e&&e(o),r.manager.itemEnd(t)},0),o;var a=document.createElementNS("http://www.w3.org/1999/xhtml","img");return a.addEventListener("load",function(){js.add(t,this),e&&e(this),r.manager.itemEnd(t)},!1),a.addEventListener("error",function(e){i&&i(e),r.manager.itemEnd(t),r.manager.itemError(t)},!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Dn.prototype,{load:function(t,e,n,i){var r=new p,o=new Un(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);for(var a=0,s=0;s<t.length;++s)!function(n){o.load(t[n],function(t){r.images[n]=t,6==++a&&(r.needsUpdate=!0,e&&e(r))},void 0,i)}(s);return r},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Object.assign(Fn.prototype,{load:function(t,e,n,i){var r=new Un(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);var a=new o;return a.image=r.load(t,function(){var n=t.search(/\.(jpg|jpeg)$/)>0||0===t.search(/^data\:image\/jpeg/);a.format=n?za:Ga,a.needsUpdate=!0,void 0!==e&&e(a)},n,i),a},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this}}),Bn.prototype=Object.assign(Object.create(lt.prototype),{constructor:Bn,isLight:!0,copy:function(t){return lt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this},toJSON:function(t){var e=lt.prototype.toJSON.call(this,t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}),zn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:zn,isHemisphereLight:!0,copy:function(t){return Bn.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}),Object.assign(Gn.prototype,{copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var t={};return 0!==this.bias&&(t.bias=this.bias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}),kn.prototype=Object.assign(Object.create(Gn.prototype),{constructor:kn,isSpotLightShadow:!0,update:function(t){var e=this.camera,n=2*Es.RAD2DEG*t.angle,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix())}}),Hn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Hn,isSpotLight:!0,copy:function(t){return Bn.prototype.copy.call(this,t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Vn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Vn,isPointLight:!0,copy:function(t){return Bn.prototype.copy.call(this,t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}),jn.prototype=Object.assign(Object.create(Gn.prototype),{constructor:jn}),Wn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Wn,isDirectionalLight:!0,copy:function(t){return Bn.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Xn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Xn,isAmbientLight:!0}),Yn.prototype=Object.assign(Object.create(Bn.prototype),{constructor:Yn,isRectAreaLight:!0,copy:function(t){return Bn.prototype.copy.call(this,t),this.width=t.width,this.height=t.height,this},toJSON:function(t){var e=Bn.prototype.toJSON.call(this,t);return e.object.width=this.width,e.object.height=this.height,e}});var Xs={arraySlice:function(t,e,n){return Xs.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){function e(e,n){return t[e]-t[n]}for(var n=t.length,i=new Array(n),r=0;r!==n;++r)i[r]=r;return i.sort(e),i},sortedArray:function(t,e,n){for(var i=t.length,r=new t.constructor(i),o=0,a=0;a!==i;++o)for(var s=n[o]*e,c=0;c!==e;++c)r[a++]=t[s+c];return r},flattenJSON:function(t,e,n,i){for(var r=1,o=t[0];void 0!==o&&void 0===o[i];)o=t[r++];if(void 0!==o){var a=o[i];if(void 0!==a)if(Array.isArray(a))do{a=o[i],void 0!==a&&(e.push(o.time),n.push.apply(n,a)),o=t[r++]}while(void 0!==o);else if(void 0!==a.toArray)do{a=o[i],void 0!==a&&(e.push(o.time),a.toArray(n,n.length)),o=t[r++]}while(void 0!==o);else do{a=o[i],void 0!==a&&(e.push(o.time),n.push(a)),o=t[r++]}while(void 0!==o)}}};Object.assign(qn.prototype,{evaluate:function(t){var e=this.parameterPositions,n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{var o;n:{i:if(!(t<i)){for(var a=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===a)break;if(r=i,i=e[++n],t<i)break e}o=e.length;break n}{if(t>=r)break t;var s=e[1];t<s&&(n=2,r=s);for(var a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===a)break;if(i=r,r=e[--n-1],t>=r)break e}o=n,n=0}}for(;n<o;){var c=n+o>>>1;t<e[c]?o=c:n=c+1}if(i=e[n],void 0===(r=e[n-1]))return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(t){for(var e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i,o=0;o!==i;++o)e[o]=n[r+o];return e},interpolate_:function(t,e,n,i){throw new Error("call to abstract method")},intervalChanged_:function(t,e,n){}}), | |
//!\ DECLARE ALIAS AFTER assign prototype ! | |
Object.assign(qn.prototype,{beforeStart_:qn.prototype.copySampleValue_,afterEnd_:qn.prototype.copySampleValue_}),Zn.prototype=Object.assign(Object.create(qn.prototype),{constructor:Zn,DefaultSettings_:{endingStart:ss,endingEnd:ss},intervalChanged_:function(t,e,n){var i=this.parameterPositions,r=t-2,o=t+1,a=i[r],s=i[o];if(void 0===a)switch(this.getSettings_().endingStart){case cs:r=t,a=2*e-n;break;case us:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=n}if(void 0===s)switch(this.getSettings_().endingEnd){case cs:o=t,s=2*n-e;break;case us:o=1,s=n+i[1]-i[0];break;default:o=t-1,s=e}var c=.5*(n-e),u=this.valueSize;this._weightPrev=c/(e-a),this._weightNext=c/(s-n),this._offsetPrev=r*u,this._offsetNext=o*u},interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,u=this._offsetPrev,l=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,v=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,_=d*m-d*f,x=0;x!==a;++x)r[x]=g*o[u+x]+v*o[c+x]+y*o[s+x]+_*o[l+x];return r}}),Jn.prototype=Object.assign(Object.create(qn.prototype),{constructor:Jn,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=s-a,u=(n-e)/(i-e),l=1-u,h=0;h!==a;++h)r[h]=o[c+h]*l+o[s+h]*u;return r}}),Kn.prototype=Object.assign(Object.create(qn.prototype),{constructor:Kn,interpolate_:function(t,e,n,i){return this.copySampleValue_(t-1)}});var Ys;Ys={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:os,InterpolantFactoryMethodDiscrete:function(t){return new Kn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodLinear:function(t){return new Jn(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:function(t){return new Zn(this.times,this.values,this.getValueSize(),t)},setInterpolation:function(t){var e;switch(t){case rs:e=this.InterpolantFactoryMethodDiscrete;break;case os:e=this.InterpolantFactoryMethodLinear;break;case as:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(n);this.setInterpolation(this.DefaultInterpolation)}return void console.warn(n)}this.createInterpolant=e},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return rs;case this.InterpolantFactoryMethodLinear:return os;case this.InterpolantFactoryMethodSmooth:return as}},getValueSize:function(){return this.values.length/this.times.length},shift:function(t){if(0!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]+=t;return this},scale:function(t){if(1!==t)for(var e=this.times,n=0,i=e.length;n!==i;++n)e[n]*=t;return this},trim:function(t,e){for(var n=this.times,i=n.length,r=0,o=i-1;r!==i&&n[r]<t;)++r;for(;-1!==o&&n[o]>e;)--o;if(++o,0!==r||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);var a=this.getValueSize();this.times=Xs.arraySlice(n,r,o),this.values=Xs.arraySlice(this.values,r*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("invalid value size in track",this),t=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("track is empty",this),t=!1);for(var o=null,a=0;a!==r;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("time is not a valid number",this,a,s),t=!1;break}if(null!==o&&o>s){console.error("out of order keys",this,a,s,o),t=!1;break}o=s}if(void 0!==i&&Xs.isTypedArray(i))for(var a=0,c=i.length;a!==c;++a){var u=i[a];if(isNaN(u)){console.error("value is not a valid number",this,a,u),t=!1;break}}return t},optimize:function(){for(var t=this.times,e=this.values,n=this.getValueSize(),i=this.getInterpolation()===as,r=1,o=t.length-1,a=1;a<o;++a){var s=!1,c=t[a];if(c!==t[a+1]&&(1!==a||c!==c[0]))if(i)s=!0;else for(var u=a*n,l=u-n,h=u+n,d=0;d!==n;++d){var p=e[u+d];if(p!==e[l+d]||p!==e[h+d]){s=!0;break}}if(s){if(a!==r){t[r]=t[a];for(var f=a*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[f+d]}++r}}if(o>0){t[r]=t[o];for(var f=o*n,m=r*n,d=0;d!==n;++d)e[m+d]=e[f+d];++r}return r!==t.length&&(this.times=Xs.arraySlice(t,0,r),this.values=Xs.arraySlice(e,0,r*n)),this}},$n.prototype=Object.assign(Object.create(Ys),{constructor:$n,ValueTypeName:"vector"}),ti.prototype=Object.assign(Object.create(qn.prototype),{constructor:ti,interpolate_:function(t,e,n,i){for(var r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=t*a,c=(n-e)/(i-e),l=s+a;s!==l;s+=4)u.slerpFlat(r,0,o,s-a,o,s,c);return r}}),ei.prototype=Object.assign(Object.create(Ys),{constructor:ei,ValueTypeName:"quaternion",DefaultInterpolation:os,InterpolantFactoryMethodLinear:function(t){return new ti(this.times,this.values,this.getValueSize(),t)},InterpolantFactoryMethodSmooth:void 0}),ni.prototype=Object.assign(Object.create(Ys),{constructor:ni,ValueTypeName:"number"}),ii.prototype=Object.assign(Object.create(Ys),{constructor:ii,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:rs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),ri.prototype=Object.assign(Object.create(Ys),{constructor:ri,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:rs,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),oi.prototype=Object.assign(Object.create(Ys),{constructor:oi,ValueTypeName:"color"}),ai.prototype=Ys,Ys.constructor=ai,Object.assign(ai,{parse:function(t){if(void 0===t.type)throw new Error("track type undefined, can not parse");var e=ai._getTrackTypeForValueTypeName(t.type);if(void 0===t.times){var n=[],i=[];Xs.flattenJSON(t.keys,n,i,"value"),t.times=n,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)},toJSON:function(t){var e,n=t.constructor;if(void 0!==n.toJSON)e=n.toJSON(t);else{e={name:t.name,times:Xs.convertArray(t.times,Array),values:Xs.convertArray(t.values,Array)};var i=t.getInterpolation();i!==t.DefaultInterpolation&&(e.interpolation=i)}return e.type=t.ValueTypeName,e},_getTrackTypeForValueTypeName:function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return ni;case"vector":case"vector2":case"vector3":case"vector4":return $n;case"color":return oi;case"quaternion":return ei;case"bool":case"boolean":return ri;case"string":return ii}throw new Error("Unsupported typeName: "+t)}}),Object.assign(si,{parse:function(t){for(var e=[],n=t.tracks,i=1/(t.fps||1),r=0,o=n.length;r!==o;++r)e.push(ai.parse(n[r]).scale(i));return new si(t.name,t.duration,e)},toJSON:function(t){for(var e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e},r=0,o=n.length;r!==o;++r)e.push(ai.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(t,e,n,i){for(var r=e.length,o=[],a=0;a<r;a++){var s=[],c=[];s.push((a+r-1)%r,a,(a+1)%r),c.push(0,1,0);var u=Xs.getKeyframeOrder(s);s=Xs.sortedArray(s,1,u),c=Xs.sortedArray(c,1,u),i||0!==s[0]||(s.push(r),c.push(c[0])),o.push(new ni(".morphTargetInfluences["+e[a].name+"]",s,c).scale(1/n))}return new si(t,-1,o)},findByName:function(t,e){var n=t;if(!Array.isArray(t)){var i=t;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===e)return n[r];return null},CreateClipsFromMorphTargetSequences:function(t,e,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,o=0,a=t.length;o<a;o++){var s=t[o],c=s.name.match(r);if(c&&c.length>1){var u=c[1],l=i[u];l||(i[u]=l=[]),l.push(s)}}var h=[];for(var u in i)h.push(si.CreateFromMorphTargetSequence(u,i[u],e,n));return h},parseAnimation:function(t,e){if(!t)return console.error(" no animation in JSONLoader data"),null;for(var n=function(t,e,n,i,r){if(0!==n.length){var o=[],a=[];Xs.flattenJSON(n,o,a,i),0!==o.length&&r.push(new t(e,o,a))}},i=[],r=t.name||"default",o=t.length||-1,a=t.fps||30,s=t.hierarchy||[],c=0;c<s.length;c++){var u=s[c].keys;if(u&&0!==u.length)if(u[0].morphTargets){for(var l={},h=0;h<u.length;h++)if(u[h].morphTargets)for(var d=0;d<u[h].morphTargets.length;d++)l[u[h].morphTargets[d]]=-1;for(var p in l){for(var f=[],m=[],d=0;d!==u[h].morphTargets.length;++d){var g=u[h];f.push(g.time),m.push(g.morphTarget===p?1:0)}i.push(new ni(".morphTargetInfluence["+p+"]",f,m))}o=l.length*(a||1)}else{var v=".bones["+e[c].name+"]";n($n,v+".position",u,"pos",i),n(ei,v+".quaternion",u,"rot",i),n($n,v+".scale",u,"scl",i)}}return 0===i.length?null:new si(r,o,i)}}),Object.assign(si.prototype,{resetDuration:function(){for(var t=this.tracks,e=0,n=0,i=t.length;n!==i;++n){var r=this.tracks[n];e=Math.max(e,r.times[r.times.length-1])}this.duration=e},trim:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this},optimize:function(){for(var t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}}),Object.assign(ci.prototype,{load:function(t,e,n,i){var r=this,o=new On(r.manager);o.setResponseType("json"),o.load(t,function(t){e(r.parse(t))},n,i)},setTextures:function(t){this.textures=t},parse:function(t){function e(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var n=this.textures,i=new Vs[t.type];if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&i.specular.setHex(t.specular),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearCoat&&(i.clearCoat=t.clearCoat),void 0!==t.clearCoatRoughness&&(i.clearCoatRoughness=t.clearCoatRoughness),void 0!==t.uniforms&&(i.uniforms=t.uniforms),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.vertexColors&&(i.vertexColors=t.vertexColors),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.shading&&(i.shading=t.shading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.side&&(i.side=t.side),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.skinning&&(i.skinning=t.skinning),void 0!==t.morphTargets&&(i.morphTargets=t.morphTargets),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=e(t.map)),void 0!==t.alphaMap&&(i.alphaMap=e(t.alphaMap),i.transparent=!0),void 0!==t.bumpMap&&(i.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=e(t.normalMap)),void 0!==t.normalScale){var o=t.normalScale;!1===Array.isArray(o)&&(o=[o,o]),i.normalScale=(new r).fromArray(o)}return void 0!==t.displacementMap&&(i.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=e(t.specularMap)),void 0!==t.envMap&&(i.envMap=e(t.envMap)),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.lightMap&&(i.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=e(t.gradientMap)),i}}),Object.assign(ui.prototype,{load:function(t,e,n,i){var r=this,o=new On(r.manager);o.setResponseType("json"),o.load(t,function(t){e(r.parse(t))},n,i)},parse:function(t){var e=new Lt,n=t.data.index;if(void 0!==n){var i=new qs[n.type](n.array);e.setIndex(new mt(i,1))}var r=t.data.attributes;for(var o in r){var a=r[o],i=new qs[a.type](a.array);e.addAttribute(o,new mt(i,a.itemSize,a.normalized))}var s=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==s)for(var c=0,u=s.length;c!==u;++c){var h=s[c];e.addGroup(h.start,h.count,h.materialIndex)}var d=t.data.boundingSphere;if(void 0!==d){var p=new l;void 0!==d.center&&p.fromArray(d.center),e.boundingSphere=new nt(p,d.radius)}return e}});var qs={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};li.Handlers={handlers:[],add:function(t,e){this.handlers.push(t,e)},get:function(t){for(var e=this.handlers,n=0,i=e.length;n<i;n+=2){var r=e[n],o=e[n+1];if(r.test(t))return o}return null}},Object.assign(li.prototype,{crossOrigin:void 0,extractUrlBase:function(t){var e=t.split("/");return 1===e.length?"./":(e.pop(),e.join("/")+"/")},initMaterials:function(t,e,n){for(var i=[],r=0;r<t.length;++r)i[r]=this.createMaterial(t[r],e,n);return i},createMaterial:function(){var t={NoBlending:To,NormalBlending:So,AdditiveBlending:Ao,SubtractiveBlending:Ro,MultiplyBlending:Lo,CustomBlending:Co},e=new q,n=new Fn,i=new ci;return function(r,o,a){function s(t,e,i,r,s){var u,l=o+t,h=li.Handlers.get(l);null!==h?u=h.load(l):(n.setCrossOrigin(a),u=n.load(l)),void 0!==e&&(u.repeat.fromArray(e),1!==e[0]&&(u.wrapS=va),1!==e[1]&&(u.wrapT=va)),void 0!==i&&u.offset.fromArray(i),void 0!==r&&("repeat"===r[0]&&(u.wrapS=va),"mirror"===r[0]&&(u.wrapS=_a),"repeat"===r[1]&&(u.wrapT=va),"mirror"===r[1]&&(u.wrapT=_a)),void 0!==s&&(u.anisotropy=s);var d=Es.generateUUID();return c[d]=u,d}var c={},u={uuid:Es.generateUUID(),type:"MeshLambertMaterial"};for(var l in r){var h=r[l];switch(l){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=h;break;case"blending":u.blending=t[h];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",l,"is no longer supported.");break;case"colorDiffuse":u.color=e.fromArray(h).getHex();break;case"colorSpecular":u.specular=e.fromArray(h).getHex();break;case"colorEmissive":u.emissive=e.fromArray(h).getHex();break;case"specularCoef":u.shininess=h;break;case"shading":"basic"===h.toLowerCase()&&(u.type="MeshBasicMaterial"),"phong"===h.toLowerCase()&&(u.type="MeshPhongMaterial"),"standard"===h.toLowerCase()&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=s(h,r.mapDiffuseRepeat,r.mapDiffuseOffset,r.mapDiffuseWrap,r.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=s(h,r.mapEmissiveRepeat,r.mapEmissiveOffset,r.mapEmissiveWrap,r.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=s(h,r.mapLightRepeat,r.mapLightOffset,r.mapLightWrap,r.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=s(h,r.mapAORepeat,r.mapAOOffset,r.mapAOWrap,r.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=s(h,r.mapBumpRepeat,r.mapBumpOffset,r.mapBumpWrap,r.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=h;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=s(h,r.mapNormalRepeat,r.mapNormalOffset,r.mapNormalWrap,r.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=[h,h];break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=s(h,r.mapSpecularRepeat,r.mapSpecularOffset,r.mapSpecularWrap,r.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=s(h,r.mapMetalnessRepeat,r.mapMetalnessOffset,r.mapMetalnessWrap,r.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=s(h,r.mapRoughnessRepeat,r.mapRoughnessOffset,r.mapRoughnessWrap,r.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=s(h,r.mapAlphaRepeat,r.mapAlphaOffset,r.mapAlphaWrap,r.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=yo;break;case"doubleSided":u.side=_o;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=h;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[l]=h;break;case"vertexColors":!0===h&&(u.vertexColors=Mo),"face"===h&&(u.vertexColors=Eo);break;default:console.error("THREE.Loader.createMaterial: Unsupported",l,h)}}return"MeshBasicMaterial"===u.type&&delete u.emissive,"MeshPhongMaterial"!==u.type&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(c),i.parse(u)}}()}),Object.assign(hi.prototype,{load:function(t,e,n,i){var r=this,o=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:li.prototype.extractUrlBase(t),a=new On(this.manager);a.setResponseType("json"),a.setWithCredentials(this.withCredentials),a.load(t,function(n){var i=n.metadata;if(void 0!==i){var a=i.type;if(void 0!==a){if("object"===a.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.ObjectLoader instead.");if("scene"===a.toLowerCase())return void console.error("THREE.JSONLoader: "+t+" should be loaded with THREE.SceneLoader instead.")}}var s=r.parse(n,o);e(s.geometry,s.materials)},n,i)},setTexturePath:function(t){this.texturePath=t},parse:function(){function t(t,e){function n(t,e){return t&1<<e}var i,o,a,s,c,u,h,d,p,f,m,g,v,y,_,x,b,w,E,M,T,S,A,R,L,C,P,O=t.faces,I=t.vertices,N=t.normals,U=t.colors,D=t.scale,F=0;if(void 0!==t.uvs){for(i=0;i<t.uvs.length;i++)t.uvs[i].length&&F++;for(i=0;i<F;i++)e.faceVertexUvs[i]=[]}for(s=0,c=I.length;s<c;)w=new l,w.x=I[s++]*D,w.y=I[s++]*D,w.z=I[s++]*D,e.vertices.push(w);for(s=0,c=O.length;s<c;)if(f=O[s++],m=n(f,0),g=n(f,1),v=n(f,3),y=n(f,4),_=n(f,5),x=n(f,6),b=n(f,7),m){if(M=new pt,M.a=O[s],M.b=O[s+1],M.c=O[s+3],T=new pt,T.a=O[s+1],T.b=O[s+2],T.c=O[s+3],s+=4,g&&(p=O[s++],M.materialIndex=p,T.materialIndex=p),a=e.faces.length,v)for(i=0;i<F;i++)for(R=t.uvs[i],e.faceVertexUvs[i][a]=[],e.faceVertexUvs[i][a+1]=[],o=0;o<4;o++)d=O[s++],C=R[2*d],P=R[2*d+1],L=new r(C,P),2!==o&&e.faceVertexUvs[i][a].push(L),0!==o&&e.faceVertexUvs[i][a+1].push(L);if(y&&(h=3*O[s++],M.normal.set(N[h++],N[h++],N[h]),T.normal.copy(M.normal)),_)for(i=0;i<4;i++)h=3*O[s++],A=new l(N[h++],N[h++],N[h]),2!==i&&M.vertexNormals.push(A),0!==i&&T.vertexNormals.push(A);if(x&&(u=O[s++],S=U[u],M.color.setHex(S),T.color.setHex(S)),b)for(i=0;i<4;i++)u=O[s++],S=U[u],2!==i&&M.vertexColors.push(new q(S)),0!==i&&T.vertexColors.push(new q(S));e.faces.push(M),e.faces.push(T)}else{if(E=new pt,E.a=O[s++],E.b=O[s++],E.c=O[s++],g&&(p=O[s++],E.materialIndex=p),a=e.faces.length,v)for(i=0;i<F;i++)for(R=t.uvs[i],e.faceVertexUvs[i][a]=[],o=0;o<3;o++)d=O[s++],C=R[2*d],P=R[2*d+1],L=new r(C,P),e.faceVertexUvs[i][a].push(L);if(y&&(h=3*O[s++],E.normal.set(N[h++],N[h++],N[h])),_)for(i=0;i<3;i++)h=3*O[s++],A=new l(N[h++],N[h++],N[h]),E.vertexNormals.push(A);if(x&&(u=O[s++],E.color.setHex(U[u])),b)for(i=0;i<3;i++)u=O[s++],E.vertexColors.push(new q(U[u]));e.faces.push(E)}}function e(t,e){var n=void 0!==t.influencesPerVertex?t.influencesPerVertex:2;if(t.skinWeights)for(var i=0,r=t.skinWeights.length;i<r;i+=n){var o=t.skinWeights[i],s=n>1?t.skinWeights[i+1]:0,c=n>2?t.skinWeights[i+2]:0,u=n>3?t.skinWeights[i+3]:0;e.skinWeights.push(new a(o,s,c,u))}if(t.skinIndices)for(var i=0,r=t.skinIndices.length;i<r;i+=n){var l=t.skinIndices[i],h=n>1?t.skinIndices[i+1]:0,d=n>2?t.skinIndices[i+2]:0,p=n>3?t.skinIndices[i+3]:0;e.skinIndices.push(new a(l,h,d,p))}e.bones=t.bones,e.bones&&e.bones.length>0&&(e.skinWeights.length!==e.skinIndices.length||e.skinIndices.length!==e.vertices.length)&&console.warn("When skinning, number of vertices ("+e.vertices.length+"), skinIndices ("+e.skinIndices.length+"), and skinWeights ("+e.skinWeights.length+") should match.")}function n(t,e){var n=t.scale;if(void 0!==t.morphTargets)for(var i=0,r=t.morphTargets.length;i<r;i++){e.morphTargets[i]={},e.morphTargets[i].name=t.morphTargets[i].name,e.morphTargets[i].vertices=[];for(var o=e.morphTargets[i].vertices,a=t.morphTargets[i].vertices,s=0,c=a.length;s<c;s+=3){var u=new l;u.x=a[s]*n,u.y=a[s+1]*n,u.z=a[s+2]*n,o.push(u)}}if(void 0!==t.morphColors&&t.morphColors.length>0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');for(var h=e.faces,d=t.morphColors[0].colors,i=0,r=h.length;i<r;i++)h[i].color.fromArray(d,3*i)}}function i(t,e){var n=[],i=[];void 0!==t.animation&&i.push(t.animation),void 0!==t.animations&&(t.animations.length?i=i.concat(t.animations):i.push(t.animations));for(var r=0;r<i.length;r++){var o=si.parseAnimation(i[r],e.bones);o&&n.push(o)}if(e.morphTargets){var a=si.CreateClipsFromMorphTargetSequences(e.morphTargets,10);n=n.concat(a)}n.length>0&&(e.animations=n)}return function(r,o){void 0!==r.data&&(r=r.data),void 0!==r.scale?r.scale=1/r.scale:r.scale=1;var a=new Rt;return t(r,a),e(r,a),n(r,a),i(r,a),a.computeFaceNormals(),a.computeBoundingSphere(),void 0===r.materials||0===r.materials.length?{geometry:a}:{geometry:a,materials:li.prototype.initMaterials(r.materials,o,this.crossOrigin)}}}()}),Object.assign(di.prototype,{load:function(t,e,n,i){""===this.texturePath&&(this.texturePath=t.substring(0,t.lastIndexOf("/")+1));var r=this;new On(r.manager).load(t,function(n){var o=null;try{o=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}var a=o.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void console.error("THREE.ObjectLoader: Can't load "+t+". Use THREE.JSONLoader instead.");r.parse(o,e)},n,i)},setTexturePath:function(t){this.texturePath=t},setCrossOrigin:function(t){this.crossOrigin=t},parse:function(t,e){var n=this.parseGeometries(t.geometries),i=this.parseImages(t.images,function(){void 0!==e&&e(a)}),r=this.parseTextures(t.textures,i),o=this.parseMaterials(t.materials,r),a=this.parseObject(t.object,n,o);return t.animations&&(a.animations=this.parseAnimations(t.animations)),void 0!==t.images&&0!==t.images.length||void 0!==e&&e(a),a},parseGeometries:function(t){var e={};if(void 0!==t)for(var n=new hi,i=new ui,r=0,o=t.length;r<o;r++){var a,s=t[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":a=new Hs[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":a=new Hs[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":a=new Hs[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":a=new Hs[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":a=new Hs[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":a=new Hs[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"IcosahedronGeometry":case"OctahedronGeometry":case"TetrahedronGeometry":a=new Hs[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":a=new Hs[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":a=new Hs[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":a=new Hs[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"LatheGeometry":case"LatheBufferGeometry":a=new Hs[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"BufferGeometry":a=i.parse(s);break;case"Geometry":a=n.parse(s,this.texturePath).geometry;break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),e[s.uuid]=a}return e},parseMaterials:function(t,e){var n={};if(void 0!==t){var i=new ci;i.setTextures(e);for(var r=0,o=t.length;r<o;r++){var a=t[r];if("MultiMaterial"===a.type){for(var s=[],c=0;c<a.materials.length;c++)s.push(i.parse(a.materials[c]));n[a.uuid]=s}else n[a.uuid]=i.parse(a)}}return n},parseAnimations:function(t){for(var e=[],n=0;n<t.length;n++){var i=si.parse(t[n]);e.push(i)}return e},parseImages:function(t,e){var n=this,i={};if(void 0!==t&&t.length>0){var r=new Pn(e),o=new Un(r);o.setCrossOrigin(this.crossOrigin);for(var a=0,s=t.length;a<s;a++){var c=t[a],u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.texturePath+c.url;i[c.uuid]=function(t){return n.manager.itemStart(t),o.load(t,function(){n.manager.itemEnd(t)},void 0,function(){n.manager.itemEnd(t),n.manager.itemError(t)})}(u)}}return i},parseTextures:function(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}var i={};if(void 0!==t)for(var r=0,a=t.length;r<a;r++){var s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);var c=new o(e[s.image]);c.needsUpdate=!0,c.uuid=s.uuid,void 0!==s.name&&(c.name=s.name),void 0!==s.mapping&&(c.mapping=n(s.mapping,Zs)),void 0!==s.offset&&c.offset.fromArray(s.offset),void 0!==s.repeat&&c.repeat.fromArray(s.repeat),void 0!==s.wrap&&(c.wrapS=n(s.wrap[0],Js),c.wrapT=n(s.wrap[1],Js)),void 0!==s.minFilter&&(c.minFilter=n(s.minFilter,Ks)),void 0!==s.magFilter&&(c.magFilter=n(s.magFilter,Ks)),void 0!==s.anisotropy&&(c.anisotropy=s.anisotropy),void 0!==s.flipY&&(c.flipY=s.flipY),i[s.uuid]=c}return i},parseObject:function(){var t=new h;return function(e,n,i){function r(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),n[t]}function o(t){if(void 0!==t){if(Array.isArray(t)){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n];void 0===i[o]&&console.warn("THREE.ObjectLoader: Undefined material",o),e.push(i[o])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}var a;switch(e.type){case"Scene":a=new ye,void 0!==e.background&&Number.isInteger(e.background)&&(a.background=new q(e.background)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new ve(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new ge(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":a=new Dt(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Ft(e.left,e.right,e.top,e.bottom,e.near,e.far);break;case"AmbientLight":a=new Xn(e.color,e.intensity);break;case"DirectionalLight":a=new Wn(e.color,e.intensity);break;case"PointLight":a=new Vn(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Yn(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Hn(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":a=new zn(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var s=r(e.geometry),c=o(e.material);a=s.bones&&s.bones.length>0?new Te(s,c):new Ct(s,c);break;case"LOD":a=new we;break;case"Line":a=new Ae(r(e.geometry),o(e.material),e.mode);break;case"LineLoop":a=new Le(r(e.geometry),o(e.material));break;case"LineSegments":a=new Re(r(e.geometry),o(e.material));break;case"PointCloud":case"Points":a=new Pe(r(e.geometry),o(e.material));break;case"Sprite":a=new be(o(e.material));break;case"Group":a=new Oe;break;default:a=new lt}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(t.fromArray(e.matrix),t.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.children)for(var u in e.children)a.add(this.parseObject(e.children[u],n,i));if("LOD"===e.type)for(var l=e.levels,h=0;h<l.length;h++){var d=l[h],u=a.getObjectByProperty("uuid",d.object);void 0!==u&&a.addLevel(u,d.distance)}return a}}()});var Zs={UVMapping:ua,CubeReflectionMapping:la,CubeRefractionMapping:ha,EquirectangularReflectionMapping:da,EquirectangularRefractionMapping:pa,SphericalReflectionMapping:fa,CubeUVReflectionMapping:ma,CubeUVRefractionMapping:ga},Js={RepeatWrapping:va,ClampToEdgeWrapping:ya,MirroredRepeatWrapping:_a},Ks={NearestFilter:xa,NearestMipMapNearestFilter:ba,NearestMipMapLinearFilter:wa,LinearFilter:Ea,LinearMipMapNearestFilter:Ma,LinearMipMapLinearFilter:Ta};Object.assign(Ei.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t){var e=this.getUtoTmapping(t);return this.getPoint(e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n,i=[],r=this.getPoint(0),o=0;for(i.push(0),n=1;n<=t;n++)e=this.getPoint(n/t),o+=e.distanceTo(r),i.push(o),r=e;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,i=this.getLengths(),r=0,o=i.length;n=e||t*i[o-1];for(var a,s=0,c=o-1;s<=c;)if(r=Math.floor(s+(c-s)/2),(a=i[r]-n)<0)s=r+1;else{if(!(a>0)){c=r;break}c=r-1}if(r=c,i[r]===n)return r/(o-1);var u=i[r];return(r+(n-u)/(i[r+1]-u))/(o-1)},getTangent:function(t){var e=t-1e-4,n=t+1e-4;e<0&&(e=0),n>1&&(n=1);var i=this.getPoint(e);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(t){var e=this.getUtoTmapping(t);return this.getTangent(e)},computeFrenetFrames:function(t,e){var n,i,r,o=new l,a=[],s=[],c=[],u=new l,d=new h;for(n=0;n<=t;n++)i=n/t,a[n]=this.getTangentAt(i),a[n].normalize();s[0]=new l,c[0]=new l;var p=Number.MAX_VALUE,f=Math.abs(a[0].x),m=Math.abs(a[0].y),g=Math.abs(a[0].z);for(f<=p&&(p=f,o.set(1,0,0)),m<=p&&(p=m,o.set(0,1,0)),g<=p&&o.set(0,0,1),u.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],u),c[0].crossVectors(a[0],s[0]),n=1;n<=t;n++)s[n]=s[n-1].clone(),c[n]=c[n-1].clone(),u.crossVectors(a[n-1],a[n]),u.length()>Number.EPSILON&&(u.normalize(),r=Math.acos(Es.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(d.makeRotationAxis(u,r))),c[n].crossVectors(a[n],s[n]);if(!0===e)for(r=Math.acos(Es.clamp(s[0].dot(s[t]),-1,1)),r/=t,a[0].dot(u.crossVectors(s[0],s[t]))>0&&(r=-r),n=1;n<=t;n++)s[n].applyMatrix4(d.makeRotationAxis(a[n],r*n)),c[n].crossVectors(a[n],s[n]);return{tangents:a,normals:s,binormals:c}}}),Mi.prototype=Object.create(Ei.prototype),Mi.prototype.constructor=Mi,Mi.prototype.isLineCurve=!0,Mi.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=this.v2.clone().sub(this.v1);return e.multiplyScalar(t).add(this.v1),e},Mi.prototype.getPointAt=function(t){return this.getPoint(t)},Mi.prototype.getTangent=function(t){return this.v2.clone().sub(this.v1).normalize()},Ti.prototype=Object.assign(Object.create(Ei.prototype),{constructor:Ti,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new Mi(e,t))},getPoint:function(t){for(var e=t*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=e){var r=n[i]-e,o=this.curves[i],a=o.getLength(),s=0===a?0:1-r/a;return o.getPointAt(s)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e},getPoints:function(t){t=t||12;for(var e,n=[],i=0,r=this.curves;i<r.length;i++)for(var o=r[i],a=o&&o.isEllipseCurve?2*t:o&&o.isLineCurve?1:o&&o.isSplineCurve?t*o.points.length:t,s=o.getPoints(a),c=0;c<s.length;c++){var u=s[c];e&&e.equals(u)||(n.push(u),e=u)}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},createPointsGeometry:function(t){var e=this.getPoints(t);return this.createGeometry(e)},createSpacedPointsGeometry:function(t){var e=this.getSpacedPoints(t);return this.createGeometry(e)},createGeometry:function(t){for(var e=new Rt,n=0,i=t.length;n<i;n++){var r=t[n];e.vertices.push(new l(r.x,r.y,r.z||0))}return e}}),Si.prototype=Object.create(Ei.prototype),Si.prototype.constructor=Si,Si.prototype.isEllipseCurve=!0,Si.prototype.getPoint=function(t){for(var e=2*Math.PI,n=this.aEndAngle-this.aStartAngle,i=Math.abs(n)<Number.EPSILON;n<0;)n+=e;for(;n>e;)n-=e;n<Number.EPSILON&&(n=i?0:e),!0!==this.aClockwise||i||(n===e?n=-e:n-=e);var o=this.aStartAngle+t*n,a=this.aX+this.xRadius*Math.cos(o),s=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),l=a-this.aX,h=s-this.aY;a=l*c-h*u+this.aX,s=l*u+h*c+this.aY}return new r(a,s)},Ai.prototype=Object.create(Ei.prototype),Ai.prototype.constructor=Ai,Ai.prototype.isSplineCurve=!0,Ai.prototype.getPoint=function(t){var e=this.points,n=(e.length-1)*t,i=Math.floor(n),o=n-i,a=e[0===i?i:i-1],s=e[i],c=e[i>e.length-2?e.length-1:i+1],u=e[i>e.length-3?e.length-1:i+2];return new r(pi(o,a.x,s.x,c.x,u.x),pi(o,a.y,s.y,c.y,u.y))},Ri.prototype=Object.create(Ei.prototype),Ri.prototype.constructor=Ri,Ri.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,o=this.v3;return new r(wi(t,e.x,n.x,i.x,o.x),wi(t,e.y,n.y,i.y,o.y))},Li.prototype=Object.create(Ei.prototype),Li.prototype.constructor=Li,Li.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new r(vi(t,e.x,n.x,i.x),vi(t,e.y,n.y,i.y))};var Qs=Object.assign(Object.create(Ti.prototype),{fromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y)},moveTo:function(t,e){this.currentPoint.set(t,e)},lineTo:function(t,e){var n=new Mi(this.currentPoint.clone(),new r(t,e));this.curves.push(n),this.currentPoint.set(t,e)},quadraticCurveTo:function(t,e,n,i){var o=new Li(this.currentPoint.clone(),new r(t,e),new r(n,i));this.curves.push(o),this.currentPoint.set(n,i)},bezierCurveTo:function(t,e,n,i,o,a){var s=new Ri(this.currentPoint.clone(),new r(t,e),new r(n,i),new r(o,a));this.curves.push(s),this.currentPoint.set(o,a)},splineThru:function(t){var e=[this.currentPoint.clone()].concat(t),n=new Ai(e);this.curves.push(n),this.currentPoint.copy(t[t.length-1])},arc:function(t,e,n,i,r,o){var a=this.currentPoint.x,s=this.currentPoint.y;this.absarc(t+a,e+s,n,i,r,o)},absarc:function(t,e,n,i,r,o){this.absellipse(t,e,n,n,i,r,o)},ellipse:function(t,e,n,i,r,o,a,s){var c=this.currentPoint.x,u=this.currentPoint.y;this.absellipse(t+c,e+u,n,i,r,o,a,s)},absellipse:function(t,e,n,i,r,o,a,s){var c=new Si(t,e,n,i,r,o,a,s);if(this.curves.length>0){var u=c.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)}});Ci.prototype=Qs,Qs.constructor=Ci,Pi.prototype=Object.assign(Object.create(Qs),{constructor:Pi,getPointsHoles:function(t){for(var e=[],n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e},extractAllPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},extractPoints:function(t){return this.extractAllPoints(t)}}),Object.assign(Oi.prototype,{moveTo:function(t,e){this.currentPath=new Ci,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e)},lineTo:function(t,e){this.currentPath.lineTo(t,e)},quadraticCurveTo:function(t,e,n,i){this.currentPath.quadraticCurveTo(t,e,n,i)},bezierCurveTo:function(t,e,n,i,r,o){this.currentPath.bezierCurveTo(t,e,n,i,r,o)},splineThru:function(t){this.currentPath.splineThru(t)},toShapes:function(t,e){function n(t){for(var e=[],n=0,i=t.length;n<i;n++){var r=t[n],o=new Pi;o.curves=r.curves,e.push(o)}return e}var i=ks.isClockWise,r=this.subPaths;if(0===r.length)return[];if(!0===e)return n(r);var o,a,s,c=[];if(1===r.length)return a=r[0],s=new Pi,s.curves=a.curves,c.push(s),c;var u=!i(r[0].getPoints());u=t?!u:u;var l,h=[],d=[],p=[],f=0;d[f]=void 0,p[f]=[];for(var m=0,g=r.length;m<g;m++)a=r[m],l=a.getPoints(),o=i(l),o=t?!o:o,o?(!u&&d[f]&&f++,d[f]={s:new Pi,p:l},d[f].s.curves=a.curves,u&&f++,p[f]=[]):p[f].push({h:a,p:l[0]});if(!d[0])return n(r);if(d.length>1){for(var v=!1,y=[],_=0,x=d.length;_<x;_++)h[_]=[];for(var _=0,x=d.length;_<x;_++)for(var b=p[_],w=0;w<b.length;w++){for(var E=b[w],M=!0,T=0;T<d.length;T++)(function(t,e){for(var n=e.length,i=!1,r=n-1,o=0;o<n;r=o++){var a=e[r],s=e[o],c=s.x-a.x,u=s.y-a.y;if(Math.abs(u)>Number.EPSILON){if(u<0&&(a=e[o],c=-c,s=e[r],u=-u),t.y<a.y||t.y>s.y)continue;if(t.y===a.y){if(t.x===a.x)return!0}else{var l=u*(t.x-a.x)-c*(t.y-a.y);if(0===l)return!0;if(l<0)continue;i=!i}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return!0}}return i})(E.p,d[T].p)&&(_!==T&&y.push({froms:_,tos:T,hole:w}),M?(M=!1,h[T].push(E)):v=!0);M&&h[_].push(E)}y.length>0&&(v||(p=h))}for(var S,m=0,A=d.length;m<A;m++){s=d[m].s,c.push(s),S=p[m];for(var R=0,L=S.length;R<L;R++)s.holes.push(S[R].h)}return c}}),Object.assign(Ii.prototype,{isFont:!0,generateShapes:function(t,e,n){function i(t,e,i,o){var a=r.glyphs[t]||r.glyphs["?"];if(a){var s,c,u,l,h,d,p,f,m,g,v,y=new Oi,_=[];if(a.o)for(var x=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),b=0,w=x.length;b<w;){var E=x[b++];switch(E){case"m":s=x[b++]*e+i,c=x[b++]*e+o,y.moveTo(s,c);break;case"l":s=x[b++]*e+i,c=x[b++]*e+o,y.lineTo(s,c);break;case"q":if(u=x[b++]*e+i,l=x[b++]*e+o,p=x[b++]*e+i,f=x[b++]*e+o,y.quadraticCurveTo(p,f,u,l),v=_[_.length-1]){h=v.x,d=v.y;for(var M=1;M<=n;M++){var T=M/n;vi(T,h,p,u),vi(T,d,f,l)}}break;case"b":if(u=x[b++]*e+i,l=x[b++]*e+o,p=x[b++]*e+i,f=x[b++]*e+o,m=x[b++]*e+i,g=x[b++]*e+o,y.bezierCurveTo(p,f,m,g,u,l),v=_[_.length-1]){h=v.x,d=v.y;for(var M=1;M<=n;M++){var T=M/n;wi(T,h,p,m,u),wi(T,d,f,g,l)}}}}return{offsetX:a.ha*e,path:y}}}void 0===e&&(e=100),void 0===n&&(n=4);for(var r=this.data,o=function(t){for(var n=String(t).split(""),o=e/r.resolution,a=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*o,s=0,c=0,u=[],l=0;l<n.length;l++){var h=n[l];if("\n"===h)s=0,c-=a;else{var d=i(h,o,s,c);s+=d.offsetX,u.push(d.path)}}return u}(t),a=[],s=0,c=o.length;s<c;s++)Array.prototype.push.apply(a,o[s].toShapes());return a}}),Object.assign(Ni.prototype,{load:function(t,e,n,i){var r=this;new On(this.manager).load(t,function(t){var n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}var i=r.parse(n);e&&e(i)},n,i)},parse:function(t){return new Ii(t)}});var $s,tc={getContext:function(){return void 0===$s&&($s=new(window.AudioContext||window.webkitAudioContext)),$s},setContext:function(t){$s=t}};Object.assign(Ui.prototype,{load:function(t,e,n,i){var r=new On(this.manager);r.setResponseType("arraybuffer"),r.load(t,function(t){tc.getContext().decodeAudioData(t,function(t){e(t)})},n,i)}}),Object.assign(Di.prototype,{update:function(){var t,e,n,i,r,o,a,s,c=new h,u=new h;return function(l){if(t!==this||e!==l.focus||n!==l.fov||i!==l.aspect*this.aspect||r!==l.near||o!==l.far||a!==l.zoom||s!==this.eyeSep){t=this,e=l.focus,n=l.fov,i=l.aspect*this.aspect,r=l.near,o=l.far,a=l.zoom;var h=l.projectionMatrix.clone();s=this.eyeSep/2;var d,p,f=s*r/e,m=r*Math.tan(Es.DEG2RAD*n*.5)/a;u.elements[12]=-s,c.elements[12]=s,d=-m*i+f,p=m*i+f,h.elements[0]=2*r/(p-d),h.elements[8]=(p+d)/(p-d),this.cameraL.projectionMatrix.copy(h),d=-m*i-f,p=m*i-f,h.elements[0]=2*r/(p-d),h.elements[8]=(p+d)/(p-d),this.cameraR.projectionMatrix.copy(h)}this.cameraL.matrixWorld.copy(l.matrixWorld).multiply(u),this.cameraR.matrixWorld.copy(l.matrixWorld).multiply(c)}}()}),Fi.prototype=Object.create(lt.prototype),Fi.prototype.constructor=Fi,Bi.prototype=Object.assign(Object.create(Dt.prototype),{constructor:Bi,isArrayCamera:!0}),zi.prototype=Object.assign(Object.create(lt.prototype),{constructor:zi,getInput:function(){return this.gain},removeFilter:function(){null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null)},getFilter:function(){return this.filter},setFilter:function(t){null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination)},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(t){this.gain.gain.value=t},updateMatrixWorld:function(){var t=new l,e=new u,n=new l,i=new l;return function(r){lt.prototype.updateMatrixWorld.call(this,r);var o=this.context.listener,a=this.up;this.matrixWorld.decompose(t,e,n),i.set(0,0,-1).applyQuaternion(e),o.positionX?(o.positionX.setValueAtTime(t.x,this.context.currentTime),o.positionY.setValueAtTime(t.y,this.context.currentTime),o.positionZ.setValueAtTime(t.z,this.context.currentTime),o.forwardX.setValueAtTime(i.x,this.context.currentTime),o.forwardY.setValueAtTime(i.y,this.context.currentTime),o.forwardZ.setValueAtTime(i.z,this.context.currentTime),o.upX.setValueAtTime(a.x,this.context.currentTime),o.upY.setValueAtTime(a.y,this.context.currentTime),o.upZ.setValueAtTime(a.z,this.context.currentTime)):(o.setPosition(t.x,t.y,t.z),o.setOrientation(i.x,i.y,i.z,a.x,a.y,a.z))}}()}),Gi.prototype=Object.assign(Object.create(lt.prototype),{constructor:Gi,getOutput:function(){return this.gain},setNodeSource:function(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this},setBuffer:function(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.onended=this.onEnded.bind(this),t.playbackRate.setValueAtTime(this.playbackRate,this.startTime),t.start(0,this.startTime),this.isPlaying=!0,this.source=t,this.connect()},pause:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=this.context.currentTime,this.isPlaying=!1,this)},stop:function(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.source.stop(),this.startTime=0,this.isPlaying=!1,this)},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(t){return t||(t=[]),!0===this.isPlaying?(this.disconnect(),this.filters=t,this.connect()):this.filters=t,this},getFilter:function(){return this.getFilters()[0]},setFilter:function(t){return this.setFilters(t?[t]:[])},setPlaybackRate:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setValueAtTime(this.playbackRate,this.context.currentTime),this)},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(t){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this)},getVolume:function(){return this.gain.gain.value},setVolume:function(t){return this.gain.gain.value=t,this}}),ki.prototype=Object.assign(Object.create(Gi.prototype),{constructor:ki,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(t){this.panner.refDistance=t},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(t){this.panner.rolloffFactor=t},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(t){this.panner.distanceModel=t},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(t){this.panner.maxDistance=t},updateMatrixWorld:function(){var t=new l;return function(e){lt.prototype.updateMatrixWorld.call(this,e),t.setFromMatrixPosition(this.matrixWorld),this.panner.setPosition(t.x,t.y,t.z)}}()}),Object.assign(Hi.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var t=0,e=this.getFrequencyData(),n=0;n<e.length;n++)t+=e[n];return t/e.length}}),Object.assign(Vi.prototype,{accumulate:function(t,e){var n=this.buffer,i=this.valueSize,r=t*i+i,o=this.cumulativeWeight;if(0===o){for(var a=0;a!==i;++a)n[r+a]=n[a];o=e}else{o+=e;var s=e/o;this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=o},apply:function(t){var e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,o=this.binding;if(this.cumulativeWeight=0,r<1){var a=3*e;this._mixBufferRegion(n,i,a,1-r,e)}for(var s=e,c=e+e;s!==c;++s)if(n[s]!==n[s+e]){o.setValue(n,i);break}},saveOriginalState:function(){var t=this.binding,e=this.buffer,n=this.valueSize,i=3*n;t.getValue(e,i);for(var r=n,o=i;r!==o;++r)e[r]=e[i+r%n];this.cumulativeWeight=0},restoreOriginalState:function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},_select:function(t,e,n,i,r){if(i>=.5)for(var o=0;o!==r;++o)t[e+o]=t[n+o]},_slerp:function(t,e,n,i){u.slerpFlat(t,e,t,e,t,n,i)},_lerp:function(t,e,n,i,r){for(var o=1-i,a=0;a!==r;++a){var s=e+a;t[s]=t[s]*o+t[n+a]*i}}}),Object.assign(ji.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Wi,{Composite:ji,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Wi.Composite(t,e,n):new Wi(t,e,n)},parseTrackName:function(){var t=/((?:[\w-]+[\/:])*)/,e=/([\w-\.]+)?/,n=/(?:\.([\w-]+)(?:\[(.+)\])?)?/,i=/\.([\w-]+)(?:\[(.+)\])?/,r=new RegExp("^"+t.source+e.source+n.source+i.source+"$"),o=["material","materials","bones"];return function(t){var e=r.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var a=n.nodeName.substring(i+1);-1!==o.indexOf(a)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=a)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}}(),findNode:function(t,e){if(!e||""===e||"root"===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=function(t){for(var n=0;n<t.bones.length;n++){var i=t.bones[n];if(i.name===e)return i}return null}(t.skeleton);if(n)return n}if(t.children){var i=function(t){for(var n=0;n<t.length;n++){var r=t[n];if(r.name===e||r.uuid===e)return r;var o=i(r.children);if(o)return o}return null},r=i(t.children);if(r)return r}return null}}),Object.assign(Wi.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,e){t[e]=this.node[this.propertyName]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)t[e++]=n[i]},function(t,e){t[e]=this.resolvedProperty[this.propertyIndex]},function(t,e){this.resolvedProperty.toArray(t,e)}],SetterByBindingTypeAndVersioning:[[function(t,e){this.node[this.propertyName]=t[e]},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.node[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++]},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0},function(t,e){for(var n=this.resolvedProperty,i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty[this.propertyIndex]=t[e]},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,e){this.resolvedProperty.fromArray(t,e)},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0},function(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,e){this.bind(),this.getValue(t,e)},setValue:function(t,e){this.bind(),this.setValue(t,e)},bind:function(){var t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,r=e.propertyIndex;if(t||(t=Wi.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error(" trying to update node for track: "+this.path+" but it wasn't found.");if(n){var o=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error(" can not bind to material as node does not have a material",this);if(!t.material.materials)return void console.error(" can not bind to material.materials as node.material does not have a materials array",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error(" can not bind to bones as node does not have a skeleton",this);t=t.skeleton.bones;for(var a=0;a<t.length;a++)if(t[a].name===o){o=a;break}break;default:if(void 0===t[n])return void console.error(" can not bind to objectName of node, undefined",this);t=t[n]}if(void 0!==o){if(void 0===t[o])return void console.error(" trying to bind to objectIndex of objectName, but is undefined:",this,t);t=t[o]}}var s=t[i];if(void 0===s){var c=e.nodeName;return void console.error(" trying to update property for track: "+c+"."+i+" but it wasn't found.",t)}var u=this.Versioning.None;void 0!==t.needsUpdate?(u=this.Versioning.NeedsUpdate,this.targetObject=t):void 0!==t.matrixWorldNeedsUpdate&&(u=this.Versioning.MatrixWorldNeedsUpdate,this.targetObject=t);var l=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry",this);if(!t.geometry.morphTargets)return void console.error(" can not bind to morphTargetInfluences becasuse node does not have a geometry.morphTargets",this);for(var a=0;a<this.node.geometry.morphTargets.length;a++)if(t.geometry.morphTargets[a].name===r){r=a;break}}l=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(l=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(l=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][u]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}), | |
//!\ DECLARE ALIAS AFTER assign prototype ! | |
Object.assign(Wi.prototype,{_getValue_unbound:Wi.prototype.getValue,_setValue_unbound:Wi.prototype.setValue}),Object.assign(Xi.prototype,{isAnimationObjectGroup:!0,add:function(t){for(var e=this._objects,n=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._paths,a=this._parsedPaths,s=this._bindings,c=s.length,u=0,l=arguments.length;u!==l;++u){var h=arguments[u],d=h.uuid,p=r[d],f=void 0;if(void 0===p){p=n++,r[d]=p,e.push(h);for(var m=0,g=c;m!==g;++m)s[m].push(new Wi(h,o[m],a[m]))}else if(p<i){f=e[p];var v=--i,y=e[v];r[y.uuid]=p,e[p]=y,r[d]=v,e[v]=h;for(var m=0,g=c;m!==g;++m){var _=s[m],x=_[v],b=_[p];_[p]=x,void 0===b&&(b=new Wi(h,o[m],a[m])),_[v]=b}}else e[p]!==f&&console.error("Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes...")}this.nCachedObjects_=i},remove:function(t){for(var e=this._objects,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,o=r.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a],u=c.uuid,l=i[u];if(void 0!==l&&l>=n){var h=n++,d=e[h];i[d.uuid]=l,e[l]=d,i[u]=h,e[h]=c;for(var p=0,f=o;p!==f;++p){var m=r[p],g=m[h],v=m[l];m[l]=g,m[h]=v}}}this.nCachedObjects_=n},uncache:function(t){for(var e=this._objects,n=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,o=this._bindings,a=o.length,s=0,c=arguments.length;s!==c;++s){var u=arguments[s],l=u.uuid,h=r[l];if(void 0!==h)if(delete r[l],h<i){var d=--i,p=e[d],f=--n,m=e[f];r[p.uuid]=h,e[h]=p,r[m.uuid]=d,e[d]=m,e.pop();for(var g=0,v=a;g!==v;++g){var y=o[g],_=y[d],x=y[f];y[h]=_,y[d]=x,y.pop()}}else{var f=--n,m=e[f];r[m.uuid]=h,e[h]=m,e.pop();for(var g=0,v=a;g!==v;++g){var y=o[g];y[h]=y[f],y.pop()}}}this.nCachedObjects_=i},subscribe_:function(t,e){var n=this._bindingsIndicesByPath,i=n[t],r=this._bindings;if(void 0!==i)return r[i];var o=this._paths,a=this._parsedPaths,s=this._objects,c=s.length,u=this.nCachedObjects_,l=new Array(c);i=r.length,n[t]=i,o.push(t),a.push(e),r.push(l);for(var h=u,d=s.length;h!==d;++h){var p=s[h];l[h]=new Wi(p,t,e)}return l},unsubscribe_:function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,s=o[a];e[t[a]]=n,o[n]=s,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}),Object.assign(Yi.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(t){return this._startTime=t,this},setLoop:function(t,e){return this.loop=t,this.repetitions=e,this},setEffectiveWeight:function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(t){return this._scheduleFading(t,0,1)},fadeOut:function(t){return this._scheduleFading(t,1,0)},crossFadeFrom:function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var i=this._clip.duration,r=t._clip.duration,o=r/i,a=i/r;t.warp(1,o,e),this.warp(a,1,e)}return this},crossFadeTo:function(t,e,n){return t.crossFadeFrom(this,e,n)},stopFading:function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},setEffectiveTimeScale:function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},syncWith:function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},halt:function(t){return this.warp(this._effectiveTimeScale,0,t)},warp:function(t,e,n){var i=this._mixer,r=i.time,o=this._timeScaleInterpolant,a=this.timeScale;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,c=o.sampleValues;return s[0]=r,s[1]=r+n,c[0]=t/a,c[1]=e/a,this},stopWarping:function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);var r=this._startTime;if(null!==r){var o=(t-r)*n;if(o<0||0===n)return;this._startTime=null,e=n*o}e*=this._updateTimeScale(t);var a=this._updateTime(e),s=this._updateWeight(t);if(s>0)for(var c=this._interpolants,u=this._propertyBindings,l=0,h=c.length;l!==h;++l)c[l].evaluate(a),u[l].accumulate(i,s)},_updateWeight:function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e},_updateTime:function(t){var e=this.time+t;if(0===t)return e;var n=this._clip.duration,i=this.loop,r=this._loopCount;if(i===es){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(e>=n)e=n;else{if(!(e<0))break t;e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{var o=i===is;if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),e>=n||e<0){var a=Math.floor(e/n);e-=n*a,r+=Math.abs(a);var s=this.repetitions-r;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=t>0?n:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(0===s){var c=t<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&r))return this.time=e,n-e}return this.time=e,e},_setEndings:function(t,e,n){var i=this._interpolantSettings;n?(i.endingStart=cs,i.endingEnd=cs):(i.endingStart=t?this.zeroSlopeAtStart?cs:ss:us,i.endingEnd=e?this.zeroSlopeAtEnd?cs:ss:us)},_scheduleFading:function(t,e,n){var i=this._mixer,r=i.time,o=this._weightInterpolant;null===o&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=r,s[0]=e,a[1]=r+t,s[1]=n,this}}),Object.assign(qi.prototype,i.prototype,{_bindAction:function(t,e){var n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,o=t._propertyBindings,a=t._interpolants,s=n.uuid,c=this._bindingsByRootAndName,u=c[s];void 0===u&&(u={},c[s]=u);for(var l=0;l!==r;++l){var h=i[l],d=h.name,p=u[d];if(void 0!==p)o[l]=p;else{if(void 0!==(p=o[l])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[l].binding.parsedPath;p=new Vi(Wi.create(n,d,f),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,s,d),o[l]=p}a[l].resultBuffer=p.buffer}},_activateAction:function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}for(var r=t._propertyBindings,o=0,a=r.length;o!==a;++o){var s=r[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},_deactivateAction:function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(t)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}},_isActiveAction:function(t){var e=t._cacheIndex;return null!==e&&e<this._nActiveActions},_addInactiveAction:function(t,e,n){var i=this._actions,r=this._actionsByClip,o=r[e];if(void 0===o)o={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=o;else{var a=o.knownActions;t._byClipCacheIndex=a.length,a.push(t)}t._cacheIndex=i.length,i.push(t),o.actionByRoot[n]=t},_removeInactiveAction:function(t){var e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;var r=t._clip.uuid,o=this._actionsByClip,a=o[r],s=a.knownActions,c=s[s.length-1],u=t._byClipCacheIndex;c._byClipCacheIndex=u,s[u]=c,s.pop(),t._byClipCacheIndex=null,delete a.actionByRoot[(t._localRoot||this._root).uuid],0===s.length&&delete o[r],this._removeInactiveBindingsForAction(t)},_removeInactiveBindingsForAction:function(t){for(var e=t._propertyBindings,n=0,i=e.length;n!==i;++n){var r=e[n];0==--r.referenceCount&&this._removeInactiveBinding(r)}},_lendAction:function(t){var e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackAction:function(t){var e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_addInactiveBinding:function(t,e,n){var i=this._bindingsByRootAndName,r=i[e],o=this._bindings;void 0===r&&(r={},i[e]=r),r[n]=t,t._cacheIndex=o.length,o.push(t)},_removeInactiveBinding:function(t){var e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,o=this._bindingsByRootAndName,a=o[i],s=e[e.length-1],c=t._cacheIndex;s._cacheIndex=c,e[c]=s,e.pop(),delete a[r];t:{for(var u in a)break t;delete o[i]}},_lendBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_takeBackBinding:function(t){var e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r},_lendControlInterpolant:function(){var t=this._controlInterpolants,e=this._nActiveControlInterpolants++,n=t[e];return void 0===n&&(n=new Jn(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n},_takeBackControlInterpolant:function(t){var e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(t,e){var n=e||this._root,i=n.uuid,r="string"==typeof t?si.findByName(n,t):t,o=null!==r?r.uuid:t,a=this._actionsByClip[o],s=null;if(void 0!==a){var c=a.actionByRoot[i];if(void 0!==c)return c;s=a.knownActions[0],null===r&&(r=s._clip)}if(null===r)return null;var u=new Yi(this,r,e);return this._bindAction(u,s),this._addInactiveAction(u,o,i),u},existingAction:function(t,e){var n=e||this._root,i=n.uuid,r="string"==typeof t?si.findByName(n,t):t,o=r?r.uuid:t,a=this._actionsByClip[o];return void 0!==a?a.actionByRoot[i]||null:null},stopAllAction:function(){var t=this._actions,e=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==e;++r)t[r].reset();for(var r=0;r!==i;++r)n[r].useCount=0;return this},update:function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),o=this._accuIndex^=1,a=0;a!==n;++a){e[a]._update(i,t,r,o)}for(var s=this._bindings,c=this._nActiveBindings,a=0;a!==c;++a)s[a].apply(o);return this},getRoot:function(){return this._root},uncacheClip:function(t){var e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){for(var o=r.knownActions,a=0,s=o.length;a!==s;++a){var c=o[a];this._deactivateAction(c);var u=c._cacheIndex,l=e[e.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,l._cacheIndex=u,e[u]=l,e.pop(),this._removeInactiveBindingsForAction(c)}delete i[n]}},uncacheRoot:function(t){var e=t.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot,o=r[e];void 0!==o&&(this._deactivateAction(o),this._removeInactiveAction(o))}var a=this._bindingsByRootAndName,s=a[e];if(void 0!==s)for(var c in s){var u=s[c];u.restoreOriginalState(),this._removeInactiveBinding(u)}},uncacheAction:function(t,e){var n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}),Zi.prototype.clone=function(){return new Zi(void 0===this.value.clone?this.value:this.value.clone())},Ji.prototype=Object.assign(Object.create(Lt.prototype),{constructor:Ji,isInstancedBufferGeometry:!0,addGroup:function(t,e,n){this.groups.push({start:t,count:e,materialIndex:n})},copy:function(t){var e=t.index;null!==e&&this.setIndex(e.clone());var n=t.attributes;for(var i in n){var r=n[i];this.addAttribute(i,r.clone())}for(var o=t.groups,a=0,s=o.length;a<s;a++){var c=o[a];this.addGroup(c.start,c.count,c.materialIndex)}return this}}),Object.defineProperties(Ki.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Ki.prototype,{isInterleavedBufferAttribute:!0,setX:function(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this},setY:function(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this},setZ:function(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this},setW:function(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this},setXYZ:function(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this},setXYZW:function(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}}),Object.defineProperty(Qi.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Qi.prototype,{isInterleavedBuffer:!0,setArray:function(t){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.count=void 0!==t?t.length/this.stride:0,this.array=t},setDynamic:function(t){return this.dynamic=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.dynamic=t.dynamic,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this},set:function(t,e){return void 0===e&&(e=0),this.array.set(t,e),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),$i.prototype=Object.assign(Object.create(Qi.prototype),{constructor:$i,isInstancedInterleavedBuffer:!0,copy:function(t){return Qi.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),tr.prototype=Object.assign(Object.create(mt.prototype),{constructor:tr,isInstancedBufferAttribute:!0,copy:function(t){return mt.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}}),Object.assign(er.prototype,{linePrecision:1,set:function(t,e){this.ray.set(t,e)},setFromCamera:function(t,e){e&&e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize()):e&&e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(t,e){var n=[];return ir(t,this,n,e),n.sort(nr),n},intersectObjects:function(t,e){var n=[];if(!1===Array.isArray(t))return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),n;for(var i=0,r=t.length;i<r;i++)ir(t[i],this,n,e);return n.sort(nr),n}}),Object.assign(rr.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var e=("undefined"==typeof performance?Date:performance).now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}),Object.assign(or.prototype,{set:function(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this},makeSafe:function(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this},setFromVector3:function(t){return this.radius=t.length(),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t.x,t.z),this.phi=Math.acos(Es.clamp(t.y/this.radius,-1,1))),this}}),Object.assign(ar.prototype,{set:function(t,e,n){return this.radius=t,this.theta=e,this.y=n,this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this},setFromVector3:function(t){return this.radius=Math.sqrt(t.x*t.x+t.z*t.z),this.theta=Math.atan2(t.x,t.z),this.y=t.y,this}}),sr.prototype=Object.create(Ct.prototype),sr.prototype.constructor=sr,sr.prototype.createAnimation=function(t,e,n,i){var r={start:e,end:n,length:n-e+1,fps:i,duration:(n-e)/i,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[t]=r,this.animationsList.push(r)},sr.prototype.autoCreateAnimations=function(t){for(var e,n=/([a-z]+)_?(\d+)/i,i={},r=this.geometry,o=0,a=r.morphTargets.length;o<a;o++){var s=r.morphTargets[o],c=s.name.match(n);if(c&&c.length>1){var u=c[1];i[u]||(i[u]={start:1/0,end:-1/0});var l=i[u];o<l.start&&(l.start=o),o>l.end&&(l.end=o),e||(e=u)}}for(var u in i){var l=i[u];this.createAnimation(u,l.start,l.end,t)}this.firstAnimation=e},sr.prototype.setAnimationDirectionForward=function(t){var e=this.animationsMap[t];e&&(e.direction=1,e.directionBackwards=!1)},sr.prototype.setAnimationDirectionBackward=function(t){var e=this.animationsMap[t];e&&(e.direction=-1,e.directionBackwards=!0)},sr.prototype.setAnimationFPS=function(t,e){var n=this.animationsMap[t];n&&(n.fps=e,n.duration=(n.end-n.start)/n.fps)},sr.prototype.setAnimationDuration=function(t,e){var n=this.animationsMap[t];n&&(n.duration=e,n.fps=(n.end-n.start)/n.duration)},sr.prototype.setAnimationWeight=function(t,e){var n=this.animationsMap[t];n&&(n.weight=e)},sr.prototype.setAnimationTime=function(t,e){var n=this.animationsMap[t];n&&(n.time=e)},sr.prototype.getAnimationTime=function(t){var e=0,n=this.animationsMap[t];return n&&(e=n.time),e},sr.prototype.getAnimationDuration=function(t){var e=-1,n=this.animationsMap[t];return n&&(e=n.duration),e},sr.prototype.playAnimation=function(t){var e=this.animationsMap[t];e?(e.time=0,e.active=!0):console.warn("THREE.MorphBlendMesh: animation["+t+"] undefined in .playAnimation()")},sr.prototype.stopAnimation=function(t){var e=this.animationsMap[t];e&&(e.active=!1)},sr.prototype.update=function(t){for(var e=0,n=this.animationsList.length;e<n;e++){var i=this.animationsList[e];if(i.active){var r=i.duration/i.length;i.time+=i.direction*t,i.mirroredLoop?(i.time>i.duration||i.time<0)&&(i.direction*=-1,i.time>i.duration&&(i.time=i.duration,i.directionBackwards=!0),i.time<0&&(i.time=0,i.directionBackwards=!1)):(i.time=i.time%i.duration,i.time<0&&(i.time+=i.duration));var o=i.start+Es.clamp(Math.floor(i.time/r),0,i.length-1),a=i.weight;o!==i.currentFrame&&(this.morphTargetInfluences[i.lastFrame]=0,this.morphTargetInfluences[i.currentFrame]=1*a,this.morphTargetInfluences[o]=0,i.lastFrame=i.currentFrame,i.currentFrame=o);var s=i.time%r/r;i.directionBackwards&&(s=1-s),i.currentFrame!==i.lastFrame?(this.morphTargetInfluences[i.currentFrame]=s*a,this.morphTargetInfluences[i.lastFrame]=(1-s)*a):this.morphTargetInfluences[i.currentFrame]=a}}},cr.prototype=Object.create(lt.prototype),cr.prototype.constructor=cr,cr.prototype.isImmediateRenderObject=!0,ur.prototype=Object.create(Re.prototype),ur.prototype.constructor=ur,ur.prototype.update=function(){var t=new l,e=new l,n=new it;return function(){var i=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var r=this.object.matrixWorld,o=this.geometry.attributes.position,a=this.object.geometry;if(a&&a.isGeometry)for(var s=a.vertices,c=a.faces,u=0,l=0,h=c.length;l<h;l++)for(var d=c[l],p=0,f=d.vertexNormals.length;p<f;p++){var m=s[d[i[p]]],g=d.vertexNormals[p];t.copy(m).applyMatrix4(r),e.copy(g).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(u,t.x,t.y,t.z),u+=1,o.setXYZ(u,e.x,e.y,e.z),u+=1}else if(a&&a.isBufferGeometry)for(var v=a.attributes.position,y=a.attributes.normal,u=0,p=0,f=v.count;p<f;p++)t.set(v.getX(p),v.getY(p),v.getZ(p)).applyMatrix4(r),e.set(y.getX(p),y.getY(p),y.getZ(p)),e.applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),o.setXYZ(u,t.x,t.y,t.z),u+=1,o.setXYZ(u,e.x,e.y,e.z),u+=1;o.needsUpdate=!0}}(),lr.prototype=Object.create(lt.prototype),lr.prototype.constructor=lr,lr.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},lr.prototype.update=function(){var t=new l,e=new l;return function(){var n=this.light.distance?this.light.distance:1e3,i=n*Math.tan(this.light.angle);this.cone.scale.set(i,i,n),t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e.sub(t)),this.cone.material.color.copy(this.light.color)}}(),hr.prototype=Object.create(Re.prototype),hr.prototype.constructor=hr,hr.prototype.getBoneList=function(t){var e=[];t&&t.isBone&&e.push(t);for(var n=0;n<t.children.length;n++)e.push.apply(e,this.getBoneList(t.children[n]));return e},hr.prototype.update=function(){var t=new l,e=new h,n=new h;return function(){var i=this.geometry,r=i.getAttribute("position");n.getInverse(this.root.matrixWorld);for(var o=0,a=0;o<this.bones.length;o++){var s=this.bones[o];s.parent&&s.parent.isBone&&(e.multiplyMatrices(n,s.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(a,t.x,t.y,t.z),e.multiplyMatrices(n,s.parent.matrixWorld),t.setFromMatrixPosition(e),r.setXYZ(a+1,t.x,t.y,t.z),a+=2)}i.getAttribute("position").needsUpdate=!0}}(),dr.prototype=Object.create(Ct.prototype),dr.prototype.constructor=dr,dr.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()},dr.prototype.update=function(){this.material.color.copy(this.light.color)},pr.prototype=Object.create(lt.prototype),pr.prototype.constructor=pr,pr.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},pr.prototype.update=function(){var t=this.children[0];t.material.color.copy(this.light.color);var e=.5*this.light.width,n=.5*this.light.height,i=t.geometry.attributes.position,r=i.array;r[0]=e,r[1]=-n,r[2]=0,r[3]=e,r[4]=n,r[5]=0,r[6]=-e,r[7]=n,r[8]=0,r[9]=-e,r[10]=-n,r[11]=0,r[12]=e,r[13]=-n,r[14]=0,i.needsUpdate=!0},fr.prototype=Object.create(lt.prototype),fr.prototype.constructor=fr,fr.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()},fr.prototype.update=function(){var t=new l,e=new q,n=new q;return function(){var i=this.children[0],r=i.geometry.getAttribute("color");e.copy(this.light.color),n.copy(this.light.groundColor);for(var o=0,a=r.count;o<a;o++){var s=o<a/2?e:n;r.setXYZ(o,s.r,s.g,s.b)}i.lookAt(t.setFromMatrixPosition(this.light.matrixWorld).negate()),r.needsUpdate=!0}}(),mr.prototype=Object.create(Re.prototype),mr.prototype.constructor=mr,gr.prototype=Object.create(Re.prototype),gr.prototype.constructor=gr,vr.prototype=Object.create(Re.prototype),vr.prototype.constructor=vr,vr.prototype.update=function(){var t=new l,e=new l,n=new it;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var i=this.object.matrixWorld,r=this.geometry.attributes.position,o=this.object.geometry,a=o.vertices,s=o.faces,c=0,u=0,l=s.length;u<l;u++){var h=s[u],d=h.normal;t.copy(a[h.a]).add(a[h.b]).add(a[h.c]).divideScalar(3).applyMatrix4(i),e.copy(d).applyMatrix3(n).normalize().multiplyScalar(this.size).add(t),r.setXYZ(c,t.x,t.y,t.z),c+=1,r.setXYZ(c,e.x,e.y,e.z),c+=1}r.needsUpdate=!0}}(),yr.prototype=Object.create(lt.prototype),yr.prototype.constructor=yr,yr.prototype.dispose=function(){var t=this.children[0],e=this.children[1];t.geometry.dispose(),t.material.dispose(),e.geometry.dispose(),e.material.dispose()},yr.prototype.update=function(){var t=new l,e=new l,n=new l;return function(){t.setFromMatrixPosition(this.light.matrixWorld),e.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(e,t);var i=this.children[0],r=this.children[1];i.lookAt(n),i.material.color.copy(this.light.color),r.lookAt(n),r.scale.z=n.length()}}(),_r.prototype=Object.create(Re.prototype),_r.prototype.constructor=_r,_r.prototype.update=function(){function t(t,o,a,s){i.set(o,a,s).unproject(r);var c=n[t];if(void 0!==c)for(var u=e.getAttribute("position"),l=0,h=c.length;l<h;l++)u.setXYZ(c[l],i.x,i.y,i.z)}var e,n,i=new l,r=new Ut;return function(){e=this.geometry,n=this.pointMap;r.projectionMatrix.copy(this.camera.projectionMatrix),t("c",0,0,-1),t("t",0,0,1),t("n1",-1,-1,-1),t("n2",1,-1,-1),t("n3",-1,1,-1),t("n4",1,1,-1),t("f1",-1,-1,1),t("f2",1,-1,1),t("f3",-1,1,1),t("f4",1,1,1),t("u1",.7,1.1,-1),t("u2",-.7,1.1,-1),t("u3",0,2,-1),t("cf1",-1,0,1),t("cf2",1,0,1),t("cf3",0,-1,1),t("cf4",0,1,1),t("cn1",-1,0,-1),t("cn2",1,0,-1),t("cn3",0,-1,-1),t("cn4",0,1,-1),e.getAttribute("position").needsUpdate=!0}}(),xr.prototype=Object.create(Re.prototype),xr.prototype.constructor=xr,xr.prototype.update=function(){var t=new et;return function(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&t.setFromObject(this.object),!t.isEmpty()){var n=t.min,i=t.max,r=this.geometry.attributes.position,o=r.array;o[0]=i.x,o[1]=i.y,o[2]=i.z,o[3]=n.x,o[4]=i.y,o[5]=i.z,o[6]=n.x,o[7]=n.y,o[8]=i.z,o[9]=i.x,o[10]=n.y,o[11]=i.z,o[12]=i.x,o[13]=i.y,o[14]=n.z,o[15]=n.x,o[16]=i.y,o[17]=n.z,o[18]=n.x,o[19]=n.y,o[20]=n.z,o[21]=i.x,o[22]=n.y,o[23]=n.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}(),xr.prototype.setFromObject=function(t){return this.object=t,this.update(),this};var ec,nc;br.prototype=Object.create(lt.prototype),br.prototype.constructor=br,br.prototype.setDirection=function(){var t,e=new l;return function(n){n.y>.99999?this.quaternion.set(0,0,0,1):n.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(n.z,0,-n.x).normalize(),t=Math.acos(n.y),this.quaternion.setFromAxisAngle(e,t))}}(),br.prototype.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(n=.2*e),this.line.scale.set(1,Math.max(0,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()},br.prototype.setColor=function(t){this.line.material.color.copy(t),this.cone.material.color.copy(t)},wr.prototype=Object.create(Re.prototype),wr.prototype.constructor=wr;var ic=new l,rc=new Er,oc=new Er,ac=new Er;Mr.prototype=Object.create(Ei.prototype),Mr.prototype.constructor=Mr,Mr.prototype.getPoint=function(t){var e=this.points,n=e.length;n<2&&console.log("duh, you need at least 2 points");var i=(n-(this.closed?0:1))*t,r=Math.floor(i),o=i-r;this.closed?r+=r>0?0:(Math.floor(Math.abs(r)/e.length)+1)*e.length:0===o&&r===n-1&&(r=n-2,o=1);var a,s,c,u;if(this.closed||r>0?a=e[(r-1)%n]:(ic.subVectors(e[0],e[1]).add(e[0]),a=ic),s=e[r%n],c=e[(r+1)%n],this.closed||r+2<n?u=e[(r+2)%n]:(ic.subVectors(e[n-1],e[n-2]).add(e[n-1]),u=ic),void 0===this.type||"centripetal"===this.type||"chordal"===this.type){var h="chordal"===this.type?.5:.25,d=Math.pow(a.distanceToSquared(s),h),p=Math.pow(s.distanceToSquared(c),h),f=Math.pow(c.distanceToSquared(u),h);p<1e-4&&(p=1),d<1e-4&&(d=p),f<1e-4&&(f=p),rc.initNonuniformCatmullRom(a.x,s.x,c.x,u.x,d,p,f),oc.initNonuniformCatmullRom(a.y,s.y,c.y,u.y,d,p,f),ac.initNonuniformCatmullRom(a.z,s.z,c.z,u.z,d,p,f)}else if("catmullrom"===this.type){var m=void 0!==this.tension?this.tension:.5;rc.initCatmullRom(a.x,s.x,c.x,u.x,m),oc.initCatmullRom(a.y,s.y,c.y,u.y,m),ac.initCatmullRom(a.z,s.z,c.z,u.z,m)}return new l(rc.calc(o),oc.calc(o),ac.calc(o))},Tr.prototype=Object.create(Ei.prototype),Tr.prototype.constructor=Tr,Tr.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2,r=this.v3;return new l(wi(t,e.x,n.x,i.x,r.x),wi(t,e.y,n.y,i.y,r.y),wi(t,e.z,n.z,i.z,r.z))},Sr.prototype=Object.create(Ei.prototype),Sr.prototype.constructor=Sr,Sr.prototype.getPoint=function(t){var e=this.v0,n=this.v1,i=this.v2;return new l(vi(t,e.x,n.x,i.x),vi(t,e.y,n.y,i.y),vi(t,e.z,n.z,i.z))},Ar.prototype=Object.create(Ei.prototype),Ar.prototype.constructor=Ar,Ar.prototype.getPoint=function(t){if(1===t)return this.v2.clone();var e=new l;return e.subVectors(this.v2,this.v1),e.multiplyScalar(t),e.add(this.v1),e},Rr.prototype=Object.create(Si.prototype),Rr.prototype.constructor=Rr;var sc={createMultiMaterialObject:function(t,e){for(var n=new Oe,i=0,r=e.length;i<r;i++)n.add(new Ct(t,e[i]));return n},detach:function(t,e,n){t.applyMatrix(e.matrixWorld),e.remove(t),n.add(t)},attach:function(t,e,n){var i=new h;i.getInverse(n.matrixWorld),t.applyMatrix(i),e.remove(t),n.add(t)}},cc=0,uc=1;Ei.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Ei.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Zr.prototype=Object.create(Mr.prototype),Jr.prototype=Object.create(Mr.prototype),Kr.prototype=Object.create(Mr.prototype),Object.assign(Kr.prototype,{initFromArray:function(t){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(t){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(t){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}}),mr.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Object.assign(Z.prototype,{center:function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},size:function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)}}),Object.assign(et.prototype,{center:function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionSphere:function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},size:function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)}}),ht.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Es.random16=function(){return console.warn("THREE.Math.random16() has been deprecated. Use Math.random() instead."),Math.random()},Object.assign(it.prototype,{flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},multiplyVector3:function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,n){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}}),Object.assign(h.prototype,{extractPosition:function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},flattenToArrayOffset:function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},getPosition:function(){var t;return function(){return void 0===t&&(t=new l),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),t.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector4:function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},multiplyVector3Array:function(t){return console.warn("THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead."),this.applyToVector3Array(t)},rotateAxis:function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},crossVector:function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(t,e,n){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(t)},applyToVector3Array:function(t,e,n){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(t,e,n,i,r,o){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,o)}}),rt.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},u.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Object.assign(st.prototype,{isIntersectionBox:function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},isIntersectionPlane:function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},isIntersectionSphere:function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)}}),Object.assign(Pi.prototype,{extrude:function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new nn(this,t)},makeGeometry:function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new pn(this,t)}}),Object.assign(r.prototype,{fromAttribute:function(t,e,n){return console.error("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Object.assign(l.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},getScaleFromMatrix:function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},getColumnFromMatrix:function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},applyProjection:function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},fromAttribute:function(t,e,n){return console.error("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Object.assign(a.prototype,{fromAttribute:function(t,e,n){return console.error("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)}}),Rt.prototype.computeTangents=function(){console.warn("THREE.Geometry: .computeTangents() has been removed.")},Object.assign(lt.prototype,{getChildByName:function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)}}),Object.defineProperties(lt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Object.defineProperties(we.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Ee.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Object.defineProperty(Ei.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Dt.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Bn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(mt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}}}),Object.assign(Lt.prototype,{addIndex:function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},addDrawCall:function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}}),Object.defineProperties(Lt.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Zi.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(Q.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new q}}}),Object.defineProperties(Sn.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties($.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),Object.assign(me.prototype,{getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")}}),Object.defineProperties(me.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){return this.shadowMap.cullFace},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace."),this.shadowMap.cullFace=t}}}),Object.defineProperties(at.prototype,{cullFace:{get:function(){return this.renderReverseSided?uo:co},set:function(t){var e=t!==co;console.warn("WebGLRenderer: .shadowMap.cullFace is deprecated. Set .shadowMap.renderReverseSided to "+e+"."),this.renderReverseSided=e}}}),Object.defineProperties(s.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Gi.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new Ui).load(t,function(t){e.setBuffer(t)}),this},Hi.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};var lc={merge:function(t,e,n){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;e.isMesh&&(e.matrixAutoUpdate&&e.updateMatrix(),i=e.matrix,e=e.geometry),t.merge(e,i,n)},center:function(t){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),t.center()}},hc={crossOrigin:void 0,loadTexture:function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Fn;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},loadTextureCube:function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new Dn;r.setCrossOrigin(this.crossOrigin);var o=r.load(t,n,void 0,i);return e&&(o.mapping=e),o},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")}}},function(t,e,n){var i={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!(!window.WebGLRenderingContext||!t.getContext("webgl")&&!t.getContext("experimental-webgl"))}catch(t){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n"):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'].join("\n")),t},addGetWebGLMessage:function(t){var e,n,r;t=t||{},e=void 0!==t.parent?t.parent:document.body,n=void 0!==t.id?t.id:"oldie",r=i.getWebGLErrorMessage(),r.id=n,e.appendChild(r)}};t.exports=i},function(t,e){var n=t.exports=n||{};n.color=n.color||{},n.utils=n.utils||{},n.utils.common=function(){var t=Array.prototype.forEach,e=Array.prototype.slice;return{BREAK:{},extend:function(t){return this.each(e.call(arguments,1),function(e){for(var n in e)this.isUndefined(e[n])||(t[n]=e[n])},this),t},defaults:function(t){return this.each(e.call(arguments,1),function(e){for(var n in e)this.isUndefined(t[n])&&(t[n]=e[n])},this),t},compose:function(){var t=e.call(arguments);return function(){for(var n=e.call(arguments),i=t.length-1;i>=0;i--)n=[t[i].apply(this,n)];return n[0]}},each:function(e,n,i){if(t&&e.forEach===t)e.forEach(n,i);else if(e.length===e.length+0){for(var r=0,o=e.length;r<o;r++)if(r in e&&n.call(i,e[r],r)===this.BREAK)return}else for(var r in e)if(n.call(i,e[r],r)===this.BREAK)return},defer:function(t){setTimeout(t,0)},toArray:function(t){return t.toArray?t.toArray():e.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){return t!==t},isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)}}}(),n.color.toString=function(t){return function(e){if(1==e.a||t.isUndefined(e.a)){for(var n=e.hex.toString(16);n.length<6;)n="0"+n;return"#"+n}return"rgba("+Math.round(e.r)+","+Math.round(e.g)+","+Math.round(e.b)+","+e.a+")"}}(n.utils.common),n.Color=n.color.Color=function(t,e,n,i){function r(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space?this.__state[e]:(a(this,e,n),this.__state[e])},set:function(t){"RGB"!==this.__state.space&&(a(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function o(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space?this.__state[e]:(s(this),this.__state[e])},set:function(t){"HSV"!==this.__state.space&&(s(this),this.__state.space="HSV"),this.__state[e]=t}})}function a(t,n,r){if("HEX"===t.__state.space)t.__state[n]=e.component_from_hex(t.__state.hex,r);else{if("HSV"!==t.__state.space)throw"Corrupted color state";i.extend(t.__state,e.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}}function s(t){var n=e.rgb_to_hsv(t.r,t.g,t.b);i.extend(t.__state,{s:n.s,v:n.v}),i.isNaN(n.h)?i.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=n.h}var c=function(){if(this.__state=t.apply(this,arguments),!1===this.__state)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||1};return c.COMPONENTS=["r","g","b","h","s","v","hex","a"],i.extend(c.prototype,{toString:function(){return n(this)},toOriginal:function(){return this.__state.conversion.write(this)}}),r(c.prototype,"r",2),r(c.prototype,"g",1),r(c.prototype,"b",0),o(c.prototype,"h"),o(c.prototype,"s"),o(c.prototype,"v"),Object.defineProperty(c.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(c.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=e.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}}),c}(n.color.interpret=function(t,e){var n,i,r=function(){i=!1;var t=arguments.length>1?e.toArray(arguments):arguments[0];return e.each(o,function(r){if(r.litmus(t))return e.each(r.conversions,function(r,o){if(n=r.read(t),!1===i&&!1!==n)return i=n,n.conversionName=o,n.conversion=r,e.BREAK}),e.BREAK}),i},o=[{litmus:e.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString())}},write:t},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString())}},write:t},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:t},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:t}}},{litmus:e.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:e.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3==t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4==t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:e.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(e.isNumber(t.r)&&e.isNumber(t.g)&&e.isNumber(t.b)&&e.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(e.isNumber(t.r)&&e.isNumber(t.g)&&e.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(e.isNumber(t.h)&&e.isNumber(t.s)&&e.isNumber(t.v)&&e.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(e.isNumber(t.h)&&e.isNumber(t.s)&&e.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}];return r}(n.color.toString,n.utils.common),n.color.math=function(){var t;return{hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),a=n*(1-r*e),s=n*(1-(1-r)*e),c=[[n,s,o],[a,n,o],[o,n,s],[o,a,n],[s,o,n],[n,o,a]][i];return{r:255*c[0],g:255*c[1],b:255*c[2]}},rgb_to_hsv:function(t,e,n){var i,r,o=Math.min(t,e,n),a=Math.max(t,e,n),s=a-o;return 0==a?{h:NaN,s:0,v:0}:(r=s/a,i=t==a?(e-n)/s:e==a?2+(n-t)/s:4+(t-e)/s,i/=6,i<0&&(i+=1),{h:360*i,s:r,v:a/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(e,n,i){return i<<(t=8*n)|e&~(255<<t)}}}(),n.color.toString,n.utils.common)},function(t,e){var n=t.exports=n||{};n.gui=n.gui||{},n.utils=n.utils||{},n.controllers=n.controllers||{},n.dom=n.dom||{},n.color=n.color||{},n.utils.css=function(){return{load:function(t,e){e=e||document;var n=e.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=t,e.getElementsByTagName("head")[0].appendChild(n)},inject:function(t,e){e=e||document;var n=document.createElement("style");n.type="text/css",n.innerHTML=t,e.getElementsByTagName("head")[0].appendChild(n)}}}(),n.utils.common=function(){var t=Array.prototype.forEach,e=Array.prototype.slice;return{BREAK:{},extend:function(t){return this.each(e.call(arguments,1),function(e){for(var n in e)this.isUndefined(e[n])||(t[n]=e[n])},this),t},defaults:function(t){return this.each(e.call(arguments,1),function(e){for(var n in e)this.isUndefined(t[n])&&(t[n]=e[n])},this),t},compose:function(){var t=e.call(arguments);return function(){for(var n=e.call(arguments),i=t.length-1;i>=0;i--)n=[t[i].apply(this,n)];return n[0]}},each:function(e,n,i){if(t&&e.forEach===t)e.forEach(n,i);else if(e.length===e.length+0){for(var r=0,o=e.length;r<o;r++)if(r in e&&n.call(i,e[r],r)===this.BREAK)return}else for(var r in e)if(n.call(i,e[r],r)===this.BREAK)return},defer:function(t){setTimeout(t,0)},toArray:function(t){return t.toArray?t.toArray():e.call(t)},isUndefined:function(t){return void 0===t},isNull:function(t){return null===t},isNaN:function(t){return t!==t},isArray:Array.isArray||function(t){return t.constructor===Array},isObject:function(t){return t===Object(t)},isNumber:function(t){return t===t+0},isString:function(t){return t===t+""},isBoolean:function(t){return!1===t||!0===t},isFunction:function(t){return"[object Function]"===Object.prototype.toString.call(t)}}}(),n.controllers.Controller=function(t){var e=function(t,e){this.initialValue=t[e],this.domElement=document.createElement("div"),this.object=t,this.property=e,this.__onChange=void 0,this.__onFinishChange=void 0};return t.extend(e.prototype,{onChange:function(t){return this.__onChange=t,this},onFinishChange:function(t){return this.__onFinishChange=t,this},setValue:function(t){return this.object[this.property]=t,this.__onChange&&this.__onChange.call(this,t),this.updateDisplay(),this},getValue:function(){return this.object[this.property]},updateDisplay:function(){return this},isModified:function(){return this.initialValue!==this.getValue()}}),e}(n.utils.common),n.dom.dom=function(t){function e(e){if("0"===e||t.isUndefined(e))return 0;var n=e.match(r);return t.isNull(n)?0:parseFloat(n[1])}var n={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},i={};t.each(n,function(e,n){t.each(e,function(t){i[t]=n})});var r=/(\d+(\.\d+)?)px/,o={makeSelectable:function(t,e){void 0!==t&&void 0!==t.style&&(t.onselectstart=e?function(){return!1}:function(){},t.style.MozUserSelect=e?"auto":"none",t.style.KhtmlUserSelect=e?"auto":"none",t.unselectable=e?"on":"off")},makeFullscreen:function(e,n,i){t.isUndefined(n)&&(n=!0),t.isUndefined(i)&&(i=!0),e.style.position="absolute",n&&(e.style.left=0,e.style.right=0),i&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,n,r,o){r=r||{};var a=i[n];if(!a)throw new Error("Event type "+n+" not supported.");var s=document.createEvent(a);switch(a){case"MouseEvents":var c=r.x||r.clientX||0,u=r.y||r.clientY||0;s.initMouseEvent(n,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,c,u,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var l=s.initKeyboardEvent||s.initKeyEvent;t.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),l(n,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:s.initEvent(n,r.bubbles||!1,r.cancelable||!0)}t.defaults(s,o),e.dispatchEvent(s)},bind:function(t,e,n,i){return i=i||!1,t.addEventListener?t.addEventListener(e,n,i):t.attachEvent&&t.attachEvent("on"+e,n),o},unbind:function(t,e,n,i){return i=i||!1,t.removeEventListener?t.removeEventListener(e,n,i):t.detachEvent&&t.detachEvent("on"+e,n),o},addClass:function(t,e){if(void 0===t.className)t.className=e;else if(t.className!==e){var n=t.className.split(/ +/);-1==n.indexOf(e)&&(n.push(e),t.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return o},removeClass:function(t,e){if(e)if(void 0===t.className);else if(t.className===e)t.removeAttribute("class");else{var n=t.className.split(/ +/),i=n.indexOf(e);-1!=i&&(n.splice(i,1),t.className=n.join(" "))}else t.className=void 0;return o},hasClass:function(t,e){return new RegExp("(?:^|\\s+)"+e+"(?:\\s+|$)").test(t.className)||!1},getWidth:function(t){var n=getComputedStyle(t);return e(n["border-left-width"])+e(n["border-right-width"])+e(n["padding-left"])+e(n["padding-right"])+e(n.width)},getHeight:function(t){var n=getComputedStyle(t);return e(n["border-top-width"])+e(n["border-bottom-width"])+e(n["padding-top"])+e(n["padding-bottom"])+e(n.height)},getOffset:function(t){var e={left:0,top:0};if(t.offsetParent)do{e.left+=t.offsetLeft,e.top+=t.offsetTop}while(t=t.offsetParent);return e},isActive:function(t){return t===document.activeElement&&(t.type||t.href)}};return o}(n.utils.common),n.controllers.OptionController=function(t,e,n){var i=function(t,r,o){i.superclass.call(this,t,r);var a=this;if(this.__select=document.createElement("select"),n.isArray(o)){var s={};n.each(o,function(t){s[t]=t}),o=s}n.each(o,function(t,e){var n=document.createElement("option");n.innerHTML=e,n.setAttribute("value",t),a.__select.appendChild(n)}),this.updateDisplay(),e.bind(this.__select,"change",function(){var t=this.options[this.selectedIndex].value;a.setValue(t)}),this.domElement.appendChild(this.__select)};return i.superclass=t,n.extend(i.prototype,t.prototype,{setValue:function(t){var e=i.superclass.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),e},updateDisplay:function(){return this.__select.value=this.getValue(),i.superclass.prototype.updateDisplay.call(this)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.controllers.NumberController=function(t,e){function n(t){return t=t.toString(),t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var i=function(t,r,o){i.superclass.call(this,t,r),o=o||{},this.__min=o.min,this.__max=o.max,this.__step=o.step,e.isUndefined(this.__step)?0==this.initialValue?this.__impliedStep=1:this.__impliedStep=Math.pow(10,Math.floor(Math.log(this.initialValue)/Math.LN10))/10:this.__impliedStep=this.__step,this.__precision=n(this.__impliedStep)};return i.superclass=t,e.extend(i.prototype,t.prototype,{setValue:function(t){return void 0!==this.__min&&t<this.__min?t=this.__min:void 0!==this.__max&&t>this.__max&&(t=this.__max),void 0!==this.__step&&t%this.__step!=0&&(t=Math.round(t/this.__step)*this.__step),i.superclass.prototype.setValue.call(this,t)},min:function(t){return this.__min=t,this},max:function(t){return this.__max=t,this},step:function(t){return this.__step=t,this}}),i}(n.controllers.Controller,n.utils.common),n.controllers.NumberControllerBox=function(t,e,n){function i(t,e){var n=Math.pow(10,e);return Math.round(t*n)/n}var r=function(t,i,o){function a(){var t=parseFloat(d.__input.value);n.isNaN(t)||d.setValue(t)}function s(){a(),d.__onFinishChange&&d.__onFinishChange.call(d,d.getValue())}function c(t){e.bind(window,"mousemove",u),e.bind(window,"mouseup",l),h=t.clientY}function u(t){var e=h-t.clientY;d.setValue(d.getValue()+e*d.__impliedStep),h=t.clientY}function l(){e.unbind(window,"mousemove",u),e.unbind(window,"mouseup",l)}this.__truncationSuspended=!1,r.superclass.call(this,t,i,o);var h,d=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),e.bind(this.__input,"change",a),e.bind(this.__input,"blur",s),e.bind(this.__input,"mousedown",c),e.bind(this.__input,"keydown",function(t){13===t.keyCode&&(d.__truncationSuspended=!0,this.blur(),d.__truncationSuspended=!1)}),this.updateDisplay(),this.domElement.appendChild(this.__input)};return r.superclass=t,n.extend(r.prototype,t.prototype,{updateDisplay:function(){return this.__input.value=this.__truncationSuspended?this.getValue():i(this.getValue(),this.__precision),r.superclass.prototype.updateDisplay.call(this)}}),r}(n.controllers.NumberController,n.dom.dom,n.utils.common),n.controllers.NumberControllerSlider=function(t,e,n,i,r){function o(t,e,n,i,r){return i+(t-e)/(n-e)*(r-i)}var a=function(t,n,i,r,s){function c(t){e.bind(window,"mousemove",u),e.bind(window,"mouseup",l),u(t)}function u(t){t.preventDefault();var n=e.getOffset(h.__background),i=e.getWidth(h.__background);return h.setValue(o(t.clientX,n.left,n.left+i,h.__min,h.__max)),!1}function l(){e.unbind(window,"mousemove",u),e.unbind(window,"mouseup",l),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}a.superclass.call(this,t,n,{min:i,max:r,step:s});var h=this;this.__background=document.createElement("div"),this.__foreground=document.createElement("div"),e.bind(this.__background,"mousedown",c),e.addClass(this.__background,"slider"),e.addClass(this.__foreground,"slider-fg"),this.updateDisplay(),this.__background.appendChild(this.__foreground),this.domElement.appendChild(this.__background)};return a.superclass=t,a.useDefaultStyles=function(){n.inject(".slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}")},i.extend(a.prototype,t.prototype,{updateDisplay:function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",a.superclass.prototype.updateDisplay.call(this)}}),a}(n.controllers.NumberController,n.dom.dom,n.utils.css,n.utils.common),n.controllers.FunctionController=function(t,e,n){var i=function(t,n,r){i.superclass.call(this,t,n);var o=this;this.__button=document.createElement("div"),this.__button.innerHTML=void 0===r?"Fire":r,e.bind(this.__button,"click",function(t){return t.preventDefault(),o.fire(),!1}),e.addClass(this.__button,"button"),this.domElement.appendChild(this.__button)};return i.superclass=t,n.extend(i.prototype,t.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.getValue().call(this.object)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.controllers.BooleanController=function(t,e,n){var i=function(t,n){function r(){o.setValue(!o.__prev)}i.superclass.call(this,t,n);var o=this;this.__prev=this.getValue(),this.__checkbox=document.createElement("input"),this.__checkbox.setAttribute("type","checkbox"),e.bind(this.__checkbox,"change",r,!1),this.domElement.appendChild(this.__checkbox),this.updateDisplay()};return i.superclass=t,n.extend(i.prototype,t.prototype,{setValue:function(t){var e=i.superclass.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),e},updateDisplay:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1,i.superclass.prototype.updateDisplay.call(this)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.color.toString=function(t){return function(e){if(1==e.a||t.isUndefined(e.a)){for(var n=e.hex.toString(16);n.length<6;)n="0"+n;return"#"+n}return"rgba("+Math.round(e.r)+","+Math.round(e.g)+","+Math.round(e.b)+","+e.a+")"}}(n.utils.common),n.color.interpret=function(t,e){var n,i,r=function(){i=!1;var t=arguments.length>1?e.toArray(arguments):arguments[0];return e.each(o,function(r){if(r.litmus(t))return e.each(r.conversions,function(r,o){if(n=r.read(t),!1===i&&!1!==n)return i=n,n.conversionName=o,n.conversion=r,e.BREAK}),e.BREAK}),i},o=[{litmus:e.isString,conversions:{THREE_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString()+e[1].toString()+e[2].toString()+e[2].toString()+e[3].toString()+e[3].toString())}},write:t},SIX_CHAR_HEX:{read:function(t){var e=t.match(/^#([A-F0-9]{6})$/i);return null!==e&&{space:"HEX",hex:parseInt("0x"+e[1].toString())}},write:t},CSS_RGB:{read:function(t){var e=t.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3])}},write:t},CSS_RGBA:{read:function(t){var e=t.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null!==e&&{space:"RGB",r:parseFloat(e[1]),g:parseFloat(e[2]),b:parseFloat(e[3]),a:parseFloat(e[4])}},write:t}}},{litmus:e.isNumber,conversions:{HEX:{read:function(t){return{space:"HEX",hex:t,conversionName:"HEX"}},write:function(t){return t.hex}}}},{litmus:e.isArray,conversions:{RGB_ARRAY:{read:function(t){return 3==t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2]}},write:function(t){return[t.r,t.g,t.b]}},RGBA_ARRAY:{read:function(t){return 4==t.length&&{space:"RGB",r:t[0],g:t[1],b:t[2],a:t[3]}},write:function(t){return[t.r,t.g,t.b,t.a]}}}},{litmus:e.isObject,conversions:{RGBA_OBJ:{read:function(t){return!!(e.isNumber(t.r)&&e.isNumber(t.g)&&e.isNumber(t.b)&&e.isNumber(t.a))&&{space:"RGB",r:t.r,g:t.g,b:t.b,a:t.a}},write:function(t){return{r:t.r,g:t.g,b:t.b,a:t.a}}},RGB_OBJ:{read:function(t){return!!(e.isNumber(t.r)&&e.isNumber(t.g)&&e.isNumber(t.b))&&{space:"RGB",r:t.r,g:t.g,b:t.b}},write:function(t){return{r:t.r,g:t.g,b:t.b}}},HSVA_OBJ:{read:function(t){return!!(e.isNumber(t.h)&&e.isNumber(t.s)&&e.isNumber(t.v)&&e.isNumber(t.a))&&{space:"HSV",h:t.h,s:t.s,v:t.v,a:t.a}},write:function(t){return{h:t.h,s:t.s,v:t.v,a:t.a}}},HSV_OBJ:{read:function(t){return!!(e.isNumber(t.h)&&e.isNumber(t.s)&&e.isNumber(t.v))&&{space:"HSV",h:t.h,s:t.s,v:t.v}},write:function(t){return{h:t.h,s:t.s,v:t.v}}}}}];return r}(n.color.toString,n.utils.common),n.GUI=n.gui.GUI=function(t,e,n,i,r,o,a,s,c,u,l,h,d,p,f){function m(t,e,n,o){if(void 0===e[n])throw new Error("Object "+e+' has no property "'+n+'"');var a;if(o.color)a=new l(e,n);else{var s=[e,n].concat(o.factoryArgs);a=i.apply(t,s)}o.before instanceof r&&(o.before=o.before.__li),y(t,a),p.addClass(a.domElement,"c");var c=document.createElement("span");p.addClass(c,"property-name"),c.innerHTML=a.property;var u=document.createElement("div");u.appendChild(c),u.appendChild(a.domElement);var h=g(t,u,o.before);return p.addClass(h,U.CLASS_CONTROLLER_ROW),p.addClass(h,typeof a.getValue()),v(t,h,a),t.__controllers.push(a),a}function g(t,e,n){var i=document.createElement("li");return e&&i.appendChild(e),n?t.__ul.insertBefore(i,params.before):t.__ul.appendChild(i),t.onResize(),i}function v(t,e,n){if(n.__li=e,n.__gui=t,f.extend(n,{options:function(e){return arguments.length>1?(n.remove(),m(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[f.toArray(arguments)]})):f.isArray(e)||f.isObject(e)?(n.remove(),m(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[e]})):void 0},name:function(t){return n.__li.firstElementChild.firstElementChild.innerHTML=t,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof c){var i=new s(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});f.each(["updateDisplay","onChange","onFinishChange"],function(t){var e=n[t],r=i[t];n[t]=i[t]=function(){var t=Array.prototype.slice.call(arguments);return e.apply(n,t),r.apply(i,t)}}),p.addClass(e,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof s){var r=function(e){return f.isNumber(n.__min)&&f.isNumber(n.__max)?(n.remove(),m(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]})):e};n.min=f.compose(r,n.min),n.max=f.compose(r,n.max)}else n instanceof o?(p.bind(e,"click",function(){p.fakeEvent(n.__checkbox,"click")}),p.bind(n.__checkbox,"click",function(t){t.stopPropagation()})):n instanceof a?(p.bind(e,"click",function(){p.fakeEvent(n.__button,"click")}),p.bind(e,"mouseover",function(){p.addClass(n.__button,"hover")}),p.bind(e,"mouseout",function(){p.removeClass(n.__button,"hover")})):n instanceof l&&(p.addClass(e,"color"),n.updateDisplay=f.compose(function(t){return e.style.borderLeftColor=n.__color.toString(),t},n.updateDisplay),n.updateDisplay());n.setValue=f.compose(function(e){return t.getRoot().__preset_select&&n.isModified()&&S(t.getRoot(),!0),e},n.setValue)}function y(t,e){var n=t.getRoot(),i=n.__rememberedObjects.indexOf(e.object);if(-1!=i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[e.property]=e,n.load&&n.load.remembered){var o,a=n.load.remembered;if(a[t.preset])o=a[t.preset];else{if(!a[C])return;o=a[C]}if(o[i]&&void 0!==o[i][e.property]){var s=o[i][e.property];e.initialValue=s,e.setValue(s)}}}}function _(t,e){return document.location.href+"."+e}function x(t){function e(){u.style.display=t.useLocalStorage?"block":"none"}var n=t.__save_row=document.createElement("li");p.addClass(t.domElement,"has-save"),t.__ul.insertBefore(n,t.__ul.firstChild),p.addClass(n,"save-row");var i=document.createElement("span");i.innerHTML=" ",p.addClass(i,"button gears");var r=document.createElement("span");r.innerHTML="Save",p.addClass(r,"button"),p.addClass(r,"save");var o=document.createElement("span");o.innerHTML="New",p.addClass(o,"button"),p.addClass(o,"save-as");var a=document.createElement("span");a.innerHTML="Revert",p.addClass(a,"button"),p.addClass(a,"revert");var s=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?f.each(t.load.remembered,function(e,n){M(t,n,n==t.preset)}):M(t,C,!1),p.bind(s,"change",function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value}),n.appendChild(s),n.appendChild(i),n.appendChild(r),n.appendChild(o),n.appendChild(a),P){var c=document.getElementById("dg-save-locally"),u=document.getElementById("dg-local-explain");c.style.display="block";var l=document.getElementById("dg-local-storage");"true"===localStorage.getItem(_(t,"isLocal"))&&l.setAttribute("checked","checked"),e(),p.bind(l,"change",function(){t.useLocalStorage=!t.useLocalStorage,e()})}var h=document.getElementById("dg-new-constructor");p.bind(h,"keydown",function(t){!t.metaKey||67!==t.which&&67!=t.keyCode||R.hide()}),p.bind(i,"click",function(){h.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),R.show(),h.focus(),h.select()}),p.bind(r,"click",function(){t.save()}),p.bind(o,"click",function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)}),p.bind(a,"click",function(){t.revert()})}function b(t){function e(e){return e.preventDefault(),r=e.clientX,p.addClass(t.__closeButton,U.CLASS_DRAG),p.bind(window,"mousemove",n),p.bind(window,"mouseup",i),!1}function n(e){return e.preventDefault(),t.width+=r-e.clientX,t.onResize(),r=e.clientX,!1}function i(){p.removeClass(t.__closeButton,U.CLASS_DRAG),p.unbind(window,"mousemove",n),p.unbind(window,"mouseup",i)}t.__resize_handle=document.createElement("div"),f.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});var r;p.bind(t.__resize_handle,"mousedown",e),p.bind(t.__closeButton,"mousedown",e),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}function w(t,e){t.domElement.style.width=e+"px",t.__save_row&&t.autoPlace&&(t.__save_row.style.width=e+"px"),t.__closeButton&&(t.__closeButton.style.width=e+"px")}function E(t,e){var n={};return f.each(t.__rememberedObjects,function(i,r){var o={},a=t.__rememberedObjectIndecesToControllers[r];f.each(a,function(t,n){o[n]=e?t.initialValue:t.getValue()}),n[r]=o}),n}function M(t,e,n){var i=document.createElement("option");i.innerHTML=e,i.value=e,t.__preset_select.appendChild(i),n&&(t.__preset_select.selectedIndex=t.__preset_select.length-1)}function T(t){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].value==t.preset&&(t.__preset_select.selectedIndex=e)}function S(t,e){var n=t.__preset_select[t.__preset_select.selectedIndex];n.innerHTML=e?n.value+"*":n.value}function A(t){0!=t.length&&h(function(){A(t)}),f.each(t,function(t){t.updateDisplay()})}t.inject(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save ul{margin-top:27px}.dg.a.has-save ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height 0.1s ease-out;-o-transition:height 0.1s ease-out;-moz-transition:height 0.1s ease-out;transition:height 0.1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li > *{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");var R,L,C="Default",P=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}}(),O=!0,I=!1,N=[],U=function(t){function e(){localStorage.setItem(_(n,"gui"),JSON.stringify(n.getSaveObject()))}var n=this;this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),p.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],t=t||{},t=f.defaults(t,{autoPlace:!0,width:U.DEFAULT_WIDTH}),t=f.defaults(t,{resizable:t.autoPlace,hideable:t.autoPlace}),f.isUndefined(t.load)?t.load={preset:C}:t.preset&&(t.load.preset=t.preset),f.isUndefined(t.parent)&&t.hideable&&N.push(this),t.resizable=f.isUndefined(t.parent)&&t.resizable,t.autoPlace&&f.isUndefined(t.scrollable)&&(t.scrollable=!0);var i=P&&"true"===localStorage.getItem(_(this,"isLocal"));if(Object.defineProperties(this,{parent:{get:function(){return t.parent}},scrollable:{get:function(){return t.scrollable}},autoPlace:{get:function(){return t.autoPlace}},preset:{get:function(){return n.parent?n.getRoot().preset:t.load.preset},set:function(e){n.parent?n.getRoot().preset=e:t.load.preset=e,T(this),n.revert()}},width:{get:function(){return t.width},set:function(e){t.width=e,w(n,e)}},name:{get:function(){return t.name},set:function(e){t.name=e,o&&(o.innerHTML=t.name)}},closed:{get:function(){return t.closed},set:function(e){t.closed=e,t.closed?p.addClass(n.__ul,U.CLASS_CLOSED):p.removeClass(n.__ul,U.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=e?U.TEXT_OPEN:U.TEXT_CLOSED)}},load:{get:function(){return t.load}},useLocalStorage:{get:function(){return i},set:function(t){P&&(i=t,t?p.bind(window,"unload",e):p.unbind(window,"unload",e),localStorage.setItem(_(n,"isLocal"),t))}}}),f.isUndefined(t.parent)){if(t.closed=!1,p.addClass(this.domElement,U.CLASS_MAIN),p.makeSelectable(this.domElement,!1),P&&i){n.useLocalStorage=!0;var r=localStorage.getItem(_(this,"gui"));r&&(t.load=JSON.parse(r))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=U.TEXT_CLOSED,p.addClass(this.__closeButton,U.CLASS_CLOSE_BUTTON),this.domElement.appendChild(this.__closeButton),p.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===t.closed&&(t.closed=!0);var o=document.createTextNode(t.name);p.addClass(o,"controller-name");var a=g(n,o),s=function(t){return t.preventDefault(),n.closed=!n.closed,!1};p.addClass(this.__ul,U.CLASS_CLOSED),p.addClass(a,"title"),p.bind(a,"click",s),t.closed||(this.closed=!1)}t.autoPlace&&(f.isUndefined(t.parent)&&(O&&(L=document.createElement("div"),p.addClass(L,"dg"),p.addClass(L,U.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(L),O=!1),L.appendChild(this.domElement),p.addClass(this.domElement,U.CLASS_AUTO_PLACE)),this.parent||w(n,t.width)),p.bind(window,"resize",function(){n.onResize()}),p.bind(this.__ul,"webkitTransitionEnd",function(){n.onResize()}),p.bind(this.__ul,"transitionend",function(){n.onResize()}),p.bind(this.__ul,"oTransitionEnd",function(){n.onResize()}),this.onResize(),t.resizable&&b(this);n.getRoot();t.parent||function(){var t=n.getRoot();t.width+=1,f.defer(function(){t.width-=1})}()};return U.toggleHide=function(){I=!I,f.each(N,function(t){t.domElement.style.zIndex=I?-999:999,t.domElement.style.opacity=I?0:1})},U.CLASS_AUTO_PLACE="a",U.CLASS_AUTO_PLACE_CONTAINER="ac",U.CLASS_MAIN="main",U.CLASS_CONTROLLER_ROW="cr",U.CLASS_TOO_TALL="taller-than-window",U.CLASS_CLOSED="closed",U.CLASS_CLOSE_BUTTON="close-button",U.CLASS_DRAG="drag",U.DEFAULT_WIDTH=245,U.TEXT_CLOSED="Close Controls",U.TEXT_OPEN="Open Controls",p.bind(window,"keydown",function(t){"text"===document.activeElement.type||72!==t.which&&72!=t.keyCode||U.toggleHide()},!1),f.extend(U.prototype,{add:function(t,e){return m(this,t,e,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(t,e){return m(this,t,e,{color:!0})},remove:function(t){this.__ul.removeChild(t.__li),this.__controllers.slice(this.__controllers.indexOf(t),1);var e=this;f.defer(function(){e.onResize()})},destroy:function(){this.autoPlace&&L.removeChild(this.domElement)},addFolder:function(t){if(void 0!==this.__folders[t])throw new Error('You already have a folder in this GUI by the name "'+t+'"');var e={name:t,parent:this};e.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[t]&&(e.closed=this.load.folders[t].closed,e.load=this.load.folders[t]);var n=new U(e);this.__folders[t]=n;var i=g(this,n.domElement);return p.addClass(i,"folder"),n},open:function(){this.closed=!1},close:function(){this.closed=!0},onResize:function(){var t=this.getRoot();if(t.scrollable){var e=p.getOffset(t.__ul).top,n=0;f.each(t.__ul.childNodes,function(e){t.autoPlace&&e===t.__save_row||(n+=p.getHeight(e))}),window.innerHeight-e-20<n?(p.addClass(t.domElement,U.CLASS_TOO_TALL),t.__ul.style.height=window.innerHeight-e-20+"px"):(p.removeClass(t.domElement,U.CLASS_TOO_TALL),t.__ul.style.height="auto")}t.__resize_handle&&f.defer(function(){t.__resize_handle.style.height=t.__ul.offsetHeight+"px"}),t.__closeButton&&(t.__closeButton.style.width=t.width+"px")},remember:function(){if(f.isUndefined(R)&&(R=new d,R.domElement.innerHTML='<div id="dg-save" class="dg dialogue">\n\n Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n <textarea id="dg-new-constructor"></textarea>\n\n <div id="dg-save-locally">\n\n <input id="dg-local-storage" type="checkbox"/> Automatically save\n values to <code>localStorage</code> on exit.\n\n <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n easier to work incrementally, but <code>localStorage</code> is fragile,\n and your friends may not see the same values you do.\n \n </div>\n \n </div>\n\n</div>'),this.parent)throw new Error("You can only call remember on a top level GUI.");var t=this;f.each(Array.prototype.slice.call(arguments),function(e){0==t.__rememberedObjects.length&&x(t),-1==t.__rememberedObjects.indexOf(e)&&t.__rememberedObjects.push(e)}),this.autoPlace&&w(this,this.width)},getRoot:function(){for(var t=this;t.parent;)t=t.parent;return t},getSaveObject:function(){var t=this.load;return t.closed=this.closed,this.__rememberedObjects.length>0&&(t.preset=this.preset,t.remembered||(t.remembered={}),t.remembered[this.preset]=E(this)),t.folders={},f.each(this.__folders,function(e,n){t.folders[n]=e.getSaveObject()}),t},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=E(this),S(this,!1)},saveAs:function(t){this.load.remembered||(this.load.remembered={},this.load.remembered[C]=E(this,!0)),this.load.remembered[t]=E(this),this.preset=t,M(this,t,!0)},revert:function(t){f.each(this.__controllers,function(e){this.getRoot().load.remembered?y(t||this.getRoot(),e):e.setValue(e.initialValue)},this),f.each(this.__folders,function(t){t.revert(t)}),t||S(this.getRoot(),!1)},listen:function(t){var e=0==this.__listening.length;this.__listening.push(t),e&&A(this.__listening)}}),U}(n.utils.css,0,0,n.controllers.factory=function(t,e,n,i,r,o,a){return function(s,c){var u=s[c];return a.isArray(arguments[2])||a.isObject(arguments[2])?new t(s,c,arguments[2]):a.isNumber(u)?a.isNumber(arguments[2])&&a.isNumber(arguments[3])?new n(s,c,arguments[2],arguments[3]):new e(s,c,{min:arguments[2],max:arguments[3]}):a.isString(u)?new i(s,c):a.isFunction(u)?new r(s,c,""):a.isBoolean(u)?new o(s,c):void 0}}(n.controllers.OptionController,n.controllers.NumberControllerBox,n.controllers.NumberControllerSlider,n.controllers.StringController=function(t,e,n){var i=function(t,n){function r(){a.setValue(a.__input.value)}function o(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}i.superclass.call(this,t,n);var a=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),e.bind(this.__input,"keyup",r),e.bind(this.__input,"change",r),e.bind(this.__input,"blur",o),e.bind(this.__input,"keydown",function(t){13===t.keyCode&&this.blur()}),this.updateDisplay(),this.domElement.appendChild(this.__input)};return i.superclass=t,n.extend(i.prototype,t.prototype,{updateDisplay:function(){return e.isActive(this.__input)||(this.__input.value=this.getValue()),i.superclass.prototype.updateDisplay.call(this)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.controllers.FunctionController,n.controllers.BooleanController,n.utils.common),n.controllers.Controller,n.controllers.BooleanController,n.controllers.FunctionController,n.controllers.NumberControllerBox,n.controllers.NumberControllerSlider,n.controllers.OptionController,n.controllers.ColorController=function(t,e,n,i,r){function o(t,e,n,i){t.style.background="",r.each(c,function(r){t.style.cssText+="background: "+r+"linear-gradient("+e+", "+n+" 0%, "+i+" 100%); "})}function a(t){t.style.background="",t.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",t.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",t.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",t.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",t.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var s=function(t,c){function u(t){p(t),e.bind(window,"mousemove",p),e.bind(window,"mouseup",l)}function l(){e.unbind(window,"mousemove",p),e.unbind(window,"mouseup",l)}function h(){var t=i(this.value);!1!==t?(m.__color.__state=t,m.setValue(m.__color.toOriginal())):this.value=m.__color.toString()}function d(){e.unbind(window,"mousemove",f),e.unbind(window,"mouseup",d)}function p(t){t.preventDefault();var n=e.getWidth(m.__saturation_field),i=e.getOffset(m.__saturation_field),r=(t.clientX-i.left+document.body.scrollLeft)/n,o=1-(t.clientY-i.top+document.body.scrollTop)/n;return o>1?o=1:o<0&&(o=0),r>1?r=1:r<0&&(r=0),m.__color.v=o,m.__color.s=r,m.setValue(m.__color.toOriginal()),!1}function f(t){t.preventDefault();var n=e.getHeight(m.__hue_field),i=e.getOffset(m.__hue_field),r=1-(t.clientY-i.top+document.body.scrollTop)/n;return r>1?r=1:r<0&&(r=0),m.__color.h=360*r,m.setValue(m.__color.toOriginal()),!1}s.superclass.call(this,t,c),this.__color=new n(this.getValue()),this.__temp=new n(0);var m=this;this.domElement=document.createElement("div"),e.makeSelectable(this.domElement,!1),this.__selector=document.createElement("div"),this.__selector.className="selector",this.__saturation_field=document.createElement("div"),this.__saturation_field.className="saturation-field",this.__field_knob=document.createElement("div"),this.__field_knob.className="field-knob",this.__field_knob_border="2px solid ",this.__hue_knob=document.createElement("div"),this.__hue_knob.className="hue-knob",this.__hue_field=document.createElement("div"),this.__hue_field.className="hue-field",this.__input=document.createElement("input"),this.__input.type="text",this.__input_textShadow="0 1px 1px ",e.bind(this.__input,"keydown",function(t){13===t.keyCode&&h.call(this)}),e.bind(this.__input,"blur",h),e.bind(this.__selector,"mousedown",function(t){e.addClass(this,"drag").bind(window,"mouseup",function(t){e.removeClass(m.__selector,"drag")})});var g=document.createElement("div");r.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),r.extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),r.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),r.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),r.extend(g.style,{width:"100%",height:"100%",background:"none"}),o(g,"top","rgba(0,0,0,0)","#000"),r.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"}),a(this.__hue_field),r.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"}),e.bind(this.__saturation_field,"mousedown",u),e.bind(this.__field_knob,"mousedown",u),e.bind(this.__hue_field,"mousedown",function(t){f(t),e.bind(window,"mousemove",f),e.bind(window,"mouseup",d)}),this.__saturation_field.appendChild(g),this.__selector.appendChild(this.__field_knob),this.__selector.appendChild(this.__saturation_field),this.__selector.appendChild(this.__hue_field),this.__hue_field.appendChild(this.__hue_knob),this.domElement.appendChild(this.__input),this.domElement.appendChild(this.__selector),this.updateDisplay()};s.superclass=t,r.extend(s.prototype,t.prototype,{updateDisplay:function(){var t=i(this.getValue());if(!1!==t){var e=!1;r.each(n.COMPONENTS,function(n){if(!r.isUndefined(t[n])&&!r.isUndefined(this.__color.__state[n])&&t[n]!==this.__color.__state[n])return e=!0,{}},this),e&&r.extend(this.__color.__state,t)}r.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var a=this.__color.v<.5||this.__color.s>.5?255:0,s=255-a;r.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+"rgb("+a+","+a+","+a+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,o(this.__saturation_field,"left","#fff",this.__temp.toString()),r.extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+a+","+a+","+a+")",textShadow:this.__input_textShadow+"rgba("+s+","+s+","+s+",.7)"})}});var c=["-moz-","-o-","-webkit-","-ms-",""];return s}(n.controllers.Controller,n.dom.dom,n.color.Color=function(t,e,n,i){function r(t,e,n){Object.defineProperty(t,e,{get:function(){return"RGB"===this.__state.space?this.__state[e]:(a(this,e,n),this.__state[e])},set:function(t){"RGB"!==this.__state.space&&(a(this,e,n),this.__state.space="RGB"),this.__state[e]=t}})}function o(t,e){Object.defineProperty(t,e,{get:function(){return"HSV"===this.__state.space?this.__state[e]:(s(this),this.__state[e])},set:function(t){"HSV"!==this.__state.space&&(s(this),this.__state.space="HSV"),this.__state[e]=t}})}function a(t,n,r){if("HEX"===t.__state.space)t.__state[n]=e.component_from_hex(t.__state.hex,r);else{if("HSV"!==t.__state.space)throw"Corrupted color state";i.extend(t.__state,e.hsv_to_rgb(t.__state.h,t.__state.s,t.__state.v))}}function s(t){var n=e.rgb_to_hsv(t.r,t.g,t.b);i.extend(t.__state,{s:n.s,v:n.v}),i.isNaN(n.h)?i.isUndefined(t.__state.h)&&(t.__state.h=0):t.__state.h=n.h}var c=function(){if(this.__state=t.apply(this,arguments),!1===this.__state)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||1};return c.COMPONENTS=["r","g","b","h","s","v","hex","a"],i.extend(c.prototype,{toString:function(){return n(this)},toOriginal:function(){return this.__state.conversion.write(this)}}),r(c.prototype,"r",2),r(c.prototype,"g",1),r(c.prototype,"b",0),o(c.prototype,"h"),o(c.prototype,"s"),o(c.prototype,"v"),Object.defineProperty(c.prototype,"a",{get:function(){return this.__state.a},set:function(t){this.__state.a=t}}),Object.defineProperty(c.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=e.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(t){this.__state.space="HEX",this.__state.hex=t}}),c}(n.color.interpret,n.color.math=function(){var t;return{hsv_to_rgb:function(t,e,n){var i=Math.floor(t/60)%6,r=t/60-Math.floor(t/60),o=n*(1-e),a=n*(1-r*e),s=n*(1-(1-r)*e),c=[[n,s,o],[a,n,o],[o,n,s],[o,a,n],[s,o,n],[n,o,a]][i];return{r:255*c[0],g:255*c[1],b:255*c[2]}},rgb_to_hsv:function(t,e,n){var i,r,o=Math.min(t,e,n),a=Math.max(t,e,n),s=a-o;return 0==a?{h:NaN,s:0,v:0}:(r=s/a,i=t==a?(e-n)/s:e==a?2+(n-t)/s:4+(t-e)/s,i/=6,i<0&&(i+=1),{h:360*i,s:r,v:a/255})},rgb_to_hex:function(t,e,n){var i=this.hex_with_component(0,2,t);return i=this.hex_with_component(i,1,e),i=this.hex_with_component(i,0,n)},component_from_hex:function(t,e){return t>>8*e&255},hex_with_component:function(e,n,i){return i<<(t=8*n)|e&~(255<<t)}}}(),n.color.toString,n.utils.common),n.color.interpret,n.utils.common),n.utils.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t,e){window.setTimeout(t,1e3/60)}}(),n.dom.CenteredDiv=function(t,e){var n=function(){this.backgroundElement=document.createElement("div"),e.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear"}),t.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),e.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var n=this;t.bind(this.backgroundElement,"click",function(){n.hide()})};return n.prototype.show=function(){var t=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),e.defer(function(){t.backgroundElement.style.opacity=1,t.domElement.style.opacity=1,t.domElement.style.webkitTransform="scale(1)"})},n.prototype.hide=function(){var e=this,n=function(){e.domElement.style.display="none",e.backgroundElement.style.display="none",t.unbind(e.domElement,"webkitTransitionEnd",n),t.unbind(e.domElement,"transitionend",n),t.unbind(e.domElement,"oTransitionEnd",n)};t.bind(this.domElement,"webkitTransitionEnd",n),t.bind(this.domElement,"transitionend",n),t.bind(this.domElement,"oTransitionEnd",n),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},n.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-t.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-t.getHeight(this.domElement)/2+"px"},n}(n.dom.dom,n.utils.common),n.dom.dom,n.utils.common)},,,,,function(t,e,n){t.exports=function(){return new Worker(n.p+"hilbert3D.min.js")}},function(t,e,n){"use strict";function i(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function r(){var t=.95*window.innerWidth,e=.95*window.innerHeight;f=E.webgl?new _.WebGLRenderer({antialias:!0,preserveDrawingBuffer:!0}):new _.CanvasRenderer,m=new _.Scene,g=new _.PerspectiveCamera(33,window.innerWidth/window.innerHeight,1,1e4),g.position.set(50,50,50),g.lookAt(0,0,0),m.add(g),f.setSize(t,e),f.setClearColor(v.background_color,1),f.setPixelRatio(window.devicePixelRatio),d=f.domElement,d.name="canvas",d.addEventListener("dblclick",ondblclick,!1),d.addEventListener("click",onclick,!1),document.body.appendChild(d),p=new T(g,d),p.enableDamping=!0,c(v.grid),u(v.axis)}function o(){requestAnimationFrame(o),f.render(m,g)}function a(t){var e=new b.GUI;e.remember(t),e.add(t,"linewidth").name("Line thickness").min(1).max(10).step(1),e.addColor(t,"background_color").name("Background color").onChange(function(t){m.background=new _.Color(t)}),e.add(t,"size").min(1).max(30).step(1).name("Size"),e.add(t,"draw").name("Draw the curve"),e.addColor(t,"background_color").name("Background color").onChange(function(t){m.background=new _.Color(t)}),e.add(t,"axis").name("Draw axis?").listen().onChange(function(t){u(t)}),e.add(t,"grid").name("Draw grids?").listen().onChange(function(t){c(t)}),e.add(t,"download").name("Download"),e.add(t,"clear").name("Clear the scene")}function s(){for(;m.children.length>0;)m.remove(m.children[0]);c(v.grid),u(v.axis)}function c(t){if(!0===t){var e=new _.GridHelper(100,50);e.name="gridXZ",m.add(e);var n=new _.GridHelper(100,50);n.rotation.x=Math.PI/2,n.name="gridXY",m.add(n);var i=new _.GridHelper(100,50);i.rotation.z=Math.PI/2,i.name="gridYZ",m.add(i)}else m.remove(m.getObjectByName("gridXZ")),m.remove(m.getObjectByName("gridXY")),m.remove(m.getObjectByName("gridYZ"))}function u(t){if(!0===t){var e=new _.AxisHelper(100);e.name="axis",m.add(e)}else m.remove(m.getObjectByName("axis"))}function l(t,e){s();var n=new _.Geometry,i=[];n.vertices=t;for(var r=0;r<e;r++)i[r]=new _.Color(16777215);n.colors=i;for(var o,a,c=new _.LineBasicMaterial({color:16777215,opacity:1,linewidth:1,vertexColors:_.VertexColors}),u=[[c,.3*1.5,[0,0,0],n]],r=0;r<u.length;++r)a=u[r],o=new _.Line(a[3],a[0]),o.scale.x=o.scale.y=o.scale.z=a[1],o.position.x=a[2][0],o.position.y=a[2][1],o.position.z=a[2][2];m.add(new _.Line(n,c))}function h(t,e,n){var i=d.toDataURL("image/png"),r=document.createElement("a");r.download=n,r.href=i,r.dataset.downloadurl=["image/png",r.download,r.href].join(":"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}var d,p,f,m,g,v,y=n(2),_=i(y),x=n(0),b=i(x),w=n(3),E=i(w),M=n(10),T=n(1)(_),S=new M;S.onmessage=function(t){l(t.data.points,t.data.size)},window.addEventListener("resize",function(){g.aspect=window.innerWidth/window.innerHeight,g.updateProjectionMatrix(),f.setSize(.95*window.innerWidth,.95*window.innerHeight)},!1),window.addEventListener("load",function(){v={size:4,draw:function(){var t=JSON.parse(JSON.stringify(v));S.postMessage(t)},clear:function(){s()},download:function(){var t="hilbert-curve-"+(new Date).getTime().toString();h(d,"canvas",t)},linewidth:2,axis:!0,grid:!1,background_color:"#000000"},r(),a(v),o()})}]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(t){function i(s){if(r[s])return r[s].exports;var n=r[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}var r={};i.m=t,i.c=r,i.i=function(t){return t},i.d=function(t,r,s){i.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:s})},i.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(r,"a",r),r},i.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},i.p="",i(i.s=1)}([function(t,i,r){var s=i.Hilbert2d=r(2).Hilbert2d,n=i.Hilbert3d=r(3).Hilbert3d,e=new s;i.d2xy=e.d2xy,i.xy=e.xy,i.xy2d=e.xy2d,i.d2=e.d;var h=new n;i.d2xyz=h.d2xyz,i.xyz=h.xyz,i.xyz2d=h.xyz2d,i.d3=h.d,i.d=function(){if(2==arguments.length)return e.d.apply(e,arguments);if(3==arguments.length)return h.d.apply(h,arguments);throw new Error("Invalid number of arguments: "+arguments.length+". Need 2 or 3")}},function(t,i,r){"use strict";var s=r(0),n=function(t){if(t&&t.__esModule)return t;var i={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r]);return i.default=t,i}(s);self.addEventListener("message",function(t){for(var i=Math.pow(2,3*t.data.size),r=new n.Hilbert3d(i),s=[],h=0,o=0,a=0;a<i;a++){var x=r.xyz(a);x.x>=o&&(o=x),s.push({x:x.x/1,y:x.y/1,z:x.z/1}),void 0!==s[a-1]&&(h+=e(s[a-1],x))}postMessage({points:s,size:i,distance:h})},!1);var e=function(t,i){return Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)+Math.pow(t.z-i.z,2))}},function(t,i){i.Hilbert2d=function(t,i){function r(t){return{x:t.y,y:t.x}}if(t=t||{},"number"==typeof t?(this.size=t,this.anchorAxisOrder=i||"xy"):"string"==typeof t?this.anchorAxisOrder=t:(this.size=t.top,this.anchorAxisOrder=t.axisOrder||"xy"),!(this.anchorAxisOrder in{xy:1,yx:1}))throw new Error("Invalid axis order: "+anchorAxisOrder);if(this.size){this.log2size=0;for(var s=1;s<this.size;s*=2,this.log2size++);if(s!=this.size)throw new Error("Invalid size: "+this.size+". Must be a power of 2.");this.log2parity=this.log2size%2}this.maybeRotate=function(t,i){if(this.size){if("xy"==this.anchorAxisOrder&&i^this.log2parity)return r(t);if("yx"==this.anchorAxisOrder&&!(i^this.log2parity))return r(t)}else if("xy"==this.anchorAxisOrder){if(0==i)return r(t)}else if(1==i)return r(t);return t},this.d2xy=this.xy=function(t){t=Math.floor(t);for(var i={x:0,y:0},s=1,n=0,e=this.size||0;t>0||s<e;){var h=1&t/2,o=1&(h^t);0==o&&(1==h&&(i={x:s-1-i.x,y:s-1-i.y}),i=r(i)),i={x:i.x+s*o,y:i.y+s*h},s*=2,t=Math.floor(t/4),n=(n+1)%2}return this.maybeRotate(i,n)};var n=[0,1,3,2];this.xy2d=this.d=function(t,i){for(var s={x:Math.floor(t),y:Math.floor(i)},e=1,h=1,o=Math.max(s.x,s.y);2*e<=o;e*=2)h=(h+1)%2;s=this.maybeRotate(s,h);for(var a=0;e>0;){var x=s.x&e&&1,y=s.y&e&&1;a*=4,a+=n[2*y+x],0==x&&(1==y&&(s={x:e-1-s.x,y:e-1-s.y}),s=r(s)),s={x:s.x%e,y:s.y%e},e=Math.floor(e/2)}return a}}},function(t,i,r){var s=r(4).Point;debug=!1,log=function(t){debug&&console.log(t)};var n=[0,1,3,2,7,6,4,5];i.Hilbert3d=function(t,i){if(t=t||{},"number"==typeof t?(this.size=t,this.anchorAxisOrder=i):"string"==typeof t?this.anchorAxisOrder=t:(this.size=t.top,this.anchorAxisOrder=t.axisOrder),this.anchorAxisOrder&&!(this.anchorAxisOrder in{xyz:1,xzy:1,yxz:1,yzx:1,zxy:1,zyx:1}))throw new Error("Invalid axis order: "+anchorAxisOrder);if("xyz"==this.anchorAxisOrder&&(this.anchorAxisOrder=null),this.anchorAxisOrder&&(this.reverseAnchorAxisOrder={xzy:"xzy",yxz:"yxz",yzx:"zxy",zxy:"yzx",zyx:"zyx"}[this.anchorAxisOrder]),this.size){this.log2size=0;for(var r=1;r<this.size;r*=2,this.log2size++);if(r!=this.size)throw new Error("Invalid size: "+this.size+". Must be a power of 2.");this.log2parity=this.log2size%3}this.d2xyz=this.xyz=function(t){t=Math.floor(t);for(var i=new s,r=1,n=2,e=this.size||0;t>0||r<e;){var h=1&t,o=t/2&1,a=t/4&1,x=new s(h^o,o^a,a);i=i.rotate(x,r-1).add(x.mult(r)),t=Math.floor(t/8),r*=2,n++}return i=this.size?i.rotateLeft(n-this.log2parity+1):i.rotateLeft(n),i.shuffle(this.reverseAnchorAxisOrder)},this.xyz2d=this.d=function(t,i,r){for(var e=new s(t,i,r).map(Math.floor),h=1,o=0,a=Math.max.apply(Math,e.arr);2*h<=a;h*=2)o=(o+1)%3;e=e.shuffle(this.anchorAxisOrder),e=this.size?e.rotateRight(o-this.log2parity+1):e.rotateRight(o);for(var x=0;h>0;){var y=new s(e.x&h&&1,e.y&h&&1,e.z&h&&1);log("p: "+e.pp()+" s: "+h+" regs: "+y.pp()+"("+y.n+") level: "+o+" v: "+n[y.n]),x*=8,x+=n[y.n],o=(o+2)%3,e=e.mod(h),e=e.unrotate(y,h-1),h=Math.floor(h/2)}return x}}},function(t,i){var r=i.Point=function(t,i,s){t instanceof Array&&(i=t[1],s=t[2],t=t[0]),this.x=Math.round(t)||0,this.y=Math.round(i)||0,this.z=Math.round(s)||0,this.arr=[this.x,this.y,this.z],this.n=4*this.z+2*this.y+this.x,this.map=function(n){return new r([t,i,s].map(n))},this.mult=function(t){return new r(this.x*t,this.y*t,this.z*t)},this.add=function(t){return t instanceof Number?new r(this.x+t,this.y+t,this.z+t):new r(this.x+t.x,this.y+t.y,this.z+t.z)},this.mod=function(t){return new r(this.x%t,this.y%t,this.z%t)},this.rotate=function(t,i){return 0==t.n?new r(this.z,this.x,this.y):1==t.n||3==t.n?new r(this.y,this.z,this.x):2==t.n||6==t.n?new r(i-this.x,i-this.y,this.z):5==t.n||7==t.n?new r(this.y,i-this.z,i-this.x):new r(i-this.z,this.x,i-this.y)},this.unrotate=function(t,i){return 0==t.n?new r(this.y,this.z,this.x):1==t.n||3==t.n?new r(this.z,this.x,this.y):2==t.n||6==t.n?new r(i-this.x,i-this.y,this.z):5==t.n||7==t.n?new r(i-this.z,this.x,i-this.y):new r(this.y,i-this.z,i-this.x)},this.rotateLeft=function(t){return t%3==0?this:t%3==1?new r(this.y,this.z,this.x):new r(this.z,this.x,this.y)},this.rotateRight=function(t){return t%3==0?this:t%3==1?new r(this.z,this.x,this.y):new r(this.y,this.z,this.x)},this.shuffle=function(t){return t?new r(this[t[0]],this[t[1]],this[t[2]]):this},this.pp=function(){return[this.x,this.y,this.z].join(",")},this.manhattanDistance=function(t){return Math.abs(t.x-this.x)+Math.abs(t.y-this.y)+Math.abs(t.z-this.z)}}}]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Hilbert 3D</title> | |
<script type="text/javascript" src="vendors.min.js"></script><script type="text/javascript" src="hilbert3d.min.js"></script><script type="text/javascript" src="app.min.js"></script></head> | |
<body style="background-color: #000000;"> | |
</body> | |
</html> |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n=window.webpackJsonp;window.webpackJsonp=function(r,o,a){for(var s,u,c,l=0,h=[];l<r.length;l++)u=r[l],i[u]&&h.push(i[u][0]),i[u]=0;for(s in o)Object.prototype.hasOwnProperty.call(o,s)&&(t[s]=o[s]);for(n&&n(r,o,a);h.length;)h.shift()();if(a)for(l=0;l<a.length;l++)c=e(e.s=a[l]);return c};var r={},i={1:0};e.e=function(t){function n(){s.onerror=s.onload=null,clearTimeout(u);var e=i[t];0!==e&&(e&&e[1](new Error("Loading chunk "+t+" failed.")),i[t]=void 0)}var r=i[t];if(0===r)return new Promise(function(t){t()});if(r)return r[2];var o=new Promise(function(e,n){r=i[t]=[e,n]});r[2]=o;var a=document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript",s.charset="utf-8",s.async=!0,s.timeout=12e4,e.nc&&s.setAttribute("nonce",e.nc),s.src=e.p+""+t+".min.js";var u=setTimeout(n,12e4);return s.onerror=s.onload=n,a.appendChild(s),o},e.m=t,e.c=r,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e.oe=function(t){throw console.error(t),t},e(e.s=16)}([function(t,e,n){t.exports=n(5),t.exports.color=n(4)},function(t,e){t.exports=function(t){function e(e,n){function r(){return 2*Math.PI/60/60*O.autoRotateSpeed}function i(){return Math.pow(.95,O.zoomSpeed)}function o(t){H.theta-=t}function a(t){H.phi-=t}function s(e){O.object instanceof t.PerspectiveCamera?V/=e:O.object instanceof t.OrthographicCamera?(O.object.zoom=Math.max(O.minZoom,Math.min(O.maxZoom,O.object.zoom*e)),O.object.updateProjectionMatrix(),W=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),O.enableZoom=!1)}function u(e){O.object instanceof t.PerspectiveCamera?V*=e:O.object instanceof t.OrthographicCamera?(O.object.zoom=Math.max(O.minZoom,Math.min(O.maxZoom,O.object.zoom/e)),O.object.updateProjectionMatrix(),W=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),O.enableZoom=!1)}function c(t){X.set(t.clientX,t.clientY)}function l(t){Q.set(t.clientX,t.clientY)}function h(t){Z.set(t.clientX,t.clientY)}function f(t){q.set(t.clientX,t.clientY),Y.subVectors(q,X);var e=O.domElement===document?O.domElement.body:O.domElement;o(2*Math.PI*Y.x/e.clientWidth*O.rotateSpeed),a(2*Math.PI*Y.y/e.clientHeight*O.rotateSpeed),X.copy(q),O.update()}function d(t){$.set(t.clientX,t.clientY),tt.subVectors($,Q),tt.y>0?s(i()):tt.y<0&&u(i()),Q.copy($),O.update()}function p(t){J.set(t.clientX,t.clientY),K.subVectors(J,Z),rt(K.x,K.y),Z.copy(J),O.update()}function m(t){}function g(t){t.deltaY<0?u(i()):t.deltaY>0&&s(i()),O.update()}function v(t){switch(t.keyCode){case O.keys.UP:rt(0,O.keyPanSpeed),O.update();break;case O.keys.BOTTOM:rt(0,-O.keyPanSpeed),O.update();break;case O.keys.LEFT:rt(O.keyPanSpeed,0),O.update();break;case O.keys.RIGHT:rt(-O.keyPanSpeed,0),O.update()}}function y(t){X.set(t.touches[0].pageX,t.touches[0].pageY)}function _(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);Q.set(0,r)}function x(t){Z.set(t.touches[0].pageX,t.touches[0].pageY)}function b(t){q.set(t.touches[0].pageX,t.touches[0].pageY),Y.subVectors(q,X);var e=O.domElement===document?O.domElement.body:O.domElement;o(2*Math.PI*Y.x/e.clientWidth*O.rotateSpeed),a(2*Math.PI*Y.y/e.clientHeight*O.rotateSpeed),X.copy(q),O.update()}function w(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);$.set(0,r),tt.subVectors($,Q),tt.y>0?u(i()):tt.y<0&&s(i()),Q.copy($),O.update()}function M(t){J.set(t.touches[0].pageX,t.touches[0].pageY),K.subVectors(J,Z),rt(K.x,K.y),Z.copy(J),O.update()}function E(t){}function T(t){if(!1!==O.enabled){if(t.preventDefault(),t.button===O.mouseButtons.ORBIT){if(!1===O.enableRotate)return;c(t),z=B.ROTATE}else if(t.button===O.mouseButtons.ZOOM){if(!1===O.enableZoom)return;l(t),z=B.DOLLY}else if(t.button===O.mouseButtons.PAN){if(!1===O.enablePan)return;h(t),z=B.PAN}z!==B.NONE&&(document.addEventListener("mousemove",S,!1),document.addEventListener("mouseup",A,!1),O.dispatchEvent(D))}}function S(t){if(!1!==O.enabled)if(t.preventDefault(),z===B.ROTATE){if(!1===O.enableRotate)return;f(t)}else if(z===B.DOLLY){if(!1===O.enableZoom)return;d(t)}else if(z===B.PAN){if(!1===O.enablePan)return;p(t)}}function A(t){!1!==O.enabled&&(m(t),document.removeEventListener("mousemove",S,!1),document.removeEventListener("mouseup",A,!1),O.dispatchEvent(F),z=B.NONE)}function C(t){!1===O.enabled||!1===O.enableZoom||z!==B.NONE&&z!==B.ROTATE||(t.preventDefault(),t.stopPropagation(),g(t),O.dispatchEvent(D),O.dispatchEvent(F))}function L(t){!1!==O.enabled&&!1!==O.enableKeys&&!1!==O.enablePan&&v(t)}function R(t){if(!1!==O.enabled){switch(t.touches.length){case 1:if(!1===O.enableRotate)return;y(t),z=B.TOUCH_ROTATE;break;case 2:if(!1===O.enableZoom)return;_(t),z=B.TOUCH_DOLLY;break;case 3:if(!1===O.enablePan)return;x(t),z=B.TOUCH_PAN;break;default:z=B.NONE}z!==B.NONE&&O.dispatchEvent(D)}}function P(t){if(!1!==O.enabled)switch(t.preventDefault(),t.stopPropagation(),t.touches.length){case 1:if(!1===O.enableRotate)return;if(z!==B.TOUCH_ROTATE)return;b(t);break;case 2:if(!1===O.enableZoom)return;if(z!==B.TOUCH_DOLLY)return;w(t);break;case 3:if(!1===O.enablePan)return;if(z!==B.TOUCH_PAN)return;M(t);break;default:z=B.NONE}}function N(t){!1!==O.enabled&&(E(t),O.dispatchEvent(F),z=B.NONE)}function I(t){t.preventDefault()}this.object=e,this.domElement=void 0!==n?n:document,this.enabled=!0,this.target=new t.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:t.MOUSE.LEFT,ZOOM:t.MOUSE.MIDDLE,PAN:t.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return G.phi},this.getAzimuthalAngle=function(){return G.theta},this.reset=function(){O.target.copy(O.target0),O.object.position.copy(O.position0),O.object.zoom=O.zoom0,O.object.updateProjectionMatrix(),O.dispatchEvent(U),O.update(),z=B.NONE},this.update=function(){var n=new t.Vector3,i=(new t.Quaternion).setFromUnitVectors(e.up,new t.Vector3(0,1,0)),a=i.clone().inverse(),s=new t.Vector3,u=new t.Quaternion;return function(){var t=O.object.position;return n.copy(t).sub(O.target),n.applyQuaternion(i),G.setFromVector3(n),O.autoRotate&&z===B.NONE&&o(r()),G.theta+=H.theta,G.phi+=H.phi,G.theta=Math.max(O.minAzimuthAngle,Math.min(O.maxAzimuthAngle,G.theta)),G.phi=Math.max(O.minPolarAngle,Math.min(O.maxPolarAngle,G.phi)),G.makeSafe(),G.radius*=V,G.radius=Math.max(O.minDistance,Math.min(O.maxDistance,G.radius)),O.target.add(j),n.setFromSpherical(G),n.applyQuaternion(a),t.copy(O.target).add(n),O.object.lookAt(O.target),!0===O.enableDamping?(H.theta*=1-O.dampingFactor,H.phi*=1-O.dampingFactor):H.set(0,0,0),V=1,j.set(0,0,0),!!(W||s.distanceToSquared(O.object.position)>k||8*(1-u.dot(O.object.quaternion))>k)&&(O.dispatchEvent(U),s.copy(O.object.position),u.copy(O.object.quaternion),W=!1,!0)}}(),this.dispose=function(){O.domElement.removeEventListener("contextmenu",I,!1),O.domElement.removeEventListener("mousedown",T,!1),O.domElement.removeEventListener("wheel",C,!1),O.domElement.removeEventListener("touchstart",R,!1),O.domElement.removeEventListener("touchend",N,!1),O.domElement.removeEventListener("touchmove",P,!1),document.removeEventListener("mousemove",S,!1),document.removeEventListener("mouseup",A,!1),window.removeEventListener("keydown",L,!1)};var O=this,U={type:"change"},D={type:"start"},F={type:"end"},B={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY:4,TOUCH_PAN:5},z=B.NONE,k=1e-6,G=new t.Spherical,H=new t.Spherical,V=1,j=new t.Vector3,W=!1,X=new t.Vector2,q=new t.Vector2,Y=new t.Vector2,Z=new t.Vector2,J=new t.Vector2,K=new t.Vector2,Q=new t.Vector2,$=new t.Vector2,tt=new t.Vector2,et=function(){var e=new t.Vector3;return function(t,n){e.setFromMatrixColumn(n,0),e.multiplyScalar(-t),j.add(e)}}(),nt=function(){var e=new t.Vector3;return function(t,n){e.setFromMatrixColumn(n,1),e.multiplyScalar(t),j.add(e)}}(),rt=function(){var e=new t.Vector3;return function(n,r){var i=O.domElement===document?O.domElement.body:O.domElement;if(O.object instanceof t.PerspectiveCamera){var o=O.object.position;e.copy(o).sub(O.target);var a=e.length();a*=Math.tan(O.object.fov/2*Math.PI/180),et(2*n*a/i.clientHeight,O.object.matrix),nt(2*r*a/i.clientHeight,O.object.matrix)}else O.object instanceof t.OrthographicCamera?(et(n*(O.object.right-O.object.left)/O.object.zoom/i.clientWidth,O.object.matrix),nt(r*(O.object.top-O.object.bottom)/O.object.zoom/i.clientHeight,O.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),O.enablePan=!1)}}();O.domElement.addEventListener("contextmenu",I,!1),O.domElement.addEventListener("mousedown",T,!1),O.domElement.addEventListener("wheel",C,!1),O.domElement.addEventListener("touchstart",R,!1),O.domElement.addEventListener("touchend",N,!1),O.domElement.addEventListener("touchmove",P,!1),window.addEventListener("keydown",L,!1),this.update()}return e.prototype=Object.create(t.EventDispatcher.prototype),e.prototype.constructor=e,Object.defineProperties(e.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(t){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!t}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(t){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!t}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(t){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!t}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(t){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!t}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(t){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!t}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor},set:function(t){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor=t}}}),e}},function(t,e,n){"use strict";function r(){}function i(t,e){this.x=t||0,this.y=e||0}function o(t,e,n,r,a,s,u,c,l,h){Object.defineProperty(this,"id",{value:Es++}),this.uuid=Ms.generateUUID(),this.name="",this.image=void 0!==t?t:o.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:o.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:ya,this.wrapT=void 0!==r?r:ya,this.magFilter=void 0!==a?a:Ma,this.minFilter=void 0!==s?s:Ta,this.anisotropy=void 0!==l?l:1,this.format=void 0!==u?u:ka,this.type=void 0!==c?c:Sa,this.offset=new i(0,0),this.repeat=new i(1,1),this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==h?h:ds,this.version=0,this.onUpdate=null}function a(t,e,n,r){this.x=t||0,this.y=e||0,this.z=n||0,this.w=void 0!==r?r:1}function s(t,e,n){this.uuid=Ms.generateUUID(),this.width=t,this.height=e,this.scissor=new a(0,0,t,e),this.scissorTest=!1,this.viewport=new a(0,0,t,e),n=n||{},void 0===n.minFilter&&(n.minFilter=Ma),this.texture=new o(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function u(t,e,n){s.call(this,t,e,n),this.activeCubeFace=0,this.activeMipMapLevel=0}function c(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._w=void 0!==r?r:1}function l(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}function h(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function f(t,e,n,r,i,a,s,u,c,l,h,f){o.call(this,null,a,s,u,c,l,r,i,h,f),this.image={data:t,width:e,height:n},this.magFilter=void 0!==c?c:xa,this.minFilter=void 0!==l?l:xa,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}function d(t,e,n,r,i,a,s,u,c,l){t=void 0!==t?t:[],e=void 0!==e?e:la,o.call(this,t,e,n,r,i,a,s,u,c,l),this.flipY=!1}function p(){this.seq=[],this.map={}}function m(t,e,n){var r=t[0];if(r<=0||r>0)return t;var i=e*n,o=As[i];if(void 0===o&&(o=new Float32Array(i),As[i]=o),0!==e){r.toArray(o,0);for(var a=1,s=0;a!==e;++a)s+=n,t[a].toArray(o,s)}return o}function g(t,e){var n=Cs[e];void 0===n&&(n=new Int32Array(e),Cs[e]=n);for(var r=0;r!==e;++r)n[r]=t.allocTextureUnit();return n}function v(t,e){t.uniform1f(this.addr,e)}function y(t,e){t.uniform1i(this.addr,e)}function _(t,e){void 0===e.x?t.uniform2fv(this.addr,e):t.uniform2f(this.addr,e.x,e.y)}function x(t,e){void 0!==e.x?t.uniform3f(this.addr,e.x,e.y,e.z):void 0!==e.r?t.uniform3f(this.addr,e.r,e.g,e.b):t.uniform3fv(this.addr,e)}function b(t,e){void 0===e.x?t.uniform4fv(this.addr,e):t.uniform4f(this.addr,e.x,e.y,e.z,e.w)}function w(t,e){t.uniformMatrix2fv(this.addr,!1,e.elements||e)}function M(t,e){void 0===e.elements?t.uniformMatrix3fv(this.addr,!1,e):(Rs.set(e.elements),t.uniformMatrix3fv(this.addr,!1,Rs))}function E(t,e){void 0===e.elements?t.uniformMatrix4fv(this.addr,!1,e):(Ls.set(e.elements),t.uniformMatrix4fv(this.addr,!1,Ls))}function T(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTexture2D(e||Ts,r)}function S(t,e,n){var r=n.allocTextureUnit();t.uniform1i(this.addr,r),n.setTextureCube(e||Ss,r)}function A(t,e){t.uniform2iv(this.addr,e)}function C(t,e){t.uniform3iv(this.addr,e)}function L(t,e){t.uniform4iv(this.addr,e)}function R(t){switch(t){case 5126:return v;case 35664:return _;case 35665:return x;case 35666:return b;case 35674:return w;case 35675:return M;case 35676:return E;case 35678:return T;case 35680:return S;case 5124:case 35670:return y;case 35667:case 35671:return A;case 35668:case 35672:return C;case 35669:case 35673:return L}}function P(t,e){t.uniform1fv(this.addr,e)}function N(t,e){t.uniform1iv(this.addr,e)}function I(t,e){t.uniform2fv(this.addr,m(e,this.size,2))}function O(t,e){t.uniform3fv(this.addr,m(e,this.size,3))}function U(t,e){t.uniform4fv(this.addr,m(e,this.size,4))}function D(t,e){t.uniformMatrix2fv(this.addr,!1,m(e,this.size,4))}function F(t,e){t.uniformMatrix3fv(this.addr,!1,m(e,this.size,9))}function B(t,e){t.uniformMatrix4fv(this.addr,!1,m(e,this.size,16))}function z(t,e,n){var r=e.length,i=g(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTexture2D(e[o]||Ts,i[o])}function k(t,e,n){var r=e.length,i=g(n,r);t.uniform1iv(this.addr,i);for(var o=0;o!==r;++o)n.setTextureCube(e[o]||Ss,i[o])}function G(t){switch(t){case 5126:return P;case 35664:return I;case 35665:return O;case 35666:return U;case 35674:return D;case 35675:return F;case 35676:return B;case 35678:return z;case 35680:return k;case 5124:case 35670:return N;case 35667:case 35671:return A;case 35668:case 35672:return C;case 35669:case 35673:return L}}function H(t,e,n){this.id=t,this.addr=n,this.setValue=R(e.type)}function V(t,e,n){this.id=t,this.addr=n,this.size=e.size,this.setValue=G(e.type)}function j(t){this.id=t,p.call(this)}function W(t,e){t.seq.push(e),t.map[e.id]=e}function X(t,e,n){var r=t.name,i=r.length;for(Ps.lastIndex=0;;){var o=Ps.exec(r),a=Ps.lastIndex,s=o[1],u="]"===o[2],c=o[3];if(u&&(s|=0),void 0===c||"["===c&&a+2===i){W(n,void 0===c?new H(s,t,e):new V(s,t,e));break}var l=n.map,h=l[s];void 0===h&&(h=new j(s),W(n,h)),n=h}}function q(t,e,n){p.call(this),this.renderer=n;for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=0;i<r;++i){var o=t.getActiveUniform(e,i),a=o.name;X(o,t.getUniformLocation(e,a),this)}}function Y(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}function Z(t,e){this.min=void 0!==t?t:new i(1/0,1/0),this.max=void 0!==e?e:new i(-1/0,-1/0)}function J(t,e){function n(){var t=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),e=new Uint16Array([0,1,2,0,2,3]);o=p.createBuffer(),a=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,o),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),f=p.createTexture(),d=p.createTexture(),m.bindTexture(p.TEXTURE_2D,f),p.texImage2D(p.TEXTURE_2D,0,p.RGB,16,16,0,p.RGB,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),m.bindTexture(p.TEXTURE_2D,d),p.texImage2D(p.TEXTURE_2D,0,p.RGBA,16,16,0,p.RGBA,p.UNSIGNED_BYTE,null),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","vUV = uv;","vec2 pos = position;","if ( renderType == 2 ) {","vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","vVisibility = visibility.r / 9.0;","vVisibility *= 1.0 - visibility.g / 9.0;","vVisibility *= visibility.b / 9.0;","vVisibility *= 1.0 - visibility.a / 9.0;","pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","}","gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","if ( renderType == 0 ) {","gl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","} else if ( renderType == 1 ) {","gl_FragColor = texture2D( map, vUV );","} else {","vec4 texture = texture2D( map, vUV );","texture.a *= opacity * vVisibility;","gl_FragColor = texture;","gl_FragColor.rgb *= color;","}","}"].join("\n")},u=r(s),c={vertex:p.getAttribLocation(u,"position"),uv:p.getAttribLocation(u,"uv")},h={renderType:p.getUniformLocation(u,"renderType"),map:p.getUniformLocation(u,"map"),occlusionMap:p.getUniformLocation(u,"occlusionMap"),opacity:p.getUniformLocation(u,"opacity"),color:p.getUniformLocation(u,"color"),scale:p.getUniformLocation(u,"scale"),rotation:p.getUniformLocation(u,"rotation"),screenPosition:p.getUniformLocation(u,"screenPosition")}}function r(e){var n=p.createProgram(),r=p.createShader(p.FRAGMENT_SHADER),i=p.createShader(p.VERTEX_SHADER),o="precision "+t.getPrecision()+" float;\n";return p.shaderSource(r,o+e.fragmentShader),p.shaderSource(i,o+e.vertexShader),p.compileShader(r),p.compileShader(i),p.attachShader(n,r),p.attachShader(n,i),p.linkProgram(n),n}var o,a,s,u,c,h,f,d,p=t.context,m=t.state;this.render=function(r,s,g){if(0!==e.length){var v=new l,y=g.w/g.z,_=.5*g.z,x=.5*g.w,b=16/g.w,w=new i(b*y,b),M=new l(1,1,0),E=new i(1,1),T=new Z;T.min.set(g.x,g.y),T.max.set(g.x+(g.z-16),g.y+(g.w-16)),void 0===u&&n(),p.useProgram(u),m.initAttributes(),m.enableAttribute(c.vertex),m.enableAttribute(c.uv),m.disableUnusedAttributes(),p.uniform1i(h.occlusionMap,0),p.uniform1i(h.map,1),p.bindBuffer(p.ARRAY_BUFFER,o),p.vertexAttribPointer(c.vertex,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(c.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,a),m.disable(p.CULL_FACE),m.buffers.depth.setMask(!1);for(var S=0,A=e.length;S<A;S++){b=16/g.w,w.set(b*y,b);var C=e[S];if(v.set(C.matrixWorld.elements[12],C.matrixWorld.elements[13],C.matrixWorld.elements[14]),v.applyMatrix4(s.matrixWorldInverse),v.applyMatrix4(s.projectionMatrix),M.copy(v),E.x=g.x+M.x*_+_-8,E.y=g.y+M.y*x+x-8,!0===T.containsPoint(E)){m.activeTexture(p.TEXTURE0),m.bindTexture(p.TEXTURE_2D,null),m.activeTexture(p.TEXTURE1),m.bindTexture(p.TEXTURE_2D,f),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGB,E.x,E.y,16,16,0),p.uniform1i(h.renderType,0),p.uniform2f(h.scale,w.x,w.y),p.uniform3f(h.screenPosition,M.x,M.y,M.z),m.disable(p.BLEND),m.enable(p.DEPTH_TEST),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),m.activeTexture(p.TEXTURE0),m.bindTexture(p.TEXTURE_2D,d),p.copyTexImage2D(p.TEXTURE_2D,0,p.RGBA,E.x,E.y,16,16,0),p.uniform1i(h.renderType,1),m.disable(p.DEPTH_TEST),m.activeTexture(p.TEXTURE1),m.bindTexture(p.TEXTURE_2D,f),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0),C.positionScreen.copy(M),C.customUpdateCallback?C.customUpdateCallback(C):C.updateLensFlares(),p.uniform1i(h.renderType,2),m.enable(p.BLEND);for(var L=0,R=C.lensFlares.length;L<R;L++){var P=C.lensFlares[L];P.opacity>.001&&P.scale>.001&&(M.x=P.x,M.y=P.y,M.z=P.z,b=P.size*P.scale/g.w,w.x=b*y,w.y=b,p.uniform3f(h.screenPosition,M.x,M.y,M.z),p.uniform2f(h.scale,w.x,w.y),p.uniform1f(h.rotation,P.rotation),p.uniform1f(h.opacity,P.opacity),p.uniform3f(h.color,P.color.r,P.color.g,P.color.b),m.setBlending(P.blending,P.blendEquation,P.blendSrc,P.blendDst),t.setTexture2D(P.texture,1),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0))}}}m.enable(p.CULL_FACE),m.enable(p.DEPTH_TEST),m.buffers.depth.setMask(!0),t.resetGLState()}}}function K(t,e){function n(){var t=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),e=new Uint16Array([0,1,2,0,2,3]);a=p.createBuffer(),s=p.createBuffer(),p.bindBuffer(p.ARRAY_BUFFER,a),p.bufferData(p.ARRAY_BUFFER,t,p.STATIC_DRAW),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.bufferData(p.ELEMENT_ARRAY_BUFFER,e,p.STATIC_DRAW),u=r(),h={position:p.getAttribLocation(u,"position"),uv:p.getAttribLocation(u,"uv")},f={uvOffset:p.getUniformLocation(u,"uvOffset"),uvScale:p.getUniformLocation(u,"uvScale"),rotation:p.getUniformLocation(u,"rotation"),scale:p.getUniformLocation(u,"scale"),color:p.getUniformLocation(u,"color"),map:p.getUniformLocation(u,"map"),opacity:p.getUniformLocation(u,"opacity"),modelViewMatrix:p.getUniformLocation(u,"modelViewMatrix"),projectionMatrix:p.getUniformLocation(u,"projectionMatrix"),fogType:p.getUniformLocation(u,"fogType"),fogDensity:p.getUniformLocation(u,"fogDensity"),fogNear:p.getUniformLocation(u,"fogNear"),fogFar:p.getUniformLocation(u,"fogFar"),fogColor:p.getUniformLocation(u,"fogColor"),alphaTest:p.getUniformLocation(u,"alphaTest")};var n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");n.width=8,n.height=8;var i=n.getContext("2d");i.fillStyle="white",i.fillRect(0,0,8,8),d=new o(n),d.needsUpdate=!0}function r(){var e=p.createProgram(),n=p.createShader(p.VERTEX_SHADER),r=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(n,["precision "+t.getPrecision()+" float;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","void main() {","vUV = uvOffset + uv * uvScale;","vec2 alignedPosition = position * scale;","vec2 rotatedPosition;","rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","vec4 finalPosition;","finalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","finalPosition.xy += rotatedPosition;","finalPosition = projectionMatrix * finalPosition;","gl_Position = finalPosition;","}"].join("\n")),p.shaderSource(r,["precision "+t.getPrecision()+" float;","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","void main() {","vec4 texture = texture2D( map, vUV );","if ( texture.a < alphaTest ) discard;","gl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","if ( fogType > 0 ) {","float depth = gl_FragCoord.z / gl_FragCoord.w;","float fogFactor = 0.0;","if ( fogType == 1 ) {","fogFactor = smoothstep( fogNear, fogFar, depth );","} else {","const float LOG2 = 1.442695;","fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );","fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","}","gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );","}","}"].join("\n")),p.compileShader(n),p.compileShader(r),p.attachShader(e,n),p.attachShader(e,r),p.linkProgram(e),e}function i(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:e.id-t.id}var a,s,u,h,f,d,p=t.context,m=t.state,g=new l,v=new c,y=new l;this.render=function(r,o){if(0!==e.length){void 0===u&&n(),p.useProgram(u),m.initAttributes(),m.enableAttribute(h.position),m.enableAttribute(h.uv),m.disableUnusedAttributes(),m.disable(p.CULL_FACE),m.enable(p.BLEND),p.bindBuffer(p.ARRAY_BUFFER,a),p.vertexAttribPointer(h.position,2,p.FLOAT,!1,16,0),p.vertexAttribPointer(h.uv,2,p.FLOAT,!1,16,8),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,s),p.uniformMatrix4fv(f.projectionMatrix,!1,o.projectionMatrix.elements),m.activeTexture(p.TEXTURE0),p.uniform1i(f.map,0);var c=0,l=0,_=r.fog;_?(p.uniform3f(f.fogColor,_.color.r,_.color.g,_.color.b),_.isFog?(p.uniform1f(f.fogNear,_.near),p.uniform1f(f.fogFar,_.far),p.uniform1i(f.fogType,1),c=1,l=1):_.isFogExp2&&(p.uniform1f(f.fogDensity,_.density),p.uniform1i(f.fogType,2),c=2,l=2)):(p.uniform1i(f.fogType,0),c=0,l=0);for(var x=0,b=e.length;x<b;x++){var w=e[x];w.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,w.matrixWorld),w.z=-w.modelViewMatrix.elements[14]}e.sort(i);for(var M=[],x=0,b=e.length;x<b;x++){var w=e[x],E=w.material;if(!1!==E.visible){p.uniform1f(f.alphaTest,E.alphaTest),p.uniformMatrix4fv(f.modelViewMatrix,!1,w.modelViewMatrix.elements),w.matrixWorld.decompose(g,v,y),M[0]=y.x,M[1]=y.y;var T=0;r.fog&&E.fog&&(T=l),c!==T&&(p.uniform1i(f.fogType,T),c=T),null!==E.map?(p.uniform2f(f.uvOffset,E.map.offset.x,E.map.offset.y),p.uniform2f(f.uvScale,E.map.repeat.x,E.map.repeat.y)):(p.uniform2f(f.uvOffset,0,0),p.uniform2f(f.uvScale,1,1)),p.uniform1f(f.opacity,E.opacity),p.uniform3f(f.color,E.color.r,E.color.g,E.color.b),p.uniform1f(f.rotation,E.rotation),p.uniform2fv(f.scale,M),m.setBlending(E.blending,E.blendEquation,E.blendSrc,E.blendDst),m.buffers.depth.setTest(E.depthTest),m.buffers.depth.setMask(E.depthWrite),E.map?t.setTexture2D(E.map,0):t.setTexture2D(d,0),p.drawElements(p.TRIANGLES,6,p.UNSIGNED_SHORT,0)}}m.enable(p.CULL_FACE),t.resetGLState()}}}function Q(){Object.defineProperty(this,"id",{value:Fs++}),this.uuid=Ms.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=So,this.side=vo,this.shading=bo,this.vertexColors=wo,this.opacity=1,this.transparent=!1,this.blendSrc=ko,this.blendDst=Go,this.blendEquation=Po,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Jo,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.needsUpdate=!0}function $(t){Q.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function tt(t){Q.call(this),this.type="MeshDepthMaterial",this.depthPacking=bs,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(t)}function et(t,e){this.min=void 0!==t?t:new l(1/0,1/0,1/0),this.max=void 0!==e?e:new l(-1/0,-1/0,-1/0)}function nt(t,e){this.center=void 0!==t?t:new l,this.radius=void 0!==e?e:0}function rt(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function it(t,e){this.normal=void 0!==t?t:new l(1,0,0),this.constant=void 0!==e?e:0}function ot(t,e,n,r,i,o){this.planes=[void 0!==t?t:new it,void 0!==e?e:new it,void 0!==n?n:new it,void 0!==r?r:new it,void 0!==i?i:new it,void 0!==o?o:new it]}function at(t,e,n,r){function o(e,n,r,i){var o=e.geometry,a=null,s=M,u=e.customDepthMaterial;if(r&&(s=E,u=e.customDistanceMaterial),u)a=u;else{var c=!1;n.morphTargets&&(o&&o.isBufferGeometry?c=o.morphAttributes&&o.morphAttributes.position&&o.morphAttributes.position.length>0:o&&o.isGeometry&&(c=o.morphTargets&&o.morphTargets.length>0)),e.isSkinnedMesh&&!1===n.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e);var l=e.isSkinnedMesh&&n.skinning,h=0;c&&(h|=x),l&&(h|=b),a=s[h]}if(t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var f=a.uuid,d=n.uuid,p=T[f];void 0===p&&(p={},T[f]=p);var m=p[d];void 0===m&&(m=a.clone(),p[d]=m),a=m}a.visible=n.visible,a.wireframe=n.wireframe;var g=n.side;return F.renderSingleSided&&g==_o&&(g=vo),F.renderReverseSided&&(g===vo?g=yo:g===yo&&(g=vo)),a.side=g,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r&&void 0!==a.uniforms.lightPos&&a.uniforms.lightPos.value.copy(i),a}function u(e,r,i,a){if(!1!==e.visible){if(e.layers.test(r.layers)&&(e.isMesh||e.isLine||e.isPoints)&&e.castShadow&&(!e.frustumCulled||d.intersectsObject(e))){e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld);var s=n.update(e),c=e.material;if(Array.isArray(c))for(var l=s.groups,h=0,f=l.length;h<f;h++){var p=l[h],m=c[p.materialIndex];if(m&&m.visible){var g=o(e,m,a,_);t.renderBufferDirect(i,null,s,g,e,p)}}else if(c.visible){var g=o(e,c,a,_);t.renderBufferDirect(i,null,s,g,e,null)}}for(var v=e.children,y=0,x=v.length;y<x;y++)u(v[y],r,i,a)}}var c=t.context,f=t.state,d=new ot,p=new h,m=e.shadows,g=new i,v=new i(r.maxTextureSize,r.maxTextureSize),y=new l,_=new l,x=1,b=2,w=1+(x|b),M=new Array(w),E=new Array(w),T={},S=[new l(1,0,0),new l(-1,0,0),new l(0,0,1),new l(0,0,-1),new l(0,1,0),new l(0,-1,0)],A=[new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,1,0),new l(0,0,1),new l(0,0,-1)],C=[new a,new a,new a,new a,new a,new a],L=new tt;L.depthPacking=ws,L.clipping=!0;for(var R=Ds.distanceRGBA,P=Os.clone(R.uniforms),N=0;N!==w;++N){var I=0!=(N&x),O=0!=(N&b),U=L.clone();U.morphTargets=I,U.skinning=O,M[N]=U;var D=new $({defines:{USE_SHADOWMAP:""},uniforms:P,vertexShader:R.vertexShader,fragmentShader:R.fragmentShader,morphTargets:I,skinning:O,clipping:!0});E[N]=D}var F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=mo,this.renderReverseSided=!0,this.renderSingleSided=!0,this.render=function(e,n){if(!1!==F.enabled&&(!1!==F.autoUpdate||!1!==F.needsUpdate)&&0!==m.length){f.disable(c.BLEND),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);for(var r,i,o=0,a=m.length;o<a;o++){var l=m[o],h=l.shadow;if(void 0!==h){var x=h.camera,b=h.matrix;if(_.setFromMatrixPosition(l.matrixWorld),x.position.copy(_),g.copy(h.mapSize),g.min(v),l&&l.isPointLight){r=6,i=!0;var w=g.x,M=g.y;C[0].set(2*w,M,w,M),C[1].set(0,M,w,M),C[2].set(3*w,M,w,M),C[3].set(w,M,w,M),C[4].set(3*w,0,w,M),C[5].set(w,0,w,M),g.x*=4,g.y*=2,b.makeTranslation(-_.x,-_.y,-_.z)}else r=1,i=!1,y.setFromMatrixPosition(l.target.matrixWorld),x.lookAt(y),x.updateMatrixWorld(),x.matrixWorldInverse.getInverse(x.matrixWorld),b.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),b.multiply(x.projectionMatrix),b.multiply(x.matrixWorldInverse);if(null===h.map){var E={minFilter:xa,magFilter:xa,format:ka};h.map=new s(g.x,g.y,E),h.map.texture.name=l.name+".shadowMap",x.updateProjectionMatrix()}h.isSpotLightShadow&&h.update(l);var T=h.map;t.setRenderTarget(T),t.clear();for(var L=0;L<r;L++){if(i){y.copy(x.position),y.add(S[L]),x.up.copy(A[L]),x.lookAt(y),x.updateMatrixWorld(),x.matrixWorldInverse.getInverse(x.matrixWorld);var R=C[L];f.viewport(R)}p.multiplyMatrices(x.projectionMatrix,x.matrixWorldInverse),d.setFromMatrix(p),u(e,n,x,i)}}else console.warn("THREE.WebGLShadowMap:",l,"has no shadow.")}var P=t.getClearColor(),N=t.getClearAlpha();t.setClearColor(P,N),F.needsUpdate=!1}}}function st(t,e){this.origin=void 0!==t?t:new l,this.direction=void 0!==e?e:new l}function ut(t,e,n,r){this._x=t||0,this._y=e||0,this._z=n||0,this._order=r||ut.DefaultOrder}function ct(){this.mask=1}function lt(){function t(){i.setFromEuler(r,!1)}function e(){r.setFromQuaternion(i,void 0,!1)}Object.defineProperty(this,"id",{value:Bs++}),this.uuid=Ms.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=lt.DefaultUp.clone();var n=new l,r=new ut,i=new c,o=new l(1,1,1);r.onChange(t),i.onChange(e),Object.defineProperties(this,{position:{enumerable:!0,value:n},rotation:{enumerable:!0,value:r},quaternion:{enumerable:!0,value:i},scale:{enumerable:!0,value:o},modelViewMatrix:{value:new h},normalMatrix:{value:new rt}}),this.matrix=new h,this.matrixWorld=new h,this.matrixAutoUpdate=lt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new ct,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={},this.onBeforeRender=function(){},this.onAfterRender=function(){}}function ht(t,e){this.start=void 0!==t?t:new l,this.end=void 0!==e?e:new l}function ft(t,e,n){this.a=void 0!==t?t:new l,this.b=void 0!==e?e:new l,this.c=void 0!==n?n:new l}function dt(t,e,n,r,i,o){this.a=t,this.b=e,this.c=n,this.normal=r&&r.isVector3?r:new l,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new Y,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=void 0!==o?o:0}function pt(t){Q.call(this),this.type="MeshBasicMaterial",this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ea,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(t)}function mt(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.uuid=Ms.generateUUID(),this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function gt(t,e){mt.call(this,new Int8Array(t),e)}function vt(t,e){mt.call(this,new Uint8Array(t),e)}function yt(t,e){mt.call(this,new Uint8ClampedArray(t),e)}function _t(t,e){mt.call(this,new Int16Array(t),e)}function xt(t,e){mt.call(this,new Uint16Array(t),e)}function bt(t,e){mt.call(this,new Int32Array(t),e)}function wt(t,e){mt.call(this,new Uint32Array(t),e)}function Mt(t,e){mt.call(this,new Float32Array(t),e)}function Et(t,e){mt.call(this,new Float64Array(t),e)}function Tt(){this.indices=[],this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}function St(t){if(0===t.length)return-1/0;for(var e=t[0],n=1,r=t.length;n<r;++n)t[n]>e&&(e=t[n]);return e}function At(){return zs++}function Ct(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Ms.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Lt(){Object.defineProperty(this,"id",{value:At()}),this.uuid=Ms.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0}}function Rt(t,e){lt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new pt({color:16777215*Math.random()}),this.drawMode=ls,this.updateMorphTargets()}function Pt(t,e,n,r,i,o){Ct.call(this),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o},this.fromBufferGeometry(new Nt(t,e,n,r,i,o)),this.mergeVertices()}function Nt(t,e,n,r,i,o){function a(t,e,n,r,i,o,a,m,g,v,y){var _,x,b=o/g,w=a/v,M=o/2,E=a/2,T=m/2,S=g+1,A=v+1,C=0,L=0,R=new l;for(x=0;x<A;x++){var P=x*w-E;for(_=0;_<S;_++){var N=_*b-M;R[t]=N*r,R[e]=P*i,R[n]=T,c.push(R.x,R.y,R.z),R[t]=0,R[e]=0,R[n]=m>0?1:-1,h.push(R.x,R.y,R.z),f.push(_/g),f.push(1-x/v),C+=1}}for(x=0;x<v;x++)for(_=0;_<g;_++){var I=d+_+S*x,O=d+_+S*(x+1),U=d+(_+1)+S*(x+1),D=d+(_+1)+S*x;u.push(I,O,D),u.push(O,U,D),L+=6}s.addGroup(p,L,y),p+=L,d+=C}Lt.call(this),this.type="BoxBufferGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:r,heightSegments:i,depthSegments:o};var s=this;r=Math.floor(r)||1,i=Math.floor(i)||1,o=Math.floor(o)||1;var u=[],c=[],h=[],f=[],d=0,p=0;a("z","y","x",-1,-1,n,e,t,o,i,0),a("z","y","x",1,-1,n,e,-t,o,i,1),a("x","z","y",1,1,t,n,e,r,o,2),a("x","z","y",1,-1,t,n,-e,r,o,3),a("x","y","z",1,-1,t,e,n,r,i,4),a("x","y","z",-1,-1,t,e,-n,r,i,5),this.setIndex(u),this.addAttribute("position",new Mt(c,3)),this.addAttribute("normal",new Mt(h,3)),this.addAttribute("uv",new Mt(f,2))}function It(t,e,n,r){Ct.call(this),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new Ot(t,e,n,r)),this.mergeVertices()}function Ot(t,e,n,r){Lt.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:r};var i,o,a=t/2,s=e/2,u=Math.floor(n)||1,c=Math.floor(r)||1,l=u+1,h=c+1,f=t/u,d=e/c,p=[],m=[],g=[],v=[];for(o=0;o<h;o++){var y=o*d-s;for(i=0;i<l;i++){var _=i*f-a;m.push(_,-y,0),g.push(0,0,1),v.push(i/u),v.push(1-o/c)}}for(o=0;o<c;o++)for(i=0;i<u;i++){var x=i+l*o,b=i+l*(o+1),w=i+1+l*(o+1),M=i+1+l*o;p.push(x,b,M),p.push(b,w,M)}this.setIndex(p),this.addAttribute("position",new Mt(m,3)),this.addAttribute("normal",new Mt(g,3)),this.addAttribute("uv",new Mt(v,2))}function Ut(){lt.call(this),this.type="Camera",this.matrixWorldInverse=new h,this.projectionMatrix=new h}function Dt(t,e,n,r){Ut.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==n?n:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==e?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function Ft(t,e,n,r,i,o){Ut.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=r,this.near=void 0!==i?i:.1,this.far=void 0!==o?o:2e3,this.updateProjectionMatrix()}function Bt(t){function e(e,n){var r=e.array,i=e.dynamic?t.DYNAMIC_DRAW:t.STATIC_DRAW,o=t.createBuffer();t.bindBuffer(n,o),t.bufferData(n,r,i),e.onUploadCallback();var a=t.FLOAT;return r instanceof Float32Array?a=t.FLOAT:r instanceof Float64Array?console.warn("Unsupported data buffer format: Float64Array"):r instanceof Uint16Array?a=t.UNSIGNED_SHORT:r instanceof Int16Array?a=t.SHORT:r instanceof Uint32Array?a=t.UNSIGNED_INT:r instanceof Int32Array?a=t.INT:r instanceof Int8Array?a=t.BYTE:r instanceof Uint8Array&&(a=t.UNSIGNED_BYTE),{buffer:o,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}function n(e,n,r){var i=n.array,o=n.updateRange;t.bindBuffer(r,e),!1===n.dynamic?t.bufferData(r,i,t.STATIC_DRAW):-1===o.count?t.bufferSubData(r,0,i):0===o.count?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(t.bufferSubData(r,o.offset*i.BYTES_PER_ELEMENT,i.subarray(o.offset,o.offset+o.count)),o.count=0)}function r(t){return t.isInterleavedBufferAttribute&&(t=t.data),a[t.uuid]}function i(e){var n=a[e.uuid];n&&(t.deleteBuffer(n.buffer),delete a[e.uuid])}function o(t,r){t.isInterleavedBufferAttribute&&(t=t.data);var i=a[t.uuid];void 0===i?a[t.uuid]=e(t,r):i.version<t.version&&(n(i.buffer,t,r),i.version=t.version)}var a={};return{get:r,remove:i,update:o}}function zt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.program&&e.program&&t.program!==e.program?t.program.id-e.program.id:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function kt(t,e){return t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Gt(){function t(){o=-1,s=-1}function e(t,e,n,r,u){var c,l;n.transparent?(c=a,l=++s):(c=i,l=++o);var h=c[l];h?(h.id=t.id,h.object=t,h.geometry=e,h.material=n,h.program=n.program,h.renderOrder=t.renderOrder,h.z=r,h.group=u):(h={id:t.id,object:t,geometry:e,material:n,program:n.program,renderOrder:t.renderOrder,z:r,group:u},c.push(h))}function n(){i.length=o+1,a.length=s+1}function r(){i.sort(zt),a.sort(kt)}var i=[],o=-1,a=[],s=-1;return{opaque:i,transparent:a,init:t,push:e,finish:n,sort:r}}function Ht(){function t(t,e){var r=t.id+","+e.id,i=n[r];return void 0===i&&(i=new Gt,n[r]=i),i}function e(){n={}}var n={};return{get:t,dispose:e}}function Vt(t,e,n){function r(t){s=t}function i(n){n.array instanceof Uint32Array&&e.get("OES_element_index_uint")?(u=t.UNSIGNED_INT,c=4):n.array instanceof Uint16Array?(u=t.UNSIGNED_SHORT,c=2):(u=t.UNSIGNED_BYTE,c=1)}function o(e,r){t.drawElements(s,r,u,e*c),n.calls++,n.vertices+=r,s===t.TRIANGLES&&(n.faces+=r/3)}function a(r,i,o){var a=e.get("ANGLE_instanced_arrays");if(null===a)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");a.drawElementsInstancedANGLE(s,o,u,i*c,r.maxInstancedCount),n.calls++,n.vertices+=o*r.maxInstancedCount,s===t.TRIANGLES&&(n.faces+=r.maxInstancedCount*o/3)}var s,u,c;this.setMode=r,this.setIndex=i,this.render=o,this.renderInstances=a}function jt(t,e,n){function r(t){a=t}function i(e,r){t.drawArrays(a,e,r),n.calls++,n.vertices+=r,a===t.TRIANGLES&&(n.faces+=r/3)}function o(r,i,o){var s=e.get("ANGLE_instanced_arrays");if(null===s)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");var u=r.attributes.position;u.isInterleavedBufferAttribute?(o=u.data.count,s.drawArraysInstancedANGLE(a,0,o,r.maxInstancedCount)):s.drawArraysInstancedANGLE(a,i,o,r.maxInstancedCount),n.calls++,n.vertices+=o*r.maxInstancedCount,a===t.TRIANGLES&&(n.faces+=r.maxInstancedCount*o/3)}var a;this.setMode=r,this.render=i,this.renderInstances=o}function Wt(t,e,n){function r(t){var i=t.target,o=s[i.id];null!==o.index&&e.remove(o.index);for(var a in o.attributes)e.remove(o.attributes[a]);i.removeEventListener("dispose",r),delete s[i.id];var c=u[i.id];c&&(e.remove(c),delete u[i.id]),c=u[o.id],c&&(e.remove(c),delete u[o.id]),n.geometries--}function i(t,e){var i=s[e.id];return i||(e.addEventListener("dispose",r),e.isBufferGeometry?i=e:e.isGeometry&&(void 0===e._bufferGeometry&&(e._bufferGeometry=(new Lt).setFromObject(t)),i=e._bufferGeometry),s[e.id]=i,n.geometries++,i)}function o(n){var r=n.index,i=n.attributes;null!==r&&e.update(r,t.ELEMENT_ARRAY_BUFFER);for(var o in i)e.update(i[o],t.ARRAY_BUFFER);var a=n.morphAttributes;for(var o in a)for(var s=a[o],u=0,c=s.length;u<c;u++)e.update(s[u],t.ARRAY_BUFFER)}function a(n){var r=u[n.id];if(r)return r;var i=[],o=n.index,a=n.attributes;if(null!==o)for(var s=o.array,c=0,l=s.length;c<l;c+=3){var h=s[c+0],f=s[c+1],d=s[c+2];i.push(h,f,f,d,d,h)}else for(var s=a.position.array,c=0,l=s.length/3-1;c<l;c+=3){var h=c+0,f=c+1,d=c+2;i.push(h,f,f,d,d,h)}return r=new(St(i)>65535?wt:xt)(i,1),e.update(r,t.ELEMENT_ARRAY_BUFFER),u[n.id]=r,r}var s={},u={};return{get:i,update:o,getWireframeAttribute:a}}function Xt(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new l,color:new Y,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":n={position:new l,direction:new l,color:new Y,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":n={position:new l,color:new Y,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new i};break;case"HemisphereLight":n={direction:new l,skyColor:new Y,groundColor:new Y};break;case"RectAreaLight":n={color:new Y,position:new l,halfWidth:new l,halfHeight:new l}}return t[e.id]=n,n}}}function qt(t,e,n){function r(t){var r=n.frame,i=t.geometry,a=e.get(t,i);return o[a.id]!==r&&(i.isGeometry&&a.updateFromObject(t),e.update(a),o[a.id]=r),a}function i(){o={}}var o={};return{update:r,clear:i}}function Yt(t){for(var e=t.split("\n"),n=0;n<e.length;n++)e[n]=n+1+": "+e[n];return e.join("\n")}function Zt(t,e,n){var r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),!1===t.getShaderParameter(r,t.COMPILE_STATUS)&&console.error("THREE.WebGLShader: Shader couldn't compile."),""!==t.getShaderInfoLog(r)&&console.warn("THREE.WebGLShader: gl.getShaderInfoLog()",e===t.VERTEX_SHADER?"vertex":"fragment",t.getShaderInfoLog(r),Yt(n)),r}function Jt(t){switch(t){case ds:return["Linear","( value )"];case ps:return["sRGB","( value )"];case gs:return["RGBE","( value )"];case ys:return["RGBM","( value, 7.0 )"];case _s:return["RGBM","( value, 16.0 )"];case xs:return["RGBD","( value, 256.0 )"];case ms:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+t)}}function Kt(t,e){var n=Jt(e);return"vec4 "+t+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function Qt(t,e){var n=Jt(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function $t(t,e){var n;switch(e){case oa:n="Linear";break;case aa:n="Reinhard";break;case sa:n="Uncharted2";break;case ua:n="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function te(t,e,n){return t=t||{},[t.derivatives||e.envMapCubeUV||e.bumpMap||e.normalMap||e.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(t.fragDepth||e.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",t.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(t.shaderTextureLOD||e.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(re).join("\n")}function ee(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}function ne(t,e,n){for(var r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<i;o++){var a=t.getActiveAttrib(e,o),s=a.name;r[s]=t.getAttribLocation(e,s)}return r}function re(t){return""!==t}function ie(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights)}function oe(t){function e(t,e){var n=Us[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return oe(n)}var n=/^[ \t]*#include +<([\w\d.]+)>/gm;return t.replace(n,e)}function ae(t){function e(t,e,n,r){for(var i="",o=parseInt(e);o<parseInt(n);o++)i+=r.replace(/\[ i \]/g,"[ "+o+" ]");return i}var n=/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;return t.replace(n,e)}function se(t,e,n,r){var i=t.context,o=n.extensions,a=n.defines,s=n.__webglShader.vertexShader,u=n.__webglShader.fragmentShader,c="SHADOWMAP_TYPE_BASIC";r.shadowMapType===mo?c="SHADOWMAP_TYPE_PCF":r.shadowMapType===go&&(c="SHADOWMAP_TYPE_PCF_SOFT");var l="ENVMAP_TYPE_CUBE",h="ENVMAP_MODE_REFLECTION",f="ENVMAP_BLENDING_MULTIPLY";if(r.envMap){switch(n.envMap.mapping){case la:case ha:l="ENVMAP_TYPE_CUBE";break;case ma:case ga:l="ENVMAP_TYPE_CUBE_UV";break;case fa:case da:l="ENVMAP_TYPE_EQUIREC";break;case pa:l="ENVMAP_TYPE_SPHERE"}switch(n.envMap.mapping){case ha:case da:h="ENVMAP_MODE_REFRACTION"}switch(n.combine){case ea:f="ENVMAP_BLENDING_MULTIPLY";break;case na:f="ENVMAP_BLENDING_MIX";break;case ra:f="ENVMAP_BLENDING_ADD"}}var d,p,m=t.gammaFactor>0?t.gammaFactor:1,g=te(o,r,t.extensions),v=ee(a),y=i.createProgram();n.isRawShaderMaterial?(d=[v,"\n"].filter(re).join("\n"),p=[g,v,"\n"].filter(re).join("\n")):(d=["precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+m,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+h:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.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(re).join("\n"),p=[g,"precision "+r.precision+" float;","precision "+r.precision+" int;","#define SHADER_NAME "+n.__webglShader.name,v,r.alphaTest?"#define ALPHATEST "+r.alphaTest:"","#define GAMMA_FACTOR "+m,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+l:"",r.envMap?"#define "+h:"",r.envMap?"#define "+f:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.vertexColors?"#define USE_COLOR":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+r.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(r.numClippingPlanes-r.numClipIntersection),r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+c:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&t.extensions.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",r.envMap&&t.extensions.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",r.toneMapping!==ia?"#define TONE_MAPPING":"",r.toneMapping!==ia?Us.tonemapping_pars_fragment:"",r.toneMapping!==ia?$t("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.outputEncoding||r.mapEncoding||r.envMapEncoding||r.emissiveMapEncoding?Us.encodings_pars_fragment:"",r.mapEncoding?Kt("mapTexelToLinear",r.mapEncoding):"",r.envMapEncoding?Kt("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMapEncoding?Kt("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.outputEncoding?Qt("linearToOutputTexel",r.outputEncoding):"",r.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(re).join("\n")),s=oe(s,r),s=ie(s,r),u=oe(u,r),u=ie(u,r),n.isShaderMaterial||(s=ae(s),u=ae(u));var _=d+s,x=p+u,b=Zt(i,i.VERTEX_SHADER,_),w=Zt(i,i.FRAGMENT_SHADER,x);i.attachShader(y,b),i.attachShader(y,w),void 0!==n.index0AttributeName?i.bindAttribLocation(y,0,n.index0AttributeName):!0===r.morphTargets&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);var M=i.getProgramInfoLog(y),E=i.getShaderInfoLog(b),T=i.getShaderInfoLog(w),S=!0,A=!0;!1===i.getProgramParameter(y,i.LINK_STATUS)?(S=!1,console.error("THREE.WebGLProgram: shader error: ",i.getError(),"gl.VALIDATE_STATUS",i.getProgramParameter(y,i.VALIDATE_STATUS),"gl.getProgramInfoLog",M,E,T)):""!==M?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",M):""!==E&&""!==T||(A=!1),A&&(this.diagnostics={runnable:S,material:n,programLog:M,vertexShader:{log:E,prefix:d},fragmentShader:{log:T,prefix:p}}),i.deleteShader(b),i.deleteShader(w);var C;this.getUniforms=function(){return void 0===C&&(C=new q(i,y,t)),C};var L;return this.getAttributes=function(){return void 0===L&&(L=ne(i,y)),L},this.destroy=function(){i.deleteProgram(y),this.program=void 0},Object.defineProperties(this,{uniforms:{get:function(){return console.warn("THREE.WebGLProgram: .uniforms is now .getUniforms()."),this.getUniforms()}},attributes:{get:function(){return console.warn("THREE.WebGLProgram: .attributes is now .getAttributes()."),this.getAttributes()}}}),this.id=ks++,this.code=e,this.usedTimes=1,this.program=y,this.vertexShader=b,this.fragmentShader=w,this}function ue(t,e){function n(t){var n=t.skeleton,r=n.bones;if(e.floatVertexTextures)return 1024;var i=e.maxVertexUniforms,o=Math.floor((i-20)/4),a=Math.min(o,r.length);return a<r.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+r.length+" bones. This GPU supports "+a+"."),0):a}function r(t,e){var n;return t?t.isTexture?n=t.encoding:t.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),n=t.texture.encoding):n=ds,n===ds&&e&&(n=ms),n}var i=[],o={MeshDepthMaterial:"depth",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points"},a=["precision","supportsVertexTextures","map","mapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];this.getParameters=function(i,a,s,u,c,l){var h=o[i.type],f=l.isSkinnedMesh?n(l):0,d=t.getPrecision();null!==i.precision&&(d=e.getMaxPrecision(i.precision))!==i.precision&&console.warn("THREE.WebGLProgram.getParameters:",i.precision,"not supported, using",d,"instead.");var p=t.getRenderTarget();return{shaderID:h,precision:d,supportsVertexTextures:e.vertexTextures,outputEncoding:r(p?p.texture:null,t.gammaOutput),map:!!i.map,mapEncoding:r(i.map,t.gammaInput),envMap:!!i.envMap,envMapMode:i.envMap&&i.envMap.mapping,envMapEncoding:r(i.envMap,t.gammaInput),envMapCubeUV:!!i.envMap&&(i.envMap.mapping===ma||i.envMap.mapping===ga),lightMap:!!i.lightMap,aoMap:!!i.aoMap,emissiveMap:!!i.emissiveMap,emissiveMapEncoding:r(i.emissiveMap,t.gammaInput),bumpMap:!!i.bumpMap,normalMap:!!i.normalMap,displacementMap:!!i.displacementMap,roughnessMap:!!i.roughnessMap,metalnessMap:!!i.metalnessMap,specularMap:!!i.specularMap,alphaMap:!!i.alphaMap,gradientMap:!!i.gradientMap,combine:i.combine,vertexColors:i.vertexColors,fog:!!s,useFog:i.fog,fogExp:s&&s.isFogExp2,flatShading:i.shading===xo,sizeAttenuation:i.sizeAttenuation,logarithmicDepthBuffer:e.logarithmicDepthBuffer,skinning:i.skinning&&f>0,maxBones:f,useVertexTexture:e.floatVertexTextures,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numClippingPlanes:u,numClipIntersection:c,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&l.receiveShadow&&a.shadows.length>0,shadowMapType:t.shadowMap.type,toneMapping:t.toneMapping,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:i.side===_o,flipSided:i.side===yo,depthPacking:void 0!==i.depthPacking&&i.depthPacking}},this.getProgramCode=function(t,e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(t.fragmentShader),n.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)n.push(r),n.push(t.defines[r]);for(var i=0;i<a.length;i++)n.push(e[a[i]]);return n.join()},this.acquireProgram=function(e,n,r){for(var o,a=0,s=i.length;a<s;a++){var u=i[a];if(u.code===r){o=u,++o.usedTimes;break}}return void 0===o&&(o=new se(t,r,e,n),i.push(o)),o},this.releaseProgram=function(t){if(0==--t.usedTimes){var e=i.indexOf(t);i[e]=i[i.length-1],i.pop(),t.destroy()}},this.programs=i}function ce(t,e,n,r,i,o,a){function s(t,e){if(t.width>e||t.height>e){var n=e/Math.max(t.width,t.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=Math.floor(t.width*n),r.height=Math.floor(t.height*n);return r.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+t.width+"x"+t.height+"). Resized to "+r.width+"x"+r.height,t),r}return t}function u(t){return Ms.isPowerOfTwo(t.width)&&Ms.isPowerOfTwo(t.height)}function c(t){if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement){var e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");e.width=Ms.nearestPowerOfTwo(t.width),e.height=Ms.nearestPowerOfTwo(t.height);return e.getContext("2d").drawImage(t,0,0,e.width,e.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+t.width+"x"+t.height+"). Resized to "+e.width+"x"+e.height,t),e}return t}function l(t){return t.wrapS!==ya||t.wrapT!==ya||t.minFilter!==xa&&t.minFilter!==Ma}function h(e){return e===xa||e===ba||e===wa?t.NEAREST:t.LINEAR}function f(t){var e=t.target;e.removeEventListener("dispose",f),p(e),a.textures--}function d(t){var e=t.target;e.removeEventListener("dispose",d),m(e),a.textures--}function p(e){var n=r.get(e);if(e.image&&n.__image__webglTextureCube)t.deleteTexture(n.__image__webglTextureCube);else{if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture)}r.remove(e)}function m(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLRenderTargetCube)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);r.remove(e.texture),r.remove(e)}}function g(e,i){var o=r.get(e);if(e.version>0&&o.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",e);else{if(!1!==a.complete)return void x(o,e,i);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete",e)}}n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_2D,o.__webglTexture)}function v(e,c){var l=r.get(e);if(6===e.image.length)if(e.version>0&&l.__version!==e.version){l.__image__webglTextureCube||(e.addEventListener("dispose",f),l.__image__webglTextureCube=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+c),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e.flipY);for(var h=e&&e.isCompressedTexture,d=e.image[0]&&e.image[0].isDataTexture,p=[],m=0;m<6;m++)p[m]=h||d?d?e.image[m].image:e.image[m]:s(e.image[m],i.maxCubemapSize);var g=p[0],v=u(g),y=o(e.format),x=o(e.type);_(t.TEXTURE_CUBE_MAP,e,v);for(var m=0;m<6;m++)if(h)for(var b,w=p[m].mipmaps,M=0,E=w.length;M<E;M++)b=w[M],e.format!==ka&&e.format!==za?n.getCompressedTextureFormats().indexOf(y)>-1?n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,M,y,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,M,y,b.width,b.height,0,y,x,b.data);else d?n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,p[m].width,p[m].height,0,y,x,p[m].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,y,y,x,p[m]);e.generateMipmaps&&v&&t.generateMipmap(t.TEXTURE_CUBE_MAP),l.__version=e.version,e.onUpdate&&e.onUpdate(e)}else n.activeTexture(t.TEXTURE0+c),n.bindTexture(t.TEXTURE_CUBE_MAP,l.__image__webglTextureCube)}function y(e,i){n.activeTexture(t.TEXTURE0+i),n.bindTexture(t.TEXTURE_CUBE_MAP,r.get(e).__webglTexture)}function _(n,a,s){var u;if(s?(t.texParameteri(n,t.TEXTURE_WRAP_S,o(a.wrapS)),t.texParameteri(n,t.TEXTURE_WRAP_T,o(a.wrapT)),t.texParameteri(n,t.TEXTURE_MAG_FILTER,o(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,o(a.minFilter))):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),a.wrapS===ya&&a.wrapT===ya||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.",a),t.texParameteri(n,t.TEXTURE_MAG_FILTER,h(a.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,h(a.minFilter)),a.minFilter!==xa&&a.minFilter!==Ma&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.",a)),u=e.get("EXT_texture_filter_anisotropic")){if(a.type===Na&&null===e.get("OES_texture_float_linear"))return;if(a.type===Ia&&null===e.get("OES_texture_half_float_linear"))return;(a.anisotropy>1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function x(e,r,h){void 0===e.__webglInit&&(e.__webglInit=!0,r.addEventListener("dispose",f),e.__webglTexture=t.createTexture(),a.textures++),n.activeTexture(t.TEXTURE0+h),n.bindTexture(t.TEXTURE_2D,e.__webglTexture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,r.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,r.unpackAlignment);var d=s(r.image,i.maxTextureSize);l(r)&&!1===u(d)&&(d=c(d));var p=u(d),m=o(r.format),g=o(r.type);_(t.TEXTURE_2D,r,p);var v,y=r.mipmaps;if(r.isDepthTexture){var x=t.DEPTH_COMPONENT;if(r.type===Na){if(!A)throw new Error("Float Depth Texture only supported in WebGL2.0");x=t.DEPTH_COMPONENT32F}else A&&(x=t.DEPTH_COMPONENT16);r.format===ja&&x===t.DEPTH_COMPONENT&&r.type!==La&&r.type!==Pa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=La,g=o(r.type)),r.format===Wa&&(x=t.DEPTH_STENCIL,r.type!==Fa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Fa,g=o(r.type))),n.texImage2D(t.TEXTURE_2D,0,x,d.width,d.height,0,m,g,null)}else if(r.isDataTexture)if(y.length>0&&p){for(var b=0,w=y.length;b<w;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,m,g,v.data);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,d.width,d.height,0,m,g,d.data);else if(r.isCompressedTexture)for(var b=0,w=y.length;b<w;b++)v=y[b],r.format!==ka&&r.format!==za?n.getCompressedTextureFormats().indexOf(m)>-1?n.compressedTexImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,v.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(t.TEXTURE_2D,b,m,v.width,v.height,0,m,g,v.data);else if(y.length>0&&p){for(var b=0,w=y.length;b<w;b++)v=y[b],n.texImage2D(t.TEXTURE_2D,b,m,m,g,v);r.generateMipmaps=!1}else n.texImage2D(t.TEXTURE_2D,0,m,m,g,d);r.generateMipmaps&&p&&t.generateMipmap(t.TEXTURE_2D),e.__version=r.version,r.onUpdate&&r.onUpdate(r)}function b(e,i,a,s){var u=o(i.texture.format),c=o(i.texture.type);n.texImage2D(s,0,u,i.width,i.height,0,u,c,null),t.bindFramebuffer(t.FRAMEBUFFER,e),t.framebufferTexture2D(t.FRAMEBUFFER,a,s,r.get(i.texture).__webglTexture,0),t.bindFramebuffer(t.FRAMEBUFFER,null)}function w(e,n){t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_COMPONENT16,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)):n.depthBuffer&&n.stencilBuffer?(t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)):t.renderbufferStorage(t.RENDERBUFFER,t.RGBA4,n.width,n.height),t.bindRenderbuffer(t.RENDERBUFFER,null)}function M(e,n){if(n&&n.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported!");if(t.bindFramebuffer(t.FRAMEBUFFER,e),!n.depthTexture||!n.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(n.depthTexture).__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),g(n.depthTexture,0);var i=r.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===ja)t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,i,0);else{if(n.depthTexture.format!==Wa)throw new Error("Unknown depthTexture format");t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,i,0)}}function E(e){var n=r.get(e),i=!0===e.isWebGLRenderTargetCube;if(e.depthTexture){if(i)throw new Error("target.depthTexture not supported in Cube render targets");M(n.__webglFramebuffer,e)}else if(i){n.__webglDepthbuffer=[];for(var o=0;o<6;o++)t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer[o]),n.__webglDepthbuffer[o]=t.createRenderbuffer(),w(n.__webglDepthbuffer[o],e)}else t.bindFramebuffer(t.FRAMEBUFFER,n.__webglFramebuffer),n.__webglDepthbuffer=t.createRenderbuffer(),w(n.__webglDepthbuffer,e);t.bindFramebuffer(t.FRAMEBUFFER,null)}function T(e){var i=r.get(e),o=r.get(e.texture);e.addEventListener("dispose",d),o.__webglTexture=t.createTexture(),a.textures++;var s=!0===e.isWebGLRenderTargetCube,c=u(e);if(s){i.__webglFramebuffer=[];for(var l=0;l<6;l++)i.__webglFramebuffer[l]=t.createFramebuffer()}else i.__webglFramebuffer=t.createFramebuffer();if(s){n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture),_(t.TEXTURE_CUBE_MAP,e.texture,c);for(var l=0;l<6;l++)b(i.__webglFramebuffer[l],e,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+l);e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_CUBE_MAP),n.bindTexture(t.TEXTURE_CUBE_MAP,null)}else n.bindTexture(t.TEXTURE_2D,o.__webglTexture),_(t.TEXTURE_2D,e.texture,c),b(i.__webglFramebuffer,e,t.COLOR_ATTACHMENT0,t.TEXTURE_2D),e.texture.generateMipmaps&&c&&t.generateMipmap(t.TEXTURE_2D),n.bindTexture(t.TEXTURE_2D,null);e.depthBuffer&&E(e)}function S(e){var i=e.texture;if(i.generateMipmaps&&u(e)&&i.minFilter!==xa&&i.minFilter!==Ma){var o=e&&e.isWebGLRenderTargetCube?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,a=r.get(i).__webglTexture;n.bindTexture(o,a),t.generateMipmap(o),n.bindTexture(o,null)}}var A="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext;this.setTexture2D=g,this.setTextureCube=v,this.setTextureCubeDynamic=y,this.setupRenderTarget=T,this.updateRenderTargetMipmap=S}function le(){function t(t){var e=t.uuid,n=r[e];return void 0===n&&(n={},r[e]=n),n}function e(t){delete r[t.uuid]}function n(){r={}}var r={};return{get:t,remove:e,clear:n}}function he(t,e,n){function r(){var e=!1,n=new a,r=null,i=new a;return{setMask:function(n){r===n||e||(t.colorMask(n,n,n,n),r=n)},setLocked:function(t){e=t},setClear:function(e,r,o,a,s){!0===s&&(e*=a,r*=a,o*=a),n.set(e,r,o,a),!1===i.equals(n)&&(t.clearColor(e,r,o,a),i.copy(n))},reset:function(){e=!1,r=null,i.set(0,0,0,1)}}}function i(){var e=!1,n=null,r=null,i=null;return{setTest:function(e){e?d(t.DEPTH_TEST):p(t.DEPTH_TEST)},setMask:function(r){n===r||e||(t.depthMask(r),n=r)},setFunc:function(e){if(r!==e){if(e)switch(e){case qo:t.depthFunc(t.NEVER);break;case Yo:t.depthFunc(t.ALWAYS);break;case Zo:t.depthFunc(t.LESS);break;case Jo:t.depthFunc(t.LEQUAL);break;case Ko:t.depthFunc(t.EQUAL);break;case Qo:t.depthFunc(t.GEQUAL);break;case $o:t.depthFunc(t.GREATER);break;case ta:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}else t.depthFunc(t.LEQUAL);r=e}},setLocked:function(t){e=t},setClear:function(e){i!==e&&(t.clearDepth(e),i=e)},reset:function(){e=!1,n=null,r=null,i=null}}}function o(){var e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null;return{setTest:function(e){e?d(t.STENCIL_TEST):p(t.STENCIL_TEST)},setMask:function(r){n===r||e||(t.stencilMask(r),n=r)},setFunc:function(e,n,a){r===e&&i===n&&o===a||(t.stencilFunc(e,n,a),r=e,i=n,o=a)},setOp:function(e,n,r){a===e&&s===n&&u===r||(t.stencilOp(e,n,r),a=e,s=n,u=r)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,r=null,i=null,o=null,a=null,s=null,u=null,c=null}}}function s(e,n,r){var i=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var a=0;a<r;a++)t.texImage2D(n+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,i);return o}function u(){P.setClear(0,0,0,1),N.setClear(1),I.setClear(0),d(t.DEPTH_TEST),N.setFunc(Jo),y(!1),_(uo),d(t.CULL_FACE),d(t.BLEND),g(So)}function c(){for(var t=0,e=U.length;t<e;t++)U[t]=0}function l(n){if(U[n]=1,0===D[n]&&(t.enableVertexAttribArray(n),D[n]=1),0!==F[n]){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,0),F[n]=0}}function h(n,r){if(U[n]=1,0===D[n]&&(t.enableVertexAttribArray(n),D[n]=1),F[n]!==r){e.get("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(n,r),F[n]=r}}function f(){for(var e=0,n=D.length;e!==n;++e)D[e]!==U[e]&&(t.disableVertexAttribArray(e),D[e]=0)}function d(e){!0!==B[e]&&(t.enable(e),B[e]=!0)}function p(e){!1!==B[e]&&(t.disable(e),B[e]=!1)}function m(){if(null===z&&(z=[],e.get("WEBGL_compressed_texture_pvrtc")||e.get("WEBGL_compressed_texture_s3tc")||e.get("WEBGL_compressed_texture_etc1")))for(var n=t.getParameter(t.COMPRESSED_TEXTURE_FORMATS),r=0;r<n.length;r++)z.push(n[r]);return z}function g(e,r,i,o,a,s,u,c){e!==To?d(t.BLEND):p(t.BLEND),e===k&&c===q||(e===Ao?c?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE,t.ONE,t.ONE)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.SRC_ALPHA,t.ONE)):e===Co?c?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.ONE_MINUS_SRC_COLOR)):e===Lo?c?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA)):(t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ZERO,t.SRC_COLOR)):c?(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)):(t.blendEquationSeparate(t.FUNC_ADD,t.FUNC_ADD),t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA)),k=e,q=c),e===Ro?(a=a||r,s=s||i,u=u||o,r===G&&a===j||(t.blendEquationSeparate(n(r),n(a)),G=r,j=a),i===H&&o===V&&s===W&&u===X||(t.blendFuncSeparate(n(i),n(o),n(s),n(u)),H=i,V=o,W=s,X=u)):(G=null,H=null,V=null,j=null,W=null,X=null)}function v(e){e.side===_o?p(t.CULL_FACE):d(t.CULL_FACE),y(e.side===yo),!0===e.transparent?g(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha):g(To),N.setFunc(e.depthFunc),N.setTest(e.depthTest),N.setMask(e.depthWrite),P.setMask(e.colorWrite),b(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits)}function y(e){Y!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),Y=e)}function _(e){e!==so?(d(t.CULL_FACE),e!==Z&&(e===uo?t.cullFace(t.BACK):e===co?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):p(t.CULL_FACE),Z=e}function x(e){e!==J&&(nt&&t.lineWidth(e),J=e)}function b(e,n,r){e?(d(t.POLYGON_OFFSET_FILL),K===n&&Q===r||(t.polygonOffset(n,r),K=n,Q=r)):p(t.POLYGON_OFFSET_FILL)}function w(){return $}function M(e){$=e,e?d(t.SCISSOR_TEST):p(t.SCISSOR_TEST)}function E(e){void 0===e&&(e=t.TEXTURE0+tt-1),rt!==e&&(t.activeTexture(e),rt=e)}function T(e,n){null===rt&&E();var r=it[rt];void 0===r&&(r={type:void 0,texture:void 0},it[rt]=r),r.type===e&&r.texture===n||(t.bindTexture(e,n||st[e]),r.type=e,r.texture=n)}function S(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error(t)}}function A(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error(t)}}function C(e){!1===ot.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),ot.copy(e))}function L(e){!1===at.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),at.copy(e))}function R(){for(var e=0;e<D.length;e++)1===D[e]&&(t.disableVertexAttribArray(e),D[e]=0);B={},z=null,rt=null,it={},k=null,Y=null,Z=null,P.reset(),N.reset(),I.reset()}var P=new r,N=new i,I=new o,O=t.getParameter(t.MAX_VERTEX_ATTRIBS),U=new Uint8Array(O),D=new Uint8Array(O),F=new Uint8Array(O),B={},z=null,k=null,G=null,H=null,V=null,j=null,W=null,X=null,q=!1,Y=null,Z=null,J=null,K=null,Q=null,$=null,tt=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),et=parseFloat(/^WebGL\ ([0-9])/.exec(t.getParameter(t.VERSION))[1]),nt=parseFloat(et)>=1,rt=null,it={},ot=new a,at=new a,st={};return st[t.TEXTURE_2D]=s(t.TEXTURE_2D,t.TEXTURE_2D,1),st[t.TEXTURE_CUBE_MAP]=s(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),{buffers:{color:P,depth:N,stencil:I},init:u,initAttributes:c,enableAttribute:l,enableAttributeAndDivisor:h,disableUnusedAttributes:f,enable:d,disable:p,getCompressedTextureFormats:m,setBlending:g,setMaterial:v,setFlipSided:y,setCullFace:_,setLineWidth:x,setPolygonOffset:b,getScissorTest:w,setScissorTest:M,activeTexture:E,bindTexture:T,compressedTexImage2D:S,texImage2D:A,scissor:C,viewport:L,reset:R}}function fe(t,e,n){function r(){if(void 0!==o)return o;var n=e.get("EXT_texture_filter_anisotropic");return o=null!==n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o,a=void 0!==n.precision?n.precision:"highp",s=i(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);var u=!0===n.logarithmicDepthBuffer&&!!e.get("EXT_frag_depth"),c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),l=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_TEXTURE_SIZE),f=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),d=t.getParameter(t.MAX_VERTEX_ATTRIBS),p=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),g=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=l>0,y=!!e.get("OES_texture_float");return{getMaxAnisotropy:r,getMaxPrecision:i,precision:a,logarithmicDepthBuffer:u,maxTextures:c,maxVertexTextures:l,maxTextureSize:h,maxCubemapSize:f,maxAttributes:d,maxVertexUniforms:p,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y}}function de(t){var e={};return{get:function(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;case"WEBGL_compressed_texture_etc1":r=t.getExtension("WEBGL_compressed_texture_etc1");break;default:r=t.getExtension(n)}return null===r&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),e[n]=r,r}}}function pe(){function t(){c.value!==r&&(c.value=r,c.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0}function e(t,e,r,i){var o=null!==t?t.length:0,a=null;if(0!==o){if(a=c.value,!0!==i||null===a){var l=r+4*o,h=e.matrixWorldInverse;u.getNormalMatrix(h),(null===a||a.length<l)&&(a=new Float32Array(l));for(var f=0,d=r;f!==o;++f,d+=4)s.copy(t[f]).applyMatrix4(h,u),s.normal.toArray(a,d),a[d+3]=s.constant}c.value=a,c.needsUpdate=!0}return n.numPlanes=o,a}var n=this,r=null,i=0,o=!1,a=!1,s=new it,u=new rt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(t,n,a){var s=0!==t.length||n||0!==i||o;return o=n,r=e(t,a,0),i=t.length,s},this.beginShadows=function(){a=!0,e(null)},this.endShadows=function(){a=!1,t()},this.setState=function(n,s,u,l,h,f){if(!o||null===n||0===n.length||a&&!u)a?e(null):t();else{var d=a?0:i,p=4*d,m=h.clippingState||null;c.value=m,m=e(n,l,p,f);for(var g=0;g!==p;++g)m[g]=r[g];h.clippingState=m,this.numIntersection=s?this.numPlanes:0,this.numPlanes+=d}}}function me(t){function e(){return null===nt?yt:1}function n(){Jt.init(),Jt.scissor(ct.copy(_t).multiplyScalar(yt)),Jt.viewport(ht.copy(bt).multiplyScalar(yt)),Jt.buffers.color.setClear(dt.r,dt.g,dt.b,mt,H)}function r(){et=null,ut=null,st="",it=-1,Jt.reset()}function i(t){t.preventDefault(),r(),n(),Kt.clear(),ee.clear()}function o(t){var e=t.target;e.removeEventListener("dispose",o),s(e)}function s(t){u(t),Kt.remove(t)}function u(t){var e=Kt.get(t).program;t.program=void 0,void 0!==e&&ne.releaseProgram(e)}function c(t,e,n){t.render(function(t){tt.renderBufferImmediate(t,e,n)})}function d(t,e){return Math.abs(e[0])-Math.abs(t[0])}function p(t,e,n,r){if(n&&n.isInstancedBufferGeometry&&null===Yt.get("ANGLE_instanced_arrays"))return void console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");void 0===r&&(r=0),Jt.initAttributes();var i=n.attributes,o=e.getAttributes(),a=t.defaultAttributeValues;for(var s in o){var u=o[s];if(u>=0){var c=i[s];if(void 0!==c){var l=c.normalized,h=c.itemSize,f=$t.get(c),d=f.buffer,p=f.type,m=f.bytesPerElement;if(c.isInterleavedBufferAttribute){var g=c.data,v=g.stride,y=c.offset;g&&g.isInstancedInterleavedBuffer?(Jt.enableAttributeAndDivisor(u,g.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=g.meshPerAttribute*g.count)):Jt.enableAttribute(u),kt.bindBuffer(kt.ARRAY_BUFFER,d),kt.vertexAttribPointer(u,h,p,l,v*m,(r*v+y)*m)}else c.isInstancedBufferAttribute?(Jt.enableAttributeAndDivisor(u,c.meshPerAttribute),void 0===n.maxInstancedCount&&(n.maxInstancedCount=c.meshPerAttribute*c.count)):Jt.enableAttribute(u),kt.bindBuffer(kt.ARRAY_BUFFER,d),kt.vertexAttribPointer(u,h,p,l,0,r*h*m)}else if(void 0!==a){var _=a[s];if(void 0!==_)switch(_.length){case 2:kt.vertexAttrib2fv(u,_);break;case 3:kt.vertexAttrib3fv(u,_);break;case 4:kt.vertexAttrib4fv(u,_);break;default:kt.vertexAttrib1fv(u,_)}}}}Jt.disableUnusedAttributes()}function m(t,e,n){if(t.visible){if(t.layers.test(e.layers))if(t.isLight)j.push(t);else if(t.isSprite)t.frustumCulled&&!wt.intersectsSprite(t)||Z.push(t);else if(t.isLensFlare)Q.push(t);else if(t.isImmediateRenderObject)n&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St),W.push(t,null,t.material,At.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||wt.intersectsObject(t))){n&&At.setFromMatrixPosition(t.matrixWorld).applyMatrix4(St);var r=ee.update(t),i=t.material;if(Array.isArray(i))for(var o=r.groups,a=0,s=o.length;a<s;a++){var u=o[a],c=i[u.materialIndex];c&&c.visible&&W.push(t,r,c,At.z,u)}else i.visible&&W.push(t,r,i,At.z,null)}for(var l=t.children,a=0,s=l.length;a<s;a++)m(l[a],e,n)}}function g(t,e,n,r){for(var i=0,o=t.length;i<o;i++){var a=t[i],s=a.object,u=a.geometry,c=void 0===r?a.material:r,l=a.group;if(s.onBeforeRender(tt,e,n,u,c,l),n.isArrayCamera&&n.enabled)for(var h=n.cameras,f=0,d=h.length;f<d;f++){var p=h[f],m=p.bounds;tt.setViewport(m.x*gt*yt,m.y*vt*yt,m.z*gt*yt,m.w*vt*yt),tt.setScissor(m.x*gt*yt,m.y*vt*yt,m.z*gt*yt,m.w*vt*yt),tt.setScissorTest(!0),v(s,e,p,u,c,l)}else v(s,e,n,u,c,l);s.onAfterRender(tt,e,n,u,c,l)}}function v(t,e,n,r,i,o){if(t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),t.isImmediateRenderObject){Jt.setMaterial(i);var a=_(n,e.fog,i,t);st="",c(t,a,i)}else tt.renderBufferDirect(n,e.fog,r,i,t,o)}function y(t,e,n){var r=Kt.get(t),i=ne.getParameters(t,It,e,Mt.numPlanes,Mt.numIntersection,n),a=ne.getProgramCode(t,i),s=r.program,c=!0;if(void 0===s)t.addEventListener("dispose",o);else if(s.code!==a)u(t);else{if(void 0!==i.shaderID)return;c=!1}if(c){if(i.shaderID){var l=Ds[i.shaderID];r.__webglShader={name:t.type,uniforms:Os.clone(l.uniforms),vertexShader:l.vertexShader,fragmentShader:l.fragmentShader}}else r.__webglShader={name:t.type,uniforms:t.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader};t.__webglShader=r.__webglShader,s=ne.acquireProgram(t,i,a),r.program=s,t.program=s}var h=s.getAttributes();if(t.morphTargets){t.numSupportedMorphTargets=0;for(var f=0;f<tt.maxMorphTargets;f++)h["morphTarget"+f]>=0&&t.numSupportedMorphTargets++}if(t.morphNormals){t.numSupportedMorphNormals=0;for(var f=0;f<tt.maxMorphNormals;f++)h["morphNormal"+f]>=0&&t.numSupportedMorphNormals++}var d=r.__webglShader.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(r.numClippingPlanes=Mt.numPlanes,r.numIntersection=Mt.numIntersection,d.clippingPlanes=Mt.uniform),r.fog=e,r.lightsHash=It.hash,t.lights&&(d.ambientLightColor.value=It.ambient,d.directionalLights.value=It.directional,d.spotLights.value=It.spot,d.rectAreaLights.value=It.rectArea,d.pointLights.value=It.point,d.hemisphereLights.value=It.hemi,d.directionalShadowMap.value=It.directionalShadowMap,d.directionalShadowMatrix.value=It.directionalShadowMatrix,d.spotShadowMap.value=It.spotShadowMap,d.spotShadowMatrix.value=It.spotShadowMatrix,d.pointShadowMap.value=It.pointShadowMap,d.pointShadowMatrix.value=It.pointShadowMatrix);var p=r.program.getUniforms(),m=q.seqWithValue(p.seq,d);r.uniformsList=m}function _(t,e,n,r){ft=0;var i=Kt.get(n);if(Et&&(Tt||t!==ut)){var o=t===ut&&n.id===it;Mt.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,t,i,o)}!1===n.needsUpdate&&(void 0===i.program?n.needsUpdate=!0:n.fog&&i.fog!==e?n.needsUpdate=!0:n.lights&&i.lightsHash!==It.hash?n.needsUpdate=!0:void 0===i.numClippingPlanes||i.numClippingPlanes===Mt.numPlanes&&i.numIntersection===Mt.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(y(n,e,r),n.needsUpdate=!1);var a=!1,s=!1,u=!1,c=i.program,l=c.getUniforms(),h=i.__webglShader.uniforms;if(c.id!==et&&(kt.useProgram(c.program),et=c.id,a=!0,s=!0,u=!0),n.id!==it&&(it=n.id,s=!0),a||t!==ut){if(l.setValue(kt,"projectionMatrix",t.projectionMatrix),Zt.logarithmicDepthBuffer&&l.setValue(kt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),t!==ut&&(ut=t,s=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var d=l.map.cameraPosition;void 0!==d&&d.setValue(kt,At.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&l.setValue(kt,"viewMatrix",t.matrixWorldInverse),l.setValue(kt,"toneMappingExposure",tt.toneMappingExposure),l.setValue(kt,"toneMappingWhitePoint",tt.toneMappingWhitePoint)}if(n.skinning){l.setOptional(kt,r,"bindMatrix"),l.setOptional(kt,r,"bindMatrixInverse");var p=r.skeleton;if(p){var m=p.bones;if(Zt.floatVertexTextures){if(void 0===p.boneTexture){var g=Math.sqrt(4*m.length);g=Ms.nextPowerOfTwo(Math.ceil(g)),g=Math.max(g,4);var v=new Float32Array(g*g*4);v.set(p.boneMatrices);var _=new f(v,g,g,ka,Na);p.boneMatrices=v,p.boneTexture=_,p.boneTextureSize=g}l.setValue(kt,"boneTexture",p.boneTexture),l.setValue(kt,"boneTextureSize",p.boneTextureSize)}else l.setOptional(kt,p,"boneMatrices")}}return s&&(n.lights&&P(h,u),e&&n.fog&&E(h,e),(n.isMeshBasicMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshNormalMaterial||n.isMeshDepthMaterial)&&x(h,n),n.isLineBasicMaterial?b(h,n):n.isLineDashedMaterial?(b(h,n),w(h,n)):n.isPointsMaterial?M(h,n):n.isMeshLambertMaterial?T(h,n):n.isMeshToonMaterial?A(h,n):n.isMeshPhongMaterial?S(h,n):n.isMeshPhysicalMaterial?L(h,n):n.isMeshStandardMaterial?C(h,n):n.isMeshDepthMaterial?n.displacementMap&&(h.displacementMap.value=n.displacementMap,h.displacementScale.value=n.displacementScale,h.displacementBias.value=n.displacementBias):n.isMeshNormalMaterial&&R(h,n),void 0!==h.ltcMat&&(h.ltcMat.value=Is.LTC_MAT_TEXTURE),void 0!==h.ltcMag&&(h.ltcMag.value=Is.LTC_MAG_TEXTURE),q.upload(kt,i.uniformsList,h,tt)),l.setValue(kt,"modelViewMatrix",r.modelViewMatrix),l.setValue(kt,"normalMatrix",r.normalMatrix),l.setValue(kt,"modelMatrix",r.matrixWorld),c}function x(t,e){t.opacity.value=e.opacity,t.diffuse.value=e.color,e.emissive&&t.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),t.map.value=e.map,t.specularMap.value=e.specularMap,t.alphaMap.value=e.alphaMap,e.lightMap&&(t.lightMap.value=e.lightMap,t.lightMapIntensity.value=e.lightMapIntensity),e.aoMap&&(t.aoMap.value=e.aoMap,t.aoMapIntensity.value=e.aoMapIntensity);var n;if(e.map?n=e.map:e.specularMap?n=e.specularMap:e.displacementMap?n=e.displacementMap:e.normalMap?n=e.normalMap:e.bumpMap?n=e.bumpMap:e.roughnessMap?n=e.roughnessMap:e.metalnessMap?n=e.metalnessMap:e.alphaMap?n=e.alphaMap:e.emissiveMap&&(n=e.emissiveMap),void 0!==n){n.isWebGLRenderTarget&&(n=n.texture);var r=n.offset,i=n.repeat;t.offsetRepeat.value.set(r.x,r.y,i.x,i.y)}t.envMap.value=e.envMap,t.flipEnvMap.value=e.envMap&&e.envMap.isCubeTexture?-1:1,t.reflectivity.value=e.reflectivity,t.refractionRatio.value=e.refractionRatio}function b(t,e){t.diffuse.value=e.color,t.opacity.value=e.opacity}function w(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function M(t,e){if(t.diffuse.value=e.color,t.opacity.value=e.opacity,t.size.value=e.size*yt,t.scale.value=.5*vt,t.map.value=e.map,null!==e.map){var n=e.map.offset,r=e.map.repeat;t.offsetRepeat.value.set(n.x,n.y,r.x,r.y)}}function E(t,e){t.fogColor.value=e.color,e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)}function T(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}function S(t,e){t.specular.value=e.specular,t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function A(t,e){S(t,e),e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function C(t,e){t.roughness.value=e.roughness,t.metalness.value=e.metalness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap),e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap),e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function L(t,e){t.clearCoat.value=e.clearCoat,t.clearCoatRoughness.value=e.clearCoatRoughness,C(t,e)}function R(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale),e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale)),e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}function P(t,e){t.ambientLightColor.needsUpdate=e,t.directionalLights.needsUpdate=e,t.pointLights.needsUpdate=e,t.spotLights.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function N(t){for(var e=0,n=0,r=t.length;n<r;n++){var i=t[n];i.castShadow&&(It.shadows[e]=i,e++)}It.shadows.length=e}function I(t,e){var n,r,i,o,a,s,u,c,l=0,h=0,f=0,d=e.matrixWorldInverse,p=0,m=0,g=0,v=0,y=0;for(n=0,r=t.length;n<r;n++)if(i=t[n],a=i.color,s=i.intensity,u=i.distance,c=i.shadow&&i.shadow.map?i.shadow.map.texture:null,i.isAmbientLight)l+=a.r*s,h+=a.g*s,f+=a.b*s;else if(i.isDirectionalLight){var _=re.get(i);_.color.copy(i.color).multiplyScalar(i.intensity),_.direction.setFromMatrixPosition(i.matrixWorld),At.setFromMatrixPosition(i.target.matrixWorld),_.direction.sub(At),_.direction.transformDirection(d),_.shadow=i.castShadow,i.castShadow&&(o=i.shadow,_.shadowBias=o.bias,_.shadowRadius=o.radius,_.shadowMapSize=o.mapSize),It.directionalShadowMap[p]=c,It.directionalShadowMatrix[p]=i.shadow.matrix,It.directional[p]=_,p++}else if(i.isSpotLight){var _=re.get(i);_.position.setFromMatrixPosition(i.matrixWorld),_.position.applyMatrix4(d),_.color.copy(a).multiplyScalar(s),_.distance=u,_.direction.setFromMatrixPosition(i.matrixWorld),At.setFromMatrixPosition(i.target.matrixWorld),_.direction.sub(At),_.direction.transformDirection(d),_.coneCos=Math.cos(i.angle),_.penumbraCos=Math.cos(i.angle*(1-i.penumbra)),_.decay=0===i.distance?0:i.decay,_.shadow=i.castShadow,i.castShadow&&(o=i.shadow,_.shadowBias=o.bias,_.shadowRadius=o.radius,_.shadowMapSize=o.mapSize),It.spotShadowMap[g]=c,It.spotShadowMatrix[g]=i.shadow.matrix,It.spot[g]=_,g++}else if(i.isRectAreaLight){var _=re.get(i);_.color.copy(a).multiplyScalar(s/(i.width*i.height)),_.position.setFromMatrixPosition(i.matrixWorld),_.position.applyMatrix4(d),Pt.identity(),Ct.copy(i.matrixWorld),Ct.premultiply(d),Pt.extractRotation(Ct),_.halfWidth.set(.5*i.width,0,0),_.halfHeight.set(0,.5*i.height,0),_.halfWidth.applyMatrix4(Pt),_.halfHeight.applyMatrix4(Pt),It.rectArea[v]=_,v++}else if(i.isPointLight){var _=re.get(i);_.position.setFromMatrixPosition(i.matrixWorld),_.position.applyMatrix4(d),_.color.copy(i.color).multiplyScalar(i.intensity),_.distance=i.distance,_.decay=0===i.distance?0:i.decay,_.shadow=i.castShadow,i.castShadow&&(o=i.shadow,_.shadowBias=o.bias,_.shadowRadius=o.radius,_.shadowMapSize=o.mapSize),It.pointShadowMap[m]=c,It.pointShadowMatrix[m]=i.shadow.matrix,It.point[m]=_,m++}else if(i.isHemisphereLight){var _=re.get(i);_.direction.setFromMatrixPosition(i.matrixWorld),_.direction.transformDirection(d),_.direction.normalize(),_.skyColor.copy(i.color).multiplyScalar(s),_.groundColor.copy(i.groundColor).multiplyScalar(s),It.hemi[y]=_,y++}It.ambient[0]=l,It.ambient[1]=h,It.ambient[2]=f,It.directional.length=p,It.spot.length=g,It.rectArea.length=v,It.point.length=m,It.hemi.length=y,It.hash=p+","+m+","+g+","+v+","+y+","+It.shadows.length}function O(){var t=ft;return t>=Zt.maxTextures&&console.warn("WebGLRenderer: trying to use "+t+" texture units while this GPU supports only "+Zt.maxTextures),ft+=1,t}function U(t){var e;if(t===va)return kt.REPEAT;if(t===ya)return kt.CLAMP_TO_EDGE;if(t===_a)return kt.MIRRORED_REPEAT;if(t===xa)return kt.NEAREST;if(t===ba)return kt.NEAREST_MIPMAP_NEAREST;if(t===wa)return kt.NEAREST_MIPMAP_LINEAR;if(t===Ma)return kt.LINEAR;if(t===Ea)return kt.LINEAR_MIPMAP_NEAREST;if(t===Ta)return kt.LINEAR_MIPMAP_LINEAR;if(t===Sa)return kt.UNSIGNED_BYTE;if(t===Oa)return kt.UNSIGNED_SHORT_4_4_4_4;if(t===Ua)return kt.UNSIGNED_SHORT_5_5_5_1;if(t===Da)return kt.UNSIGNED_SHORT_5_6_5;if(t===Aa)return kt.BYTE;if(t===Ca)return kt.SHORT;if(t===La)return kt.UNSIGNED_SHORT;if(t===Ra)return kt.INT;if(t===Pa)return kt.UNSIGNED_INT;if(t===Na)return kt.FLOAT;if(t===Ia&&null!==(e=Yt.get("OES_texture_half_float")))return e.HALF_FLOAT_OES;if(t===Ba)return kt.ALPHA;if(t===za)return kt.RGB;if(t===ka)return kt.RGBA;if(t===Ga)return kt.LUMINANCE;if(t===Ha)return kt.LUMINANCE_ALPHA;if(t===ja)return kt.DEPTH_COMPONENT;if(t===Wa)return kt.DEPTH_STENCIL;if(t===Po)return kt.FUNC_ADD;if(t===No)return kt.FUNC_SUBTRACT;if(t===Io)return kt.FUNC_REVERSE_SUBTRACT;if(t===Do)return kt.ZERO;if(t===Fo)return kt.ONE;if(t===Bo)return kt.SRC_COLOR;if(t===zo)return kt.ONE_MINUS_SRC_COLOR;if(t===ko)return kt.SRC_ALPHA;if(t===Go)return kt.ONE_MINUS_SRC_ALPHA;if(t===Ho)return kt.DST_ALPHA;if(t===Vo)return kt.ONE_MINUS_DST_ALPHA;if(t===jo)return kt.DST_COLOR;if(t===Wo)return kt.ONE_MINUS_DST_COLOR;if(t===Xo)return kt.SRC_ALPHA_SATURATE;if((t===Xa||t===qa||t===Ya||t===Za)&&null!==(e=Yt.get("WEBGL_compressed_texture_s3tc"))){if(t===Xa)return e.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===qa)return e.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===Ya)return e.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===Za)return e.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((t===Ja||t===Ka||t===Qa||t===$a)&&null!==(e=Yt.get("WEBGL_compressed_texture_pvrtc"))){if(t===Ja)return e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===Ka)return e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===Qa)return e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===$a)return e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(t===ts&&null!==(e=Yt.get("WEBGL_compressed_texture_etc1")))return e.COMPRESSED_RGB_ETC1_WEBGL;if((t===Oo||t===Uo)&&null!==(e=Yt.get("EXT_blend_minmax"))){if(t===Oo)return e.MIN_EXT;if(t===Uo)return e.MAX_EXT}return t===Fa&&null!==(e=Yt.get("WEBGL_depth_texture"))?e.UNSIGNED_INT_24_8_WEBGL:0}console.log("THREE.WebGLRenderer",oo),t=t||{};var D=void 0!==t.canvas?t.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),F=void 0!==t.context?t.context:null,B=void 0!==t.alpha&&t.alpha,z=void 0===t.depth||t.depth,k=void 0===t.stencil||t.stencil,G=void 0!==t.antialias&&t.antialias,H=void 0===t.premultipliedAlpha||t.premultipliedAlpha,V=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,j=[],W=null,X=new Float32Array(8),Z=[],Q=[];this.domElement=D,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=oa,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var tt=this,et=null,nt=null,rt=null,it=-1,st="",ut=null,ct=new a,lt=null,ht=new a,ft=0,dt=new Y(0),mt=0,gt=D.width,vt=D.height,yt=1,_t=new a(0,0,gt,vt),xt=!1,bt=new a(0,0,gt,vt),wt=new ot,Mt=new pe,Et=!1,Tt=!1,St=new h,At=new l,Ct=new h,Pt=new h,It={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],shadows:[]},Ut={geometries:0,textures:0},zt={frame:0,calls:0,vertices:0,faces:0,points:0};this.info={render:zt,memory:Ut,programs:null};var kt;try{var Gt={alpha:B,depth:z,stencil:k,antialias:G,premultipliedAlpha:H,preserveDrawingBuffer:V};if(null===(kt=F||D.getContext("webgl",Gt)||D.getContext("experimental-webgl",Gt)))throw null!==D.getContext("webgl")?"Error creating WebGL context with your selected attributes.":"Error creating WebGL context.";void 0===kt.getShaderPrecisionFormat&&(kt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}}),D.addEventListener("webglcontextlost",i,!1)}catch(t){console.error("THREE.WebGLRenderer: "+t)}var Yt=new de(kt);Yt.get("WEBGL_depth_texture"),Yt.get("OES_texture_float"),Yt.get("OES_texture_float_linear"),Yt.get("OES_texture_half_float"),Yt.get("OES_texture_half_float_linear"),Yt.get("OES_standard_derivatives"),Yt.get("ANGLE_instanced_arrays"),Yt.get("OES_element_index_uint")&&(Lt.MaxIndex=4294967296);var Zt=new fe(kt,Yt,t),Jt=new he(kt,Yt,U),Kt=new le,Qt=new ce(kt,Yt,Jt,Kt,Zt,U,Ut),$t=new Bt(kt),te=new Wt(kt,$t,Ut),ee=new qt(kt,te,zt),ne=new ue(this,Zt),re=new Xt,ie=new Ht;this.info.programs=ne.programs;var oe,ae,se,me,ge=new jt(kt,Yt,zt),ve=new Vt(kt,Yt,zt);n(),this.context=kt,this.capabilities=Zt,this.extensions=Yt,this.properties=Kt,this.state=Jt;var ye=new at(this,It,ee,Zt);this.shadowMap=ye;var _e=new K(this,Z),xe=new J(this,Q);this.getContext=function(){return kt},this.getContextAttributes=function(){return kt.getContextAttributes()},this.forceContextLoss=function(){var t=Yt.get("WEBGL_lose_context");t&&t.loseContext()},this.getMaxAnisotropy=function(){return Zt.getMaxAnisotropy()},this.getPrecision=function(){return Zt.precision},this.getPixelRatio=function(){return yt},this.setPixelRatio=function(t){void 0!==t&&(yt=t,this.setSize(bt.z,bt.w,!1))},this.getSize=function(){return{width:gt,height:vt}},this.setSize=function(t,e,n){gt=t,vt=e,D.width=t*yt,D.height=e*yt,!1!==n&&(D.style.width=t+"px",D.style.height=e+"px"),this.setViewport(0,0,t,e)},this.setViewport=function(t,e,n,r){Jt.viewport(bt.set(t,e,n,r))},this.setScissor=function(t,e,n,r){Jt.scissor(_t.set(t,e,n,r))},this.setScissorTest=function(t){Jt.setScissorTest(xt=t)},this.getClearColor=function(){return dt},this.setClearColor=function(t,e){dt.set(t),mt=void 0!==e?e:1,Jt.buffers.color.setClear(dt.r,dt.g,dt.b,mt,H)},this.getClearAlpha=function(){return mt},this.setClearAlpha=function(t){mt=t,Jt.buffers.color.setClear(dt.r,dt.g,dt.b,mt,H)},this.clear=function(t,e,n){var r=0;(void 0===t||t)&&(r|=kt.COLOR_BUFFER_BIT),(void 0===e||e)&&(r|=kt.DEPTH_BUFFER_BIT),(void 0===n||n)&&(r|=kt.STENCIL_BUFFER_BIT),kt.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.clearTarget=function(t,e,n,r){this.setRenderTarget(t),this.clear(e,n,r)},this.resetGLState=r,this.dispose=function(){D.removeEventListener("webglcontextlost",i,!1),ie.dispose()},this.renderBufferImmediate=function(t,e,n){Jt.initAttributes();var r=Kt.get(t);t.hasPositions&&!r.position&&(r.position=kt.createBuffer()),t.hasNormals&&!r.normal&&(r.normal=kt.createBuffer()),t.hasUvs&&!r.uv&&(r.uv=kt.createBuffer()),t.hasColors&&!r.color&&(r.color=kt.createBuffer());var i=e.getAttributes();if(t.hasPositions&&(kt.bindBuffer(kt.ARRAY_BUFFER,r.position),kt.bufferData(kt.ARRAY_BUFFER,t.positionArray,kt.DYNAMIC_DRAW),Jt.enableAttribute(i.position),kt.vertexAttribPointer(i.position,3,kt.FLOAT,!1,0,0)),t.hasNormals){if(kt.bindBuffer(kt.ARRAY_BUFFER,r.normal),!n.isMeshPhongMaterial&&!n.isMeshStandardMaterial&&!n.isMeshNormalMaterial&&n.shading===xo)for(var o=0,a=3*t.count;o<a;o+=9){var s=t.normalArray,u=(s[o+0]+s[o+3]+s[o+6])/3,c=(s[o+1]+s[o+4]+s[o+7])/3,l=(s[o+2]+s[o+5]+s[o+8])/3;s[o+0]=u,s[o+1]=c,s[o+2]=l,s[o+3]=u,s[o+4]=c,s[o+5]=l,s[o+6]=u,s[o+7]=c,s[o+8]=l}kt.bufferData(kt.ARRAY_BUFFER,t.normalArray,kt.DYNAMIC_DRAW),Jt.enableAttribute(i.normal),kt.vertexAttribPointer(i.normal,3,kt.FLOAT,!1,0,0)}t.hasUvs&&n.map&&(kt.bindBuffer(kt.ARRAY_BUFFER,r.uv),kt.bufferData(kt.ARRAY_BUFFER,t.uvArray,kt.DYNAMIC_DRAW),Jt.enableAttribute(i.uv),kt.vertexAttribPointer($t.uv,2,kt.FLOAT,!1,0,0)),t.hasColors&&n.vertexColors!==wo&&(kt.bindBuffer(kt.ARRAY_BUFFER,r.color),kt.bufferData(kt.ARRAY_BUFFER,t.colorArray,kt.DYNAMIC_DRAW),Jt.enableAttribute(i.color),kt.vertexAttribPointer(i.color,3,kt.FLOAT,!1,0,0)),Jt.disableUnusedAttributes(),kt.drawArrays(kt.TRIANGLES,0,t.count),t.count=0},this.renderBufferDirect=function(t,n,r,i,o,a){Jt.setMaterial(i);var s=_(t,n,i,o),u=r.id+"_"+s.id+"_"+(!0===i.wireframe),c=!1;u!==st&&(st=u,c=!0);var l=o.morphTargetInfluences;if(void 0!==l){for(var h=[],f=0,m=l.length;f<m;f++){var g=l[f];h.push([g,f])}h.sort(d),h.length>8&&(h.length=8);for(var v=r.morphAttributes,f=0,m=h.length;f<m;f++){var g=h[f];if(X[f]=g[0],0!==g[0]){var y=g[1];!0===i.morphTargets&&v.position&&r.addAttribute("morphTarget"+f,v.position[y]),!0===i.morphNormals&&v.normal&&r.addAttribute("morphNormal"+f,v.normal[y])}else!0===i.morphTargets&&r.removeAttribute("morphTarget"+f),!0===i.morphNormals&&r.removeAttribute("morphNormal"+f)}for(var f=h.length,x=X.length;f<x;f++)X[f]=0;s.getUniforms().setValue(kt,"morphTargetInfluences",X),c=!0}var y=r.index,b=r.attributes.position,w=1;!0===i.wireframe&&(y=te.getWireframeAttribute(r),w=2);var M=ge;null!==y&&(M=ve,M.setIndex(y)),c&&(p(i,s,r),null!==y&&kt.bindBuffer(kt.ELEMENT_ARRAY_BUFFER,$t.get(y).buffer));var E=0;null!==y?E=y.count:void 0!==b&&(E=b.count);var T=r.drawRange.start*w,S=r.drawRange.count*w,A=null!==a?a.start*w:0,C=null!==a?a.count*w:1/0,L=Math.max(T,A),R=Math.min(E,T+S,A+C)-1,P=Math.max(0,R-L+1);if(0!==P){if(o.isMesh)if(!0===i.wireframe)Jt.setLineWidth(i.wireframeLinewidth*e()),M.setMode(kt.LINES);else switch(o.drawMode){case ls:M.setMode(kt.TRIANGLES);break;case hs:M.setMode(kt.TRIANGLE_STRIP);break;case fs:M.setMode(kt.TRIANGLE_FAN)}else if(o.isLine){var N=i.linewidth;void 0===N&&(N=1),Jt.setLineWidth(N*e()),o.isLineSegments?M.setMode(kt.LINES):o.isLineLoop?M.setMode(kt.LINE_LOOP):M.setMode(kt.LINE_STRIP)}else o.isPoints&&M.setMode(kt.POINTS);r&&r.isInstancedBufferGeometry?r.maxInstancedCount>0&&M.renderInstances(r,L,P):M.render(L,P)}},this.compile=function(t,e){j=[],t.traverse(function(t){t.isLight&&j.push(t)}),I(j,e),t.traverse(function(e){if(e.material)if(Array.isArray(e.material))for(var n=0;n<e.material.length;n++)y(e.material[n],t.fog,e);else y(e.material,t.fog,e)})},this.render=function(t,e,n,r){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");st="",it=-1,ut=null,!0===t.autoUpdate&&t.updateMatrixWorld(),e.onBeforeRender(tt),null===e.parent&&e.updateMatrixWorld(),e.matrixWorldInverse.getInverse(e.matrixWorld),St.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),wt.setFromMatrix(St),j.length=0,Z.length=0,Q.length=0,Tt=this.localClippingEnabled,Et=Mt.init(this.clippingPlanes,Tt,e),W=ie.get(t,e),W.init(),m(t,e,tt.sortObjects),W.finish(),!0===tt.sortObjects&&W.sort(),Et&&Mt.beginShadows(),N(j),ye.render(t,e),I(j,e),Et&&Mt.endShadows(),zt.frame++,zt.calls=0,zt.vertices=0,zt.faces=0,zt.points=0,void 0===n&&(n=null),this.setRenderTarget(n);var i=t.background;null===i?Jt.buffers.color.setClear(dt.r,dt.g,dt.b,mt,H):i&&i.isColor&&(Jt.buffers.color.setClear(i.r,i.g,i.b,1,H),r=!0),(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),i&&i.isCubeTexture?(void 0===se&&(se=new Dt,me=new Rt(new Nt(5,5,5),new $({uniforms:Ds.cube.uniforms,vertexShader:Ds.cube.vertexShader,fragmentShader:Ds.cube.fragmentShader,side:yo,depthTest:!1,depthWrite:!1,fog:!1}))),se.projectionMatrix.copy(e.projectionMatrix),se.matrixWorld.extractRotation(e.matrixWorld),se.matrixWorldInverse.getInverse(se.matrixWorld),me.material.uniforms.tCube.value=i,me.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,me.matrixWorld),ee.update(me),tt.renderBufferDirect(se,null,me.geometry,me.material,me,null)):i&&i.isTexture&&(void 0===oe&&(oe=new Ft(-1,1,1,-1,0,1),ae=new Rt(new Ot(2,2),new pt({depthTest:!1,depthWrite:!1,fog:!1}))),ae.material.map=i,ee.update(ae),tt.renderBufferDirect(oe,null,ae.geometry,ae.material,ae,null));var o=W.opaque,a=W.transparent;if(t.overrideMaterial){var s=t.overrideMaterial;o.length&&g(o,t,e,s),a.length&&g(a,t,e,s)}else o.length&&g(o,t,e),a.length&&g(a,t,e);_e.render(t,e),xe.render(t,e,ht),n&&Qt.updateRenderTargetMipmap(n),Jt.buffers.depth.setTest(!0),Jt.buffers.depth.setMask(!0),Jt.buffers.color.setMask(!0),e.isArrayCamera&&e.enabled&&tt.setScissorTest(!1),e.onAfterRender(tt)},this.setFaceCulling=function(t,e){Jt.setCullFace(t),Jt.setFlipSided(e===ho)},this.allocTextureUnit=O,this.setTexture2D=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTarget&&(t||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),Qt.setTexture2D(e,n)}}(),this.setTexture=function(){var t=!1;return function(e,n){t||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),t=!0),Qt.setTexture2D(e,n)}}(),this.setTextureCube=function(){var t=!1;return function(e,n){e&&e.isWebGLRenderTargetCube&&(t||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),t=!0),e=e.texture),e&&e.isCubeTexture||Array.isArray(e.image)&&6===e.image.length?Qt.setTextureCube(e,n):Qt.setTextureCubeDynamic(e,n)}}(),this.getRenderTarget=function(){return nt},this.setRenderTarget=function(t){nt=t,t&&void 0===Kt.get(t).__webglFramebuffer&&Qt.setupRenderTarget(t);var e,n=t&&t.isWebGLRenderTargetCube;if(t){var r=Kt.get(t);e=n?r.__webglFramebuffer[t.activeCubeFace]:r.__webglFramebuffer,ct.copy(t.scissor),lt=t.scissorTest,ht.copy(t.viewport)}else e=null,ct.copy(_t).multiplyScalar(yt),lt=xt,ht.copy(bt).multiplyScalar(yt);if(rt!==e&&(kt.bindFramebuffer(kt.FRAMEBUFFER,e),rt=e),Jt.scissor(ct),Jt.setScissorTest(lt),Jt.viewport(ht),n){var i=Kt.get(t.texture);kt.framebufferTexture2D(kt.FRAMEBUFFER,kt.COLOR_ATTACHMENT0,kt.TEXTURE_CUBE_MAP_POSITIVE_X+t.activeCubeFace,i.__webglTexture,t.activeMipMapLevel)}},this.readRenderTargetPixels=function(t,e,n,r,i,o){if(!1===(t&&t.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");var a=Kt.get(t).__webglFramebuffer;if(a){var s=!1;a!==rt&&(kt.bindFramebuffer(kt.FRAMEBUFFER,a),s=!0);try{var u=t.texture,c=u.format,l=u.type;if(c!==ka&&U(c)!==kt.getParameter(kt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===Sa||U(l)===kt.getParameter(kt.IMPLEMENTATION_COLOR_READ_TYPE)||l===Na&&(Yt.get("OES_texture_float")||Yt.get("WEBGL_color_buffer_float"))||l===Ia&&Yt.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");kt.checkFramebufferStatus(kt.FRAMEBUFFER)===kt.FRAMEBUFFER_COMPLETE?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&kt.readPixels(e,n,r,i,U(c),U(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&kt.bindFramebuffer(kt.FRAMEBUFFER,rt)}}}}function ge(t,e){this.name="",this.color=new Y(t),this.density=void 0!==e?e:25e-5}function ve(t,e,n){this.name="",this.color=new Y(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}function ye(){lt.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function _e(t,e,n,r,i){lt.call(this),this.lensFlares=[],this.positionScreen=new l,this.customUpdateCallback=void 0,void 0!==t&&this.add(t,e,n,r,i)}function xe(t){Q.call(this),this.type="SpriteMaterial",this.color=new Y(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(t)}function be(t){lt.call(this),this.type="Sprite",this.material=void 0!==t?t:new xe}function we(){lt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function Me(t,e){if(t=t||[],this.bones=t.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===e)this.calculateInverses();else if(this.bones.length===e.length)this.boneInverses=e.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new h)}}function Ee(){lt.call(this),this.type="Bone"}function Te(t,e){Rt.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new h,this.bindMatrixInverse=new h;var n=this.initBones(),r=new Me(n);this.bind(r,this.matrixWorld),this.normalizeSkinWeights()}function Se(t){Q.call(this),this.type="LineBasicMaterial",this.color=new Y(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(t)}function Ae(t,e,n){if(1===n)return console.warn("THREE.Line: parameter THREE.LinePieces no longer supported. Created THREE.LineSegments instead."),new Ce(t,e);lt.call(this),this.type="Line",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new Se({color:16777215*Math.random()})}function Ce(t,e){Ae.call(this,t,e),this.type="LineSegments"}function Le(t,e){Ae.call(this,t,e),this.type="LineLoop"}function Re(t){Q.call(this),this.type="PointsMaterial",this.color=new Y(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.lights=!1,this.setValues(t)}function Pe(t,e){lt.call(this),this.type="Points",this.geometry=void 0!==t?t:new Lt,this.material=void 0!==e?e:new Re({color:16777215*Math.random()})}function Ne(){lt.call(this),this.type="Group"}function Ie(t,e,n,r,i,a,s,u,c){function l(){requestAnimationFrame(l),t.readyState>=t.HAVE_CURRENT_DATA&&(h.needsUpdate=!0)}o.call(this,t,e,n,r,i,a,s,u,c),this.generateMipmaps=!1;var h=this;l()}function Oe(t,e,n,r,i,a,s,u,c,l,h,f){o.call(this,null,a,s,u,c,l,r,i,h,f),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Ue(t,e,n,r,i,a,s,u,c){o.call(this,t,e,n,r,i,a,s,u,c),this.needsUpdate=!0}function De(t,e,n,r,i,a,s,u,c,l){if((l=void 0!==l?l:ja)!==ja&&l!==Wa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&l===ja&&(n=La),void 0===n&&l===Wa&&(n=Fa),o.call(this,null,r,i,a,s,u,l,n,c),this.image={width:t,height:e},this.magFilter=void 0!==s?s:xa,this.minFilter=void 0!==u?u:xa,this.flipY=!1,this.generateMipmaps=!1}function Fe(t){Lt.call(this),this.type="WireframeGeometry";var e,n,r,i,o,a,s,u,c,h,f=[],d=[0,0],p={},m=["a","b","c"];if(t&&t.isGeometry){var g=t.faces;for(e=0,r=g.length;e<r;e++){var v=g[e];for(n=0;n<3;n++)s=v[m[n]],u=v[m[(n+1)%3]],d[0]=Math.min(s,u),d[1]=Math.max(s,u),c=d[0]+","+d[1],void 0===p[c]&&(p[c]={index1:d[0],index2:d[1]})}for(c in p)a=p[c],h=t.vertices[a.index1],f.push(h.x,h.y,h.z),h=t.vertices[a.index2],f.push(h.x,h.y,h.z)}else if(t&&t.isBufferGeometry){var y,_,x,b,w,M,E,T;if(h=new l,null!==t.index){for(y=t.attributes.position,_=t.index,x=t.groups,0===x.length&&(x=[{start:0,count:_.count,materialIndex:0}]),i=0,o=x.length;i<o;++i)for(b=x[i],w=b.start,M=b.count,e=w,r=w+M;e<r;e+=3)for(n=0;n<3;n++)s=_.getX(e+n),u=_.getX(e+(n+1)%3),d[0]=Math.min(s,u),d[1]=Math.max(s,u),c=d[0]+","+d[1],void 0===p[c]&&(p[c]={index1:d[0],index2:d[1]});for(c in p)a=p[c],h.fromBufferAttribute(y,a.index1),f.push(h.x,h.y,h.z),h.fromBufferAttribute(y,a.index2),f.push(h.x,h.y,h.z)}else for(y=t.attributes.position,e=0,r=y.count/3;e<r;e++)for(n=0;n<3;n++)E=3*e+n,h.fromBufferAttribute(y,E),f.push(h.x,h.y,h.z),T=3*e+(n+1)%3,h.fromBufferAttribute(y,T),f.push(h.x,h.y,h.z)}this.addAttribute("position",new Mt(f,3))}function Be(t,e,n){Ct.call(this),this.type="ParametricGeometry",this.parameters={func:t,slices:e,stacks:n},this.fromBufferGeometry(new ze(t,e,n)),this.mergeVertices()}function ze(t,e,n){Lt.call(this),this.type="ParametricBufferGeometry",this.parameters={func:t,slices:e,stacks:n};var r,i,o=[],a=[],s=[],u=[],c=new l,h=new l,f=new l,d=new l,p=new l,m=e+1;for(r=0;r<=n;r++){var g=r/n;for(i=0;i<=e;i++){var v=i/e;h=t(v,g,h),a.push(h.x,h.y,h.z),v-1e-5>=0?(f=t(v-1e-5,g,f),d.subVectors(h,f)):(f=t(v+1e-5,g,f),d.subVectors(f,h)),g-1e-5>=0?(f=t(v,g-1e-5,f),p.subVectors(h,f)):(f=t(v,g+1e-5,f),p.subVectors(f,h)),c.crossVectors(d,p).normalize(),s.push(c.x,c.y,c.z),u.push(v,g)}}for(r=0;r<n;r++)for(i=0;i<e;i++){var y=r*m+i,_=r*m+i+1,x=(r+1)*m+i+1,b=(r+1)*m+i;o.push(y,_,b),o.push(_,x,b)}this.setIndex(o),this.addAttribute("position",new Mt(a,3)),this.addAttribute("normal",new Mt(s,3)),this.addAttribute("uv",new Mt(u,2))}function ke(t,e,n,r){Ct.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},this.fromBufferGeometry(new Ge(t,e,n,r)),this.mergeVertices()}function Ge(t,e,n,r){function o(t,e,n,r){var i,o,a=Math.pow(2,r),u=[];for(i=0;i<=a;i++){u[i]=[];var c=t.clone().lerp(n,i/a),l=e.clone().lerp(n,i/a),h=a-i;for(o=0;o<=h;o++)u[i][o]=0===o&&i===a?c:c.clone().lerp(l,o/h)}for(i=0;i<a;i++)for(o=0;o<2*(a-i)-1;o++){var f=Math.floor(o/2);o%2==0?(s(u[i][f+1]),s(u[i+1][f]),s(u[i][f])):(s(u[i][f+1]),s(u[i+1][f+1]),s(u[i+1][f]))}}function a(){for(var t=0;t<m.length;t+=6){var e=m[t+0],n=m[t+2],r=m[t+4],i=Math.max(e,n,r),o=Math.min(e,n,r);i>.9&&o<.1&&(e<.2&&(m[t+0]+=1),n<.2&&(m[t+2]+=1),r<.2&&(m[t+4]+=1))}}function s(t){p.push(t.x,t.y,t.z)}function u(e,n){var r=3*e;n.x=t[r+0],n.y=t[r+1],n.z=t[r+2]}function c(){for(var t=new l,e=new l,n=new l,r=new l,o=new i,a=new i,s=new i,u=0,c=0;u<p.length;u+=9,c+=6){t.set(p[u+0],p[u+1],p[u+2]),e.set(p[u+3],p[u+4],p[u+5]),n.set(p[u+6],p[u+7],p[u+8]),o.set(m[c+0],m[c+1]),a.set(m[c+2],m[c+3]),s.set(m[c+4],m[c+5]),r.copy(t).add(e).add(n).divideScalar(3);var d=f(r);h(o,c+0,t,d),h(a,c+2,e,d),h(s,c+4,n,d)}}function h(t,e,n,r){r<0&&1===t.x&&(m[e]=t.x-1),0===n.x&&0===n.z&&(m[e]=r/2/Math.PI+.5)}function f(t){return Math.atan2(t.z,-t.x)}function d(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}Lt.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:r},n=n||1,r=r||0;var p=[],m=[];!function(t){for(var n=new l,r=new l,i=new l,a=0;a<e.length;a+=3)u(e[a+0],n),u(e[a+1],r),u(e[a+2],i),o(n,r,i,t)}(r),function(t){for(var e=new l,n=0;n<p.length;n+=3)e.x=p[n+0],e.y=p[n+1],e.z=p[n+2],e.normalize().multiplyScalar(t),p[n+0]=e.x,p[n+1]=e.y,p[n+2]=e.z}(n),function(){for(var t=new l,e=0;e<p.length;e+=3){t.x=p[e+0],t.y=p[e+1],t.z=p[e+2];var n=f(t)/2/Math.PI+.5,r=d(t)/Math.PI+.5;m.push(n,1-r)}c(),a()}(),this.addAttribute("position",new Mt(p,3)),this.addAttribute("normal",new Mt(p.slice(),3)),this.addAttribute("uv",new Mt(m,2)),this.normalizeNormals()}function He(t,e){Ct.call(this),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ve(t,e)),this.mergeVertices()}function Ve(t,e){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];Ge.call(this,n,r,t,e),this.type="TetrahedronBufferGeometry",this.parameters={radius:t,detail:e}}function je(t,e){Ct.call(this),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new We(t,e)),this.mergeVertices()}function We(t,e){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Ge.call(this,n,r,t,e),this.type="OctahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Xe(t,e){Ct.call(this),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new qe(t,e)),this.mergeVertices()}function qe(t,e){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],i=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];Ge.call(this,r,i,t,e),this.type="IcosahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Ye(t,e){Ct.call(this),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e},this.fromBufferGeometry(new Ze(t,e)),this.mergeVertices()}function Ze(t,e){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-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,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],o=[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];Ge.call(this,i,o,t,e),this.type="DodecahedronBufferGeometry",this.parameters={radius:t,detail:e}}function Je(t,e,n,r,i,o){Ct.call(this),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:i},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Ke(t,e,n,r,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Ke(t,e,n,r,o){function a(i){var o=t.getPointAt(i/e),a=c.normals[i],s=c.binormals[i];for(f=0;f<=r;f++){var u=f/r*Math.PI*2,l=Math.sin(u),h=-Math.cos(u);p.x=h*a.x+l*s.x,p.y=h*a.y+l*s.y,p.z=h*a.z+l*s.z,p.normalize(),v.push(p.x,p.y,p.z),d.x=o.x+n*p.x,d.y=o.y+n*p.y,d.z=o.z+n*p.z,g.push(d.x,d.y,d.z)}}function s(){for(f=1;f<=e;f++)for(h=1;h<=r;h++){var t=(r+1)*(f-1)+(h-1),n=(r+1)*f+(h-1),i=(r+1)*f+h,o=(r+1)*(f-1)+h;_.push(t,n,o),_.push(n,i,o)}}function u(){for(h=0;h<=e;h++)for(f=0;f<=r;f++)m.x=h/e,m.y=f/r,y.push(m.x,m.y)}Lt.call(this),this.type="TubeBufferGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:r,closed:o},e=e||64,n=n||1,r=r||8,o=o||!1;var c=t.computeFrenetFrames(e,o);this.tangents=c.tangents,this.normals=c.normals,this.binormals=c.binormals;var h,f,d=new l,p=new l,m=new i,g=[],v=[],y=[],_=[];!function(){for(h=0;h<e;h++)a(h);a(!1===o?e:0),u(),s()}(),this.setIndex(_),this.addAttribute("position",new Mt(g,3)),this.addAttribute("normal",new Mt(v,3)),this.addAttribute("uv",new Mt(y,2))}function Qe(t,e,n,r,i,o,a){Ct.call(this),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},void 0!==a&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new $e(t,e,n,r,i,o)),this.mergeVertices()}function $e(t,e,n,r,i,o){function a(t,e,n,r,i){var o=Math.cos(t),a=Math.sin(t),s=n/e*t,u=Math.cos(s);i.x=r*(2+u)*.5*o,i.y=r*(2+u)*a*.5,i.z=r*Math.sin(s)*.5}Lt.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:r,p:i,q:o},t=t||100,e=e||40,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,o=o||3;var s,u,c=[],h=[],f=[],d=[],p=new l,m=new l,g=new l,v=new l,y=new l,_=new l,x=new l;for(s=0;s<=n;++s){var b=s/n*i*Math.PI*2;for(a(b,i,o,t,g),a(b+.01,i,o,t,v),_.subVectors(v,g),x.addVectors(v,g),y.crossVectors(_,x),x.crossVectors(y,_),y.normalize(),x.normalize(),u=0;u<=r;++u){var w=u/r*Math.PI*2,M=-e*Math.cos(w),E=e*Math.sin(w);p.x=g.x+(M*x.x+E*y.x),p.y=g.y+(M*x.y+E*y.y),p.z=g.z+(M*x.z+E*y.z),h.push(p.x,p.y,p.z),m.subVectors(p,g).normalize(),f.push(m.x,m.y,m.z),d.push(s/n),d.push(u/r)}}for(u=1;u<=n;u++)for(s=1;s<=r;s++){var T=(r+1)*(u-1)+(s-1),S=(r+1)*u+(s-1),A=(r+1)*u+s,C=(r+1)*(u-1)+s;c.push(T,S,C),c.push(S,A,C)}this.setIndex(c),this.addAttribute("position",new Mt(h,3)),this.addAttribute("normal",new Mt(f,3)),this.addAttribute("uv",new Mt(d,2))}function tn(t,e,n,r,i){Ct.call(this),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new en(t,e,n,r,i)),this.mergeVertices()}function en(t,e,n,r,i){Lt.call(this),this.type="TorusBufferGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:r,arc:i},t=t||100,e=e||40,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||2*Math.PI;var o,a,s=[],u=[],c=[],h=[],f=new l,d=new l,p=new l;for(o=0;o<=n;o++)for(a=0;a<=r;a++){var m=a/r*i,g=o/n*Math.PI*2;d.x=(t+e*Math.cos(g))*Math.cos(m),d.y=(t+e*Math.cos(g))*Math.sin(m),d.z=e*Math.sin(g),u.push(d.x,d.y,d.z),f.x=t*Math.cos(m),f.y=t*Math.sin(m),p.subVectors(d,f).normalize(),c.push(p.x,p.y,p.z),h.push(a/r),h.push(o/n)}for(o=1;o<=n;o++)for(a=1;a<=r;a++){var v=(r+1)*o+a-1,y=(r+1)*(o-1)+a-1,_=(r+1)*(o-1)+a,x=(r+1)*o+a;s.push(v,y,x),s.push(y,_,x)}this.setIndex(s),this.addAttribute("position",new Mt(u,3)),this.addAttribute("normal",new Mt(c,3)),this.addAttribute("uv",new Mt(h,2))}function nn(t,e){Ct.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},this.fromBufferGeometry(new rn(t,e)),this.mergeVertices()}function rn(t,e){if(void 0===t)return void(t=[]);Lt.call(this),this.type="ExtrudeBufferGeometry",t=Array.isArray(t)?t:[t],this.addShapeList(t,e),this.computeVertexNormals()}function on(t,e){Ct.call(this),this.type="TextGeometry",this.parameters={text:t,parameters:e},this.fromBufferGeometry(new an(t,e)),this.mergeVertices()}function an(t,e){e=e||{};var n=e.font;if(!1===(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Ct;var r=n.generateShapes(t,e.size,e.curveSegments);e.amount=void 0!==e.height?e.height:50,void 0===e.bevelThickness&&(e.bevelThickness=10),void 0===e.bevelSize&&(e.bevelSize=8),void 0===e.bevelEnabled&&(e.bevelEnabled=!1),rn.call(this,r,e),this.type="TextBufferGeometry"}function sn(t,e,n,r,i,o,a){Ct.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},this.fromBufferGeometry(new un(t,e,n,r,i,o,a)),this.mergeVertices()}function un(t,e,n,r,i,o,a){Lt.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:r,phiLength:i,thetaStart:o,thetaLength:a},t=t||50,e=Math.max(3,Math.floor(e)||8),n=Math.max(2,Math.floor(n)||6),r=void 0!==r?r:0,i=void 0!==i?i:2*Math.PI,o=void 0!==o?o:0,a=void 0!==a?a:Math.PI;var s,u,c=o+a,h=0,f=[],d=new l,p=new l,m=[],g=[],v=[],y=[];for(u=0;u<=n;u++){var _=[],x=u/n;for(s=0;s<=e;s++){var b=s/e;d.x=-t*Math.cos(r+b*i)*Math.sin(o+x*a),d.y=t*Math.cos(o+x*a),d.z=t*Math.sin(r+b*i)*Math.sin(o+x*a),g.push(d.x,d.y,d.z),p.set(d.x,d.y,d.z).normalize(),v.push(p.x,p.y,p.z),y.push(b,1-x),_.push(h++)}f.push(_)}for(u=0;u<n;u++)for(s=0;s<e;s++){var w=f[u][s+1],M=f[u][s],E=f[u+1][s],T=f[u+1][s+1];(0!==u||o>0)&&m.push(w,M,T),(u!==n-1||c<Math.PI)&&m.push(M,E,T)}this.setIndex(m),this.addAttribute("position",new Mt(g,3)),this.addAttribute("normal",new Mt(v,3)),this.addAttribute("uv",new Mt(y,2))}function cn(t,e,n,r,i,o){Ct.call(this),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:o},this.fromBufferGeometry(new ln(t,e,n,r,i,o)),this.mergeVertices()}function ln(t,e,n,r,o,a){Lt.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:r,thetaStart:o,thetaLength:a},t=t||20,e=e||50,o=void 0!==o?o:0,a=void 0!==a?a:2*Math.PI,n=void 0!==n?Math.max(3,n):8,r=void 0!==r?Math.max(1,r):1;var s,u,c,h=[],f=[],d=[],p=[],m=t,g=(e-t)/r,v=new l,y=new i;for(u=0;u<=r;u++){for(c=0;c<=n;c++)s=o+c/n*a,v.x=m*Math.cos(s),v.y=m*Math.sin(s),f.push(v.x,v.y,v.z),d.push(0,0,1),y.x=(v.x/e+1)/2,y.y=(v.y/e+1)/2,p.push(y.x,y.y);m+=g}for(u=0;u<r;u++){var _=u*(n+1);for(c=0;c<n;c++){s=c+_;var x=s,b=s+n+1,w=s+n+2,M=s+1;h.push(x,b,M),h.push(b,w,M)}}this.setIndex(h),this.addAttribute("position",new Mt(f,3)),this.addAttribute("normal",new Mt(d,3)),this.addAttribute("uv",new Mt(p,2))}function hn(t,e,n,r){Ct.call(this),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},this.fromBufferGeometry(new fn(t,e,n,r)),this.mergeVertices()}function fn(t,e,n,r){Lt.call(this),this.type="LatheBufferGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:r},e=Math.floor(e)||12,n=n||0,r=r||2*Math.PI,r=Ms.clamp(r,0,2*Math.PI);var o,a,s,u=[],c=[],h=[],f=1/e,d=new l,p=new i;for(a=0;a<=e;a++){var m=n+a*f*r,g=Math.sin(m),v=Math.cos(m);for(s=0;s<=t.length-1;s++)d.x=t[s].x*g,d.y=t[s].y,d.z=t[s].x*v,c.push(d.x,d.y,d.z),p.x=a/e,p.y=s/(t.length-1),h.push(p.x,p.y)}for(a=0;a<e;a++)for(s=0;s<t.length-1;s++){o=s+a*t.length;var y=o,_=o+t.length,x=o+t.length+1,b=o+1;u.push(y,_,b),u.push(_,x,b)}if(this.setIndex(u),this.addAttribute("position",new Mt(c,3)),this.addAttribute("uv",new Mt(h,2)),this.computeVertexNormals(),r===2*Math.PI){var w=this.attributes.normal.array,M=new l,E=new l,T=new l;for(o=e*t.length*3,a=0,s=0;a<t.length;a++,s+=3)M.x=w[s+0],M.y=w[s+1],M.z=w[s+2],E.x=w[o+s+0],E.y=w[o+s+1],E.z=w[o+s+2],T.addVectors(M,E).normalize(),w[s+0]=w[o+s+0]=T.x,w[s+1]=w[o+s+1]=T.y,w[s+2]=w[o+s+2]=T.z}}function dn(t,e){Ct.call(this),this.type="ShapeGeometry","object"==typeof e&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),e=e.curveSegments),this.parameters={shapes:t,curveSegments:e},this.fromBufferGeometry(new pn(t,e)),this.mergeVertices()}function pn(t,e){function n(t){var n,s,c,l=i.length/3,h=t.extractPoints(e),f=h.shape,d=h.holes;if(!1===Gs.isClockWise(f))for(f=f.reverse(),n=0,s=d.length;n<s;n++)c=d[n],!0===Gs.isClockWise(c)&&(d[n]=c.reverse());var p=Gs.triangulateShape(f,d);for(n=0,s=d.length;n<s;n++)c=d[n],f=f.concat(c);for(n=0,s=f.length;n<s;n++){var m=f[n];i.push(m.x,m.y,0),o.push(0,0,1),a.push(m.x,m.y)}for(n=0,s=p.length;n<s;n++){var g=p[n],v=g[0]+l,y=g[1]+l,_=g[2]+l;r.push(v,y,_),u+=3}}Lt.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:e},e=e||12;var r=[],i=[],o=[],a=[],s=0,u=0;if(!1===Array.isArray(t))n(t);else for(var c=0;c<t.length;c++)n(t[c]),this.addGroup(s,u,c),s+=u,u=0;this.setIndex(r),this.addAttribute("position",new Mt(i,3)),this.addAttribute("normal",new Mt(o,3)),this.addAttribute("uv",new Mt(a,2))}function mn(t,e){Lt.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1;var n,r,i,o,a=[],s=Math.cos(Ms.DEG2RAD*e),u=[0,0],c={},l=["a","b","c"];t.isBufferGeometry?(o=new Ct,o.fromBufferGeometry(t)):o=t.clone(),o.mergeVertices(),o.computeFaceNormals();for(var h=o.vertices,f=o.faces,d=0,p=f.length;d<p;d++)for(var m=f[d],g=0;g<3;g++)n=m[l[g]],r=m[l[(g+1)%3]],u[0]=Math.min(n,r),u[1]=Math.max(n,r),i=u[0]+","+u[1],void 0===c[i]?c[i]={index1:u[0],index2:u[1],face1:d,face2:void 0}:c[i].face2=d;for(i in c){var v=c[i];if(void 0===v.face2||f[v.face1].normal.dot(f[v.face2].normal)<=s){var y=h[v.index1];a.push(y.x,y.y,y.z),y=h[v.index2],a.push(y.x,y.y,y.z)}}this.addAttribute("position",new Mt(a,3))}function gn(t,e,n,r,i,o,a,s){Ct.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:i,openEnded:o,thetaStart:a,thetaLength:s},this.fromBufferGeometry(new vn(t,e,n,r,i,o,a,s)),this.mergeVertices()}function vn(t,e,n,r,o,a,s,u){function c(n){var o,a,c,v=new i,x=new l,b=0,w=!0===n?t:e,M=!0===n?1:-1;for(a=g,o=1;o<=r;o++)d.push(0,y*M,0),p.push(0,M,0),m.push(.5,.5),g++;for(c=g,o=0;o<=r;o++){var E=o/r,T=E*u+s,S=Math.cos(T),A=Math.sin(T);x.x=w*A,x.y=y*M,x.z=w*S,d.push(x.x,x.y,x.z),p.push(0,M,0),v.x=.5*S+.5,v.y=.5*A*M+.5,m.push(v.x,v.y),g++}for(o=0;o<r;o++){var C=a+o,L=c+o;!0===n?f.push(L,L+1,C):f.push(L+1,L,C),b+=3}h.addGroup(_,b,!0===n?1:2),_+=b}Lt.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:r,heightSegments:o,openEnded:a,thetaStart:s,thetaLength:u};var h=this;t=void 0!==t?t:20,e=void 0!==e?e:20,n=void 0!==n?n:100,r=Math.floor(r)||8,o=Math.floor(o)||1,a=void 0!==a&&a,s=void 0!==s?s:0,u=void 0!==u?u:2*Math.PI;var f=[],d=[],p=[],m=[],g=0,v=[],y=n/2,_=0;!function(){var i,a,c=new l,x=new l,b=0,w=(e-t)/n;for(a=0;a<=o;a++){var M=[],E=a/o,T=E*(e-t)+t;for(i=0;i<=r;i++){var S=i/r,A=S*u+s,C=Math.sin(A),L=Math.cos(A);x.x=T*C,x.y=-E*n+y,x.z=T*L,d.push(x.x,x.y,x.z),c.set(C,w,L).normalize(),p.push(c.x,c.y,c.z),m.push(S,1-E),M.push(g++)}v.push(M)}for(i=0;i<r;i++)for(a=0;a<o;a++){var R=v[a][i],P=v[a+1][i],N=v[a+1][i+1],I=v[a][i+1];f.push(R,P,I),f.push(P,N,I),b+=6}h.addGroup(_,b,0),_+=b}(),!1===a&&(t>0&&c(!0),e>0&&c(!1)),this.setIndex(f),this.addAttribute("position",new Mt(d,3)),this.addAttribute("normal",new Mt(p,3)),this.addAttribute("uv",new Mt(m,2))}function yn(t,e,n,r,i,o,a){gn.call(this,0,t,e,n,r,i,o,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function _n(t,e,n,r,i,o,a){vn.call(this,0,t,e,n,r,i,o,a),this.type="ConeBufferGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:o,thetaLength:a}}function xn(t,e,n,r){Ct.call(this),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new bn(t,e,n,r)),this.mergeVertices()}function bn(t,e,n,r){Lt.call(this),this.type="CircleBufferGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:r},t=t||50,e=void 0!==e?Math.max(3,e):8,n=void 0!==n?n:0,r=void 0!==r?r:2*Math.PI;var o,a,s=[],u=[],c=[],h=[],f=new l,d=new i;for(u.push(0,0,0),c.push(0,0,1),h.push(.5,.5),a=0,o=3;a<=e;a++,o+=3){var p=n+a/e*r;f.x=t*Math.cos(p),f.y=t*Math.sin(p),u.push(f.x,f.y,f.z),c.push(0,0,1),d.x=(u[o]/t+1)/2,d.y=(u[o+1]/t+1)/2,h.push(d.x,d.y)}for(o=1;o<=e;o++)s.push(o,o+1,0);this.setIndex(s),this.addAttribute("position",new Mt(u,3)),this.addAttribute("normal",new Mt(c,3)),this.addAttribute("uv",new Mt(h,2))}function wn(t){$.call(this,{uniforms:Os.merge([Is.lights,{opacity:{value:1}}]),vertexShader:Us.shadow_vert,fragmentShader:Us.shadow_frag}),this.lights=!0,this.transparent=!0,Object.defineProperties(this,{opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}}}),this.setValues(t)}function Mn(t){$.call(this,t),this.type="RawShaderMaterial"}function En(t){Q.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Y(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Tn(t){En.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(t)}function Sn(t){Q.call(this),this.type="MeshPhongMaterial",this.color=new Y(16777215),this.specular=new Y(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ea,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function An(t){Sn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(t)}function Cn(t){Q.call(this,t),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Ln(t){Q.call(this),this.type="MeshLambertMaterial",this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ea,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Rn(t){Q.call(this),this.type="LineDashedMaterial",this.color=new Y(16777215),this.linewidth=1,this.scale=1,this.dashSize=3,this.gapSize=1,this.lights=!1,this.setValues(t)}function Pn(t,e,n){var r=this,i=!1,o=0,a=0;this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===i&&void 0!==r.onStart&&r.onStart(t,o,a),i=!0},this.itemEnd=function(t){o++,void 0!==r.onProgress&&r.onProgress(t,o,a),o===a&&(i=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)}}function Nn(t){this.manager=void 0!==t?t:Ws}function In(t){this.manager=void 0!==t?t:Ws,this._parser=null}function On(t){this.manager=void 0!==t?t:Ws,this._parser=null}function Un(t){this.manager=void 0!==t?t:Ws}function Dn(t){this.manager=void 0!==t?t:Ws}function Fn(t){this.manager=void 0!==t?t:Ws}function Bn(t,e){lt.call(this),this.type="Light",this.color=new Y(t),this.intensity=void 0!==e?e:1,this.receiveShadow=void 0}function zn(t,e,n){Bn.call(this,t,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(lt.DefaultUp),this.updateMatrix(),this.groundColor=new Y(e)}function kn(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new i(512,512),this.map=null,this.matrix=new h}function Gn(){kn.call(this,new Dt(50,1,.5,500))}function Hn(t,e,n,r,i,o){Bn.call(this,t,e),this.type="SpotLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(t){this.intensity=t/Math.PI}}),this.distance=void 0!==n?n:0,this.angle=void 0!==r?r:Math.PI/3,this.penumbra=void 0!==i?i:0,this.decay=void 0!==o?o:1,this.shadow=new Gn}function Vn(t,e,n,r){Bn.call(this,t,e),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return 4*this.intensity*Math.PI},set:function(t){this.intensity=t/(4*Math.PI)}}),this.distance=void 0!==n?n:0,this.decay=void 0!==r?r:1,this.shadow=new kn(new Dt(90,1,.5,500))}function jn(){kn.call(this,new Ft(-5,5,5,-5,.5,500))}function Wn(t,e){Bn.call(this,t,e),this.type="DirectionalLight",this.position.copy(lt.DefaultUp),this.updateMatrix(),this.target=new lt,this.shadow=new jn}function Xn(t,e){Bn.call(this,t,e),this.type="AmbientLight",this.castShadow=void 0}function qn(t,e,n,r){Bn.call(this,t,e),this.type="RectAreaLight",this.position.set(0,1,0),this.updateMatrix(),this.width=void 0!==n?n:10,this.height=void 0!==r?r:10}function Yn(t,e,n,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(n),this.sampleValues=e,this.valueSize=n}function Zn(t,e,n,r){Yn.call(this,t,e,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}function Jn(t,e,n,r){Yn.call(this,t,e,n,r)}function Kn(t,e,n,r){Yn.call(this,t,e,n,r)}function Qn(t,e,n,r){if(void 0===t)throw new Error("track name is undefined");if(void 0===e||0===e.length)throw new Error("no keyframes in track named "+t);this.name=t,this.times=Xs.convertArray(e,this.TimeBufferType),this.values=Xs.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation),this.validate(),this.optimize()}function $n(t,e,n,r){Qn.call(this,t,e,n,r)}function tr(t,e,n,r){Yn.call(this,t,e,n,r)}function er(t,e,n,r){Qn.call(this,t,e,n,r)}function nr(t,e,n,r){Qn.call(this,t,e,n,r)}function rr(t,e,n,r){Qn.call(this,t,e,n,r)}function ir(t,e,n){Qn.call(this,t,e,n)}function or(t,e,n,r){Qn.call(this,t,e,n,r)}function ar(t,e,n,r){Qn.apply(this,arguments)}function sr(t,e,n){this.name=t,this.tracks=n,this.duration=void 0!==e?e:-1,this.uuid=Ms.generateUUID(),this.duration<0&&this.resetDuration(),this.optimize()}function ur(t){this.manager=void 0!==t?t:Ws,this.textures={}}function cr(t){this.manager=void 0!==t?t:Ws}function lr(){this.onLoadStart=function(){},this.onLoadProgress=function(){},this.onLoadComplete=function(){}}function hr(t){"boolean"==typeof t&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),t=void 0),this.manager=void 0!==t?t:Ws,this.withCredentials=!1}function fr(t){this.manager=void 0!==t?t:Ws,this.texturePath=""}function dr(t,e,n,r,i){var o=.5*(r-e),a=.5*(i-n),s=t*t;return(2*n-2*r+o+a)*(t*s)+(-3*n+3*r-2*o-a)*s+o*t+n}function pr(t,e){var n=1-t;return n*n*e}function mr(t,e){return 2*(1-t)*t*e}function gr(t,e){return t*t*e}function vr(t,e,n,r){return pr(t,e)+mr(t,n)+gr(t,r)}function yr(t,e){var n=1-t;return n*n*n*e}function _r(t,e){var n=1-t;return 3*n*n*t*e}function xr(t,e){return 3*(1-t)*t*t*e}function br(t,e){return t*t*t*e}function wr(t,e,n,r,i){return yr(t,e)+_r(t,n)+xr(t,r)+br(t,i)}function Mr(){this.arcLengthDivisions=200}function Er(t,e){Mr.call(this),this.v1=t,this.v2=e}function Tr(){Mr.call(this),this.curves=[],this.autoClose=!1}function Sr(t,e,n,r,i,o,a,s){Mr.call(this),this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=o,this.aClockwise=a,this.aRotation=s||0}function Ar(t){Mr.call(this),this.points=void 0===t?[]:t}function Cr(t,e,n,r){Mr.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=r}function Lr(t,e,n){Mr.call(this),this.v0=t,this.v1=e,this.v2=n}function Rr(t){Tr.call(this),this.currentPoint=new i,t&&this.fromPoints(t)}function Pr(){Rr.apply(this,arguments),this.holes=[]}function Nr(){this.subPaths=[],this.currentPath=null}function Ir(t){this.data=t}function Or(t){this.manager=void 0!==t?t:Ws}function Ur(t){this.manager=void 0!==t?t:Ws}function Dr(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Dt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Dt,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}function Fr(t,e,n){lt.call(this),this.type="CubeCamera";var r=new Dt(90,1,t,e);r.up.set(0,-1,0),r.lookAt(new l(1,0,0)),this.add(r);var i=new Dt(90,1,t,e);i.up.set(0,-1,0),i.lookAt(new l(-1,0,0)),this.add(i);var o=new Dt(90,1,t,e);o.up.set(0,0,1),o.lookAt(new l(0,1,0)),this.add(o);var a=new Dt(90,1,t,e);a.up.set(0,0,-1),a.lookAt(new l(0,-1,0)),this.add(a);var s=new Dt(90,1,t,e);s.up.set(0,-1,0),s.lookAt(new l(0,0,1)),this.add(s);var c=new Dt(90,1,t,e);c.up.set(0,-1,0),c.lookAt(new l(0,0,-1)),this.add(c);var h={format:za,magFilter:Ma,minFilter:Ma};this.renderTarget=new u(n,n,h),this.renderTarget.texture.name="CubeCamera",this.updateCubeMap=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,n.activeCubeFace=0,t.render(e,r,n),n.activeCubeFace=1,t.render(e,i,n),n.activeCubeFace=2,t.render(e,o,n),n.activeCubeFace=3,t.render(e,a,n),n.activeCubeFace=4,t.render(e,s,n),n.texture.generateMipmaps=u,n.activeCubeFace=5,t.render(e,c,n),t.setRenderTarget(null)}}function Br(t){Dt.call(this),this.enabled=!1,this.cameras=t||[]}function zr(){lt.call(this),this.type="AudioListener",this.context=tu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null}function kr(t){lt.call(this),this.type="Audio",this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.loop=!1,this.startTime=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}function Gr(t){kr.call(this,t),this.panner=this.context.createPanner(),this.panner.connect(this.gain)}function Hr(t,e){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=void 0!==e?e:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}function Vr(t,e,n){this.binding=t,this.valueSize=n;var r,i=Float64Array;switch(e){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(4*n),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}function jr(t,e,n){var r=n||Wr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function Wr(t,e,n){this.path=e,this.parsedPath=n||Wr.parseTrackName(e),this.node=Wr.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}function Xr(t){this.uuid=Ms.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}function qr(t,e,n){this._mixer=t,this._clip=e,this._localRoot=n||null;for(var r=e.tracks,i=r.length,o=new Array(i),a={endingStart:ss,endingEnd:ss},s=0;s!==i;++s){var u=r[s].createInterpolant(null);o[s]=u,u.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(i),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ns,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}function Yr(t){this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function Zr(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}function Jr(){Lt.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Kr(t,e,n,r){this.uuid=Ms.generateUUID(),this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===r}function Qr(t,e){this.uuid=Ms.generateUUID(),this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.onUploadCallback=function(){},this.version=0}function $r(t,e,n){Qr.call(this,t,e),this.meshPerAttribute=n||1}function ti(t,e,n){mt.call(this,t,e),this.meshPerAttribute=n||1}function ei(t,e,n,r){this.ray=new st(t,e),this.near=n||0,this.far=r||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ni(t,e){return t.distance-e.distance}function ri(t,e,n,r){if(!1!==t.visible&&(t.raycast(e,n),!0===r))for(var i=t.children,o=0,a=i.length;o<a;o++)ri(i[o],e,n,!0)}function ii(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function oi(t,e,n){return this.radius=void 0!==t?t:1,this.phi=void 0!==e?e:0,this.theta=void 0!==n?n:0,this}function ai(t,e,n){return this.radius=void 0!==t?t:1,this.theta=void 0!==e?e:0,this.y=void 0!==n?n:0,this}function si(t,e){Rt.call(this,t,e),this.animationsMap={},this.animationsList=[];var n=this.geometry.morphTargets.length,r=n-1,i=n/1;this.createAnimation("__default",0,r,i),this.setAnimationWeight("__default",1)}function ui(t){lt.call(this),this.material=t,this.render=function(t){}}function ci(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16711680,o=void 0!==r?r:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=3*s.faces.length:s&&s.isBufferGeometry&&(a=s.attributes.normal.count);var u=new Lt,c=new Mt(2*a*3,3);u.addAttribute("position",c),Ce.call(this,u,new Se({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function li(t){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;for(var e=new Lt,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,i=1;r<32;r++,i++){var o=r/32*Math.PI*2,a=i/32*Math.PI*2;n.push(Math.cos(o),Math.sin(o),1,Math.cos(a),Math.sin(a),1)}e.addAttribute("position",new Mt(n,3));var s=new Se({fog:!1});this.cone=new Ce(e,s),this.add(this.cone),this.update()}function hi(t){this.bones=this.getBoneList(t);for(var e=new Lt,n=[],r=[],i=new Y(0,0,1),o=new Y(0,1,0),a=0;a<this.bones.length;a++){var s=this.bones[a];s.parent&&s.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),r.push(i.r,i.g,i.b),r.push(o.r,o.g,o.b))}e.addAttribute("position",new Mt(n,3)),e.addAttribute("color",new Mt(r,3));var u=new Se({vertexColors:Eo,depthTest:!1,depthWrite:!1,transparent:!0});Ce.call(this,e,u),this.root=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.update()}function fi(t,e){this.light=t,this.light.updateMatrixWorld();var n=new un(e,4,2),r=new pt({wireframe:!0,fog:!1});r.color.copy(this.light.color),Rt.call(this,n,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1}function di(t){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var e=new Se({color:t.color}),n=new Lt;n.addAttribute("position",new mt(new Float32Array(15),3)),this.add(new Ae(n,e)),this.update()}function pi(t,e){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1;var n=new We(e);n.rotateY(.5*Math.PI);var r=new pt({vertexColors:Eo,wireframe:!0}),i=n.getAttribute("position"),o=new Float32Array(3*i.count);n.addAttribute("color",new mt(o,3)),this.add(new Rt(n,r)),this.update()}function mi(t,e,n,r){t=t||10,e=e||10,n=new Y(void 0!==n?n:4473924),r=new Y(void 0!==r?r:8947848);for(var i=e/2,o=t/e,a=t/2,s=[],u=[],c=0,l=0,h=-a;c<=e;c++,h+=o){s.push(-a,0,h,a,0,h),s.push(h,0,-a,h,0,a);var f=c===i?n:r;f.toArray(u,l),l+=3,f.toArray(u,l),l+=3,f.toArray(u,l),l+=3,f.toArray(u,l),l+=3}var d=new Lt;d.addAttribute("position",new Mt(s,3)),d.addAttribute("color",new Mt(u,3));var p=new Se({vertexColors:Eo});Ce.call(this,d,p)}function gi(t,e,n,r,i,o){t=t||10,e=e||16,n=n||8,r=r||64,i=new Y(void 0!==i?i:4473924),o=new Y(void 0!==o?o:8947848);var a,s,u,c,l,h,f,d=[],p=[];for(c=0;c<=e;c++)u=c/e*(2*Math.PI),a=Math.sin(u)*t,s=Math.cos(u)*t,d.push(0,0,0),d.push(a,0,s),f=1&c?i:o,p.push(f.r,f.g,f.b),p.push(f.r,f.g,f.b);for(c=0;c<=n;c++)for(f=1&c?i:o,h=t-t/n*c,l=0;l<r;l++)u=l/r*(2*Math.PI),a=Math.sin(u)*h,s=Math.cos(u)*h,d.push(a,0,s),p.push(f.r,f.g,f.b),u=(l+1)/r*(2*Math.PI),a=Math.sin(u)*h,s=Math.cos(u)*h,d.push(a,0,s),p.push(f.r,f.g,f.b);var m=new Lt;m.addAttribute("position",new Mt(d,3)),m.addAttribute("color",new Mt(p,3));var g=new Se({vertexColors:Eo});Ce.call(this,m,g)}function vi(t,e,n,r){this.object=t,this.size=void 0!==e?e:1;var i=void 0!==n?n:16776960,o=void 0!==r?r:1,a=0,s=this.object.geometry;s&&s.isGeometry?a=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var u=new Lt,c=new Mt(2*a*3,3);u.addAttribute("position",c),Ce.call(this,u,new Se({color:i,linewidth:o})),this.matrixAutoUpdate=!1,this.update()}function yi(t,e){lt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,void 0===e&&(e=1);var n=new Lt;n.addAttribute("position",new Mt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));var r=new Se({fog:!1});this.add(new Ae(n,r)),n=new Lt,n.addAttribute("position",new Mt([0,0,0,0,0,1],3)),this.add(new Ae(n,r)),this.update()}function _i(t){function e(t,e,r){n(t,r),n(e,r)}function n(t,e){o.push(0,0,0),a.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(o.length/3-1)}var r=new Lt,i=new Se({color:16777215,vertexColors:Mo}),o=[],a=[],s={},u=new Y(16755200),c=new Y(16711680),l=new Y(43775),h=new Y(16777215),f=new Y(3355443);e("n1","n2",u),e("n2","n4",u),e("n4","n3",u),e("n3","n1",u),e("f1","f2",u),e("f2","f4",u),e("f4","f3",u),e("f3","f1",u),e("n1","f1",u),e("n2","f2",u),e("n3","f3",u),e("n4","f4",u),e("p","n1",c),e("p","n2",c),e("p","n3",c),e("p","n4",c),e("u1","u2",l),e("u2","u3",l),e("u3","u1",l),e("c","t",h),e("p","c",f),e("cn1","cn2",f),e("cn3","cn4",f),e("cf1","cf2",f),e("cf3","cf4",f),r.addAttribute("position",new Mt(o,3)),r.addAttribute("color",new Mt(a,3)),Ce.call(this,r,i),this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}function xi(t,e){this.object=t,void 0===e&&(e=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),i=new Lt;i.setIndex(new mt(n,1)),i.addAttribute("position",new mt(r,3)),Ce.call(this,i,new Se({color:e})),this.matrixAutoUpdate=!1,this.update()}function bi(t,e,n,r,i,o){lt.call(this),void 0===r&&(r=16776960),void 0===n&&(n=1),void 0===i&&(i=.2*n),void 0===o&&(o=.2*i),void 0===eu&&(eu=new Lt,eu.addAttribute("position",new Mt([0,0,0,0,1,0],3)),nu=new vn(0,.5,1,5,1),nu.translate(0,-.5,0)),this.position.copy(e),this.line=new Ae(eu,new Se({color:r})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Rt(nu,new pt({color:r})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,i,o)}function wi(t){t=t||1;var e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Lt;r.addAttribute("position",new Mt(e,3)),r.addAttribute("color",new Mt(n,3));var i=new Se({vertexColors:Eo});Ce.call(this,r,i)}function Mi(){function t(t,o,a,s){e=t,n=a,r=-3*t+3*o-2*a-s,i=2*t-2*o+a+s}var e=0,n=0,r=0,i=0;return{initCatmullRom:function(e,n,r,i,o){t(n,r,o*(r-e),o*(i-n))},initNonuniformCatmullRom:function(e,n,r,i,o,a,s){var u=(n-e)/o-(r-e)/(o+a)+(r-n)/a,c=(r-n)/a-(i-n)/(a+s)+(i-r)/s;u*=a,c*=a,t(n,r,u,c)},calc:function(t){var o=t*t;return e+n*t+r*o+i*(o*t)}}}function Ei(t){Mr.call(this),this.points=t||[],this.closed=!1}function Ti(t,e,n,r){Mr.call(this),this.v0=t,this.v1=e,this.v2=n,this.v3=r}function Si(t,e,n){Mr.call(this),this.v0=t,this.v1=e,this.v2=n}function Ai(t,e){Mr.call(this),this.v1=t,this.v2=e}function Ci(t,e,n,r,i,o){Sr.call(this,t,e,n,n,r,i,o)}function Li(t,e,n,r,i,o,a){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new dt(t,e,n,i,o,a)}function Ri(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t}function Pi(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t}function Ni(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Pe(t,e)}function Ii(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new be(t)}function Oi(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Pe(t,e)}function Ui(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new Re(t)}function Di(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new Re(t)}function Fi(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new Re(t)}function Bi(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new l(t,e,n)}function zi(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new mt(t,e).setDynamic(!0)}function ki(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new gt(t,e)}function Gi(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new vt(t,e)}function Hi(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new yt(t,e)}function Vi(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new _t(t,e)}function ji(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new xt(t,e)}function Wi(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new bt(t,e)}function Xi(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new wt(t,e)}function qi(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Mt(t,e)}function Yi(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Et(t,e)}function Zi(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ei.call(this,t),this.type="catmullrom",this.closed=!0}function Ji(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Ei.call(this,t),this.type="catmullrom"}function Ki(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Ei.call(this,t),this.type="catmullrom"}function Qi(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new xi(t,e)}function $i(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Ce(new mn(t.geometry),new Se({color:void 0!==e?e:16777215}))}function to(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new Ce(new Fe(t.geometry),new Se({color:void 0!==e?e:16777215}))}function eo(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Nn(t)}function no(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new On(t)}function ro(){console.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(t,e){console.warn("THREE.Projector: .projectVector() is now vector.project()."),t.project(e)},this.unprojectVector=function(t,e){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),t.unproject(e)},this.pickingRay=function(){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}}function io(){console.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"WebGLRenderTargetCube",function(){return u}),n.d(e,"WebGLRenderTarget",function(){return s}),n.d(e,"WebGLRenderer",function(){return me}),n.d(e,"ShaderLib",function(){return Ds}),n.d(e,"UniformsLib",function(){return Is}),n.d(e,"UniformsUtils",function(){return Os}),n.d(e,"ShaderChunk",function(){return Us}),n.d(e,"FogExp2",function(){return ge}),n.d(e,"Fog",function(){return ve}),n.d(e,"Scene",function(){return ye}),n.d(e,"LensFlare",function(){return _e}),n.d(e,"Sprite",function(){return be}),n.d(e,"LOD",function(){return we}),n.d(e,"SkinnedMesh",function(){return Te}),n.d(e,"Skeleton",function(){return Me}),n.d(e,"Bone",function(){return Ee}),n.d(e,"Mesh",function(){return Rt}),n.d(e,"LineSegments",function(){return Ce}),n.d(e,"LineLoop",function(){return Le}),n.d(e,"Line",function(){return Ae}),n.d(e,"Points",function(){return Pe}),n.d(e,"Group",function(){return Ne}),n.d(e,"VideoTexture",function(){return Ie}),n.d(e,"DataTexture",function(){return f}),n.d(e,"CompressedTexture",function(){return Oe}),n.d(e,"CubeTexture",function(){return d}),n.d(e,"CanvasTexture",function(){return Ue}),n.d(e,"DepthTexture",function(){return De}),n.d(e,"Texture",function(){return o}),n.d(e,"CompressedTextureLoader",function(){return In}),n.d(e,"DataTextureLoader",function(){return On}),n.d(e,"CubeTextureLoader",function(){return Dn}),n.d(e,"TextureLoader",function(){return Fn}),n.d(e,"ObjectLoader",function(){return fr}),n.d(e,"MaterialLoader",function(){return ur}),n.d(e,"BufferGeometryLoader",function(){return cr}),n.d(e,"DefaultLoadingManager",function(){return Ws}),n.d(e,"LoadingManager",function(){return Pn}),n.d(e,"JSONLoader",function(){return hr}),n.d(e,"ImageLoader",function(){return Un}),n.d(e,"FontLoader",function(){return Or}),n.d(e,"FileLoader",function(){return Nn}),n.d(e,"Loader",function(){return lr}),n.d(e,"Cache",function(){return js}),n.d(e,"AudioLoader",function(){return Ur}),n.d(e,"SpotLightShadow",function(){return Gn}),n.d(e,"SpotLight",function(){return Hn}),n.d(e,"PointLight",function(){return Vn}),n.d(e,"RectAreaLight",function(){return qn}),n.d(e,"HemisphereLight",function(){return zn}),n.d(e,"DirectionalLightShadow",function(){return jn}),n.d(e,"DirectionalLight",function(){return Wn}),n.d(e,"AmbientLight",function(){return Xn}),n.d(e,"LightShadow",function(){return kn}),n.d(e,"Light",function(){return Bn}),n.d(e,"StereoCamera",function(){return Dr}),n.d(e,"PerspectiveCamera",function(){return Dt}),n.d(e,"OrthographicCamera",function(){return Ft}),n.d(e,"CubeCamera",function(){return Fr}),n.d(e,"ArrayCamera",function(){return Br}),n.d(e,"Camera",function(){return Ut}),n.d(e,"AudioListener",function(){return zr}),n.d(e,"PositionalAudio",function(){return Gr}),n.d(e,"AudioContext",function(){return tu}),n.d(e,"AudioAnalyser",function(){return Hr}),n.d(e,"Audio",function(){return kr}),n.d(e,"VectorKeyframeTrack",function(){return $n}),n.d(e,"StringKeyframeTrack",function(){return rr}),n.d(e,"QuaternionKeyframeTrack",function(){return er}),n.d(e,"NumberKeyframeTrack",function(){return nr}),n.d(e,"ColorKeyframeTrack",function(){return or}),n.d(e,"BooleanKeyframeTrack",function(){return ir}),n.d(e,"PropertyMixer",function(){return Vr}),n.d(e,"PropertyBinding",function(){return Wr}),n.d(e,"KeyframeTrack",function(){return ar}),n.d(e,"AnimationUtils",function(){return Xs}),n.d(e,"AnimationObjectGroup",function(){return Xr}),n.d(e,"AnimationMixer",function(){return Yr}),n.d(e,"AnimationClip",function(){return sr}),n.d(e,"Uniform",function(){return Zr}),n.d(e,"InstancedBufferGeometry",function(){return Jr}),n.d(e,"BufferGeometry",function(){return Lt}),n.d(e,"GeometryIdCount",function(){return At}),n.d(e,"Geometry",function(){return Ct}),n.d(e,"InterleavedBufferAttribute",function(){return Kr}),n.d(e,"InstancedInterleavedBuffer",function(){return $r}),n.d(e,"InterleavedBuffer",function(){return Qr}),n.d(e,"InstancedBufferAttribute",function(){return ti}),n.d(e,"Face3",function(){return dt}),n.d(e,"Object3D",function(){return lt}),n.d(e,"Raycaster",function(){return ei}),n.d(e,"Layers",function(){return ct}),n.d(e,"EventDispatcher",function(){return r}),n.d(e,"Clock",function(){return ii}),n.d(e,"QuaternionLinearInterpolant",function(){return tr}),n.d(e,"LinearInterpolant",function(){return Jn}),n.d(e,"DiscreteInterpolant",function(){return Kn}),n.d(e,"CubicInterpolant",function(){return Zn}),n.d(e,"Interpolant",function(){return Yn}),n.d(e,"Triangle",function(){return ft}),n.d(e,"Math",function(){return Ms}),n.d(e,"Spherical",function(){return oi}),n.d(e,"Cylindrical",function(){return ai}),n.d(e,"Plane",function(){return it}),n.d(e,"Frustum",function(){return ot}),n.d(e,"Sphere",function(){return nt}),n.d(e,"Ray",function(){return st}),n.d(e,"Matrix4",function(){return h}),n.d(e,"Matrix3",function(){return rt}),n.d(e,"Box3",function(){return et}),n.d(e,"Box2",function(){return Z}),n.d(e,"Line3",function(){return ht}),n.d(e,"Euler",function(){return ut}),n.d(e,"Vector4",function(){return a}),n.d(e,"Vector3",function(){return l}),n.d(e,"Vector2",function(){return i}),n.d(e,"Quaternion",function(){return c}),n.d(e,"Color",function(){return Y}),n.d(e,"MorphBlendMesh",function(){return si}),n.d(e,"ImmediateRenderObject",function(){return ui}),n.d(e,"VertexNormalsHelper",function(){return ci}),n.d(e,"SpotLightHelper",function(){return li}),n.d(e,"SkeletonHelper",function(){return hi}),n.d(e,"PointLightHelper",function(){return fi}),n.d(e,"RectAreaLightHelper",function(){return di}),n.d(e,"HemisphereLightHelper",function(){return pi}),n.d(e,"GridHelper",function(){return mi}),n.d(e,"PolarGridHelper",function(){return gi}),n.d(e,"FaceNormalsHelper",function(){return vi}),n.d(e,"DirectionalLightHelper",function(){return yi}),n.d(e,"CameraHelper",function(){return _i}),n.d(e,"BoxHelper",function(){return xi}),n.d(e,"ArrowHelper",function(){return bi}),n.d(e,"AxisHelper",function(){return wi}),n.d(e,"CatmullRomCurve3",function(){return Ei}),n.d(e,"CubicBezierCurve3",function(){return Ti}),n.d(e,"QuadraticBezierCurve3",function(){return Si}),n.d(e,"LineCurve3",function(){return Ai}),n.d(e,"ArcCurve",function(){return Ci}),n.d(e,"EllipseCurve",function(){return Sr}),n.d(e,"SplineCurve",function(){return Ar}),n.d(e,"CubicBezierCurve",function(){return Cr}),n.d(e,"QuadraticBezierCurve",function(){return Lr}),n.d(e,"LineCurve",function(){return Er}),n.d(e,"Shape",function(){return Pr}),n.d(e,"Path",function(){return Rr}),n.d(e,"ShapePath",function(){return Nr}),n.d(e,"Font",function(){return Ir}),n.d(e,"CurvePath",function(){return Tr}),n.d(e,"Curve",function(){return Mr}),n.d(e,"ShapeUtils",function(){return Gs}),n.d(e,"SceneUtils",function(){return su}),n.d(e,"WireframeGeometry",function(){return Fe}),n.d(e,"ParametricGeometry",function(){return Be}),n.d(e,"ParametricBufferGeometry",function(){return ze}),n.d(e,"TetrahedronGeometry",function(){return He}),n.d(e,"TetrahedronBufferGeometry",function(){return Ve}),n.d(e,"OctahedronGeometry",function(){return je}),n.d(e,"OctahedronBufferGeometry",function(){return We}),n.d(e,"IcosahedronGeometry",function(){return Xe}),n.d(e,"IcosahedronBufferGeometry",function(){return qe}),n.d(e,"DodecahedronGeometry",function(){return Ye}),n.d(e,"DodecahedronBufferGeometry",function(){return Ze}),n.d(e,"PolyhedronGeometry",function(){return ke}),n.d(e,"PolyhedronBufferGeometry",function(){return Ge}),n.d(e,"TubeGeometry",function(){return Je}),n.d(e,"TubeBufferGeometry",function(){return Ke}),n.d(e,"TorusKnotGeometry",function(){return Qe}),n.d(e,"TorusKnotBufferGeometry",function(){return $e}),n.d(e,"TorusGeometry",function(){return tn}),n.d(e,"TorusBufferGeometry",function(){return en}),n.d(e,"TextGeometry",function(){return on}),n.d(e,"TextBufferGeometry",function(){return an}),n.d(e,"SphereGeometry",function(){return sn}),n.d(e,"SphereBufferGeometry",function(){return un}),n.d(e,"RingGeometry",function(){return cn}),n.d(e,"RingBufferGeometry",function(){return ln}),n.d(e,"PlaneGeometry",function(){return It}),n.d(e,"PlaneBufferGeometry",function(){return Ot}),n.d(e,"LatheGeometry",function(){return hn}),n.d(e,"LatheBufferGeometry",function(){return fn}),n.d(e,"ShapeGeometry",function(){return dn}),n.d(e,"ShapeBufferGeometry",function(){return pn}),n.d(e,"ExtrudeGeometry",function(){return nn}),n.d(e,"ExtrudeBufferGeometry",function(){return rn}),n.d(e,"EdgesGeometry",function(){return mn}),n.d(e,"ConeGeometry",function(){return yn}),n.d(e,"ConeBufferGeometry",function(){return _n}),n.d(e,"CylinderGeometry",function(){return gn}),n.d(e,"CylinderBufferGeometry",function(){return vn}),n.d(e,"CircleGeometry",function(){return xn}),n.d(e,"CircleBufferGeometry",function(){return bn}),n.d(e,"BoxGeometry",function(){return Pt}),n.d(e,"BoxBufferGeometry",function(){return Nt}),n.d(e,"ShadowMaterial",function(){return wn}),n.d(e,"SpriteMaterial",function(){return xe}),n.d(e,"RawShaderMaterial",function(){return Mn}),n.d(e,"ShaderMaterial",function(){return $}),n.d(e,"PointsMaterial",function(){return Re});n.d(e,"MeshPhysicalMaterial",function(){return Tn}),n.d(e,"MeshStandardMaterial",function(){return En}),n.d(e,"MeshPhongMaterial",function(){return Sn}),n.d(e,"MeshToonMaterial",function(){return An}),n.d(e,"MeshNormalMaterial",function(){return Cn}),n.d(e,"MeshLambertMaterial",function(){return Ln}),n.d(e,"MeshDepthMaterial",function(){return tt}),n.d(e,"MeshBasicMaterial",function(){return pt}),n.d(e,"LineDashedMaterial",function(){return Rn}),n.d(e,"LineBasicMaterial",function(){return Se}),n.d(e,"Material",function(){return Q}),n.d(e,"Float64BufferAttribute",function(){return Et}),n.d(e,"Float32BufferAttribute",function(){return Mt}),n.d(e,"Uint32BufferAttribute",function(){return wt}),n.d(e,"Int32BufferAttribute",function(){return bt}),n.d(e,"Uint16BufferAttribute",function(){return xt}),n.d(e,"Int16BufferAttribute",function(){return _t}),n.d(e,"Uint8ClampedBufferAttribute",function(){return yt}),n.d(e,"Uint8BufferAttribute",function(){return vt}),n.d(e,"Int8BufferAttribute",function(){return gt}),n.d(e,"BufferAttribute",function(){return mt}),n.d(e,"REVISION",function(){return oo}),n.d(e,"MOUSE",function(){return ao}),n.d(e,"CullFaceNone",function(){return so}),n.d(e,"CullFaceBack",function(){return uo}),n.d(e,"CullFaceFront",function(){return co}),n.d(e,"CullFaceFrontBack",function(){return lo}),n.d(e,"FrontFaceDirectionCW",function(){return ho}),n.d(e,"FrontFaceDirectionCCW",function(){return fo}),n.d(e,"BasicShadowMap",function(){return po}),n.d(e,"PCFShadowMap",function(){return mo}),n.d(e,"PCFSoftShadowMap",function(){return go}),n.d(e,"FrontSide",function(){return vo}),n.d(e,"BackSide",function(){return yo}),n.d(e,"DoubleSide",function(){return _o}),n.d(e,"FlatShading",function(){return xo}),n.d(e,"SmoothShading",function(){return bo}),n.d(e,"NoColors",function(){return wo}),n.d(e,"FaceColors",function(){return Mo}),n.d(e,"VertexColors",function(){return Eo}),n.d(e,"NoBlending",function(){return To}),n.d(e,"NormalBlending",function(){return So}),n.d(e,"AdditiveBlending",function(){return Ao}),n.d(e,"SubtractiveBlending",function(){return Co}),n.d(e,"MultiplyBlending",function(){return Lo}),n.d(e,"CustomBlending",function(){return Ro}),n.d(e,"AddEquation",function(){return Po}),n.d(e,"SubtractEquation",function(){return No}),n.d(e,"ReverseSubtractEquation",function(){return Io}),n.d(e,"MinEquation",function(){return Oo}),n.d(e,"MaxEquation",function(){return Uo}),n.d(e,"ZeroFactor",function(){return Do}),n.d(e,"OneFactor",function(){return Fo}),n.d(e,"SrcColorFactor",function(){return Bo}),n.d(e,"OneMinusSrcColorFactor",function(){return zo}),n.d(e,"SrcAlphaFactor",function(){return ko}),n.d(e,"OneMinusSrcAlphaFactor",function(){return Go}),n.d(e,"DstAlphaFactor",function(){return Ho}),n.d(e,"OneMinusDstAlphaFactor",function(){return Vo}),n.d(e,"DstColorFactor",function(){return jo}),n.d(e,"OneMinusDstColorFactor",function(){return Wo}),n.d(e,"SrcAlphaSaturateFactor",function(){return Xo}),n.d(e,"NeverDepth",function(){return qo}),n.d(e,"AlwaysDepth",function(){return Yo}),n.d(e,"LessDepth",function(){return Zo}),n.d(e,"LessEqualDepth",function(){return Jo}),n.d(e,"EqualDepth",function(){return Ko}),n.d(e,"GreaterEqualDepth",function(){return Qo}),n.d(e,"GreaterDepth",function(){return $o}),n.d(e,"NotEqualDepth",function(){return ta}),n.d(e,"MultiplyOperation",function(){return ea}),n.d(e,"MixOperation",function(){return na}),n.d(e,"AddOperation",function(){return ra}),n.d(e,"NoToneMapping",function(){return ia}),n.d(e,"LinearToneMapping",function(){return oa}),n.d(e,"ReinhardToneMapping",function(){return aa}),n.d(e,"Uncharted2ToneMapping",function(){return sa}),n.d(e,"CineonToneMapping",function(){return ua}),n.d(e,"UVMapping",function(){return ca}),n.d(e,"CubeReflectionMapping",function(){return la}),n.d(e,"CubeRefractionMapping",function(){return ha}),n.d(e,"EquirectangularReflectionMapping",function(){return fa}),n.d(e,"EquirectangularRefractionMapping",function(){return da}),n.d(e,"SphericalReflectionMapping",function(){return pa}),n.d(e,"CubeUVReflectionMapping",function(){return ma}),n.d(e,"CubeUVRefractionMapping",function(){return ga}),n.d(e,"RepeatWrapping",function(){return va}),n.d(e,"ClampToEdgeWrapping",function(){return ya}),n.d(e,"MirroredRepeatWrapping",function(){return _a}),n.d(e,"NearestFilter",function(){return xa}),n.d(e,"NearestMipMapNearestFilter",function(){return ba}),n.d(e,"NearestMipMapLinearFilter",function(){return wa}),n.d(e,"LinearFilter",function(){return Ma}),n.d(e,"LinearMipMapNearestFilter",function(){return Ea}),n.d(e,"LinearMipMapLinearFilter",function(){return Ta}),n.d(e,"UnsignedByteType",function(){return Sa}),n.d(e,"ByteType",function(){return Aa}),n.d(e,"ShortType",function(){return Ca}),n.d(e,"UnsignedShortType",function(){return La}),n.d(e,"IntType",function(){return Ra}),n.d(e,"UnsignedIntType",function(){return Pa}),n.d(e,"FloatType",function(){return Na}),n.d(e,"HalfFloatType",function(){return Ia}),n.d(e,"UnsignedShort4444Type",function(){return Oa}),n.d(e,"UnsignedShort5551Type",function(){return Ua}),n.d(e,"UnsignedShort565Type",function(){return Da}),n.d(e,"UnsignedInt248Type",function(){return Fa}),n.d(e,"AlphaFormat",function(){return Ba}),n.d(e,"RGBFormat",function(){return za}),n.d(e,"RGBAFormat",function(){return ka}),n.d(e,"LuminanceFormat",function(){return Ga}),n.d(e,"LuminanceAlphaFormat",function(){return Ha}),n.d(e,"RGBEFormat",function(){return Va}),n.d(e,"DepthFormat",function(){return ja}),n.d(e,"DepthStencilFormat",function(){return Wa}),n.d(e,"RGB_S3TC_DXT1_Format",function(){return Xa}),n.d(e,"RGBA_S3TC_DXT1_Format",function(){return qa}),n.d(e,"RGBA_S3TC_DXT3_Format",function(){return Ya}),n.d(e,"RGBA_S3TC_DXT5_Format",function(){return Za}),n.d(e,"RGB_PVRTC_4BPPV1_Format",function(){return Ja}),n.d(e,"RGB_PVRTC_2BPPV1_Format",function(){return Ka}),n.d(e,"RGBA_PVRTC_4BPPV1_Format",function(){return Qa}),n.d(e,"RGBA_PVRTC_2BPPV1_Format",function(){return $a}),n.d(e,"RGB_ETC1_Format",function(){return ts}),n.d(e,"LoopOnce",function(){return es}),n.d(e,"LoopRepeat",function(){return ns}),n.d(e,"LoopPingPong",function(){return rs}),n.d(e,"InterpolateDiscrete",function(){return is}),n.d(e,"InterpolateLinear",function(){return os}),n.d(e,"InterpolateSmooth",function(){return as}),n.d(e,"ZeroCurvatureEnding",function(){return ss}),n.d(e,"ZeroSlopeEnding",function(){return us}),n.d(e,"WrapAroundEnding",function(){return cs}),n.d(e,"TrianglesDrawMode",function(){return ls}),n.d(e,"TriangleStripDrawMode",function(){return hs}),n.d(e,"TriangleFanDrawMode",function(){return fs}),n.d(e,"LinearEncoding",function(){return ds}),n.d(e,"sRGBEncoding",function(){return ps}),n.d(e,"GammaEncoding",function(){return ms}),n.d(e,"RGBEEncoding",function(){return gs}),n.d(e,"LogLuvEncoding",function(){return vs}),n.d(e,"RGBM7Encoding",function(){return ys}),n.d(e,"RGBM16Encoding",function(){return _s}),n.d(e,"RGBDEncoding",function(){return xs}),n.d(e,"BasicDepthPacking",function(){return bs}),n.d(e,"RGBADepthPacking",function(){return ws}),n.d(e,"CubeGeometry",function(){return Pt}),n.d(e,"Face4",function(){return Li}),n.d(e,"LineStrip",function(){return uu}),n.d(e,"LinePieces",function(){return cu}),n.d(e,"MeshFaceMaterial",function(){return Ri}),n.d(e,"MultiMaterial",function(){return Pi}),n.d(e,"PointCloud",function(){return Ni}),n.d(e,"Particle",function(){return Ii}),n.d(e,"ParticleSystem",function(){return Oi}),n.d(e,"PointCloudMaterial",function(){return Ui}),n.d(e,"ParticleBasicMaterial",function(){return Di}),n.d(e,"ParticleSystemMaterial",function(){return Fi}),n.d(e,"Vertex",function(){return Bi}),n.d(e,"DynamicBufferAttribute",function(){return zi}),n.d(e,"Int8Attribute",function(){return ki}),n.d(e,"Uint8Attribute",function(){return Gi}),n.d(e,"Uint8ClampedAttribute",function(){return Hi}),n.d(e,"Int16Attribute",function(){return Vi}),n.d(e,"Uint16Attribute",function(){return ji}),n.d(e,"Int32Attribute",function(){return Wi}),n.d(e,"Uint32Attribute",function(){return Xi}),n.d(e,"Float32Attribute",function(){return qi}),n.d(e,"Float64Attribute",function(){return Yi}),n.d(e,"ClosedSplineCurve3",function(){return Zi}),n.d(e,"SplineCurve3",function(){return Ji}),n.d(e,"Spline",function(){return Ki}),n.d(e,"BoundingBoxHelper",function(){return Qi}),n.d(e,"EdgesHelper",function(){return $i}),n.d(e,"WireframeHelper",function(){return to}),n.d(e,"XHRLoader",function(){return eo}),n.d(e,"BinaryTextureLoader",function(){return no}),n.d(e,"GeometryUtils",function(){return lu}),n.d(e,"ImageUtils",function(){return hu}),n.d(e,"Projector",function(){return ro}),n.d(e,"CanvasRenderer",function(){return io}),void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),void 0===Math.sign&&(Math.sign=function(t){return t<0?-1:t>0?1:+t}),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(t){if(void 0===t||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(void 0!==r&&null!==r)for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e}}(),Object.assign(r.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners,r=n[t];if(void 0!==r){var i=r.indexOf(e);-1!==i&&r.splice(i,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners,n=e[t.type];if(void 0!==n){t.target=this;var r=[],i=0,o=n.length;for(i=0;i<o;i++)r[i]=n[i];for(i=0;i<o;i++)r[i].call(this,t)}}}});var oo="85",ao={LEFT:0,MIDDLE:1,RIGHT:2},so=0,uo=1,co=2,lo=3,ho=0,fo=1,po=0,mo=1,go=2,vo=0,yo=1,_o=2,xo=1,bo=2,wo=0,Mo=1,Eo=2,To=0,So=1,Ao=2,Co=3,Lo=4,Ro=5,Po=100,No=101,Io=102,Oo=103,Uo=104,Do=200,Fo=201,Bo=202,zo=203,ko=204,Go=205,Ho=206,Vo=207,jo=208,Wo=209,Xo=210,qo=0,Yo=1,Zo=2,Jo=3,Ko=4,Qo=5,$o=6,ta=7,ea=0,na=1,ra=2,ia=0,oa=1,aa=2,sa=3,ua=4,ca=300,la=301,ha=302,fa=303,da=304,pa=305,ma=306,ga=307,va=1e3,ya=1001,_a=1002,xa=1003,ba=1004,wa=1005,Ma=1006,Ea=1007,Ta=1008,Sa=1009,Aa=1010,Ca=1011,La=1012,Ra=1013,Pa=1014,Na=1015,Ia=1016,Oa=1017,Ua=1018,Da=1019,Fa=1020,Ba=1021,za=1022,ka=1023,Ga=1024,Ha=1025,Va=ka,ja=1026,Wa=1027,Xa=2001,qa=2002,Ya=2003,Za=2004,Ja=2100,Ka=2101,Qa=2102,$a=2103,ts=2151,es=2200,ns=2201,rs=2202,is=2300,os=2301,as=2302,ss=2400,us=2401,cs=2402,ls=0,hs=1,fs=2,ds=3e3,ps=3001,ms=3007,gs=3002,vs=3003,ys=3004,_s=3005,xs=3006,bs=3200,ws=3201,Ms={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t,e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=new Array(36),r=0;return function(){for(var i=0;i<36;i++)8===i||13===i||18===i||23===i?n[i]="-":14===i?n[i]="4":(r<=2&&(r=33554432+16777216*Math.random()|0),t=15&r,r>>=4,n[i]=e[19===i?3&t|8:t]);return n.join("")}}(),clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Ms.DEG2RAD},radToDeg:function(t){return t*Ms.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},nearestPowerOfTwo:function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},nextPowerOfTwo:function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}};Object.defineProperties(i.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(i.prototype,{isVector2:!0,set:function(t,e){return this.x=t,this.y=e,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this},clampScalar:function(){var t=new i,e=new i;return function(n,r){return t.set(n,n),e.set(r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length())},angle:function(){var t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this},rotateAround:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,o=this.y-t.y;return this.x=i*n-o*r+t.x,this.y=i*r+o*n+t.y,this}});var Es=0;o.DEFAULT_IMAGE=void 0,o.DEFAULT_MAPPING=ca,Object.defineProperty(o.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(o.prototype,r.prototype,{constructor:o,isTexture:!0,clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},toJSON:function(t){if(void 0!==t.textures[this.uuid])return t.textures[this.uuid];var e={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],wrap:[this.wrapS,this.wrapT],minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY};if(void 0!==this.image){var n=this.image;void 0===n.uuid&&(n.uuid=Ms.generateUUID()),void 0===t.images[n.uuid]&&(t.images[n.uuid]={uuid:n.uuid,url:function(t){var e;return void 0!==t.toDataURL?e=t:(e=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),e.width=t.width,e.height=t.height,e.getContext("2d").drawImage(t,0,0,t.width,t.height)),e.width>2048||e.height>2048?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}(n)}),e.image=n.uuid}return t.textures[this.uuid]=e,e},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(this.mapping===ca){if(t.multiply(this.repeat),t.add(this.offset),t.x<0||t.x>1)switch(this.wrapS){case va:t.x=t.x-Math.floor(t.x);break;case ya:t.x=t.x<0?0:1;break;case _a:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case va:t.y=t.y-Math.floor(t.y);break;case ya:t.y=t.y<0?0:1;break;case _a:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}this.flipY&&(t.y=1-t.y)}}}),Object.assign(a.prototype,{isVector4:!0,set:function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=this.w,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*r+o[12]*i,this.y=o[1]*e+o[5]*n+o[9]*r+o[13]*i,this.z=o[2]*e+o[6]*n+o[10]*r+o[14]*i,this.w=o[3]*e+o[7]*n+o[11]*r+o[15]*i,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this},setAxisAngleFromRotationMatrix:function(t){var e,n,r,i,o=t.elements,a=o[0],s=o[4],u=o[8],c=o[1],l=o[5],h=o[9],f=o[2],d=o[6],p=o[10];if(Math.abs(s-c)<.01&&Math.abs(u-f)<.01&&Math.abs(h-d)<.01){if(Math.abs(s+c)<.1&&Math.abs(u+f)<.1&&Math.abs(h+d)<.1&&Math.abs(a+l+p-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;var m=(a+1)/2,g=(l+1)/2,v=(p+1)/2,y=(s+c)/4,_=(u+f)/4,x=(h+d)/4;return m>g&&m>v?m<.01?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(m),r=y/n,i=_/n):g>v?g<.01?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(g),n=y/r,i=x/r):v<.01?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(v),n=_/i,r=x/i),this.set(n,r,i,e),this}var b=Math.sqrt((d-h)*(d-h)+(u-f)*(u-f)+(c-s)*(c-s));return Math.abs(b)<.001&&(b=1),this.x=(d-h)/b,this.y=(u-f)/b,this.z=(c-s)/b,this.w=Math.acos((a+l+p-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this},clampScalar:function(){var t=new a,e=new a;return function(n,r){return t.set(n,n,n,n),e.set(r,r,r,r),this.clamp(t,e)}}(),floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},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(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}}),Object.assign(s.prototype,r.prototype,{isWebGLRenderTarget:!0,setSize:function(t,e){this.width===t&&this.height===e||(this.width=t,this.height=e,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),u.prototype=Object.create(s.prototype),u.prototype.constructor=u,u.prototype.isWebGLRenderTargetCube=!0,Object.assign(c,{slerp:function(t,e,n,r){return n.copy(t).slerp(e,r)},slerpFlat:function(t,e,n,r,i,o,a){var s=n[r+0],u=n[r+1],c=n[r+2],l=n[r+3],h=i[o+0],f=i[o+1],d=i[o+2],p=i[o+3];if(l!==p||s!==h||u!==f||c!==d){var m=1-a,g=s*h+u*f+c*d+l*p,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){var _=Math.sqrt(y),x=Math.atan2(_,g*v);m=Math.sin(m*x)/_,a=Math.sin(a*x)/_}var b=a*v;if(s=s*m+h*b,u=u*m+f*b,c=c*m+d*b,l=l*m+p*b,m===1-a){var w=1/Math.sqrt(s*s+u*u+c*c+l*l);s*=w,u*=w,c*=w,l*=w}}t[e]=s,t[e+1]=u,t[e+2]=c,t[e+3]=l}}),Object.defineProperties(c.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this.onChangeCallback()}}}),Object.assign(c.prototype,{set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this.onChangeCallback(),this},setFromEuler:function(t,e){if(!1===(t&&t.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,o=t.order,a=Math.cos,s=Math.sin,u=a(n/2),c=a(r/2),l=a(i/2),h=s(n/2),f=s(r/2),d=s(i/2);return"XYZ"===o?(this._x=h*c*l+u*f*d,this._y=u*f*l-h*c*d,this._z=u*c*d+h*f*l,this._w=u*c*l-h*f*d):"YXZ"===o?(this._x=h*c*l+u*f*d,this._y=u*f*l-h*c*d,this._z=u*c*d-h*f*l,this._w=u*c*l+h*f*d):"ZXY"===o?(this._x=h*c*l-u*f*d,this._y=u*f*l+h*c*d,this._z=u*c*d+h*f*l,this._w=u*c*l-h*f*d):"ZYX"===o?(this._x=h*c*l-u*f*d,this._y=u*f*l+h*c*d,this._z=u*c*d-h*f*l,this._w=u*c*l+h*f*d):"YZX"===o?(this._x=h*c*l+u*f*d,this._y=u*f*l+h*c*d,this._z=u*c*d-h*f*l,this._w=u*c*l-h*f*d):"XZY"===o&&(this._x=h*c*l-u*f*d,this._y=u*f*l-h*c*d,this._z=u*c*d+h*f*l,this._w=u*c*l+h*f*d),!1!==e&&this.onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this.onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],u=n[9],c=n[2],l=n[6],h=n[10],f=r+s+h;return f>0?(e=.5/Math.sqrt(f+1),this._w=.25/e,this._x=(l-u)*e,this._y=(o-c)*e,this._z=(a-i)*e):r>s&&r>h?(e=2*Math.sqrt(1+r-s-h),this._w=(l-u)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(o+c)/e):s>h?(e=2*Math.sqrt(1+s-r-h),this._w=(o-c)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(u+l)/e):(e=2*Math.sqrt(1+h-r-s),this._w=(a-i)/e,this._x=(o+c)/e,this._y=(u+l)/e,this._z=.25*e),this.onChangeCallback(),this},setFromUnitVectors:function(){var t,e=new l;return function(n,r){return void 0===e&&(e=new l),t=n.dot(r)+1,t<1e-6?(t=0,Math.abs(n.x)>Math.abs(n.z)?e.set(-n.y,n.x,0):e.set(0,-n.z,n.y)):e.crossVectors(n,r),this._x=e.x,this._y=e.y,this._z=e.z,this._w=t,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this.onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,u=e._z,c=e._w;return this._x=n*c+o*a+r*u-i*s,this._y=r*c+o*s+i*a-n*u,this._z=i*c+o*u+n*s-r*a,this._w=o*c-n*a-r*s-i*u,this.onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(n+this._x),this._y=.5*(r+this._y),this._z=.5*(i+this._z),this;var u=Math.atan2(s,a),c=Math.sin((1-e)*u)/s,l=Math.sin(e*u)/s;return this._w=o*c+this._w*l,this._x=n*c+this._x*l,this._y=r*c+this._y*l,this._z=i*c+this._z*l,this.onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this.onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},onChange:function(t){return this.onChangeCallback=t,this},onChangeCallback:function(){}}),Object.assign(l.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(){var t=new c;return function(e){return!1===(e&&e.isEuler)&&console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(t.setFromEuler(e))}}(),applyAxisAngle:function(){var t=new c;return function(e,n){return this.applyQuaternion(t.setFromAxisAngle(e,n))}}(),applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;this.x=i[0]*e+i[4]*n+i[8]*r+i[12],this.y=i[1]*e+i[5]*n+i[9]*r+i[13],this.z=i[2]*e+i[6]*n+i[10]*r+i[14];var o=i[3]*e+i[7]*n+i[11]*r+i[15];return this.divideScalar(o)},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,u=s*e+o*r-a*n,c=s*n+a*e-i*r,l=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=u*s+h*-i+c*-a-l*-o,this.y=c*s+h*-o+l*-i-u*-a,this.z=l*s+h*-a+u*-o-c*-i,this},project:function(){var t=new h;return function(e){return t.multiplyMatrices(e.projectionMatrix,t.getInverse(e.matrixWorld)),this.applyMatrix4(t)}}(),unproject:function(){var t=new h;return function(e){return t.multiplyMatrices(e.matrixWorld,t.getInverse(e.projectionMatrix)),this.applyMatrix4(t)}}(),transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(){var t=new l,e=new l;return function(n,r){return t.set(n,n,n),e.set(r,r,r),this.clamp(t,e)}}(),clampLength:function(t,e){var n=this.length();return this.multiplyScalar(Math.max(t,Math.min(e,n))/n)},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(t){return this.multiplyScalar(t/this.length())},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){if(void 0!==e)return console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e);var n=this.x,r=this.y,i=this.z;return this.x=r*t.z-i*t.y,this.y=i*t.x-n*t.z,this.z=n*t.y-r*t.x,this},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.dot(this)/t.lengthSq();return this.copy(t).multiplyScalar(e)},projectOnPlane:function(){var t=new l;return function(e){return t.copy(this).projectOnVector(e),this.sub(t)}}(),reflect:function(){var t=new l;return function(e){return this.sub(t.copy(e).multiplyScalar(2*this.dot(e)))}}(),angleTo:function(t){var e=this.dot(t)/Math.sqrt(this.lengthSq()*t.lengthSq());return Math.acos(Ms.clamp(e,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},distanceToManhattan:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){var e=Math.sin(t.phi)*t.radius;return this.x=e*Math.sin(t.theta),this.y=Math.cos(t.phi)*t.radius,this.z=e*Math.cos(t.theta),this},setFromCylindrical:function(t){return this.x=t.radius*Math.sin(t.theta),this.y=t.y,this.z=t.radius*Math.cos(t.theta),this},setFromMatrixPosition:function(t){return this.setFromMatrixColumn(t,3)},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}}),Object.assign(h.prototype,{isMatrix4:!0,set:function(t,e,n,r,i,o,a,s,u,c,l,h,f,d,p,m){var g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=r,g[1]=i,g[5]=o,g[9]=a,g[13]=s,g[2]=u,g[6]=c,g[10]=l,g[14]=h,g[3]=f,g[7]=d,g[11]=p,g[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new h).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this},copyPosition:function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},extractBasis:function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this},extractRotation:function(){var t=new l;return function(e){var n=this.elements,r=e.elements,i=1/t.setFromMatrixColumn(e,0).length(),o=1/t.setFromMatrixColumn(e,1).length(),a=1/t.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[4]=r[4]*o,n[5]=r[5]*o,n[6]=r[6]*o,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,this}}(),makeRotationFromEuler:function(t){!1===(t&&t.isEuler)&&console.error("THREE.Matrix: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,o=Math.cos(n),a=Math.sin(n),s=Math.cos(r),u=Math.sin(r),c=Math.cos(i),l=Math.sin(i);if("XYZ"===t.order){var h=o*c,f=o*l,d=a*c,p=a*l;e[0]=s*c,e[4]=-s*l,e[8]=u,e[1]=f+d*u,e[5]=h-p*u,e[9]=-a*s,e[2]=p-h*u,e[6]=d+f*u,e[10]=o*s}else if("YXZ"===t.order){var m=s*c,g=s*l,v=u*c,y=u*l;e[0]=m+y*a,e[4]=v*a-g,e[8]=o*u,e[1]=o*l,e[5]=o*c,e[9]=-a,e[2]=g*a-v,e[6]=y+m*a,e[10]=o*s}else if("ZXY"===t.order){var m=s*c,g=s*l,v=u*c,y=u*l;e[0]=m-y*a,e[4]=-o*l,e[8]=v+g*a,e[1]=g+v*a,e[5]=o*c,e[9]=y-m*a,e[2]=-o*u,e[6]=a,e[10]=o*s}else if("ZYX"===t.order){var h=o*c,f=o*l,d=a*c,p=a*l;e[0]=s*c,e[4]=d*u-f,e[8]=h*u+p,e[1]=s*l,e[5]=p*u+h,e[9]=f*u-d,e[2]=-u,e[6]=a*s,e[10]=o*s}else if("YZX"===t.order){var _=o*s,x=o*u,b=a*s,w=a*u;e[0]=s*c,e[4]=w-_*l,e[8]=b*l+x,e[1]=l,e[5]=o*c,e[9]=-a*c,e[2]=-u*c,e[6]=x*l+b,e[10]=_-w*l}else if("XZY"===t.order){var _=o*s,x=o*u,b=a*s,w=a*u;e[0]=s*c,e[4]=-l,e[8]=u*c,e[1]=_*l+w,e[5]=o*c,e[9]=x*l-b,e[2]=b*l-x,e[6]=a*c,e[10]=w*l+_}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},makeRotationFromQuaternion:function(t){var e=this.elements,n=t._x,r=t._y,i=t._z,o=t._w,a=n+n,s=r+r,u=i+i,c=n*a,l=n*s,h=n*u,f=r*s,d=r*u,p=i*u,m=o*a,g=o*s,v=o*u;return e[0]=1-(f+p),e[4]=l-v,e[8]=h+g,e[1]=l+v,e[5]=1-(c+p),e[9]=d-m,e[2]=h-g,e[6]=d+m,e[10]=1-(c+f),e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},lookAt:function(){var t=new l,e=new l,n=new l;return function(r,i,o){var a=this.elements;return n.subVectors(r,i),0===n.lengthSq()&&(n.z=1),n.normalize(),t.crossVectors(o,n),0===t.lengthSq()&&(n.z+=1e-4,t.crossVectors(o,n)),t.normalize(),e.crossVectors(n,t),a[0]=t.x,a[4]=e.x,a[8]=n.x,a[1]=t.y,a[5]=e.y,a[9]=n.y,a[2]=t.z,a[6]=e.z,a[10]=n.z,this}}(),multiply:function(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[4],s=n[8],u=n[12],c=n[1],l=n[5],h=n[9],f=n[13],d=n[2],p=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],x=n[15],b=r[0],w=r[4],M=r[8],E=r[12],T=r[1],S=r[5],A=r[9],C=r[13],L=r[2],R=r[6],P=r[10],N=r[14],I=r[3],O=r[7],U=r[11],D=r[15];return i[0]=o*b+a*T+s*L+u*I,i[4]=o*w+a*S+s*R+u*O,i[8]=o*M+a*A+s*P+u*U,i[12]=o*E+a*C+s*N+u*D,i[1]=c*b+l*T+h*L+f*I,i[5]=c*w+l*S+h*R+f*O,i[9]=c*M+l*A+h*P+f*U,i[13]=c*E+l*C+h*N+f*D,i[2]=d*b+p*T+m*L+g*I,i[6]=d*w+p*S+m*R+g*O,i[10]=d*M+p*A+m*P+g*U,i[14]=d*E+p*C+m*N+g*D,i[3]=v*b+y*T+_*L+x*I,i[7]=v*w+y*S+_*R+x*O,i[11]=v*M+y*A+_*P+x*U,i[15]=v*E+y*C+_*N+x*D,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},applyToBufferAttribute:function(){var t=new l;return function(e){for(var n=0,r=e.count;n<r;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix4(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),determinant:function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],o=t[1],a=t[5],s=t[9],u=t[13],c=t[2],l=t[6],h=t[10],f=t[14];return t[3]*(+i*s*l-r*u*l-i*a*h+n*u*h+r*a*f-n*s*f)+t[7]*(+e*s*f-e*u*h+i*o*h-r*o*f+r*u*c-i*s*c)+t[11]*(+e*u*l-e*a*f-i*o*l+n*o*f+i*a*c-n*u*c)+t[15]*(-r*a*c-e*s*l+e*a*h+r*o*l-n*o*h+n*s*c)},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(t){var e=this.elements;return e[12]=t.x,e[13]=t.y,e[14]=t.z,this},getInverse:function(t,e){var n=this.elements,r=t.elements,i=r[0],o=r[1],a=r[2],s=r[3],u=r[4],c=r[5],l=r[6],h=r[7],f=r[8],d=r[9],p=r[10],m=r[11],g=r[12],v=r[13],y=r[14],_=r[15],x=d*y*h-v*p*h+v*l*m-c*y*m-d*l*_+c*p*_,b=g*p*h-f*y*h-g*l*m+u*y*m+f*l*_-u*p*_,w=f*v*h-g*d*h+g*c*m-u*v*m-f*c*_+u*d*_,M=g*d*l-f*v*l-g*c*p+u*v*p+f*c*y-u*d*y,E=i*x+o*b+a*w+s*M;if(0===E){var T="THREE.Matrix4.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(T);return console.warn(T),this.identity()}var S=1/E;return n[0]=x*S,n[1]=(v*p*s-d*y*s-v*a*m+o*y*m+d*a*_-o*p*_)*S,n[2]=(c*y*s-v*l*s+v*a*h-o*y*h-c*a*_+o*l*_)*S,n[3]=(d*l*s-c*p*s-d*a*h+o*p*h+c*a*m-o*l*m)*S,n[4]=b*S,n[5]=(f*y*s-g*p*s+g*a*m-i*y*m-f*a*_+i*p*_)*S,n[6]=(g*l*s-u*y*s-g*a*h+i*y*h+u*a*_-i*l*_)*S,n[7]=(u*p*s-f*l*s+f*a*h-i*p*h-u*a*m+i*l*m)*S,n[8]=w*S,n[9]=(g*d*s-f*v*s-g*o*m+i*v*m+f*o*_-i*d*_)*S,n[10]=(u*v*s-g*c*s+g*o*h-i*v*h-u*o*_+i*c*_)*S,n[11]=(f*c*s-u*d*s-f*o*h+i*d*h+u*o*m-i*c*m)*S,n[12]=M*S,n[13]=(f*v*a-g*d*a+g*o*p-i*v*p-f*o*y+i*d*y)*S,n[14]=(g*c*a-u*v*a-g*o*l+i*v*l+u*o*y-i*c*y)*S,n[15]=(u*d*a-f*c*a+f*o*l-i*d*l-u*o*p+i*c*p)*S,this},scale:function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},getMaxScaleOnAxis:function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},makeTranslation:function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},makeRotationX:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this},makeRotationY:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this},makeRotationZ:function(t){var e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,o=t.x,a=t.y,s=t.z,u=i*o,c=i*a;return this.set(u*o+n,u*a-r*s,u*s+r*a,0,u*a+r*s,c*a+n,c*s-r*o,0,u*s-r*a,c*s+r*o,i*s*s+n,0,0,0,0,1),this},makeScale:function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},compose:function(t,e,n){return this.makeRotationFromQuaternion(e),this.scale(n),this.setPosition(t),this},decompose:function(){var t=new l,e=new h;return function(n,r,i){var o=this.elements,a=t.set(o[0],o[1],o[2]).length(),s=t.set(o[4],o[5],o[6]).length(),u=t.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),n.x=o[12],n.y=o[13],n.z=o[14],e.copy(this);var c=1/a,l=1/s,h=1/u;return e.elements[0]*=c,e.elements[1]*=c,e.elements[2]*=c,e.elements[4]*=l,e.elements[5]*=l,e.elements[6]*=l,e.elements[8]*=h,e.elements[9]*=h,e.elements[10]*=h,r.setFromRotationMatrix(e),i.x=a,i.y=s,i.z=u,this}}(),makePerspective:function(t,e,n,r,i,o){void 0===o&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var a=this.elements,s=2*i/(e-t),u=2*i/(n-r),c=(e+t)/(e-t),l=(n+r)/(n-r),h=-(o+i)/(o-i),f=-2*o*i/(o-i);return a[0]=s,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=u,a[9]=l,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this},makeOrthographic:function(t,e,n,r,i,o){var a=this.elements,s=1/(e-t),u=1/(n-r),c=1/(o-i),l=(e+t)*s,h=(n+r)*u,f=(o+i)*c;return a[0]=2*s,a[4]=0,a[8]=0,a[12]=-l,a[1]=0,a[5]=2*u,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}),f.prototype=Object.create(o.prototype),f.prototype.constructor=f,f.prototype.isDataTexture=!0,d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.prototype.isCubeTexture=!0,Object.defineProperty(d.prototype,"images",{get:function(){return this.image},set:function(t){this.image=t}});var Ts=new o,Ss=new d,As=[],Cs=[],Ls=new Float32Array(16),Rs=new Float32Array(9);j.prototype.setValue=function(t,e){for(var n=this.seq,r=0,i=n.length;r!==i;++r){var o=n[r];o.setValue(t,e[o.id])}};var Ps=/([\w\d_]+)(\])?(\[|\.)?/g;q.prototype.setValue=function(t,e,n){var r=this.map[e];void 0!==r&&r.setValue(t,n,this.renderer)},q.prototype.setOptional=function(t,e,n){var r=e[n];void 0!==r&&this.setValue(t,n,r)},q.upload=function(t,e,n,r){for(var i=0,o=e.length;i!==o;++i){var a=e[i],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,r)}},q.seqWithValue=function(t,e){for(var n=[],r=0,i=t.length;r!==i;++r){var o=t[r];o.id in e&&n.push(o)}return n};var Ns={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Object.assign(Y.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(){function t(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}return function(e,n,r){if(e=Ms.euclideanModulo(e,1),n=Ms.clamp(n,0,1),r=Ms.clamp(r,0,1),0===n)this.r=this.g=this.b=r;else{var i=r<=.5?r*(1+n):r+n-r*n,o=2*r-i;this.r=t(o,i,e+1/3),this.g=t(o,i,e),this.b=t(o,i,e-1/3)}return this}}(),setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,u)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c=n[1],l=c.length;if(3===l)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}if(t&&t.length>0){var c=Ns[t];void 0!==c?this.setHex(c):console.warn("THREE.Color: Unknown color "+t)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},copyLinearToGamma:function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(){var t=this.r,e=this.g,n=this.b;return this.r=t*t,this.g=e*e,this.b=n*n,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){var e,n,r=t||{h:0,s:0,l:0},i=this.r,o=this.g,a=this.b,s=Math.max(i,o,a),u=Math.min(i,o,a),c=(u+s)/2;if(u===s)e=0,n=0;else{var l=s-u;switch(n=c<=.5?l/(s+u):l/(2-s-u),s){case i:e=(o-a)/l+(o<a?6:0);break;case o:e=(a-i)/l+2;break;case a:e=(i-o)/l+4}e/=6}return r.h=e,r.s=n,r.l=c,r},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,e,n){var r=this.getHSL();return r.h+=t,r.s+=e,r.l+=n,this.setHSL(r.h,r.s,r.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,e){return void 0===e&&(e=0),this.r=t[e],this.g=t[e+1],this.b=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t},toJSON:function(){return this.getHex()}});var Is={common:{diffuse:{value:new Y(15658734)},opacity:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)},specularMap:{value:null},alphaMap:{value:null},envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new i(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Y(16777215)}},lights:{ambientLightColor:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Y(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},offsetRepeat:{value:new a(0,0,1,1)}}},Os={merge:function(t){for(var e={},n=0;n<t.length;n++){var r=this.clone(t[n]);for(var i in r)e[i]=r[i]}return e},clone:function(t){var e={};for(var n in t){e[n]={};for(var r in t[n]){var i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}},Us={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif\n",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif\n",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif\n",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif\n",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n",bsdfs:"float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tif( decayExponent > 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat 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}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos );\n\t\tvec3 vSigmaY = dFdy( surf_pos );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transpose( const in mat3 v ) {\n\tmat3 tmp;\n\ttmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n\ttmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n\ttmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n\treturn tmp;\n}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"#ifdef FLIP_SIDED\n\tobjectNormal = -objectNormal;\n#endif\nvec3 transformedNormal = normalMatrix * objectNormal;\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = value.rgb * cLogLuvM;\n\tXp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract(Le);\n\tvResult.z = (Le - (floor(vResult.w*255.0))/255.0)/255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2((Le - 127.0) / 2.0);\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\tsampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );\n\t\tsampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\tvec3 reflectView = flipNormal * normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif\n",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltcMat;\tuniform sampler2D ltcMag;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_BlinnPhong( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = BlinnExponentToGGXRoughness( material.specularShininess );\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearCoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos - halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos + halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos + halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos - halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\tgl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform vec4 offsetRepeat;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_flip:"#ifdef DOUBLE_SIDED\n\tfloat flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n#else\n\tfloat flipNormal = 1.0;\n#endif\n",normal_fragment:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal ) * flipNormal;\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 1.0 - 2.0 * rgb.xyz;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"#ifdef USE_SKINNING\n\tvec4 mvPosition = modelViewMatrix * skinned;\n#else\n\tvec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\n#endif\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( DITHERING )\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\treturn (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn 1.0;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tfloat dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\n",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif\n",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\tskinned = bindMatrixInverse * skinned;\n#endif\n",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n#endif\n",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#define saturate(a) clamp( a, 0.0, 1.0 )\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform vec4 offsetRepeat;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( PHYSICAL ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n\t#ifdef USE_SKINNING\n\t\tvec4 worldPosition = modelMatrix * skinned;\n\t#else\n\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t#endif\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n}\n",distanceRGBA_frag:"uniform vec3 lightPos;\nvarying vec4 vWorldPosition;\n#include <common>\n#include <packing>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tgl_FragColor = packDepthToRGBA( length( vWorldPosition.xyz - lightPos.xyz ) / 1000.0 );\n}\n",distanceRGBA_vert:"varying vec4 vWorldPosition;\n#include <common>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <skinbase_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition;\n}\n",equirect_frag:"uniform sampler2D tEquirect;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = saturate( tFlip * direction.y * -0.5 + 0.5 );\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include <common>\nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}\n",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}\n",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <normal_flip>\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <lights_pars>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_template>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshphysical_vert:"#define PHYSICAL\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\t#include <normal_flip>\n\t#include <normal_fragment>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <displacementmap_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <premultiplied_alpha_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}\n",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",shadow_frag:"uniform float opacity;\n#include <common>\n#include <packing>\n#include <bsdfs>\n#include <lights_pars>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( 0.0, 0.0, 0.0, opacity * ( 1.0 - getShadowMask() ) );\n}\n",shadow_vert:"#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n}\n"},Ds={basic:{uniforms:Os.merge([Is.common,Is.aomap,Is.lightmap,Is.fog]),vertexShader:Us.meshbasic_vert,fragmentShader:Us.meshbasic_frag},lambert:{uniforms:Os.merge([Is.common,Is.aomap,Is.lightmap,Is.emissivemap,Is.fog,Is.lights,{emissive:{value:new Y(0)}}]),vertexShader:Us.meshlambert_vert,fragmentShader:Us.meshlambert_frag},phong:{uniforms:Os.merge([Is.common,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.gradientmap,Is.fog,Is.lights,{emissive:{value:new Y(0)},specular:{value:new Y(1118481)},shininess:{value:30}}]),vertexShader:Us.meshphong_vert,fragmentShader:Us.meshphong_frag},standard:{uniforms:Os.merge([Is.common,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.roughnessmap,Is.metalnessmap,Is.fog,Is.lights,{emissive:{value:new Y(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Us.meshphysical_vert,fragmentShader:Us.meshphysical_frag},points:{uniforms:Os.merge([Is.points,Is.fog]),vertexShader:Us.points_vert,fragmentShader:Us.points_frag},dashed:{uniforms:Os.merge([Is.common,Is.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Us.linedashed_vert,fragmentShader:Us.linedashed_frag},depth:{uniforms:Os.merge([Is.common,Is.displacementmap]),vertexShader:Us.depth_vert,fragmentShader:Us.depth_frag},normal:{uniforms:Os.merge([Is.common,Is.bumpmap,Is.normalmap,Is.displacementmap,{opacity:{value:1}}]),vertexShader:Us.normal_vert,fragmentShader:Us.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Us.cube_vert,fragmentShader:Us.cube_frag},equirect:{uniforms:{tEquirect:{value:null},tFlip:{value:-1}},vertexShader:Us.equirect_vert,fragmentShader:Us.equirect_frag},distanceRGBA:{uniforms:{lightPos:{value:new l}},vertexShader:Us.distanceRGBA_vert,fragmentShader:Us.distanceRGBA_frag}};Ds.physical={uniforms:Os.merge([Ds.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Us.meshphysical_vert,fragmentShader:Us.meshphysical_frag},Object.assign(Z.prototype,{set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new i;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new i;return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return(e||new i).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)},clampPoint:function(t,e){return(e||new i).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new i;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var Fs=0;Object.assign(Q.prototype,r.prototype,{isMaterial:!0,setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]="overdraw"===e?Number(n):n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){function e(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}var n=void 0===t;n&&(t={textures:{},images:{}});var r={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearCoat&&(r.clearCoat=this.clearCoat),void 0!==this.clearCoatRoughness&&(r.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(t).uuid),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(t).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(t).uuid,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(t).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(t).uuid,r.reflectivity=this.reflectivity),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(r.size=this.size),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==So&&(r.blending=this.blending),this.shading!==bo&&(r.shading=this.shading),this.side!==vo&&(r.side=this.side),this.vertexColors!==wo&&(r.vertexColors=this.vertexColors),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(r.wireframe=this.wireframe),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),r.skinning=this.skinning,r.morphTargets=this.morphTargets,r.dithering=this.dithering,n){var i=e(t.textures),o=e(t.images);i.length>0&&(r.textures=i),o.length>0&&(r.images=o)}return r},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.lights=t.lights,this.blending=t.blending,this.side=t.side,this.shading=t.shading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.overdraw=t.overdraw,this.visible=t.visible,this.clipShadows=t.clipShadows,this.clipIntersection=t.clipIntersection;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),$.prototype=Object.create(Q.prototype),$.prototype.constructor=$,$.prototype.isShaderMaterial=!0,$.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Os.clone(t.uniforms),this.defines=t.defines,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},$.prototype.toJSON=function(t){var e=Q.prototype.toJSON.call(this,t);return e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e},tt.prototype=Object.create(Q.prototype),tt.prototype.constructor=tt,tt.prototype.isMeshDepthMaterial=!0,tt.prototype.copy=function(t){return Q.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},Object.assign(et.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],l=t[s+1],h=t[s+2];c<e&&(e=c),l<n&&(n=l),h<r&&(r=h),c>i&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromBufferAttribute:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,u=t.count;s<u;s++){var c=t.getX(s),l=t.getY(s),h=t.getZ(s);c<e&&(e=c),l<n&&(n=l),h<r&&(r=h),c>i&&(i=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,n,r),this.max.set(i,o,a),this},setFromPoints:function(t){this.makeEmpty();for(var e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this},setFromCenterAndSize:function(){var t=new l;return function(e,n){var r=t.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}}(),setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){var e=t||new l;return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){var e=t||new l;return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(){var t=new l;return function(e){var n=this;return e.updateMatrixWorld(!0),e.traverse(function(e){var r,i,o=e.geometry;if(void 0!==o)if(o.isGeometry){var a=o.vertices;for(r=0,i=a.length;r<i;r++)t.copy(a[r]),t.applyMatrix4(e.matrixWorld),n.expandByPoint(t)}else if(o.isBufferGeometry){var s=o.attributes.position;if(void 0!==s)for(r=0,i=s.count;r<i;r++)t.fromBufferAttribute(s,r).applyMatrix4(e.matrixWorld),n.expandByPoint(t)}}),this}}(),containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return(e||new l).set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(){var t=new l;return function(e){return this.clampPoint(e.center,t),t.distanceToSquared(e.center)<=e.radius*e.radius}}(),intersectsPlane:function(t){var e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=t.constant&&n>=t.constant},clampPoint:function(t,e){return(e||new l).copy(t).clamp(this.min,this.max)},distanceToPoint:function(){var t=new l;return function(e){return t.copy(e).clamp(this.min,this.max).sub(e).length()}}(),getBoundingSphere:function(){var t=new l;return function(e){var n=e||new nt;return this.getCenter(n.center),n.radius=.5*this.getSize(t).length(),n}}(),intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(){var t=[new l,new l,new l,new l,new l,new l,new l,new l];return function(e){return this.isEmpty()?this:(t[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),t[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),t[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),t[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),t[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),t[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),t[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),t[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(t),this)}}(),translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.assign(nt.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(){var t=new et;return function(e,n){var r=this.center;void 0!==n?r.copy(n):t.setFromPoints(e).getCenter(r);for(var i=0,o=0,a=e.length;o<a;o++)i=Math.max(i,r.distanceToSquared(e[o]));return this.radius=Math.sqrt(i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(this.center.dot(t.normal)-t.constant)<=this.radius},clampPoint:function(t,e){var n=this.center.distanceToSquared(t),r=e||new l;return r.copy(t),n>this.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(t){var e=t||new et;return e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(rt.prototype,{isMatrix3:!0,set:function(t,e,n,r,i,o,a,s,u){var c=this.elements;return c[0]=t,c[1]=r,c[2]=a,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=o,c[8]=u,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this},setFromMatrix4:function(t){var e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this},applyToBufferAttribute:function(){var t=new l;return function(e){for(var n=0,r=e.count;n<r;n++)t.x=e.getX(n),t.y=e.getY(n),t.z=e.getZ(n),t.applyMatrix3(this),e.setXYZ(n,t.x,t.y,t.z);return e}}(),multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,e){var n=t.elements,r=e.elements,i=this.elements,o=n[0],a=n[3],s=n[6],u=n[1],c=n[4],l=n[7],h=n[2],f=n[5],d=n[8],p=r[0],m=r[3],g=r[6],v=r[1],y=r[4],_=r[7],x=r[2],b=r[5],w=r[8];return i[0]=o*p+a*v+s*x,i[3]=o*m+a*y+s*b,i[6]=o*g+a*_+s*w,i[1]=u*p+c*v+l*x,i[4]=u*m+c*y+l*b,i[7]=u*g+c*_+l*w,i[2]=h*p+f*v+d*x,i[5]=h*m+f*y+d*b,i[8]=h*g+f*_+d*w,this},multiplyScalar:function(t){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this},determinant:function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8];return e*o*c-e*a*u-n*i*c+n*a*s+r*i*u-r*o*s},getInverse:function(t,e){t&&t.isMatrix4&&console.error("THREE.Matrix3.getInverse no longer takes a Matrix4 argument.");var n=t.elements,r=this.elements,i=n[0],o=n[1],a=n[2],s=n[3],u=n[4],c=n[5],l=n[6],h=n[7],f=n[8],d=f*u-c*h,p=c*l-f*s,m=h*s-u*l,g=i*d+o*p+a*m;if(0===g){var v="THREE.Matrix3.getInverse(): can't invert matrix, determinant is 0";if(!0===e)throw new Error(v);return console.warn(v),this.identity()}var y=1/g;return r[0]=d*y,r[1]=(a*h-f*o)*y,r[2]=(c*o-a*u)*y,r[3]=p*y,r[4]=(f*i-a*l)*y,r[5]=(a*s-c*i)*y,r[6]=m*y,r[7]=(o*l-h*i)*y,r[8]=(u*i-o*s)*y,this},transpose:function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this},equals:function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},fromArray:function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},toArray:function(t,e){void 0===t&&(t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment