C端蜂鸟地图
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

1 строка
449 KiB

  1. !function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.fengmap=n():t.fengmap=n()}(this,function(){return i={},r.m=e=[function(t,n,e){"use strict";e.r(n);var h={};function i(){}e.r(h),e.d(h,"ShadowMaterial",function(){return sn}),e.d(h,"SpriteMaterial",function(){return hn}),e.d(h,"RawShaderMaterial",function(){return mn}),e.d(h,"ShaderMaterial",function(){return vn}),e.d(h,"PointsMaterial",function(){return H}),e.d(h,"MeshPhysicalMaterial",function(){return gn}),e.d(h,"MeshStandardMaterial",function(){return pn}),e.d(h,"MeshPhongMaterial",function(){return _n}),e.d(h,"MeshToonMaterial",function(){return xn}),e.d(h,"MeshNormalMaterial",function(){return An}),e.d(h,"MeshLambertMaterial",function(){return wn}),e.d(h,"MeshDepthMaterial",function(){return Sn}),e.d(h,"MeshDistanceMaterial",function(){return yn}),e.d(h,"MeshBasicMaterial",function(){return Mn}),e.d(h,"MeshMatcapMaterial",function(){return Tn}),e.d(h,"LineDashedMaterial",function(){return Ln}),e.d(h,"LineBasicMaterial",function(){return bn}),e.d(h,"Material",function(){return F}),Object.assign(i.prototype,{addEventListener:function(t,n){void 0===this.e&&(this.e={});var e=this.e;void 0===e[t]&&(e[t]=[]),-1===e[t].indexOf(n)&&e[t].push(n)},hasEventListener:function(t,n){if(void 0===this.e)return!1;var e=this.e;return void 0!==e[t]&&-1!==e[t].indexOf(n)},removeEventListener:function(t,n){void 0!==this.e&&(void 0===(t=this.e[t])||-1!==(n=t.indexOf(n))&&t.splice(n,1))},dispatchEvent:function(t){if(void 0!==this.e){var n=this.e[t.type];if(void 0!==n){t.target=this;for(var e=n.slice(0),i=0,r=e.length;i<r;i++)e[i].call(this,t)}}}});for(var L=0,l=1,c=2,r=1,a=100,o=204,s=205,u=3,f=0,d=1001,v=1003,P=1006,m=1008,p=1009,g=1023,_=3e3,x=3200,A=0,w=7680,S=519,y=35044,M=[],T=0;T<256;T++)M[T]=(T<16?"0":"")+T.toString(16);var E={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(M[255&t]+M[t>>8&255]+M[t>>16&255]+M[t>>24&255]+"-"+M[255&n]+M[n>>8&255]+"-"+M[n>>16&15|64]+M[n>>24&255]+"-"+M[63&e|128]+M[e>>8&255]+"-"+M[e>>16&255]+M[e>>24&255]+M[255&i]+M[i>>8&255]+M[i>>16&255]+M[i>>24&255]).toUpperCase()},clamp:function(t,n,e){return Math.max(n,Math.min(e,t))},euclideanModulo:function(t,n){return(t%n+n)%n},mapLinear:function(t,n,e,i,r){return i+(t-n)*(r-i)/(e-n)},lerp:function(t,n,e){return(1-e)*t+e*n},smoothstep:function(t,n,e){return t<=n?0:e<=t?1:(t=(t-n)/(e-n))*t*(3-2*t)},smootherstep:function(t,n,e){return t<=n?0:e<=t?1:(t=(t-n)/(e-n))*t*t*(t*(6*t-15)+10)},randInt:function(t,n){return t+Math.floor(Math.random()*(n-t+1))},randFloat:function(t,n){return t+Math.random()*(n-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*E.DEG2RAD},radToDeg:function(t){return t*E.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,n,e,i,r){var a=Math.cos,o=Math.sin,s=a(e/2),h=o(e/2),l=a((n+i)/2),c=o((n+i)/2),u=a((n-i)/2),e=o((n-i)/2),a=a((i-n)/2),n=o((i-n)/2);"XYX"===r?t.set(s*c,h*u,h*e,s*l):"YZY"===r?t.set(h*e,s*c,h*u,s*l):"ZXZ"===r?t.set(h*u,h*e,s*c,s*l):"XZX"===r?t.set(s*c,h*n,h*a,s*l):"YXY"===r?t.set(h*a,s*c,h*n,s*l):"ZYZ"===r?t.set(h*n,h*a,s*c,s*l):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}},b=0;function F(){Object.defineProperty(this,"id",{value:b++}),this.uuid=E.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=r,this.side=L,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=o,this.blendDst=s,this.blendEquation=a,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=u,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=S,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=w,this.stencilZFail=w,this.stencilZPass=w,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}F.prototype=Object.assign(Object.create(i.prototype),{constructor:F,isMaterial:!0,onBeforeCompile:function(){},setValues:function(t){if(void 0!==t)for(var n in t){var e,i=t[n];void 0!==i?"shading"!==n?void 0!==(e=this[n])?e&&e.isColor?e.set(i):e&&e.isVector3&&i&&i.isVector3?e.copy(i):this[n]=i:console.warn("THREE."+this.type+": '"+n+"' is not a property of this material."):(console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===i):console.warn("THREE.Material: '"+n+"' parameter is undefined.")}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.flatShading=t.flatShading,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var n=t.clippingPlanes,e=null;if(null!==n)for(var i=n.length,e=new Array(i),r=0;r!==i;++r)e[r]=n[r].clone();return this.clippingPlanes=e,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(F.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});var N={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},D={h:0,s:0,l:0},C={h:0,s:0,l:0};function I(t,n,e){return void 0===n&&void 0===e?this.set(t):this.setRGB(t,n,e)}function R(t,n,e){return e<0&&(e+=1),1<e&&--e,e<1/6?t+6*(n-t)*e:e<.5?n:e<2/3?t+6*(n-t)*(2/3-e):t}function U(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function O(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}function H(t){F.call(this),this.type="PointsMaterial",this.color=new I(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}function X(t,n,e,i){this.u=t||0,this.f=n||0,this.v=e||0,this._=void 0!==i?i:1}Object.assign(I.prototype,{isColor:!0,r:1,g:1,b:1,set:function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},setScalar:function(t){return this.r=t,this.g=t,this.b=t,this},setHex:function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,n,e){return this.r=t,this.g=n,this.b=e,this},setHSL:function(t,n,e){return t=E.euclideanModulo(t,1),n=E.clamp(n,0,1),e=E.clamp(e,0,1),0===n?this.r=this.g=this.b=e:(this.r=R(n=2*e-(e=e<=.5?e*(1+n):e+n-e*n),e,t+1/3),this.g=R(n,e,t),this.b=R(n,e,t-1/3)),this},setStyle:function(n){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+n+" will be ignored.")}if(h=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(n)){var e,i=h[1],r=h[2];switch(i){case"rgb":case"rgba":if(e=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(255,parseInt(e[1],10))/255,this.g=Math.min(255,parseInt(e[2],10))/255,this.b=Math.min(255,parseInt(e[3],10))/255,t(e[5]),this;if(e=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r))return this.r=Math.min(100,parseInt(e[1],10))/100,this.g=Math.min(100,parseInt(e[2],10))/100,this.b=Math.min(100,parseInt(e[3],10))/100,t(e[5]),this;break;case"hsl":case"hsla":if(e=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(r)){var a=parseFloat(e[1])/360,o=parseInt(e[2],10)/100,s=parseInt(e[3],10)/100;return t(e[5]),this.setHSL(a,o,s)}}}else if(h=/^\#([A-Fa-f0-9]+)$/.exec(n)){var i=h[1],h=i.length;if(3===h)return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this}return n&&0<n.length?this.setColorName(n):this},setColorName:function(t){var n=N[t];return void 0!==n?this.setHex(n):console.warn("THREE.Color: Unknown color "+t),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},copyGammaToLinear:function(t,n){return void 0===n&&(n=2),this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},copyLinearToGamma:function(t,n){n=0<(n=void 0===n?2:n)?1/n:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},convertGammaToLinear:function(t){return this.copyGammaToLinear(this,t),this},convertLinearToGamma:function(t){return this.copyLinearToGamma(this,t),this},copySRGBToLinear:function(t){return this.r=U(t.r),this.g=U(t.g),this.b=U(t.b),this},copyLinearToSRGB:function(t){return this.r=O(t.r),this.g=O(t.g),this.b=O(t.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var n,e=this.r,i=this.g,r=this.b,a=Math.max(e,i,r),o=Math.min(e,i,r),s=(o+a)/2;if(o===a)l=n=0;else{var h=a-o,l=s<=.5?h/(a+o):h/(2-a-o);switch(a){case e:n=(i-r)/h+(i<r?6:0);break;case i:n=(r-e)/h+2;break;case r:n=(e-i)/h+4}n/=6}return t.h=n,t.s=l,t.l=s,t},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},offsetHSL:function(t,n,e){return this.getHSL(D),D.h+=t,D.s+=n,D.l+=e,this.setHSL(D.h,D.s,D.l),this},add:function(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this},addColors:function(t,n){return this.r=t.r+n.r,this.g=t.g+n.g,this.b=t.b+n.b,this},addScalar:function(t){return this.r+=t,this.g+=t,this.b+=t,this},sub:function(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this},multiply:function(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this},multiplyScalar:function(t){return this.r*=t,this.g*=t,this.b*=t,this},lerp:function(t,n){return this.r+=(t.r-this.r)*n,this.g+=(t.g-this.g)*n,this.b+=(t.b-this.b)*n,this},lerpHSL:function(t,n){this.getHSL(D),t.getHSL(C);var e=E.lerp(D.h,C.h,n),t=E.lerp(D.s,C.s,n),n=E.lerp(D.l,C.l,n);return this.setHSL(e,t,n),this},equals:function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b},fromArray:function(t,n){return this.r=t[n=void 0===n?0:n],this.g=t[n+1],this.b=t[n+2],this},toArray:function(t,n){return(t=void 0===t?[]:t)[n=void 0===n?0:n]=this.r,t[n+1]=this.g,t[n+2]=this.b,t}}),I.NAMES=N,((H.prototype=Object.create(F.prototype)).constructor=H).prototype.isPointsMaterial=!0,H.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this},Object.assign(X,{slerp:function(t,n,e,i){return e.copy(t).slerp(n,i)},slerpFlat:function(t,n,e,i,r,a,o){var s=e[i+0],h=e[i+1],l=e[i+2],c=e[i+3],u=r[a+0],f=r[a+1],d=r[a+2],v=r[a+3];c===v&&s===u&&h===f&&l===d||(e=1-o,r=0<=(i=s*u+h*f+l*d+c*v)?1:-1,(a=1-i*i)>Number.EPSILON&&(a=Math.sqrt(a),i=Math.atan2(a,i*r),e=Math.sin(e*i)/a,o=Math.sin(o*i)/a),s=s*e+u*(r=o*r),h=h*e+f*r,l=l*e+d*r,c=c*e+v*r,e===1-o&&(s*=o=1/Math.sqrt(s*s+h*h+l*l+c*c),h*=o,l*=o,c*=o)),t[n]=s,t[n+1]=h,t[n+2]=l,t[n+3]=c}}),Object.defineProperties(X.prototype,{x:{get:function(){return this.u},set:function(t){this.u=t,this.A()}},y:{get:function(){return this.f},set:function(t){this.f=t,this.A()}},z:{get:function(){return this.v},set:function(t){this.v=t,this.A()}},w:{get:function(){return this._},set:function(t){this._=t,this.A()}}}),Object.assign(X.prototype,{isQuaternion:!0,set:function(t,n,e,i){return this.u=t,this.f=n,this.v=e,this._=i,this.A(),this},clone:function(){return new this.constructor(this.u,this.f,this.v,this._)},copy:function(t){return this.u=t.x,this.f=t.y,this.v=t.z,this._=t.w,this.A(),this},setFromEuler:function(t,n){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var e=t.u,i=t.f,r=t.v,a=t.order,o=Math.cos,s=Math.sin,h=o(e/2),t=o(i/2),o=o(r/2),e=s(e/2),i=s(i/2),r=s(r/2);return"XYZ"===a?(this.u=e*t*o+h*i*r,this.f=h*i*o-e*t*r,this.v=h*t*r+e*i*o,this._=h*t*o-e*i*r):"YXZ"===a?(this.u=e*t*o+h*i*r,this.f=h*i*o-e*t*r,this.v=h*t*r-e*i*o,this._=h*t*o+e*i*r):"ZXY"===a?(this.u=e*t*o-h*i*r,this.f=h*i*o+e*t*r,this.v=h*t*r+e*i*o,this._=h*t*o-e*i*r):"ZYX"===a?(this.u=e*t*o-h*i*r,this.f=h*i*o+e*t*r,this.v=h*t*r-e*i*o,this._=h*t*o+e*i*r):"YZX"===a?(this.u=e*t*o+h*i*r,this.f=h*i*o+e*t*r,this.v=h*t*r-e*i*o,this._=h*t*o-e*i*r):"XZY"===a&&(this.u=e*t*o-h*i*r,this.f=h*i*o-e*t*r,this.v=h*t*r+e*i*o,this._=h*t*o+e*i*r),!1!==n&&this.A(),this},setFromAxisAngle:function(t,n){var e=n/2,n=Math.sin(e);return this.u=t.x*n,this.f=t.y*n,this.v=t.z*n,this._=Math.cos(e),this.A(),this},setFromRotationMatrix:function(t){var n,e=t.elements,i=e[0],r=e[4],a=e[8],o=e[1],s=e[5],h=e[9],l=e[2],c=e[6],t=e[10],e=i+s+t;return 0<e?(n=.5/Math.sqrt(e+1),this._=.25/n,this.u=(c-h)*n,this.f=(a-l)*n,this.v=(o-r)*n):s<i&&t<i?(n=2*Math.sqrt(1+i-s-t),this._=(c-h)/n,this.u=.25*n,this.f=(r+o)/n,this.v=(a+l)/n):t<s?(n=2*Math.sqrt(1+s-i-t),this._=(a-l)/n,this.u=(r+o)/n,this.f=.25*n,this.v=(h+c)/n):(n=2*Math.sqrt(1+t-i-s),this._=(o-r)/n,this.u=(a+l)/n,this.f=(h+c)/n,this.v=.25*n),this.A(),this},setFromUnitVectors:function(t,n){var e=t.dot(n)+1;return e<1e-6?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this.u=-t.y,this.f=t.x,this.v=0):(this.u=0,this.f=-t.z,this.v=t.y)):(this.u=t.y*n.z-t.z*n.y,this.f=t.z*n.x-t.x*n.z,this.v=t.x*n.y-t.y*n.x),this._=e,this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(E.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,n){var e=this.angleTo(t);if(0===e)return this;e=Math.min(1,n/e);return this.slerp(t,e),this},inverse:function(){return this.conjugate()},conjugate:function(){return this.u*=-1,this.f*=-1,this.v*=-1,this.A(),this},dot:function(t){return this.u*t.u+this.f*t.f+this.v*t.v+this._*t._},lengthSq:function(){return this.u*this.u+this.f*this.f+this.v*this.v+this._*this._},length:function(){return Math.sqrt(this.u*this.u+this.f*this.f+this.v*this.v+this._*this._)},normalize:function(){var t=this.length();return 0===t?(this.u=0,this.f=0,this.v=0,this._=1):(this.u=this.u*(t=1/t),this.f=this.f*t,this.v=this.v*t,this._=this._*t),this.A(),this},multiply:function(t,n){return void 0!==n?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,n)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,n){var e=t.u,i=t.f,r=t.v,a=t._,o=n.u,s=n.f,t=n.v,n=n._;return this.u=e*n+a*o+i*t-r*s,this.f=i*n+a*s+r*o-e*t,this.v=r*n+a*t+e*s-i*o,this._=a*n-e*o-i*s-r*t,this.A(),this},slerp:function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var e=this.u,i=this.f,r=this.v,a=this._,o=a*t._+e*t.u+i*t.f+r*t.v;if(o<0?(this._=-t._,this.u=-t.u,this.f=-t.f,this.v=-t.v,o=-o):this.copy(t),1<=o)return this._=a,this.u=e,this.f=i,this.v=r,this;t=1-o*o;if(t<=Number.EPSILON){var s=1-n;return this._=s*a+n*this._,this.u=s*e+n*this.u,this.f=s*i+n*this.f,this.v=s*r+n*this.v,this.normalize(),this.A(),this}s=Math.sqrt(t),t=Math.atan2(s,o),o=Math.sin((1-n)*t)/s,s=Math.sin(n*t)/s;return this._=a*o+this._*s,this.u=e*o+this.u*s,this.f=i*o+this.f*s,this.v=r*o+this.v*s,this.A(),this},equals:function(t){return t.u===this.u&&t.f===this.f&&t.v===this.v&&t._===this._},fromArray:function(t,n){return this.u=t[n=void 0===n?0:n],this.f=t[n+1],this.v=t[n+2],this._=t[n+3],this.A(),this},toArray:function(t,n){return(t=void 0===t?[]:t)[n=void 0===n?0:n]=this.u,t[n+1]=this.f,t[n+2]=this.v,t[n+3]=this._,t},fromBufferAttribute:function(t,n){return this.u=t.getX(n),this.f=t.getY(n),this.v=t.getZ(n),this._=t.getW(n),this},S:function(t){return this.A=t,this},A:function(){}});var G=new B,z=new X;function B(t,n,e){this.x=t||0,this.y=n||0,this.z=e||0}Object.assign(B.prototype,{isVector3:!0,set:function(t,n,e){return this.x=t,this.y=n,this.z=e,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,n){return void 0!==n?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,n)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this},addScaledVector:function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this},sub:function(t,n){return void 0!==n?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,n)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this},multiply:function(t,n){return void 0!==n?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,n)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this},applyEuler:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(z.setFromEuler(t))},applyAxisAngle:function(t,n){return this.applyQuaternion(z.setFromAxisAngle(t,n))},applyMatrix3:function(t){var n=this.x,e=this.y,i=this.z,t=t.elements;return this.x=t[0]*n+t[3]*e+t[6]*i,this.y=t[1]*n+t[4]*e+t[7]*i,this.z=t[2]*n+t[5]*e+t[8]*i,this},applyNormalMatrix:function(t){return this.applyMatrix3(t).normalize()},applyMatrix4:function(t){var n=this.x,e=this.y,i=this.z,r=t.elements,t=1/(r[3]*n+r[7]*e+r[11]*i+r[15]);return this.x=(r[0]*n+r[4]*e+r[8]*i+r[12])*t,this.y=(r[1]*n+r[5]*e+r[9]*i+r[13])*t,this.z=(r[2]*n+r[6]*e+r[10]*i+r[14])*t,this},applyQuaternion:function(t){var n=this.x,e=this.y,i=this.z,r=t.x,a=t.y,o=t.z,s=t.w,h=s*n+a*i-o*e,l=s*e+o*n-r*i,t=s*i+r*e-a*n,i=-r*n-a*e-o*i;return this.x=h*s+i*-r+l*-o-t*-a,this.y=l*s+i*-a+t*-r-h*-o,this.z=t*s+i*-o+h*-a-l*-r,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var n=this.x,e=this.y,i=this.z,t=t.elements;return this.x=t[0]*n+t[4]*e+t[8]*i,this.y=t[1]*n+t[5]*e+t[9]*i,this.z=t[2]*n+t[6]*e+t[10]*i,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this},clampScalar:function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this},clampLength:function(t,n){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(n,e)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this},lerpVectors:function(t,n,e){return this.subVectors(n,t).multiplyScalar(e).add(t)},cross:function(t,n){return void 0!==n?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,n)):this.crossVectors(this,t)},crossVectors:function(t,n){var e=t.x,i=t.y,r=t.z,a=n.x,t=n.y,n=n.z;return this.x=i*n-r*t,this.y=r*a-e*n,this.z=e*t-i*a,this},projectOnVector:function(t){var n=t.lengthSq();if(0===n)return this.set(0,0,0);n=t.dot(this)/n;return this.copy(t).multiplyScalar(n)},projectOnPlane:function(t){return G.copy(this).projectOnVector(t),this.sub(G)},reflect:function(t){return this.sub(G.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var n=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===n)return Math.PI/2;n=this.dot(t)/n;return Math.acos(E.clamp(n,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var n=this.x-t.x,e=this.y-t.y,t=this.z-t.z;return n*n+e*e+t*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,n,e){var i=Math.sin(n)*t;return this.x=i*Math.sin(e),this.y=Math.cos(n)*t,this.z=i*Math.cos(e),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,n,e){return this.x=t*Math.sin(n),this.y=e,this.z=t*Math.cos(n),this},setFromMatrixPosition:function(t){t=t.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(t){var n=this.setFromMatrixColumn(t,0).length(),e=this.setFromMatrixColumn(t,1).length(),t=this.setFromMatrixColumn(t,2).length();return this.x=n,this.y=e,this.z=t,this},setFromMatrixColumn:function(t,n){return this.fromArray(t.elements,4*n)},setFromMatrix3Column:function(t,n){return this.fromArray(t.elements,3*n)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,n){return this.x=t[n=void 0===n?0:n],this.y=t[n+1],this.z=t[n+2],this},toArray:function(t,n){return(t=void 0===t?[]:t)[n=void 0===n?0:n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t},fromBufferAttribute:function(t,n,e){return void 0!==e&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this}});var k=[new B,new B,new B,new B,new B,new B,new B,new B],V=new B,Y=new et,j=new B,Q=new B,W=new B,Z=new B,q=new B,K=new B,J=new B,$=new B,tt=new B,nt=new B;function et(t,n){this.min=void 0!==t?t:new B(1/0,1/0,1/0),this.max=void 0!==n?n:new B(-1/0,-1/0,-1/0)}function it(t,n,e,i,r){for(var a=0,o=t.length-3;a<=o;a+=3){nt.fromArray(t,a);var s=r.x*Math.abs(nt.x)+r.y*Math.abs(nt.y)+r.z*Math.abs(nt.z),h=n.dot(nt),l=e.dot(nt),c=i.dot(nt);if(Math.max(-Math.max(h,l,c),Math.min(h,l,c))>s)return!1}return!0}function rt(t,n,e,i){this.x=t||0,this.y=n||0,this.z=e||0,this.w=void 0!==i?i:1}function at(t,n){this.x=t||0,this.y=n||0}Object.assign(et.prototype,{isBox3:!0,set:function(t,n){return this.min.copy(t),this.max.copy(n),this},setFromArray:function(t){for(var n=1/0,e=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,h=t.length;s<h;s+=3){var l=t[s],c=t[s+1],u=t[s+2];l<n&&(n=l),c<e&&(e=c),u<i&&(i=u),r<l&&(r=l),a<c&&(a=c),o<u&&(o=u)}return this.min.set(n,e,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(t){for(var n=1/0,e=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,h=t.count;s<h;s++){var l=t.getX(s),c=t.getY(s),u=t.getZ(s);l<n&&(n=l),c<e&&(e=c),u<i&&(i=u),r<l&&(r=l),a<c&&(a=c),o<u&&(o=u)}return this.min.set(n,e,i),this.max.set(r,a,o),this},setFromPoints:function(t){this.makeEmpty();for(var n=0,e=t.length;n<e;n++)this.expandByPoint(t[n]);return this},setFromCenterAndSize:function(t,n){n=V.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this},setFromObject:function(t){return this.makeEmpty(),this.expandByObject(t)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.min.copy(t.min),this.max.copy(t.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(t){return void 0===t&&(console.warn("THREE.Box3: .getCenter() target is now required"),t=new B),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(t){return void 0===t&&(console.warn("THREE.Box3: .getSize() target is now required"),t=new B),this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)},expandByPoint:function(t){return this.min.min(t),this.max.max(t),this},expandByVector:function(t){return this.min.sub(t),this.max.add(t),this},expandByScalar:function(t){return this.min.addScalar(-t),this.max.addScalar(t),this},expandByObject:function(t){t.updateWorldMatrix(!1,!1);var n=t.geometry;void 0!==n&&(null===n.boundingBox&&n.computeBoundingBox(),Y.copy(n.boundingBox),Y.applyMatrix4(t.matrixWorld),this.union(Y));for(var e=t.children,i=0,r=e.length;i<r;i++)this.expandByObject(e[i]);return this},containsPoint:function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,n){return void 0===n&&(console.warn("THREE.Box3: .getParameter() target is now required"),n=new B),n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},intersectsSphere:function(t){return this.clampPoint(t.center,V),V.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var n,e=0<t.normal.x?(n=t.normal.x*this.min.x,t.normal.x*this.max.x):(n=t.normal.x*this.max.x,t.normal.x*this.min.x);return 0<t.normal.y?(n+=t.normal.y*this.min.y,e+=t.normal.y*this.max.y):(n+=t.normal.y*this.max.y,e+=t.normal.y*this.min.y),0<t.normal.z?(n+=t.normal.z*this.min.z,e+=t.normal.z*this.max.z):(n+=t.normal.z*this.max.z,e+=t.normal.z*this.min.z),n<=-t.constant&&e>=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return!1;this.getCenter(J),$.subVectors(this.max,J),j.subVectors(t.a,J),Q.subVectors(t.b,J),W.subVectors(t.c,J),Z.subVectors(Q,j),q.subVectors(W,Q),K.subVectors(j,W);t=[0,-Z.z,Z.y,0,-q.z,q.y,0,-K.z,K.y,Z.z,0,-Z.x,q.z,0,-q.x,K.z,0,-K.x,-Z.y,Z.x,0,-q.y,q.x,0,-K.y,K.x,0];return!!it(t,j,Q,W,$)&&(!!it(t=[1,0,0,0,1,0,0,0,1],j,Q,W,$)&&(tt.crossVectors(Z,q),it(t=[tt.x,tt.y,tt.z],j,Q,W,$)))},clampPoint:function(t,n){return void 0===n&&(console.warn("THREE.Box3: .clampPoint() target is now required"),n=new B),n.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return V.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(V).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()||(k[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),k[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),k[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),k[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),k[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),k[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),k[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),k[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(k)),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}),Object.defineProperties(rt.prototype,{width:{get:function(){return this.z},set:function(t){this.z=t}},height:{get:function(){return this.w},set:function(t){this.w=t}}}),Object.assign(rt.prototype,{isVector4:!0,set:function(t,n,e,i){return this.x=t,this.y=n,this.z=e,this.w=i,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setW:function(t){return this.w=t,this},setComponent:function(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},add:function(t,n){return void 0!==n?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,n)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},addVectors:function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this.w=t.w+n.w,this},addScaledVector:function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this.w+=t.w*n,this},sub:function(t,n){return void 0!==n?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,n)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},subVectors:function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this.w=t.w-n.w,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},applyMatrix4:function(t){var n=this.x,e=this.y,i=this.z,r=this.w,t=t.elements;return this.x=t[0]*n+t[4]*e+t[8]*i+t[12]*r,this.y=t[1]*n+t[5]*e+t[9]*i+t[13]*r,this.z=t[2]*n+t[6]*e+t[10]*i+t[14]*r,this.w=t[3]*n+t[7]*e+t[11]*i+t[15]*r,this},divideScalar:function(t){return this.multiplyScalar(1/t)},setAxisAngleFromQuaternion:function(t){this.w=2*Math.acos(t.w);var n=Math.sqrt(1-t.w*t.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/n,this.y=t.y/n,this.z=t.z/n),this},setAxisAngleFromRotationMatrix:function(t){var n,e,i,r=t.elements,a=r[0],o=r[4],s=r[8],h=r[1],l=r[5],c=r[9],u=r[2],f=r[6],d=r[10];if(Math.abs(o-h)<.01&&Math.abs(s-u)<.01&&Math.abs(c-f)<.01){if(Math.abs(o+h)<.1&&Math.abs(s+u)<.1&&Math.abs(c+f)<.1&&Math.abs(a+l+d-3)<.1)return this.set(1,0,0,0),this;var v=Math.PI,m=(a+1)/2,p=(l+1)/2,g=(d+1)/2,_=(o+h)/4,t=(s+u)/4,r=(c+f)/4;return p<m&&g<m?i=m<.01?(n=0,e=.707106781):(e=_/(n=Math.sqrt(m)),t/n):g<p?i=p<.01?(e=0,n=.707106781):(n=_/(e=Math.sqrt(p)),r/e):g<.01?(e=n=.707106781,i=0):(n=t/(i=Math.sqrt(g)),e=r/i),this.set(n,e,i,v),this}v=Math.sqrt((f-c)*(f-c)+(s-u)*(s-u)+(h-o)*(h-o));return Math.abs(v)<.001&&(v=1),this.x=(f-c)/v,this.y=(s-u)/v,this.z=(h-o)/v,this.w=Math.acos((a+l+d-1)/2),this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this},clamp:function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this.w=Math.max(t.w,Math.min(n.w,this.w)),this},clampScalar:function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this.w=Math.max(t,Math.min(n,this.w)),this},clampLength:function(t,n){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(n,e)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this.w+=(t.w-this.w)*n,this},lerpVectors:function(t,n,e){return this.subVectors(n,t).multiplyScalar(e).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},fromArray:function(t,n){return this.x=t[n=void 0===n?0:n],this.y=t[n+1],this.z=t[n+2],this.w=t[n+3],this},toArray:function(t,n){return(t=void 0===t?[]:t)[n=void 0===n?0:n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t[n+3]=this.w,t},fromBufferAttribute:function(t,n,e){return void 0!==e&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this.w=t.getW(n),this}}),Object.defineProperties(at.prototype,{width:{get:function(){return this.x},set:function(t){this.x=t}},height:{get:function(){return this.y},set:function(t){this.y=t}}}),Object.assign(at.prototype,{isVector2:!0,set:function(t,n){return this.x=t,this.y=n,this},setScalar:function(t){return this.x=t,this.y=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setComponent:function(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(t){return this.x=t.x,this.y=t.y,this},add:function(t,n){return void 0!==n?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,n)):(this.x+=t.x,this.y+=t.y,this)},addScalar:function(t){return this.x+=t,this.y+=t,this},addVectors:function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this},addScaledVector:function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this},sub:function(t,n){return void 0!==n?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,n)):(this.x-=t.x,this.y-=t.y,this)},subScalar:function(t){return this.x-=t,this.y-=t,this},subVectors:function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this},multiply:function(t){return this.x*=t.x,this.y*=t.y,this},multiplyScalar:function(t){return this.x*=t,this.y*=t,this},divide:function(t){return this.x/=t.x,this.y/=t.y,this},divideScalar:function(t){return this.multiplyScalar(1/t)},applyMatrix3:function(t){var n=this.x,e=this.y,t=t.elements;return this.x=t[0]*n+t[3]*e+t[6],this.y=t[1]*n+t[4]*e+t[7],this},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},clamp:function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this},clampScalar:function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this},clampLength:function(t,n){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(n,e)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(t){return this.x*t.x+this.y*t.y},cross:function(t){return this.x*t.y-this.y*t.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){return Math.atan2(-this.y,-this.x)+Math.PI},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var n=this.x-t.x,t=this.y-t.y;return n*n+t*t},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},setLength:function(t){return this.normalize().multiplyScalar(t)},lerp:function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this},lerpVectors:function(t,n,e){return this.subVectors(n,t).multiplyScalar(e).add(t)},equals:function(t){return t.x===this.x&&t.y===this.y},fromArray:function(t,n){return this.x=t[n=void 0===n?0:n],this.y=t[n+1],this},toArray:function(t,n){return(t=void 0===t?[]:t)[n=void 0===n?0:n]=this.x,t[n+1]=this.y,t},fromBufferAttribute:function(t,n,e){return void 0!==e&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(n),this.y=t.getY(n),this},rotateAround:function(t,n){var e=Math.cos(n),i=Math.sin(n),r=this.x-t.x,n=this.y-t.y;return this.x=r*e-n*i+t.x,this.y=r*i+n*e+t.y,this}});var ot=new B;function st(t,n,e){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=n,this.count=void 0!==t?t.length/n:0,this.normalized=!0===e,this.usage=y,this.updateRange={offset:0,count:-1},this.version=0}function ht(t,n,e){st.call(this,new Int8Array(t),n,e)}function lt(t,n,e){st.call(this,new Uint8Array(t),n,e)}function ct(t,n,e){st.call(this,new Uint8ClampedArray(t),n,e)}function ut(t,n,e){st.call(this,new Int16Array(t),n,e)}function ft(t,n,e){st.call(this,new Uint16Array(t),n,e)}function dt(t,n,e){st.call(this,new Int32Array(t),n,e)}function vt(t,n,e){st.call(this,new Uint32Array(t),n,e)}function mt(t,n,e){st.call(this,new Float32Array(t),n,e)}function pt(t,n,e){st.call(this,new Float64Array(t),n,e)}Object.defineProperty(st.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(st.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,n,e){t*=this.itemSize,e*=n.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[t+i]=n.array[e+i];return this},copyArray:function(t){return this.array.set(t),this},copyColorsArray:function(t){for(var n=this.array,e=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new I),n[e++]=a.r,n[e++]=a.g,n[e++]=a.b}return this},copyVector2sArray:function(t){for(var n=this.array,e=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new at),n[e++]=a.x,n[e++]=a.y}return this},copyVector3sArray:function(t){for(var n=this.array,e=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new B),n[e++]=a.x,n[e++]=a.y,n[e++]=a.z}return this},copyVector4sArray:function(t){for(var n=this.array,e=0,i=0,r=t.length;i<r;i++){var a=t[i];void 0===a&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new rt),n[e++]=a.x,n[e++]=a.y,n[e++]=a.z,n[e++]=a.w}return this},applyMatrix3:function(t){for(var n=0,e=this.count;n<e;n++)ot.x=this.getX(n),ot.y=this.getY(n),ot.z=this.getZ(n),ot.applyMatrix3(t),this.setXYZ(n,ot.x,ot.y,ot.z);return this},applyMatrix4:function(t){for(var n=0,e=this.count;n<e;n++)ot.x=this.getX(n),ot.y=this.getY(n),ot.z=this.getZ(n),ot.applyMatrix4(t),this.setXYZ(n,ot.x,ot.y,ot.z);return this},applyNormalMatrix:function(t){for(var n=0,e=this.count;n<e;n++)ot.x=this.getX(n),ot.y=this.getY(n),ot.z=this.getZ(n),ot.applyNormalMatrix(t),this.setXYZ(n,ot.x,ot.y,ot.z);return this},transformDirection:function(t){for(var n=0,e=this.count;n<e;n++)ot.x=this.getX(n),ot.y=this.getY(n),ot.z=this.getZ(n),ot.transformDirection(t),this.setXYZ(n,ot.x,ot.y,ot.z);return this},set:function(t,n){return this.array.set(t,n=void 0===n?0:n),this},getX:function(t){return this.array[t*this.itemSize]},setX:function(t,n){return this.array[t*this.itemSize]=n,this},getY:function(t){return this.array[t*this.itemSize+1]},setY:function(t,n){return this.array[t*this.itemSize+1]=n,this},getZ:function(t){return this.array[t*this.itemSize+2]},setZ:function(t,n){return this.array[t*this.itemSize+2]=n,this},getW:function(t){return this.array[t*this.itemSize+3]},setW:function(t,n){return this.array[t*this.itemSize+3]=n,this},setXY:function(t,n,e){return t*=this.itemSize,this.array[t+0]=n,this.array[t+1]=e,this},setXYZ:function(t,n,e,i){return t*=this.itemSize,this.array[t+0]=n,this.array[t+1]=e,this.array[t+2]=i,this},setXYZW:function(t,n,e,i,r){return t*=this.itemSize,this.array[t+0]=n,this.array[t+1]=e,this.array[t+2]=i,this.array[t+3]=r,this},onUpload:function(t){return this.onUploadCallback=t,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)}}),(ht.prototype=Object.create(st.prototype)).constructor=ht,(lt.prototype=Object.create(st.prototype)).constructor=lt,(ct.prototype=Object.create(st.prototype)).constructor=ct,(ut.prototype=Object.create(st.prototype)).constructor=ut,ft.prototype=Object.create(st.prototype),ft.prototype.constructor=ft,(dt.prototype=Object.create(st.prototype)).constructor=dt,vt.prototype=Object.create(st.prototype),vt.prototype.constructor=vt,(mt.prototype=Object.create(st.prototype)).constructor=mt,(pt.prototype=Object.create(st.prototype)).constructor=pt;var gt=new et;function _t(t,n){this.center=void 0!==t?t:new B,this.radius=void 0!==n?n:0}function xt(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}Object.assign(_t.prototype,{set:function(t,n){return this.center.copy(t),this.radius=n,this},setFromPoints:function(t,n){var e=this.center;void 0!==n?e.copy(n):gt.setFromPoints(t).getCenter(e);for(var i=0,r=0,a=t.length;r<a;r++)i=Math.max(i,e.distanceToSquared(t[r]));return this.radius=Math.sqrt(i),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.center.copy(t.center),this.radius=t.radius,this},empty:function(){return this.radius<=0},containsPoint:function(t){return t.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(t){return t.distanceTo(this.center)-this.radius},intersectsSphere:function(t){var n=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=n*n},intersectsBox:function(t){return t.intersectsSphere(this)},intersectsPlane:function(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius},clampPoint:function(t,n){var e=this.center.distanceToSquared(t);return void 0===n&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),n=new B),n.copy(t),e>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new et),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}}),Object.assign(xt.prototype,{computeGroups:function(t){for(var n,e=[],i=void 0,r=t.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,void 0!==n&&(n.count=3*a-n.start,e.push(n)),n={start:3*a,materialIndex:i})}void 0!==n&&(n.count=3*a-n.start,e.push(n)),this.groups=e},fromGeometry:function(t){var n=t.faces,e=t.vertices,i=t.faceVertexUvs,r=i[0]&&0<i[0].length,a=i[1]&&0<i[1].length,o=t.morphTargets,s=o.length;if(0<s){for(var h=[],l=0;l<s;l++)h[l]={name:o[l].name,data:[]};this.morphTargets.position=h}var c=t.morphNormals,u=c.length;if(0<u){for(var f=[],l=0;l<u;l++)f[l]={name:c[l].name,data:[]};this.morphTargets.normal=f}var d=t.skinIndices,v=t.skinWeights,m=d.length===e.length,p=v.length===e.length;0<e.length&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(l=0;l<n.length;l++){var g=n[l];this.vertices.push(e[g.a],e[g.b],e[g.c]);var _=g.vertexNormals;3===_.length?this.normals.push(_[0],_[1],_[2]):(A=g.normal,this.normals.push(A,A,A));var x,A=g.vertexColors;3===A.length?this.colors.push(A[0],A[1],A[2]):(A=g.color,this.colors.push(A,A,A)),!0===r&&(void 0!==(x=i[0][l])?this.uvs.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new at,new at,new at))),!0===a&&(void 0!==(x=i[1][l])?this.uvs2.push(x[0],x[1],x[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new at,new at,new at)));for(var w=0;w<s;w++){var S=o[w].vertices;h[w].data.push(S[g.a],S[g.b],S[g.c])}for(w=0;w<u;w++){var y=c[w].vertexNormals[l];f[w].data.push(y.a,y.b,y.c)}m&&this.skinIndices.push(d[g.a],d[g.b],d[g.c]),p&&this.skinWeights.push(v[g.a],v[g.b],v[g.c])}return this.computeGroups(t),this.verticesNeedUpdate=t.verticesNeedUpdate,this.normalsNeedUpdate=t.normalsNeedUpdate,this.colorsNeedUpdate=t.colorsNeedUpdate,this.uvsNeedUpdate=t.uvsNeedUpdate,this.groupsNeedUpdate=t.groupsNeedUpdate,null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this}});var At=new B,wt=new Lt,St=new B(0,0,0),yt=new B(1,1,1),Mt=new B,Tt=new B,bt=new B;function Lt(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(Lt.prototype,{isMatrix4:!0,set:function(t,n,e,i,r,a,o,s,h,l,c,u,f,d,v,m){var p=this.elements;return p[0]=t,p[4]=n,p[8]=e,p[12]=i,p[1]=r,p[5]=a,p[9]=o,p[13]=s,p[2]=h,p[6]=l,p[10]=c,p[14]=u,p[3]=f,p[7]=d,p[11]=v,p[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new Lt).fromArray(this.elements)},copy:function(t){var n=this.elements,t=t.elements;return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],this},copyPosition:function(t){var n=this.elements,t=t.elements;return n[12]=t[12],n[13]=t[13],n[14]=t[14],this},extractBasis:function(t,n,e){return t.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),e.setFromMatrixColumn(this,2),this},makeBasis:function(t,n,e){return this.set(t.x,n.x,e.x,0,t.y,n.y,e.y,0,t.z,n.z,e.z,0,0,0,0,1),this},extractRotation:function(t){var n=this.elements,e=t.elements,i=1/At.setFromMatrixColumn(t,0).length(),r=1/At.setFromMatrixColumn(t,1).length(),t=1/At.setFromMatrixColumn(t,2).length();return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n[3]=0,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=0,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this},makeRotationFromEuler:function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var n,e,i,r,a,o,s,h,l,c,u,f,d=this.elements,v=t.x,m=t.y,p=t.z,g=Math.cos(v),_=Math.sin(v),x=Math.cos(m),v=Math.sin(m),m=Math.cos(p),p=Math.sin(p);return"XYZ"===t.order?(a=g*m,o=g*p,s=_*m,h=_*p,d[0]=x*m,d[4]=-x*p,d[8]=v,d[1]=o+s*v,d[5]=a-h*v,d[9]=-_*x,d[2]=h-a*v,d[6]=s+o*v,d[10]=g*x):"YXZ"===t.order?(e=x*p,i=v*m,d[0]=(n=x*m)+(r=v*p)*_,d[4]=i*_-e,d[8]=g*v,d[1]=g*p,d[5]=g*m,d[9]=-_,d[2]=e*_-i,d[6]=r+n*_,d[10]=g*x):"ZXY"===t.order?(e=x*p,i=v*m,d[0]=(n=x*m)-(r=v*p)*_,d[4]=-g*p,d[8]=i+e*_,d[1]=e+i*_,d[5]=g*m,d[9]=r-n*_,d[2]=-g*v,d[6]=_,d[10]=g*x):"ZYX"===t.order?(a=g*m,o=g*p,s=_*m,h=_*p,d[0]=x*m,d[4]=s*v-o,d[8]=a*v+h,d[1]=x*p,d[5]=h*v+a,d[9]=o*v-s,d[2]=-v,d[6]=_*x,d[10]=g*x):"YZX"===t.order?(l=g*x,c=g*v,u=_*x,f=_*v,d[0]=x*m,d[4]=f-l*p,d[8]=u*p+c,d[1]=p,d[5]=g*m,d[9]=-_*m,d[2]=-v*m,d[6]=c*p+u,d[10]=l-f*p):"XZY"===t.order&&(l=g*x,c=g*v,u=_*x,f=_*v,d[0]=x*m,d[4]=-p,d[8]=v*m,d[1]=l*p+f,d[5]=g*m,d[9]=c*p-u,d[2]=u*p-c,d[6]=_*m,d[10]=f*p+l),d[3]=0,d[7]=0,d[11]=0,d[12]=0,d[13]=0,d[14]=0,d[15]=1,this},makeRotationFromQuaternion:function(t){return this.compose(St,t,yt)},lookAt:function(t,n,e){var i=this.elements;return bt.subVectors(t,n),0===bt.lengthSq()&&(bt.z=1),bt.normalize(),Mt.crossVectors(e,bt),0===Mt.lengthSq()&&(1===Math.abs(e.z)?bt.x+=1e-4:bt.z+=1e-4,bt.normalize(),Mt.crossVectors(e,bt)),Mt.normalize(),Tt.crossVectors(bt,Mt),i[0]=Mt.x,i[4]=Tt.x,i[8]=bt.x,i[1]=Mt.y,i[5]=Tt.y,i[9]=bt.y,i[2]=Mt.z,i[6]=Tt.z,i[10]=bt.z,this},multiply:function(t,n){return void 0!==n?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,n)):this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,n){var e=t.elements,i=n.elements,r=this.elements,a=e[0],o=e[4],s=e[8],h=e[12],l=e[1],c=e[5],u=e[9],f=e[13],d=e[2],v=e[6],m=e[10],p=e[14],g=e[3],_=e[7],x=e[11],A=e[15],w=i[0],S=i[4],y=i[8],M=i[12],T=i[1],b=i[5],L=i[9],P=i[13],E=i[2],F=i[6],N=i[10],D=i[14],t=i[3],n=i[7],e=i[11],i=i[15];return r[0]=a*w+o*T+s*E+h*t,r[4]=a*S+o*b+s*F+h*n,r[8]=a*y+o*L+s*N+h*e,r[12]=a*M+o*P+s*D+h*i,r[1]=l*w+c*T+u*E+f*t,r[5]=l*S+c*b+u*F+f*n,r[9]=l*y+c*L+u*N+f*e,r[13]=l*M+c*P+u*D+f*i,r[2]=d*w+v*T+m*E+p*t,r[6]=d*S+v*b+m*F+p*n,r[10]=d*y+v*L+m*N+p*e,r[14]=d*M+v*P+m*D+p*i,r[3]=g*w+_*T+x*E+A*t,r[7]=g*S+_*b+x*F+A*n,r[11]=g*y+_*L+x*N+A*e,r[15]=g*M+_*P+x*D+A*i,this},multiplyScalar:function(t){var n=this.elements;return n[0]*=t,n[4]*=t,n[8]*=t,n[12]*=t,n[1]*=t,n[5]*=t,n[9]*=t,n[13]*=t,n[2]*=t,n[6]*=t,n[10]*=t,n[14]*=t,n[3]*=t,n[7]*=t,n[11]*=t,n[15]*=t,this},determinant:function(){var t=this.elements,n=t[0],e=t[4],i=t[8],r=t[12],a=t[1],o=t[5],s=t[9],h=t[13],l=t[2],c=t[6],u=t[10],f=t[14];return t[3]*(+r*s*c-i*h*c-r*o*u+e*h*u+i*o*f-e*s*f)+t[7]*(+n*s*f-n*h*u+r*a*u-i*a*f+i*h*l-r*s*l)+t[11]*(+n*h*c-n*o*f-r*a*c+e*a*f+r*o*l-e*h*l)+t[15]*(-i*o*l-n*s*c+n*o*u+i*a*c-e*a*u+e*s*l)},transpose:function(){var t=this.elements,n=t[1];return t[1]=t[4],t[4]=n,n=t[2],t[2]=t[8],t[8]=n,n=t[6],t[6]=t[9],t[9]=n,n=t[3],t[3]=t[12],t[12]=n,n=t[7],t[7]=t[13],t[13]=n,n=t[11],t[11]=t[14],t[14]=n,this},setPosition:function(t,n,e){var i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=n,i[14]=e),this},getInverse:function(t,n){void 0!==n&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var e=this.elements,i=t.elements,r=i[0],a=i[1],o=i[2],s=i[3],h=i[4],l=i[5],c=i[6],u=i[7],f=i[8],d=i[9],v=i[10],m=i[11],p=i[12],g=i[13],_=i[14],x=i[15],A=d*_*u-g*v*u+g*c*m-l*_*m-d*c*x+l*v*x,w=p*v*u-f*_*u-p*c*m+h*_*m+f*c*x-h*v*x,n=f*g*u-p*d*u+p*l*m-h*g*m-f*l*x+h*d*x,t=p*d*c-f*g*c-p*l*v+h*g*v+f*l*_-h*d*_,i=r*A+a*w+o*n+s*t;if(0==i)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);i=1/i;return e[0]=A*i,e[1]=(g*v*s-d*_*s-g*o*m+a*_*m+d*o*x-a*v*x)*i,e[2]=(l*_*s-g*c*s+g*o*u-a*_*u-l*o*x+a*c*x)*i,e[3]=(d*c*s-l*v*s-d*o*u+a*v*u+l*o*m-a*c*m)*i,e[4]=w*i,e[5]=(f*_*s-p*v*s+p*o*m-r*_*m-f*o*x+r*v*x)*i,e[6]=(p*c*s-h*_*s-p*o*u+r*_*u+h*o*x-r*c*x)*i,e[7]=(h*v*s-f*c*s+f*o*u-r*v*u-h*o*m+r*c*m)*i,e[8]=n*i,e[9]=(p*d*s-f*g*s-p*a*m+r*g*m+f*a*x-r*d*x)*i,e[10]=(h*g*s-p*l*s+p*a*u-r*g*u-h*a*x+r*l*x)*i,e[11]=(f*l*s-h*d*s-f*a*u+r*d*u+h*a*m-r*l*m)*i,e[12]=t*i,e[13]=(f*g*o-p*d*o+p*a*v-r*g*v-f*a*_+r*d*_)*i,e[14]=(p*l*o-h*g*o-p*a*c+r*g*c+h*a*_-r*l*_)*i,e[15]=(h*d*o-f*l*o+f*a*c-r*d*c-h*a*v+r*l*v)*i,this},scale:function(t){var n=this.elements,e=t.x,i=t.y,t=t.z;return n[0]*=e,n[4]*=i,n[8]*=t,n[1]*=e,n[5]*=i,n[9]*=t,n[2]*=e,n[6]*=i,n[10]*=t,n[3]*=e,n[7]*=i,n[11]*=t,this},getMaxScaleOnAxis:function(){var t=this.elements,n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],e=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],t=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(n,e,t))},makeTranslation:function(t,n,e){return this.set(1,0,0,t,0,1,0,n,0,0,1,e,0,0,0,1),this},makeRotationX:function(t){var n=Math.cos(t),t=Math.sin(t);return this.set(1,0,0,0,0,n,-t,0,0,t,n,0,0,0,0,1),this},makeRotationY:function(t){var n=Math.cos(t),t=Math.sin(t);return this.set(n,0,t,0,0,1,0,0,-t,0,n,0,0,0,0,1),this},makeRotationZ:function(t){var n=Math.cos(t),t=Math.sin(t);return this.set(n,-t,0,0,t,n,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(t,n){var e=Math.cos(n),i=Math.sin(n),r=1-e,a=t.x,o=t.y,s=t.z,n=r*a,t=r*o;return this.set(n*a+e,n*o-i*s,n*s+i*o,0,n*o+i*s,t*o+e,t*s-i*a,0,n*s-i*o,t*s+i*a,r*s*s+e,0,0,0,0,1),this},makeScale:function(t,n,e){return this.set(t,0,0,0,0,n,0,0,0,0,e,0,0,0,0,1),this},makeShear:function(t,n,e){return this.set(1,n,e,0,t,1,e,0,t,n,1,0,0,0,0,1),this},compose:function(t,n,e){var i=this.elements,r=n.u,a=n.f,o=n.v,s=n._,h=r+r,l=a+a,c=o+o,u=r*h,f=r*l,d=r*c,n=a*l,r=a*c,a=o*c,o=s*h,h=s*l,l=s*c,s=e.x,c=e.y,e=e.z;return i[0]=(1-(n+a))*s,i[1]=(f+l)*s,i[2]=(d-h)*s,i[3]=0,i[4]=(f-l)*c,i[5]=(1-(u+a))*c,i[6]=(r+o)*c,i[7]=0,i[8]=(d+h)*e,i[9]=(r-o)*e,i[10]=(1-(u+n))*e,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this},decompose:function(t,n,e){var i=this.elements,r=At.set(i[0],i[1],i[2]).length(),a=At.set(i[4],i[5],i[6]).length(),o=At.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],wt.copy(this);var s=1/r,t=1/a,i=1/o;return wt.elements[0]*=s,wt.elements[1]*=s,wt.elements[2]*=s,wt.elements[4]*=t,wt.elements[5]*=t,wt.elements[6]*=t,wt.elements[8]*=i,wt.elements[9]*=i,wt.elements[10]*=i,n.setFromRotationMatrix(wt),e.x=r,e.y=a,e.z=o,this},makePerspective:function(t,n,e,i,r,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(e-i),h=(n+t)/(n-t),e=(e+i)/(e-i),i=-(a+r)/(a-r),a=-2*a*r/(a-r);return o[0]=2*r/(n-t),o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=s,o[9]=e,o[13]=0,o[2]=0,o[6]=0,o[10]=i,o[14]=a,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(t,n,e,i,r,a){var o=this.elements,s=1/(n-t),h=1/(e-i),l=1/(a-r),t=(n+t)*s,i=(e+i)*h,r=(a+r)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-t,o[1]=0,o[5]=2*h,o[9]=0,o[13]=-i,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-r,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(t){for(var n=this.elements,e=t.elements,i=0;i<16;i++)if(n[i]!==e[i])return!1;return!0},fromArray:function(t,n){void 0===n&&(n=0);for(var e=0;e<16;e++)this.elements[e]=t[e+n];return this},toArray:function(t,n){var e=this.elements;return(t=void 0===t?[]:t)[n=void 0===n?0:n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3],t[n+4]=e[4],t[n+5]=e[5],t[n+6]=e[6],t[n+7]=e[7],t[n+8]=e[8],t[n+9]=e[9],t[n+10]=e[10],t[n+11]=e[11],t[n+12]=e[12],t[n+13]=e[13],t[n+14]=e[14],t[n+15]=e[15],t}});var Pt=new Lt,Et=new X;function Ft(t,n,e,i){this.u=t||0,this.f=n||0,this.v=e||0,this.M=i||Ft.DefaultOrder}function Nt(){this.mask=1}function Dt(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Ft.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],Ft.DefaultOrder="XYZ",Object.defineProperties(Ft.prototype,{x:{get:function(){return this.u},set:function(t){this.u=t,this.A()}},y:{get:function(){return this.f},set:function(t){this.f=t,this.A()}},z:{get:function(){return this.v},set:function(t){this.v=t,this.A()}},order:{get:function(){return this.M},set:function(t){this.M=t,this.A()}}}),Object.assign(Ft.prototype,{isEuler:!0,set:function(t,n,e,i){return this.u=t,this.f=n,this.v=e,this.M=i||this.M,this.A(),this},clone:function(){return new this.constructor(this.u,this.f,this.v,this.M)},copy:function(t){return this.u=t.u,this.f=t.f,this.v=t.v,this.M=t.M,this.A(),this},setFromRotationMatrix:function(t,n,e){var i=E.clamp,r=t.elements,a=r[0],o=r[4],s=r[8],h=r[1],l=r[5],c=r[9],u=r[2],t=r[6],r=r[10];return"XYZ"===(n=n||this.M)?(this.f=Math.asin(i(s,-1,1)),Math.abs(s)<.9999999?(this.u=Math.atan2(-c,r),this.v=Math.atan2(-o,a)):(this.u=Math.atan2(t,l),this.v=0)):"YXZ"===n?(this.u=Math.asin(-i(c,-1,1)),Math.abs(c)<.9999999?(this.f=Math.atan2(s,r),this.v=Math.atan2(h,l)):(this.f=Math.atan2(-u,a),this.v=0)):"ZXY"===n?(this.u=Math.asin(i(t,-1,1)),Math.abs(t)<.9999999?(this.f=Math.atan2(-u,r),this.v=Math.atan2(-o,l)):(this.f=0,this.v=Math.atan2(h,a))):"ZYX"===n?(this.f=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this.u=Math.atan2(t,r),this.v=Math.atan2(h,a)):(this.u=0,this.v=Math.atan2(-o,l))):"YZX"===n?(this.v=Math.asin(i(h,-1,1)),Math.abs(h)<.9999999?(this.u=Math.atan2(-c,l),this.f=Math.atan2(-u,a)):(this.u=0,this.f=Math.atan2(s,r))):"XZY"===n?(this.v=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this.u=Math.atan2(t,l),this.f=Math.atan2(s,a)):(this.u=Math.atan2(-c,r),this.f=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+n),this.M=n,!1!==e&&this.A(),this},setFromQuaternion:function(t,n,e){return Pt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Pt,n,e)},setFromVector3:function(t,n){return this.set(t.x,t.y,t.z,n||this.M)},reorder:function(t){return Et.setFromEuler(this),this.setFromQuaternion(Et,t)},equals:function(t){return t.u===this.u&&t.f===this.f&&t.v===this.v&&t.M===this.M},fromArray:function(t){return this.u=t[0],this.f=t[1],this.v=t[2],void 0!==t[3]&&(this.M=t[3]),this.A(),this},toArray:function(t,n){return(t=void 0===t?[]:t)[n=void 0===n?0:n]=this.u,t[n+1]=this.f,t[n+2]=this.v,t[n+3]=this.M,t},toVector3:function(t){return t?t.set(this.u,this.f,this.v):new B(this.u,this.f,this.v)},S:function(t){return this.A=t,this},A:function(){}}),Object.assign(Nt.prototype,{set:function(t){this.mask=1<<t|0},enable:function(t){this.mask|=1<<t|0},enableAll:function(){this.mask=-1},toggle:function(t){this.mask^=1<<t|0},disable:function(t){this.mask&=~(1<<t|0)},disableAll:function(){this.mask=0},test:function(t){return 0!=(this.mask&t.mask)}}),Object.assign(Dt.prototype,{isMatrix3:!0,set:function(t,n,e,i,r,a,o,s,h){var l=this.elements;return l[0]=t,l[1]=i,l[2]=o,l[3]=n,l[4]=r,l[5]=s,l[6]=e,l[7]=a,l[8]=h,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(t){var n=this.elements,t=t.elements;return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],this},extractBasis:function(t,n,e){return t.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),e.setFromMatrix3Column(this,2),this},setFromMatrix4:function(t){t=t.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(t){return this.multiplyMatrices(this,t)},premultiply:function(t){return this.multiplyMatrices(t,this)},multiplyMatrices:function(t,n){var e=t.elements,i=n.elements,r=this.elements,a=e[0],o=e[3],s=e[6],h=e[1],l=e[4],c=e[7],u=e[2],f=e[5],d=e[8],v=i[0],m=i[3],p=i[6],g=i[1],_=i[4],t=i[7],n=i[2],e=i[5],i=i[8];return r[0]=a*v+o*g+s*n,r[3]=a*m+o*_+s*e,r[6]=a*p+o*t+s*i,r[1]=h*v+l*g+c*n,r[4]=h*m+l*_+c*e,r[7]=h*p+l*t+c*i,r[2]=u*v+f*g+d*n,r[5]=u*m+f*_+d*e,r[8]=u*p+f*t+d*i,this},multiplyScalar:function(t){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=t,n[4]*=t,n[7]*=t,n[2]*=t,n[5]*=t,n[8]*=t,this},determinant:function(){var t=this.elements,n=t[0],e=t[1],i=t[2],r=t[3],a=t[4],o=t[5],s=t[6],h=t[7],t=t[8];return n*a*t-n*o*h-e*r*t+e*o*s+i*r*h-i*a*s},getInverse:function(t,n){void 0!==n&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var e=t.elements,i=this.elements,r=e[0],a=e[1],o=e[2],s=e[3],h=e[4],l=e[5],c=e[6],u=e[7],f=e[8],d=f*h-l*u,n=l*c-f*s,t=u*s-h*c,e=r*d+a*n+o*t;if(0==e)return this.set(0,0,0,0,0,0,0,0,0);e=1/e;return i[0]=d*e,i[1]=(o*u-f*a)*e,i[2]=(l*a-o*h)*e,i[3]=n*e,i[4]=(f*r-o*c)*e,i[5]=(o*s-l*r)*e,i[6]=t*e,i[7]=(a*c-u*r)*e,i[8]=(h*r-a*s)*e,this},transpose:function(){var t=this.elements,n=t[1];return t[1]=t[3],t[3]=n,n=t[2],t[2]=t[6],t[6]=n,n=t[5],t[5]=t[7],t[7]=n,this},getNormalMatrix:function(t){return this.setFromMatrix4(t).getInverse(this).transpose()},transposeIntoArray:function(t){var n=this.elements;return t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8],this},setUvTransform:function(t,n,e,i,r,a,o){var s=Math.cos(r),r=Math.sin(r);this.set(e*s,e*r,-e*(s*a+r*o)+a+t,-i*r,i*s,-i*(-r*a+s*o)+o+n,0,0,1)},scale:function(t,n){var e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=n,e[4]*=n,e[7]*=n,this},rotate:function(t){var n=Math.cos(t),e=Math.sin(t),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],h=i[4],t=i[7];return i[0]=n*r+e*s,i[3]=n*a+e*h,i[6]=n*o+e*t,i[1]=-e*r+n*s,i[4]=-e*a+n*h,i[7]=-e*o+n*t,this},translate:function(t,n){var e=this.elements;return e[0]+=t*e[2],e[3]+=t*e[5],e[6]+=t*e[8],e[1]+=n*e[2],e[4]+=n*e[5],e[7]+=n*e[8],this},equals:function(t){for(var n=this.elements,e=t.elements,i=0;i<9;i++)if(n[i]!==e[i])return!1;return!0},fromArray:function(t,n){void 0===n&&(n=0);for(var e=0;e<9;e++)this.elements[e]=t[e+n];return this},toArray:function(t,n){var e=this.elements;return(t=void 0===t?[]:t)[n=void 0===n?0:n]=e[0],t[n+1]=e[1],t[n+2]=e[2],t[n+3]=e[3],t[n+4]=e[4],t[n+5]=e[5],t[n+6]=e[6],t[n+7]=e[7],t[n+8]=e[8],t}});var Ct=0,It=new B,Rt=new X,Ut=new Lt,Ot=new B,Ht=new B,Xt=new B,Gt=new X,zt=new B(1,0,0),Bt=new B(0,1,0),kt=new B(0,0,1),Vt={type:"added"},Yt={type:"removed"};function jt(){Object.defineProperty(this,"id",{value:Ct++}),this.uuid=E.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=jt.DefaultUp.clone();var t=new B,n=new Ft,e=new X,i=new B(1,1,1);n.S(function(){e.setFromEuler(n,!1)}),e.S(function(){n.setFromQuaternion(e,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:e},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Lt},normalMatrix:{value:new Dt}}),this.matrix=new Lt,this.matrixWorld=new Lt,this.matrixAutoUpdate=jt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Nt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}jt.DefaultUp=new B(0,1,0),jt.DefaultMatrixAutoUpdate=!0,jt.prototype=Object.assign(Object.create(i.prototype),{constructor:jt,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(t){return this.quaternion.premultiply(t),this},setRotationFromAxisAngle:function(t,n){this.quaternion.setFromAxisAngle(t,n)},setRotationFromEuler:function(t){this.quaternion.setFromEuler(t,!0)},setRotationFromMatrix:function(t){this.quaternion.setFromRotationMatrix(t)},setRotationFromQuaternion:function(t){this.quaternion.copy(t)},rotateOnAxis:function(t,n){return Rt.setFromAxisAngle(t,n),this.quaternion.multiply(Rt),this},rotateOnWorldAxis:function(t,n){return Rt.setFromAxisAngle(t,n),this.quaternion.premultiply(Rt),this},rotateX:function(t){return this.rotateOnAxis(zt,t)},rotateY:function(t){return this.rotateOnAxis(Bt,t)},rotateZ:function(t){return this.rotateOnAxis(kt,t)},translateOnAxis:function(t,n){return It.copy(t).applyQuaternion(this.quaternion),this.position.add(It.multiplyScalar(n)),this},translateX:function(t){return this.translateOnAxis(zt,t)},translateY:function(t){return this.translateOnAxis(Bt,t)},translateZ:function(t){return this.translateOnAxis(kt,t)},localToWorld:function(t){return t.applyMatrix4(this.matrixWorld)},worldToLocal:function(t){return t.applyMatrix4(Ut.getInverse(this.matrixWorld))},lookAt:function(t,n,e){t.isVector3?Ot.copy(t):Ot.set(t,n,e);e=this.parent;this.updateWorldMatrix(!0,!1),Ht.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ut.lookAt(Ht,Ot,this.up):Ut.lookAt(Ot,Ht,this.up),this.quaternion.setFromRotationMatrix(Ut),e&&(Ut.extractRotation(e.matrixWorld),Rt.setFromRotationMatrix(Ut),this.quaternion.premultiply(Rt.inverse()))},add:function(t){if(1<arguments.length){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return t===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",t):t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),(t.parent=this).children.push(t),t.dispatchEvent(Vt)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this},remove:function(t){if(1<arguments.length){for(var n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}var e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Yt)),this},attach:function(t){return this.updateWorldMatrix(!0,!1),Ut.getInverse(this.matrixWorld),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ut.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ut),t.updateWorldMatrix(!1,!1),this.add(t),this},getObjectById:function(t){return this.getObjectByProperty("id",t)},getObjectByName:function(t){return this.getObjectByProperty("name",t)},getObjectByProperty:function(t,n){if(this[t]===n)return this;for(var e=0,i=this.children.length;e<i;e++){var r=this.children[e].getObjectByProperty(t,n);if(void 0!==r)return r}},getWorldPosition:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),t=new B),this.updateMatrixWorld(!0),t.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),t=new X),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Ht,t,Xt),t},getWorldScale:function(t){return void 0===t&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),t=new B),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Ht,Gt,t),t},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),t=new B),this.updateMatrixWorld(!0);var n=this.matrixWorld.elements;return t.set(n[8],n[9],n[10]).normalize()},raycast:function(){},traverse:function(t){t(this);for(var n=this.children,e=0,i=n.length;e<i;e++)n[e].traverse(t)},traverseVisible:function(t){if(!1!==this.visible){t(this);for(var n=this.children,e=0,i=n.length;e<i;e++)n[e].traverseVisible(t)}},traverseAncestors:function(t){var n=this.parent;null!==n&&(t(n),n.traverseAncestors(t))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t=!(this.matrixWorldNeedsUpdate=!1));for(var n=this.children,e=0,i=n.length;e<i;e++)n[e].updateMatrixWorld(t)},updateWorldMatrix:function(t,n){var e=this.parent;if(!0===t&&null!==e&&e.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===n)for(var i=this.children,r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,n){if(void 0===n&&(n=!0),this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===n)for(var e=0;e<t.children.length;e++){var i=t.children[e];this.add(i.clone())}return this}});var Qt=1,Wt=new Lt,Zt=new jt,qt=new B,Kt=new et,Jt=new et,$t=new B;function tn(){Object.defineProperty(this,"id",{value:Qt+=2}),this.uuid=E.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}tn.prototype=Object.assign(Object.create(i.prototype),{constructor:tn,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(t){Array.isArray(t)?this.index=new(65535<function(t){if(0===t.length)return-1/0;for(var n=t[0],e=1,i=t.length;e<i;++e)t[e]>n&&(n=t[e]);return n}(t)?vt:ft)(t,1):this.index=t},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,n){return this.attributes[t]=n,this},deleteAttribute:function(t){return delete this.attributes[t],this},addGroup:function(t,n,e){this.groups.push({start:t,count:n,materialIndex:void 0!==e?e:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,n){this.drawRange.start=t,this.drawRange.count=n},applyMatrix4:function(t){var n=this.attributes.position;void 0!==n&&(n.applyMatrix4(t),n.needsUpdate=!0);var e=this.attributes.normal;void 0!==e&&(n=(new Dt).getNormalMatrix(t),e.applyNormalMatrix(n),e.needsUpdate=!0);e=this.attributes.tangent;return void 0!==e&&(e.transformDirection(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return Wt.makeRotationX(t),this.applyMatrix4(Wt),this},rotateY:function(t){return Wt.makeRotationY(t),this.applyMatrix4(Wt),this},rotateZ:function(t){return Wt.makeRotationZ(t),this.applyMatrix4(Wt),this},translate:function(t,n,e){return Wt.makeTranslation(t,n,e),this.applyMatrix4(Wt),this},scale:function(t,n,e){return Wt.makeScale(t,n,e),this.applyMatrix4(Wt),this},lookAt:function(t){return Zt.lookAt(t),Zt.updateMatrix(),this.applyMatrix4(Zt.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(qt).negate(),this.translate(qt.x,qt.y,qt.z),this},setFromObject:function(t){var n,e,i=t.geometry;return t.isPoints||t.isLine?(n=new mt(3*i.vertices.length,3),e=new mt(3*i.colors.length,3),this.setAttribute("position",n.copyVector3sArray(i.vertices)),this.setAttribute("color",e.copyColorsArray(i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length&&(e=new mt(i.lineDistances.length,1),this.setAttribute("lineDistance",e.copyArray(i.lineDistances))),null!==i.boundingSphere&&(this.boundingSphere=i.boundingSphere.clone()),null!==i.boundingBox&&(this.boundingBox=i.boundingBox.clone())):t.isMesh&&i&&i.isGeometry&&this.fromGeometry(i),this},setFromPoints:function(t){for(var n=[],e=0,i=t.length;e<i;e++){var r=t[e];n.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new mt(n,3)),this},updateFromObject:function(t){var n,e=t.geometry;if(t.isMesh){var i=e.T;if(!0===e.elementsNeedUpdate&&(i=void 0,e.elementsNeedUpdate=!1),void 0===i)return this.fromGeometry(e);i.verticesNeedUpdate=e.verticesNeedUpdate,i.normalsNeedUpdate=e.normalsNeedUpdate,i.colorsNeedUpdate=e.colorsNeedUpdate,i.uvsNeedUpdate=e.uvsNeedUpdate,i.groupsNeedUpdate=e.groupsNeedUpdate,e.verticesNeedUpdate=!1,e.normalsNeedUpdate=!1,e.colorsNeedUpdate=!1,e.uvsNeedUpdate=!1,e.groupsNeedUpdate=!1,e=i}return!0===e.verticesNeedUpdate&&(void 0!==(n=this.attributes.position)&&(n.copyVector3sArray(e.vertices),n.needsUpdate=!0),e.verticesNeedUpdate=!1),!0===e.normalsNeedUpdate&&(void 0!==(n=this.attributes.normal)&&(n.copyVector3sArray(e.normals),n.needsUpdate=!0),e.normalsNeedUpdate=!1),!0===e.colorsNeedUpdate&&(void 0!==(n=this.attributes.color)&&(n.copyColorsArray(e.colors),n.needsUpdate=!0),e.colorsNeedUpdate=!1),e.uvsNeedUpdate&&(void 0!==(n=this.attributes.uv)&&(n.copyVector2sArray(e.uvs),n.needsUpdate=!0),e.uvsNeedUpdate=!1),e.lineDistancesNeedUpdate&&(void 0!==(n=this.attributes.lineDistance)&&(n.copyArray(e.lineDistances),n.needsUpdate=!0),e.lineDistancesNeedUpdate=!1),e.groupsNeedUpdate&&(e.computeGroups(t.geometry),this.groups=e.groups,e.groupsNeedUpdate=!1),this},fromGeometry:function(t){return t.T=(new xt).fromGeometry(t),this.fromDirectGeometry(t.T)},fromDirectGeometry:function(t){var n,e,i,r,a=new Float32Array(3*t.vertices.length);for(i in this.setAttribute("position",new st(a,3).copyVector3sArray(t.vertices)),0<t.normals.length&&(n=new Float32Array(3*t.normals.length),this.setAttribute("normal",new st(n,3).copyVector3sArray(t.normals))),0<t.colors.length&&(n=new Float32Array(3*t.colors.length),this.setAttribute("color",new st(n,3).copyColorsArray(t.colors))),0<t.uvs.length&&(e=new Float32Array(2*t.uvs.length),this.setAttribute("uv",new st(e,2).copyVector2sArray(t.uvs))),0<t.uvs2.length&&(e=new Float32Array(2*t.uvs2.length),this.setAttribute("uv2",new st(e,2).copyVector2sArray(t.uvs2))),this.groups=t.groups,t.morphTargets){for(var o=[],s=t.morphTargets[i],h=0,l=s.length;h<l;h++){var c=s[h],u=new mt(3*c.data.length,3);u.name=c.name,o.push(u.copyVector3sArray(c.data))}this.morphAttributes[i]=o}return 0<t.skinIndices.length&&(r=new mt(4*t.skinIndices.length,4),this.setAttribute("skinIndex",r.copyVector4sArray(t.skinIndices))),0<t.skinWeights.length&&(r=new mt(4*t.skinWeights.length,4),this.setAttribute("skinWeight",r.copyVector4sArray(t.skinWeights))),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),this},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new _t);var t=this.attributes.position,n=this.morphAttributes.position;if(t){var e=this.boundingSphere.center;if(Kt.setFromBufferAttribute(t),n)for(var i=0,r=n.length;i<r;i++){var a=n[i];Jt.setFromBufferAttribute(a),this.morphTargetsRelative?($t.addVectors(Kt.min,Jt.min),Kt.expandByPoint($t),$t.addVectors(Kt.max,Jt.max),Kt.expandByPoint($t)):(Kt.expandByPoint(Jt.min),Kt.expandByPoint(Jt.max))}Kt.getCenter(e);for(var o=0,i=0,r=t.count;i<r;i++)$t.fromBufferAttribute(t,i),o=Math.max(o,e.distanceToSquared($t));if(n)for(i=0,r=n.length;i<r;i++)for(var a=n[i],s=this.morphTargetsRelative,h=0,l=a.count;h<l;h++)$t.fromBufferAttribute(a,h),s&&(qt.fromBufferAttribute(t,h),$t.add(qt)),o=Math.max(o,e.distanceToSquared($t));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var t=this.index,n=this.attributes;if(n.position){var e=n.position.array;if(void 0===n.normal)this.setAttribute("normal",new st(new Float32Array(e.length),3));else for(var i=n.normal.array,r=0,a=i.length;r<a;r++)i[r]=0;var o,s,h,l=n.normal.array,c=new B,u=new B,f=new B,d=new B,v=new B;if(t)for(var m=t.array,r=0,a=t.count;r<a;r+=3)o=3*m[r+0],s=3*m[r+1],h=3*m[r+2],c.fromArray(e,o),u.fromArray(e,s),f.fromArray(e,h),d.subVectors(f,u),v.subVectors(c,u),d.cross(v),l[o]+=d.x,l[1+o]+=d.y,l[2+o]+=d.z,l[s]+=d.x,l[1+s]+=d.y,l[2+s]+=d.z,l[h]+=d.x,l[1+h]+=d.y,l[2+h]+=d.z;else for(r=0,a=e.length;r<a;r+=9)c.fromArray(e,r),u.fromArray(e,r+3),f.fromArray(e,r+6),d.subVectors(f,u),v.subVectors(c,u),d.cross(v),l[r]=d.x,l[r+1]=d.y,l[r+2]=d.z,l[r+3]=d.x,l[r+4]=d.y,l[r+5]=d.z,l[r+6]=d.x,l[r+7]=d.y,l[r+8]=d.z;this.normalizeNormals(),n.normal.needsUpdate=!0}},normalizeNormals:function(){for(var t=this.attributes.normal,n=0,e=t.count;n<e;n++)$t.x=t.getX(n),$t.y=t.getY(n),$t.z=t.getZ(n),$t.normalize(),t.setXYZ(n,$t.x,$t.y,$t.z)},dispose:function(){this.dispatchEvent({type:"dispose"})}});var nn={enabled:!1,files:{},add:function(t,n){!1!==this.enabled&&(this.files[t]=n)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function en(t,n,e){var i=this,r=!1,a=0,o=0,s=void 0,h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=e,this.itemStart=function(t){o++,!1===r&&void 0!==i.onStart&&i.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,n){return h.push(t,n),this},this.removeHandler=function(t){t=h.indexOf(t);return-1!==t&&h.splice(t,2),this},this.getHandler=function(t){for(var n=0,e=h.length;n<e;n+=2){var i=h[n],r=h[n+1];if(i.global&&(i.lastIndex=0),i.test(t))return r}return null}}var rn=new en,an={};function on(t){Cn.call(this,t)}function sn(t){F.call(this),this.type="ShadowMaterial",this.color=new I(0),this.transparent=!0,this.setValues(t)}function hn(t){F.call(this),this.type="SpriteMaterial",this.color=new I(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}function ln(t){var n,e={};for(n in t)for(var i in e[n]={},t[n]){var r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}return e}function cn(t){for(var n={},e=0;e<t.length;e++){var i,r=ln(t[e]);for(i in r)n[i]=r[i]}return n}on.prototype=Object.assign(Object.create(Cn.prototype),{constructor:on,load:function(o,t,n,e){void 0===o&&(o=""),void 0!==this.path&&(o=this.path+o),o=this.manager.resolveURL(o);var s=this,i=nn.get(o);if(void 0!==i)return s.manager.itemStart(o),setTimeout(function(){t&&t(i),s.manager.itemEnd(o)},0),i;if(void 0===an[o]){var r=o.match(/^data:(.*?)(;base64)?,(.*)$/);if(r){var a=r[1],h=!!r[2],l=r[3],l=decodeURIComponent(l);h&&(l=atob(l));try{var c=(this.responseType||"").toLowerCase();switch(c){case"arraybuffer":case"blob":for(var u=new Uint8Array(l.length),f=0;f<l.length;f++)u[f]=l.charCodeAt(f);d="blob"===c?new Blob([u.buffer],{type:a}):u.buffer;break;case"document":var d=(new DOMParser).parseFromString(l,a);break;case"json":d=JSON.parse(l);break;default:d=l}setTimeout(function(){t&&t(d),s.manager.itemEnd(o)},0)}catch(t){setTimeout(function(){e&&e(t),s.manager.itemError(o),s.manager.itemEnd(o)},0)}}else{an[o]=[],an[o].push({onLoad:t,onProgress:n,onError:e});var v,m=new XMLHttpRequest;for(v in m.open("GET",o,!0),m.addEventListener("load",function(t){var n=this.response,e=an[o];if(delete an[o],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),nn.add(o,n);for(var i=0,r=e.length;i<r;i++)(a=e[i]).onLoad&&a.onLoad(n);s.manager.itemEnd(o)}else{for(var a,i=0,r=e.length;i<r;i++)(a=e[i]).onError&&a.onError(t);s.manager.itemError(o),s.manager.itemEnd(o)}},!1),m.addEventListener("progress",function(t){for(var n=an[o],e=0,i=n.length;e<i;e++){var r=n[e];r.onProgress&&r.onProgress(t)}},!1),m.addEventListener("error",function(t){var n=an[o];delete an[o];for(var e=0,i=n.length;e<i;e++){var r=n[e];r.onError&&r.onError(t)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),m.addEventListener("abort",function(t){var n=an[o];delete an[o];for(var e=0,i=n.length;e<i;e++){var r=n[e];r.onError&&r.onError(t)}s.manager.itemError(o),s.manager.itemEnd(o)},!1),void 0!==this.responseType&&(m.responseType=this.responseType),void 0!==this.withCredentials&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(void 0!==this.mimeType?this.mimeType:"text/plain"),this.requestHeader)m.setRequestHeader(v,this.requestHeader[v]);m.send(null)}return s.manager.itemStart(o),m}an[o].push({onLoad:t,onProgress:n,onError:e})},setResponseType:function(t){return this.responseType=t,this},setWithCredentials:function(t){return this.withCredentials=t,this},setMimeType:function(t){return this.mimeType=t,this},setRequestHeader:function(t){return this.requestHeader=t,this}}),((sn.prototype=Object.create(F.prototype)).constructor=sn).prototype.isShadowMaterial=!0,sn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this},((hn.prototype=Object.create(F.prototype)).constructor=hn).prototype.isSpriteMaterial=!0,hn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this};var un={clone:ln,merge:cn},fn="\nvoid main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n",dn="\nvoid main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}\n";function vn(t){F.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=fn,this.fragmentShader=dn,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}function mn(t){vn.call(this,t),this.type="RawShaderMaterial"}function pn(t){F.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new I(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=A,this.normalScale=new at(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(t)}function gn(t){pn.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new at(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(t)}function _n(t){F.call(this),this.type="MeshPhongMaterial",this.color=new I(16777215),this.specular=new I(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=A,this.normalScale=new at(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=f,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function xn(t){F.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new I(16777215),this.specular=new I(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=A,this.normalScale=new at(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function An(t){F.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=A,this.normalScale=new at(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function wn(t){F.call(this),this.type="MeshLambertMaterial",this.color=new I(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new I(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=f,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function Sn(t){F.call(this),this.type="MeshDepthMaterial",this.depthPacking=x,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}function yn(t){F.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new B,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}function Mn(t){F.call(this),this.type="MeshBasicMaterial",this.color=new I(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=f,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(t)}function Tn(t){F.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new I(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=A,this.normalScale=new at(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}function bn(t){F.call(this),this.type="LineBasicMaterial",this.color=new I(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}function Ln(t){bn.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}function Pn(t){Cn.call(this,t),this.textures={}}((vn.prototype=Object.create(F.prototype)).constructor=vn).prototype.isShaderMaterial=!0,vn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=ln(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.extensions=t.extensions,this},((mn.prototype=Object.create(vn.prototype)).constructor=mn).prototype.isRawShaderMaterial=!0,((pn.prototype=Object.create(F.prototype)).constructor=pn).prototype.isMeshStandardMaterial=!0,pn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.vertexTangents=t.vertexTangents,this},((gn.prototype=Object.create(pn.prototype)).constructor=gn).prototype.isMeshPhysicalMaterial=!0,gn.prototype.copy=function(t){return pn.prototype.copy.call(this,t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new I).copy(t.sheen):this.sheen=null,this.transparency=t.transparency,this},((_n.prototype=Object.create(F.prototype)).constructor=_n).prototype.isMeshPhongMaterial=!0,_n.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((xn.prototype=Object.create(F.prototype)).constructor=xn).prototype.isMeshToonMaterial=!0,xn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((An.prototype=Object.create(F.prototype)).constructor=An).prototype.isMeshNormalMaterial=!0,An.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((wn.prototype=Object.create(F.prototype)).constructor=wn).prototype.isMeshLambertMaterial=!0,wn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((Sn.prototype=Object.create(F.prototype)).constructor=Sn).prototype.isMeshDepthMaterial=!0,Sn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this},((yn.prototype=Object.create(F.prototype)).constructor=yn).prototype.isMeshDistanceMaterial=!0,yn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this},((Mn.prototype=Object.create(F.prototype)).constructor=Mn).prototype.isMeshBasicMaterial=!0,Mn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this},((Tn.prototype=Object.create(F.prototype)).constructor=Tn).prototype.isMeshMatcapMaterial=!0,Tn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this},((bn.prototype=Object.create(F.prototype)).constructor=bn).prototype.isLineBasicMaterial=!0,bn.prototype.copy=function(t){return F.prototype.copy.call(this,t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this},((Ln.prototype=Object.create(bn.prototype)).constructor=Ln).prototype.isLineDashedMaterial=!0,Ln.prototype.copy=function(t){return bn.prototype.copy.call(this,t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this},Pn.prototype=Object.assign(Object.create(Cn.prototype),{constructor:Pn,load:function(t,n,e,i){var r=this,a=new on(r.manager);a.setPath(r.path),a.load(t,function(t){n(r.parse(JSON.parse(t)))},e,i)},parse:function(t){var n=this.textures;function e(t){return void 0===n[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),n[t]}var i,r=new h[t.type];if(void 0!==t.uuid&&(r.uuid=t.uuid),void 0!==t.name&&(r.name=t.name),void 0!==t.color&&r.color.setHex(t.color),void 0!==t.roughness&&(r.roughness=t.roughness),void 0!==t.metalness&&(r.metalness=t.metalness),void 0!==t.sheen&&(r.sheen=(new I).setHex(t.sheen)),void 0!==t.emissive&&r.emissive.setHex(t.emissive),void 0!==t.specular&&r.specular.setHex(t.specular),void 0!==t.shininess&&(r.shininess=t.shininess),void 0!==t.clearcoat&&(r.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(r.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.fog&&(r.fog=t.fog),void 0!==t.flatShading&&(r.flatShading=t.flatShading),void 0!==t.blending&&(r.blending=t.blending),void 0!==t.combine&&(r.combine=t.combine),void 0!==t.side&&(r.side=t.side),void 0!==t.opacity&&(r.opacity=t.opacity),void 0!==t.transparent&&(r.transparent=t.transparent),void 0!==t.alphaTest&&(r.alphaTest=t.alphaTest),void 0!==t.depthTest&&(r.depthTest=t.depthTest),void 0!==t.depthWrite&&(r.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(r.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(r.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(r.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(r.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(r.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(r.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(r.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(r.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(r.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(r.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(r.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(r.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(r.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(r.rotation=t.rotation),1!==t.linewidth&&(r.linewidth=t.linewidth),void 0!==t.dashSize&&(r.dashSize=t.dashSize),void 0!==t.gapSize&&(r.gapSize=t.gapSize),void 0!==t.scale&&(r.scale=t.scale),void 0!==t.polygonOffset&&(r.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(r.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(r.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.skinning&&(r.skinning=t.skinning),void 0!==t.morphTargets&&(r.morphTargets=t.morphTargets),void 0!==t.morphNormals&&(r.morphNormals=t.morphNormals),void 0!==t.dithering&&(r.dithering=t.dithering),void 0!==t.vertexTangents&&(r.vertexTangents=t.vertexTangents),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.toneMapped&&(r.toneMapped=t.toneMapped),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?r.vertexColors=0<t.vertexColors:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(var a in t.uniforms){var o=t.uniforms[a];switch(r.uniforms[a]={},o.type){case"t":r.uniforms[a].value=e(o.value);break;case"c":r.uniforms[a].value=(new I).setHex(o.value);break;case"v2":r.uniforms[a].value=(new at).fromArray(o.value);break;case"v3":r.uniforms[a].value=(new B).fromArray(o.value);break;case"v4":r.uniforms[a].value=(new rt).fromArray(o.value);break;case"m3":r.uniforms[a].value=(new Dt).fromArray(o.value);case"m4":r.uniforms[a].value=(new Lt).fromArray(o.value);break;default:r.uniforms[a].value=o.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var s in t.extensions)r.extensions[s]=t.extensions[s];return void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=e(t.map)),void 0!==t.matcap&&(r.matcap=e(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=e(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=e(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=e(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale&&(i=t.normalScale,!1===Array.isArray(i)&&(i=[i,i]),r.normalScale=(new at).fromArray(i)),void 0!==t.displacementMap&&(r.displacementMap=e(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=e(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=e(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=e(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=e(t.specularMap)),void 0!==t.envMap&&(r.envMap=e(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=e(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=e(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=e(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=e(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=e(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=e(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new at).fromArray(t.clearcoatNormalScale)),r},setTextures:function(t){return this.textures=t,this}});var En,Fn,Nn,Dn;function Cn(t){this.manager=void 0!==t?t:rn,this.crossOrigin="anonymous",this.path="",this.resourcePath=""}function In(t){Cn.call(this,t)}Object.assign(Cn.prototype,{load:function(){},parse:function(){},setCrossOrigin:function(t){return this.crossOrigin=t,this},setPath:function(t){return this.path=t,this},setResourcePath:function(t){return this.resourcePath=t,this}}),Object.assign(Cn.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(t,n,e){for(var i=[],r=0;r<t.length;++r)i[r]=this.createMaterial(t[r],n,e);return i},createMaterial:(En={NoBlending:0,NormalBlending:1,AdditiveBlending:2,SubtractiveBlending:3,MultiplyBlending:4,CustomBlending:5},Fn=new I,Nn=new On,Dn=new Pn,function(t,o,s){var h={};function n(t,n,e,i,r){var a=o+t,t=(new en).getHandler(a),a=null!==t?t.load(a):(Nn.setCrossOrigin(s),Nn.load(a));void 0!==n&&(a.repeat.fromArray(n),1!==n[0]&&(a.wrapS=1e3),1!==n[1]&&(a.wrapT=1e3)),void 0!==e&&a.offset.fromArray(e),void 0!==i&&("repeat"===i[0]&&(a.wrapS=1e3),"mirror"===i[0]&&(a.wrapS=1002),"repeat"===i[1]&&(a.wrapT=1e3),"mirror"===i[1]&&(a.wrapT=1002)),void 0!==r&&(a.anisotropy=r);r=E.generateUUID();return h[r]=a,r}var e,i={uuid:E.generateUUID(),type:"MeshLambertMaterial"};for(e in t){var r=t[e];switch(e){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":i.name=r;break;case"blending":i.blending=En[r];break;case"colorAmbient":case"mapAmbient":break;case"colorDiffuse":i.color=Fn.fromArray(r).getHex();break;case"colorSpecular":i.specular=Fn.fromArray(r).getHex();break;case"colorEmissive":i.emissive=Fn.fromArray(r).getHex();break;case"specularCoef":i.shininess=r;break;case"shading":"basic"===r.toLowerCase()&&(i.type="MeshBasicMaterial"),"phong"===r.toLowerCase()&&(i.type="MeshPhongMaterial"),"standard"===r.toLowerCase()&&(i.type="MeshStandardMaterial");break;case"mapDiffuse":i.map=n(r,t.mapDiffuseRepeat,t.mapDiffuseOffset,t.mapDiffuseWrap,t.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":i.emissiveMap=n(r,t.mapEmissiveRepeat,t.mapEmissiveOffset,t.mapEmissiveWrap,t.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":i.lightMap=n(r,t.mapLightRepeat,t.mapLightOffset,t.mapLightWrap,t.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":i.aoMap=n(r,t.mapAORepeat,t.mapAOOffset,t.mapAOWrap,t.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":i.bumpMap=n(r,t.mapBumpRepeat,t.mapBumpOffset,t.mapBumpWrap,t.mapBumpAnisotropy);break;case"mapBumpScale":i.bumpScale=r;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":i.normalMap=n(r,t.mapNormalRepeat,t.mapNormalOffset,t.mapNormalWrap,t.mapNormalAnisotropy);break;case"mapNormalFactor":i.normalScale=r;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":i.specularMap=n(r,t.mapSpecularRepeat,t.mapSpecularOffset,t.mapSpecularWrap,t.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":i.metalnessMap=n(r,t.mapMetalnessRepeat,t.mapMetalnessOffset,t.mapMetalnessWrap,t.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":i.roughnessMap=n(r,t.mapRoughnessRepeat,t.mapRoughnessOffset,t.mapRoughnessWrap,t.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":i.alphaMap=n(r,t.mapAlphaRepeat,t.mapAlphaOffset,t.mapAlphaWrap,t.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":i.side=1;break;case"doubleSided":i.side=2;break;case"transparency":i.opacity=r;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":i[e]=r;break;case"vertexColors":!0===r&&(i.vertexColors=2),"face"===r&&(i.vertexColors=1)}}return"MeshBasicMaterial"===i.type&&delete i.emissive,"MeshPhongMaterial"!==i.type&&delete i.specular,i.opacity<1&&(i.transparent=!0),Dn.setTextures(h),Dn.parse(i)})}),In.prototype=Object.assign(Object.create(Cn.prototype),{constructor:In,load:function(n,t,e,i){void 0!==this.path&&(n=this.path+n),n=this.manager.resolveURL(n);var r=this,a=nn.get(n);if(void 0!==a)return r.manager.itemStart(n),setTimeout(function(){t&&t(a),r.manager.itemEnd(n)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",h,!1),nn.add(n,this),t&&t(this),r.manager.itemEnd(n)}function h(t){o.removeEventListener("load",s,!1),o.removeEventListener("error",h,!1),i&&i(t),r.manager.itemError(n),r.manager.itemEnd(n)}return o.addEventListener("load",s,!1),o.addEventListener("error",h,!1),"data:"!==n.substr(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(n),o.src=n,o}});var Rn=0;function Un(t,n,e,i,r,a,o,s,h,l){Object.defineProperty(this,"id",{value:Rn++}),this.uuid=E.generateUUID(),this.name="",this.image=void 0!==t?t:Un.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==n?n:Un.DEFAULT_MAPPING,this.wrapS=void 0!==e?e:d,this.wrapT=void 0!==i?i:d,this.magFilter=void 0!==r?r:P,this.minFilter=void 0!==a?a:m,this.anisotropy=void 0!==h?h:1,this.format=void 0!==o?o:g,this.internalFormat=null,this.type=void 0!==s?s:p,this.offset=new at(0,0),this.repeat=new at(1,1),this.center=new at(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Dt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==l?l:_,this.version=0,this.onUpdate=null}function On(t){Cn.call(this,t)}Un.DEFAULT_IMAGE=void 0,Un.DEFAULT_MAPPING=300,Un.prototype=Object.assign(Object.create(i.prototype),{constructor:Un,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||1<t.x)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case d:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||1<t.y)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case d:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}}),Object.defineProperty(Un.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),On.prototype=Object.assign(Object.create(Cn.prototype),{constructor:On,load:function(n,e,t,i){var r=new Un,a=new In(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(n,function(t){r.image=t;t=0<n.search(/\.jpe?g($|\?)/i)||0===n.search(/^data\:image\/jpeg/);r.format=t?1022:g,r.needsUpdate=!0,void 0!==e&&e(r)},t,i),r}});var Hn=new B,Xn=new B,Gn=new B,zn=new B,Bn=new B,kn=new B,Vn=new B;function Yn(t,n){this.origin=void 0!==t?t:new B,this.direction=void 0!==n?n:new B(0,0,-1)}Object.assign(Yn.prototype,{set:function(t,n){return this.origin.copy(t),this.direction.copy(n),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,n){return void 0===n&&(console.warn("THREE.Ray: .at() target is now required"),n=new B),n.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,Hn)),this},closestPointToPoint:function(t,n){void 0===n&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),n=new B),n.subVectors(t,this.origin);t=n.dot(this.direction);return t<0?n.copy(this.origin):n.copy(this.direction).multiplyScalar(t).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var n=Hn.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(Hn.copy(this.direction).multiplyScalar(n).add(this.origin),Hn.distanceToSquared(t))},distanceSqToSegment:function(t,n,e,i){Xn.copy(t).add(n).multiplyScalar(.5),Gn.copy(n).sub(t).normalize(),zn.copy(this.origin).sub(Xn);var r,a,o=.5*t.distanceTo(n),s=-this.direction.dot(Gn),h=zn.dot(this.direction),l=-zn.dot(Gn),c=zn.lengthSq(),t=Math.abs(1-s*s);return c=0<t?(a=s*h-l,n=o*t,0<=(r=s*l-h)?-n<=a?a<=n?(r*=t=1/t)*(r+s*(a*=t)+2*h)+a*(s*r+a+2*l)+c:(a=o,-(r=Math.max(0,-(s*a+h)))*r+a*(a+2*l)+c):(a=-o,-(r=Math.max(0,-(s*a+h)))*r+a*(a+2*l)+c):a<=-n?-(r=Math.max(0,-(-s*o+h)))*r+(a=0<r?-o:Math.min(Math.max(-o,-l),o))*(a+2*l)+c:a<=n?(r=0,(a=Math.min(Math.max(-o,-l),o))*(a+2*l)+c):-(r=Math.max(0,-(s*o+h)))*r+(a=0<r?o:Math.min(Math.max(-o,-l),o))*(a+2*l)+c):(a=0<s?-o:o,-(r=Math.max(0,-(s*a+h)))*r+a*(a+2*l)+c),e&&e.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(Gn).multiplyScalar(a).add(Xn),c},intersectSphere:function(t,n){Hn.subVectors(t.center,this.origin);var e=Hn.dot(this.direction),i=Hn.dot(Hn)-e*e,t=t.radius*t.radius;if(t<i)return null;t=Math.sqrt(t-i),i=e-t,t=e+t;return i<0&&t<0?null:i<0?this.at(t,n):this.at(i,n)},intersectsSphere:function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},distanceToPlane:function(t){var n=t.normal.dot(this.direction);if(0===n)return 0===t.distanceToPoint(this.origin)?0:null;n=-(this.origin.dot(t.normal)+t.constant)/n;return 0<=n?n:null},intersectPlane:function(t,n){t=this.distanceToPlane(t);return null===t?null:this.at(t,n)},intersectsPlane:function(t){var n=t.distanceToPoint(this.origin);return 0===n||t.normal.dot(this.direction)*n<0},intersectBox:function(t,n){var e,i,r,a=1/this.direction.x,o=1/this.direction.y,s=1/this.direction.z,h=this.origin,a=0<=a?(e=(t.min.x-h.x)*a,(t.max.x-h.x)*a):(e=(t.max.x-h.x)*a,(t.min.x-h.x)*a),o=0<=o?(i=(t.min.y-h.y)*o,(t.max.y-h.y)*o):(i=(t.max.y-h.y)*o,(t.min.y-h.y)*o);return o<e||a<i?null:((o<a||a!=a)&&(a=o),(s=0<=s?(r=(t.min.z-h.z)*s,(t.max.z-h.z)*s):(r=(t.max.z-h.z)*s,(t.min.z-h.z)*s))<(e=e<i||e!=e?i:e)||a<r?null:((e<r||e!=e)&&(e=r),(a=s<a||a!=a?s:a)<0?null:this.at(0<=e?e:a,n)))},intersectsBox:function(t){return null!==this.intersectBox(t,Hn)},intersectTriangle:function(t,n,e,i,r){Bn.subVectors(n,t),kn.subVectors(e,t),Vn.crossVectors(Bn,kn);e=this.direction.dot(Vn);if(0<e){if(i)return null;a=1}else{if(!(e<0))return null;a=-1,e=-e}zn.subVectors(this.origin,t);i=a*this.direction.dot(kn.crossVectors(zn,kn));if(i<0)return null;t=a*this.direction.dot(Bn.cross(zn));if(t<0)return null;if(e<i+t)return null;var a=-a*zn.dot(Vn);return a<0?null:this.at(a/e,r)},applyMatrix4:function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},equals:function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}});var jn=new Lt,Qn=new Yn,Wn=new _t,Zn=new B;function qn(t,n){jt.call(this),this.type="Points",this.geometry=void 0!==t?t:new tn,this.material=void 0!==n?n:new H,this.updateMorphTargets()}function Kn(t,n,e,i,r,a,o){var s=Qn.distanceSqToPoint(t);s<e&&(e=new B,Qn.closestPointToPoint(t,e),e.applyMatrix4(i),(i=r.ray.origin.distanceTo(e))<r.near||i>r.far||a.push({distance:i,distanceToRay:Math.sqrt(s),point:e,index:n,face:null,object:o}))}function Jn(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}qn.prototype=Object.assign(Object.create(jt.prototype),{constructor:qn,isPoints:!0,raycast:function(t,n){var e=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold;if(null===e.boundingSphere&&e.computeBoundingSphere(),Wn.copy(e.boundingSphere),Wn.applyMatrix4(i),Wn.radius+=r,!1!==t.ray.intersectsSphere(Wn)){jn.getInverse(i),Qn.copy(t.ray).applyMatrix4(jn);var r=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=r*r;if(e.isBufferGeometry){var r=e.index,o=e.attributes.position.array;if(null!==r)for(var s=r.array,h=0,l=s.length;h<l;h++){var c=s[h];Zn.fromArray(o,3*c),Kn(Zn,c,a,i,t,n,this)}else for(var h=0,u=o.length/3;h<u;h++)Zn.fromArray(o,3*h),Kn(Zn,h,a,i,t,n,this)}else for(var f=e.vertices,h=0,u=f.length;h<u;h++)Kn(f[h],h,a,i,t,n,this)}},updateMorphTargets:function(){var t,n,e,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(0<a.length){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)e=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}else{i=i.morphTargets;void 0!==i&&0<i.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var $n=function(){function i(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,i);var e=new H({opacity:1,transparent:!0,depthTest:!1,size:5});this.material=e,this.geo=new tn;n=(new On).load(n);e.map=n,e.needsUpdate=!0,this.pointsArrayLength=t.length,this.pointsArray=t,this.geo.setFromPoints(t),this.plength=t.length,this.points=new qn(this.geo,e)}var t,n,e;return t=i,(n=[{key:"updatePoints",value:function(t){this.geo.setFromPoints(t)}},{key:"changePositions",value:function(t,n,e,i,r){for(var a=this.geo.attributes.position,o=0;o<this.plength;o++){var s=a.getX(o)+t*this.runstatus[o].x.sign*this.runstatus[o].x.weight,h=a.getY(o)+n*this.runstatus[o].y.sign*this.runstatus[o].y.weight,l=a.getZ(o)+e*this.runstatus[o].z.sign*this.runstatus[o].z.weight;i(s,h,l)?a.setXYZ(o,s,h,l):(l=r(),a.setXYZ(o,l.x,l.y,l.z))}a.needsUpdate=!0}},{key:"setRunStatus",value:function(t){this.runstatus=t}},{key:"setParticleCount",value:function(t){this.pointsArray.length=this.pointsArrayLength*t,this.geo.setFromPoints(this.pointsArray),this.points=new qn(this.geo,this.material)}}])&&Jn(t.prototype,n),e&&Jn(t,e),i}();function te(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var ne=function(){function t(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,t),this.type="effect",this.particle=null,this.sky=null,this.rain=null,this.bloom=null,this.water=new Map,this.flowlines=new Map,this.sweep=null,this.sao=null}var n,e,i;return n=t,(e=[{key:"render",value:function(){var e=this;this.renderer.clear(),this.resize(),this.sky&&this.sky.render(),this.sao&&this.sao.render();for(var t=Array.from(this.getRenderList()),n=0;n<t.length;n++){this.renderer.render(t[n][1],this.parent.getCamera());var i=parseInt(t[n][0].split("_")[0]);this.sweep&&this.sweep.render(t[n][1]),0!==i&&(this.water.forEach(function(t){for(var n=0;n<t.userData.waters.length;n++)t.userData.waters[n].material.uniforms.time.value+=.1/60;e.renderer.render(t,e.parent.getCamera())}),this.flowlines.forEach(function(t){return t.render()}),this.bloom&&this.bloom.composers3D.get(i).composer.render(),this.sao&&this.sao.add(t[n][1]))}this.parent.getMarkerGroup()&&this.renderer.render(this.parent.getMarkerGroup().getScene(),this.parent.getCamera()),this.particle&&this.particle.render(),this.rain&&this.rain.render(),this.xx45f6&&this.renderer.render(this.xx45f6,this.parent.getCamera())}}])&&te(n.prototype,e),i&&te(n,i),t}();function ee(){jt.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function ie(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}ee.prototype=Object.assign(Object.create(jt.prototype),{constructor:ee,isScene:!0,copy:function(t,n){return jt.prototype.copy.call(this,t,n),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var re=function(){function n(t){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),this.L=t,this.P=new ee,this.F=null,this.N="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TS0UqDnYQ6ZChOlkQK8VRqlgEC6Wt0KqDyaVf0MSQpLg4Cq4FBz8Wqw4uzro6uAqC4AeIk6OToouU+L+k0CLGg+N+vLv3uHsHCK06U82+SUDVLCObSoqF4ooYfEUAEfiRQFxipp7OLeThOb7u4ePrXYxneZ/7cwwqJZMBPpF4lumGRbxOnNi0dM77xGFWlRTic+IJgy5I/Mh12eU3zhWHBZ4ZNvLZOeIwsVjpYbmHWdVQiaeJo4qqUb5QcFnhvMVZrTdY5578haGStpzjOs0IUlhEGhmIkNFADXVYiNGqkWIiS/tJD/+o48+QSyZXDYwc89iACsnxg//B727NcnzKTQolgcCLbX+MAcFdoN207e9j226fAP5n4Err+jdawMwn6c2uFj0ChraBi+uuJu8BlzvAyJMuGZIj+WkK5TLwfkbfVASGb4GBVbe3zj5OH4A8dbV0AxwcAuMVyl7zeHd/b2//nun09wPqUXLXvsrewQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB+QFHAQMLuREfnwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAA9UlEQVQY002Pu0oDQRRA7517d0ISFwKaIKLgphPSqGltxEYk/2AnBNILdhba2PkBNv6BJn8QxLR2KVwEH6xBEk1G3ezMXBsDOeWpzgGYoxPbZvsxa807BgC4ibNSYhy9TdwGAvjzrglrK5oaUTDCTmx3p06O343rhzl1azK/hwC9coEOCeGMHVN38JlerZb4WxNeLCHZl6HdekjS9mZUvFdifhEJlpMvd6QUsngIKgt0WWR8IgRk1kG9zFJLJv46/phuF7S6G6d+J1rM1f2Pf8ZZZO8182uhOhUR7cGerId53q/ygAEAGlEw+t/siwgdVPPD2eYf14pkaPQAZiEAAAAASUVORK5CYII=",this.points=[],this.pointsStatus=[],this._=t.getBound().size.x,this.D=t.getBound().size.y,this.C=1e5,this.I=0,this.R(this.C),this.U()}var t,e,i;return t=n,(e=[{key:"enable",value:function(){this.L.getRenderManager().particle=this}},{key:"disable",value:function(){this.L.getRenderManager().particle=null}},{key:"setUrl",value:function(t){this.P.children[0].material.map=(new On).load(t)}},{key:"setAmount",value:function(t){this.P.remove(this.F.points),this.points=[],this.pointsStatus=[];t=this.C*t;this.R(t)}},{key:"render",value:function(){var t=this;null!==this.F&&this.F.changePositions(.1,-.32,.1,function(t,n){return 0<=n},function(){return new B((Math.random()-.5)*t._,1e3*Math.random(),(Math.random()-.5)*t.D)}),this.L.getRenderManager().renderer.render(this.P,this.L.getCamera())}}])&&ie(t.prototype,e),i&&ie(t,i),n}();Object.assign(re.prototype,{O:function(t,n,e){for(var i=0;i<t;i++){var r=(Math.random()-.5)*this._,a=1e3*Math.random(),o=(Math.random()-.5)*this.D,s=Math.random()-.5,h=s/Math.abs(s),l=3*Math.random(),s=Math.random()-.5,s=s/Math.abs(s);n.push(new B(r,a,o)),e.push({x:{sign:h,weight:l},y:{sign:1,weight:1},z:{sign:s,weight:3*Math.random()}})}},R:function(t){this.O(t,this.points,this.pointsStatus),this.F=new $n(this.points,this.N),this.F.setRunStatus(this.pointsStatus),this.P.add(this.F.points)},U:function(){"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne)}});var ae=re;function oe(){jt.call(this),this.type="Camera",this.matrixWorldInverse=new Lt,this.projectionMatrix=new Lt,this.projectionMatrixInverse=new Lt}function se(t,n,e,i,r,a){oe.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=void 0!==t?t:-1,this.right=void 0!==n?n:1,this.top=void 0!==e?e:1,this.bottom=void 0!==i?i:-1,this.near=void 0!==r?r:.1,this.far=void 0!==a?a:2e3,this.updateProjectionMatrix()}function he(t,n,e,i){tn.call(this),this.type="PlaneBufferGeometry",this.parameters={width:t,height:n,widthSegments:e,heightSegments:i};for(var r=(t=t||1)/2,a=(n=n||1)/2,o=Math.floor(e)||1,s=Math.floor(i)||1,h=o+1,l=s+1,c=t/o,u=n/s,f=[],d=[],v=[],m=[],p=0;p<l;p++)for(var g=p*u-a,_=0;_<h;_++)d.push(_*c-r,-g,0),v.push(0,0,1),m.push(_/o),m.push(1-p/s);for(p=0;p<s;p++)for(_=0;_<o;_++){var x=_+h*(p+1),A=_+1+h*(p+1),w=_+1+h*p;f.push(_+h*p,x,w),f.push(x,A,w)}this.setIndex(f),this.setAttribute("position",new mt(d,3)),this.setAttribute("normal",new mt(v,3)),this.setAttribute("uv",new mt(m,2))}oe.prototype=Object.assign(Object.create(jt.prototype),{constructor:oe,isCamera:!0,copy:function(t,n){return jt.prototype.copy.call(this,t,n),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new B),this.updateMatrixWorld(!0);var n=this.matrixWorld.elements;return t.set(-n[8],-n[9],-n[10]).normalize()},updateMatrixWorld:function(t){jt.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(t,n){jt.prototype.updateWorldMatrix.call(this,t,n),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),se.prototype=Object.assign(Object.create(oe.prototype),{constructor:se,isOrthographicCamera:!0,copy:function(t,n){return oe.prototype.copy.call(this,t,n),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this},setViewOffset:function(t,n,e,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=n,this.view.offsetX=e,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),e=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=e-t,a=e+t,e=i+n,t=i-n;null!==this.view&&this.view.enabled&&(i=(this.right-this.left)/this.view.fullWidth/this.zoom,n=(this.top-this.bottom)/this.view.fullHeight/this.zoom,a=(r+=i*this.view.offsetX)+i*this.view.width,t=(e-=n*this.view.offsetY)-n*this.view.height),this.projectionMatrix.makeOrthographic(r,a,e,t,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)}}),(he.prototype=Object.create(tn.prototype)).constructor=he;var le=new B,ce=new B,ue=new Dt;function fe(t,n){this.normal=void 0!==t?t:new B(1,0,0),this.constant=void 0!==n?n:0}Object.assign(fe.prototype,{isPlane:!0,set:function(t,n){return this.normal.copy(t),this.constant=n,this},setComponents:function(t,n,e,i){return this.normal.set(t,n,e),this.constant=i,this},setFromNormalAndCoplanarPoint:function(t,n){return this.normal.copy(t),this.constant=-n.dot(this.normal),this},setFromCoplanarPoints:function(t,n,e){n=le.subVectors(e,n).cross(ce.subVectors(t,n)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.normal.copy(t.normal),this.constant=t.constant,this},normalize:function(){var t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(t){return this.normal.dot(t)+this.constant},distanceToSphere:function(t){return this.distanceToPoint(t.center)-t.radius},projectPoint:function(t,n){return void 0===n&&(console.warn("THREE.Plane: .projectPoint() target is now required"),n=new B),n.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)},intersectLine:function(t,n){void 0===n&&(console.warn("THREE.Plane: .intersectLine() target is now required"),n=new B);var e=t.delta(le),i=this.normal.dot(e);if(0===i)return 0===this.distanceToPoint(t.start)?n.copy(t.start):void 0;i=-(t.start.dot(this.normal)+this.constant)/i;return i<0||1<i?void 0:n.copy(e).multiplyScalar(i).add(t.start)},intersectsLine:function(t){var n=this.distanceToPoint(t.start),t=this.distanceToPoint(t.end);return n<0&&0<t||t<0&&0<n},intersectsBox:function(t){return t.intersectsPlane(this)},intersectsSphere:function(t){return t.intersectsPlane(this)},coplanarPoint:function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new B),t.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(t,n){n=n||ue.getNormalMatrix(t),t=this.coplanarPoint(le).applyMatrix4(t),n=this.normal.applyMatrix3(n).normalize();return this.constant=-t.dot(n),this},translate:function(t){return this.constant-=t.dot(this.normal),this},equals:function(t){return t.normal.equals(this.normal)&&t.constant===this.constant}});var de=new B,ve=new B,me=new B,pe=new B,ge=new B,_e=new B,xe=new B,Ae=new B,we=new B,Se=new B;function ye(t,n,e){this.a=void 0!==t?t:new B,this.b=void 0!==n?n:new B,this.c=void 0!==e?e:new B}function Me(t,n,e,i,r,a){this.a=t,this.b=n,this.c=e,this.normal=i&&i.isVector3?i:new B,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new I,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Object.assign(ye,{getNormal:function(t,n,e,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new B),i.subVectors(e,n),de.subVectors(t,n),i.cross(de);n=i.lengthSq();return 0<n?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)},getBarycoord:function(t,n,e,i,r){de.subVectors(i,n),ve.subVectors(e,n),me.subVectors(t,n);var a=de.dot(de),o=de.dot(ve),i=de.dot(me),e=ve.dot(ve),t=ve.dot(me),n=a*e-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new B),0==n)return r.set(-2,-1,-1);n=1/n,e=(e*i-o*t)*n,n*=a*t-o*i;return r.set(1-e-n,n,e)},containsPoint:function(t,n,e,i){return ye.getBarycoord(t,n,e,i,pe),0<=pe.x&&0<=pe.y&&pe.x+pe.y<=1},getUV:function(t,n,e,i,r,a,o,s){return this.getBarycoord(t,n,e,i,pe),s.set(0,0),s.addScaledVector(r,pe.x),s.addScaledVector(a,pe.y),s.addScaledVector(o,pe.z),s},isFrontFacing:function(t,n,e,i){return de.subVectors(e,n),ve.subVectors(t,n),de.cross(ve).dot(i)<0}}),Object.assign(ye.prototype,{set:function(t,n,e){return this.a.copy(t),this.b.copy(n),this.c.copy(e),this},setFromPointsAndIndices:function(t,n,e,i){return this.a.copy(t[n]),this.b.copy(t[e]),this.c.copy(t[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},getArea:function(){return de.subVectors(this.c,this.b),ve.subVectors(this.a,this.b),.5*de.cross(ve).length()},getMidpoint:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new B),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(t){return ye.getNormal(this.a,this.b,this.c,t)},getPlane:function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new fe),t.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(t,n){return ye.getBarycoord(t,this.a,this.b,this.c,n)},getUV:function(t,n,e,i,r){return ye.getUV(t,this.a,this.b,this.c,n,e,i,r)},containsPoint:function(t){return ye.containsPoint(t,this.a,this.b,this.c)},isFrontFacing:function(t){return ye.isFrontFacing(this.a,this.b,this.c,t)},intersectsBox:function(t){return t.intersectsTriangle(this)},closestPointToPoint:function(t,n){void 0===n&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),n=new B);var e=this.a,i=this.b,r=this.c;ge.subVectors(i,e),_e.subVectors(r,e),Ae.subVectors(t,e);var a=ge.dot(Ae),o=_e.dot(Ae);if(a<=0&&o<=0)return n.copy(e);we.subVectors(t,i);var s=ge.dot(we),h=_e.dot(we);if(0<=s&&h<=s)return n.copy(i);var l=a*h-s*o;if(l<=0&&0<=a&&s<=0)return u=a/(a-s),n.copy(e).addScaledVector(ge,u);Se.subVectors(t,r);var c=ge.dot(Se),t=_e.dot(Se);if(0<=t&&c<=t)return n.copy(r);a=c*o-a*t;if(a<=0&&0<=o&&t<=0)return f=o/(o-t),n.copy(e).addScaledVector(_e,f);o=s*t-c*h;if(o<=0&&0<=h-s&&0<=c-t)return xe.subVectors(r,i),f=(h-s)/(h-s+(c-t)),n.copy(i).addScaledVector(xe,f);var o=1/(o+a+l),u=a*o,f=l*o;return n.copy(e).addScaledVector(ge,u).addScaledVector(_e,f)},equals:function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}),Object.assign(Me.prototype,{clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.a=t.a,this.b=t.b,this.c=t.c,this.normal.copy(t.normal),this.color.copy(t.color),this.materialIndex=t.materialIndex;for(var n=0,e=t.vertexNormals.length;n<e;n++)this.vertexNormals[n]=t.vertexNormals[n].clone();for(n=0,e=t.vertexColors.length;n<e;n++)this.vertexColors[n]=t.vertexColors[n].clone();return this}});var Te=new Lt,be=new Yn,Le=new _t,Pe=new B,Ee=new B,Fe=new B,Ne=new B,De=new B,Ce=new B,Ie=new B,Re=new B,Ue=new B,Oe=new at,He=new at,Xe=new at,Ge=new B,ze=new B;function Be(t,n){jt.call(this),this.type="Mesh",this.geometry=void 0!==t?t:new tn,this.material=void 0!==n?n:new Mn,this.updateMorphTargets()}function ke(t,n,e,i,r,a,o,s){n=n.side===l?i.intersectTriangle(o,a,r,!0,s):i.intersectTriangle(r,a,o,n.side!==c,s);if(null===n)return null;ze.copy(s),ze.applyMatrix4(t.matrixWorld);s=e.ray.origin.distanceTo(ze);return s<e.near||s>e.far?null:{distance:s,point:ze.clone(),object:t}}function Ve(t,n,e,i,r,a,o,s,h,l,c,u){Pe.fromBufferAttribute(r,l),Ee.fromBufferAttribute(r,c),Fe.fromBufferAttribute(r,u);var f=t.morphTargetInfluences;if(n.morphTargets&&a&&f){Ie.set(0,0,0),Re.set(0,0,0),Ue.set(0,0,0);for(var d=0,v=a.length;d<v;d++){var m=f[d],p=a[d];0!==m&&(Ne.fromBufferAttribute(p,l),De.fromBufferAttribute(p,c),Ce.fromBufferAttribute(p,u),o?(Ie.addScaledVector(Ne,m),Re.addScaledVector(De,m),Ue.addScaledVector(Ce,m)):(Ie.addScaledVector(Ne.sub(Pe),m),Re.addScaledVector(De.sub(Ee),m),Ue.addScaledVector(Ce.sub(Fe),m)))}Pe.add(Ie),Ee.add(Re),Fe.add(Ue)}i=ke(t,n,e,i,Pe,Ee,Fe,Ge);return i&&(s&&(Oe.fromBufferAttribute(s,l),He.fromBufferAttribute(s,c),Xe.fromBufferAttribute(s,u),i.uv=ye.getUV(Ge,Pe,Ee,Fe,Oe,He,Xe,new at)),h&&(Oe.fromBufferAttribute(h,l),He.fromBufferAttribute(h,c),Xe.fromBufferAttribute(h,u),i.uv2=ye.getUV(Ge,Pe,Ee,Fe,Oe,He,Xe,new at)),h=new Me(l,c,u),ye.getNormal(Pe,Ee,Fe,h.normal),i.face=h),i}function Ye(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}Be.prototype=Object.assign(Object.create(jt.prototype),{constructor:Be,isMesh:!0,copy:function(t){return jt.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this},updateMorphTargets:function(){var t,n,e,i=this.geometry;if(i.isBufferGeometry){var r=i.morphAttributes,a=Object.keys(r);if(0<a.length){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)e=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}else{i=i.morphTargets;void 0!==i&&0<i.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,n){var e=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i&&(null===e.boundingSphere&&e.computeBoundingSphere(),Le.copy(e.boundingSphere),Le.applyMatrix4(r),!1!==t.ray.intersectsSphere(Le)&&(Te.getInverse(r),be.copy(t.ray).applyMatrix4(Te),null===e.boundingBox||!1!==be.intersectsBox(e.boundingBox))))if(e.isBufferGeometry){var a,o,s,h,l,c,u,f,d,v=e.index,m=e.attributes.position,p=e.morphAttributes.position,g=e.morphTargetsRelative,_=e.attributes.uv,x=e.attributes.uv2,A=e.groups,w=e.drawRange;if(null!==v)if(Array.isArray(i))for(h=0,c=A.length;h<c;h++)for(d=i[(f=A[h]).materialIndex],l=Math.max(f.start,w.start),u=Math.min(f.start+f.count,w.start+w.count);l<u;l+=3)a=v.getX(l),o=v.getX(l+1),s=v.getX(l+2),(N=Ve(this,d,t,be,m,p,g,_,x,a,o,s))&&(N.faceIndex=Math.floor(l/3),N.face.materialIndex=f.materialIndex,n.push(N));else for(h=Math.max(0,w.start),c=Math.min(v.count,w.start+w.count);h<c;h+=3)a=v.getX(h),o=v.getX(h+1),s=v.getX(h+2),(N=Ve(this,i,t,be,m,p,g,_,x,a,o,s))&&(N.faceIndex=Math.floor(h/3),n.push(N));else if(void 0!==m)if(Array.isArray(i))for(h=0,c=A.length;h<c;h++)for(d=i[(f=A[h]).materialIndex],l=Math.max(f.start,w.start),u=Math.min(f.start+f.count,w.start+w.count);l<u;l+=3)(N=Ve(this,d,t,be,m,p,g,_,x,a=l,o=l+1,s=l+2))&&(N.faceIndex=Math.floor(l/3),N.face.materialIndex=f.materialIndex,n.push(N));else for(h=Math.max(0,w.start),c=Math.min(m.count,w.start+w.count);h<c;h+=3)(N=Ve(this,i,t,be,m,p,g,_,x,a=h,o=h+1,s=h+2))&&(N.faceIndex=Math.floor(h/3),n.push(N))}else if(e.isGeometry){var S,y=Array.isArray(i),M=e.vertices,T=e.faces,e=e.faceVertexUvs[0];0<e.length&&(S=e);for(var b=0,L=T.length;b<L;b++){var P,E,F,N,D=T[b],C=y?i[D.materialIndex]:i;void 0!==C&&(P=M[D.a],E=M[D.b],F=M[D.c],(N=ke(this,C,t,be,P,E,F,Ge))&&(S&&S[b]&&(C=S[b],Oe.copy(C[0]),He.copy(C[1]),Xe.copy(C[2]),N.uv=ye.getUV(Ge,P,E,F,Oe,He,Xe,new at)),N.face=D,N.faceIndex=b,n.push(N)))}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function je(){Ye(this,je),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}var Qe,We;function Ze(t){Ye(this,Ze),this.H=new Be(We,t)}Object.assign(je.prototype,{setSize:function(){},render:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}),je.FullScreenQuad=(Qe=new se(-1,1,1,-1,0,1),We=new he(2,2),Object.defineProperty(Ze.prototype,"material",{get:function(){return this.H.material},set:function(t){this.H.material=t}}),Object.assign(Ze.prototype,{render:function(t){t.render(this.H,Qe)}}),Ze);var qe={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {","vec4 texel = texture2D( tDiffuse, vUv );","gl_FragColor = opacity * texel;","}"].join("\n")},Ke={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new I(0)},defaultOpacity:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec3 defaultColor;","uniform float defaultOpacity;","uniform float luminosityThreshold;","uniform float smoothWidth;","varying vec2 vUv;","void main() {","\tvec4 texel = texture2D( tDiffuse, vUv );","\tvec3 luma = vec3( 0.299, 0.587, 0.114 );","\tfloat v = dot( texel.xyz, luma );","\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );","\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );","\tgl_FragColor = mix( outputColor, texel, alpha );","}"].join("\n")};function Je(t,n,e){this.width=t,this.height=n,this.scissor=new rt(0,0,t,n),this.scissorTest=!1,this.viewport=new rt(0,0,t,n),this.texture=new Un(void 0,(e=e||{}).mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.image={},this.texture.image.width=t,this.texture.image.height=n,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:P,this.depthBuffer=void 0===e.depthBuffer||e.depthBuffer,this.stencilBuffer=void 0===e.stencilBuffer||e.stencilBuffer,this.depthTexture=void 0!==e.depthTexture?e.depthTexture:null}Je.prototype=Object.assign(Object.create(i.prototype),{constructor:Je,isWebGLRenderTarget:!0,setSize:function(t,n){this.width===t&&this.height===n||(this.width=t,this.height=n,this.texture.image.width=t,this.texture.image.height=n,this.dispose()),this.viewport.set(0,0,t,n),this.scissor.set(0,0,t,n)},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.width=t.width,this.height=t.height,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function $e(t,n,e,i){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,$e),je.call(this),this.strength=void 0!==n?n:1,this.radius=e,this.threshold=i,this.resolution=void 0!==t?new at(t.x,t.y):new at(256,256),this.texture=null,this.clearColor=new I(0,0,0);var r={minFilter:P,magFilter:P,format:g};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;var a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new Je(a,o,r),this.renderTargetBright.texture.name="RainPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(var s=0;s<this.nMips;s++){var h=new Je(a,o,r);h.texture.name="RainPass.h"+s,h.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(h);h=new Je(a,o,r);h.texture.name="RainPass.v"+s,h.texture.generateMipmaps=!1,this.renderTargetsVertical.push(h),a=Math.round(a/2),o=Math.round(o/2)}t=Ke,this.highPassUniforms=un.clone(t.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new vn({uniforms:this.highPassUniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,defines:{}}),this.separableBlurMaterials=[];for(var l=[3,5,7,9,11],a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2),c=0;c<this.nMips;c++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[c])),this.separableBlurMaterials[c].uniforms.texSize.value=new at(a,o),a=Math.round(a/2),o=Math.round(o/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=n,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new B(1,1,1),new B(1,1,1),new B(1,1,1),new B(1,1,1),new B(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,n=qe,this.copyUniforms=un.clone(n.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new vn({uniforms:this.copyUniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new I,this.oldClearAlpha=1,this.basic=new Mn,this.basic.transparent=!0,this.fsQuad=new je.FullScreenQuad(null)}$e.prototype=Object.assign(Object.create(je.prototype),{constructor:$e,dispose:function(){for(var t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()},setSize:function(t,n){var e=Math.round(t/2),i=Math.round(n/2);this.renderTargetBright.setSize(e,i);for(var r=0;r<this.nMips;r++)this.renderTargetsHorizontal[r].setSize(e,i),this.renderTargetsVertical[r].setSize(e,i),this.separableBlurMaterials[r].uniforms.texSize.value=new at(e,i),e=Math.round(e/2),i=Math.round(i/2)},render:function(t,n,e,i,r){this.oldClearColor.copy(t.getClearColor()),this.oldClearAlpha=t.getClearAlpha();var a=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),r&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=e.texture,t.setRenderTarget(null),this.fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=e.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this.fsQuad.render(t);for(var o=this.renderTargetBright,s=0;s<this.nMips;s++)this.fsQuad.material=this.separableBlurMaterials[s],this.separableBlurMaterials[s].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[s].uniforms.direction.value=$e.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[s]),t.clear(),this.fsQuad.render(t),this.separableBlurMaterials[s].uniforms.colorTexture.value=this.renderTargetsHorizontal[s].texture,this.separableBlurMaterials[s].uniforms.direction.value=$e.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[s]),t.clear(),this.fsQuad.render(t),o=this.renderTargetsVertical[s];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?t.setRenderTarget(null):t.setRenderTarget(e),this.fsQuad.render(t),t.setClearColor(this.oldClearColor,this.oldClearAlpha),t.autoClear=a},getSeperableBlurMaterial:function(t){return new vn({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new at(.5,.5)},direction:{value:new at(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat fSigma = float(SIGMA);\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\t\t\t\t\t\tfloat x = float(i);\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\t\t\t\t\t\tweightSum += 2.0 * w;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})},getCompositeMaterial:function(t){return new vn({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0},iTime:{value:0},rainSize:{value:.1},iResolution:{value:new at(300,200)},iMouse:{value:new at(300,200)},iChannel3:{value:null}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"\n\n varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform sampler2D dirtTexture;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n \n uniform float iTime;\n\n uniform float rainSize;\n\n uniform vec2 iResolution;\n\n uniform vec2 iMouse;\n\n uniform sampler2D iChannel3;\n\n uniform sampler2D tDiffuse;\n\n float sigh;\n mat3 turn;\n vec3 lightning;\n float nose;\n\n mat3 RotMat(vec3 v, float angle) {\n\n v = normalize(v);\n float c = cos(angle);\n float s = sin(angle);\n \n return mat3(c + (1.0 - c) * v.x * v.x, (1.0 - c) * v.x * v.y - s * v.z, (1.0 - c) * v.x * v.z + s * v.y,\n (1.0 - c) * v.x * v.y + s * v.z, c + (1.0 - c) * v.y * v.y, (1.0 - c) * v.y * v.z - s * v.x,\n (1.0 - c) * v.x * v.z - s * v.y, (1.0 - c) * v.y * v.z + s * v.x, c + (1.0 - c) * v.z * v.z\n );\n\n }\n\n vec3 Render( in vec3 ro, in vec3 rd ) {\n\n\n return vec3( 0.0,0.0,0.0 );\n\n }\n\n void main() {\n \n \n vec2 q = gl_FragCoord.xy/iResolution.xy;\n vec2 p = -1.0+2.0*q;\n vec2 mo = iMouse.xy;\n sigh = cos(iTime*1.2+1.5)*.03 + sin(iTime*.746)*.03;\n float ti = mod(iTime, 9.0);\n float f = floor(mod(iTime/9., 2.0));\n float r = (smoothstep(2.0, 3.0, ti) * smoothstep(8.0, 5.0, ti)) * .4;\n if (f == 0.0)\n turn = RotMat(vec3(.1, 0.5, .0), r);\n else\n turn = RotMat(vec3(.1, -0.5, .0), r);\n\n nose = smoothstep(3.0, 3.1, ti)* smoothstep(3.2, 3.1, ti)*.007;\n nose += smoothstep(3.2, 3.3, ti)* smoothstep(3.5, 3.3, ti)*.01;\n nose += smoothstep(3.7, 3.9, ti)* smoothstep(4.4, 3.8, ti)*.02;\n sigh += nose*.75;\n mo = (mo / iResolution.xy) - .5;\n\n vec3 origin = vec3(6.0*mo.x, 3.0 + 4.0*mo.y, -4.0);\n vec3 target = vec3( 0.0, 0.8, 1.2 );\n\n vec3 cw = normalize( target-origin);\n vec3 cp = vec3( 0.0, 1.0, 0.0 );\n vec3 cu = normalize( cross(cw,cp) );\n vec3 cv = ( cross(cu,cw) );\n vec3 ray = normalize( p.x*cu + p.y*cv + 2.5*cw );\n\n vec3 col = Render(origin, ray);\n\n col = pow( abs(col), vec3(.5));\n col *= pow( abs(65.0*q.x*q.y*(1.0-q.x)*(1.0-q.y)), .4 );\n vec2 st = p * vec2(.5, .01)+vec2(iTime*.3-q.y*.6*-cw.x, iTime*.3);\n f = texture2D(iChannel3, st).y * texture2D(iChannel3, st*.773).x * 0.655; \n col += f;\n // col *= min(iTime, 1.0);\n col *= min(rainSize, 1.0);\n gl_FragColor=vec4(clamp(col, 0.0, 1.0), 1.0 );\n \n }\n "})}}),$e.BlurDirectionX=new at(1,0),$e.BlurDirectionY=new at(0,1);function ti(t,n,e,i,r){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,ti),je.call(this),this.scene=t,this.camera=n,this.overrideMaterial=e,this.clearColor=i,this.clearAlpha=void 0!==r?r:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1}ti.prototype=Object.assign(Object.create(je.prototype),{constructor:ti,setPass:function(t,n){this.scene=t,this.camera=n},render:function(t,n,e){var i,r,a=t.autoClear;t.autoClear=!1,this.scene.overrideMaterial=this.overrideMaterial,this.clearColor&&(i=t.getClearColor().getHex(),r=t.getClearAlpha(),t.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&t.clearDepth(),t.setRenderTarget(this.renderToScreen?null:e),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera),this.clearColor&&t.setClearColor(i,r),this.scene.overrideMaterial=null,t.autoClear=a}});function ni(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,ni),je.call(this),this.textureID=void 0!==n?n:"tDiffuse",t instanceof vn?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=un.clone(t.uniforms),this.material=new vn({defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this.fsQuad=new je.FullScreenQuad(this.material)}function ei(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}ni.prototype=Object.assign(Object.create(je.prototype),{constructor:ni,render:function(t,n,e){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=e.texture),this.fsQuad.material=this.material,this.renderToScreen?t.setRenderTarget(null):(t.setRenderTarget(n),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil)),this.fsQuad.render(t)}});function ii(t,n){ei(this,ii),je.call(this),this.scene=t,this.camera=n,this.clear=!0,this.needsSwap=!1,this.inverse=!1}ii.prototype=Object.assign(Object.create(je.prototype),{constructor:ii,render:function(t,n,e){var i,r,a=t.getContext(),o=t.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0),r=this.inverse?(i=0,1):(i=1,0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.buffers.stencil.setFunc(a.ALWAYS,i,4294967295),o.buffers.stencil.setClear(r),t.setRenderTarget(e),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(n),this.clear&&t.clear(),t.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.stencil.setFunc(a.EQUAL,1,4294967295),o.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP)}});function ri(){ei(this,ri),je.call(this),this.needsSwap=!1}function ai(t){this.autoStart=void 0===t||t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}function oi(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}ri.prototype=Object.create(je.prototype),Object.assign(ri.prototype,{render:function(t){t.state.buffers.stencil.setTest(!1)}}),Object.assign(ai.prototype,{start:function(){this.startTime=("undefined"==typeof performance?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var t,n=0;return this.autoStart&&!this.running?(this.start(),0):(this.running&&(n=((t=("undefined"==typeof performance?Date:performance).now())-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=n),n)}});function si(t,n){var e,i;oi(this,si),this.renderer=t,void 0===n?(e={minFilter:P,magFilter:P,format:g,stencilBuffer:!1},i=t.getSize(new at),this.X=t.getPixelRatio(),this.G=i.width,this.B=i.height,(n=new Je(this.G*this.X,this.B*this.X,e)).texture.name="EffectComposer.rt1"):(this.X=1,this.G=n.width,this.B=n.height),this.renderTarget1=n,this.renderTarget2=n.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new ni(qe),this.clock=new ai}Object.assign(si.prototype,{swapBuffers:function(){var t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t},clearPass:function(){for(var t=0;t<this.passes.length;t++)this.passes[t].scene=null,this.passes[t].camera=null},addPass:function(t){this.passes.push(t),t.setSize(this.G*this.X,this.B*this.X)},insertPass:function(t,n){this.passes.splice(n,0,t)},isLastEnabledPass:function(t){for(var n=t+1;n<this.passes.length;n++)if(this.passes[n].enabled)return!1;return!0},render:function(t){void 0===t&&(t=this.clock.getDelta());for(var n,e,i,r=this.renderer.getRenderTarget(),a=!1,o=this.passes.length,s=0;s<o;s++)!1!==(i=this.passes[s]).enabled&&(i.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(s),i.render(this.renderer,this.writeBuffer,this.readBuffer,t,a),i.needsSwap&&(a&&(n=this.renderer.getContext(),(e=this.renderer.state.buffers.stencil).setFunc(n.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,t),e.setFunc(n.EQUAL,1,4294967295)),this.swapBuffers()),i instanceof ii?a=!0:i instanceof ri&&(a=!1));this.renderer.setRenderTarget(r)},reset:function(t){var n;void 0===t&&(n=this.renderer.getSize(new at),this.X=this.renderer.getPixelRatio(),this.G=n.width,this.B=n.height,(t=this.renderTarget1.clone()).setSize(this.G*this.X,this.B*this.X)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2},setSize:function(t,n){this.G=t,this.B=n;var e=this.G*this.X,i=this.B*this.X;this.renderTarget1.setSize(e,i),this.renderTarget2.setSize(e,i);for(var r=0;r<this.passes.length;r++)this.passes[r].setSize(e,i)},setPixelRatio:function(t){this.X=t,this.setSize(this.G,this.B)}});var hi,li,ci=function t(){oi(this,t),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1};function ui(t){oi(this,ui),this.H=new Be(li,t)}function fi(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}Object.assign(ci.prototype,{setSize:function(){},render:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}),ci.FullScreenQuad=(hi=new se(-1,1,1,-1,0,1),li=new he(2,2),Object.defineProperty(ui.prototype,"material",{get:function(){return this.H.material},set:function(t){this.H.material=t}}),Object.assign(ui.prototype,{render:function(t){t.render(this.H,hi)}}),ui);var di=function(){function e(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.L=t,this.k=this.V(),this.R(n)}var t,n,i;return t=e,(n=[{key:"getRaindrops",value:function(){return this.Y}},{key:"setRaindrops",value:function(t){this.Y=t}},{key:"getUrl",value:function(){return this.N}},{key:"setUrl",value:function(t){this.N=t,this.j.compositeMaterial.uniforms.iChannel3.value=(new On).load(t,function(t){t.wrapS=1e3,t.wrapT=1e3,t.anisotropy=16,t.repeat.set(4,4)})}},{key:"enable",value:function(){this.L.getRenderManager().rain=this}},{key:"disable",value:function(){this.L.getRenderManager().rain=null}},{key:"render",value:function(){this.Q+=1e-4*((new Date).getTime()-this.W),this.j.compositeMaterial.uniforms.iTime.value=this.Q,this.j.compositeMaterial.uniforms.rainSize.value=this.Y,this.Z.render()}}])&&fi(t.prototype,n),i&&fi(t,i),e}();Object.assign(di.prototype,{V:function(){return"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne),this.L.getRenderManager()},R:function(t){this.N=t.url,this.j=new $e(this.k.renderer),this.P=new ee,this.q=new ti(this.P,this.L.getCamera()),this.Z=new si(this.k.renderer),this.Z.addPass(this.q),this.Z.addPass(this.j),this.setUrl(this.N),this.j.compositeMaterial.uniforms.iTime.value=.2,this.j.compositeMaterial.uniforms.iResolution.value=new at(60,60),this.j.compositeMaterial.uniforms.iMouse.value=new at(10,10),this.Q=.6,this.W=(new Date).getTime(),this.Y=t.raindrops}});var vi=di,mi=0,pi=new Lt,gi=new jt,_i=new B;function xi(){Object.defineProperty(this,"id",{value:mi+=2}),this.uuid=E.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}function Ai(t){return(Ai="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function wi(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function Si(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&yi(t,n)}function yi(t,n){return(yi=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function Mi(e){var i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,n=bi(e);return t=i?(t=bi(this).constructor,Reflect.construct(n,arguments,t)):n.apply(this,arguments),n=this,!(t=t)||"object"!==Ai(t)&&"function"!=typeof t?Ti(n):t}}function Ti(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bi(t){return(bi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}xi.prototype=Object.assign(Object.create(i.prototype),{constructor:xi,isGeometry:!0,applyMatrix4:function(t){for(var n=(new Dt).getNormalMatrix(t),e=0,i=this.vertices.length;e<i;e++)this.vertices[e].applyMatrix4(t);for(e=0,i=this.faces.length;e<i;e++){var r=this.faces[e];r.normal.applyMatrix3(n).normalize();for(var a=0,o=r.vertexNormals.length;a<o;a++)r.vertexNormals[a].applyMatrix3(n).normalize()}return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(t){return pi.makeRotationX(t),this.applyMatrix4(pi),this},rotateY:function(t){return pi.makeRotationY(t),this.applyMatrix4(pi),this},rotateZ:function(t){return pi.makeRotationZ(t),this.applyMatrix4(pi),this},translate:function(t,n,e){return pi.makeTranslation(t,n,e),this.applyMatrix4(pi),this},scale:function(t,n,e){return pi.makeScale(t,n,e),this.applyMatrix4(pi),this},lookAt:function(t){return gi.lookAt(t),gi.updateMatrix(),this.applyMatrix4(gi.matrix),this},fromBufferGeometry:function(t){var a=this,n=null!==t.index?t.index.array:void 0,e=t.attributes;if(void 0===e.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=e.position.array,o=void 0!==e.normal?e.normal.array:void 0,s=void 0!==e.color?e.color.array:void 0,h=void 0!==e.uv?e.uv.array:void 0,l=void 0!==e.uv2?e.uv2.array:void 0;void 0!==l&&(this.faceVertexUvs[1]=[]);for(var r=0;r<i.length;r+=3)a.vertices.push((new B).fromArray(i,r)),void 0!==s&&a.colors.push((new I).fromArray(s,r));function c(t,n,e,i){var r=void 0===s?[]:[a.colors[t].clone(),a.colors[n].clone(),a.colors[e].clone()],i=new Me(t,n,e,void 0===o?[]:[(new B).fromArray(o,3*t),(new B).fromArray(o,3*n),(new B).fromArray(o,3*e)],r,i);a.faces.push(i),void 0!==h&&a.faceVertexUvs[0].push([(new at).fromArray(h,2*t),(new at).fromArray(h,2*n),(new at).fromArray(h,2*e)]),void 0!==l&&a.faceVertexUvs[1].push([(new at).fromArray(l,2*t),(new at).fromArray(l,2*n),(new at).fromArray(l,2*e)])}var u=t.groups;if(0<u.length)for(r=0;r<u.length;r++)for(var f=u[r],d=f.start,v=d,m=d+f.count;v<m;v+=3)void 0!==n?c(n[v],n[v+1],n[v+2],f.materialIndex):c(v,v+1,v+2,f.materialIndex);else if(void 0!==n)for(r=0;r<n.length;r+=3)c(n[r],n[r+1],n[r+2]);else for(r=0;r<i.length/3;r+=3)c(r,r+1,r+2);return this.computeFaceNormals(),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(_i).negate(),this.translate(_i.x,_i.y,_i.z),this},normalize:function(){this.computeBoundingSphere();var t=this.boundingSphere.center,n=this.boundingSphere.radius,e=0===n?1:1/n,n=new Lt;return n.set(e,0,0,-e*t.x,0,e,0,-e*t.y,0,0,e,-e*t.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){for(var t=new B,n=new B,e=0,i=this.faces.length;e<i;e++){var r=this.faces[e],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];t.subVectors(s,o),n.subVectors(a,o),t.cross(n),t.normalize(),r.normal.copy(t)}},computeVertexNormals:function(t){var n,e,i;for(void 0===t&&(t=!0),i=new Array(this.vertices.length),n=0,e=this.vertices.length;n<e;n++)i[n]=new B;if(t)for(var r,a,o,s=new B,h=new B,l=0,c=this.faces.length;l<c;l++)u=this.faces[l],r=this.vertices[u.a],a=this.vertices[u.b],o=this.vertices[u.c],s.subVectors(o,a),h.subVectors(r,a),s.cross(h),i[u.a].add(s),i[u.b].add(s),i[u.c].add(s);else for(this.computeFaceNormals(),l=0,c=this.faces.length;l<c;l++)i[(u=this.faces[l]).a].add(u.normal),i[u.b].add(u.normal),i[u.c].add(u.normal);for(n=0,e=this.vertices.length;n<e;n++)i[n].normalize();for(l=0,c=this.faces.length;l<c;l++){var u,f=(u=this.faces[l]).vertexNormals;3===f.length?(f[0].copy(i[u.a]),f[1].copy(i[u.b]),f[2].copy(i[u.c])):(f[0]=i[u.a].clone(),f[1]=i[u.b].clone(),f[2]=i[u.c].clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var t,n;for(this.computeFaceNormals(),t=0,n=this.faces.length;t<n;t++){var e,i=(e=this.faces[t]).vertexNormals;3===i.length?(i[0].copy(e.normal),i[1].copy(e.normal),i[2].copy(e.normal)):(i[0]=e.normal.clone(),i[1]=e.normal.clone(),i[2]=e.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var t,n,e;for(o=0,s=this.faces.length;o<s;o++)for((e=this.faces[o]).K?e.K.copy(e.normal):e.K=e.normal.clone(),e.J||(e.J=[]),t=0,n=e.vertexNormals.length;t<n;t++)e.J[t]?e.J[t].copy(e.vertexNormals[t]):e.J[t]=e.vertexNormals[t].clone();var i=new xi;for(i.faces=this.faces,t=0,n=this.morphTargets.length;t<n;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];for(var r=this.morphNormals[t].faceNormals,a=this.morphNormals[t].vertexNormals,o=0,s=this.faces.length;o<s;o++)h=new B,l={a:new B,b:new B,c:new B},r.push(h),a.push(l)}var h,l,c=this.morphNormals[t];for(i.vertices=this.morphTargets[t].vertices,i.computeFaceNormals(),i.computeVertexNormals(),o=0,s=this.faces.length;o<s;o++)e=this.faces[o],h=c.faceNormals[o],l=c.vertexNormals[o],h.copy(e.normal),l.a.copy(e.vertexNormals[0]),l.b.copy(e.vertexNormals[1]),l.c.copy(e.vertexNormals[2])}for(o=0,s=this.faces.length;o<s;o++)(e=this.faces[o]).normal=e.K,e.vertexNormals=e.J},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new et),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new _t),this.boundingSphere.setFromPoints(this.vertices)},mergeVertices:function(){for(var t,n,e,i,r={},a=[],o=[],s=Math.pow(10,4),h=0,l=this.vertices.length;h<l;h++)t=this.vertices[h],void 0===r[t=Math.round(t.x*s)+"_"+Math.round(t.y*s)+"_"+Math.round(t.z*s)]?(r[t]=h,a.push(this.vertices[h]),o[h]=a.length-1):o[h]=o[r[t]];var c=[];for(h=0,l=this.faces.length;h<l;h++){(n=this.faces[h]).a=o[n.a],n.b=o[n.b],n.c=o[n.c];for(var u=[n.a,n.b,n.c],f=0;f<3;f++)if(u[f]===u[(f+1)%3]){c.push(h);break}}for(h=c.length-1;0<=h;h--){var d=c[h];for(this.faces.splice(d,1),e=0,i=this.faceVertexUvs.length;e<i;e++)this.faceVertexUvs[e].splice(d,1)}var v=this.vertices.length-a.length;return this.vertices=a,v},setFromPoints:function(t){this.vertices=[];for(var n=0,e=t.length;n<e;n++){var i=t[n];this.vertices.push(new B(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var t=this.faces,n=t.length,e=0;e<n;e++)t[e].$=e;t.sort(function(t,n){return t.materialIndex-n.materialIndex});var i,r,a=this.faceVertexUvs[0],o=this.faceVertexUvs[1];a&&a.length===n&&(i=[]),o&&o.length===n&&(r=[]);for(e=0;e<n;e++){var s=t[e].$;i&&i.push(a[s]),r&&r.push(o[s])}i&&(this.faceVertexUvs[0]=i),r&&(this.faceVertexUvs[1]=r)},dispose:function(){this.dispatchEvent({type:"dispose"})}});var Li=function(){Si(l,tn);var h=Mi(l);function l(t,n,e,i,r,a){var o;wi(this,l),(o=h.call(this)).type="BoxBufferGeometry",o.parameters={width:t,height:n,depth:e,widthSegments:i,heightSegments:r,depthSegments:a};var L=Ti(o);t=t||1,n=n||1,e=e||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var P=[],E=[],F=[],N=[],D=0,C=0;function s(t,n,e,i,r,a,o,s,h,l,c){for(var u=a/h,f=o/l,d=a/2,v=o/2,m=s/2,p=h+1,g=l+1,_=0,x=0,A=new B,w=0;w<g;w++)for(var S=w*f-v,y=0;y<p;y++)A[t]=(y*u-d)*i,A[n]=S*r,A[e]=m,E.push(A.x,A.y,A.z),A[t]=0,A[n]=0,A[e]=0<s?1:-1,F.push(A.x,A.y,A.z),N.push(y/h),N.push(1-w/l),_+=1;for(w=0;w<l;w++)for(y=0;y<h;y++){var M=D+y+p*(w+1),T=D+(y+1)+p*(w+1),b=D+(y+1)+p*w;P.push(D+y+p*w,M,b),P.push(M,T,b),x+=6}L.addGroup(C,x,c),C+=x,D+=_}return s("z","y","x",-1,-1,e,n,t,a,r,0),s("z","y","x",1,-1,e,n,-t,a,r,1),s("x","z","y",1,1,t,e,n,i,a,2),s("x","z","y",1,-1,t,e,-n,i,a,3),s("x","y","z",1,-1,t,n,e,i,r,4),s("x","y","z",-1,-1,t,n,-e,i,r,5),o.setIndex(P),o.setAttribute("position",new mt(E,3)),o.setAttribute("normal",new mt(F,3)),o.setAttribute("uv",new mt(N,2)),o}return l}();function Pi(){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,Pi);var t=new vn({fragmentShader:(t=Pi.SkyShader).fragmentShader,vertexShader:t.vertexShader,uniforms:un.clone(t.uniforms),side:l});Be.call(this,new Li(1,1,1),t)}function Ei(t,n,e,i,r,a,o){xi.call(this),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:n,heightSegments:e,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new Fi(t,n,e,i,r,a,o)),this.mergeVertices()}function Fi(t,n,e,i,r,a,o){tn.call(this),this.type="SphereBufferGeometry",this.parameters={radius:t,widthSegments:n,heightSegments:e,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},t=t||1,n=Math.max(3,Math.floor(n)||8),e=Math.max(2,Math.floor(e)||6),i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI,a=void 0!==a?a:0,o=void 0!==o?o:Math.PI;for(var s,h=Math.min(a+o,Math.PI),l=0,c=[],u=new B,f=new B,d=[],v=[],m=[],p=[],g=0;g<=e;g++){var _=[],x=g/e,A=0;for(0==g&&0==a?A=.5/n:g==e&&h==Math.PI&&(A=-.5/n),s=0;s<=n;s++){var w=s/n;u.x=-t*Math.cos(i+w*r)*Math.sin(a+x*o),u.y=t*Math.cos(a+x*o),u.z=t*Math.sin(i+w*r)*Math.sin(a+x*o),v.push(u.x,u.y,u.z),f.copy(u).normalize(),m.push(f.x,f.y,f.z),p.push(w+A,1-x),_.push(l++)}c.push(_)}for(g=0;g<e;g++)for(s=0;s<n;s++){var S=c[g][s+1],y=c[g][s],M=c[g+1][s],T=c[g+1][s+1];(0!==g||0<a)&&d.push(S,y,T),(g!==e-1||h<Math.PI)&&d.push(y,M,T)}this.setIndex(d),this.setAttribute("position",new mt(v,3)),this.setAttribute("normal",new mt(m,3)),this.setAttribute("uv",new mt(p,2))}function Ni(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}Pi.prototype=Object.create(Be.prototype),Pi.SkyShader={uniforms:{luminance:{value:1},turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new B},up:{value:new B(0,1,0)}},vertexShader:["uniform vec3 sunPosition;","uniform float rayleigh;","uniform float turbidity;","uniform float mieCoefficient;","uniform vec3 up;","varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunFade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","const float e = 2.71828182845904523536028747135266249775724709369995957;","const float pi = 3.141592653589793238462643383279502884197169;","const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );","const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );","const float v = 4.0;","const vec3 K = vec3( 0.686, 0.678, 0.666 );","const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );","const float cutoffAngle = 1.6110731556870734;","const float steepness = 1.5;","const float EE = 1000.0;","float sunIntensity( float zenithAngleCos ) {","\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );","\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );","}","vec3 totalMie( float T ) {","\tfloat c = ( 0.2 * T ) * 10E-18;","\treturn 0.434 * c * MieConst;","}","void main() {","\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );","\tvWorldPosition = worldPosition.xyz;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","\tgl_Position.z = gl_Position.w;","\tvSunDirection = normalize( sunPosition );","\tvSunE = sunIntensity( dot( vSunDirection, up ) );","\tvSunFade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );","\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunFade ) );","\tvBetaR = totalRayleigh * rayleighCoefficient;","\tvBetaM = totalMie( turbidity ) * mieCoefficient;","}"].join("\n"),fragmentShader:["varying vec3 vWorldPosition;","varying vec3 vSunDirection;","varying float vSunFade;","varying vec3 vBetaR;","varying vec3 vBetaM;","varying float vSunE;","uniform float luminance;","uniform float mieDirectionalG;","uniform vec3 up;","const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );","const float pi = 3.141592653589793238462643383279502884197169;","const float n = 1.0003;","const float N = 2.545E25;","const float rayleighZenithLength = 8.4E3;","const float mieZenithLength = 1.25E3;","const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;","const float THREE_OVER_SIXTEENPI = 0.05968310365946075;","const float ONE_OVER_FOURPI = 0.07957747154594767;","float rayleighPhase( float cosTheta ) {","\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );","}","float hgPhase( float cosTheta, float g ) {","\tfloat g2 = pow( g, 2.0 );","\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );","\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );","}","const float A = 0.15;","const float B = 0.50;","const float C = 0.10;","const float D = 0.20;","const float E = 0.02;","const float F = 0.30;","const float whiteScale = 1.0748724675633854;","vec3 Uncharted2Tonemap( vec3 x ) {","\treturn ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;","}","void main() {","\tfloat zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );","\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );","\tfloat sR = rayleighZenithLength * inverse;","\tfloat sM = mieZenithLength * inverse;","\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );","\tfloat cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );","\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );","\tvec3 betaRTheta = vBetaR * rPhase;","\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );","\tvec3 betaMTheta = vBetaM * mPhase;","\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );","\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );","\tvec3 direction = normalize( vWorldPosition - cameraPos );","\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]","\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]","\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );","\tvec3 L0 = vec3( 0.1 ) * Fex;","\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );","\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;","\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );","\tvec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );","\tvec3 color = curr * whiteScale;","\tvec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunFade ) ) ) );","\tgl_FragColor = vec4( retColor, 1.0 );","}"].join("\n")},(Ei.prototype=Object.create(xi.prototype)).constructor=Ei,(Fi.prototype=Object.create(tn.prototype)).constructor=Fi;var Di=function(){function n(t){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),this.L=t,this.P=new ee,this.tt=null,this.nt=null,this.nt={turbidity:10,rayleigh:3,mieCoefficient:.005,mieDirectionalG:.7,luminance:1,inclination:.49,azimuth:.25,scale:500},this.et=4e5,this.it=0,this.rt=1,this.R(),this.U()}var t,e,i;return t=n,(e=[{key:"getState",value:function(){var t=this.sky.material.uniforms;return{turbidity:t.turbidity.value,rayleigh:t.rayleigh.value,luminance:t.luminance.value,scale:this.sky.scale.x}}},{key:"setState",value:function(t){t.scale&&this.sky.scale.setScalar(t.scale);var n=this.sky.material.uniforms;n.turbidity.value=("number"==typeof t.turbidity?t:this.nt).turbidity,n.rayleigh.value=("number"==typeof t.rayleigh?t:this.nt).rayleigh,n.luminance.value=("number"==typeof t.luminance?t:this.nt).luminance,this.ot(this.nt.inclination)}},{key:"enable",value:function(){this.L.getRenderManager().sky=this}},{key:"disable",value:function(){this.L.getRenderManager().sky=null}},{key:"setTime",value:function(t){t=(t-6)/12;1<t&&(t-=2),this.ot(t)}},{key:"autoTime",value:function(){}},{key:"render",value:function(){this.L.getRenderManager().renderer.render(this.P,this.L.getCamera())}}])&&Ni(t.prototype,e),i&&Ni(t,i),n}();Object.assign(Di.prototype,{R:function(){this.sky=new Pi,this.sky.scale.setScalar(this.nt.scale),this.P.add(this.sky),this.tt=new Be(new Fi(2e4,16,8),new Mn({color:16777215})),this.tt.position.y=-7e5,this.tt.visible=!0,this.P.add(this.tt),this.setState(this.nt)},U:function(){"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne)},ot:function(t){var n=this.sky.material.uniforms,e=Math.PI*(t+1),t=2*Math.PI*(this.nt.azimuth-.5);this.tt.position.z=this.et*Math.cos(t),this.tt.position.y=this.et*Math.sin(t)*Math.sin(e),this.tt.position.x=this.et*Math.sin(t)*Math.cos(e),n.sunPosition.value=this.tt.position}});var Ci=Di,Ii={common:{diffuse:{value:new I(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Dt},uv2Transform:{value:new Dt},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 at(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new I(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new I(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Dt}},sprite:{diffuse:{value:new I(15658734)},opacity:{value:1},center:{value:new at(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Dt}}},Ri={alphamap_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n\n#endif\n",alphamap_pars_fragment:"\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",alphatest_fragment:"\n#ifdef ALPHATEST\n\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n\n#endif\n",aomap_fragment:"\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\n\t#endif\n\n#endif\n",aomap_pars_fragment:"\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n",begin_vertex:"\nvec3 transformed = vec3( position );\n",beginnormal_vertex:"\nvec3 objectNormal = vec3( normal );\n\n#ifdef USE_TANGENT\n\n\tvec3 objectTangent = vec3( tangent.xyz );\n\n#endif\n",bsdfs:'\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via \'environmentBRDF\' from "Physically Based Shading on Mobile"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\n\tvec4 r = roughness * c0 + c1;\n\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n\n}\n\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\t// this is intended to be used on spot and point lights who are represented as luminous intensity\n\t// but who must be converted to luminous irradiance for surface lighting calculation\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\tif( cutoffDistance > 0.0 ) {\n\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t}\n\n\treturn distanceFalloff;\n\n#else\n\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\n\t}\n\n\treturn 1.0;\n\n#endif\n\n}\n\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\n\t// Original approximation by Christophe Schlick \'94\n\t// float fresnel = pow( 1.0 - dotLH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH \'13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n\n} // validated\n\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\n\t// See F_Schlick\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\n\treturn Fr * fresnel + F0;\n\n}\n\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (34)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\t// geometry term (normalized) = G(l)⋅G(v) / 4(n⋅l)(n⋅v)\n\t// also see #12151\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\n\treturn 1.0 / ( gl * gv );\n\n} // validated\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\n\t// dotNL and dotNV are explicitly swapped. This is not a mistake.\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is "roughness squared" in Disney’s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\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\n\tfloat alpha = pow2( roughness ); // UE4\'s roughness\n\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\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\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\tfloat D = D_GGX( alpha, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\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\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\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\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\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\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\n\t// transform rect\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\n\t// project rect onto sphere\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\n\t// calculate vector form factor\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\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see referece)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\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\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\n\treturn specularColor * brdf.x + brdf.y;\n\n} // validated\n\n// Fdez-Agüera\'s "Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\n\t//float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\t//float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n// source: http://simonstechblog.blogspot.ca/2011/12/microfacet-brdf.html\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\n\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L94\nfloat D_Charlie(float roughness, float NoH) {\n\t// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF"\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs#L136\nfloat V_Neubelt(float NoV, float NoL) {\n\t// Neubelt and Pettineo 2013, "Crafting a Next-gen Material Pipeline for The Order: 1886"\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\n\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n\n}\n\n#endif\n',bumpmap_pars_fragment:"\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\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\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\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;\t\t// normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n",clipping_planes_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\tbool clipped = true;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\tif ( clipped ) discard;\n\n\t#endif\n\n#endif\n",clipping_planes_pars_fragment:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n",clipping_planes_pars_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n",clipping_planes_vertex:"\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n",color_fragment:"\n#ifdef USE_COLOR\n\n\tdiffuseColor.rgb *= vColor;\n\n#endif\n",color_pars_fragment:"\n#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",color_pars_vertex:"\n#ifdef USE_COLOR\n\n\tvarying vec3 vColor;\n\n#endif\n",color_vertex:"\n#ifdef USE_COLOR\n\n\tvColor.xyz = color.xyz;\n\n#endif\n",common:"\n#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n\n#ifndef saturate\n// <tonemapping_pars_fragment> may have defined saturate() already\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\n\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 ) ); }\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\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\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\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t// dir can be either a direction vector or a normal vector\n\t// upper-left 3x3 of matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n\n}\n\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\n\treturn - distance * planeNormal + point;\n\n}\n\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n\n}\n\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n\n}\n\nmat3 transposeMat3( const in mat3 m ) {\n\n\tmat3 tmp;\n\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\n\treturn tmp;\n\n}\n\n// https://en.wikipedia.org/wiki/Relative_luminance\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\n\treturn dot( weights, color.rgb );\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n return m[ 2 ][ 3 ] == - 1.0;\n\n}\n",cube_uv_reflection_fragment:"\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\n\n// These shader functions convert between the UV coordinates of a single face of\n// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n// sampling a textureCube (not generally normalized).\n\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\n\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\n\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n\n// These defines must match with PMREMGenerator\n\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\n\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25\n }\n return mip;\n}\n\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif\n",defaultnormal_vertex:"\nvec3 transformedNormal = objectNormal;\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// shear transforms in the instance matrix are not supported\n\n\tmat3 m = mat3( instanceMatrix );\n\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\n\ttransformedNormal = m * transformedNormal;\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#ifdef FLIP_SIDED\n\n\t\ttransformedTangent = - transformedTangent;\n\n\t#endif\n\n#endif\n",displacementmap_pars_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n",displacementmap_vertex:"\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n\n#endif\n",emissivemap_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n",emissivemap_pars_fragment:"\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n",encodings_fragment:"\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n",encodings_pars_fragment:"\n// For a discussion of what this is, please read this: http://lousodrome.net/blog/light/2013/05/26/gamma-correct-and-hdr-rendering-in-a-32-bits-buffer/\n\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\n\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\n\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\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}\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}\n\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\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// return vec4( value.brg, ( 3.0 + 128.0 ) / 256.0 );\n}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\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}\n\n// reference: http://iwasbeingirony.blogspot.ca/2010/06/difference-between-rgbm-and-rgbd.html\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\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\t// NOTE: The implementation with min causes the shader to not compile on\n\t// a common Alcatel A502DL in Chrome 78/Android 8.1. Some research suggests \n\t// that the chipset is Mediatek MT6739 w/ IMG PowerVR GE8100 GPU.\n\t// D = min( floor( D ) / 255.0, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\n\n// LogLuv reference: http://graphicrants.blogspot.ca/2009/04/rgbm-color-encoding.html\n\n// M matrix, for encoding\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}\n\n// Inverse M matrix, for decoding\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}\n",envmap_fragment:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\n\t\tvec2 sampleUV;\n\n\t\treflectVec = normalize( reflectVec );\n\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\treflectVec = normalize( reflectVec );\n\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\n\t#else\n\n\t\tvec4 envColor = vec4( 0.0 );\n\n\t#endif\n\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\n\t\tenvColor = envMapTexelToLinear( envColor );\n\n\t#endif\n\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t#endif\n\n#endif\n",envmap_common_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\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\n",envmap_pars_fragment:"\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n",envmap_pars_vertex:"\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n",envmap_physical_pars_fragment:"\n#if defined( USE_ENVMAP )\n\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\n\tvec3 getLightProbeIndirectIrradiance( /*const in SpecularLightProbe specularLightProbe,*/ const in GeometricContext geometry, const in int maxMIPLevel ) {\n\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\n\t\t\t// TODO: replace with properly filtered cubemaps and access the irradiance LOD level, be it the last LOD level\n\t\t\t// of a specular cubemap, or just the default level of a specially created irradiance cubemap.\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#else\n\n\t\t\t\t// force the bias high to get the last LOD level as it is the most blurred.\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\n\t\t#else\n\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\n\t\t#endif\n\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t}\n\n\t// Trowbridge-Reitz distribution to Mip level, following the logic of http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\n\t\t// clamp to allowable LOD ranges.\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\n\t}\n\n\tvec3 getLightProbeIndirectRadiance( /*const in SpecularLightProbe specularLightProbe,*/ const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\n\t\t // Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\n\t\t#else\n\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\n\t\t#endif\n\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#else\n\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\n\t\t\t#endif\n\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\n\t\t#endif\n\n\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t}\n\n#endif\n",envmap_vertex:"\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) { \n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n",fog_vertex:"\n#ifdef USE_FOG\n\n\tfogDepth = -mvPosition.z;\n\n#endif\n",fog_pars_vertex:"\n#ifdef USE_FOG\n\n\tvarying float fogDepth;\n\n#endif\n",fog_fragment:"\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n",fog_pars_fragment:"\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n",gradientmap_pars_fragment:"\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\n\t#else\n\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\n\t#endif\n\n}\n\n",lightmap_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; // factor of PI should not be present; included here to prevent breakage\n\n#endif\n",lightmap_pars_fragment:"\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n",lights_lambert_vertex:"\nvec3 diffuse = vec3( 1.0 );\n\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\n\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\n\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\n\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n\n#if NUM_POINT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_SPOT_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n/*\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\t// TODO (abelnation): implement\n\n\t}\n\n#endif\n*/\n\n#if NUM_DIR_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if NUM_HEMI_LIGHTS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t#ifdef DOUBLE_SIDED\n\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\n\t\t#endif\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n",lights_pars_begin:"\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\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\n\t// band 2\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\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI;\n\n\t#endif\n\n\treturn irradiance;\n\n}\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\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\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\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\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t// directLight is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\n\t\tif ( angleCos > spotLight.coneCos ) {\n\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\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\n\t\t} else {\n\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\n\t\t}\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tirradiance *= PI;\n\n\t\t#endif\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n",lights_toon_fragment:"\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_toon_pars_fragment:"\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n\nstruct ToonMaterial {\n\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n\n};\n\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI; // punctual light\n\n\t#endif\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_phong_fragment:"\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n\nstruct BlinnPhongMaterial {\n\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI; // punctual light\n\n\t#endif\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n\n#define Material_LightProbeLOD( material )\t(0)\n",lights_physical_fragment:"\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\n\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n\n#ifdef REFLECTIVITY\n\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n\n#endif\n\n#ifdef CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheen;\n\n#endif\n",lights_physical_pars_fragment:"\nstruct PhysicalMaterial {\n\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n\n};\n\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\n\n// Clear coat directional hemishperical reflectance (this approximation should be improved)\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\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\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\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\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\tirradiance *= PI; // punctual light\n\n\t#endif\n\n\t#ifdef CLEARCOAT\n\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tccIrradiance *= PI; // punctual light\n\n\t\t#endif\n\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\n\t#else\n\n\t\tfloat clearcoatDHR = 0.0;\n\n\t#endif\n\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\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\n}\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\n\t#ifdef CLEARCOAT\n\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\n\t#else\n\n\t\tfloat clearcoatDHR = 0.0;\n\n\t#endif\n\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n",lights_fragment_begin:"\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - If you have defined an RE_IndirectSpecular, you need to also provide a Material_LightProbeLOD. <---- ???\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\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\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\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\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\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\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",lights_fragment_maps:"\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\n\t\t\tlightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage\n\n\t\t#endif\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\tradiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\n\t#ifdef CLEARCOAT\n\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\n\t#endif\n\n#endif\n",lights_fragment_end:"\n#if defined( RE_IndirectDiffuse )\n\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n\n#endif\n",logdepthbuf_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n",logdepthbuf_pars_fragment:"\n#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n",logdepthbuf_pars_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\n\t#else\n\n\t\tuniform float logDepthBufFC;\n\n\t#endif\n\n#endif\n",logdepthbuf_vertex:"\n#ifdef USE_LOGDEPTHBUF\n\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n\t#else\n\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\n\t\t\tgl_Position.z *= gl_Position.w;\n\n\t\t}\n\n\t#endif\n\n#endif\n",map_fragment:"\n#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n\n#endif\n",map_fragment_1:"\n#ifdef USE_MAP\n\n\tvec4 texelColor = texture2D( map, vUv );\n\n\ttexelColor = mapTexelToLinear( texelColor );\n\t\n\tif(mapMixColor){\n\t diffuseColor = texelColor*texelColor.a + diffuseColor*(1.0-texelColor.a);\n\t}else {\n\t diffuseColor *= texelColor;\n\t}\n\n#endif\n",map_pars_fragment:"\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n",map_particle_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n#endif\n\n#ifdef USE_MAP\n\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n",map_particle_pars_fragment:"\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\tuniform mat3 uvTransform;\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n",metalnessmap_fragment:"\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n",metalnessmap_pars_fragment:"\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n",morphnormal_vertex:"\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\n#endif\n",morphtarget_pars_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\tuniform float morphTargetBaseInfluence;\n\n\t#ifndef USE_MORPHNORMALS\n\n\tuniform float morphTargetInfluences[ 8 ];\n\n\t#else\n\n\tuniform float morphTargetInfluences[ 4 ];\n\n\t#endif\n\n#endif\n",morphtarget_vertex:"\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\n\t#ifndef USE_MORPHNORMALS\n\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\n\t#endif\n\n#endif\n",normal_fragment_begin:"\n#ifdef FLAT_SHADED\n\n\t// Workaround for Adreno/Nexus5 not able able to do dFdx( vViewPosition ) ...\n\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\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t#endif\n\n\t#ifdef USE_TANGENT\n\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\n\t\t#ifdef DOUBLE_SIDED\n\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\n\t\t#endif\n\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 geometryNormal = normal;\n\n",normal_fragment_maps:"\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( TANGENTSPACE_NORMALMAP )\n\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tnormal = normalize( vTBN * mapN );\n\n\t#else\n\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\n\t#endif\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n",normalmap_pars_fragment:"\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef OBJECTSPACE_NORMALMAP\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\n\t// Per-Pixel Tangent Space Normal Mapping\n\t// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\n\t\t// Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\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\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s ); // we do not care about the magnitude\n\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\n\t\tmat3 tsn = mat3( S, T, N );\n\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\n\t\treturn normalize( tsn * mapN );\n\n\t}\n\n#endif\n",clearcoat_normal_fragment_begin:"\n#ifdef CLEARCOAT\n\n\tvec3 clearcoatNormal = geometryNormal;\n\n#endif\n",clearcoat_normal_fragment_maps:"\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\t#ifdef USE_TANGENT\n\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\n\t#else\n\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\n\t#endif\n\n#endif\n",clearcoat_pars_fragment:"\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n",packing:"\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\n\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\n\nconst float ShiftRight8 = 1. / 256.;\n\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8; // tidy overflow\n\treturn r * PackUpscale;\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\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}\n\n// NOTE: viewZ/eyeZ is < 0 when in front of the camera per OpenGL conventions\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}\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}\n",premultiplied_alpha_fragment:"\n#ifdef PREMULTIPLIED_ALPHA\n\n\t// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation.\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n",project_vertex:"\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n",dithering_pars_fragment:"\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift acording to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n",roughnessmap_fragment:"\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n",roughnessmap_pars_fragment:"\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n",shadowmap_pars_fragment:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): create uniforms for area light shadows\n\n\t#endif\n\t*/\n\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\n\t}\n\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\n\t}\n\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\n\t\tfloat occlusion = 1.0;\n\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\n\t\tfloat hard_shadow = step( compare , distribution.x ); // Hard Shadow\n\n\t\tif (hard_shadow != 1.0 ) {\n\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 ); // Chebeyshevs inequality\n\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed\n\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\n\t\t}\n\t\treturn occlusion;\n\n\t}\n\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\n\t\t// if ( something && something ) breaks ATI OpenGL shader compiler\n\t\t// if ( all( something, something ) ) using this instead\n\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\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\n\t\tbool frustumTest = all( frustumTestVec );\n\n\t\tif ( frustumTest ) {\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\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\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\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\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\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#else // no percentage-closer filtering:\n\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\n\t\t#endif\n\n\t\t}\n\n\t\treturn shadow;\n\n\t}\n\n\t// cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D\n\t// vector suitable for 2D texture mapping. This code uses the following layout for the\n\t// 2D texture:\n\t//\n\t// xzXZ\n\t// y Y\n\t//\n\t// Y - Positive y direction\n\t// y - Negative y direction\n\t// X - Positive x direction\n\t// x - Negative x direction\n\t// Z - Positive z direction\n\t// z - Negative z direction\n\t//\n\t// Source and test bed:\n\t// https://gist.github.com/tschw/da10c43c467ce8afd0c4\n\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\n\t\t// Number of texels to avoid at the edge of each square\n\n\t\tvec3 absV = abs( v );\n\n\t\t// Intersect unit cube\n\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\n\t\t// Apply scale to avoid seams\n\n\t\t// two texels less per square (one texel will do for NEAREST)\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\n\t\t// Unwrap\n\n\t\t// space: -1 ... 1 range for each square\n\t\t//\n\t\t// #X##\t\tdim := ( 4 , 2 )\n\t\t// # #\t\tcenter := ( 1 , 1 )\n\n\t\tvec2 planar = v.xy;\n\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\n\t\tif ( absV.z >= almostOne ) {\n\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\n\t\t} else if ( absV.x >= almostOne ) {\n\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\n\t\t} else if ( absV.y >= almostOne ) {\n\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\n\t\t}\n\n\t\t// Transform to UV space\n\n\t\t// scale := 0.5 / dim\n\t\t// translate := ( center + 0.5 ) / dim\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\n\t}\n\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// dp = normalized distance from light to fragment position\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?\n\t\tdp += shadowBias;\n\n\t\t// bd3D = base direction 3D\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\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\n\t\t#else // no percentage-closer filtering\n\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\n\t\t#endif\n\n\t}\n\n#endif\n",shadowmap_pars_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n",shadowmap_vertex:"\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n",shadowmask_pars_fragment:"\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\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\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n",skinbase_vertex:"\n#ifdef USE_SKINNING\n\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\n#endif\n",skinning_pars_vertex:"\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\t#ifdef BONE_TEXTURE\n\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\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\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\n\t\t\ty = dy * ( y + 0.5 );\n\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\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\n\t\t\treturn bone;\n\n\t\t}\n\n\t#else\n\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\n\t\tmat4 getBoneMatrix( const in float i ) {\n\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\n\t\t}\n\n\t#endif\n\n#endif\n",skinning_vertex:"\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\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\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n",skinnormal_vertex:"\n#ifdef USE_SKINNING\n\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\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n",specularmap_fragment:"\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n",specularmap_pars_fragment:"\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n",tonemapping_fragment:"\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n",tonemapping_pars_fragment:"\n#ifndef saturate\n// <common> may have defined saturate() already\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn toneMappingExposure * color;\n\n}\n\n// source: https://www.cs.utah.edu/~reinhard/cdrom/\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\n\t// John Hable's filmic operator from Uncharted 2 video game\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n\n}\n\n// source: http://filmicgames.com/archives/75\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\n\t// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n\n}\n",uv_pars_fragment:"\n#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\n\tvarying vec2 vUv;\n\n#endif\n",uv_pars_vertex:"\n#ifdef USE_UV\n\n\t#ifdef UVS_VERTEX_ONLY\n\n\t\tvec2 vUv;\n\n\t#else\n\n\t\tvarying vec2 vUv;\n\n\t#endif\n\n\tuniform mat3 uvTransform;\n\n#endif\n",uv_vertex:"\n#ifdef USE_UV\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n#endif\n",uv2_pars_fragment:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvarying vec2 vUv2;\n\n#endif\n",uv2_pars_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\n\tuniform mat3 uv2Transform;\n\n#endif\n",uv2_vertex:"\n#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n\n#endif\n",worldpos_vertex:"\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n",background_frag:"\nuniform sampler2D t2D;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tvec4 texColor = texture2D( t2D, vUv );\n\n\tgl_FragColor = mapTexelToLinear( texColor );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\n}\n",background_vert:"\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n",cube_frag:"\n\n#include <envmap_common_pars_fragment>\nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\n#include <cube_uv_reflection_fragment>\n\nvoid main() {\n\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\n}\n",cube_vert:"\nvarying vec3 vWorldDirection;\n\n#include <common>\n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n",depth_frag:"\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\n\t#include <logdepthbuf_fragment>\n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n",depth_vert:"\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\t#include <skinbase_vertex>\n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n",distanceRGBA_frag:"\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main () {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n",distanceRGBA_vert:"\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\t#include <skinbase_vertex>\n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n",equirect_frag:"\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include <common>\n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV;\n\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\n\tgl_FragColor = mapTexelToLinear( texColor );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\n}\n",equirect_vert:"\nvarying vec3 vWorldDirection;\n\n#include <common>\n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\n}\n",linedashed_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\n}\n",linedashed_vert:"\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\n}\n",meshbasic_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include <envmap_fragment>\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\n}\n",meshbasic_vert:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\n\t#ifdef USE_ENVMAP\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n\n}\n",meshlambert_frag:"\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\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\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\n\t#endif\n\n\t#include <lightmap_fragment>\n\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\n\t#else\n\n\t\treflectedLight.directDiffuse = vLightFront;\n\n\t#endif\n\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include <envmap_fragment>\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}\n",meshlambert_vert:"\n#define LAMBERT\n\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}\n",meshmatcap_frag:"\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\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; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( 1.0 );\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\n}\n",meshmatcap_vert:"\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n\t#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\t\tvNormal = normalize( transformedNormal );\n\n\t#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n",meshtoon_frag:"\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\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\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",meshtoon_vert:"\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n}\n",meshphong_frag:"\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\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\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include <envmap_fragment>\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",meshphong_vert:"\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n}\n",meshphysical_frag:"\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\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\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\n\t// accumulation\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\n\t// modulation\n\t#include <aomap_fragment>\n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t// this is a stub for the transparency model\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n\n}\n",meshphysical_vert:"\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n}\n",normal_frag:"\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\n}\n",normal_vert:"\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\n#ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t#endif\n\n#endif\n\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n",points_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\n\toutgoingLight = diffuseColor.rgb;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\n}\n",points_vert:"\nuniform float size;\nuniform float scale;\n\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n\n}\n",shadow_frag:"\nuniform vec3 color;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n\nvoid main() {\n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n",shadow_vert:"\n#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\n\nvoid main() {\n\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n\n}\n",sprite_frag:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\n\toutgoingLight = diffuseColor.rgb;\n\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\n}\n",sprite_vert:"\nuniform float rotation;\nuniform vec2 center;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n\t#include <uv_vertex>\n\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\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\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\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\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\n}\n"};function Ui(t,n,e,i){oe.call(this),this.type="PerspectiveCamera",this.fov=void 0!==t?t:50,this.zoom=1,this.near=void 0!==e?e:.1,this.far=void 0!==i?i:2e3,this.focus=10,this.aspect=void 0!==n?n:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}Ui.prototype=Object.assign(Object.create(oe.prototype),{constructor:Ui,isPerspectiveCamera:!0,copy:function(t,n){return oe.prototype.copy.call(this,t,n),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){t=.5*this.getFilmHeight()/t;this.fov=2*E.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*E.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*E.RAD2DEG*Math.atan(Math.tan(.5*E.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,n,e,i,r,a){this.aspect=t/n,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=n,this.view.offsetX=e,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t,n=this.near,e=n*Math.tan(.5*E.DEG2RAD*this.fov)/this.zoom,i=2*e,r=this.aspect*i,a=-.5*r,o=this.view;null!==this.view&&this.view.enabled&&(t=o.fullWidth,s=o.fullHeight,a+=o.offsetX*r/t,e-=o.offsetY*i/s,r*=o.width/t,i*=o.height/s);var s=this.filmOffset;0!==s&&(a+=n*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+r,e,e-i,n,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)}});function Oi(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,Oi),Be.call(this,t);var r=this,e=void 0!==(n=n||{}).textureWidth?n.textureWidth:512,i=void 0!==n.textureHeight?n.textureHeight:512,a=void 0!==n.clipBias?n.clipBias:0,o=void 0!==n.alpha?n.alpha:1,s=void 0!==n.time?n.time:0,h=void 0!==n.waterNormals?n.waterNormals:null,l=void 0!==n.sunDirection?n.sunDirection:new B(.70707,.70707,0),c=new I(void 0!==n.sunColor?n.sunColor:16777215),u=new I(void 0!==n.waterColor?n.waterColor:8355711),f=void 0!==n.eye?n.eye:new B(0,0,0),d=void 0!==n.distortionScale?n.distortionScale:20,t=void 0!==n.side?n.side:L,n=void 0!==n.fog&&n.fog,v=new fe,m=new B,p=new B,g=new B,_=new Lt,x=new B(0,0,-1),A=new rt,w=new B,S=new B,y=new rt,M=new Lt,T=new Ui,b=new Je(e,i,{minFilter:P,magFilter:P,format:1022,stencilBuffer:!1});E.isPowerOfTwo(e)&&E.isPowerOfTwo(i)||(b.texture.generateMipmaps=!1),i={uniforms:un.merge([Ii.fog,Ii.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new Lt},sunColor:{value:new I(8355711)},sunDirection:{value:new B(.70707,.70707,0)},eye:{value:new B},waterColor:{value:new I(5592405)}}]),vertexShader:["uniform mat4 textureMatrix;","uniform float time;","varying vec4 mirrorCoord;","varying vec4 worldPosition;",Ri.fog_pars_vertex,Ri.shadowmap_pars_vertex,"void main() {","\tmirrorCoord = modelMatrix * vec4( position, 1.0 );","\tworldPosition = mirrorCoord.xyzw;","\tmirrorCoord = textureMatrix * mirrorCoord;","\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );","\tgl_Position = projectionMatrix * mvPosition;",Ri.fog_vertex,Ri.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform sampler2D mirrorSampler;","uniform float alpha;","uniform float time;","uniform float size;","uniform float distortionScale;","uniform sampler2D normalSampler;","uniform vec3 sunColor;","uniform vec3 sunDirection;","uniform vec3 eye;","uniform vec3 waterColor;","varying vec4 mirrorCoord;","varying vec4 worldPosition;","vec4 getNoise( vec2 uv ) {","\tvec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);","\tvec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );","\tvec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );","\tvec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );","\tvec4 noise = texture2D( normalSampler, uv0 ) +","\t\ttexture2D( normalSampler, uv1 ) +","\t\ttexture2D( normalSampler, uv2 ) +","\t\ttexture2D( normalSampler, uv3 );","\treturn noise * 0.5 - 1.0;","}","void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {","\tvec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );","\tfloat direction = max( 0.0, dot( eyeDirection, reflection ) );","\tspecularColor += pow( direction, shiny ) * sunColor * spec;","\tdiffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;","}",Ri.common,Ri.packing,Ri.bsdfs,Ri.fog_pars_fragment,Ri.lights_pars_begin,Ri.shadowmap_pars_fragment,Ri.shadowmask_pars_fragment,"void main() {","\tvec4 noise = getNoise( worldPosition.xz * size );","\tvec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );","\tvec3 diffuseLight = vec3(0.0);","\tvec3 specularLight = vec3(0.0);","\tvec3 worldToEye = eye-worldPosition.xyz;","\tvec3 eyeDirection = normalize( worldToEye );","\tsunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );","\tfloat distance = length(worldToEye);","\tvec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;","\tvec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );","\tfloat theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );","\tfloat rf0 = 0.3;","\tfloat reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );","\tvec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;","\tvec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);","\tvec3 outgoingLight = albedo;","\tgl_FragColor = vec4( outgoingLight, alpha );",Ri.tonemapping_fragment,Ri.fog_fragment,"}"].join("\n")},(n=new vn({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:un.clone(i.uniforms),transparent:!0,lights:!0,side:t,fog:n})).uniforms.mirrorSampler.value=b.texture,n.uniforms.textureMatrix.value=M,n.uniforms.alpha.value=o,n.uniforms.time.value=s,n.uniforms.normalSampler.value=h,n.uniforms.sunColor.value=c,n.uniforms.waterColor.value=u,n.uniforms.sunDirection.value=l,n.uniforms.distortionScale.value=d,n.uniforms.eye.value=f,r.material=n,r.onBeforeRender=function(t,n,e){var i;p.setFromMatrixPosition(r.matrixWorld),g.setFromMatrixPosition(e.matrixWorld),_.extractRotation(r.matrixWorld),m.set(0,0,1),m.applyMatrix4(_),w.subVectors(p,g),0<w.dot(m)||(w.reflect(m).negate(),w.add(p),_.extractRotation(e.matrixWorld),x.set(0,0,-1),x.applyMatrix4(_),x.add(g),S.subVectors(p,x),S.reflect(m).negate(),S.add(p),T.position.copy(w),T.up.set(0,1,0),T.up.applyMatrix4(_),T.up.reflect(m),T.lookAt(S),T.far=e.far,T.updateMatrixWorld(),T.projectionMatrix.copy(e.projectionMatrix),M.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),M.multiply(T.projectionMatrix),M.multiply(T.matrixWorldInverse),v.setFromNormalAndCoplanarPoint(m,p),v.applyMatrix4(T.matrixWorldInverse),A.set(v.normal.x,v.normal.y,v.normal.z,v.constant),i=T.projectionMatrix,y.x=(Math.sign(A.x)+i.elements[8])/i.elements[0],y.y=(Math.sign(A.y)+i.elements[9])/i.elements[5],y.z=-1,y.w=(1+i.elements[10])/i.elements[14],A.multiplyScalar(2/A.dot(y)),i.elements[2]=A.x,i.elements[6]=A.y,i.elements[10]=A.z+1-a,i.elements[14]=A.w,f.setFromMatrixPosition(e.matrixWorld),i=t.getRenderTarget(),e=t.shadowMap.autoUpdate,r.visible=!1,t.shadowMap.autoUpdate=!1,t.setRenderTarget(b),t.clear(),t.render(n,T),r.visible=!0,t.shadowMap.autoUpdate=e,t.setRenderTarget(i))}}function Hi(t,n){jt.call(this),this.type="Light",this.color=new I(t),this.intensity=void 0!==n?n:1,this.receiveShadow=void 0}function Xi(t,n){Hi.call(this,t,n),this.type="AmbientLight",this.castShadow=void 0}Oi.prototype=Object.create(Be.prototype),Hi.prototype=Object.assign(Object.create(jt.prototype),{constructor:Hi,isLight:!0,copy:function(t){return jt.prototype.copy.call(this,t),this.color.copy(t.color),this.intensity=t.intensity,this}}),Xi.prototype=Object.assign(Object.create(Hi.prototype),{constructor:Xi,isAmbientLight:!0});var Gi=new _t,zi=new B;function Bi(t,n,e,i,r,a){this.planes=[void 0!==t?t:new fe,void 0!==n?n:new fe,void 0!==e?e:new fe,void 0!==i?i:new fe,void 0!==r?r:new fe,void 0!==a?a:new fe]}function ki(t){this.camera=t,this.bias=0,this.radius=1,this.mapSize=new at(512,512),this.map=null,this.mapPass=null,this.matrix=new Lt,this.st=new Bi,this.ht=new at(1,1),this.lt=1,this.ct=[new rt(0,0,1,1)]}function Vi(){ki.call(this,new se(-5,5,5,-5,.5,500))}function Yi(t,n){Hi.call(this,t,n),this.type="DirectionalLight",this.position.copy(jt.DefaultUp),this.updateMatrix(),this.target=new jt,this.shadow=new Vi}function ji(){this.type="Curve",this.arcLengthDivisions=200}function Qi(t,n,e,i,r,a,o,s){ji.call(this),this.type="EllipseCurve",this.aX=t||0,this.aY=n||0,this.xRadius=e||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}function Wi(t,n,e,i,r,a){Qi.call(this,t,n,e,e,i,r,a),this.type="ArcCurve"}function Zi(){var r=0,a=0,o=0,s=0;function h(t,n,e,i){o=-3*(r=t)+3*n-2*(a=e)-i,s=2*t-2*n+e+i}return{initCatmullRom:function(t,n,e,i,r){h(n,e,r*(e-t),r*(i-n))},initNonuniformCatmullRom:function(t,n,e,i,r,a,o){r=(n-t)/r-(e-t)/(r+a)+(e-n)/a,o=(e-n)/a-(i-n)/(a+o)+(i-e)/o;h(n,e,r*=a,o*=a)},calc:function(t){var n=t*t;return r+a*t+o*n+s*(n*t)}}}Object.assign(Bi.prototype,{set:function(t,n,e,i,r,a){var o=this.planes;return o[0].copy(t),o[1].copy(n),o[2].copy(e),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var n=this.planes,e=0;e<6;e++)n[e].copy(t.planes[e]);return this},setFromProjectionMatrix:function(t){var n=this.planes,e=t.elements,i=e[0],r=e[1],a=e[2],o=e[3],s=e[4],h=e[5],l=e[6],c=e[7],u=e[8],f=e[9],d=e[10],v=e[11],m=e[12],p=e[13],t=e[14],e=e[15];return n[0].setComponents(o-i,c-s,v-u,e-m).normalize(),n[1].setComponents(o+i,c+s,v+u,e+m).normalize(),n[2].setComponents(o+r,c+h,v+f,e+p).normalize(),n[3].setComponents(o-r,c-h,v-f,e-p).normalize(),n[4].setComponents(o-a,c-l,v-d,e-t).normalize(),n[5].setComponents(o+a,c+l,v+d,e+t).normalize(),this},intersectsObject:function(t){var n=t.geometry;return null===n.boundingSphere&&n.computeBoundingSphere(),Gi.copy(n.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Gi)},intersectsSprite:function(t){return Gi.center.set(0,0,0),Gi.radius=.7071067811865476,Gi.applyMatrix4(t.matrixWorld),this.intersectsSphere(Gi)},intersectsSphere:function(t){for(var n=this.planes,e=t.center,i=-t.radius,r=0;r<6;r++)if(n[r].distanceToPoint(e)<i)return!1;return!0},intersectsBox:function(t){for(var n=this.planes,e=0;e<6;e++){var i=n[e];if(zi.x=(0<i.normal.x?t.max:t.min).x,zi.y=(0<i.normal.y?t.max:t.min).y,zi.z=(0<i.normal.z?t.max:t.min).z,i.distanceToPoint(zi)<0)return!1}return!0},containsPoint:function(t){for(var n=this.planes,e=0;e<6;e++)if(n[e].distanceToPoint(t)<0)return!1;return!0}}),Object.assign(ki.prototype,{ut:new Lt,ft:new B,dt:new B,getViewportCount:function(){return this.lt},getFrustum:function(){return this.st},updateMatrices:function(t){var n=this.camera,e=this.matrix,i=this.ut,r=this.dt,a=this.ft;a.setFromMatrixPosition(t.matrixWorld),n.position.copy(a),r.setFromMatrixPosition(t.target.matrixWorld),n.lookAt(r),n.updateMatrixWorld(),i.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this.st.setFromProjectionMatrix(i),e.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),e.multiply(n.projectionMatrix),e.multiply(n.matrixWorldInverse)},getViewport:function(t){return this.ct[t]},getFrameExtents:function(){return this.ht},copy:function(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this},clone:function(){return(new this.constructor).copy(this)}}),Vi.prototype=Object.assign(Object.create(ki.prototype),{constructor:Vi,isDirectionalLightShadow:!0,updateMatrices:function(t){ki.prototype.updateMatrices.call(this,t)}}),Yi.prototype=Object.assign(Object.create(Hi.prototype),{constructor:Yi,isDirectionalLight:!0,copy:function(t){return Hi.prototype.copy.call(this,t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}),Object.assign(ji.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,n){t=this.getUtoTmapping(t);return this.getPoint(t,n)},getPoints:function(t){void 0===t&&(t=5);for(var n=[],e=0;e<=t;e++)n.push(this.getPoint(e/t));return n},getSpacedPoints:function(t){void 0===t&&(t=5);for(var n=[],e=0;e<=t;e++)n.push(this.getPointAt(e/t));return n},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var n,e,i=[],r=this.getPoint(0),a=0;for(i.push(0),e=1;e<=t;e++)a+=(n=this.getPoint(e/t)).distanceTo(r),i.push(a),r=n;return this.cacheArcLengths=i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,n){for(var e,i=this.getLengths(),r=0,a=i.length,o=n||t*i[a-1],s=0,h=a-1;s<=h;)if((e=i[r=Math.floor(s+(h-s)/2)]-o)<0)s=r+1;else{if(!(0<e)){h=r;break}h=r-1}if(i[r=h]===o)return r/(a-1);t=i[r];return(r+(o-t)/(i[r+1]-t))/(a-1)},getTangent:function(t){var n=t-1e-4,t=t+1e-4;1<t&&(t=1);n=this.getPoint(n=n<0?0:n);return this.getPoint(t).clone().sub(n).normalize()},getTangentAt:function(t){t=this.getUtoTmapping(t);return this.getTangent(t)},computeFrenetFrames:function(t,n){for(var e,i=new B,r=[],a=[],o=[],s=new B,h=new Lt,l=0;l<=t;l++)r[l]=this.getTangentAt(l/t),r[l].normalize();a[0]=new B,o[0]=new B;var c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),d=Math.abs(r[0].z);for(u<=c&&(c=u,i.set(1,0,0)),f<=c&&(c=f,i.set(0,1,0)),d<=c&&i.set(0,0,1),s.crossVectors(r[0],i).normalize(),a[0].crossVectors(r[0],s),o[0].crossVectors(r[0],a[0]),l=1;l<=t;l++)a[l]=a[l-1].clone(),o[l]=o[l-1].clone(),s.crossVectors(r[l-1],r[l]),s.length()>Number.EPSILON&&(s.normalize(),e=Math.acos(E.clamp(r[l-1].dot(r[l]),-1,1)),a[l].applyMatrix4(h.makeRotationAxis(s,e))),o[l].crossVectors(r[l],a[l]);if(!0===n)for(e=Math.acos(E.clamp(a[0].dot(a[t]),-1,1)),e/=t,0<r[0].dot(s.crossVectors(a[0],a[t]))&&(e=-e),l=1;l<=t;l++)a[l].applyMatrix4(h.makeRotationAxis(r[l],e*l)),o[l].crossVectors(r[l],a[l]);return{tangents:r,normals:a,binormals:o}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}),((Qi.prototype=Object.create(ji.prototype)).constructor=Qi).prototype.isEllipseCurve=!0,Qi.prototype.getPoint=function(t,n){for(var e=n||new at,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;i<r;)r-=i;r<Number.EPSILON&&(r=a?0:i),!0!==this.aClockwise||a||(r===i?r=-i:r-=i);var o=this.aStartAngle+t*r,s=this.aX+this.xRadius*Math.cos(o),h=this.aY+this.yRadius*Math.sin(o);return 0!==this.aRotation&&(n=Math.cos(this.aRotation),a=Math.sin(this.aRotation),s=(t=s-this.aX)*n-(o=h-this.aY)*a+this.aX,h=t*a+o*n+this.aY),e.set(s,h)},Qi.prototype.copy=function(t){return ji.prototype.copy.call(this,t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this},((Wi.prototype=Object.create(Qi.prototype)).constructor=Wi).prototype.isArcCurve=!0;var qi=new B,Ki=new Zi,Ji=new Zi,$i=new Zi;function tr(t,n,e,i){ji.call(this),this.type="CatmullRomCurve3",this.points=t||[],this.closed=n||!1,this.curveType=e||"centripetal",this.tension=i||.5}function nr(t,n,e,i,r){var a=.5*(i-n),n=.5*(r-e),r=t*t;return(2*e-2*i+a+n)*(t*r)+(-3*e+3*i-2*a-n)*r+a*t+e}function er(t,n,e,i){return(r=1-(r=t))*r*n+2*(1-(n=t))*n*e+(t=t)*t*i;var r}function ir(t,n,e,i,r){return(a=1-(a=t))*a*a*n+3*(n=1-(a=t))*n*a*e+3*(1-(e=t))*e*e*i+(t=t)*t*t*r;var a}function rr(t,n,e,i){ji.call(this),this.type="CubicBezierCurve",this.v0=t||new at,this.v1=n||new at,this.v2=e||new at,this.v3=i||new at}function ar(t,n,e,i){ji.call(this),this.type="CubicBezierCurve3",this.v0=t||new B,this.v1=n||new B,this.v2=e||new B,this.v3=i||new B}function or(t,n){ji.call(this),this.type="LineCurve",this.v1=t||new at,this.v2=n||new at}function sr(t,n){ji.call(this),this.type="LineCurve3",this.v1=t||new B,this.v2=n||new B}function hr(t,n,e){ji.call(this),this.type="QuadraticBezierCurve",this.v0=t||new at,this.v1=n||new at,this.v2=e||new at}function lr(t){ji.call(this),this.type="SplineCurve",this.points=t||[]}function cr(){ji.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}function ur(t){cr.call(this),this.type="Path",this.currentPoint=new at,t&&this.setFromPoints(t)}function fr(t){ur.call(this,t),this.uuid=E.generateUUID(),this.type="Shape",this.holes=[]}((tr.prototype=Object.create(ji.prototype)).constructor=tr).prototype.isCatmullRomCurve3=!0,tr.prototype.getPoint=function(t,n){var e,i=n||new B,r=this.points,a=r.length,o=(a-(this.closed?0:1))*t,s=Math.floor(o),h=o-s;return this.closed?s+=0<s?0:(Math.floor(Math.abs(s)/a)+1)*a:0===h&&s===a-1&&(s=a-2,h=1),e=this.closed||0<s?r[(s-1)%a]:(qi.subVectors(r[0],r[1]).add(r[0]),qi),n=r[s%a],t=r[(s+1)%a],o=this.closed||s+2<a?r[(s+2)%a]:(qi.subVectors(r[a-1],r[a-2]).add(r[a-1]),qi),"centripetal"===this.curveType||"chordal"===this.curveType?(s="chordal"===this.curveType?.5:.25,r=Math.pow(e.distanceToSquared(n),s),a=Math.pow(n.distanceToSquared(t),s),s=Math.pow(t.distanceToSquared(o),s),a<1e-4&&(a=1),Ki.initNonuniformCatmullRom(e.x,n.x,t.x,o.x,r=r<1e-4?a:r,a,s=s<1e-4?a:s),Ji.initNonuniformCatmullRom(e.y,n.y,t.y,o.y,r,a,s),$i.initNonuniformCatmullRom(e.z,n.z,t.z,o.z,r,a,s)):"catmullrom"===this.curveType&&(Ki.initCatmullRom(e.x,n.x,t.x,o.x,this.tension),Ji.initCatmullRom(e.y,n.y,t.y,o.y,this.tension),$i.initCatmullRom(e.z,n.z,t.z,o.z,this.tension)),i.set(Ki.calc(h),Ji.calc(h),$i.calc(h)),i},tr.prototype.copy=function(t){ji.prototype.copy.call(this,t),this.points=[];for(var n=0,e=t.points.length;n<e;n++){var i=t.points[n];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this},((rr.prototype=Object.create(ji.prototype)).constructor=rr).prototype.isCubicBezierCurve=!0,rr.prototype.getPoint=function(t,n){var e=n||new at,i=this.v0,r=this.v1,a=this.v2,n=this.v3;return e.set(ir(t,i.x,r.x,a.x,n.x),ir(t,i.y,r.y,a.y,n.y)),e},rr.prototype.copy=function(t){return ji.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},((ar.prototype=Object.create(ji.prototype)).constructor=ar).prototype.isCubicBezierCurve3=!0,ar.prototype.getPoint=function(t,n){var e=n||new B,i=this.v0,r=this.v1,a=this.v2,n=this.v3;return e.set(ir(t,i.x,r.x,a.x,n.x),ir(t,i.y,r.y,a.y,n.y),ir(t,i.z,r.z,a.z,n.z)),e},ar.prototype.copy=function(t){return ji.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this},((or.prototype=Object.create(ji.prototype)).constructor=or).prototype.isLineCurve=!0,or.prototype.getPoint=function(t,n){n=n||new at;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},or.prototype.getPointAt=function(t,n){return this.getPoint(t,n)},or.prototype.getTangent=function(){return this.v2.clone().sub(this.v1).normalize()},or.prototype.copy=function(t){return ji.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},((sr.prototype=Object.create(ji.prototype)).constructor=sr).prototype.isLineCurve3=!0,sr.prototype.getPoint=function(t,n){n=n||new B;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n},sr.prototype.getPointAt=function(t,n){return this.getPoint(t,n)},sr.prototype.copy=function(t){return ji.prototype.copy.call(this,t),this.v1.copy(t.v1),this.v2.copy(t.v2),this},((hr.prototype=Object.create(ji.prototype)).constructor=hr).prototype.isQuadraticBezierCurve=!0,hr.prototype.getPoint=function(t,n){var e=n||new at,i=this.v0,r=this.v1,n=this.v2;return e.set(er(t,i.x,r.x,n.x),er(t,i.y,r.y,n.y)),e},hr.prototype.copy=function(t){return ji.prototype.copy.call(this,t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this},((lr.prototype=Object.create(ji.prototype)).constructor=lr).prototype.isSplineCurve=!0,lr.prototype.getPoint=function(t,n){var e=n||new at,i=this.points,r=(i.length-1)*t,a=Math.floor(r),o=r-a,n=i[0===a?a:a-1],t=i[a],r=i[a>i.length-2?i.length-1:a+1],a=i[a>i.length-3?i.length-1:a+2];return e.set(nr(o,n.x,t.x,r.x,a.x),nr(o,n.y,t.y,r.y,a.y)),e},lr.prototype.copy=function(t){ji.prototype.copy.call(this,t),this.points=[];for(var n=0,e=t.points.length;n<e;n++){var i=t.points[n];this.points.push(i.clone())}return this},cr.prototype=Object.assign(Object.create(ji.prototype),{constructor:cr,add:function(t){this.curves.push(t)},closePath:function(){var t=this.curves[0].getPoint(0),n=this.curves[this.curves.length-1].getPoint(1);t.equals(n)||this.curves.push(new or(n,t))},getPoint:function(t){for(var n=t*this.getLength(),e=this.getCurveLengths(),i=0;i<e.length;){if(e[i]>=n){var r=e[i]-n,a=this.curves[i],o=a.getLength();return a.getPointAt(0===o?0:1-r/o)}i++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],n=0,e=0,i=this.curves.length;e<i;e++)n+=this.curves[e].getLength(),t.push(n);return this.cacheLengths=t},getSpacedPoints:function(t){void 0===t&&(t=40);for(var n=[],e=0;e<=t;e++)n.push(this.getPoint(e/t));return this.autoClose&&n.push(n[0]),n},getPoints:function(t){t=t||12;for(var n,e=[],i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?2*t:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?t*a.points.length:t,s=a.getPoints(o),h=0;h<s.length;h++){var l=s[h];n&&n.equals(l)||(e.push(l),n=l)}return this.autoClose&&1<e.length&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e},copy:function(t){ji.prototype.copy.call(this,t),this.curves=[];for(var n=0,e=t.curves.length;n<e;n++){var i=t.curves[n];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}}),ur.prototype=Object.assign(Object.create(cr.prototype),{constructor:ur,setFromPoints:function(t){this.moveTo(t[0].x,t[0].y);for(var n=1,e=t.length;n<e;n++)this.lineTo(t[n].x,t[n].y);return this},moveTo:function(t,n){return this.currentPoint.set(t,n),this},lineTo:function(t,n){var e=new or(this.currentPoint.clone(),new at(t,n));return this.curves.push(e),this.currentPoint.set(t,n),this},quadraticCurveTo:function(t,n,e,i){n=new hr(this.currentPoint.clone(),new at(t,n),new at(e,i));return this.curves.push(n),this.currentPoint.set(e,i),this},bezierCurveTo:function(t,n,e,i,r,a){i=new rr(this.currentPoint.clone(),new at(t,n),new at(e,i),new at(r,a));return this.curves.push(i),this.currentPoint.set(r,a),this},splineThru:function(t){var n=new lr([this.currentPoint.clone()].concat(t));return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this},arc:function(t,n,e,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(t+o,n+s,e,i,r,a),this},absarc:function(t,n,e,i,r,a){return this.absellipse(t,n,e,e,i,r,a),this},ellipse:function(t,n,e,i,r,a,o,s){var h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,n+l,e,i,r,a,o,s),this},absellipse:function(t,n,e,i,r,a,o,s){o=new Qi(t,n,e,i,r,a,o,s);0<this.curves.length&&((s=o.getPoint(0)).equals(this.currentPoint)||this.lineTo(s.x,s.y)),this.curves.push(o);o=o.getPoint(1);return this.currentPoint.copy(o),this},copy:function(t){return cr.prototype.copy.call(this,t),this.currentPoint.copy(t.currentPoint),this}}),fr.prototype=Object.assign(Object.create(ur.prototype),{constructor:fr,getPointsHoles:function(t){for(var n=[],e=0,i=this.holes.length;e<i;e++)n[e]=this.holes[e].getPoints(t);return n},extractPoints:function(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}},copy:function(t){ur.prototype.copy.call(this,t),this.holes=[];for(var n=0,e=t.holes.length;n<e;n++){var i=t.holes[n];this.holes.push(i.clone())}return this}});var dr=function(t,n,e){e=e||2;var i,r,a,o,s,h=n&&n.length,l=h?n[0]*e:t.length,c=vr(t,0,l,e,!0),u=[];if(!c||c.next===c.prev)return u;if(h&&(c=function(t,n,e,i){var r,a,o,s,h=[];for(r=0,a=n.length;r<a;r++)o=n[r]*i,s=r<a-1?n[r+1]*i:t.length,(s=vr(t,o,s,i,!1))===s.next&&(s.steiner=!0),h.push(function(t){var n=t,e=t;for(;(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next,n!==t;);return e}(s));for(h.sort(gr),r=0;r<h.length;r++)!function(t,n){(n=function(t,n){var e,i=n,r=t.x,a=t.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&o<s){if((o=s)===r){if(a===i.y)return i;if(a===i.next.y)return i.next}e=i.x<i.next.x?i:i.next}}}while(i=i.next,i!==n);if(!e)return null;if(r===o)return e.prev;var h,l=e,c=e.x,u=e.y,f=1/0;i=e.next;for(;i!==l;)r>=i.x&&i.x>=c&&r!==i.x&&xr(a<u?r:o,a,c,u,a<u?o:r,a,i.x,i.y)&&((h=Math.abs(a-i.y)/(r-i.x))<f||h===f&&i.x>e.x)&&yr(i,t)&&(e=i,f=h),i=i.next;return e}(t,n))&&mr(t=Mr(n,t),t.next)}(h[r],e),e=mr(e,e.next);return e}(t,n,c,e)),t.length>80*e){for(var f=i=t[0],d=r=t[1],v=e;v<l;v+=e)(a=t[v])<f&&(f=a),(o=t[v+1])<d&&(d=o),i<a&&(i=a),r<o&&(r=o);s=0!==(s=Math.max(i-f,r-d))?1/s:0}return pr(c,u,e,f,d,s),u};function vr(t,n,e,i,r){var a,o;if(r===0<function(t,n,e,i){for(var r=0,a=n,o=e-i;a<e;a+=i)r+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return r}(t,n,e,i))for(a=n;a<e;a+=i)o=Tr(a,t[a],t[a+1],o);else for(a=e-i;n<=a;a-=i)o=Tr(a,t[a],t[a+1],o);return o&&wr(o,o.next)&&(br(o),o=o.next),o}function mr(t,n){if(!t)return t;n=n||t;var e,i=t;do{if(e=!1,i.steiner||!wr(i,i.next)&&0!==Ar(i.prev,i,i.next))i=i.next;else{if(br(i),(i=n=i.prev)===i.next)break;e=!0}}while(e||i!==n);return n}function pr(t,n,e,i,r,a,o){if(t){!o&&a&&function(t,n,e,i){var r=t;for(;null===r.z&&(r.z=_r(r.x,r.y,n,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next,r!==t;);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,e,i,r,a,o,s,h,l=1;do{for(e=t,a=t=null,o=0;e;){for(o++,i=e,n=s=0;n<l&&(s++,i=i.nextZ);n++);for(h=l;0<s||0<h&&i;)0!==s&&(0===h||!i||e.z<=i.z)?(e=(r=e).nextZ,s--):(i=(r=i).nextZ,h--),a?a.nextZ=r:t=r,r.prevZ=a,a=r;e=i}}while(a.nextZ=null,l*=2,1<o)}(r)}(t,i,r,a);for(var s,h,l=t;t.prev!==t.next;)if(s=t.prev,h=t.next,a?function(t,n,e,i){var r=t.prev,a=t,o=t.next;if(0<=Ar(r,a,o))return!1;var s=(r.x<a.x?r.x<o.x?r:o:a.x<o.x?a:o).x,h=(r.y<a.y?r.y<o.y?r:o:a.y<o.y?a:o).y,l=(r.x>a.x?r.x>o.x?r:o:a.x>o.x?a:o).x,c=(r.y>a.y?r.y>o.y?r:o:a.y>o.y?a:o).y,u=_r(s,h,n,e,i),f=_r(l,c,n,e,i),d=t.prevZ,v=t.nextZ;for(;d&&d.z>=u&&v&&v.z<=f;){if(d!==t.prev&&d!==t.next&&xr(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=Ar(d.prev,d,d.next))return!1;if(d=d.prevZ,v!==t.prev&&v!==t.next&&xr(r.x,r.y,a.x,a.y,o.x,o.y,v.x,v.y)&&0<=Ar(v.prev,v,v.next))return!1;v=v.nextZ}for(;d&&d.z>=u;){if(d!==t.prev&&d!==t.next&&xr(r.x,r.y,a.x,a.y,o.x,o.y,d.x,d.y)&&0<=Ar(d.prev,d,d.next))return!1;d=d.prevZ}for(;v&&v.z<=f;){if(v!==t.prev&&v!==t.next&&xr(r.x,r.y,a.x,a.y,o.x,o.y,v.x,v.y)&&0<=Ar(v.prev,v,v.next))return!1;v=v.nextZ}return!0}(t,i,r,a):function(t){var n=t.prev,e=t,i=t.next;if(0<=Ar(n,e,i))return!1;var r=t.next.next;for(;r!==t.prev;){if(xr(n.x,n.y,e.x,e.y,i.x,i.y,r.x,r.y)&&0<=Ar(r.prev,r,r.next))return!1;r=r.next}return!0}(t))n.push(s.i/e),n.push(t.i/e),n.push(h.i/e),br(t),t=h.next,l=h.next;else if((t=h)===l){o?1===o?pr(t=function(t,n,e){var i=t;do{var r=i.prev,a=i.next.next}while(!wr(r,a)&&Sr(r,i,i.next,a)&&yr(r,a)&&yr(a,r)&&(n.push(r.i/e),n.push(i.i/e),n.push(a.i/e),br(i),br(i.next),i=t=a),i=i.next,i!==t);return i}(t,n,e),n,e,i,r,a,2):2===o&&function(t,n,e,i,r,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&function(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&Sr(e,e.next,t,n))return!0}while(e=e.next,e!==t);return!1}(t,n)&&yr(t,n)&&yr(n,t)&&function(t,n){var e=t,i=!1,r=(t.x+n.x)/2,a=(t.y+n.y)/2;for(;e.y>a!=e.next.y>a&&e.next.y!==e.y&&r<(e.next.x-e.x)*(a-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next,e!==t;);return i}(t,n)}(o,s)){var h=Mr(o,s);return o=mr(o,o.next),h=mr(h,h.next),pr(o,n,e,i,r,a),pr(h,n,e,i,r,a)}s=s.next}}while(o=o.next,o!==t)}(t,n,e,i,r,a):pr(mr(t),n,e,i,r,a,1);break}}}function gr(t,n){return t.x-n.x}function _r(t,n,e,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-e)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-i)*r)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function xr(t,n,e,i,r,a,o,s){return 0<=(r-o)*(n-s)-(t-o)*(a-s)&&0<=(t-o)*(i-s)-(e-o)*(n-s)&&0<=(e-o)*(a-s)-(r-o)*(i-s)}function Ar(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function wr(t,n){return t.x===n.x&&t.y===n.y}function Sr(t,n,e,i){return wr(t,e)&&wr(n,i)||wr(t,i)&&wr(e,n)||0<Ar(t,n,e)!=0<Ar(t,n,i)&&0<Ar(e,i,t)!=0<Ar(e,i,n)}function yr(t,n){return Ar(t.prev,t,t.next)<0?0<=Ar(t,n,t.next)&&0<=Ar(t,t.prev,n):Ar(t,n,t.prev)<0||Ar(t,t.next,n)<0}function Mr(t,n){var e=new Lr(t.i,t.x,t.y),i=new Lr(n.i,n.x,n.y),r=t.next,a=n.prev;return(t.next=n).prev=t,(e.next=r).prev=e,(i.next=e).prev=i,(a.next=i).prev=a,i}function Tr(t,n,e,i){e=new Lr(t,n,e);return i?(e.next=i.next,(e.prev=i).next.prev=e,i.next=e):(e.prev=e).next=e,e}function br(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Lr(t,n,e){this.i=t,this.x=n,this.y=e,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Pr={area:function(t){for(var n=t.length,e=0,i=n-1,r=0;r<n;i=r++)e+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*e},isClockWise:function(t){return Pr.area(t)<0},triangulateShape:function(t,n){var e=[],i=[],r=[];Er(t),Fr(e,t);var a=t.length;n.forEach(Er);for(var o=0;o<n.length;o++)i.push(a),a+=n[o].length,Fr(e,n[o]);for(var s=dr(e,i),o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function Er(t){var n=t.length;2<n&&t[n-1].equals(t[0])&&t.pop()}function Fr(t,n){for(var e=0;e<n.length;e++)t.push(n[e].x),t.push(n[e].y)}function Nr(t){return(Nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Dr(t,n){xi.call(this),this.type="ShapeGeometry","object"===Nr(n)&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),n=n.curveSegments),this.parameters={shapes:t,curveSegments:n},this.fromBufferGeometry(new Cr(t,n)),this.mergeVertices()}function Cr(t,f){tn.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:t,curveSegments:f},f=f||12;var d=[],v=[],m=[],p=[],n=0,g=0;if(!1===Array.isArray(t))i(t);else for(var e=0;e<t.length;e++)i(t[e]),this.addGroup(n,g,e),n+=g,g=0;function i(t){var n,e=v.length/3,t=t.extractPoints(f),i=t.shape,r=t.holes;for(!1===Pr.isClockWise(i)&&(i=i.reverse()),o=0,s=r.length;o<s;o++)n=r[o],!0===Pr.isClockWise(n)&&(r[o]=n.reverse());for(var a=Pr.triangulateShape(i,r),o=0,s=r.length;o<s;o++)n=r[o],i=i.concat(n);for(o=0,s=i.length;o<s;o++){var h=i[o];v.push(h.x,h.y,0),m.push(0,0,1),p.push(h.x,h.y)}for(o=0,s=a.length;o<s;o++){var l=a[o],c=l[0]+e,u=l[1]+e,l=l[2]+e;d.push(c,u,l),g+=3}}this.setIndex(d),this.setAttribute("position",new mt(v,3)),this.setAttribute("normal",new mt(m,3)),this.setAttribute("uv",new mt(p,2))}function Ir(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}(Dr.prototype=Object.create(xi.prototype)).constructor=Dr,(Cr.prototype=Object.create(tn.prototype)).constructor=Cr;var Rr=new Map,e=function(){function e(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.L=t,this.vt=null,this.mt=null,this.P=new ee,this.P.add(new Xi(7631988)),this.pt=n.color,this.gt=n.alpha,this.B="number"==typeof n.height?n.height:0,this._t=n.points,this.xt=null,this.N=n.url}var t,n,i;return t=e,(n=[{key:"getColor",value:function(){return this.pt}},{key:"setColor",value:function(t){this.pt=t,this.mt.material.uniforms.waterColor.value=new I(t)}},{key:"getAlpha",value:function(){return this.gt}},{key:"setAlpha",value:function(t){this.gt=t,this.mt.material.uniforms.alpha.value=t}},{key:"getHeight",value:function(){return this.B}},{key:"setHeight",value:function(t){this.B=t,this.mt.position=t}},{key:"addTo",value:function(t){if(this.vt=t,!Rr.has(t.level)){var n=new ee;n.position.y=t.height,n.userData.waters=[],function(t){var n=new Xi(7631988),e=new jt,i=new Yi(8947848,1.2);i.position.set(-1,1,1).normalize(),i.castShadow=!1,i.target=e;var r=new Yi(3355443);r.position.set(-.5,1,-1).normalize(),r.target=e,t.add(i),t.add(n),t.add(r),t.add(e)}(n);for(var e=0;e<t.getLayers().length;e++)t.getLayers()[e].getScene().position.y=0,t.getLayers()[e].removeLight&&t.getLayers()[e].removeLight(),n.add(t.getLayers()[e].getScene());Rr.set(t.level,n)}this.U(),this.R(Rr.get(t.level)),this.L.getRenderManager().water.set(Rr.get(t.level),Rr.get(t.level))}},{key:"remove",value:function(){this.L.getRenderManager().water.delete(this.P.uuid)}}])&&Ir(t.prototype,n),i&&Ir(t,i),e}();Object.assign(e.prototype,{At:function(){},U:function(){"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne)},R:function(t){var n=new fr,e=this.L.getBuilding();n.moveTo(this._t[0].x-e.x,this._t[0].y-e.y);for(var i=1;i<this._t.length;i++)n.lineTo(this._t[i].x-e.x,this._t[i].y-e.y);n.lineTo(this._t[0].x-e.x,-this._t[0].y+e.y);var r=new Cr(n),r=new Oi(r,{textureWidth:512,textureHeight:512,waterNormals:(new On).load(this.N,function(t){t.wrapS=t.wrapT=1e3}),alpha:this.gt,waterColor:this.pt,distortionScale:5.7});r.rotation.x=-Math.PI/2,r.position.y=this.B,r.renderOrder=-1,this.mt=r,t.add(r),t.userData.waters.push(r)}});re=e;function Ur(t,n,e,i){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,Ur),je.call(this),this.strength=void 0!==n?n:1,this.radius=e,this.threshold=i,this.resolution=void 0!==t?new at(t.x,t.y):new at(256,256),this.clearColor=new I(0,0,0);var r={minFilter:P,magFilter:P,format:g};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;var a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2);this.renderTargetBright=new Je(a,o,r),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(var s=0;s<this.nMips;s++){var h=new Je(a,o,r);h.texture.name="UnrealBloomPass.h"+s,h.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(h);h=new Je(a,o,r);h.texture.name="UnrealBloomPass.v"+s,h.texture.generateMipmaps=!1,this.renderTargetsVertical.push(h),a=Math.round(a/2),o=Math.round(o/2)}t=Ke,this.highPassUniforms=un.clone(t.uniforms),this.highPassUniforms.luminosityThreshold.value=i,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new vn({uniforms:this.highPassUniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,defines:{}}),this.separableBlurMaterials=[];for(var l=[3,5,7,9,11],a=Math.round(this.resolution.x/2),o=Math.round(this.resolution.y/2),s=0;s<this.nMips;s++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[s])),this.separableBlurMaterials[s].uniforms.texSize.value=new at(a,o),a=Math.round(a/2),o=Math.round(o/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=n,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0,this.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],this.bloomTintColors=[new B(1,1,1),new B(1,1,1),new B(1,1,1),new B(1,1,1),new B(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,n=qe,this.copyUniforms=un.clone(n.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new vn({uniforms:this.copyUniforms,vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,blending:2,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this.oldClearColor=new I,this.oldClearAlpha=1,this.basic=new Mn,this.basic.transparent=!0,this.fsQuad=new je.FullScreenQuad(null)}function Or(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}Ur.prototype=Object.assign(Object.create(je.prototype),{constructor:Ur,dispose:function(){for(var t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()},setSize:function(t,n){var e=Math.round(t/2),i=Math.round(n/2);this.renderTargetBright.setSize(e,i);for(var r=0;r<this.nMips;r++)this.renderTargetsHorizontal[r].setSize(e,i),this.renderTargetsVertical[r].setSize(e,i),this.separableBlurMaterials[r].uniforms.texSize.value=new at(e,i),e=Math.round(e/2),i=Math.round(i/2)},render:function(t,n,e,i,r){this.oldClearColor.copy(t.getClearColor()),this.oldClearAlpha=t.getClearAlpha();var a=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),r&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=e.texture,t.setRenderTarget(null),this.fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=e.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this.fsQuad.render(t);for(var o=this.renderTargetBright,s=0;s<this.nMips;s++)this.fsQuad.material=this.separableBlurMaterials[s],this.separableBlurMaterials[s].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[s].uniforms.direction.value=Ur.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[s]),t.clear(),this.fsQuad.render(t),this.separableBlurMaterials[s].uniforms.colorTexture.value=this.renderTargetsHorizontal[s].texture,this.separableBlurMaterials[s].uniforms.direction.value=Ur.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[s]),t.clear(),this.fsQuad.render(t),o=this.renderTargetsVertical[s];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this.fsQuad.render(t),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?t.setRenderTarget(null):t.setRenderTarget(e),this.fsQuad.render(t),t.setClearColor(this.oldClearColor,this.oldClearAlpha),t.autoClear=a},getSeperableBlurMaterial:function(t){return new vn({defines:{KERNEL_RADIUS:t,SIGMA:t},uniforms:{colorTexture:{value:null},texSize:{value:new at(.5,.5)},direction:{value:new at(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat fSigma = float(SIGMA);\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\t\t\t\t\t\tfloat x = float(i);\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\t\t\t\t\t\tweightSum += 2.0 * w;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})},getCompositeMaterial:function(t){return new vn({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\t\t\t\tuniform sampler2D blurTexture1;\t\t\t\tuniform sampler2D blurTexture2;\t\t\t\tuniform sampler2D blurTexture3;\t\t\t\tuniform sampler2D blurTexture4;\t\t\t\tuniform sampler2D blurTexture5;\t\t\t\tuniform sampler2D dirtTexture;\t\t\t\tuniform float bloomStrength;\t\t\t\tuniform float bloomRadius;\t\t\t\tuniform float bloomFactors[NUM_MIPS];\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\t\t\t\t\t\t\t\tfloat lerpBloomFactor(const in float factor) { \t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\t\t\t\t}\t\t\t\t\t\t\t\tvoid main() {\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + \t\t\t\t\t\t\t\t\t\t\t\t\t lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\t\t\t\t}"})}}),Ur.BlurDirectionX=new at(1,0),Ur.BlurDirectionY=new at(0,1);ci=function(){function e(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.L=t,this.wt=[],this.k=this.V(),this.R(n)}var t,n,i;return t=e,(n=[{key:"getThreshold",value:function(){return this.St.threshold}},{key:"setThreshold",value:function(t){this.St.threshold=t}},{key:"getStrength",value:function(){return this.St.strength}},{key:"setStrength",value:function(t){this.St.strength=t}},{key:"getRadius",value:function(){return this.St.radius}},{key:"setRadius",value:function(t){this.St.radius=t}},{key:"enable",value:function(){this.k.bloom=this}},{key:"disable",value:function(){this.k.bloom=null}},{key:"add",value:function(t){var n=t.parent.level,e=this.L.getVisibleLevels();(n?this.composers3D.get(n):this.composers3D.get(e[e.length-1])).bloomscene.children.push(t.getScene())}},{key:"remove",value:function(e){this.composers3D.forEach(function(t){for(var n=0;n<t.bloomscene.children.length;n++)if(t.bloomscene.children[n].uuid===e.getScene().uuid){t.bloomscene.children.splice(n,1);break}})}},{key:"clear",value:function(){this.composers3D.forEach(function(t){return t.bloomscene.children.length=0})}}])&&Or(t.prototype,n),i&&Or(t,i),e}();Object.assign(ci.prototype,{V:function(){return"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne),this.L.getRenderManager()},R:function(t){this.composers3D=new Map,this.St=new Ur(new at(this.L.getContainer().clientWidth,this.L.getContainer().clientHeight),1.5,.4,.85),this.St.threshold=t&&"number"==typeof t.threshold?t.threshold:.4,this.St.strength=t&&"number"==typeof t.strength?t.strength:.62,this.St.radius=t&&"number"==typeof t.radius?t.radius:.6,this.St.basic.depthWrite=!1;for(var n=0;n<this.L.getVisibleLevels().length;n++){var e={};e.composer=new si(this.k.renderer),e.bloomscene=new ee,e.renderScene=new ti(e.bloomscene,this.L.getCamera()),e.composer.addPass(e.renderScene),e.composer.addPass(this.St),this.composers3D.set(this.L.getVisibleLevels()[n],e)}}});di=ci;function Hr(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}Di=function(){function n(t){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),this.L=t,this.yt=[],this.Mt={x:0,y:0,maxR:0,radius:0,minR:0,widthR:0,length:0,distance:0,width:0,height:0,color_a:0,color_r:0,point:null,endPoint:null,startPoint:null,se2N:null,speed:1,se2RN:null},this.Tt=!1,this.bt=!1,this.k=this.V(),this.W=(new Date).getTime(),this.R()}var t,e,i;return t=n,(e=[{key:"enable",value:function(){this.k.sweep=this}},{key:"disable",value:function(){this.k.sweep=null}},{key:"annulus",value:function(t){this.Mt.x=t.x,this.Mt.y=t.y,this.Mt.maxR=t.maxRadius,this.Mt.minR=t.minRadius,this.Mt.radius=t.minRadius+t.width,this.Mt.widthR=t.width,this.Mt.duration_a=1e3*t.duration,this.Mt.color_a=new I(t.color),this.Tt=!0}},{key:"rect",value:function(t){this.Mt.endPoint=new at(t.endPoint.x-this.L.getX(),-t.endPoint.y+this.L.getY()),this.Mt.startPoint=new at(t.startPoint.x-this.L.getX(),-t.startPoint.y+this.L.getY()),this.Mt.point=this.Mt.startPoint.clone();var n=new at(t.endPoint.x-t.startPoint.x,-t.endPoint.y+t.startPoint.y);this.Mt.se2N=n.normalize(),this.Mt.se2RN=n.clone().rotateAround(new at(0,0),Math.PI/2).normalize(),this.Mt.duration_r=1e3*t.duration,this.Mt.width=t.width,this.Mt.height=t.height,this.Mt.distance=this.Mt.endPoint.distanceTo(this.Mt.startPoint),this.Mt.color_r=new I(t.color),this.bt=!0}},{key:"render",value:function(t){var n,e=this;this.Tt&&(this.Mt.radius<this.Mt.maxR?this.Mt.radius+=((new Date).getTime()-this.W)*this.Mt.maxR/this.Mt.duration_a:this.Mt.radius=this.Mt.minR),this.bt&&(n=((new Date).getTime()-this.W)*this.Mt.distance/this.Mt.duration_r,n=this.Mt.se2N.clone().multiplyScalar(n),this.Mt.length<=this.Mt.distance?(this.Mt.point.add(n),this.Mt.length+=n.length()):(this.Mt.point=this.Mt.startPoint.clone(),this.Mt.length=0)),t.traverse(function(t){"Mesh"===t.type&&"FMMeshStandardMaterial"===t.material.type&&(e.Tt&&(t.material.uniforms.isAnnulus.value||(t.material.uniforms.isAnnulus.value=!0,t.material.uniforms.circleC.value=new at(e.Mt.x-e.L.getX(),-e.Mt.y+e.L.getY()),t.material.uniforms.color_a.value=e.Mt.color_a),t.material.uniforms.maxR.value=e.Mt.radius+e.Mt.widthR,t.material.uniforms.minR.value=e.Mt.radius),e.bt&&(t.material.uniforms.isRect.value||(t.material.uniforms.isRect.value=!0,t.material.uniforms.sweepW.value=e.Mt.width,t.material.uniforms.sweepH.value=e.Mt.height,t.material.uniforms.se2N.value=e.Mt.se2N,t.material.uniforms.se2RN.value=e.Mt.se2RN,t.material.uniforms.color_r.value=e.Mt.color_r),t.material.uniforms.moveP.value=e.Mt.point))}),this.W=(new Date).getTime()}}])&&Hr(t.prototype,e),i&&Hr(t,i),n}();Object.assign(Di.prototype,{V:function(){return"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne),this.L.getRenderManager()},R:function(){for(var n=this,t=this.L.getBuilding().getFloors(),e=0;e<t.length;e++)for(var i=t[e].getLayers(),r=0;r<i.length;r++)i[r].type===fengmap.FMType.EXTERNAL_MODEL_LAYER&&i[r].getScene().traverse(function(t){t.isGltf&&"Mesh"===t.type&&n.yt.push(t)})}});var e=Di,Xr={uniforms:{tDiffuse:{value:null},resolution:{value:new at(1/1024,1/512)}},vertexShader:["varying vec2 vUv;","void main() {","vUv = uv;","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["precision highp float;","","uniform sampler2D tDiffuse;","","uniform vec2 resolution;","","varying vec2 vUv;","","// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)","","//----------------------------------------------------------------------------------","// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag","// SDK Version: v3.00","// Email: gameworks@nvidia.com","// Site: http://developer.nvidia.com/","//","// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.","//","// Redistribution and use in source and binary forms, with or without","// modification, are permitted provided that the following conditions","// are met:","// * Redistributions of source code must retain the above copyright","// notice, this list of conditions and the following disclaimer.","// * Redistributions in binary form must reproduce the above copyright","// notice, this list of conditions and the following disclaimer in the","// documentation and/or other materials provided with the distribution.","// * Neither the name of NVIDIA CORPORATION nor the names of its","// contributors may be used to endorse or promote products derived","// from this software without specific prior written permission.","//","// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY","// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE","// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR","// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR","// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,","// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,","// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR","// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY","// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT","// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE","// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.","//","//----------------------------------------------------------------------------------","","#define FXAA_PC 1","#define FXAA_GLSL_100 1","#define FXAA_QUALITY_PRESET 12","","#define FXAA_GREEN_AS_LUMA 1","","/*--------------------------------------------------------------------------*/","#ifndef FXAA_PC_CONSOLE"," //"," // The console algorithm for PC is included"," // for developers targeting really low spec machines."," // Likely better to just run FXAA_PC, and use a really low preset."," //"," #define FXAA_PC_CONSOLE 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_120"," #define FXAA_GLSL_120 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GLSL_130"," #define FXAA_GLSL_130 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_3"," #define FXAA_HLSL_3 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_4"," #define FXAA_HLSL_4 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_HLSL_5"," #define FXAA_HLSL_5 0","#endif","/*==========================================================================*/","#ifndef FXAA_GREEN_AS_LUMA"," //"," // For those using non-linear color,"," // and either not able to get luma in alpha, or not wanting to,"," // this enables FXAA to run using green as a proxy for luma."," // So with this enabled, no need to pack luma in alpha."," //"," // This will turn off AA on anything which lacks some amount of green."," // Pure red and blue or combination of only R and B, will get no AA."," //"," // Might want to lower the settings for both,"," // fxaaConsoleEdgeThresholdMin"," // fxaaQualityEdgeThresholdMin"," // In order to insure AA does not get turned off on colors"," // which contain a minor amount of green."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_GREEN_AS_LUMA 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_EARLY_EXIT"," //"," // Controls algorithm's early exit path."," // On PS3 turning this ON adds 2 cycles to the shader."," // On 360 turning this OFF adds 10ths of a millisecond to the shader."," // Turning this off on console will result in a more blurry image."," // So this defaults to on."," //"," // 1 = On."," // 0 = Off."," //"," #define FXAA_EARLY_EXIT 1","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_DISCARD"," //"," // Only valid for PC OpenGL currently."," // Probably will not work when FXAA_GREEN_AS_LUMA = 1."," //"," // 1 = Use discard on pixels which don't need AA."," // For APIs which enable concurrent TEX+ROP from same surface."," // 0 = Return unchanged color on pixels which don't need AA."," //"," #define FXAA_DISCARD 0","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_FAST_PIXEL_OFFSET"," //"," // Used for GLSL 120 only."," //"," // 1 = GL API supports fast pixel offsets"," // 0 = do not use fast pixel offsets"," //"," #ifdef GL_EXT_gpu_shader4"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_FAST_PIXEL_OFFSET 1"," #endif"," #ifndef FXAA_FAST_PIXEL_OFFSET"," #define FXAA_FAST_PIXEL_OFFSET 0"," #endif","#endif","/*--------------------------------------------------------------------------*/","#ifndef FXAA_GATHER4_ALPHA"," //"," // 1 = API supports gather4 on alpha channel."," // 0 = API does not support gather4 on alpha channel."," //"," #if (FXAA_HLSL_5 == 1)"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_ARB_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifdef GL_NV_gpu_shader5"," #define FXAA_GATHER4_ALPHA 1"," #endif"," #ifndef FXAA_GATHER4_ALPHA"," #define FXAA_GATHER4_ALPHA 0"," #endif","#endif","","","/*============================================================================"," FXAA QUALITY - TUNING KNOBS","------------------------------------------------------------------------------","NOTE the other tuning knobs are now in the shader function inputs!","============================================================================*/","#ifndef FXAA_QUALITY_PRESET"," //"," // Choose the quality preset."," // This needs to be compiled into the shader as it effects code."," // Best option to include multiple presets is to"," // in each shader define the preset, then include this file."," //"," // OPTIONS"," // -----------------------------------------------------------------------"," // 10 to 15 - default medium dither (10=fastest, 15=highest quality)"," // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)"," // 39 - no dither, very expensive"," //"," // NOTES"," // -----------------------------------------------------------------------"," // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)"," // 13 = about same speed as FXAA 3.9 and better than 12"," // 23 = closest to FXAA 3.9 visually and performance wise"," // _ = the lowest digit is directly related to performance"," // _ = the highest digit is directly related to style"," //"," #define FXAA_QUALITY_PRESET 12","#endif","","","/*============================================================================",""," FXAA QUALITY - PRESETS","","============================================================================*/","","/*============================================================================"," FXAA QUALITY - MEDIUM DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 10)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 3.0"," #define FXAA_QUALITY_P2 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 11)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 3.0"," #define FXAA_QUALITY_P3 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 12)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 4.0"," #define FXAA_QUALITY_P4 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 13)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 4.0"," #define FXAA_QUALITY_P5 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 14)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 4.0"," #define FXAA_QUALITY_P6 12.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 15)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 12.0","#endif","","/*============================================================================"," FXAA QUALITY - LOW DITHER PRESETS","============================================================================*/","#if (FXAA_QUALITY_PRESET == 20)"," #define FXAA_QUALITY_PS 3"," #define FXAA_QUALITY_P0 1.5"," #define FXAA_QUALITY_P1 2.0"," #define FXAA_QUALITY_P2 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 21)"," #define FXAA_QUALITY_PS 4"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 22)"," #define FXAA_QUALITY_PS 5"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 23)"," #define FXAA_QUALITY_PS 6"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 24)"," #define FXAA_QUALITY_PS 7"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 3.0"," #define FXAA_QUALITY_P6 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 25)"," #define FXAA_QUALITY_PS 8"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 4.0"," #define FXAA_QUALITY_P7 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 26)"," #define FXAA_QUALITY_PS 9"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 4.0"," #define FXAA_QUALITY_P8 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 27)"," #define FXAA_QUALITY_PS 10"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 4.0"," #define FXAA_QUALITY_P9 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 28)"," #define FXAA_QUALITY_PS 11"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 4.0"," #define FXAA_QUALITY_P10 8.0","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_QUALITY_PRESET == 29)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.5"," #define FXAA_QUALITY_P2 2.0"," #define FXAA_QUALITY_P3 2.0"," #define FXAA_QUALITY_P4 2.0"," #define FXAA_QUALITY_P5 2.0"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","/*============================================================================"," FXAA QUALITY - EXTREME QUALITY","============================================================================*/","#if (FXAA_QUALITY_PRESET == 39)"," #define FXAA_QUALITY_PS 12"," #define FXAA_QUALITY_P0 1.0"," #define FXAA_QUALITY_P1 1.0"," #define FXAA_QUALITY_P2 1.0"," #define FXAA_QUALITY_P3 1.0"," #define FXAA_QUALITY_P4 1.0"," #define FXAA_QUALITY_P5 1.5"," #define FXAA_QUALITY_P6 2.0"," #define FXAA_QUALITY_P7 2.0"," #define FXAA_QUALITY_P8 2.0"," #define FXAA_QUALITY_P9 2.0"," #define FXAA_QUALITY_P10 4.0"," #define FXAA_QUALITY_P11 8.0","#endif","","","","/*============================================================================",""," API PORTING","","============================================================================*/","#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)"," #define FxaaBool bool"," #define FxaaDiscard discard"," #define FxaaFloat float"," #define FxaaFloat2 vec2"," #define FxaaFloat3 vec3"," #define FxaaFloat4 vec4"," #define FxaaHalf float"," #define FxaaHalf2 vec2"," #define FxaaHalf3 vec3"," #define FxaaHalf4 vec4"," #define FxaaInt2 ivec2"," #define FxaaSat(x) clamp(x, 0.0, 1.0)"," #define FxaaTex sampler2D","#else"," #define FxaaBool bool"," #define FxaaDiscard clip(-1)"," #define FxaaFloat float"," #define FxaaFloat2 float2"," #define FxaaFloat3 float3"," #define FxaaFloat4 float4"," #define FxaaHalf half"," #define FxaaHalf2 half2"," #define FxaaHalf3 half3"," #define FxaaHalf4 half4"," #define FxaaSat(x) saturate(x)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_100 == 1)"," #define FxaaTexTop(t, p) texture2D(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_120 == 1)"," // Requires,"," // #version 120"," // And at least,"," // #extension GL_EXT_gpu_shader4 : enable"," // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)"," #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)"," #if (FXAA_FAST_PIXEL_OFFSET == 1)"," #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)"," #else"," #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)"," #endif"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_GLSL_130 == 1)",' // Requires "#version 130" or better'," #define FxaaTexTop(t, p) textureLod(t, p, 0.0)"," #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)"," #if (FXAA_GATHER4_ALPHA == 1)"," // use #extension GL_ARB_gpu_shader5 : enable"," #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)"," #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)"," #define FxaaTexGreen4(t, p) textureGather(t, p, 1)"," #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)"," #endif","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_3 == 1)"," #define FxaaInt2 float2"," #define FxaaTex sampler2D"," #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))"," #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_4 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)","#endif","/*--------------------------------------------------------------------------*/","#if (FXAA_HLSL_5 == 1)"," #define FxaaInt2 int2"," struct FxaaTex { SamplerState smpl; Texture2D tex; };"," #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)"," #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)"," #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)"," #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)"," #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)"," #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)","#endif","","","/*============================================================================"," GREEN AS LUMA OPTION SUPPORT FUNCTION","============================================================================*/","#if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }","#else"," FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }","#endif","","","","","/*============================================================================",""," FXAA3 QUALITY - PC","","============================================================================*/","#if (FXAA_PC == 1)","/*--------------------------------------------------------------------------*/","FxaaFloat4 FxaaPixelShader("," //"," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy} = center of pixel"," FxaaFloat2 pos,"," //"," // Used only for FXAA Console, and not used on the 360 version."," // Use noperspective interpolation here (turn off perspective interpolation)."," // {xy_} = upper left of pixel"," // {_zw} = lower right of pixel"," FxaaFloat4 fxaaConsolePosPos,"," //"," // Input color texture."," // {rgb_} = color in linear or perceptual color space"," // if (FXAA_GREEN_AS_LUMA == 0)"," // {__a} = luma in perceptual color space (not linear)"," FxaaTex tex,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 2nd sampler."," // This sampler needs to have an exponent bias of -1."," FxaaTex fxaaConsole360TexExpBiasNegOne,"," //"," // Only used on the optimized 360 version of FXAA Console.",' // For everything but 360, just use the same input here as for "tex".'," // For 360, same texture, just alias with a 3nd sampler."," // This sampler needs to have an exponent bias of -2."," FxaaTex fxaaConsole360TexExpBiasNegTwo,"," //"," // Only used on FXAA Quality."," // This must be from a constant/uniform."," // {x_} = 1.0/screenWidthInPixels"," // {_y} = 1.0/screenHeightInPixels"," FxaaFloat2 fxaaQualityRcpFrame,"," //"," // Only used on FXAA Console."," // This must be from a constant/uniform."," // This effects sub-pixel AA quality and inversely sharpness."," // Where N ranges between,"," // N = 0.50 (default)"," // N = 0.33 (sharper)"," // {x__} = -N/screenWidthInPixels"," // {_y_} = -N/screenHeightInPixels"," // {_z_} = N/screenWidthInPixels"," // {__w} = N/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt,"," //"," // Only used on FXAA Console."," // Not used on 360, but used on PS3 and PC."," // This must be from a constant/uniform."," // {x__} = -2.0/screenWidthInPixels"," // {_y_} = -2.0/screenHeightInPixels"," // {_z_} = 2.0/screenWidthInPixels"," // {__w} = 2.0/screenHeightInPixels"," FxaaFloat4 fxaaConsoleRcpFrameOpt2,"," //"," // Only used on FXAA Console."," // Only used on 360 in place of fxaaConsoleRcpFrameOpt2."," // This must be from a constant/uniform."," // {x__} = 8.0/screenWidthInPixels"," // {_y_} = 8.0/screenHeightInPixels"," // {_z_} = -4.0/screenWidthInPixels"," // {__w} = -4.0/screenHeightInPixels"," FxaaFloat4 fxaaConsole360RcpFrameOpt2,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_SUBPIX define."," // It is here now to allow easier tuning."," // Choose the amount of sub-pixel aliasing removal."," // This can effect sharpness."," // 1.00 - upper limit (softer)"," // 0.75 - default amount of filtering"," // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)"," // 0.25 - almost off"," // 0.00 - completely off"," FxaaFloat fxaaQualitySubpix,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // The minimum amount of local contrast required to apply algorithm."," // 0.333 - too little (faster)"," // 0.250 - low quality"," // 0.166 - default"," // 0.125 - high quality"," // 0.063 - overkill (slower)"," FxaaFloat fxaaQualityEdgeThreshold,"," //"," // Only used on FXAA Quality."," // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // 0.0833 - upper limit (default, the start of visible unfiltered edges)"," // 0.0625 - high quality (faster)"," // 0.0312 - visible limit (slower)"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaQualityEdgeThresholdMin,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3."," // Due to the PS3 being ALU bound,"," // there are only three safe values here: 2 and 4 and 8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // For all other platforms can be a non-power of two."," // 8.0 is sharper (default!!!)"," // 4.0 is softer"," // 2.0 is really soft (good only for vector graphics inputs)"," FxaaFloat fxaaConsoleEdgeSharpness,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define."," // It is here now to allow easier tuning."," // This does not effect PS3, as this needs to be compiled in."," // Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3."," // Due to the PS3 being ALU bound,"," // there are only two safe values here: 1/4 and 1/8."," // These options use the shaders ability to a free *|/ by 2|4|8."," // The console setting has a different mapping than the quality setting."," // Other platforms can use other values."," // 0.125 leaves less aliasing, but is softer (default!!!)"," // 0.25 leaves more aliasing, and is sharper"," FxaaFloat fxaaConsoleEdgeThreshold,"," //"," // Only used on FXAA Console."," // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define."," // It is here now to allow easier tuning."," // Trims the algorithm from processing darks."," // The console setting has a different mapping than the quality setting."," // This only applies when FXAA_EARLY_EXIT is 1."," // This does not apply to PS3,"," // PS3 was simplified to avoid more shader instructions."," // 0.06 - faster but more aliasing in darks"," // 0.05 - default"," // 0.04 - slower and less aliasing in darks"," // Special notes when using FXAA_GREEN_AS_LUMA,"," // Likely want to set this to zero."," // As colors that are mostly not-green"," // will appear very dark in the green channel!"," // Tune by looking at mostly non-green content,"," // then start at zero and increase until aliasing is a problem."," FxaaFloat fxaaConsoleEdgeThresholdMin,"," //"," // Extra constants for 360 FXAA Console only."," // Use zeros or anything else for other platforms."," // These must be in physical constant registers and NOT immediates."," // Immediates will result in compiler un-optimizing."," // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)"," FxaaFloat4 fxaaConsole360ConstDir",") {","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posM;"," posM.x = pos.x;"," posM.y = pos.y;"," #if (FXAA_GATHER4_ALPHA == 1)"," #if (FXAA_DISCARD == 0)"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #endif"," #if (FXAA_GREEN_AS_LUMA == 0)"," FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));"," #else"," FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);"," FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));"," #endif"," #if (FXAA_DISCARD == 1)"," #define lumaM luma4A.w"," #endif"," #define lumaE luma4A.z"," #define lumaS luma4A.x"," #define lumaSE luma4A.y"," #define lumaNW luma4B.w"," #define lumaN luma4B.z"," #define lumaW luma4B.x"," #else"," FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);"," #if (FXAA_GREEN_AS_LUMA == 0)"," #define lumaM rgbyM.w"," #else"," #define lumaM rgbyM.y"," #endif"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));"," #endif"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat maxSM = max(lumaS, lumaM);"," FxaaFloat minSM = min(lumaS, lumaM);"," FxaaFloat maxESM = max(lumaE, maxSM);"," FxaaFloat minESM = min(lumaE, minSM);"," FxaaFloat maxWN = max(lumaN, lumaW);"," FxaaFloat minWN = min(lumaN, lumaW);"," FxaaFloat rangeMax = max(maxWN, maxESM);"," FxaaFloat rangeMin = min(minWN, minESM);"," FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;"," FxaaFloat range = rangeMax - rangeMin;"," FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);"," FxaaBool earlyExit = range < rangeMaxClamped;","/*--------------------------------------------------------------------------*/"," if(earlyExit)"," #if (FXAA_DISCARD == 1)"," FxaaDiscard;"," #else"," return rgbyM;"," #endif","/*--------------------------------------------------------------------------*/"," #if (FXAA_GATHER4_ALPHA == 0)"," #if (FXAA_GLSL_100 == 1)"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));"," #else"," FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif"," #else"," FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));"," FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));"," #endif","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNS = lumaN + lumaS;"," FxaaFloat lumaWE = lumaW + lumaE;"," FxaaFloat subpixRcpRange = 1.0/range;"," FxaaFloat subpixNSWE = lumaNS + lumaWE;"," FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;"," FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNESE = lumaNE + lumaSE;"," FxaaFloat lumaNWNE = lumaNW + lumaNE;"," FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;"," FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;","/*--------------------------------------------------------------------------*/"," FxaaFloat lumaNWSW = lumaNW + lumaSW;"," FxaaFloat lumaSWSE = lumaSW + lumaSE;"," FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);"," FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);"," FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;"," FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;"," FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;"," FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;","/*--------------------------------------------------------------------------*/"," FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;"," FxaaFloat lengthSign = fxaaQualityRcpFrame.x;"," FxaaBool horzSpan = edgeHorz >= edgeVert;"," FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;","/*--------------------------------------------------------------------------*/"," if(!horzSpan) lumaN = lumaW;"," if(!horzSpan) lumaS = lumaE;"," if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;"," FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;","/*--------------------------------------------------------------------------*/"," FxaaFloat gradientN = lumaN - lumaM;"," FxaaFloat gradientS = lumaS - lumaM;"," FxaaFloat lumaNN = lumaN + lumaM;"," FxaaFloat lumaSS = lumaS + lumaM;"," FxaaBool pairN = abs(gradientN) >= abs(gradientS);"," FxaaFloat gradient = max(abs(gradientN), abs(gradientS));"," if(pairN) lengthSign = -lengthSign;"," FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posB;"," posB.x = posM.x;"," posB.y = posM.y;"," FxaaFloat2 offNP;"," offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;"," offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;"," if(!horzSpan) posB.x += lengthSign * 0.5;"," if( horzSpan) posB.y += lengthSign * 0.5;","/*--------------------------------------------------------------------------*/"," FxaaFloat2 posN;"," posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;"," posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;"," FxaaFloat2 posP;"," posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;"," posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;"," FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;"," FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));"," FxaaFloat subpixE = subpixC * subpixC;"," FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));","/*--------------------------------------------------------------------------*/"," if(!pairN) lumaNN = lumaSS;"," FxaaFloat gradientScaled = gradient * 1.0/4.0;"," FxaaFloat lumaMM = lumaM - lumaNN * 0.5;"," FxaaFloat subpixF = subpixD * subpixE;"," FxaaBool lumaMLTZero = lumaMM < 0.0;","/*--------------------------------------------------------------------------*/"," lumaEndN -= lumaNN * 0.5;"," lumaEndP -= lumaNN * 0.5;"," FxaaBool doneN = abs(lumaEndN) >= gradientScaled;"," FxaaBool doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;"," FxaaBool doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;","/*--------------------------------------------------------------------------*/"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 3)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 4)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 5)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 6)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 7)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 8)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 9)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 10)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 11)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;","/*--------------------------------------------------------------------------*/"," #if (FXAA_QUALITY_PS > 12)"," if(doneNP) {"," if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));"," if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));"," if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;"," if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;"," doneN = abs(lumaEndN) >= gradientScaled;"," doneP = abs(lumaEndP) >= gradientScaled;"," if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;"," if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;"," doneNP = (!doneN) || (!doneP);"," if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;"," if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }"," #endif","/*--------------------------------------------------------------------------*/"," }","/*--------------------------------------------------------------------------*/"," FxaaFloat dstN = posM.x - posN.x;"," FxaaFloat dstP = posP.x - posM.x;"," if(!horzSpan) dstN = posM.y - posN.y;"," if(!horzSpan) dstP = posP.y - posM.y;","/*--------------------------------------------------------------------------*/"," FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;"," FxaaFloat spanLength = (dstP + dstN);"," FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;"," FxaaFloat spanLengthRcp = 1.0/spanLength;","/*--------------------------------------------------------------------------*/"," FxaaBool directionN = dstN < dstP;"," FxaaFloat dst = min(dstN, dstP);"," FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;"," FxaaFloat subpixG = subpixF * subpixF;"," FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;"," FxaaFloat subpixH = subpixG * fxaaQualitySubpix;","/*--------------------------------------------------------------------------*/"," FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;"," FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);"," if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;"," if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;"," #if (FXAA_DISCARD == 1)"," return FxaaTexTop(tex, posM);"," #else"," return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);"," #endif","}","/*==========================================================================*/","#endif","","void main() {"," gl_FragColor = FxaaPixelShader("," vUv,"," vec4(0.0),"," tDiffuse,"," tDiffuse,"," tDiffuse,"," resolution,"," vec4(0.0),"," vec4(0.0),"," vec4(0.0),"," 0.75,"," 0.166,"," 0.0833,"," 0.0,"," 0.0,"," 0.0,"," vec4(0.0)"," );",""," // TODO avoid querying texture twice for same texel"," gl_FragColor.a = texture2D(tDiffuse, vUv).a;","}"].join("\n")},Gr={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new at(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new Lt},cameraInverseProjectionMatrix:{value:new Lt},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","varying vec2 vUv;","#if DIFFUSE_TEXTURE == 1","uniform sampler2D tDiffuse;","#endif","uniform sampler2D tDepth;","#if NORMAL_TEXTURE == 1","uniform sampler2D tNormal;","#endif","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float scale;","uniform float intensity;","uniform float bias;","uniform float kernelRadius;","uniform float minResolution;","uniform vec2 size;","uniform float randomSeed;","// RGBA depth","#include <packing>","vec4 getDefaultColor( const in vec2 screenPosition ) {","\t#if DIFFUSE_TEXTURE == 1","\treturn texture2D( tDiffuse, vUv );","\t#else","\treturn vec4( 1.0 );","\t#endif","}","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {","\tfloat clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];","\tvec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );","\tclipPosition *= clipW; // unprojection.","\treturn ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {","\t#if NORMAL_TEXTURE == 1","\treturn unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","\t#else","\treturn normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );","\t#endif","}","float scaleDividedByCameraFar;","float minResolutionMultipliedByCameraFar;","float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {","\tvec3 viewDelta = sampleViewPosition - centerViewPosition;","\tfloat viewDistance = length( viewDelta );","\tfloat scaledScreenDistance = scaleDividedByCameraFar * viewDistance;","\treturn max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );","}","// moving costly divides into consts","const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );","const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );","float getAmbientOcclusion( const in vec3 centerViewPosition ) {","\t// precompute some variables require in getOcclusion.","\tscaleDividedByCameraFar = scale / cameraFar;","\tminResolutionMultipliedByCameraFar = minResolution * cameraFar;","\tvec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );","\t// jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/","\tfloat angle = rand( vUv + randomSeed ) * PI2;","\tvec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;","\tvec2 radiusStep = radius;","\tfloat occlusionSum = 0.0;","\tfloat weightSum = 0.0;","\tfor( int i = 0; i < NUM_SAMPLES; i ++ ) {","\t\tvec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;","\t\tradius += radiusStep;","\t\tangle += ANGLE_STEP;","\t\tfloat sampleDepth = getDepth( sampleUv );","\t\tif( sampleDepth >= ( 1.0 - EPSILON ) ) {","\t\t\tcontinue;","\t\t}","\t\tfloat sampleViewZ = getViewZ( sampleDepth );","\t\tvec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );","\t\tocclusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );","\t\tweightSum += 1.0;","\t}","\tif( weightSum == 0.0 ) discard;","\treturn occlusionSum * ( intensity / weightSum );","}","void main() {","\tfloat centerDepth = getDepth( vUv );","\tif( centerDepth >= ( 1.0 - EPSILON ) ) {","\t\tdiscard;","\t}","\tfloat centerViewZ = getViewZ( centerDepth );","\tvec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );","\tfloat ambientOcclusion = getAmbientOcclusion( viewPosition );","\tgl_FragColor = getDefaultColor( vUv );","\tgl_FragColor.xyz *= 1.0 - ambientOcclusion;","}"].join("\n")},zr={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new at(512,512)},sampleUvOffsets:{value:[new at(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:["#include <common>","uniform vec2 size;","varying vec2 vUv;","varying vec2 vInvSize;","void main() {","\tvUv = uv;","\tvInvSize = 1.0 / size;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#include <common>","#include <packing>","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","uniform float depthCutoff;","uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];","uniform float sampleWeights[ KERNEL_RADIUS + 1 ];","varying vec2 vUv;","varying vec2 vInvSize;","float getDepth( const in vec2 screenPosition ) {","\t#if DEPTH_PACKING == 1","\treturn unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );","\t#else","\treturn texture2D( tDepth, screenPosition ).x;","\t#endif","}","float getViewZ( const in float depth ) {","\t#if PERSPECTIVE_CAMERA == 1","\treturn perspectiveDepthToViewZ( depth, cameraNear, cameraFar );","\t#else","\treturn orthographicDepthToViewZ( depth, cameraNear, cameraFar );","\t#endif","}","void main() {","\tfloat depth = getDepth( vUv );","\tif( depth >= ( 1.0 - EPSILON ) ) {","\t\tdiscard;","\t}","\tfloat centerViewZ = -getViewZ( depth );","\tbool rBreak = false, lBreak = false;","\tfloat weightSum = sampleWeights[0];","\tvec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;","\tfor( int i = 1; i <= KERNEL_RADIUS; i ++ ) {","\t\tfloat sampleWeight = sampleWeights[i];","\t\tvec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;","\t\tvec2 sampleUv = vUv + sampleUvOffset;","\t\tfloat viewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;","\t\tif( ! rBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t\tsampleUv = vUv - sampleUvOffset;","\t\tviewZ = -getViewZ( getDepth( sampleUv ) );","\t\tif( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;","\t\tif( ! lBreak ) {","\t\t\tdiffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;","\t\t\tweightSum += sampleWeight;","\t\t}","\t}","\tgl_FragColor = diffuseSum / weightSum;","}"].join("\n")},Br={createSampleWeights:function(t,n){for(var e,i,r=[],a=0;a<=t;a++)r.push((e=a,i=n,Math.exp(-e*e/(i*i*2))/(Math.sqrt(2*Math.PI)*i)));return r},createSampleOffsets:function(t,n){for(var e=[],i=0;i<=t;i++)e.push(n.clone().multiplyScalar(i));return e},configure:function(t,n,e,i){t.defines.KERNEL_RADIUS=n,t.uniforms.sampleUvOffsets.value=Br.createSampleOffsets(n,i),t.uniforms.sampleWeights.value=Br.createSampleWeights(n,e),t.needsUpdate=!0}},kr={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {","\tvUv = uv;","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include <packing>","void main() {","\tfloat depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );","\tgl_FragColor = vec4( vec3( depth ), opacity );","}"].join("\n")};function Vr(t,n,e,i,r,a,o,s,h,l){if(1026!==(l=void 0!==l?l:1026)&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");Un.call(this,null,i,r,a,o,s,l,e=void 0===(e=void 0===e&&1026===l?1012:e)&&1027===l?1020:e,h),this.image={width:t,height:n},this.magFilter=void 0!==o?o:v,this.minFilter=void 0!==s?s:v,this.flipY=!1,this.generateMipmaps=!1}((Vr.prototype=Object.create(Un.prototype)).constructor=Vr).prototype.isDepthTexture=!0;function Yr(t,n,e,i,r){je.call(this),this.scene=t,this.camera=n,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=void 0!==e&&e,this.supportsNormalTexture=void 0!==i&&i,this.originalClearColor=new I,this.oldClearColor=new I,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=void 0!==r?new at(r.x,r.y):new at(256,256),this.saoRenderTarget=new Je(this.resolution.x,this.resolution.y,{minFilter:P,magFilter:P,format:g}),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new Je(this.resolution.x,this.resolution.y,{minFilter:v,magFilter:v,format:g}),this.depthRenderTarget=this.normalRenderTarget.clone(),this.supportsDepthTextureExtension&&((e=new Vr).type=1012,e.minFilter=v,e.maxFilter=v,this.beautyRenderTarget.depthTexture=e,this.beautyRenderTarget.depthBuffer=!0),this.depthMaterial=new Sn,this.depthMaterial.depthPacking=3201,this.depthMaterial.blending=0,this.normalMaterial=new An,this.normalMaterial.blending=0,this.saoMaterial=new vn({defines:Object.assign({},Gr.defines),fragmentShader:Gr.fragmentShader,vertexShader:Gr.vertexShader,uniforms:un.clone(Gr.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?e:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(this.camera.projectionMatrix),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=0,this.vBlurMaterial=new vn({uniforms:un.clone(zr.uniforms),defines:Object.assign({},zr.defines),vertexShader:zr.vertexShader,fragmentShader:zr.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?e:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=0,this.hBlurMaterial=new vn({uniforms:un.clone(zr.uniforms),defines:Object.assign({},zr.defines),vertexShader:zr.vertexShader,fragmentShader:zr.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?e:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=0,this.materialCopy=new vn({uniforms:un.clone(qe.uniforms),vertexShader:qe.vertexShader,fragmentShader:qe.fragmentShader,blending:0}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=5,this.materialCopy.blendSrc=208,this.materialCopy.blendDst=200,this.materialCopy.blendEquation=a,this.materialCopy.blendSrcAlpha=206,this.materialCopy.blendDstAlpha=200,this.materialCopy.blendEquationAlpha=a,this.depthCopy=new vn({uniforms:un.clone(kr.uniforms),vertexShader:kr.vertexShader,fragmentShader:kr.fragmentShader,blending:0}),this.fsQuad=new je.FullScreenQuad(null)}function jr(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}Yr.OUTPUT={Beauty:1,Default:0,SAO:2,Depth:3,Normal:4},Yr.prototype=Object.assign(Object.create(je.prototype),{constructor:Yr,render:function(t,n,e){var i,r;this.renderToScreen&&(this.materialCopy.blending=0,this.materialCopy.uniforms.tDiffuse.value=e.texture,this.materialCopy.needsUpdate=!0,this.renderPass(t,this.materialCopy,null)),1!==this.params.output&&(this.oldClearColor.copy(t.getClearColor()),this.oldClearAlpha=t.getClearAlpha(),i=t.autoClear,t.autoClear=!1,t.setRenderTarget(this.depthRenderTarget),t.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far,r=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near),this.vBlurMaterial.uniforms.depthCutoff.value=r,this.hBlurMaterial.uniforms.depthCutoff.value=r,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),this.prevStdDev===this.params.saoBlurStdDev&&this.prevNumSamples===this.params.saoBlurRadius||(Br.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new at(0,1)),Br.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new at(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),t.setClearColor(0),t.setRenderTarget(this.beautyRenderTarget),t.clear(),t.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(t,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(t,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(t,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(t,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(t,this.hBlurMaterial,this.saoRenderTarget,16777215,1)),r=this.materialCopy,3===this.params.output?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,r=this.depthCopy):(4===this.params.output?this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture:this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),0===this.params.output?r.blending=5:r.blending=0,this.renderPass(t,r,this.renderToScreen?null:e),t.setClearColor(this.oldClearColor,this.oldClearAlpha),t.autoClear=i)},renderPass:function(t,n,e,i,r){this.originalClearColor.copy(t.getClearColor());var a=t.getClearAlpha(),o=t.autoClear;t.setRenderTarget(e),t.autoClear=!1,null!=i&&(t.setClearColor(i),t.setClearAlpha(r||0),t.clear()),this.fsQuad.material=n,this.fsQuad.render(t),t.autoClear=o,t.setClearColor(this.originalClearColor),t.setClearAlpha(a)},renderOverride:function(t,n,e,i,r){this.originalClearColor.copy(t.getClearColor());var a=t.getClearAlpha(),o=t.autoClear;t.setRenderTarget(e),t.autoClear=!1,i=n.clearColor||i,r=n.clearAlpha||r,null!=i&&(t.setClearColor(i),t.setClearAlpha(r||0),t.clear()),this.scene.overrideMaterial=n,t.render(this.scene,this.camera),this.scene.overrideMaterial=null,t.autoClear=o,t.setClearColor(this.originalClearColor),t.setClearAlpha(a)},setSize:function(t,n){this.beautyRenderTarget.setSize(t,n),this.saoRenderTarget.setSize(t,n),this.blurIntermediateRenderTarget.setSize(t,n),this.normalRenderTarget.setSize(t,n),this.depthRenderTarget.setSize(t,n),this.saoMaterial.uniforms.size.value.set(t,n),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.getInverse(this.camera.projectionMatrix),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(t,n),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(t,n),this.hBlurMaterial.needsUpdate=!0}});ci=function(){function e(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.L=t,this.P=new ee,this.k=this.V(),this.R(n)}var t,n,i;return t=e,(n=[{key:"getAttribute",value:function(t){for(var n in this.Lt.params)if(n.toLowerCase()===("sao"+t).toLowerCase())return this.Lt.params[n]}},{key:"setAttribute",value:function(t,n){for(var e in this.Lt.params)e.toLowerCase()===("sao"+t).toLowerCase()&&(this.Lt.params[e]=n)}},{key:"add",value:function(t){this.P.add(t)}},{key:"enable",value:function(){this.k.sao=this}},{key:"disable",value:function(){this.k.sao=null}},{key:"render",value:function(){this.Pt.render()}}])&&jr(t.prototype,n),i&&jr(t,i),e}();Object.assign(ci.prototype,{V:function(){return"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne),this.L.getRenderManager()},R:function(t){this.Pt=new si(this.k.renderer),this.Et=new ni(Xr),this.Et.uniforms.resolution.value.set(1/this.L.getContainer().clientWidth,1/this.L.getContainer().clientHeight),this.Ft=new ti(this.P,this.L.getCamera()),this.Lt=new Yr(this.P,this.L.getCamera(),!1,!0),this.Lt.params.output=Yr.OUTPUT.Default,this.Lt.params.saoBias=t.bias||-.8,this.Lt.params.saoIntensity=t.intensity||12e-5,this.Lt.params.saoScale=t.scale||30,this.Lt.params.saoKernelRadius=t.radius||30,this.Lt.params.saoMinResolution=t.minResolution||0,this.Lt.params.saoBlurRadius=t.blurRadius||4.1,this.Lt.params.saoBlurStdDev=t.blurStdDev||4,this.Lt.params.saoBlurDepthCutoff=t.blurDepthCutoff||.01,this.Pt.addPass(this.Ft),this.Pt.addPass(this.Lt),this.Pt.addPass(this.Et)}});Di=ci;function Qr(){tn.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}function Wr(t,n){this.array=t,this.stride=n,this.count=void 0!==t?t.length/n:0,this.usage=y,this.updateRange={offset:0,count:-1},this.version=0}function Zr(t,n,e){Wr.call(this,t,n),this.meshPerAttribute=e||1}Qr.prototype=Object.assign(Object.create(tn.prototype),{constructor:Qr,isInstancedBufferGeometry:!0,copy:function(t){return tn.prototype.copy.call(this,t),this.maxInstancedCount=t.maxInstancedCount,this},clone:function(){return(new this.constructor).copy(this)}}),Object.defineProperty(Wr.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Wr.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,n,e){t*=this.stride,e*=n.stride;for(var i=0,r=this.stride;i<r;i++)this.array[t+i]=n.array[e+i];return this},set:function(t,n){return this.array.set(t,n=void 0===n?0:n),this},clone:function(){return(new this.constructor).copy(this)},onUpload:function(t){return this.onUploadCallback=t,this}}),Zr.prototype=Object.assign(Object.create(Wr.prototype),{constructor:Zr,isInstancedInterleavedBuffer:!0,copy:function(t){return Wr.prototype.copy.call(this,t),this.meshPerAttribute=t.meshPerAttribute,this}});var qr=new B;function Kr(t,n,e,i){this.data=t,this.itemSize=n,this.offset=e,this.normalized=!0===i}function Jr(t){tn.call(this),this.type="WireframeGeometry";var n,e,i,r,a,o,s=[],h=[0,0],l={},c=["a","b","c"];if(t&&t.isGeometry){for(var u=t.faces,f=0,d=u.length;f<d;f++)for(var v=u[f],m=0;m<3;m++)r=v[c[m]],a=v[c[(m+1)%3]],h[0]=Math.min(r,a),h[1]=Math.max(r,a),void 0===l[o=h[0]+","+h[1]]&&(l[o]={index1:h[0],index2:h[1]});for(o in l)i=l[o],A=t.vertices[i.index1],s.push(A.x,A.y,A.z),A=t.vertices[i.index2],s.push(A.x,A.y,A.z)}else if(t&&t.isBufferGeometry){var p,g,_,x,A=new B;if(null!==t.index){for(p=t.attributes.position,g=t.index,e=(_=(n=0)===(_=t.groups).length?[{start:0,count:g.count,materialIndex:0}]:_).length;n<e;++n)for(d=(f=(x=_[n]).start)+x.count;f<d;f+=3)for(m=0;m<3;m++)r=g.getX(f+m),a=g.getX(f+(m+1)%3),h[0]=Math.min(r,a),h[1]=Math.max(r,a),void 0===l[o=h[0]+","+h[1]]&&(l[o]={index1:h[0],index2:h[1]});for(o in l)i=l[o],A.fromBufferAttribute(p,i.index1),s.push(A.x,A.y,A.z),A.fromBufferAttribute(p,i.index2),s.push(A.x,A.y,A.z)}else for(f=0,d=(p=t.attributes.position).count/3;f<d;f++)for(m=0;m<3;m++)A.fromBufferAttribute(p,3*f+m),s.push(A.x,A.y,A.z),A.fromBufferAttribute(p,3*f+(m+1)%3),s.push(A.x,A.y,A.z)}this.setAttribute("position",new mt(s,3))}function $r(t){return($r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ta(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function na(t,n){return(na=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function ea(e){var i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,n=ia(e);return t=i?(t=ia(this).constructor,Reflect.construct(n,arguments,t)):n.apply(this,arguments),n=this,!(t=t)||"object"!==$r(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(n):t}}function ia(t){return(ia=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Object.defineProperties(Kr.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}}),Object.assign(Kr.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(t){for(var n=0,e=this.data.count;n<e;n++)qr.x=this.getX(n),qr.y=this.getY(n),qr.z=this.getZ(n),qr.applyMatrix4(t),this.setXYZ(n,qr.x,qr.y,qr.z);return this},setX:function(t,n){return this.data.array[t*this.data.stride+this.offset]=n,this},setY:function(t,n){return this.data.array[t*this.data.stride+this.offset+1]=n,this},setZ:function(t,n){return this.data.array[t*this.data.stride+this.offset+2]=n,this},setW:function(t,n){return this.data.array[t*this.data.stride+this.offset+3]=n,this},getX:function(t){return this.data.array[t*this.data.stride+this.offset]},getY:function(t){return this.data.array[t*this.data.stride+this.offset+1]},getZ:function(t){return this.data.array[t*this.data.stride+this.offset+2]},getW:function(t){return this.data.array[t*this.data.stride+this.offset+3]},setXY:function(t,n,e){return t=t*this.data.stride+this.offset,this.data.array[t+0]=n,this.data.array[t+1]=e,this},setXYZ:function(t,n,e,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=n,this.data.array[t+1]=e,this.data.array[t+2]=i,this},setXYZW:function(t,n,e,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=n,this.data.array[t+1]=e,this.data.array[t+2]=i,this.data.array[t+3]=r,this}}),(Jr.prototype=Object.create(tn.prototype)).constructor=Jr;var ra=function(){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&na(t,n)}(r,Qr);var t,n,e,i=ea(r);function r(){var t;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,r),(t=i.call(this)).type="LineSegmentsGeometry";return t.isLineSegmentsGeometry=!0,t.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),t.setAttribute("position",new mt([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),t.setAttribute("uv",new mt([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),t.setAttribute("uv2",new mt([0,0,1,0,0,1/3,1,1/3,0,2/3,1,2/3,0,1,1,1],2)),t}return t=r,(n=[{key:"applyMatrix",value:function(t){var n=this.attributes.instanceStart,e=this.attributes.instanceEnd;return void 0!==n&&(t.applyToBufferAttribute(n),t.applyToBufferAttribute(e),n.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(t){t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));var n=new Zr(n,6,1);return this.setAttribute("instanceStart",new Kr(n,3,0)),this.setAttribute("instanceEnd",new Kr(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(t){t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));var n=new Zr(n,6,1);return this.setAttribute("instanceColorStart",new Kr(n,3,0)),this.setAttribute("instanceColorEnd",new Kr(n,3,3)),this}},{key:"setUvys",value:function(t){t instanceof Float32Array?n=t:Array.isArray(t)&&(n=new Float32Array(t));var n=new Zr(n,2,1);return this.setAttribute("uvyStart",new Kr(n,1,0)),this.setAttribute("uvyEnd",new Kr(n,1,1)),this}},{key:"fromWireframeGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(t){return this.setPositions(t.attributes.position.array),this}},{key:"fromMesh",value:function(t){return this.fromWireframeGeometry(new Jr(t.geometry)),this}},{key:"fromLineSegements",value:function(t){t=t.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this}},{key:"computeBoundingBox",value:function(){var t=new et;null===this.boundingBox&&(this.boundingBox=new et);var n=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==n&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(n),t.setFromBufferAttribute(e),this.boundingBox.union(t))}},{key:"computeBoundingSphere",value:function(){var t=new B;null===this.boundingSphere&&(this.boundingSphere=new _t),null===this.boundingBox&&this.computeBoundingBox();var n=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==n&&void 0!==e){var i=this.boundingSphere.center;this.boundingBox.getCenter(i);for(var r=0,a=0,o=n.count;a<o;a++)t.fromBufferAttribute(n,a),r=Math.max(r,i.distanceToSquared(t)),t.fromBufferAttribute(e,a),r=Math.max(r,i.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error("fm.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"clone",value:function(){}},{key:"copy",value:function(t){return this}}])&&ta(t.prototype,n),e&&ta(t,e),r}();function aa(t){return(aa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function oa(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function sa(t,n){return(sa=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function ha(e){var i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,n=la(e);return t=i?(t=la(this).constructor,Reflect.construct(n,arguments,t)):n.apply(this,arguments),n=this,!(t=t)||"object"!==aa(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(n):t}}function la(t){return(la=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ca=function(){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&sa(t,n)}(r,ra);var t,n,e,i=ha(r);function r(){var t;return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,r),(t=i.call(this)).type="LineGeometry",t.isLineGeometry=!0,t}return t=r,(n=[{key:"setPositions",value:function(t){for(var n=t.length-3,e=new Float32Array(2*n),i=0;i<n;i+=3)e[2*i]=t[i],e[2*i+1]=t[i+1],e[2*i+2]=t[i+2],e[2*i+3]=t[i+3],e[2*i+4]=t[i+4],e[2*i+5]=t[i+5];return(new ra).setPositions.call(this,e),this}},{key:"setColors",value:function(t){for(var n=t.length-3,e=new Float32Array(2*n),i=0;i<n;i+=3)e[2*i]=t[i],e[2*i+1]=t[i+1],e[2*i+2]=t[i+2],e[2*i+3]=t[i+3],e[2*i+4]=t[i+4],e[2*i+5]=t[i+5];return(new ra).setColors.call(this,e),this}},{key:"fromLine",value:function(t){t=t.geometry;return t.isGeometry?this.setPositions(t.vertices):t.isBufferGeometry&&this.setPositions(t.position.array),this}},{key:"copy",value:function(t){return this}}])&&oa(t.prototype,n),e&&oa(t,e),r}(),ua={basic:{uniforms:cn([Ii.common,Ii.specularmap,Ii.envmap,Ii.aomap,Ii.lightmap,Ii.fog]),vertexShader:Ri.meshbasic_vert,fragmentShader:Ri.meshbasic_frag},lambert:{uniforms:cn([Ii.common,Ii.specularmap,Ii.envmap,Ii.aomap,Ii.lightmap,Ii.emissivemap,Ii.fog,Ii.lights,{emissive:{value:new I(0)}}]),vertexShader:Ri.meshlambert_vert,fragmentShader:Ri.meshlambert_frag},phong:{uniforms:cn([Ii.common,Ii.specularmap,Ii.envmap,Ii.aomap,Ii.lightmap,Ii.emissivemap,Ii.bumpmap,Ii.normalmap,Ii.displacementmap,Ii.fog,Ii.lights,{emissive:{value:new I(0)},specular:{value:new I(1118481)},shininess:{value:30}}]),vertexShader:Ri.meshphong_vert,fragmentShader:Ri.meshphong_frag},standard:{uniforms:cn([Ii.common,Ii.envmap,Ii.aomap,Ii.lightmap,Ii.emissivemap,Ii.bumpmap,Ii.normalmap,Ii.displacementmap,Ii.roughnessmap,Ii.metalnessmap,Ii.fog,Ii.lights,{emissive:{value:new I(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Ri.meshphysical_vert,fragmentShader:Ri.meshphysical_frag},toon:{uniforms:cn([Ii.common,Ii.specularmap,Ii.aomap,Ii.lightmap,Ii.emissivemap,Ii.bumpmap,Ii.normalmap,Ii.displacementmap,Ii.gradientmap,Ii.fog,Ii.lights,{emissive:{value:new I(0)},specular:{value:new I(1118481)},shininess:{value:30}}]),vertexShader:Ri.meshtoon_vert,fragmentShader:Ri.meshtoon_frag},matcap:{uniforms:cn([Ii.common,Ii.bumpmap,Ii.normalmap,Ii.displacementmap,Ii.fog,{matcap:{value:null}}]),vertexShader:Ri.meshmatcap_vert,fragmentShader:Ri.meshmatcap_frag},points:{uniforms:cn([Ii.points,Ii.fog]),vertexShader:Ri.points_vert,fragmentShader:Ri.points_frag},dashed:{uniforms:cn([Ii.common,Ii.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ri.linedashed_vert,fragmentShader:Ri.linedashed_frag},depth:{uniforms:cn([Ii.common,Ii.displacementmap]),vertexShader:Ri.depth_vert,fragmentShader:Ri.depth_frag},normal:{uniforms:cn([Ii.common,Ii.bumpmap,Ii.normalmap,Ii.displacementmap,{opacity:{value:1}}]),vertexShader:Ri.normal_vert,fragmentShader:Ri.normal_frag},sprite:{uniforms:cn([Ii.sprite,Ii.fog]),vertexShader:Ri.sprite_vert,fragmentShader:Ri.sprite_frag},background:{uniforms:{uvTransform:{value:new Dt},t2D:{value:null}},vertexShader:Ri.background_vert,fragmentShader:Ri.background_frag},cube:{uniforms:cn([Ii.envmap,{opacity:{value:1}}]),vertexShader:Ri.cube_vert,fragmentShader:Ri.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ri.equirect_vert,fragmentShader:Ri.equirect_frag},distanceRGBA:{uniforms:cn([Ii.common,Ii.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ri.distanceRGBA_vert,fragmentShader:Ri.distanceRGBA_frag},shadow:{uniforms:cn([Ii.lights,Ii.fog,{color:{value:new I(0)},opacity:{value:1}}]),vertexShader:Ri.shadow_vert,fragmentShader:Ri.shadow_frag}};ua.physical={uniforms:cn([ua.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new at(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new I(0)},transparency:{value:0}}]),vertexShader:Ri.meshphysical_vert,fragmentShader:Ri.meshphysical_frag},Ii.line2={linewidth:{value:1},resolution:{value:new at(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},ua.line2={uniforms:un.merge([Ii.common,Ii.fog,Ii.line2]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <premultiplied_alpha_fragment>\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\n\t\t}\n\t\t"};function fa(t){vn.call(this,{type:"LineMaterial",uniforms:un.clone(ua.line2.uniforms),vertexShader:ua.line2.vertexShader,fragmentShader:ua.line2.fragmentShader,clipping:!0}),this.dashed=!1,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},lineWidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}}),this.setValues(t)}function da(t){return(da="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function va(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function ma(t,n){return(ma=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function pa(e){var i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,n=ga(e);return t=i?(t=ga(this).constructor,Reflect.construct(n,arguments,t)):n.apply(this,arguments),n=this,!(t=t)||"object"!==da(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(n):t}}function ga(t){return(ga=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}((fa.prototype=Object.create(vn.prototype)).constructor=fa).prototype.isLineMaterial=!0;var _a=function(){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&ma(t,n)}(r,Be);var t,n,e,i=pa(r);function r(t,n){return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,r),(n=i.call(this,t,n)).type="LineSegments2",n.isLineSegments2=!0,n}return t=r,(n=[{key:"computeLineDistances",value:function(){for(var t=new B,n=new B,e=this.geometry,i=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*i.data.count),o=0,s=0,h=i.data.count;o<h;o++,s+=2)t.fromBufferAttribute(i,o),n.fromBufferAttribute(r,o),a[s]=0===s?0:a[s-1],a[s+1]=a[s]+t.distanceTo(n);var l=new Zr(a,2,1);return e.setAttribute("instanceDistanceStart",new Kr(l,1,0)),e.setAttribute("instanceDistanceEnd",new Kr(l,1,1)),this}},{key:"copy",value:function(t){return this}}])&&va(t.prototype,n),e&&va(t,e),r}();function xa(t){return(xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Aa(t,n){return(Aa=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function wa(e){var i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,n=Sa(e);return t=i?(t=Sa(this).constructor,Reflect.construct(n,arguments,t)):n.apply(this,arguments),n=this,!(t=t)||"object"!==xa(t)&&"function"!=typeof t?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(n):t}}function Sa(t){return(Sa=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ya=function(){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&Aa(t,n)}(i,_a);var e=wa(i);function i(t,n){return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,i),(n=e.call(this,t,n)).type="Line2",n.isLine2=!0,n}return i}();function Ma(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}ci=function(){function e(t,n){!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.L=t,this.parent=null,this.P=new ee,this.P.add(new Xi(7631988)),this.R(n)}var t,n,i;return t=e,(n=[{key:"getColor",value:function(){return this.Nt}},{key:"setColor",value:function(t){this.Nt=t,this.Dt()}},{key:"getBackgroundColor",value:function(){return this.Ct}},{key:"setBackgroundColor",value:function(t){this.Ct=t,this.Dt()}},{key:"getLineWidth",value:function(){return this.It}},{key:"setLineWidth",value:function(t){this.Rt=t,this.P.children[1].material.lineWidth=t}},{key:"getSpeed",value:function(){return this.Ut}},{key:"setSpeed",value:function(t){this.Ut=t,this.P.children[1].userData.speed=t}},{key:"addTo",value:function(t){this.P.position.y=t.height,this.parent=t,this.U(),this.L.getRenderManager().flowlines.set(this.P.uuid,this)}},{key:"remove",value:function(){this.L.getRenderManager().flowlines.delete(this.P.uuid)}},{key:"getScene",value:function(){return this.P}},{key:"render",value:function(){var t,n,e,i;(new Date).getTime()-this.P.children[1].userData.time>20/this.P.children[1].userData.speed&&(n=(t=this.P.children[1].userData.colors).pop(),e=t.pop(),i=t.pop(),t.splice(0,0,n),t.splice(0,0,e),t.splice(0,0,i),this.P.children[1].geometry.setColors(t),this.P.children[1].userData.time=(new Date).getTime()),this.L.getRenderManager().renderer.render(this.P,this.L.getCamera())}}])&&Ma(t.prototype,n),i&&Ma(t,i),e}();Object.assign(ci.prototype,{U:function(){"basic"===this.L.getRenderManager().type&&this.L.setRenderManager(new ne)},R:function(t){this.Ot=void 0!==t.lineLength?t.lineLength:5,this.Ht={x:this.L.getX(),y:this.L.getY()},this.Xt=this.Gt(t.points),this.zt=this.Bt(t.points),this.Ct=t.backgroundColor,this.Nt=t.color,this.kt=this.Vt(),this.Yt=t.opacity,this.It=t.lineWidth,this.Ut=t.speed;var n=new ca;n.setPositions(this.zt),n.setColors(this.kt);t=new fa({lineWidth:this.It,vertexColors:!0});t.uniforms.opacity.value=this.Yt,t.resolution.set(this.L.getContainer().clientWidth,this.L.getContainer().clientHeight);t=new ya(n,t);t.userData.colors=this.kt,t.userData.speed=this.Ut,t.userData.time=(new Date).getTime(),this.P.add(t)},Gt:function(t){for(var n=0,e=0;e<t.length;e+=3){var i=new B(t[e],t[e+2],-t[e+1]),r=new B(t[e+3],t[e+5],-t[e+4]),a=i.distanceToSquared(r);0===e?n=i.distanceToSquared(r):a<n&&(n=a)}return Math.sqrt(n)},Bt:function(t){for(var n=[],e=0;e<t.length-3;e+=3)for(var i=new B(t[e]-this.Ht.x,t[e+2],-t[e+1]+this.Ht.y),r=new B(t[e+3]-this.Ht.x,t[e+5],-t[e+4]+this.Ht.y),a=new sr(i,r),r=i.distanceTo(r),r=Math.ceil(r/(this.Xt*this.Ot)),o=a.getPoints(10*r),s=0;s<o.length;s++)n.push(o[s].x,o[s].y,o[s].z);return n},Vt:function(){for(var t=[],n=new I(this.Nt),e=new I(this.Ct),i=0;i<this.zt.length/3;i++)3*i<3*this.Ot?t.push(n.r,n.g,n.b):t.push(e.r,e.g,e.b);return t},Dt:function(){this.kt=this.Vt(),this.P.children[1].geometry.setColors(this.kt),this.P.children[1].userData.colors=this.kt}});var Ta,ba={FMParticle:ae,FMRain:vi,FMSky:Ci,FMWater:re,FMBloom:di,FMSweep:e,FMSAO:Di,FMFlowline:ci};for(Ta in ba)window.fengmap[Ta]=ba[Ta];n.default=fengmap}],r.c=i,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"jt",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.jt)return n;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var i in n)r.d(e,i,function(t){return n[t]}.bind(null,i));return e},r.n=function(t){var n=t&&t.jt?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=0).default;function r(t){if(i[t])return i[t].exports;var n=i[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,r),n.l=!0,n.exports}var e,i});