// threejs.org/license (function(r,wb){"object"===typeof exports&&"undefined"!==typeof module?wb(exports):"function"===typeof define&&define.amd?define(["exports"],wb):(r="undefined"!==typeof globalThis?globalThis:r||self,wb(r.THREE={}))})(this,function(r){function wb(){}function Oa(c,a,b,d,e,f,g,h,k,l){Object.defineProperty(this,"id",{value:hk++});this.uuid=xa.generateUUID();this.name="";this.image=void 0!==c?c:Oa.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==a?a:Oa.DEFAULT_MAPPING;this.wrapS=void 0!==b?b:1001;this.wrapT= void 0!==d?d:1001;this.magFilter=void 0!==e?e:1006;this.minFilter=void 0!==f?f:1008;this.anisotropy=void 0!==k?k:1;this.format=void 0!==g?g:1023;this.internalFormat=null;this.type=void 0!==h?h:1009;this.offset=new L(0,0);this.repeat=new L(1,1);this.center=new L(0,0);this.rotation=0;this.matrixAutoUpdate=!0;this.matrix=new Da;this.generateMipmaps=!0;this.premultiplyAlpha=!1;this.flipY=!0;this.unpackAlignment=4;this.encoding=void 0!==l?l:3E3;this.version=0;this.onUpdate=null}function Db(c,a,b){this.width= c;this.height=a;this.scissor=new ca(0,0,c,a);this.scissorTest=!1;this.viewport=new ca(0,0,c,a);b=b||{};this.texture=new Oa(void 0,b.mapping,b.wrapS,b.wrapT,b.magFilter,b.minFilter,b.format,b.type,b.anisotropy,b.encoding);this.texture.image={};this.texture.image.width=c;this.texture.image.height=a;this.texture.generateMipmaps=void 0!==b.generateMipmaps?b.generateMipmaps:!1;this.texture.minFilter=void 0!==b.minFilter?b.minFilter:1006;this.depthBuffer=void 0!==b.depthBuffer?b.depthBuffer:!0;this.stencilBuffer= void 0!==b.stencilBuffer?b.stencilBuffer:!1;this.depthTexture=void 0!==b.depthTexture?b.depthTexture:null}function dh(c,a,b){Db.call(this,c,a,b);this.samples=4}function eh(c,a,b,d,e){for(var f=0,g=c.length-3;f<=g;f+=3){Yc.fromArray(c,f);var h=e.x*Math.abs(Yc.x)+e.y*Math.abs(Yc.y)+e.z*Math.abs(Yc.z),k=a.dot(Yc),l=b.dot(Yc),m=d.dot(Yc);if(Math.max(-Math.max(k,l,m),Math.min(k,l,m))>h)return!1}return!0}function ha(){Object.defineProperty(this,"id",{value:ik++});this.uuid=xa.generateUUID();this.name=""; this.type="Object3D";this.parent=null;this.children=[];this.up=ha.DefaultUp.clone();var c=new w,a=new hb,b=new ua,d=new w(1,1,1);a._onChange(function(){b.setFromEuler(a,!1)});b._onChange(function(){a.setFromQuaternion(b,void 0,!1)});Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:c},rotation:{configurable:!0,enumerable:!0,value:a},quaternion:{configurable:!0,enumerable:!0,value:b},scale:{configurable:!0,enumerable:!0,value:d},modelViewMatrix:{value:new da},normalMatrix:{value:new Da}}); this.matrix=new da;this.matrixWorld=new da;this.matrixAutoUpdate=ha.DefaultMatrixAutoUpdate;this.matrixWorldNeedsUpdate=!1;this.layers=new $b;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this.renderOrder=0;this.userData={}}function fh(c,a,b){0>b&&(b+=1);1b?a:b<2/3?c+6*(a-c)*(2/3-b):c}function gh(c){return.04045>c?.0773993808*c:Math.pow(.9478672986*c+.0521327014,2.4)}function hh(c){return.0031308>c?12.92*c:1.055*Math.pow(c,.41666)- .055}function ra(){Object.defineProperty(this,"id",{value:jk++});this.uuid=xa.generateUUID();this.name="";this.type="Material";this.fog=!0;this.blending=1;this.side=0;this.vertexColors=this.flatShading=!1;this.opacity=1;this.transparent=!1;this.blendSrc=204;this.blendDst=205;this.blendEquation=100;this.blendEquationAlpha=this.blendDstAlpha=this.blendSrcAlpha=null;this.depthFunc=3;this.depthWrite=this.depthTest=!0;this.stencilWriteMask=255;this.stencilFunc=519;this.stencilRef=0;this.stencilFuncMask= 255;this.stencilZPass=this.stencilZFail=this.stencilFail=7680;this.stencilWrite=!1;this.clippingPlanes=null;this.clipShadows=this.clipIntersection=!1;this.shadowSide=null;this.colorWrite=!0;this.precision=null;this.polygonOffset=!1;this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.dithering=!1;this.alphaTest=0;this.premultipliedAlpha=!1;this.toneMapped=this.visible=!0;this.userData={};this.version=0}function Kb(c){ra.call(this);this.type="MeshBasicMaterial";this.color=new S(16777215);this.lightMap= this.map=null;this.lightMapIntensity=1;this.aoMap=null;this.aoMapIntensity=1;this.envMap=this.alphaMap=this.specularMap=null;this.combine=0;this.reflectivity=1;this.refractionRatio=.98;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.morphTargets=this.skinning=!1;this.setValues(c)}function pa(c,a,b){if(Array.isArray(c))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="";this.array=c;this.itemSize=a;this.count= void 0!==c?c.length/a:0;this.normalized=!0===b;this.usage=35044;this.updateRange={offset:0,count:-1};this.version=0}function Ce(c,a,b){pa.call(this,new Int8Array(c),a,b)}function De(c,a,b){pa.call(this,new Uint8Array(c),a,b)}function Ee(c,a,b){pa.call(this,new Uint8ClampedArray(c),a,b)}function Fe(c,a,b){pa.call(this,new Int16Array(c),a,b)}function Zc(c,a,b){pa.call(this,new Uint16Array(c),a,b)}function Ge(c,a,b){pa.call(this,new Int32Array(c),a,b)}function $c(c,a,b){pa.call(this,new Uint32Array(c), a,b)}function ea(c,a,b){pa.call(this,new Float32Array(c),a,b)}function He(c,a,b){pa.call(this,new Float64Array(c),a,b)}function vi(c){if(0===c.length)return-Infinity;for(var a=c[0],b=1,d=c.length;ba&&(a=c[b]);return a}function ka(){Object.defineProperty(this,"id",{value:kk+=2});this.uuid=xa.generateUUID();this.name="";this.type="BufferGeometry";this.index=null;this.attributes={};this.morphAttributes={};this.morphTargetsRelative=!1;this.groups=[];this.boundingSphere=this.boundingBox=null; this.drawRange={start:0,count:Infinity};this.userData={}}function Qa(c,a){ha.call(this);this.type="Mesh";this.geometry=void 0!==c?c:new ka;this.material=void 0!==a?a:new Kb;this.updateMorphTargets()}function wi(c,a,b,d,e,f,g,h){if(null===(1===a.side?d.intersectTriangle(g,f,e,!0,h):d.intersectTriangle(e,f,g,2!==a.side,h)))return null;Of.copy(h);Of.applyMatrix4(c.matrixWorld);a=b.ray.origin.distanceTo(Of);return ab.far?null:{distance:a,point:Of.clone(),object:c}}function Pf(c,a,b,d,e,f,g, h,k,l,m,n){yc.fromBufferAttribute(e,l);zc.fromBufferAttribute(e,m);Ac.fromBufferAttribute(e,n);e=c.morphTargetInfluences;if(a.morphTargets&&f&&e){Qf.set(0,0,0);Rf.set(0,0,0);Sf.set(0,0,0);for(var p=0,t=f.length;pq;q++)l.setRenderTarget(b,q),l.clear(m,n,p);l.setRenderTarget(t)}}}function Cc(c,a,b){Number.isInteger(a)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),a=b);Db.call(this,c,c,a);this.texture.isWebGLCubeRenderTargetTexture=!0}function bd(c,a,b,d,e,f,g,h,k,l,m,n){Oa.call(this,null,f,g,h,k,l,d,e,m,n);this.image={data:c|| null,width:a||1,height:b||1};this.magFilter=void 0!==k?k:1003;this.minFilter=void 0!==l?l:1003;this.flipY=this.generateMipmaps=!1;this.unpackAlignment=1;this.needsUpdate=!0}function xi(){function c(f,g){d(f,g);e=a.requestAnimationFrame(c)}var a=null,b=!1,d=null,e=null;return{start:function(){!0!==b&&null!==d&&(e=a.requestAnimationFrame(c),b=!0)},stop:function(){a.cancelAnimationFrame(e);b=!1},setAnimationLoop:function(f){d=f},setContext:function(f){a=f}}}function mk(c,a){function b(f,g){var h=f.array, k=f.usage,l=c.createBuffer();c.bindBuffer(g,l);c.bufferData(g,h,k);f.onUploadCallback();g=5126;h instanceof Float32Array?g=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?g=5123:h instanceof Int16Array?g=5122:h instanceof Uint32Array?g=5125:h instanceof Int32Array?g=5124:h instanceof Int8Array?g=5120:h instanceof Uint8Array&&(g=5121);return{buffer:l,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:f.version}} var d=a.isWebGL2,e=new WeakMap;return{get:function(f){f.isInterleavedBufferAttribute&&(f=f.data);return e.get(f)},remove:function(f){f.isInterleavedBufferAttribute&&(f=f.data);var g=e.get(f);g&&(c.deleteBuffer(g.buffer),e.delete(f))},update:function(f,g){if(f.isGLBufferAttribute)g=e.get(f),(!g||g.versione;e++)d[e]=[e,0];return{update:function(f,g,h,k){var l=f.morphTargetInfluences;f=void 0===l?0:l.length;var m=a[g.id];if(void 0===m){m=[];for(var n=0;nl;l++)ll;l++)p=d[l],n=p[0],p=p[1],n!==Number.MAX_SAFE_INTEGER&&p?(f&&g.getAttribute("morphTarget"+l)!==f[n]&&g.setAttribute("morphTarget"+l,f[n]),h&&g.getAttribute("morphNormal"+l)!==h[n]&&g.setAttribute("morphNormal"+l,h[n]),b[l]=p,m+=p):(f&&void 0!==g.getAttribute("morphTarget"+l)&&g.deleteAttribute("morphTarget"+l),h&&void 0!==g.getAttribute("morphNormal"+l)&&g.deleteAttribute("morphNormal"+l),b[l]=0);g=g.morphTargetsRelative?1:1-m;k.getUniforms().setValue(c,"morphTargetBaseInfluence",g); k.getUniforms().setValue(c,"morphTargetInfluences",b)}}}function Ak(c,a,b,d){var e=new WeakMap;return{update:function(f){var g=d.render.frame,h=f.geometry,k=a.get(f,h);e.get(k)!==g&&(h.isGeometry&&k.updateFromObject(f),a.update(k),e.set(k,g));f.isInstancedMesh&&(b.update(f.instanceMatrix,34962),null!==f.instanceColor&&b.update(f.instanceColor,34962));return k},dispose:function(){e=new WeakMap}}}function kc(c,a,b,d,e,f,g,h,k,l){c=void 0!==c?c:[];Oa.call(this,c,void 0!==a?a:301,b,d,e,f,void 0!==g?g: 1022,h,k,l);this.flipY=!1}function Id(c,a,b,d){Oa.call(this,null);this.image={data:c||null,width:a||1,height:b||1,depth:d||1};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1;this.needsUpdate=!0}function Jd(c,a,b,d){Oa.call(this,null);this.image={data:c||null,width:a||1,height:b||1,depth:d||1};this.minFilter=this.magFilter=1003;this.wrapR=1001;this.flipY=this.generateMipmaps=!1;this.needsUpdate=!0}function Kd(c,a,b){var d=c[0];if(0>=d||0");return c.replace(nh,mh)}function Ni(c,a,b,d){console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.");return oh(c,a,b,d)}function oh(c,a,b,d){c="";for(a=parseInt(a);ad;d++)b.probe.push(new w);var e=new w,f=new da,g=new da;return{setup:function(h,k,l){for(var m=k=0,n=0,p=0;9>p;p++)b.probe[p].set(0,0,0);var t=p=0,q=0,v=0,u=0,A=0,B=0,D=0;l=l.matrixWorldInverse;h.sort(yl);for(var G=0,I=h.length;GK;K++)b.probe[K].addScaledVector(E.sh.coefficients[K],M);else if(E.isDirectionalLight){M=c.get(E);M.color.copy(E.color).multiplyScalar(E.intensity);M.direction.setFromMatrixPosition(E.matrixWorld);e.setFromMatrixPosition(E.target.matrixWorld);M.direction.sub(e);M.direction.transformDirection(l);if(E.castShadow){var P=E.shadow;H=a.get(E);H.shadowBias=P.bias;H.shadowNormalBias=P.normalBias; H.shadowRadius=P.radius;H.shadowMapSize=P.mapSize;b.directionalShadow[p]=H;b.directionalShadowMap[p]=K;b.directionalShadowMatrix[p]=E.shadow.matrix;A++}b.directional[p]=M;p++}else E.isSpotLight?(P=c.get(E),P.position.setFromMatrixPosition(E.matrixWorld),P.position.applyMatrix4(l),P.color.copy(H).multiplyScalar(M),P.distance=F,P.direction.setFromMatrixPosition(E.matrixWorld),e.setFromMatrixPosition(E.target.matrixWorld),P.direction.sub(e),P.direction.transformDirection(l),P.coneCos=Math.cos(E.angle), P.penumbraCos=Math.cos(E.angle*(1-E.penumbra)),P.decay=E.decay,E.castShadow&&(M=E.shadow,H=a.get(E),H.shadowBias=M.bias,H.shadowNormalBias=M.normalBias,H.shadowRadius=M.radius,H.shadowMapSize=M.mapSize,b.spotShadow[q]=H,b.spotShadowMap[q]=K,b.spotShadowMatrix[q]=E.shadow.matrix,D++),b.spot[q]=P,q++):E.isRectAreaLight?(K=c.get(E),K.color.copy(H).multiplyScalar(M),K.position.setFromMatrixPosition(E.matrixWorld),K.position.applyMatrix4(l),g.identity(),f.copy(E.matrixWorld),f.premultiply(l),g.extractRotation(f), K.halfWidth.set(.5*E.width,0,0),K.halfHeight.set(0,.5*E.height,0),K.halfWidth.applyMatrix4(g),K.halfHeight.applyMatrix4(g),b.rectArea[v]=K,v++):E.isPointLight?(M=c.get(E),M.position.setFromMatrixPosition(E.matrixWorld),M.position.applyMatrix4(l),M.color.copy(E.color).multiplyScalar(E.intensity),M.distance=E.distance,M.decay=E.decay,E.castShadow&&(P=E.shadow,H=a.get(E),H.shadowBias=P.bias,H.shadowNormalBias=P.normalBias,H.shadowRadius=P.radius,H.shadowMapSize=P.mapSize,H.shadowCameraNear=P.camera.near, H.shadowCameraFar=P.camera.far,b.pointShadow[t]=H,b.pointShadowMap[t]=K,b.pointShadowMatrix[t]=E.shadow.matrix,B++),b.point[t]=M,t++):E.isHemisphereLight&&(K=c.get(E),K.direction.setFromMatrixPosition(E.matrixWorld),K.direction.transformDirection(l),K.direction.normalize(),K.skyColor.copy(E.color).multiplyScalar(M),K.groundColor.copy(E.groundColor).multiplyScalar(M),b.hemi[u]=K,u++)}0\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}), u=v.clone();u.defines.HORIZONAL_PASS=1;var A=new ka;A.setAttribute("position",new pa(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var B=new Qa(A,v),D=this;this.enabled=!1;this.autoUpdate=!0;this.needsUpdate=!1;this.type=1;this.render=function(G,I,E){if(!1!==D.enabled&&(!1!==D.autoUpdate||!1!==D.needsUpdate)&&0!==G.length){var H=c.getRenderTarget(),M=c.getActiveCubeFace(),F=c.getActiveMipmapLevel(),K=c.state;K.setBlending(0);K.buffers.color.setClear(1,1,1,1);K.buffers.depth.setTest(!0);K.setScissorTest(!1); for(var P=0,V=G.length;Pb||k.y>b)k.x>b&&(l.x=Math.floor(b/aa.x),k.x=l.x*aa.x,W.mapSize.x=l.x),k.y>b&&(l.y=Math.floor(b/aa.y),k.y=l.y*aa.y,W.mapSize.y=l.y);null!==W.map||W.isPointLightShadow||3!==this.type||(aa={minFilter:1006,magFilter:1006,format:1023},W.map=new Db(k.x, k.y,aa),W.map.texture.name=ia.name+".shadowMap",W.mapPass=new Db(k.x,k.y,aa),W.camera.updateProjectionMatrix());null===W.map&&(W.map=new Db(k.x,k.y,{minFilter:1003,magFilter:1003,format:1023}),W.map.texture.name=ia.name+".shadowMap",W.camera.updateProjectionMatrix());c.setRenderTarget(W.map);c.clear();aa=W.getViewportCount();for(var Z=0;ZQ||z.height>Q)T=Q/Math.max(z.width,z.height);if(1>T||!0===C){if("undefined"!==typeof HTMLImageElement&&z instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&z instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&z instanceof ImageBitmap)return Q=C?xa.floorPowerOfTwo:Math.floor,C=Q(T*z.width),T=Q(T*z.height),void 0===aa&&(aa=h(C,T)),y=y?h(C,T):aa,y.width=C,y.height=T,y.getContext("2d").drawImage(z,0,0,C,T),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ z.width+"x"+z.height+") to ("+C+"x"+T+")."),y;"data"in z&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+z.width+"x"+z.height+").")}return z}function l(z){return xa.isPowerOfTwo(z.width)&&xa.isPowerOfTwo(z.height)}function m(z,C){return z.generateMipmaps&&C&&1003!==z.minFilter&&1006!==z.minFilter}function n(z,C,y,Q){c.generateMipmap(z);d.get(C).__maxMipLevel=Math.log(Math.max(y,Q))*Math.LOG2E}function p(z,C,y){if(!1===F)return C;if(null!==z){if(void 0!==c[z])return c[z];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ z+"'")}z=C;6403===C&&(5126===y&&(z=33326),5131===y&&(z=33325),5121===y&&(z=33321));6407===C&&(5126===y&&(z=34837),5131===y&&(z=34843),5121===y&&(z=32849));6408===C&&(5126===y&&(z=34836),5131===y&&(z=34842),5121===y&&(z=32856));33325!==z&&33326!==z&&34842!==z&&34836!==z||a.get("EXT_color_buffer_float");return z}function t(z){return 1003===z||1004===z||1005===z?9728:9729}function q(z){z=z.target;z.removeEventListener("dispose",q);var C=d.get(z);void 0!==C.__webglInit&&(c.deleteTexture(C.__webglTexture), d.remove(z));z.isVideoTexture&&W.delete(z);g.memory.textures--}function v(z){z=z.target;z.removeEventListener("dispose",v);var C=d.get(z),y=d.get(z.texture);if(z){void 0!==y.__webglTexture&&c.deleteTexture(y.__webglTexture);z.depthTexture&&z.depthTexture.dispose();if(z.isWebGLCubeRenderTarget)for(y=0;6>y;y++)c.deleteFramebuffer(C.__webglFramebuffer[y]),C.__webglDepthbuffer&&c.deleteRenderbuffer(C.__webglDepthbuffer[y]);else c.deleteFramebuffer(C.__webglFramebuffer),C.__webglDepthbuffer&&c.deleteRenderbuffer(C.__webglDepthbuffer), C.__webglMultisampledFramebuffer&&c.deleteFramebuffer(C.__webglMultisampledFramebuffer),C.__webglColorRenderbuffer&&c.deleteRenderbuffer(C.__webglColorRenderbuffer),C.__webglDepthRenderbuffer&&c.deleteRenderbuffer(C.__webglDepthRenderbuffer);d.remove(z.texture);d.remove(z)}g.memory.textures--}function u(z,C){var y=d.get(z);if(z.isVideoTexture){var Q=g.render.frame;W.get(z)!==Q&&(W.set(z,Q),z.update())}if(0ba;ba++)C[ba]=Q||T?T?z.image[ba].image:z.image[ba]:k(z.image[ba],!1,!0,P);ba=C[0];var X=l(ba)||F,ta=f.convert(z.format),va=f.convert(z.type),ya=p(z.internalFormat,ta,va);D(34067,z,X);if(Q){for(T=0;6>T;T++){var Pa=C[T].mipmaps;for(Q=0;QQ;Q++)if(T)for(b.texImage2D(34069+Q,0,ya,C[Q].width,C[Q].height,0,ta,va,C[Q].data),U=0;U=K&&console.warn("THREE.WebGLTextures: Trying to use "+z+" texture units while this GPU supports only "+K);ja+=1;return z};this.resetTextureUnits=function(){ja=0};this.setTexture2D=u;this.setTexture2DArray=function(z,C){var y=d.get(z);0T;T++)C.__webglFramebuffer[T]=c.createFramebuffer();else if(C.__webglFramebuffer=c.createFramebuffer(),T)if(F){C.__webglMultisampledFramebuffer=c.createFramebuffer();C.__webglColorRenderbuffer=c.createRenderbuffer();c.bindRenderbuffer(36161,C.__webglColorRenderbuffer);T=f.convert(z.texture.format);var X=f.convert(z.texture.type);T=p(z.texture.internalFormat, T,X);X=M(z);c.renderbufferStorageMultisample(36161,X,T,z.width,z.height);c.bindFramebuffer(36160,C.__webglMultisampledFramebuffer);c.framebufferRenderbuffer(36160,36064,36161,C.__webglColorRenderbuffer);c.bindRenderbuffer(36161,null);z.depthBuffer&&(C.__webglDepthRenderbuffer=c.createRenderbuffer(),H(C.__webglDepthRenderbuffer,z,!0));c.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(Q){b.bindTexture(34067,y.__webglTexture); D(34067,z.texture,ba);for(y=0;6>y;y++)E(C.__webglFramebuffer[y],z,36064,34069+y);m(z.texture,ba)&&n(34067,z.texture,z.width,z.height);b.bindTexture(34067,null)}else b.bindTexture(3553,y.__webglTexture),D(3553,z.texture,ba),E(C.__webglFramebuffer,z,36064,3553),m(z.texture,ba)&&n(3553,z.texture,z.width,z.height),b.bindTexture(3553,null);if(z.depthBuffer){C=d.get(z);ba=!0===z.isWebGLCubeRenderTarget;if(z.depthTexture){if(ba)throw Error("target.depthTexture not supported in Cube render targets");if(z&& z.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");c.bindFramebuffer(36160,C.__webglFramebuffer);if(!z.depthTexture||!z.depthTexture.isDepthTexture)throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");d.get(z.depthTexture).__webglTexture&&z.depthTexture.image.width===z.width&&z.depthTexture.image.height===z.height||(z.depthTexture.image.width=z.width,z.depthTexture.image.height=z.height,z.depthTexture.needsUpdate=!0);u(z.depthTexture, 0);C=d.get(z.depthTexture).__webglTexture;if(1026===z.depthTexture.format)c.framebufferTexture2D(36160,36096,3553,C,0);else if(1027===z.depthTexture.format)c.framebufferTexture2D(36160,33306,3553,C,0);else throw Error("Unknown depthTexture format");}else if(ba)for(C.__webglDepthbuffer=[],ba=0;6>ba;ba++)c.bindFramebuffer(36160,C.__webglFramebuffer[ba]),C.__webglDepthbuffer[ba]=c.createRenderbuffer(),H(C.__webglDepthbuffer[ba],z,!1);else c.bindFramebuffer(36160,C.__webglFramebuffer),C.__webglDepthbuffer= c.createRenderbuffer(),H(C.__webglDepthbuffer,z,!1);c.bindFramebuffer(36160,null)}};this.updateRenderTargetMipmap=function(z){var C=z.texture,y=l(z)||F;if(m(C,y)){y=z.isWebGLCubeRenderTarget?34067:3553;var Q=d.get(C).__webglTexture;b.bindTexture(y,Q);n(y,C,z.width,z.height);b.bindTexture(y,null)}};this.updateMultisampleRenderTarget=function(z){if(z.isWebGLMultisampleRenderTarget)if(F){var C=d.get(z);c.bindFramebuffer(36008,C.__webglMultisampledFramebuffer);c.bindFramebuffer(36009,C.__webglFramebuffer); var y=z.width,Q=z.height,T=16384;z.depthBuffer&&(T|=256);z.stencilBuffer&&(T|=1024);c.blitFramebuffer(0,0,y,Q,0,0,y,Q,T,9728);c.bindFramebuffer(36160,C.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")};this.safeSetTexture2D=function(z,C){z&&z.isWebGLRenderTarget&&(!1===bb&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),bb=!0),z=z.texture); u(z,C)};this.safeSetTextureCube=function(z,C){z&&z.isWebGLCubeRenderTarget&&(!1===fb&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),fb=!0),z=z.texture);z&&z.isCubeTexture||Array.isArray(z.image)&&6===z.image.length?A(z,C):B(z,C)}}function Vi(c,a,b){var d=b.isWebGL2;return{convert:function(e){if(1009===e)return 5121;if(1017===e)return 32819;if(1018===e)return 32820;if(1019===e)return 33635;if(1010===e)return 5120; if(1011===e)return 5122;if(1012===e)return 5123;if(1013===e)return 5124;if(1014===e)return 5125;if(1015===e)return 5126;if(1016===e){if(d)return 5131;var f=a.get("OES_texture_half_float");return null!==f?f.HALF_FLOAT_OES:null}if(1021===e)return 6406;if(1022===e)return 6407;if(1023===e)return 6408;if(1024===e)return 6409;if(1025===e)return 6410;if(1026===e)return 6402;if(1027===e)return 34041;if(1028===e)return 6403;if(1029===e)return 36244;if(1030===e)return 33319;if(1031===e)return 33320;if(1032=== e)return 36248;if(1033===e)return 36249;if(33776===e||33777===e||33778===e||33779===e)if(f=a.get("WEBGL_compressed_texture_s3tc"),null!==f){if(33776===e)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(35840===e||35841===e||35842===e||35843===e)if(f=a.get("WEBGL_compressed_texture_pvrtc"),null!==f){if(35840===e)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if(35841===e)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(36196===e)return f=a.get("WEBGL_compressed_texture_etc1"),null!==f?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===e||37496===e)if(f=a.get("WEBGL_compressed_texture_etc"),null!==f){if(37492===e)return f.COMPRESSED_RGB8_ETC2;if(37496===e)return f.COMPRESSED_RGBA8_ETC2_EAC}if(37808===e||37809===e||37810===e||37811===e||37812=== e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e||37840===e||37841===e||37842===e||37843===e||37844===e||37845===e||37846===e||37847===e||37848===e||37849===e||37850===e||37851===e||37852===e||37853===e)return f=a.get("WEBGL_compressed_texture_astc"),null!==f?e:null;if(36492===e)return f=a.get("EXT_texture_compression_bptc"),null!==f?e:null;if(1020===e){if(d)return 34042;f=a.get("WEBGL_depth_texture");return null!==f?f.UNSIGNED_INT_24_8_WEBGL:null}}}} function Tf(c){eb.call(this);this.cameras=c||[]}function Gc(){ha.call(this);this.type="Group"}function Me(){this._hand=this._grip=this._targetRay=null}function Wi(c,a){function b(F){var K=q.get(F.inputSource);K&&K.dispatchEvent({type:F.type})}function d(){q.forEach(function(F,K){F.disconnect(K)});q.clear();c.setFramebuffer(null);c.setRenderTarget(c.getRenderTarget());M.stop();h.isPresenting=!1;h.dispatchEvent({type:"sessionend"})}function e(F){m=F;M.setContext(k);M.start();h.isPresenting=!0;h.dispatchEvent({type:"sessionstart"})} function f(F){for(var K=k.inputSources,P=0;PY.matrixWorld.determinant();x=p(x,N,O,Y); Ca.setMaterial(O,na);na=J.index;N=J.attributes.position;if(null===na){if(void 0===N||0===N.count)return}else if(0===na.count)return;var Ha=1;!0===O.wireframe&&(na=ph.getWireframeAttribute(J),Ha=2);(O.morphTargets||O.morphNormals)&&Xi.update(Y,J,O,x);Fb.setup(Y,O,x,J,na);x=Yi;if(null!==na){var Fa=Oe.get(na);x=Zi;x.setIndex(Fa)}var ib=J.drawRange.start*Ha,Ia=null!==ma?ma.start*Ha:0;Fa=Math.max(ib,Ia);ma=Math.max(0,Math.min(null!==na?na.count:N.count,ib+J.drawRange.count*Ha,Ia+(null!==ma?ma.count*Ha: Infinity))-1-Fa+1);0!==ma&&(Y.isMesh?!0===O.wireframe?(Ca.setLineWidth(O.wireframeLinewidth*(null===W?y:1)),x.setMode(1)):x.setMode(4):Y.isLine?(O=O.linewidth,void 0===O&&(O=1),Ca.setLineWidth(O*(null===W?y:1)),Y.isLineSegments?x.setMode(1):Y.isLineLoop?x.setMode(2):x.setMode(3)):Y.isPoints?x.setMode(0):Y.isSprite&&x.setMode(4),Y.isInstancedMesh?x.renderInstances(Fa,ma,Y.count):J.isInstancedBufferGeometry?x.renderInstances(Fa,ma,Math.min(J.instanceCount,J._maxInstanceCount)):x.render(Fa,ma))};this.compile= function(x,N){M=Md.get(x,N);M.init();x.traverse(function(O){O.isLight&&(M.pushLight(O),O.castShadow&&M.pushShadow(O))});M.setupLights(N);var J=new WeakMap;x.traverse(function(O){var Y=O.material;if(Y)if(Array.isArray(Y))for(var ma=0;mae.far||f.push({distance:c,distanceToRay:Math.sqrt(h),point:b,index:a,face:null,object:g}))}function xh(c,a,b,d, e,f,g,h,k){function l(){m.needsUpdate=!0;c.requestVideoFrameCallback(l)}Oa.call(this,c,a,b,d,e,f,g,h,k);this.format=void 0!==g?g:1022;this.minFilter=void 0!==f?f:1006;this.magFilter=void 0!==e?e:1006;this.generateMipmaps=!1;var m=this;"requestVideoFrameCallback"in c&&c.requestVideoFrameCallback(l)}function Qd(c,a,b,d,e,f,g,h,k,l,m,n){Oa.call(this,null,f,g,h,k,l,d,e,m,n);this.image={width:a,height:b};this.mipmaps=c;this.generateMipmaps=this.flipY=!1}function Te(c,a,b,d,e,f,g,h,k){Oa.call(this,c,a, b,d,e,f,g,h,k);this.needsUpdate=!0}function Ue(c,a,b,d,e,f,g,h,k,l){l=void 0!==l?l:1026;if(1026!==l&&1027!==l)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===b&&1026===l&&(b=1012);void 0===b&&1027===l&&(b=1020);Oa.call(this,null,d,e,f,g,h,l,b,k);this.image={width:c,height:a};this.magFilter=void 0!==g?g:1003;this.minFilter=void 0!==h?h:1003;this.generateMipmaps=this.flipY=!1}function Rd(c){ka.call(this);this.type="WireframeGeometry";var a=[], b=[0,0],d={},e=["a","b","c"];if(c&&c.isGeometry){for(var f=c.faces,g=0,h=f.length;gl;l++){var m=k[e[l]],n=k[e[(l+1)%3]];b[0]=Math.min(m,n);b[1]=Math.max(m,n);m=b[0]+","+b[1];void 0===d[m]&&(d[m]={index1:b[0],index2:b[1]})}for(var p in d)b=d[p],f=c.vertices[b.index1],a.push(f.x,f.y,f.z),f=c.vertices[b.index2],a.push(f.x,f.y,f.z)}else if(c&&c.isBufferGeometry)if(p=new w,null!==c.index){e=c.attributes.position;g=c.index;c=c.groups;0===c.length&&(c=[{start:0,count:g.count, materialIndex:0}]);h=0;for(k=c.length;hn;n++){var t=g.getX(l+n),q=g.getX(l+(n+1)%3);b[0]=Math.min(t,q);b[1]=Math.max(t,q);t=b[0]+","+b[1];void 0===d[t]&&(d[t]={index1:b[0],index2:b[1]})}for(f in d)b=d[f],p.fromBufferAttribute(e,b.index1),a.push(p.x,p.y,p.z),p.fromBufferAttribute(e,b.index2),a.push(p.x,p.y,p.z)}else for(d=c.attributes.position,b=0,f=d.count/3;bc;c++)p.fromBufferAttribute(d,3*b+c),a.push(p.x,p.y,p.z),p.fromBufferAttribute(d, 3*b+(c+1)%3),a.push(p.x,p.y,p.z);this.setAttribute("position",new ea(a,3))}function Ve(c,a,b){sa.call(this);this.type="ParametricGeometry";this.parameters={func:c,slices:a,stacks:b};this.fromBufferGeometry(new Sd(c,a,b));this.mergeVertices()}function Sd(c,a,b){ka.call(this);this.type="ParametricBufferGeometry";this.parameters={func:c,slices:a,stacks:b};var d=[],e=[],f=[],g=[],h=new w,k=new w,l=new w,m=new w,n=new w;3>c.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); for(var p=a+1,t=0;t<=b;t++)for(var q=t/b,v=0;v<=a;v++){var u=v/a;c(u,q,k);e.push(k.x,k.y,k.z);0<=u-1E-5?(c(u-1E-5,q,l),m.subVectors(k,l)):(c(u+1E-5,q,l),m.subVectors(l,k));0<=q-1E-5?(c(u,q-1E-5,l),n.subVectors(k,l)):(c(u,q+1E-5,l),n.subVectors(l,k));h.crossVectors(m,n).normalize();f.push(h.x,h.y,h.z);g.push(u,q)}for(c=0;cp&&1===l.x&&(k[m]=l.x-1);0===n.x&&0===n.z&&(k[m]=p/2/Math.PI+.5)}ka.call(this);this.type="PolyhedronBufferGeometry";this.parameters={vertices:c,indices:a, radius:b,detail:d};b=b||1;d=d||0;var h=[],k=[];(function(l){for(var m=new w,n=new w,p=new w,t=0;tt&&(.2>m&&(k[l+0]+=1),.2>n&&(k[l+2]+=1),.2>p&&(k[l+4]+=1))})();this.setAttribute("position",new ea(h,3));this.setAttribute("normal",new ea(h.slice(),3));this.setAttribute("uv",new ea(k,2));0===d?this.computeVertexNormals():this.normalizeNormals()}function Xe(c, a){sa.call(this);this.type="TetrahedronGeometry";this.parameters={radius:c,detail:a};this.fromBufferGeometry(new Td(c,a));this.mergeVertices()}function Td(c,a){zb.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],c,a);this.type="TetrahedronBufferGeometry";this.parameters={radius:c,detail:a}}function Ye(c,a){sa.call(this);this.type="OctahedronGeometry";this.parameters={radius:c,detail:a};this.fromBufferGeometry(new fd(c,a));this.mergeVertices()}function fd(c,a){zb.call(this,[1,0, 0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],c,a);this.type="OctahedronBufferGeometry";this.parameters={radius:c,detail:a}}function Ze(c,a){sa.call(this);this.type="IcosahedronGeometry";this.parameters={radius:c,detail:a};this.fromBufferGeometry(new Ud(c,a));this.mergeVertices()}function Ud(c,a){var b=(1+Math.sqrt(5))/2;zb.call(this,[-1,b,0,1,b,0,-1,-b,0,1,-b,0,0,-1,b,0,1,b,0,-1,-b,0,1,-b,b,0,-1,b,0,1,-b,0,-1,-b,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5, 9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],c,a);this.type="IcosahedronBufferGeometry";this.parameters={radius:c,detail:a}}function $e(c,a){sa.call(this);this.type="DodecahedronGeometry";this.parameters={radius:c,detail:a};this.fromBufferGeometry(new Vd(c,a));this.mergeVertices()}function Vd(c,a){var b=(1+Math.sqrt(5))/2,d=1/b;zb.call(this,[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-d,-b,0,-d,b,0,d,-b,0,d,b,-d,-b,0,-d,b,0,d,-b,0, d,b,0,-b,0,-d,b,0,-d,-b,0,d,b,0,d],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],c,a);this.type="DodecahedronBufferGeometry";this.parameters={radius:c,detail:a}}function af(c,a,b,d,e,f){sa.call(this);this.type="TubeGeometry";this.parameters={path:c,tubularSegments:a,radius:b,radialSegments:d, closed:e};void 0!==f&&console.warn("THREE.TubeGeometry: taper has been removed.");c=new gd(c,a,b,d,e);this.tangents=c.tangents;this.normals=c.normals;this.binormals=c.binormals;this.fromBufferGeometry(c);this.mergeVertices()}function gd(c,a,b,d,e){function f(v){m=c.getPointAt(v/a,m);var u=g.normals[v];v=g.binormals[v];for(var A=0;A<=d;A++){var B=A/d*Math.PI*2,D=Math.sin(B);B=-Math.cos(B);k.x=B*u.x+D*v.x;k.y=B*u.y+D*v.y;k.z=B*u.z+D*v.z;k.normalize();p.push(k.x,k.y,k.z);h.x=m.x+b*k.x;h.y=m.y+b*k.y; h.z=m.z+b*k.z;n.push(h.x,h.y,h.z)}}ka.call(this);this.type="TubeBufferGeometry";this.parameters={path:c,tubularSegments:a,radius:b,radialSegments:d,closed:e};a=a||64;b=b||1;d=d||8;e=e||!1;var g=c.computeFrenetFrames(a,e);this.tangents=g.tangents;this.normals=g.normals;this.binormals=g.binormals;var h=new w,k=new w,l=new L,m=new w,n=[],p=[],t=[],q=[];(function(){for(var v=0;v=a;e-=d)f=cj(e,c[e],c[e+1],f);f&&ag(f,f.next)&&(df(f),f=f.next);return f}function Mc(c,a){if(!c)return c;a||(a=c);do{var b=!1;if(c.steiner||!ag(c,c.next)&&0!==ab(c.prev,c,c.next))c=c.next;else{df(c);c=a= c.prev;if(c===c.next)break;b=!0}}while(b||c!==a);return a}function ef(c,a,b,d,e,f,g){if(c){if(!g&&f){var h=c,k=h;do null===k.z&&(k.z=yh(k.x,k.y,d,e,f)),k.prevZ=k.prev,k=k.nextZ=k.next;while(k!==h);k.prevZ.nextZ=null;k.prevZ=null;h=k;var l,m,n,p,t=1;do{k=h;var q=h=null;for(m=0;k;){m++;var v=k;for(l=n=0;lt!==q.next.y>t&&q.next.y!==q.y&&n<(q.next.x-q.x)*(t-q.y)/(q.next.y-q.y)+q.x&&(m=!m),q=q.next;while(q!==k);q=m}q=q&&(ab(k.prev,k, v.prev)||ab(k,v.prev,v))||ag(k,v)&&0c.x?e.x>f.x?e.x:f.x:c.x>f.x?c.x:f.x,h=e.y>c.y?e.y>f.y?e.y:f.y:c.y>f.y?c.y:f.y,k=yh(e.x=k&&d&&d.z<=a;){if(b!==c.prev&&b!==c.next&&Yd(e.x,e.y,c.x,c.y,f.x,f.y,b.x,b.y)&&0<=ab(b.prev,b,b.next))return!1;b=b.prevZ;if(d!==c.prev&&d!==c.next&&Yd(e.x,e.y,c.x,c.y,f.x,f.y,d.x,d.y)&&0<=ab(d.prev,d,d.next))return!1;d=d.nextZ}for(;b&&b.z>=k;){if(b!==c.prev&&b!==c.next&&Yd(e.x,e.y,c.x,c.y,f.x,f.y,b.x,b.y)&&0<=ab(b.prev,b,b.next))return!1;b=b.prevZ}for(;d&&d.z<=a;){if(d!==c.prev&&d!==c.next&&Yd(e.x,e.y,c.x,c.y,f.x,f.y,d.x,d.y)&&0<=ab(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function Gl(c, a){return c.x-a.x}function Hl(c,a){var b=a,d=c.x,e=c.y,f=-Infinity;do{if(e<=b.y&&e>=b.next.y&&b.next.y!==b.y){var g=b.x+(e-b.y)*(b.next.x-b.x)/(b.next.y-b.y);if(g<=d&&g>f){f=g;if(g===d){if(e===b.y)return b;if(e===b.next.y)return b.next}var h=b.x=b.x&&b.x>=g&&d!==b.x&&Yd(eh.x)&&(n=b.x===h.x)){n=h;var p=b;n=0>ab(n.prev,n,p.prev)&&0>ab(p.next,n,n.next)}n&&(h=b,l=m)}b=b.next}while(b!==a);return h}function yh(c,a,b,d,e){c=32767*(c-b)*e;a=32767*(a-d)*e;c=(c|c<<8)&16711935;c=(c|c<<4)&252645135;c=(c|c<<2)&858993459;a=(a|a<<8)&16711935;a=(a|a<<4)&252645135;a=(a|a<<2)&858993459;return(c|c<<1)&1431655765|((a|a<<1)&1431655765)<<1}function Il(c){var a=c,b=c;do{if(a.x=Math.min(c.x,b.x)&&a.y<=Math.max(c.y,b.y)&&a.y>=Math.min(c.y,b.y)}function bg(c){return 0< c?1:0>c?-1:0}function ff(c,a){return 0>ab(c.prev,c,c.next)?0<=ab(c,a,c.next)&&0<=ab(c,c.prev,a):0>ab(c,a,c.prev)||0>ab(c,c.next,a)}function ej(c,a){var b=new zh(c.i,c.x,c.y),d=new zh(a.i,a.x,a.y),e=c.next,f=a.prev;c.next=a;a.prev=c;b.next=e;e.prev=b;d.next=b;b.prev=d;f.next=d;d.prev=f;return d}function cj(c,a,b,d){c=new zh(c,a,b);d?(c.next=d.next,c.prev=d,d.next.prev=c,d.next=c):(c.prev=c,c.next=c);return c}function df(c){c.next.prev=c.prev;c.prev.next=c.next;c.prevZ&&(c.prevZ.nextZ=c.nextZ);c.nextZ&& (c.nextZ.prevZ=c.prevZ)}function zh(c,a,b){this.i=c;this.x=a;this.y=b;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function fj(c){var a=c.length;2Number.EPSILON){var Ra=Math.sqrt(Ka),kb=Math.sqrt(Ea*Ea+Ca*Ca);Ka=la.x-qa/Ra;la=la.y+R/Ra;Ca=((wa.x-Ca/kb-Ka)*Ca-(wa.y+Ea/kb-la)*Ea)/(R*Ca-qa*Ea);Ea=Ka+R*Ca-U.x;R=la+qa*Ca-U.y;qa=Ea*Ea+R*R;if(2>=qa)return new L(Ea,R);qa=Math.sqrt(qa/2)}else U=!1,R>Number.EPSILON?Ea>Number.EPSILON&&(U=!0):R<-Number.EPSILON?Ea<-Number.EPSILON&&(U=!0):Math.sign(qa)=== Math.sign(Ca)&&(U=!0),U?(Ea=-qa,qa=Math.sqrt(Ka)):(Ea=R,R=qa,qa=Math.sqrt(Ka/2));return new L(Ea/qa,R/qa)}function n(U,la){for(var wa=U.length;0<=--wa;){var R=wa,qa=wa-1;0>qa&&(qa=U.length-1);for(var Ea=0,Ca=B+2*M;Eam;m++){var n=l[f[m]];var p=l[f[(m+1)%3]];d[0]=Math.min(n,p);d[1]=Math.max(n,p);n=d[0]+","+d[1];void 0===e[n]?e[n]={index1:d[0],index2:d[1],face1:h,face2:void 0}:e[n].face2=h}for(n in e)if(d=e[n],void 0===d.face2||g[d.face1].normal.dot(g[d.face2].normal)<=a)f=c[d.index1], b.push(f.x,f.y,f.z),f=c[d.index2],b.push(f.x,f.y,f.z);this.setAttribute("position",new ea(b,3))}function ld(c,a,b,d,e,f,g,h){sa.call(this);this.type="CylinderGeometry";this.parameters={radiusTop:c,radiusBottom:a,height:b,radialSegments:d,heightSegments:e,openEnded:f,thetaStart:g,thetaLength:h};this.fromBufferGeometry(new oc(c,a,b,d,e,f,g,h));this.mergeVertices()}function oc(c,a,b,d,e,f,g,h){function k(B){for(var D=q,G=new L,I=new w,E=0,H=!0===B?c:a,M=!0===B?1:-1,F=1;F<=d;F++)n.push(0,u*M,0),p.push(0, M,0),t.push(.5,.5),q++;F=q;for(var K=0;K<=d;K++){var P=K/d*h+g,V=Math.cos(P);P=Math.sin(P);I.x=H*P;I.y=u*M;I.z=H*V;n.push(I.x,I.y,I.z);p.push(0,M,0);G.x=.5*V+.5;G.y=.5*P*M+.5;t.push(G.x,G.y);q++}for(G=0;Gthis.duration&&this.resetDuration()}function Kl(c){switch(c.toLowerCase()){case "scalar":case "double":case "float":case "number":case "integer":return de;case "vector":case "vector2":case "vector3":case "vector4":return ee;case "color":return gg;case "quaternion":return pf;case "bool":case "boolean":return fg;case "string":return ig}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+c);}function Ll(c){if(void 0=== c.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");var a=Kl(c.type);if(void 0===c.times){var b=[],d=[];Va.flattenJSON(c.keys,b,d,"value");c.times=b;c.values=d}return void 0!==a.parse?a.parse(c):new a(c.name,c.times,c.values,c.interpolation)}function Ah(c,a,b){var d=this,e=!1,f=0,g=0,h=void 0,k=[];this.onStart=void 0;this.onLoad=c;this.onProgress=a;this.onError=b;this.itemStart=function(l){g++;if(!1===e&&void 0!==d.onStart)d.onStart(l,f,g);e=!0};this.itemEnd=function(l){f++; if(void 0!==d.onProgress)d.onProgress(l,f,g);if(f===g&&(e=!1,void 0!==d.onLoad))d.onLoad()};this.itemError=function(l){if(void 0!==d.onError)d.onError(l)};this.resolveURL=function(l){return h?h(l):l};this.setURLModifier=function(l){h=l;return this};this.addHandler=function(l,m){k.push(l,m);return this};this.removeHandler=function(l){l=k.indexOf(l);-1!==l&&k.splice(l,2);return this};this.getHandler=function(l){for(var m=0,n=k.length;mb;b++,d++){var e=b/32*Math.PI*2,f=d/32*Math.PI*2;a.push(Math.cos(e),Math.sin(e),1,Math.cos(f),Math.sin(f),1)}c.setAttribute("position",new ea(a,3));a=new Ya({fog:!1, toneMapped:!1});this.cone=new Za(c,a);this.add(this.cone);this.update()}function ke(c){for(var a=pj(c),b=new ka,d=[],e=[],f=new S(0,0,1),g=new S(0,1,0),h=0;h\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t", blending:0,depthTest:!1,depthWrite:!1})}function sj(){return new pc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:hc[3E3]},outputEncoding:{value:hc[3E3]}},vertexShader:Vh(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t"+Wh()+"\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t", blending:0,depthTest:!1,depthWrite:!1})}function Vh(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"} function Wh(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"} function tj(c){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");ob.call(this,c);this.type="catmullrom";this.closed=!0}function uj(c){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead.");ob.call(this,c);this.type="catmullrom"}function Xh(c){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead.");ob.call(this,c);this.type="catmullrom"}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2, -52));void 0===Number.isInteger&&(Number.isInteger=function(c){return"number"===typeof c&&isFinite(c)&&Math.floor(c)===c});void 0===Math.sign&&(Math.sign=function(c){return 0>c?-1:0zf;zf++)mb[zf]=(16>zf?"0":"")+zf.toString(16);var Bg=1234567,xa={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var c=4294967295*Math.random()|0,a=4294967295*Math.random()|0,b= 4294967295*Math.random()|0,d=4294967295*Math.random()|0;return(mb[c&255]+mb[c>>8&255]+mb[c>>16&255]+mb[c>>24&255]+"-"+mb[a&255]+mb[a>>8&255]+"-"+mb[a>>16&15|64]+mb[a>>24&255]+"-"+mb[b&63|128]+mb[b>>8&255]+"-"+mb[b>>16&255]+mb[b>>24&255]+mb[d&255]+mb[d>>8&255]+mb[d>>16&255]+mb[d>>24&255]).toUpperCase()},clamp:function(c,a,b){return Math.max(a,Math.min(b,c))},euclideanModulo:function(c,a){return(c%a+a)%a},mapLinear:function(c,a,b,d,e){return d+(c-a)*(e-d)/(b-a)},lerp:function(c,a,b){return(1-b)*c+b* a},smoothstep:function(c,a,b){if(c<=a)return 0;if(c>=b)return 1;c=(c-a)/(b-a);return c*c*(3-2*c)},smootherstep:function(c,a,b){if(c<=a)return 0;if(c>=b)return 1;c=(c-a)/(b-a);return c*c*c*(c*(6*c-15)+10)},randInt:function(c,a){return c+Math.floor(Math.random()*(a-c+1))},randFloat:function(c,a){return c+Math.random()*(a-c)},randFloatSpread:function(c){return c*(.5-Math.random())},seededRandom:function(c){void 0!==c&&(Bg=c%2147483647);Bg=16807*Bg%2147483647;return(Bg-1)/2147483646},degToRad:function(c){return c* xa.DEG2RAD},radToDeg:function(c){return c*xa.RAD2DEG},isPowerOfTwo:function(c){return 0===(c&c-1)&&0!==c},ceilPowerOfTwo:function(c){return Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))},floorPowerOfTwo:function(c){return Math.pow(2,Math.floor(Math.log(c)/Math.LN2))},setQuaternionFromProperEuler:function(c,a,b,d,e){var f=Math.cos,g=Math.sin,h=f(b/2);b=g(b/2);var k=f((a+d)/2),l=g((a+d)/2),m=f((a-d)/2),n=g((a-d)/2);f=f((d-a)/2);a=g((d-a)/2);switch(e){case "XYX":c.set(h*l,b*m,b*n,h*k);break;case "YZY":c.set(b* n,h*l,b*m,h*k);break;case "ZXZ":c.set(b*m,b*n,h*l,h*k);break;case "XZX":c.set(h*l,b*a,b*f,h*k);break;case "YXY":c.set(b*f,h*l,b*a,h*k);break;case "ZYZ":c.set(b*a,b*f,h*l,h*k);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+e)}}},L=function(c,a){void 0===c&&(c=0);void 0===a&&(a=0);Object.defineProperty(this,"isVector2",{value:!0});this.x=c;this.y=a},Af={width:{configurable:!0},height:{configurable:!0}};Af.width.get=function(){return this.x}; Af.width.set=function(c){this.x=c};Af.height.get=function(){return this.y};Af.height.set=function(c){this.y=c};L.prototype.set=function(c,a){this.x=c;this.y=a;return this};L.prototype.setScalar=function(c){this.y=this.x=c;return this};L.prototype.setX=function(c){this.x=c;return this};L.prototype.setY=function(c){this.y=c;return this};L.prototype.setComponent=function(c,a){switch(c){case 0:this.x=a;break;case 1:this.y=a;break;default:throw Error("index is out of range: "+c);}return this};L.prototype.getComponent= function(c){switch(c){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+c);}};L.prototype.clone=function(){return new this.constructor(this.x,this.y)};L.prototype.copy=function(c){this.x=c.x;this.y=c.y;return this};L.prototype.add=function(c,a){if(void 0!==a)return console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(c,a);this.x+=c.x;this.y+=c.y;return this};L.prototype.addScalar=function(c){this.x+= c;this.y+=c;return this};L.prototype.addVectors=function(c,a){this.x=c.x+a.x;this.y=c.y+a.y;return this};L.prototype.addScaledVector=function(c,a){this.x+=c.x*a;this.y+=c.y*a;return this};L.prototype.sub=function(c,a){if(void 0!==a)return console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(c,a);this.x-=c.x;this.y-=c.y;return this};L.prototype.subScalar=function(c){this.x-=c;this.y-=c;return this};L.prototype.subVectors=function(c,a){this.x= c.x-a.x;this.y=c.y-a.y;return this};L.prototype.multiply=function(c){this.x*=c.x;this.y*=c.y;return this};L.prototype.multiplyScalar=function(c){this.x*=c;this.y*=c;return this};L.prototype.divide=function(c){this.x/=c.x;this.y/=c.y;return this};L.prototype.divideScalar=function(c){return this.multiplyScalar(1/c)};L.prototype.applyMatrix3=function(c){var a=this.x,b=this.y;c=c.elements;this.x=c[0]*a+c[3]*b+c[6];this.y=c[1]*a+c[4]*b+c[7];return this};L.prototype.min=function(c){this.x=Math.min(this.x, c.x);this.y=Math.min(this.y,c.y);return this};L.prototype.max=function(c){this.x=Math.max(this.x,c.x);this.y=Math.max(this.y,c.y);return this};L.prototype.clamp=function(c,a){this.x=Math.max(c.x,Math.min(a.x,this.x));this.y=Math.max(c.y,Math.min(a.y,this.y));return this};L.prototype.clampScalar=function(c,a){this.x=Math.max(c,Math.min(a,this.x));this.y=Math.max(c,Math.min(a,this.y));return this};L.prototype.clampLength=function(c,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(c, Math.min(a,b)))};L.prototype.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};L.prototype.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};L.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};L.prototype.roundToZero=function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);return this};L.prototype.negate=function(){this.x=-this.x;this.y= -this.y;return this};L.prototype.dot=function(c){return this.x*c.x+this.y*c.y};L.prototype.cross=function(c){return this.x*c.y-this.y*c.x};L.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y};L.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};L.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)};L.prototype.normalize=function(){return this.divideScalar(this.length()||1)};L.prototype.angle=function(){return Math.atan2(-this.y,-this.x)+ Math.PI};L.prototype.distanceTo=function(c){return Math.sqrt(this.distanceToSquared(c))};L.prototype.distanceToSquared=function(c){var a=this.x-c.x;c=this.y-c.y;return a*a+c*c};L.prototype.manhattanDistanceTo=function(c){return Math.abs(this.x-c.x)+Math.abs(this.y-c.y)};L.prototype.setLength=function(c){return this.normalize().multiplyScalar(c)};L.prototype.lerp=function(c,a){this.x+=(c.x-this.x)*a;this.y+=(c.y-this.y)*a;return this};L.prototype.lerpVectors=function(c,a,b){this.x=c.x+(a.x-c.x)*b; this.y=c.y+(a.y-c.y)*b;return this};L.prototype.equals=function(c){return c.x===this.x&&c.y===this.y};L.prototype.fromArray=function(c,a){void 0===a&&(a=0);this.x=c[a];this.y=c[a+1];return this};L.prototype.toArray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this.x;c[a+1]=this.y;return c};L.prototype.fromBufferAttribute=function(c,a,b){void 0!==b&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute().");this.x=c.getX(a);this.y=c.getY(a);return this};L.prototype.rotateAround= function(c,a){var b=Math.cos(a);a=Math.sin(a);var d=this.x-c.x,e=this.y-c.y;this.x=d*b-e*a+c.x;this.y=d*a+e*b+c.y;return this};L.prototype.random=function(){this.x=Math.random();this.y=Math.random();return this};Object.defineProperties(L.prototype,Af);var Da=function(){Object.defineProperty(this,"isMatrix3",{value:!0});this.elements=[1,0,0,0,1,0,0,0,1];0b;b++)if(a[b]!==c[b])return!1;return!0};Da.prototype.fromArray=function(c,a){void 0===a&&(a=0);for(var b=0;9>b;b++)this.elements[b]=c[b+a];return this};Da.prototype.toArray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);var b=this.elements;c[a]=b[0];c[a+1]=b[1];c[a+2]=b[2];c[a+3]=b[3];c[a+4]=b[4];c[a+5]=b[5];c[a+6]=b[6];c[a+7]=b[7];c[a+8]=b[8];return c};var oe, Sc={getDataURL:function(c){if(/^data:/i.test(c.src)||"undefined"==typeof HTMLCanvasElement)return c.src;if(!(c instanceof HTMLCanvasElement)){void 0===oe&&(oe=document.createElementNS("http://www.w3.org/1999/xhtml","canvas"));oe.width=c.width;oe.height=c.height;var a=oe.getContext("2d");c instanceof ImageData?a.putImageData(c,0,0):a.drawImage(c,0,0,c.width,c.height);c=oe}return 2048c.x||1c.x?0:1;break;case 1002:c.x=1===Math.abs(Math.floor(c.x)%2)?Math.ceil(c.x)-c.x:c.x-Math.floor(c.x)}if(0>c.y||1c.y?0:1;break;case 1002:c.y=1===Math.abs(Math.floor(c.y)%2)?Math.ceil(c.y)-c.y:c.y-Math.floor(c.y)}this.flipY&&(c.y=1-c.y);return c}});Object.defineProperty(Oa.prototype,"needsUpdate",{set:function(c){!0===c&&this.version++}});var ca= function(c,a,b,d){void 0===c&&(c=0);void 0===a&&(a=0);void 0===b&&(b=0);void 0===d&&(d=1);Object.defineProperty(this,"isVector4",{value:!0});this.x=c;this.y=a;this.z=b;this.w=d},Bf={width:{configurable:!0},height:{configurable:!0}};Bf.width.get=function(){return this.z};Bf.width.set=function(c){this.z=c};Bf.height.get=function(){return this.w};Bf.height.set=function(c){this.w=c};ca.prototype.set=function(c,a,b,d){this.x=c;this.y=a;this.z=b;this.w=d;return this};ca.prototype.setScalar=function(c){this.w= this.z=this.y=this.x=c;return this};ca.prototype.setX=function(c){this.x=c;return this};ca.prototype.setY=function(c){this.y=c;return this};ca.prototype.setZ=function(c){this.z=c;return this};ca.prototype.setW=function(c){this.w=c;return this};ca.prototype.setComponent=function(c,a){switch(c){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;case 3:this.w=a;break;default:throw Error("index is out of range: "+c);}return this};ca.prototype.getComponent=function(c){switch(c){case 0:return this.x; case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+c);}};ca.prototype.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)};ca.prototype.copy=function(c){this.x=c.x;this.y=c.y;this.z=c.z;this.w=void 0!==c.w?c.w:1;return this};ca.prototype.add=function(c,a){if(void 0!==a)return console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(c,a);this.x+=c.x;this.y+=c.y; this.z+=c.z;this.w+=c.w;return this};ca.prototype.addScalar=function(c){this.x+=c;this.y+=c;this.z+=c;this.w+=c;return this};ca.prototype.addVectors=function(c,a){this.x=c.x+a.x;this.y=c.y+a.y;this.z=c.z+a.z;this.w=c.w+a.w;return this};ca.prototype.addScaledVector=function(c,a){this.x+=c.x*a;this.y+=c.y*a;this.z+=c.z*a;this.w+=c.w*a;return this};ca.prototype.sub=function(c,a){if(void 0!==a)return console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(c,a);this.x-=c.x;this.y-=c.y;this.z-=c.z;this.w-=c.w;return this};ca.prototype.subScalar=function(c){this.x-=c;this.y-=c;this.z-=c;this.w-=c;return this};ca.prototype.subVectors=function(c,a){this.x=c.x-a.x;this.y=c.y-a.y;this.z=c.z-a.z;this.w=c.w-a.w;return this};ca.prototype.multiplyScalar=function(c){this.x*=c;this.y*=c;this.z*=c;this.w*=c;return this};ca.prototype.applyMatrix4=function(c){var a=this.x,b=this.y,d=this.z,e=this.w;c=c.elements;this.x=c[0]*a+c[4]*b+c[8]*d+c[12]*e; this.y=c[1]*a+c[5]*b+c[9]*d+c[13]*e;this.z=c[2]*a+c[6]*b+c[10]*d+c[14]*e;this.w=c[3]*a+c[7]*b+c[11]*d+c[15]*e;return this};ca.prototype.divideScalar=function(c){return this.multiplyScalar(1/c)};ca.prototype.setAxisAngleFromQuaternion=function(c){this.w=2*Math.acos(c.w);var a=Math.sqrt(1-c.w*c.w);1E-4>a?(this.x=1,this.z=this.y=0):(this.x=c.x/a,this.y=c.y/a,this.z=c.z/a);return this};ca.prototype.setAxisAngleFromRotationMatrix=function(c){c=c.elements;var a=c[0];var b=c[4];var d=c[8],e=c[1],f=c[5], g=c[9];var h=c[2];var k=c[6];var l=c[10];if(.01>Math.abs(b-e)&&.01>Math.abs(d-h)&&.01>Math.abs(g-k)){if(.1>Math.abs(b+e)&&.1>Math.abs(d+h)&&.1>Math.abs(g+k)&&.1>Math.abs(a+f+l-3))return this.set(1,0,0,0),this;c=Math.PI;a=(a+1)/2;f=(f+1)/2;l=(l+1)/2;b=(b+e)/4;d=(d+h)/4;g=(g+k)/4;a>f&&a>l?.01>a?(k=0,b=h=.707106781):(k=Math.sqrt(a),h=b/k,b=d/k):f>l?.01>f?(k=.707106781,h=0,b=.707106781):(h=Math.sqrt(f),k=b/h,b=g/h):.01>l?(h=k=.707106781,b=0):(b=Math.sqrt(l),k=d/b,h=g/b);this.set(k,h,b,c);return this}c= Math.sqrt((k-g)*(k-g)+(d-h)*(d-h)+(e-b)*(e-b));.001>Math.abs(c)&&(c=1);this.x=(k-g)/c;this.y=(d-h)/c;this.z=(e-b)/c;this.w=Math.acos((a+f+l-1)/2);return this};ca.prototype.min=function(c){this.x=Math.min(this.x,c.x);this.y=Math.min(this.y,c.y);this.z=Math.min(this.z,c.z);this.w=Math.min(this.w,c.w);return this};ca.prototype.max=function(c){this.x=Math.max(this.x,c.x);this.y=Math.max(this.y,c.y);this.z=Math.max(this.z,c.z);this.w=Math.max(this.w,c.w);return this};ca.prototype.clamp=function(c,a){this.x= Math.max(c.x,Math.min(a.x,this.x));this.y=Math.max(c.y,Math.min(a.y,this.y));this.z=Math.max(c.z,Math.min(a.z,this.z));this.w=Math.max(c.w,Math.min(a.w,this.w));return this};ca.prototype.clampScalar=function(c,a){this.x=Math.max(c,Math.min(a,this.x));this.y=Math.max(c,Math.min(a,this.y));this.z=Math.max(c,Math.min(a,this.z));this.w=Math.max(c,Math.min(a,this.w));return this};ca.prototype.clampLength=function(c,a){var b=this.length();return this.divideScalar(b||1).multiplyScalar(Math.max(c,Math.min(a, b)))};ca.prototype.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);this.w=Math.floor(this.w);return this};ca.prototype.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);this.w=Math.ceil(this.w);return this};ca.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);this.w=Math.round(this.w);return this};ca.prototype.roundToZero=function(){this.x=0>this.x?Math.ceil(this.x): Math.floor(this.x);this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w);return this};ca.prototype.negate=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;this.w=-this.w;return this};ca.prototype.dot=function(c){return this.x*c.x+this.y*c.y+this.z*c.z+this.w*c.w};ca.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w};ca.prototype.length=function(){return Math.sqrt(this.x* this.x+this.y*this.y+this.z*this.z+this.w*this.w)};ca.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)};ca.prototype.normalize=function(){return this.divideScalar(this.length()||1)};ca.prototype.setLength=function(c){return this.normalize().multiplyScalar(c)};ca.prototype.lerp=function(c,a){this.x+=(c.x-this.x)*a;this.y+=(c.y-this.y)*a;this.z+=(c.z-this.z)*a;this.w+=(c.w-this.w)*a;return this};ca.prototype.lerpVectors=function(c,a,b){this.x= c.x+(a.x-c.x)*b;this.y=c.y+(a.y-c.y)*b;this.z=c.z+(a.z-c.z)*b;this.w=c.w+(a.w-c.w)*b;return this};ca.prototype.equals=function(c){return c.x===this.x&&c.y===this.y&&c.z===this.z&&c.w===this.w};ca.prototype.fromArray=function(c,a){void 0===a&&(a=0);this.x=c[a];this.y=c[a+1];this.z=c[a+2];this.w=c[a+3];return this};ca.prototype.toArray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this.x;c[a+1]=this.y;c[a+2]=this.z;c[a+3]=this.w;return c};ca.prototype.fromBufferAttribute=function(c,a,b){void 0!== b&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute().");this.x=c.getX(a);this.y=c.getY(a);this.z=c.getZ(a);this.w=c.getW(a);return this};ca.prototype.random=function(){this.x=Math.random();this.y=Math.random();this.z=Math.random();this.w=Math.random();return this};Object.defineProperties(ca.prototype,Bf);Db.prototype=Object.assign(Object.create(wb.prototype),{constructor:Db,isWebGLRenderTarget:!0,setSize:function(c,a){if(this.width!==c||this.height!==a)this.width=c, this.height=a,this.texture.image.width=c,this.texture.image.height=a,this.dispose();this.viewport.set(0,0,c,a);this.scissor.set(0,0,c,a)},clone:function(){return(new this.constructor).copy(this)},copy:function(c){this.width=c.width;this.height=c.height;this.viewport.copy(c.viewport);this.texture=c.texture.clone();this.depthBuffer=c.depthBuffer;this.stencilBuffer=c.stencilBuffer;this.depthTexture=c.depthTexture;return this},dispose:function(){this.dispatchEvent({type:"dispose"})}});dh.prototype=Object.assign(Object.create(Db.prototype), {constructor:dh,isWebGLMultisampleRenderTarget:!0,copy:function(c){Db.prototype.copy.call(this,c);this.samples=c.samples;return this}});var ua=function(c,a,b,d){void 0===c&&(c=0);void 0===a&&(a=0);void 0===b&&(b=0);void 0===d&&(d=1);Object.defineProperty(this,"isQuaternion",{value:!0});this._x=c;this._y=a;this._z=b;this._w=d},rc={x:{configurable:!0},y:{configurable:!0},z:{configurable:!0},w:{configurable:!0}};ua.slerp=function(c,a,b,d){return b.copy(c).slerp(a,d)};ua.slerpFlat=function(c,a,b,d,e, f,g){var h=b[d+0],k=b[d+1],l=b[d+2];b=b[d+3];d=e[f+0];var m=e[f+1],n=e[f+2];e=e[f+3];if(b!==e||h!==d||k!==m||l!==n){f=1-g;var p=h*d+k*m+l*n+b*e,t=0<=p?1:-1,q=1-p*p;q>Number.EPSILON&&(q=Math.sqrt(q),p=Math.atan2(q,p*t),f=Math.sin(f*p)/q,g=Math.sin(g*p)/q);t*=g;h=h*f+d*t;k=k*f+m*t;l=l*f+n*t;b=b*f+e*t;f===1-g&&(g=1/Math.sqrt(h*h+k*k+l*l+b*b),h*=g,k*=g,l*=g,b*=g)}c[a]=h;c[a+1]=k;c[a+2]=l;c[a+3]=b};ua.multiplyQuaternionsFlat=function(c,a,b,d,e,f){var g=b[d],h=b[d+1],k=b[d+2];b=b[d+3];d=e[f];var l=e[f+ 1],m=e[f+2];e=e[f+3];c[a]=g*e+b*d+h*m-k*l;c[a+1]=h*e+b*l+k*d-g*m;c[a+2]=k*e+b*m+g*l-h*d;c[a+3]=b*e-g*d-h*l-k*m;return c};rc.x.get=function(){return this._x};rc.x.set=function(c){this._x=c;this._onChangeCallback()};rc.y.get=function(){return this._y};rc.y.set=function(c){this._y=c;this._onChangeCallback()};rc.z.get=function(){return this._z};rc.z.set=function(c){this._z=c;this._onChangeCallback()};rc.w.get=function(){return this._w};rc.w.set=function(c){this._w=c;this._onChangeCallback()};ua.prototype.set= function(c,a,b,d){this._x=c;this._y=a;this._z=b;this._w=d;this._onChangeCallback();return this};ua.prototype.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)};ua.prototype.copy=function(c){this._x=c.x;this._y=c.y;this._z=c.z;this._w=c.w;this._onChangeCallback();return this};ua.prototype.setFromEuler=function(c,a){if(!c||!c.isEuler)throw Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var b=c._x,d=c._y,e=c._z;c= c._order;var f=Math.cos,g=Math.sin,h=f(b/2),k=f(d/2);f=f(e/2);b=g(b/2);d=g(d/2);e=g(e/2);switch(c){case "XYZ":this._x=b*k*f+h*d*e;this._y=h*d*f-b*k*e;this._z=h*k*e+b*d*f;this._w=h*k*f-b*d*e;break;case "YXZ":this._x=b*k*f+h*d*e;this._y=h*d*f-b*k*e;this._z=h*k*e-b*d*f;this._w=h*k*f+b*d*e;break;case "ZXY":this._x=b*k*f-h*d*e;this._y=h*d*f+b*k*e;this._z=h*k*e+b*d*f;this._w=h*k*f-b*d*e;break;case "ZYX":this._x=b*k*f-h*d*e;this._y=h*d*f+b*k*e;this._z=h*k*e-b*d*f;this._w=h*k*f+b*d*e;break;case "YZX":this._x= b*k*f+h*d*e;this._y=h*d*f+b*k*e;this._z=h*k*e-b*d*f;this._w=h*k*f-b*d*e;break;case "XZY":this._x=b*k*f-h*d*e;this._y=h*d*f-b*k*e;this._z=h*k*e+b*d*f;this._w=h*k*f+b*d*e;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+c)}!1!==a&&this._onChangeCallback();return this};ua.prototype.setFromAxisAngle=function(c,a){a/=2;var b=Math.sin(a);this._x=c.x*b;this._y=c.y*b;this._z=c.z*b;this._w=Math.cos(a);this._onChangeCallback();return this};ua.prototype.setFromRotationMatrix= function(c){var a=c.elements,b=a[0];c=a[4];var d=a[8],e=a[1],f=a[5],g=a[9],h=a[2],k=a[6];a=a[10];var l=b+f+a;0f&&b>a?(b=2*Math.sqrt(1+b-f-a),this._w=(k-g)/b,this._x=.25*b,this._y=(c+e)/b,this._z=(d+h)/b):f>a?(b=2*Math.sqrt(1+f-b-a),this._w=(d-h)/b,this._x=(c+e)/b,this._y=.25*b,this._z=(g+k)/b):(b=2*Math.sqrt(1+a-b-f),this._w=(e-c)/b,this._x=(d+h)/b,this._y=(g+k)/b,this._z=.25*b);this._onChangeCallback();return this}; ua.prototype.setFromUnitVectors=function(c,a){var b=c.dot(a)+1;1E-6>b?(b=0,Math.abs(c.x)>Math.abs(c.z)?(this._x=-c.y,this._y=c.x,this._z=0):(this._x=0,this._y=-c.z,this._z=c.y)):(this._x=c.y*a.z-c.z*a.y,this._y=c.z*a.x-c.x*a.z,this._z=c.x*a.y-c.y*a.x);this._w=b;return this.normalize()};ua.prototype.angleTo=function(c){return 2*Math.acos(Math.abs(xa.clamp(this.dot(c),-1,1)))};ua.prototype.rotateTowards=function(c,a){var b=this.angleTo(c);if(0===b)return this;this.slerp(c,Math.min(1,a/b));return this}; ua.prototype.identity=function(){return this.set(0,0,0,1)};ua.prototype.inverse=function(){return this.conjugate()};ua.prototype.conjugate=function(){this._x*=-1;this._y*=-1;this._z*=-1;this._onChangeCallback();return this};ua.prototype.dot=function(c){return this._x*c._x+this._y*c._y+this._z*c._z+this._w*c._w};ua.prototype.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w};ua.prototype.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z* this._z+this._w*this._w)};ua.prototype.normalize=function(){var c=this.length();0===c?(this._z=this._y=this._x=0,this._w=1):(c=1/c,this._x*=c,this._y*=c,this._z*=c,this._w*=c);this._onChangeCallback();return this};ua.prototype.multiply=function(c,a){return void 0!==a?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(c,a)):this.multiplyQuaternions(this,c)};ua.prototype.premultiply=function(c){return this.multiplyQuaternions(c, this)};ua.prototype.multiplyQuaternions=function(c,a){var b=c._x,d=c._y,e=c._z;c=c._w;var f=a._x,g=a._y,h=a._z;a=a._w;this._x=b*a+c*f+d*h-e*g;this._y=d*a+c*g+e*f-b*h;this._z=e*a+c*h+b*g-d*f;this._w=c*a-b*f-d*g-e*h;this._onChangeCallback();return this};ua.prototype.slerp=function(c,a){if(0===a)return this;if(1===a)return this.copy(c);var b=this._x,d=this._y,e=this._z,f=this._w,g=f*c._w+b*c._x+d*c._y+e*c._z;0>g?(this._w=-c._w,this._x=-c._x,this._y=-c._y,this._z=-c._z,g=-g):this.copy(c);if(1<=g)return this._w= f,this._x=b,this._y=d,this._z=e,this;c=1-g*g;if(c<=Number.EPSILON)return g=1-a,this._w=g*f+a*this._w,this._x=g*b+a*this._x,this._y=g*d+a*this._y,this._z=g*e+a*this._z,this.normalize(),this._onChangeCallback(),this;c=Math.sqrt(c);var h=Math.atan2(c,g);g=Math.sin((1-a)*h)/c;a=Math.sin(a*h)/c;this._w=f*g+this._w*a;this._x=b*g+this._x*a;this._y=d*g+this._y*a;this._z=e*g+this._z*a;this._onChangeCallback();return this};ua.prototype.equals=function(c){return c._x===this._x&&c._y===this._y&&c._z===this._z&& c._w===this._w};ua.prototype.fromArray=function(c,a){void 0===a&&(a=0);this._x=c[a];this._y=c[a+1];this._z=c[a+2];this._w=c[a+3];this._onChangeCallback();return this};ua.prototype.toArray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this._x;c[a+1]=this._y;c[a+2]=this._z;c[a+3]=this._w;return c};ua.prototype.fromBufferAttribute=function(c,a){this._x=c.getX(a);this._y=c.getY(a);this._z=c.getZ(a);this._w=c.getW(a);return this};ua.prototype._onChange=function(c){this._onChangeCallback=c;return this}; ua.prototype._onChangeCallback=function(){};Object.defineProperties(ua.prototype,rc);var w=function(c,a,b){void 0===c&&(c=0);void 0===a&&(a=0);void 0===b&&(b=0);Object.defineProperty(this,"isVector3",{value:!0});this.x=c;this.y=a;this.z=b};w.prototype.set=function(c,a,b){void 0===b&&(b=this.z);this.x=c;this.y=a;this.z=b;return this};w.prototype.setScalar=function(c){this.z=this.y=this.x=c;return this};w.prototype.setX=function(c){this.x=c;return this};w.prototype.setY=function(c){this.y=c;return this}; w.prototype.setZ=function(c){this.z=c;return this};w.prototype.setComponent=function(c,a){switch(c){case 0:this.x=a;break;case 1:this.y=a;break;case 2:this.z=a;break;default:throw Error("index is out of range: "+c);}return this};w.prototype.getComponent=function(c){switch(c){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+c);}};w.prototype.clone=function(){return new this.constructor(this.x,this.y,this.z)};w.prototype.copy=function(c){this.x= c.x;this.y=c.y;this.z=c.z;return this};w.prototype.add=function(c,a){if(void 0!==a)return console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(c,a);this.x+=c.x;this.y+=c.y;this.z+=c.z;return this};w.prototype.addScalar=function(c){this.x+=c;this.y+=c;this.z+=c;return this};w.prototype.addVectors=function(c,a){this.x=c.x+a.x;this.y=c.y+a.y;this.z=c.z+a.z;return this};w.prototype.addScaledVector=function(c,a){this.x+=c.x*a;this.y+=c.y* a;this.z+=c.z*a;return this};w.prototype.sub=function(c,a){if(void 0!==a)return console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(c,a);this.x-=c.x;this.y-=c.y;this.z-=c.z;return this};w.prototype.subScalar=function(c){this.x-=c;this.y-=c;this.z-=c;return this};w.prototype.subVectors=function(c,a){this.x=c.x-a.x;this.y=c.y-a.y;this.z=c.z-a.z;return this};w.prototype.multiply=function(c,a){if(void 0!==a)return console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(c,a);this.x*=c.x;this.y*=c.y;this.z*=c.z;return this};w.prototype.multiplyScalar=function(c){this.x*=c;this.y*=c;this.z*=c;return this};w.prototype.multiplyVectors=function(c,a){this.x=c.x*a.x;this.y=c.y*a.y;this.z=c.z*a.z;return this};w.prototype.applyEuler=function(c){c&&c.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.");return this.applyQuaternion(vj.setFromEuler(c))};w.prototype.applyAxisAngle=function(c, a){return this.applyQuaternion(vj.setFromAxisAngle(c,a))};w.prototype.applyMatrix3=function(c){var a=this.x,b=this.y,d=this.z;c=c.elements;this.x=c[0]*a+c[3]*b+c[6]*d;this.y=c[1]*a+c[4]*b+c[7]*d;this.z=c[2]*a+c[5]*b+c[8]*d;return this};w.prototype.applyNormalMatrix=function(c){return this.applyMatrix3(c).normalize()};w.prototype.applyMatrix4=function(c){var a=this.x,b=this.y,d=this.z;c=c.elements;var e=1/(c[3]*a+c[7]*b+c[11]*d+c[15]);this.x=(c[0]*a+c[4]*b+c[8]*d+c[12])*e;this.y=(c[1]*a+c[5]*b+c[9]* d+c[13])*e;this.z=(c[2]*a+c[6]*b+c[10]*d+c[14])*e;return this};w.prototype.applyQuaternion=function(c){var a=this.x,b=this.y,d=this.z,e=c.x,f=c.y,g=c.z;c=c.w;var h=c*a+f*d-g*b,k=c*b+g*a-e*d,l=c*d+e*b-f*a;a=-e*a-f*b-g*d;this.x=h*c+a*-e+k*-g-l*-f;this.y=k*c+a*-f+l*-e-h*-g;this.z=l*c+a*-g+h*-f-k*-e;return this};w.prototype.project=function(c){return this.applyMatrix4(c.matrixWorldInverse).applyMatrix4(c.projectionMatrix)};w.prototype.unproject=function(c){return this.applyMatrix4(c.projectionMatrixInverse).applyMatrix4(c.matrixWorld)}; w.prototype.transformDirection=function(c){var a=this.x,b=this.y,d=this.z;c=c.elements;this.x=c[0]*a+c[4]*b+c[8]*d;this.y=c[1]*a+c[5]*b+c[9]*d;this.z=c[2]*a+c[6]*b+c[10]*d;return this.normalize()};w.prototype.divide=function(c){this.x/=c.x;this.y/=c.y;this.z/=c.z;return this};w.prototype.divideScalar=function(c){return this.multiplyScalar(1/c)};w.prototype.min=function(c){this.x=Math.min(this.x,c.x);this.y=Math.min(this.y,c.y);this.z=Math.min(this.z,c.z);return this};w.prototype.max=function(c){this.x= Math.max(this.x,c.x);this.y=Math.max(this.y,c.y);this.z=Math.max(this.z,c.z);return this};w.prototype.clamp=function(c,a){this.x=Math.max(c.x,Math.min(a.x,this.x));this.y=Math.max(c.y,Math.min(a.y,this.y));this.z=Math.max(c.z,Math.min(a.z,this.z));return this};w.prototype.clampScalar=function(c,a){this.x=Math.max(c,Math.min(a,this.x));this.y=Math.max(c,Math.min(a,this.y));this.z=Math.max(c,Math.min(a,this.z));return this};w.prototype.clampLength=function(c,a){var b=this.length();return this.divideScalar(b|| 1).multiplyScalar(Math.max(c,Math.min(a,b)))};w.prototype.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);this.z=Math.floor(this.z);return this};w.prototype.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);this.z=Math.ceil(this.z);return this};w.prototype.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.z=Math.round(this.z);return this};w.prototype.roundToZero=function(){this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x);this.y=0>this.y? Math.ceil(this.y):Math.floor(this.y);this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z);return this};w.prototype.negate=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this};w.prototype.dot=function(c){return this.x*c.x+this.y*c.y+this.z*c.z};w.prototype.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z};w.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)};w.prototype.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+ Math.abs(this.z)};w.prototype.normalize=function(){return this.divideScalar(this.length()||1)};w.prototype.setLength=function(c){return this.normalize().multiplyScalar(c)};w.prototype.lerp=function(c,a){this.x+=(c.x-this.x)*a;this.y+=(c.y-this.y)*a;this.z+=(c.z-this.z)*a;return this};w.prototype.lerpVectors=function(c,a,b){this.x=c.x+(a.x-c.x)*b;this.y=c.y+(a.y-c.y)*b;this.z=c.z+(a.z-c.z)*b;return this};w.prototype.cross=function(c,a){return void 0!==a?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), this.crossVectors(c,a)):this.crossVectors(this,c)};w.prototype.crossVectors=function(c,a){var b=c.x,d=c.y;c=c.z;var e=a.x,f=a.y;a=a.z;this.x=d*a-c*f;this.y=c*e-b*a;this.z=b*f-d*e;return this};w.prototype.projectOnVector=function(c){var a=c.lengthSq();if(0===a)return this.set(0,0,0);a=c.dot(this)/a;return this.copy(c).multiplyScalar(a)};w.prototype.projectOnPlane=function(c){Yh.copy(this).projectOnVector(c);return this.sub(Yh)};w.prototype.reflect=function(c){return this.sub(Yh.copy(c).multiplyScalar(2* this.dot(c)))};w.prototype.angleTo=function(c){var a=Math.sqrt(this.lengthSq()*c.lengthSq());if(0===a)return Math.PI/2;c=this.dot(c)/a;return Math.acos(xa.clamp(c,-1,1))};w.prototype.distanceTo=function(c){return Math.sqrt(this.distanceToSquared(c))};w.prototype.distanceToSquared=function(c){var a=this.x-c.x,b=this.y-c.y;c=this.z-c.z;return a*a+b*b+c*c};w.prototype.manhattanDistanceTo=function(c){return Math.abs(this.x-c.x)+Math.abs(this.y-c.y)+Math.abs(this.z-c.z)};w.prototype.setFromSpherical=function(c){return this.setFromSphericalCoords(c.radius, c.phi,c.theta)};w.prototype.setFromSphericalCoords=function(c,a,b){var d=Math.sin(a)*c;this.x=d*Math.sin(b);this.y=Math.cos(a)*c;this.z=d*Math.cos(b);return this};w.prototype.setFromCylindrical=function(c){return this.setFromCylindricalCoords(c.radius,c.theta,c.y)};w.prototype.setFromCylindricalCoords=function(c,a,b){this.x=c*Math.sin(a);this.y=b;this.z=c*Math.cos(a);return this};w.prototype.setFromMatrixPosition=function(c){c=c.elements;this.x=c[12];this.y=c[13];this.z=c[14];return this};w.prototype.setFromMatrixScale= function(c){var a=this.setFromMatrixColumn(c,0).length(),b=this.setFromMatrixColumn(c,1).length();c=this.setFromMatrixColumn(c,2).length();this.x=a;this.y=b;this.z=c;return this};w.prototype.setFromMatrixColumn=function(c,a){return this.fromArray(c.elements,4*a)};w.prototype.setFromMatrix3Column=function(c,a){return this.fromArray(c.elements,3*a)};w.prototype.equals=function(c){return c.x===this.x&&c.y===this.y&&c.z===this.z};w.prototype.fromArray=function(c,a){void 0===a&&(a=0);this.x=c[a];this.y= c[a+1];this.z=c[a+2];return this};w.prototype.toArray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);c[a]=this.x;c[a+1]=this.y;c[a+2]=this.z;return c};w.prototype.fromBufferAttribute=function(c,a,b){void 0!==b&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute().");this.x=c.getX(a);this.y=c.getY(a);this.z=c.getZ(a);return this};w.prototype.random=function(){this.x=Math.random();this.y=Math.random();this.z=Math.random();return this};var Yh=new w,vj=new ua,za=function(c, a){Object.defineProperty(this,"isBox3",{value:!0});this.min=void 0!==c?c:new w(Infinity,Infinity,Infinity);this.max=void 0!==a?a:new w(-Infinity,-Infinity,-Infinity)};za.prototype.set=function(c,a){this.min.copy(c);this.max.copy(a);return this};za.prototype.setFromArray=function(c){for(var a=Infinity,b=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,k=c.length;he&&(e=l);m>f&&(f=m);n>g&&(g=n)}this.min.set(a,b,d);this.max.set(e, f,g);return this};za.prototype.setFromBufferAttribute=function(c){for(var a=Infinity,b=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=-Infinity,h=0,k=c.count;he&&(e=l);m>f&&(f=m);n>g&&(g=n)}this.min.set(a,b,d);this.max.set(e,f,g);return this};za.prototype.setFromPoints=function(c){this.makeEmpty();for(var a=0,b=c.length;athis.max.x||c.ythis.max.y||c.zthis.max.z?!1:!0};za.prototype.containsBox=function(c){return this.min.x<=c.min.x&&c.max.x<=this.max.x&&this.min.y<=c.min.y&&c.max.y<=this.max.y&&this.min.z<=c.min.z&&c.max.z<=this.max.z};za.prototype.getParameter=function(c,a){void 0===a&&(console.warn("THREE.Box3: .getParameter() target is now required"),a=new w);return a.set((c.x-this.min.x)/(this.max.x-this.min.x),(c.y-this.min.y)/(this.max.y- this.min.y),(c.z-this.min.z)/(this.max.z-this.min.z))};za.prototype.intersectsBox=function(c){return c.max.xthis.max.x||c.max.ythis.max.y||c.max.zthis.max.z?!1:!0};za.prototype.intersectsSphere=function(c){this.clampPoint(c.center,Cf);return Cf.distanceToSquared(c.center)<=c.radius*c.radius};za.prototype.intersectsPlane=function(c){if(0=-c.constant};za.prototype.intersectsTriangle=function(c){if(this.isEmpty())return!1;this.getCenter(Df);Cg.subVectors(this.max,Df);pe.subVectors(c.a,Df);qe.subVectors(c.b,Df);re.subVectors(c.c,Df);Tc.subVectors(qe,pe);Uc.subVectors(re, qe);sd.subVectors(pe,re);c=[0,-Tc.z,Tc.y,0,-Uc.z,Uc.y,0,-sd.z,sd.y,Tc.z,0,-Tc.x,Uc.z,0,-Uc.x,sd.z,0,-sd.x,-Tc.y,Tc.x,0,-Uc.y,Uc.x,0,-sd.y,sd.x,0];if(!eh(c,pe,qe,re,Cg))return!1;c=[1,0,0,0,1,0,0,0,1];if(!eh(c,pe,qe,re,Cg))return!1;Dg.crossVectors(Tc,Uc);c=[Dg.x,Dg.y,Dg.z];return eh(c,pe,qe,re,Cg)};za.prototype.clampPoint=function(c,a){void 0===a&&(console.warn("THREE.Box3: .clampPoint() target is now required"),a=new w);return a.copy(c).clamp(this.min,this.max)};za.prototype.distanceToPoint=function(c){return Cf.copy(c).clamp(this.min, this.max).sub(c).length()};za.prototype.getBoundingSphere=function(c){void 0===c&&console.error("THREE.Box3: .getBoundingSphere() target is now required");this.getCenter(c.center);c.radius=.5*this.getSize(Cf).length();return c};za.prototype.intersect=function(c){this.min.max(c.min);this.max.min(c.max);this.isEmpty()&&this.makeEmpty();return this};za.prototype.union=function(c){this.min.min(c.min);this.max.max(c.max);return this};za.prototype.applyMatrix4=function(c){if(this.isEmpty())return this; sc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(c);sc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(c);sc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(c);sc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(c);sc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(c);sc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(c);sc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(c);sc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(c);this.setFromPoints(sc); return this};za.prototype.translate=function(c){this.min.add(c);this.max.add(c);return this};za.prototype.equals=function(c){return c.min.equals(this.min)&&c.max.equals(this.max)};var sc=[new w,new w,new w,new w,new w,new w,new w,new w],Cf=new w,Zh=new za,pe=new w,qe=new w,re=new w,Tc=new w,Uc=new w,sd=new w,Df=new w,Cg=new w,Dg=new w,Yc=new w,Ml=new za,Wa=function(c,a){this.center=void 0!==c?c:new w;this.radius=void 0!==a?a:-1};Wa.prototype.set=function(c,a){this.center.copy(c);this.radius=a;return this}; Wa.prototype.setFromPoints=function(c,a){var b=this.center;void 0!==a?b.copy(a):Ml.setFromPoints(c).getCenter(b);for(var d=a=0,e=c.length;dthis.radius};Wa.prototype.makeEmpty=function(){this.center.set(0,0,0);this.radius= -1;return this};Wa.prototype.containsPoint=function(c){return c.distanceToSquared(this.center)<=this.radius*this.radius};Wa.prototype.distanceToPoint=function(c){return c.distanceTo(this.center)-this.radius};Wa.prototype.intersectsSphere=function(c){var a=this.radius+c.radius;return c.center.distanceToSquared(this.center)<=a*a};Wa.prototype.intersectsBox=function(c){return c.intersectsSphere(this)};Wa.prototype.intersectsPlane=function(c){return Math.abs(c.distanceToPoint(this.center))<=this.radius}; Wa.prototype.clampPoint=function(c,a){var b=this.center.distanceToSquared(c);void 0===a&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),a=new w);a.copy(c);b>this.radius*this.radius&&(a.sub(this.center).normalize(),a.multiplyScalar(this.radius).add(this.center));return a};Wa.prototype.getBoundingBox=function(c){void 0===c&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),c=new za);if(this.isEmpty())return c.makeEmpty(),c;c.set(this.center,this.center);c.expandByScalar(this.radius); return c};Wa.prototype.applyMatrix4=function(c){this.center.applyMatrix4(c);this.radius*=c.getMaxScaleOnAxis();return this};Wa.prototype.translate=function(c){this.center.add(c);return this};Wa.prototype.equals=function(c){return c.center.equals(this.center)&&c.radius===this.radius};var tc=new w,$h=new w,Eg=new w,Vc=new w,ai=new w,Fg=new w,bi=new w,Ta=function(c,a){this.origin=void 0!==c?c:new w;this.direction=void 0!==a?a:new w(0,0,-1)};Ta.prototype.set=function(c,a){this.origin.copy(c);this.direction.copy(a); return this};Ta.prototype.clone=function(){return(new this.constructor).copy(this)};Ta.prototype.copy=function(c){this.origin.copy(c.origin);this.direction.copy(c.direction);return this};Ta.prototype.at=function(c,a){void 0===a&&(console.warn("THREE.Ray: .at() target is now required"),a=new w);return a.copy(this.direction).multiplyScalar(c).add(this.origin)};Ta.prototype.lookAt=function(c){this.direction.copy(c).sub(this.origin).normalize();return this};Ta.prototype.recast=function(c){this.origin.copy(this.at(c, tc));return this};Ta.prototype.closestPointToPoint=function(c,a){void 0===a&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),a=new w);a.subVectors(c,this.origin);c=a.dot(this.direction);return 0>c?a.copy(this.origin):a.copy(this.direction).multiplyScalar(c).add(this.origin)};Ta.prototype.distanceToPoint=function(c){return Math.sqrt(this.distanceSqToPoint(c))};Ta.prototype.distanceSqToPoint=function(c){var a=tc.subVectors(c,this.origin).dot(this.direction);if(0>a)return this.origin.distanceToSquared(c); tc.copy(this.direction).multiplyScalar(a).add(this.origin);return tc.distanceToSquared(c)};Ta.prototype.distanceSqToSegment=function(c,a,b,d){$h.copy(c).add(a).multiplyScalar(.5);Eg.copy(a).sub(c).normalize();Vc.copy(this.origin).sub($h);var e=.5*c.distanceTo(a),f=-this.direction.dot(Eg),g=Vc.dot(this.direction),h=-Vc.dot(Eg),k=Vc.lengthSq(),l=Math.abs(1-f*f);if(0=-m?a<=m?(e=1/l,c*=e,a*=e,f=c*(c+f*a+2*g)+a*(f*c+a+2*h)+k):(a=e,c=Math.max(0,-(f*a+g)),f=-c*c+a*(a+ 2*h)+k):(a=-e,c=Math.max(0,-(f*a+g)),f=-c*c+a*(a+2*h)+k):a<=-m?(c=Math.max(0,-(-f*e+g)),a=0c)return null;c=Math.sqrt(c-d);d=b-c;b+=c;return 0>d&&0>b?null:0>d?this.at(b,a):this.at(d,a)};Ta.prototype.intersectsSphere=function(c){return this.distanceSqToPoint(c.center)<=c.radius*c.radius};Ta.prototype.distanceToPlane=function(c){var a=c.normal.dot(this.direction);if(0===a)return 0===c.distanceToPoint(this.origin)?0:null;c=-(this.origin.dot(c.normal)+c.constant)/a;return 0<=c?c:null};Ta.prototype.intersectPlane= function(c,a){c=this.distanceToPlane(c);return null===c?null:this.at(c,a)};Ta.prototype.intersectsPlane=function(c){var a=c.distanceToPoint(this.origin);return 0===a||0>c.normal.dot(this.direction)*a?!0:!1};Ta.prototype.intersectBox=function(c,a){var b=1/this.direction.x;var d=1/this.direction.y;var e=1/this.direction.z,f=this.origin;if(0<=b){var g=(c.min.x-f.x)*b;b*=c.max.x-f.x}else g=(c.max.x-f.x)*b,b*=c.min.x-f.x;if(0<=d){var h=(c.min.y-f.y)*d;d*=c.max.y-f.y}else h=(c.max.y-f.y)*d,d*=c.min.y-f.y; if(g>d||h>b)return null;if(h>g||g!==g)g=h;if(dc||h>b)return null;if(h>g||g!==g)g=h;if(cb?null:this.at(0<=g?g:b,a)};Ta.prototype.intersectsBox=function(c){return null!==this.intersectBox(c,tc)};Ta.prototype.intersectTriangle=function(c,a,b,d,e){ai.subVectors(a,c);Fg.subVectors(b,c);bi.crossVectors(ai,Fg);a=this.direction.dot(bi);if(0a)d=-1,a= -a;else return null;Vc.subVectors(this.origin,c);c=d*this.direction.dot(Fg.crossVectors(Vc,Fg));if(0>c)return null;b=d*this.direction.dot(ai.cross(Vc));if(0>b||c+b>a)return null;c=-d*Vc.dot(bi);return 0>c?null:this.at(c/a,e)};Ta.prototype.applyMatrix4=function(c){this.origin.applyMatrix4(c);this.direction.transformDirection(c);return this};Ta.prototype.equals=function(c){return c.origin.equals(this.origin)&&c.direction.equals(this.direction)};var da=function(){Object.defineProperty(this,"isMatrix4", {value:!0});this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];0this.determinant()&&(e=-e);c.x=d[12];c.y=d[13];c.z=d[14];gb.copy(this);c=1/e;d=1/f;var h=1/g;gb.elements[0]*= c;gb.elements[1]*=c;gb.elements[2]*=c;gb.elements[4]*=d;gb.elements[5]*=d;gb.elements[6]*=d;gb.elements[8]*=h;gb.elements[9]*=h;gb.elements[10]*=h;a.setFromRotationMatrix(gb);b.x=e;b.y=f;b.z=g;return this};da.prototype.makePerspective=function(c,a,b,d,e,f){void 0===f&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var g=this.elements;g[0]=2*e/(a-c);g[4]=0;g[8]=(a+c)/(a-c);g[12]=0;g[1]=0;g[5]=2*e/(b-d);g[9]=(b+d)/(b-d);g[13]=0;g[2]= 0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this};da.prototype.makeOrthographic=function(c,a,b,d,e,f){var g=this.elements,h=1/(a-c),k=1/(b-d),l=1/(f-e);g[0]=2*h;g[4]=0;g[8]=0;g[12]=-((a+c)*h);g[1]=0;g[5]=2*k;g[9]=0;g[13]=-((b+d)*k);g[2]=0;g[6]=0;g[10]=-2*l;g[14]=-((f+e)*l);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this};da.prototype.equals=function(c){var a=this.elements;c=c.elements;for(var b=0;16>b;b++)if(a[b]!==c[b])return!1;return!0};da.prototype.fromArray= function(c,a){void 0===a&&(a=0);for(var b=0;16>b;b++)this.elements[b]=c[b+a];return this};da.prototype.toArray=function(c,a){void 0===c&&(c=[]);void 0===a&&(a=0);var b=this.elements;c[a]=b[0];c[a+1]=b[1];c[a+2]=b[2];c[a+3]=b[3];c[a+4]=b[4];c[a+5]=b[5];c[a+6]=b[6];c[a+7]=b[7];c[a+8]=b[8];c[a+9]=b[9];c[a+10]=b[10];c[a+11]=b[11];c[a+12]=b[12];c[a+13]=b[13];c[a+14]=b[14];c[a+15]=b[15];return c};var se=new w,gb=new da,Nl=new w(0,0,0),Ol=new w(1,1,1),Wc=new w,Gg=new w,ub=new w,hb=function f(a,b,d,e){void 0=== a&&(a=0);void 0===b&&(b=0);void 0===d&&(d=0);void 0===e&&(e=f.DefaultOrder);Object.defineProperty(this,"isEuler",{value:!0});this._x=a;this._y=b;this._z=d;this._order=e},uc={x:{configurable:!0},y:{configurable:!0},z:{configurable:!0},order:{configurable:!0}};uc.x.get=function(){return this._x};uc.x.set=function(a){this._x=a;this._onChangeCallback()};uc.y.get=function(){return this._y};uc.y.set=function(a){this._y=a;this._onChangeCallback()};uc.z.get=function(){return this._z};uc.z.set=function(a){this._z= a;this._onChangeCallback()};uc.order.get=function(){return this._order};uc.order.set=function(a){this._order=a;this._onChangeCallback()};hb.prototype.set=function(a,b,d,e){this._x=a;this._y=b;this._z=d;this._order=e||this._order;this._onChangeCallback();return this};hb.prototype.clone=function(){return new this.constructor(this._x,this._y,this._z,this._order)};hb.prototype.copy=function(a){this._x=a._x;this._y=a._y;this._z=a._z;this._order=a._order;this._onChangeCallback();return this};hb.prototype.setFromRotationMatrix= function(a,b,d){var e=xa.clamp,f=a.elements;a=f[0];var g=f[4],h=f[8],k=f[1],l=f[5],m=f[9],n=f[2],p=f[6];f=f[10];b=b||this._order;switch(b){case "XYZ":this._y=Math.asin(e(h,-1,1));.9999999>Math.abs(h)?(this._x=Math.atan2(-m,f),this._z=Math.atan2(-g,a)):(this._x=Math.atan2(p,l),this._z=0);break;case "YXZ":this._x=Math.asin(-e(m,-1,1));.9999999>Math.abs(m)?(this._y=Math.atan2(h,f),this._z=Math.atan2(k,l)):(this._y=Math.atan2(-n,a),this._z=0);break;case "ZXY":this._x=Math.asin(e(p,-1,1));.9999999>Math.abs(p)? (this._y=Math.atan2(-n,f),this._z=Math.atan2(-g,l)):(this._y=0,this._z=Math.atan2(k,a));break;case "ZYX":this._y=Math.asin(-e(n,-1,1));.9999999>Math.abs(n)?(this._x=Math.atan2(p,f),this._z=Math.atan2(k,a)):(this._x=0,this._z=Math.atan2(-g,l));break;case "YZX":this._z=Math.asin(e(k,-1,1));.9999999>Math.abs(k)?(this._x=Math.atan2(-m,l),this._y=Math.atan2(-n,a)):(this._x=0,this._y=Math.atan2(h,f));break;case "XZY":this._z=Math.asin(-e(g,-1,1));.9999999>Math.abs(g)?(this._x=Math.atan2(p,l),this._y=Math.atan2(h, a)):(this._x=Math.atan2(-m,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+b)}this._order=b;!1!==d&&this._onChangeCallback();return this};hb.prototype.setFromQuaternion=function(a,b,d){wj.makeRotationFromQuaternion(a);return this.setFromRotationMatrix(wj,b,d)};hb.prototype.setFromVector3=function(a,b){return this.set(a.x,a.y,a.z,b||this._order)};hb.prototype.reorder=function(a){xj.setFromEuler(this);return this.setFromQuaternion(xj,a)}; hb.prototype.equals=function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order};hb.prototype.fromArray=function(a){this._x=a[0];this._y=a[1];this._z=a[2];void 0!==a[3]&&(this._order=a[3]);this._onChangeCallback();return this};hb.prototype.toArray=function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);a[b]=this._x;a[b+1]=this._y;a[b+2]=this._z;a[b+3]=this._order;return a};hb.prototype.toVector3=function(a){return a?a.set(this._x,this._y,this._z):new w(this._x,this._y,this._z)}; hb.prototype._onChange=function(a){this._onChangeCallback=a;return this};hb.prototype._onChangeCallback=function(){};Object.defineProperties(hb.prototype,uc);hb.DefaultOrder="XYZ";hb.RotationOrders="XYZ YZX ZXY XZY YXZ ZYX".split(" ");var wj=new da,xj=new ua,$b=function(){this.mask=1};$b.prototype.set=function(a){this.mask=1<e||1b&&0a&&0=xc.x+xc.y};Ga.getUV=function(a,b,d,e,f,g,h,k){this.getBarycoord(a,b,d,e,xc);k.set(0,0);k.addScaledVector(f, xc.x);k.addScaledVector(g,xc.y);k.addScaledVector(h,xc.z);return k};Ga.isFrontFacing=function(a,b,d,e){Yb.subVectors(d,b);wc.subVectors(a,b);return 0>Yb.cross(wc).dot(e)?!0:!1};Ga.prototype.set=function(a,b,d){this.a.copy(a);this.b.copy(b);this.c.copy(d);return this};Ga.prototype.setFromPointsAndIndices=function(a,b,d,e){this.a.copy(a[b]);this.b.copy(a[d]);this.c.copy(a[e]);return this};Ga.prototype.clone=function(){return(new this.constructor).copy(this)};Ga.prototype.copy=function(a){this.a.copy(a.a); this.b.copy(a.b);this.c.copy(a.c);return this};Ga.prototype.getArea=function(){Yb.subVectors(this.c,this.b);wc.subVectors(this.a,this.b);return.5*Yb.cross(wc).length()};Ga.prototype.getMidpoint=function(a){void 0===a&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),a=new w);return a.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)};Ga.prototype.getNormal=function(a){return Ga.getNormal(this.a,this.b,this.c,a)};Ga.prototype.getPlane=function(a){void 0===a&&(console.warn("THREE.Triangle: .getPlane() target is now required"), a=new Na);return a.setFromCoplanarPoints(this.a,this.b,this.c)};Ga.prototype.getBarycoord=function(a,b){return Ga.getBarycoord(a,this.a,this.b,this.c,b)};Ga.prototype.getUV=function(a,b,d,e,f){return Ga.getUV(a,this.a,this.b,this.c,b,d,e,f)};Ga.prototype.containsPoint=function(a){return Ga.containsPoint(a,this.a,this.b,this.c)};Ga.prototype.isFrontFacing=function(a){return Ga.isFrontFacing(this.a,this.b,this.c,a)};Ga.prototype.intersectsBox=function(a){return a.intersectsTriangle(this)};Ga.prototype.closestPointToPoint= function(a,b){void 0===b&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),b=new w);var d=this.a,e=this.b,f=this.c;ue.subVectors(e,d);ve.subVectors(f,d);ei.subVectors(a,d);var g=ue.dot(ei),h=ve.dot(ei);if(0>=g&&0>=h)return b.copy(d);fi.subVectors(a,e);var k=ue.dot(fi),l=ve.dot(fi);if(0<=k&&l<=k)return b.copy(e);var m=g*l-k*h;if(0>=m&&0<=g&&0>=k)return e=g/(g-k),b.copy(d).addScaledVector(ue,e);gi.subVectors(a,f);a=ue.dot(gi);var n=ve.dot(gi);if(0<=n&&a<=n)return b.copy(f); g=a*h-g*n;if(0>=g&&0<=h&&0>=n)return m=h/(h-n),b.copy(d).addScaledVector(ve,m);h=k*n-a*l;if(0>=h&&0<=l-k&&0<=a-n)return Cj.subVectors(f,e),m=(l-k)/(l-k+(a-n)),b.copy(e).addScaledVector(Cj,m);f=1/(h+g+m);e=g*f;m*=f;return b.copy(d).addScaledVector(ue,e).addScaledVector(ve,m)};Ga.prototype.equals=function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)};var Dj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0, blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347, darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365, lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683, mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910, purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074}, Bb={h:0,s:0,l:0},Ig={h:0,s:0,l:0},S=function(a,b,d){Object.defineProperty(this,"isColor",{value:!0});return void 0===b&&void 0===d?this.set(a):this.setRGB(a,b,d)};S.prototype.set=function(a){a&&a.isColor?this.copy(a):"number"===typeof a?this.setHex(a):"string"===typeof a&&this.setStyle(a);return this};S.prototype.setScalar=function(a){this.b=this.g=this.r=a;return this};S.prototype.setHex=function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this};S.prototype.setRGB= function(a,b,d){this.r=a;this.g=b;this.b=d;return this};S.prototype.setHSL=function(a,b,d){a=xa.euclideanModulo(a,1);b=xa.clamp(b,0,1);d=xa.clamp(d,0,1);0===b?this.r=this.g=this.b=d:(b=.5>=d?d*(1+b):d+b-d*b,d=2*d-b,this.r=fh(d,b,a+1/3),this.g=fh(d,b,a),this.b=fh(d,b,a-1/3));return this};S.prototype.setStyle=function(a){function b(h){void 0!==h&&1>parseFloat(h)&&console.warn("THREE.Color: Alpha component of "+a+" will be ignored.")}var d;if(d=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(a)){var e=d[2];switch(d[1]){case "rgb":case "rgba":if(d= /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e))return this.r=Math.min(255,parseInt(d[1],10))/255,this.g=Math.min(255,parseInt(d[2],10))/255,this.b=Math.min(255,parseInt(d[3],10))/255,b(d[5]),this;if(d=/^(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e))return this.r=Math.min(100,parseInt(d[1],10))/100,this.g=Math.min(100,parseInt(d[2],10))/100,this.b=Math.min(100,parseInt(d[3],10))/100,b(d[5]),this;break;case "hsl":case "hsla":if(d=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(e)){e= parseFloat(d[1])/360;var f=parseInt(d[2],10)/100,g=parseInt(d[3],10)/100;b(d[5]);return this.setHSL(e,f,g)}}}else if(d=/^#([A-Fa-f0-9]+)$/.exec(a)){d=d[1];e=d.length;if(3===e)return this.r=parseInt(d.charAt(0)+d.charAt(0),16)/255,this.g=parseInt(d.charAt(1)+d.charAt(1),16)/255,this.b=parseInt(d.charAt(2)+d.charAt(2),16)/255,this;if(6===e)return this.r=parseInt(d.charAt(0)+d.charAt(1),16)/255,this.g=parseInt(d.charAt(2)+d.charAt(3),16)/255,this.b=parseInt(d.charAt(4)+d.charAt(5),16)/255,this}return a&& 0=k?l/(f+g):l/(2-f-g);switch(f){case b:h=(d-e)/l+(dthis.opacity&&(e.opacity=this.opacity);!0===this.transparent&&(e.transparent=this.transparent);e.depthFunc=this.depthFunc;e.depthTest=this.depthTest;e.depthWrite=this.depthWrite;e.stencilWrite=this.stencilWrite;e.stencilWriteMask= this.stencilWriteMask;e.stencilFunc=this.stencilFunc;e.stencilRef=this.stencilRef;e.stencilFuncMask=this.stencilFuncMask;e.stencilFail=this.stencilFail;e.stencilZFail=this.stencilZFail;e.stencilZPass=this.stencilZPass;this.rotation&&0!==this.rotation&&(e.rotation=this.rotation);!0===this.polygonOffset&&(e.polygonOffset=!0);0!==this.polygonOffsetFactor&&(e.polygonOffsetFactor=this.polygonOffsetFactor);0!==this.polygonOffsetUnits&&(e.polygonOffsetUnits=this.polygonOffsetUnits);this.linewidth&&1!==this.linewidth&& (e.linewidth=this.linewidth);void 0!==this.dashSize&&(e.dashSize=this.dashSize);void 0!==this.gapSize&&(e.gapSize=this.gapSize);void 0!==this.scale&&(e.scale=this.scale);!0===this.dithering&&(e.dithering=!0);0h;h++)if(g[h]===g[(h+1)%3]){a.push(e);break}for(d=a.length-1;0<=d;d--)for(e=a[d],this.faces.splice(e,1),f=0,g=this.faceVertexUvs.length;f\n\t\t\t\t#include \n\n\t\t\t}\n\t\t", fragmentShader:"\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t",side:1,blending:0});e.uniforms.tEquirect.value=b;d=new Qa(d,e);e=b.minFilter;1008===b.minFilter&&(b.minFilter=1006);(new Hd(1,10,this)).update(a,d);b.minFilter=e;d.geometry.dispose(); d.material.dispose();return this};bd.prototype=Object.create(Oa.prototype);bd.prototype.constructor=bd;bd.prototype.isDataTexture=!0;var xe=new Wa,Lg=new w,xb=function(a,b,d,e,f,g){this.planes=[void 0!==a?a:new Na,void 0!==b?b:new Na,void 0!==d?d:new Na,void 0!==e?e:new Na,void 0!==f?f:new Na,void 0!==g?g:new Na]};xb.prototype.set=function(a,b,d,e,f,g){var h=this.planes;h[0].copy(a);h[1].copy(b);h[2].copy(d);h[3].copy(e);h[4].copy(f);h[5].copy(g);return this};xb.prototype.clone=function(){return(new this.constructor).copy(this)}; xb.prototype.copy=function(a){for(var b=this.planes,d=0;6>d;d++)b[d].copy(a.planes[d]);return this};xb.prototype.setFromProjectionMatrix=function(a){var b=this.planes,d=a.elements;a=d[0];var e=d[1],f=d[2],g=d[3],h=d[4],k=d[5],l=d[6],m=d[7],n=d[8],p=d[9],t=d[10],q=d[11],v=d[12],u=d[13],A=d[14];d=d[15];b[0].setComponents(g-a,m-h,q-n,d-v).normalize();b[1].setComponents(g+a,m+h,q+n,d+v).normalize();b[2].setComponents(g+e,m+k,q+p,d+u).normalize();b[3].setComponents(g-e,m-k,q-p,d-u).normalize();b[4].setComponents(g- f,m-l,q-t,d-A).normalize();b[5].setComponents(g+f,m+l,q+t,d+A).normalize();return this};xb.prototype.intersectsObject=function(a){var b=a.geometry;null===b.boundingSphere&&b.computeBoundingSphere();xe.copy(b.boundingSphere).applyMatrix4(a.matrixWorld);return this.intersectsSphere(xe)};xb.prototype.intersectsSprite=function(a){xe.center.set(0,0,0);xe.radius=.7071067811865476;xe.applyMatrix4(a.matrixWorld);return this.intersectsSphere(xe)};xb.prototype.intersectsSphere=function(a){var b=this.planes, d=a.center;a=-a.radius;for(var e=0;6>e;e++)if(b[e].distanceToPoint(d)d;d++){var e=b[d];Lg.x=0e.distanceToPoint(Lg))return!1}return!0};xb.prototype.containsPoint=function(a){for(var b=this.planes,d=0;6>d;d++)if(0>b[d].distanceToPoint(a))return!1;return!0};Je.prototype=Object.create(sa.prototype);Je.prototype.constructor= Je;cd.prototype=Object.create(ka.prototype);cd.prototype.constructor=cd;var Ba={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",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( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif", aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\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}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\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 vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\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#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif", bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif", clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif", clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif", color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\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}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}", cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif", defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif", displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif", emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",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.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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.a );\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.a );\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.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, 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.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.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 = cLogLuvM * value.rgb;\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 = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}", envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif", envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif", envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\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\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 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 roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, 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\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif", envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif", fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\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",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", gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif", 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 = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\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\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif", lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\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};\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};\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};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif", lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)", lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial 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\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)", lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif", lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\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 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}", lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif", lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif", lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif", logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif", map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif", map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif", morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif", morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif", normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;", normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif", normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif", clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif", packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float 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}", premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif", roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\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", shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif", shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif", shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}", skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp 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", skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif", specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, 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\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\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}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }", transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif", uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif", background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}", cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}", depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}", distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}", distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}", equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}", linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \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 \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}", meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}", meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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 \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \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#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}", normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}", normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}", points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}", points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}", shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}", sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}", sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"}, fa={common:{diffuse:{value:new S(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Da},uv2Transform:{value:new Da},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null}, bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new L(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:2.5E-4},fogNear:{value:1},fogFar:{value:2E3},fogColor:{value:new S(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{}, color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{}, position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new S(15658734)},opacity:{value:1},size:{value:1}, scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Da}},sprite:{diffuse:{value:new S(15658734)},opacity:{value:1},center:{value:new L(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Da}}},Pb={basic:{uniforms:nb([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.fog]),vertexShader:Ba.meshbasic_vert,fragmentShader:Ba.meshbasic_frag},lambert:{uniforms:nb([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap, fa.fog,fa.lights,{emissive:{value:new S(0)}}]),vertexShader:Ba.meshlambert_vert,fragmentShader:Ba.meshlambert_frag},phong:{uniforms:nb([fa.common,fa.specularmap,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap,fa.normalmap,fa.displacementmap,fa.fog,fa.lights,{emissive:{value:new S(0)},specular:{value:new S(1118481)},shininess:{value:30}}]),vertexShader:Ba.meshphong_vert,fragmentShader:Ba.meshphong_frag},standard:{uniforms:nb([fa.common,fa.envmap,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap, fa.normalmap,fa.displacementmap,fa.roughnessmap,fa.metalnessmap,fa.fog,fa.lights,{emissive:{value:new S(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ba.meshphysical_vert,fragmentShader:Ba.meshphysical_frag},toon:{uniforms:nb([fa.common,fa.aomap,fa.lightmap,fa.emissivemap,fa.bumpmap,fa.normalmap,fa.displacementmap,fa.gradientmap,fa.fog,fa.lights,{emissive:{value:new S(0)}}]),vertexShader:Ba.meshtoon_vert,fragmentShader:Ba.meshtoon_frag},matcap:{uniforms:nb([fa.common, fa.bumpmap,fa.normalmap,fa.displacementmap,fa.fog,{matcap:{value:null}}]),vertexShader:Ba.meshmatcap_vert,fragmentShader:Ba.meshmatcap_frag},points:{uniforms:nb([fa.points,fa.fog]),vertexShader:Ba.points_vert,fragmentShader:Ba.points_frag},dashed:{uniforms:nb([fa.common,fa.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ba.linedashed_vert,fragmentShader:Ba.linedashed_frag},depth:{uniforms:nb([fa.common,fa.displacementmap]),vertexShader:Ba.depth_vert,fragmentShader:Ba.depth_frag}, normal:{uniforms:nb([fa.common,fa.bumpmap,fa.normalmap,fa.displacementmap,{opacity:{value:1}}]),vertexShader:Ba.normal_vert,fragmentShader:Ba.normal_frag},sprite:{uniforms:nb([fa.sprite,fa.fog]),vertexShader:Ba.sprite_vert,fragmentShader:Ba.sprite_frag},background:{uniforms:{uvTransform:{value:new Da},t2D:{value:null}},vertexShader:Ba.background_vert,fragmentShader:Ba.background_frag},cube:{uniforms:nb([fa.envmap,{opacity:{value:1}}]),vertexShader:Ba.cube_vert,fragmentShader:Ba.cube_frag},equirect:{uniforms:{tEquirect:{value:null}}, vertexShader:Ba.equirect_vert,fragmentShader:Ba.equirect_frag},distanceRGBA:{uniforms:nb([fa.common,fa.displacementmap,{referencePosition:{value:new w},nearDistance:{value:1},farDistance:{value:1E3}}]),vertexShader:Ba.distanceRGBA_vert,fragmentShader:Ba.distanceRGBA_frag},shadow:{uniforms:nb([fa.lights,fa.fog,{color:{value:new S(0)},opacity:{value:1}}]),vertexShader:Ba.shadow_vert,fragmentShader:Ba.shadow_frag}};Pb.physical={uniforms:nb([Pb.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null}, clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new L(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new S(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:Ba.meshphysical_vert,fragmentShader:Ba.meshphysical_frag};kc.prototype=Object.create(Oa.prototype);kc.prototype.constructor=kc;kc.prototype.isCubeTexture=!0;Object.defineProperty(kc.prototype,"images",{get:function(){return this.image},set:function(a){this.image=a}});Id.prototype= Object.create(Oa.prototype);Id.prototype.constructor=Id;Id.prototype.isDataTexture2DArray=!0;Jd.prototype=Object.create(Oa.prototype);Jd.prototype.constructor=Jd;Jd.prototype.isDataTexture3D=!0;var Ei=new Oa,Kk=new Id,Mk=new Jd,Fi=new kc,yi=[],Ai=[],Di=new Float32Array(16),Ci=new Float32Array(9),Bi=new Float32Array(4);Gi.prototype.updateCache=function(a){var b=this.cache;a instanceof Float32Array&&b.length!==a.length&&(this.cache=new Float32Array(a.length));Eb(b,a)};Hi.prototype.setValue=function(a, b,d){for(var e=this.seq,f=0,g=e.length;f!==g;++f){var h=e[f];h.setValue(a,b[h.id],d)}};var lh=/([\w\d_]+)(\])?(\[|\.)?/g;Dc.prototype.setValue=function(a,b,d,e){b=this.map[b];void 0!==b&&b.setValue(a,d,e)};Dc.prototype.setOptional=function(a,b,d){b=b[d];void 0!==b&&this.setValue(a,d,b)};Dc.upload=function(a,b,d,e){for(var f=0,g=b.length;f!==g;++f){var h=b[f],k=d[h.id];!1!==k.needsUpdate&&h.setValue(a,k.value,e)}};Dc.seqWithValue=function(a,b){for(var d=[],e=0,f=a.length;e!==f;++e){var g=a[e];g.id in b&&d.push(g)}return d};var ql=0,nh=/^[ \t]*#include +<([\w\d./]+)>/gm,Qi=/#pragma unroll_loop[\s]+?for \( int i = (\d+); i < (\d+); i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Pi=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g,Al=0;Ec.prototype=Object.create(ra.prototype);Ec.prototype.constructor=Ec;Ec.prototype.isMeshDepthMaterial=!0;Ec.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.depthPacking=a.depthPacking; this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;return this};Fc.prototype=Object.create(ra.prototype);Fc.prototype.constructor=Fc;Fc.prototype.isMeshDistanceMaterial=!0;Fc.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.referencePosition.copy(a.referencePosition); this.nearDistance=a.nearDistance;this.farDistance=a.farDistance;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.map=a.map;this.alphaMap=a.alphaMap;this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;return this};Tf.prototype=Object.assign(Object.create(eb.prototype),{constructor:Tf,isArrayCamera:!0});Gc.prototype=Object.assign(Object.create(ha.prototype),{constructor:Gc,isGroup:!0});Object.assign(Me.prototype,{constructor:Me, getHandSpace:function(){if(null===this._hand&&(this._hand=new Gc,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints=[],this._hand.inputState={pinching:!1},window.XRHand))for(var a=0;a<=window.XRHand.LITTLE_PHALANX_TIP;a++){var b=new Gc;b.matrixAutoUpdate=!1;b.visible=!1;this._hand.joints.push(b);this._hand.add(b)}return this._hand},getTargetRaySpace:function(){null===this._targetRay&&(this._targetRay=new Gc,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1);return this._targetRay}, getGripSpace:function(){null===this._grip&&(this._grip=new Gc,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1);return this._grip},dispatchEvent:function(a){null!==this._targetRay&&this._targetRay.dispatchEvent(a);null!==this._grip&&this._grip.dispatchEvent(a);null!==this._hand&&this._hand.dispatchEvent(a);return this},disconnect:function(a){this.dispatchEvent({type:"disconnected",data:a});null!==this._targetRay&&(this._targetRay.visible=!1);null!==this._grip&&(this._grip.visible=!1);null!==this._hand&& (this._hand.visible=!1);return this},update:function(a,b,d){var e=null,f=null,g=null,h=this._targetRay,k=this._grip,l=this._hand;if(a)if(l&&a.hand){g=!0;for(var m=0;m<=window.XRHand.LITTLE_PHALANX_TIP;m++)if(a.hand[m]){var n=b.getJointPose(a.hand[m],d),p=l.joints[m];null!==n&&(p.matrix.fromArray(n.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.jointRadius=n.radius);p.visible=null!==n;n=l.joints[window.XRHand.INDEX_PHALANX_TIP].position.distanceTo(l.joints[window.XRHand.THUMB_PHALANX_TIP].position); l.inputState.pinching&&.025=n&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:a.handedness,target:this}))}}else null!==h&&(e=b.getPose(a.targetRaySpace,d),null!==e&&(h.matrix.fromArray(e.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale))),null!==k&&a.gripSpace&&(f=b.getPose(a.gripSpace,d),null!==f&&(k.matrix.fromArray(f.transform.matrix), k.matrix.decompose(k.position,k.rotation,k.scale)));null!==h&&(h.visible=null!==e);null!==k&&(k.visible=null!==f);null!==l&&(l.visible=null!==g);return this}});Object.assign(Wi.prototype,wb.prototype);th.prototype=Object.assign(Object.create(Ne.prototype),{constructor:th,isWebGL1Renderer:!0});var Gf=function(a,b){Object.defineProperty(this,"isFogExp2",{value:!0});this.name="";this.color=new S(a);this.density=void 0!==b?b:2.5E-4};Gf.prototype.clone=function(){return new Gf(this.color,this.density)}; Gf.prototype.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}};var Hf=function(a,b,d){Object.defineProperty(this,"isFog",{value:!0});this.name="";this.color=new S(a);this.near=void 0!==b?b:1;this.far=void 0!==d?d:1E3};Hf.prototype.clone=function(){return new Hf(this.color,this.near,this.far)};Hf.prototype.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}};Jc.prototype=Object.create(ha.prototype);Jc.prototype.constructor= Jc;Jc.prototype.copy=function(a,b){ha.prototype.copy.call(this,a,b);null!==a.background&&(this.background=a.background.clone());null!==a.environment&&(this.environment=a.environment.clone());null!==a.fog&&(this.fog=a.fog.clone());null!==a.overrideMaterial&&(this.overrideMaterial=a.overrideMaterial.clone());this.autoUpdate=a.autoUpdate;this.matrixAutoUpdate=a.matrixAutoUpdate;return this};Jc.prototype.toJSON=function(a){var b=ha.prototype.toJSON.call(this,a);null!==this.background&&(b.object.background= this.background.toJSON(a));null!==this.environment&&(b.object.environment=this.environment.toJSON(a));null!==this.fog&&(b.object.fog=this.fog.toJSON());return b};Object.defineProperty(Gb.prototype,"needsUpdate",{set:function(a){!0===a&&this.version++}});Object.assign(Gb.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(a){this.usage=a;return this},copy:function(a){this.array=new a.array.constructor(a.array);this.count=a.count;this.stride=a.stride;this.usage=a.usage; return this},copyAt:function(a,b,d){a*=this.stride;d*=b.stride;for(var e=0,f=this.stride;ea.far||b.push({distance:f,point:If.clone(),uv:Ga.getUV(If,Mg,Jf,Ng,Fj,li,Gj,new L),face:null,object:this})},copy:function(a){ha.prototype.copy.call(this, a);void 0!==a.center&&this.center.copy(a.center);this.material=a.material;return this}});var Og=new w,Hj=new w;Se.prototype=Object.assign(Object.create(ha.prototype),{constructor:Se,isLOD:!0,copy:function(a){ha.prototype.copy.call(this,a,!1);for(var b=a.levels,d=0,e=b.length;d=b[e].distance)b[e-1].object.visible=!1,b[e].object.visible=!0;else break;for(this._currentLevel=e-1;eg;g++)if(l=d.getComponent(g),0!==l){var m=b.getComponent(g);f.multiplyMatrices(k.bones[m].matrixWorld, k.boneInverses[m]);h.addScaledVector(e.copy(a).applyMatrix4(f),l)}return h.applyMatrix4(this.bindMatrixInverse)}}()});var Ij=new da,Vl=new da;Object.assign(Yf.prototype,{calculateInverses:function(){this.boneInverses=[];for(var a=0,b=this.bones.length;ae||(k.applyMatrix4(this.matrixWorld),t=a.ray.origin.distanceTo(k),ta.far||b.push({distance:t,point:f.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this}))}}else for(m=0,n=d.length/3-1;me||(k.applyMatrix4(this.matrixWorld),p=a.ray.origin.distanceTo(k),pa.far||b.push({distance:p,point:f.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else if(d.isGeometry)for(g=d.vertices,h=g.length,d=0;de||(k.applyMatrix4(this.matrixWorld),m=a.ray.origin.distanceTo(k),ma.far||b.push({distance:m,point:f.clone().applyMatrix4(this.matrixWorld), index:d,face:null,faceIndex:null,object:this}))}},updateMorphTargets:function(){var a=this.geometry;if(a.isBufferGeometry){a=a.morphAttributes;var b=Object.keys(a);if(0=a.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});Qd.prototype=Object.create(Oa.prototype);Qd.prototype.constructor=Qd;Qd.prototype.isCompressedTexture=!0;Te.prototype=Object.create(Oa.prototype);Te.prototype.constructor=Te;Te.prototype.isCanvasTexture=!0;Ue.prototype=Object.create(Oa.prototype);Ue.prototype.constructor=Ue;Ue.prototype.isDepthTexture=!0;Rd.prototype=Object.create(ka.prototype); Rd.prototype.constructor=Rd;Ve.prototype=Object.create(sa.prototype);Ve.prototype.constructor=Ve;Sd.prototype=Object.create(ka.prototype);Sd.prototype.constructor=Sd;We.prototype=Object.create(sa.prototype);We.prototype.constructor=We;zb.prototype=Object.create(ka.prototype);zb.prototype.constructor=zb;Xe.prototype=Object.create(sa.prototype);Xe.prototype.constructor=Xe;Td.prototype=Object.create(zb.prototype);Td.prototype.constructor=Td;Ye.prototype=Object.create(sa.prototype);Ye.prototype.constructor= Ye;fd.prototype=Object.create(zb.prototype);fd.prototype.constructor=fd;Ze.prototype=Object.create(sa.prototype);Ze.prototype.constructor=Ze;Ud.prototype=Object.create(zb.prototype);Ud.prototype.constructor=Ud;$e.prototype=Object.create(sa.prototype);$e.prototype.constructor=$e;Vd.prototype=Object.create(zb.prototype);Vd.prototype.constructor=Vd;af.prototype=Object.create(sa.prototype);af.prototype.constructor=af;gd.prototype=Object.create(ka.prototype);gd.prototype.constructor=gd;gd.prototype.toJSON= function(){var a=ka.prototype.toJSON.call(this);a.path=this.parameters.path.toJSON();return a};bf.prototype=Object.create(sa.prototype);bf.prototype.constructor=bf;Wd.prototype=Object.create(ka.prototype);Wd.prototype.constructor=Wd;cf.prototype=Object.create(sa.prototype);cf.prototype.constructor=cf;Xd.prototype=Object.create(ka.prototype);Xd.prototype.constructor=Xd;var Wl={triangulate:function(a,b,d){d=d||2;var e=b&&b.length,f=e?b[0]*d:a.length,g=bj(a,0,f,d,!0),h=[];if(!g||g.next===g.prev)return h; var k;if(e){var l=d;e=[];var m;var n=0;for(m=b.length;n80*d){var q=k=a[0];var v=e=a[1];for(l=d;lk&&(k=n),b>e&&(e=b);k=Math.max(k-q,e-v);k=0!==k?1/k:0}ef(g,h,d,q,v,k);return h}},nc={area:function(a){for(var b=a.length,d=0, e=b-1,f=0;fnc.area(a)},triangulateShape:function(a,b){var d=[],e=[],f=[];fj(a);gj(d,a);a=a.length;b.forEach(fj);for(var g=0;gMath.abs(h-l)?[new L(a,1-d),new L(k,1-e),new L(m,1-f),new L(p,1-b)]:[new L(h,1-d),new L(l,1-e),new L(n,1-f),new L(t,1-b)]}};gf.prototype=Object.create(sa.prototype);gf.prototype.constructor=gf;Zd.prototype=Object.create(bc.prototype);Zd.prototype.constructor=Zd;hf.prototype=Object.create(sa.prototype);hf.prototype.constructor=hf;id.prototype=Object.create(ka.prototype);id.prototype.constructor=id;jf.prototype=Object.create(sa.prototype);jf.prototype.constructor= jf;$d.prototype=Object.create(ka.prototype);$d.prototype.constructor=$d;kf.prototype=Object.create(sa.prototype);kf.prototype.constructor=kf;ae.prototype=Object.create(ka.prototype);ae.prototype.constructor=ae;jd.prototype=Object.create(sa.prototype);jd.prototype.constructor=jd;jd.prototype.toJSON=function(){var a=sa.prototype.toJSON.call(this);return ij(this.parameters.shapes,a)};kd.prototype=Object.create(ka.prototype);kd.prototype.constructor=kd;kd.prototype.toJSON=function(){var a=ka.prototype.toJSON.call(this); return ij(this.parameters.shapes,a)};be.prototype=Object.create(ka.prototype);be.prototype.constructor=be;ld.prototype=Object.create(sa.prototype);ld.prototype.constructor=ld;oc.prototype=Object.create(ka.prototype);oc.prototype.constructor=oc;lf.prototype=Object.create(ld.prototype);lf.prototype.constructor=lf;mf.prototype=Object.create(oc.prototype);mf.prototype.constructor=mf;nf.prototype=Object.create(sa.prototype);nf.prototype.constructor=nf;ce.prototype=Object.create(ka.prototype);ce.prototype.constructor= ce;var vb=Object.freeze({__proto__:null,WireframeGeometry:Rd,ParametricGeometry:Ve,ParametricBufferGeometry:Sd,TetrahedronGeometry:Xe,TetrahedronBufferGeometry:Td,OctahedronGeometry:Ye,OctahedronBufferGeometry:fd,IcosahedronGeometry:Ze,IcosahedronBufferGeometry:Ud,DodecahedronGeometry:$e,DodecahedronBufferGeometry:Vd,PolyhedronGeometry:We,PolyhedronBufferGeometry:zb,TubeGeometry:af,TubeBufferGeometry:gd,TorusKnotGeometry:bf,TorusKnotBufferGeometry:Wd,TorusGeometry:cf,TorusBufferGeometry:Xd,TextGeometry:gf, TextBufferGeometry:Zd,SphereGeometry:hf,SphereBufferGeometry:id,RingGeometry:jf,RingBufferGeometry:$d,PlaneGeometry:Je,PlaneBufferGeometry:cd,LatheGeometry:kf,LatheBufferGeometry:ae,ShapeGeometry:jd,ShapeBufferGeometry:kd,ExtrudeGeometry:hd,ExtrudeBufferGeometry:bc,EdgesGeometry:be,ConeGeometry:lf,ConeBufferGeometry:mf,CylinderGeometry:ld,CylinderBufferGeometry:oc,CircleGeometry:nf,CircleBufferGeometry:ce,BoxGeometry:Fd,BoxBufferGeometry:Bc});md.prototype=Object.create(ra.prototype);md.prototype.constructor= md;md.prototype.isShadowMaterial=!0;md.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color);return this};pc.prototype=Object.create(sb.prototype);pc.prototype.constructor=pc;pc.prototype.isRawShaderMaterial=!0;cc.prototype=Object.create(ra.prototype);cc.prototype.constructor=cc;cc.prototype.isMeshStandardMaterial=!0;cc.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.defines={STANDARD:""};this.color.copy(a.color);this.roughness=a.roughness;this.metalness= a.metalness;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias= a.displacementBias;this.roughnessMap=a.roughnessMap;this.metalnessMap=a.metalnessMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.envMapIntensity=a.envMapIntensity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;this.vertexTangents=a.vertexTangents;return this}; Nc.prototype=Object.create(cc.prototype);Nc.prototype.constructor=Nc;Nc.prototype.isMeshPhysicalMaterial=!0;Nc.prototype.copy=function(a){cc.prototype.copy.call(this,a);this.defines={STANDARD:"",PHYSICAL:""};this.clearcoat=a.clearcoat;this.clearcoatMap=a.clearcoatMap;this.clearcoatRoughness=a.clearcoatRoughness;this.clearcoatRoughnessMap=a.clearcoatRoughnessMap;this.clearcoatNormalMap=a.clearcoatNormalMap;this.clearcoatNormalScale.copy(a.clearcoatNormalScale);this.reflectivity=a.reflectivity;this.sheen= a.sheen?(this.sheen||new S).copy(a.sheen):null;this.transmission=a.transmission;this.transmissionMap=a.transmissionMap;return this};Oc.prototype=Object.create(ra.prototype);Oc.prototype.constructor=Oc;Oc.prototype.isMeshPhongMaterial=!0;Oc.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color);this.specular.copy(a.specular);this.shininess=a.shininess;this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity= a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity= a.reflectivity;this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};nd.prototype=Object.create(ra.prototype);nd.prototype.constructor=nd;nd.prototype.isMeshToonMaterial=!0;nd.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color); this.map=a.map;this.gradientMap=a.gradientMap;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale; this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};od.prototype=Object.create(ra.prototype);od.prototype.constructor=od;od.prototype.isMeshNormalMaterial=!0;od.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.bumpMap= a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};pd.prototype=Object.create(ra.prototype);pd.prototype.constructor= pd;pd.prototype.isMeshLambertMaterial=!0;pd.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.color.copy(a.color);this.map=a.map;this.lightMap=a.lightMap;this.lightMapIntensity=a.lightMapIntensity;this.aoMap=a.aoMap;this.aoMapIntensity=a.aoMapIntensity;this.emissive.copy(a.emissive);this.emissiveMap=a.emissiveMap;this.emissiveIntensity=a.emissiveIntensity;this.specularMap=a.specularMap;this.alphaMap=a.alphaMap;this.envMap=a.envMap;this.combine=a.combine;this.reflectivity=a.reflectivity; this.refractionRatio=a.refractionRatio;this.wireframe=a.wireframe;this.wireframeLinewidth=a.wireframeLinewidth;this.wireframeLinecap=a.wireframeLinecap;this.wireframeLinejoin=a.wireframeLinejoin;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};qd.prototype=Object.create(ra.prototype);qd.prototype.constructor=qd;qd.prototype.isMeshMatcapMaterial=!0;qd.prototype.copy=function(a){ra.prototype.copy.call(this,a);this.defines={MATCAP:""};this.color.copy(a.color); this.matcap=a.matcap;this.map=a.map;this.bumpMap=a.bumpMap;this.bumpScale=a.bumpScale;this.normalMap=a.normalMap;this.normalMapType=a.normalMapType;this.normalScale.copy(a.normalScale);this.displacementMap=a.displacementMap;this.displacementScale=a.displacementScale;this.displacementBias=a.displacementBias;this.alphaMap=a.alphaMap;this.skinning=a.skinning;this.morphTargets=a.morphTargets;this.morphNormals=a.morphNormals;return this};rd.prototype=Object.create(Ya.prototype);rd.prototype.constructor= rd;rd.prototype.isLineDashedMaterial=!0;rd.prototype.copy=function(a){Ya.prototype.copy.call(this,a);this.scale=a.scale;this.dashSize=a.dashSize;this.gapSize=a.gapSize;return this};var Xl=Object.freeze({__proto__:null,ShadowMaterial:md,SpriteMaterial:Lc,RawShaderMaterial:pc,ShaderMaterial:sb,PointsMaterial:Rb,MeshPhysicalMaterial:Nc,MeshStandardMaterial:cc,MeshPhongMaterial:Oc,MeshToonMaterial:nd,MeshNormalMaterial:od,MeshLambertMaterial:pd,MeshDepthMaterial:Ec,MeshDistanceMaterial:Fc,MeshBasicMaterial:Kb, MeshMatcapMaterial:qd,LineDashedMaterial:rd,LineBasicMaterial:Ya,Material:ra}),Va={arraySlice:function(a,b,d){return Va.isTypedArray(a)?new a.constructor(a.subarray(b,void 0!==d?d:a.length)):a.slice(b,d)},convertArray:function(a,b,d){return!a||!d&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,d=Array(b),e=0;e!==b;++e)d[e]= e;d.sort(function(f,g){return a[f]-a[g]});return d},sortedArray:function(a,b,d){for(var e=a.length,f=new a.constructor(e),g=0,h=0;h!==e;++g)for(var k=d[g]*b,l=0;l!==b;++l)f[h++]=a[k+l];return f},flattenJSON:function(a,b,d,e){for(var f=1,g=a[0];void 0!==g&&void 0===g[e];)g=a[f++];if(void 0!==g){var h=g[e];if(void 0!==h)if(Array.isArray(h)){do h=g[e],void 0!==h&&(b.push(g.time),d.push.apply(d,h)),g=a[f++];while(void 0!==g)}else if(void 0!==h.toArray){do h=g[e],void 0!==h&&(b.push(g.time),h.toArray(d, d.length)),g=a[f++];while(void 0!==g)}else{do h=g[e],void 0!==h&&(b.push(g.time),d.push(h)),g=a[f++];while(void 0!==g)}}},subclip:function(a,b,d,e,f){f=f||30;a=a.clone();a.name=b;b=[];for(var g=0;g=e))for(l.push(h.times[n]),p=0;pa.tracks[e].times[0]&&(d=a.tracks[e].times[0]);for(e=0;e=e)e=30;var f=a.tracks.length,g=b/e;b=function(h){var k=d.tracks[h],l=k.ValueTypeName;if("bool"!==l&&"string"!==l&&(h=a.tracks.find(function(B){return B.name===k.name&&B.ValueTypeName===l}),void 0!==h)){var m=0,n=k.getValueSize(); k.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=n/3);var p=0,t=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=t/3);var q=k.times.length-1,v=void 0;g<=k.times[0]?v=Va.arraySlice(k.values,m,n-m):g>=k.times[q]?(v=q*n+m,v=Va.arraySlice(k.values,v,v+n-m)):(v=k.createInterpolant(),q=m,m=n-m,v.evaluate(g),v=Va.arraySlice(v.resultBuffer,q,m));"quaternion"===l&&(new ua).fromArray(v).normalize().conjugate().toArray(v);m=h.times.length;for(n=0;n=f)break a; else{g=b[1];a=f)break b}e=d;d=0}}for(;d>>1,ab;)--g;++g;if(0!==f||g!==e)f>=g&&(g=Math.max(g, 1),f=g-1),a=this.getValueSize(),this.times=Va.arraySlice(d,f,g),this.values=Va.arraySlice(this.values,f*a,g*a);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),a=!1);var d=this.times;b=this.values;var e=d.length;0===e&&(console.error("THREE.KeyframeTrack: Track is empty.",this),a=!1);for(var f=null,g=0;g!==e;g++){var h=d[g];if("number"===typeof h&&isNaN(h)){console.error("THREE.KeyframeTrack: Time is not a valid number.", this,g,h);a=!1;break}if(null!==f&&f>h){console.error("THREE.KeyframeTrack: Out of order keys.",this,g,h,f);a=!1;break}f=h}if(void 0!==b&&Va.isTypedArray(b))for(d=0,e=b.length;d!==e;++d)if(f=b[d],isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,d,f);a=!1;break}return a},optimize:function(){for(var a=Va.arraySlice(this.times),b=Va.arraySlice(this.values),d=this.getValueSize(),e=2302===this.getInterpolation(),f=a.length-1,g=1,h=1;hh)f=a+1;else if(0d&&(d=0);1Number.EPSILON&&(h.normalize(), l=Math.acos(xa.clamp(e[d-1].dot(e[d]),-1,1)),f[d].applyMatrix4(k.makeRotationAxis(h,l))),g[d].crossVectors(e[d],f[d]);if(!0===b)for(b=Math.acos(xa.clamp(f[0].dot(f[a]),-1,1)),b/=a,0e;)e+=d;for(;e>d;)e-=d;ef&&(f=1);1E-4>e&&(e=f);1E-4>l&&(l=f);mi.initNonuniformCatmullRom(g.x,h.x,k.x,d.x, e,f,l);ni.initNonuniformCatmullRom(g.y,h.y,k.y,d.y,e,f,l);oi.initNonuniformCatmullRom(g.z,h.z,k.z,d.z,e,f,l)}else"catmullrom"===this.curveType&&(mi.initCatmullRom(g.x,h.x,k.x,d.x,this.tension),ni.initCatmullRom(g.y,h.y,k.y,d.y,this.tension),oi.initCatmullRom(g.z,h.z,k.z,d.z,this.tension));b.set(mi.calc(a),ni.calc(a),oi.calc(a));return b};ob.prototype.copy=function(a){oa.prototype.copy.call(this,a);this.points=[];for(var b=0,d=a.points.length;bd.length-2?d.length-1:a+1];d=d[a>d.length-3?d.length-1:a+2];b.set(kj(e,f.x,g.x,h.x,d.x),kj(e,f.y,g.y,h.y,d.y));return b};Vb.prototype.copy=function(a){oa.prototype.copy.call(this,a);this.points=[];for(var b=0,d=a.points.length;b=b)return b=d[a]-b,a=this.curves[a],d=a.getLength(),a.getPointAt(0===d?0:1-b/d);a++}return null},getLength:function(){var a=this.getCurveLengths();return a[a.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 a=[],b=0,d=0,e=this.curves.length;da;a++)this.coefficients.push(new w)};pb.prototype.set=function(a){for(var b=0;9>b;b++)this.coefficients[b].copy(a[b]);return this};pb.prototype.zero=function(){for(var a=0;9>a;a++)this.coefficients[a].set(0,0,0);return this};pb.prototype.getAt=function(a,b){var d=a.x,e=a.y;a=a.z;var f=this.coefficients;b.copy(f[0]).multiplyScalar(.282095);b.addScaledVector(f[1],.488603*e); b.addScaledVector(f[2],.488603*a);b.addScaledVector(f[3],.488603*d);b.addScaledVector(f[4],1.092548*d*e);b.addScaledVector(f[5],1.092548*e*a);b.addScaledVector(f[6],.315392*(3*a*a-1));b.addScaledVector(f[7],1.092548*d*a);b.addScaledVector(f[8],.546274*(d*d-e*e));return b};pb.prototype.getIrradianceAt=function(a,b){var d=a.x,e=a.y;a=a.z;var f=this.coefficients;b.copy(f[0]).multiplyScalar(.886227);b.addScaledVector(f[1],1.023328*e);b.addScaledVector(f[2],1.023328*a);b.addScaledVector(f[3],1.023328* d);b.addScaledVector(f[4],.858086*d*e);b.addScaledVector(f[5],.858086*e*a);b.addScaledVector(f[6],.743125*a*a-.247708);b.addScaledVector(f[7],.858086*d*a);b.addScaledVector(f[8],.429043*(d*d-e*e));return b};pb.prototype.add=function(a){for(var b=0;9>b;b++)this.coefficients[b].add(a.coefficients[b]);return this};pb.prototype.addScaledSH=function(a,b){for(var d=0;9>d;d++)this.coefficients[d].addScaledVector(a.coefficients[d],b);return this};pb.prototype.scale=function(a){for(var b=0;9>b;b++)this.coefficients[b].multiplyScalar(a); return this};pb.prototype.lerp=function(a,b){for(var d=0;9>d;d++)this.coefficients[d].lerp(a.coefficients[d],b);return this};pb.prototype.equals=function(a){for(var b=0;9>b;b++)if(!this.coefficients[b].equals(a.coefficients[b]))return!1;return!0};pb.prototype.copy=function(a){return this.set(a.coefficients)};pb.prototype.clone=function(){return(new this.constructor).copy(this)};pb.prototype.fromArray=function(a,b){void 0===b&&(b=0);for(var d=this.coefficients,e=0;9>e;e++)d[e].fromArray(a,b+3*e);return this}; pb.prototype.toArray=function(a,b){void 0===a&&(a=[]);void 0===b&&(b=0);for(var d=this.coefficients,e=0;9>e;e++)d[e].toArray(a,b+3*e);return a};pb.getBasisAt=function(a,b){var d=a.x,e=a.y;a=a.z;b[0]=.282095;b[1]=.488603*e;b[2]=.488603*a;b[3]=.488603*d;b[4]=1.092548*d*e;b[5]=1.092548*e*a;b[6]=.315392*(3*a*a-1);b[7]=1.092548*d*a;b[8]=.546274*(d*d-e*e)};Ob.prototype=Object.assign(Object.create(Sa.prototype),{constructor:Ob,isLightProbe:!0,copy:function(a){Sa.prototype.copy.call(this,a);this.sh.copy(a.sh); return this},fromJSON:function(a){this.intensity=a.intensity;this.sh.fromArray(a.sh);return this},toJSON:function(a){a=Sa.prototype.toJSON.call(this,a);a.object.sh=this.sh.toArray();return a}});sg.prototype=Object.assign(Object.create(Ma.prototype),{constructor:sg,load:function(a,b,d,e){var f=this,g=new Nb(f.manager);g.setPath(f.path);g.setRequestHeader(f.requestHeader);g.load(a,function(h){try{b(f.parse(JSON.parse(h)))}catch(k){e?e(k):console.error(k),f.manager.itemError(a)}},d,e)},parse:function(a){function b(k){void 0=== d[k]&&console.warn("THREE.MaterialLoader: Undefined texture",k);return d[k]}var d=this.textures,e=new Xl[a.type];void 0!==a.uuid&&(e.uuid=a.uuid);void 0!==a.name&&(e.name=a.name);void 0!==a.color&&e.color.setHex(a.color);void 0!==a.roughness&&(e.roughness=a.roughness);void 0!==a.metalness&&(e.metalness=a.metalness);void 0!==a.sheen&&(e.sheen=(new S).setHex(a.sheen));void 0!==a.emissive&&e.emissive.setHex(a.emissive);void 0!==a.specular&&e.specular.setHex(a.specular);void 0!==a.shininess&&(e.shininess= a.shininess);void 0!==a.clearcoat&&(e.clearcoat=a.clearcoat);void 0!==a.clearcoatRoughness&&(e.clearcoatRoughness=a.clearcoatRoughness);void 0!==a.fog&&(e.fog=a.fog);void 0!==a.flatShading&&(e.flatShading=a.flatShading);void 0!==a.blending&&(e.blending=a.blending);void 0!==a.combine&&(e.combine=a.combine);void 0!==a.side&&(e.side=a.side);void 0!==a.opacity&&(e.opacity=a.opacity);void 0!==a.transparent&&(e.transparent=a.transparent);void 0!==a.alphaTest&&(e.alphaTest=a.alphaTest);void 0!==a.depthTest&& (e.depthTest=a.depthTest);void 0!==a.depthWrite&&(e.depthWrite=a.depthWrite);void 0!==a.colorWrite&&(e.colorWrite=a.colorWrite);void 0!==a.stencilWrite&&(e.stencilWrite=a.stencilWrite);void 0!==a.stencilWriteMask&&(e.stencilWriteMask=a.stencilWriteMask);void 0!==a.stencilFunc&&(e.stencilFunc=a.stencilFunc);void 0!==a.stencilRef&&(e.stencilRef=a.stencilRef);void 0!==a.stencilFuncMask&&(e.stencilFuncMask=a.stencilFuncMask);void 0!==a.stencilFail&&(e.stencilFail=a.stencilFail);void 0!==a.stencilZFail&& (e.stencilZFail=a.stencilZFail);void 0!==a.stencilZPass&&(e.stencilZPass=a.stencilZPass);void 0!==a.wireframe&&(e.wireframe=a.wireframe);void 0!==a.wireframeLinewidth&&(e.wireframeLinewidth=a.wireframeLinewidth);void 0!==a.wireframeLinecap&&(e.wireframeLinecap=a.wireframeLinecap);void 0!==a.wireframeLinejoin&&(e.wireframeLinejoin=a.wireframeLinejoin);void 0!==a.rotation&&(e.rotation=a.rotation);1!==a.linewidth&&(e.linewidth=a.linewidth);void 0!==a.dashSize&&(e.dashSize=a.dashSize);void 0!==a.gapSize&& (e.gapSize=a.gapSize);void 0!==a.scale&&(e.scale=a.scale);void 0!==a.polygonOffset&&(e.polygonOffset=a.polygonOffset);void 0!==a.polygonOffsetFactor&&(e.polygonOffsetFactor=a.polygonOffsetFactor);void 0!==a.polygonOffsetUnits&&(e.polygonOffsetUnits=a.polygonOffsetUnits);void 0!==a.skinning&&(e.skinning=a.skinning);void 0!==a.morphTargets&&(e.morphTargets=a.morphTargets);void 0!==a.morphNormals&&(e.morphNormals=a.morphNormals);void 0!==a.dithering&&(e.dithering=a.dithering);void 0!==a.vertexTangents&& (e.vertexTangents=a.vertexTangents);void 0!==a.visible&&(e.visible=a.visible);void 0!==a.toneMapped&&(e.toneMapped=a.toneMapped);void 0!==a.userData&&(e.userData=a.userData);void 0!==a.vertexColors&&(e.vertexColors="number"===typeof a.vertexColors?0Number.EPSILON){if(0>K&&(H=B[E],F=-F,M=B[I],K=-K),!(A.yM.y))if(A.y===H.y){if(A.x===H.x)return!0}else{I=K*(A.x-H.x)-F*(A.y-H.y);if(0===I)return!0;0>I||(G=!G)}}else if(A.y=== H.y&&(M.x<=A.x&&A.x<=H.x||H.x<=A.x&&A.x<=M.x))return!0}return G}var f=nc.isClockWise,g=this.subPaths;if(0===g.length)return[];if(!0===b)return d(g);b=[];if(1===g.length){var h=g[0];var k=new Pc;k.curves=h.curves;b.push(k);return b}var l=!f(g[0].getPoints());l=a?!l:l;k=[];var m=[],n=[],p=0;m[p]=void 0;n[p]=[];for(var t=0,q=g.length;te&&this._mixBufferRegion(d,a,b*this._origIndex,1-e,b);0=f){var n=f++,p=a[n];b[p.uuid]=m;a[m]=p;b[l]=n;a[n]=k;k=0;for(l=e;k!==l;++k){p=d[k];var t=p[m];p[m]=p[n];p[n]=t}}}this.nCachedObjects_=f},uncache:function(){for(var a=this._objects,b=this._indicesByUUID,d=this._bindings,e=d.length,f=this.nCachedObjects_,g=a.length,h=0,k=arguments.length;h!==k;++h){var l=arguments[h].uuid,m=b[l];if(void 0!==m)if(delete b[l],mb||0=== d)return;this._startTime=null;b*=d}b*=this._updateTimeScale(a);d=this._updateTime(b);a=this._updateWeight(a);if(0d.parameterPositions[1]&&(this.stopFading(),0===e&&(this.enabled=!1))}}return this._effectiveWeight=b};La.prototype._updateTimeScale=function(a){var b=0;if(!this.paused){b=this.timeScale;var d=this._timeScaleInterpolant;if(null!==d){var e=d.evaluate(a)[0];b*=e;a>d.parameterPositions[1]&&(this.stopWarping(),0===b?this.paused=!0:this.timeScale=b)}}return this._effectiveTimeScale=b};La.prototype._updateTime=function(a){var b=this._clip.duration,d=this.loop,e=this.time+ a,f=this._loopCount,g=2202===d;if(0===a)return-1===f?e:g&&1===(f&1)?b-e:e;if(2200===d)a:{if(-1===f&&(this._loopCount=0,this._setEndings(!0,!0,!1)),e>=b)e=b;else if(0>e)e=0;else{this.time=e;break a}this.clampWhenFinished?this.paused=!0:this.enabled=!1;this.time=e;this._mixer.dispatchEvent({type:"finished",action:this,direction:0>a?-1:1})}else{-1===f&&(0<=a?(f=0,this._setEndings(!0,0===this.repetitions,g)):this._setEndings(0===this.repetitions,!0,g));if(e>=b||0>e){d=Math.floor(e/b);e-=b*d;f+=Math.abs(d); var h=this.repetitions-f;0>=h?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e=0a,this._setEndings(a,!a,g)):this._setEndings(!1,!1,g),this._loopCount=f,this.time=e,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:d}))}else this.time=e;if(g&&1===(f&1))return b-e}return e};La.prototype._setEndings=function(a,b,d){var e=this._interpolantSettings;d?(e.endingStart=2401,e.endingEnd= 2401):(e.endingStart=a?this.zeroSlopeAtStart?2401:2400:2402,e.endingEnd=b?this.zeroSlopeAtEnd?2401:2400:2402)};La.prototype._scheduleFading=function(a,b,d){var e=this._mixer,f=e.time,g=this._weightInterpolant;null===g&&(this._weightInterpolant=g=e._lendControlInterpolant());e=g.parameterPositions;g=g.sampleValues;e[0]=f;g[0]=b;e[1]=f+a;g[1]=d;return this};Ph.prototype=Object.assign(Object.create(wb.prototype),{constructor:Ph,_bindAction:function(a,b){var d=a._localRoot||this._root,e=a._clip.tracks, f=e.length,g=a._propertyBindings;a=a._interpolants;var h=d.uuid,k=this._bindingsByRootAndName,l=k[h];void 0===l&&(l={},k[h]=l);for(k=0;k!==f;++k){var m=e[k],n=m.name,p=l[n];if(void 0===p){p=g[k];if(void 0!==p){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,h,n));continue}p=new Oh(qb.create(d,n,b&&b._propertyBindings[k].binding.parsedPath),m.ValueTypeName,m.getValueSize());++p.referenceCount;this._addInactiveBinding(p,h,n)}g[k]=p;a[k].resultBuffer=p.buffer}},_activateAction:function(a){if(!this._isActiveAction(a)){if(null=== a._cacheIndex){var b=(a._localRoot||this._root).uuid,d=a._clip.uuid,e=this._actionsByClip[d];this._bindAction(a,e&&e.knownActions[0]);this._addInactiveAction(a,d,b)}b=a._propertyBindings;d=0;for(e=b.length;d!==e;++d){var f=b[d];0===f.useCount++&&(this._lendBinding(f),f.saveOriginalState())}this._lendAction(a)}},_deactivateAction:function(a){if(this._isActiveAction(a)){for(var b=a._propertyBindings,d=0,e=b.length;d!==e;++d){var f=b[d];0===--f.useCount&&(f.restoreOriginalState(),this._takeBackBinding(f))}this._takeBackAction(a)}}, _initMemoryManager:function(){this._actions=[];this._nActiveActions=0;this._actionsByClip={};this._bindings=[];this._nActiveBindings=0;this._bindingsByRootAndName={};this._controlInterpolants=[];this._nActiveControlInterpolants=0;var a=this;this.stats={actions:{get total(){return a._actions.length},get inUse(){return a._nActiveActions}},bindings:{get total(){return a._bindings.length},get inUse(){return a._nActiveBindings}},controlInterpolants:{get total(){return a._controlInterpolants.length},get inUse(){return a._nActiveControlInterpolants}}}}, _isActiveAction:function(a){a=a._cacheIndex;return null!==a&&athis.max.x||a.ythis.max.y?!1:!0};$a.prototype.containsBox=function(a){return this.min.x<= a.min.x&&a.max.x<=this.max.x&&this.min.y<=a.min.y&&a.max.y<=this.max.y};$a.prototype.getParameter=function(a,b){void 0===b&&(console.warn("THREE.Box2: .getParameter() target is now required"),b=new L);return b.set((a.x-this.min.x)/(this.max.x-this.min.x),(a.y-this.min.y)/(this.max.y-this.min.y))};$a.prototype.intersectsBox=function(a){return a.max.xthis.max.x||a.max.ythis.max.y?!1:!0};$a.prototype.clampPoint=function(a,b){void 0===b&&(console.warn("THREE.Box2: .clampPoint() target is now required"), b=new L);return b.copy(a).clamp(this.min,this.max)};$a.prototype.distanceToPoint=function(a){return Vj.copy(a).clamp(this.min,this.max).sub(a).length()};$a.prototype.intersect=function(a){this.min.max(a.min);this.max.min(a.max);return this};$a.prototype.union=function(a){this.min.min(a.min);this.max.max(a.max);return this};$a.prototype.translate=function(a){this.min.add(a);this.max.add(a);return this};$a.prototype.equals=function(a){return a.min.equals(this.min)&&a.max.equals(this.max)};var Wj=new w, Zg=new w,Cb=function(a,b){this.start=void 0!==a?a:new w;this.end=void 0!==b?b:new w};Cb.prototype.set=function(a,b){this.start.copy(a);this.end.copy(b);return this};Cb.prototype.clone=function(){return(new this.constructor).copy(this)};Cb.prototype.copy=function(a){this.start.copy(a.start);this.end.copy(a.end);return this};Cb.prototype.getCenter=function(a){void 0===a&&(console.warn("THREE.Line3: .getCenter() target is now required"),a=new w);return a.addVectors(this.start,this.end).multiplyScalar(.5)}; Cb.prototype.delta=function(a){void 0===a&&(console.warn("THREE.Line3: .delta() target is now required"),a=new w);return a.subVectors(this.end,this.start)};Cb.prototype.distanceSq=function(){return this.start.distanceToSquared(this.end)};Cb.prototype.distance=function(){return this.start.distanceTo(this.end)};Cb.prototype.at=function(a,b){void 0===b&&(console.warn("THREE.Line3: .at() target is now required"),b=new w);return this.delta(b).multiplyScalar(a).add(this.start)};Cb.prototype.closestPointToPointParameter= function(a,b){Wj.subVectors(a,this.start);Zg.subVectors(this.end,this.start);a=Zg.dot(Zg);a=Zg.dot(Wj)/a;b&&(a=xa.clamp(a,0,1));return a};Cb.prototype.closestPointToPoint=function(a,b,d){a=this.closestPointToPointParameter(a,b);void 0===d&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),d=new w);return this.delta(d).multiplyScalar(a).add(this.start)};Cb.prototype.applyMatrix4=function(a){this.start.applyMatrix4(a);this.end.applyMatrix4(a);return this};Cb.prototype.equals= function(a){return a.start.equals(this.start)&&a.end.equals(this.end)};tf.prototype=Object.create(ha.prototype);tf.prototype.constructor=tf;tf.prototype.isImmediateRenderObject=!0;var Xj=new w;je.prototype=Object.create(ha.prototype);je.prototype.constructor=je;je.prototype.dispose=function(){this.cone.geometry.dispose();this.cone.material.dispose()};je.prototype.update=function(){this.light.updateMatrixWorld();var a=this.light.distance?this.light.distance:1E3,b=a*Math.tan(this.light.angle);this.cone.scale.set(b, b,a);Xj.setFromMatrixPosition(this.light.target.matrixWorld);this.cone.lookAt(Xj);void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Xc=new w,$g=new da,ri=new da;ke.prototype=Object.create(Za.prototype);ke.prototype.constructor=ke;ke.prototype.updateMatrixWorld=function(a){var b=this.bones,d=this.geometry,e=d.getAttribute("position");ri.getInverse(this.root.matrixWorld);for(var f=0,g=0;fMath.abs(b)&&(b=1E-8);this.scale.set(.5*this.size,.5*this.size,b);this.children[0].material.side= 0>b?1:0;this.lookAt(this.plane.normal);yb.prototype.updateMatrixWorld.call(this,a)};var ck=new w,zg,Uh;Rc.prototype=Object.create(ha.prototype);Rc.prototype.constructor=Rc;Rc.prototype.setDirection=function(a){.99999a.y?this.quaternion.set(1,0,0,0):(ck.set(a.z,0,-a.x).normalize(),this.quaternion.setFromAxisAngle(ck,Math.acos(a.y)))};Rc.prototype.setLength=function(a,b,d){void 0===b&&(b=.2*a);void 0===d&&(d=.2*b);this.line.scale.set(1,Math.max(1E-4,a-b),1); this.line.updateMatrix();this.cone.scale.set(d,b,d);this.cone.position.y=a;this.cone.updateMatrix()};Rc.prototype.setColor=function(a){this.line.material.color.set(a);this.cone.material.color.set(a)};Rc.prototype.copy=function(a){ha.prototype.copy.call(this,a,!1);this.line.copy(a.line);this.cone.copy(a.cone);return this};yf.prototype=Object.create(Za.prototype);yf.prototype.constructor=yf;var gc=Math.pow(2,8),dk=[.125,.215,.35,.446,.526,.582],ek=5+dk.length,hc={3E3:0,3001:1,3002:2,3004:3,3005:4,3006:5, 3007:6},si=new he,ti=function(){for(var a=[],b=[],d=[],e=8,f=0;fm;m++){var n=m%3*2/3-1,p=2\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t", blending:0,depthTest:!1,depthWrite:!1});this._cubemapShader=this._equirectShader=null;this._compileMaterial(this._blurMaterial)};rb.prototype.fromScene=function(a,b,d,e){void 0===b&&(b=0);void 0===d&&(d=.1);void 0===e&&(e=100);ui=this._renderer.getRenderTarget();var f=this._allocateTargets();this._sceneToCubeUV(a,d,e,f);0n;n++)p=n%3,0==p?(b.up.set(0,d[n],0),b.lookAt(f[n],0,0)):1==p?(b.up.set(0,0,d[n]),b.lookAt(0,f[n],0)):(b.up.set(0,d[n],0),b.lookAt(0,0,f[n])),Ag(e,p*gc,2v;++v){var u=v/p;u=Math.exp(-u*u/2);f.push(u);0==v?q+=u:v